posthog-js 1.17.0 → 1.17.4

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 CHANGED
@@ -1,3 +1,19 @@
1
+ ## 1.17.4 - 2022-01-27
2
+
3
+ - Fix featureflags not working when /decide is down (#359)
4
+
5
+ ## 1.17.3 - 2022-01-20
6
+
7
+ - Add an allow list to skip truncating strings when capturing events (#355)
8
+
9
+ ## 1.17.2 - 2022-01-20
10
+
11
+ - remove debug option (#357)
12
+
13
+ ## 1.17.1 - 2022-01-13
14
+
15
+ - Reduce the size of the APM performance data payload (#354)
16
+
1
17
  ## 1.17.0 - 2022-01-10
2
18
 
3
19
  - Send APM data so that we don't need a plugin (#352)
package/dist/array.js CHANGED
@@ -1,11 +1,11 @@
1
1
  parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"zdbk":[function(require,module,exports) {
2
2
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.LZString=void 0;var o=String.fromCharCode,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",n={};function t(o,r){if(!n[o]){n[o]={};for(var e=0;e<o.length;e++)n[o][o.charAt(e)]=e}return n[o][r]}var s={compressToBase64:function(o){if(null==o)return"";var e=s._compress(o,6,function(o){return r.charAt(o)});switch(e.length%4){default:case 0:return e;case 1:return e+"===";case 2:return e+"==";case 3:return e+"="}},decompressFromBase64:function(o){return null==o?"":""==o?null:s._decompress(o.length,32,function(e){return t(r,o.charAt(e))})},compressToUTF16:function(r){return null==r?"":s._compress(r,15,function(r){return o(r+32)})+" "},decompressFromUTF16:function(o){return null==o?"":""==o?null:s._decompress(o.length,16384,function(r){return o.charCodeAt(r)-32})},compressToUint8Array:function(o){for(var r=s.compress(o),e=new Uint8Array(2*r.length),n=0,t=r.length;n<t;n++){var i=r.charCodeAt(n);e[2*n]=i>>>8,e[2*n+1]=i%256}return e},decompressFromUint8Array:function(r){if(null==r)return s.decompress(r);for(var e=new Array(r.length/2),n=0,t=e.length;n<t;n++)e[n]=256*r[2*n]+r[2*n+1];var i=[];return e.forEach(function(r){i.push(o(r))}),s.decompress(i.join(""))},compressToEncodedURIComponent:function(o){return null==o?"":s._compress(o,6,function(o){return e.charAt(o)})},decompressFromEncodedURIComponent:function(o){return null==o?"":""==o?null:(o=o.replace(/ /g,"+"),s._decompress(o.length,32,function(r){return t(e,o.charAt(r))}))},compress:function(r){return s._compress(r,16,function(r){return o(r)})},_compress:function(o,r,e){if(null==o)return"";var n,t,s,i={},p={},c="",a="",u="",l=2,f=3,h=2,d=[],m=0,v=0;for(s=0;s<o.length;s+=1)if(c=o.charAt(s),Object.prototype.hasOwnProperty.call(i,c)||(i[c]=f++,p[c]=!0),a=u+c,Object.prototype.hasOwnProperty.call(i,a))u=a;else{if(Object.prototype.hasOwnProperty.call(p,u)){if(u.charCodeAt(0)<256){for(n=0;n<h;n++)m<<=1,v==r-1?(v=0,d.push(e(m)),m=0):v++;for(t=u.charCodeAt(0),n=0;n<8;n++)m=m<<1|1&t,v==r-1?(v=0,d.push(e(m)),m=0):v++,t>>=1}else{for(t=1,n=0;n<h;n++)m=m<<1|t,v==r-1?(v=0,d.push(e(m)),m=0):v++,t=0;for(t=u.charCodeAt(0),n=0;n<16;n++)m=m<<1|1&t,v==r-1?(v=0,d.push(e(m)),m=0):v++,t>>=1}0==--l&&(l=Math.pow(2,h),h++),delete p[u]}else for(t=i[u],n=0;n<h;n++)m=m<<1|1&t,v==r-1?(v=0,d.push(e(m)),m=0):v++,t>>=1;0==--l&&(l=Math.pow(2,h),h++),i[a]=f++,u=String(c)}if(""!==u){if(Object.prototype.hasOwnProperty.call(p,u)){if(u.charCodeAt(0)<256){for(n=0;n<h;n++)m<<=1,v==r-1?(v=0,d.push(e(m)),m=0):v++;for(t=u.charCodeAt(0),n=0;n<8;n++)m=m<<1|1&t,v==r-1?(v=0,d.push(e(m)),m=0):v++,t>>=1}else{for(t=1,n=0;n<h;n++)m=m<<1|t,v==r-1?(v=0,d.push(e(m)),m=0):v++,t=0;for(t=u.charCodeAt(0),n=0;n<16;n++)m=m<<1|1&t,v==r-1?(v=0,d.push(e(m)),m=0):v++,t>>=1}0==--l&&(l=Math.pow(2,h),h++),delete p[u]}else for(t=i[u],n=0;n<h;n++)m=m<<1|1&t,v==r-1?(v=0,d.push(e(m)),m=0):v++,t>>=1;0==--l&&(l=Math.pow(2,h),h++)}for(t=2,n=0;n<h;n++)m=m<<1|1&t,v==r-1?(v=0,d.push(e(m)),m=0):v++,t>>=1;for(;;){if(m<<=1,v==r-1){d.push(e(m));break}v++}return d.join("")},decompress:function(o){return null==o?"":""==o?null:s._decompress(o.length,32768,function(r){return o.charCodeAt(r)})},_decompress:function(r,e,n){var t,s,i,p,c,a,u,l=[],f=4,h=4,d=3,m="",v=[],w={val:n(0),position:e,index:1};for(t=0;t<3;t+=1)l[t]=t;for(i=0,c=Math.pow(2,2),a=1;a!=c;)p=w.val&w.position,w.position>>=1,0==w.position&&(w.position=e,w.val=n(w.index++)),i|=(p>0?1:0)*a,a<<=1;switch(i){case 0:for(i=0,c=Math.pow(2,8),a=1;a!=c;)p=w.val&w.position,w.position>>=1,0==w.position&&(w.position=e,w.val=n(w.index++)),i|=(p>0?1:0)*a,a<<=1;u=o(i);break;case 1:for(i=0,c=Math.pow(2,16),a=1;a!=c;)p=w.val&w.position,w.position>>=1,0==w.position&&(w.position=e,w.val=n(w.index++)),i|=(p>0?1:0)*a,a<<=1;u=o(i);break;case 2:return""}for(l[3]=u,s=u,v.push(u);;){if(w.index>r)return"";for(i=0,c=Math.pow(2,d),a=1;a!=c;)p=w.val&w.position,w.position>>=1,0==w.position&&(w.position=e,w.val=n(w.index++)),i|=(p>0?1:0)*a,a<<=1;switch(u=i){case 0:for(i=0,c=Math.pow(2,8),a=1;a!=c;)p=w.val&w.position,w.position>>=1,0==w.position&&(w.position=e,w.val=n(w.index++)),i|=(p>0?1:0)*a,a<<=1;l[h++]=o(i),u=h-1,f--;break;case 1:for(i=0,c=Math.pow(2,16),a=1;a!=c;)p=w.val&w.position,w.position>>=1,0==w.position&&(w.position=e,w.val=n(w.index++)),i|=(p>0?1:0)*a,a<<=1;l[h++]=o(i),u=h-1,f--;break;case 2:return v.join("")}if(0==f&&(f=Math.pow(2,d),d++),l[u])m=l[u];else{if(u!==h)return null;m=s+s.charAt(0)}v.push(m),l[h++]=s+m.charAt(0),s=m,0==--f&&(f=Math.pow(2,d),d++)}}};exports.LZString=s;
3
3
  },{}],"EHrm":[function(require,module,exports) {
4
- module.exports={name:"posthog-js",version:"1.17.0",description:"Posthog-js allows you to automatically capture usage and send events to PostHog.",repository:"https://github.com/PostHog/posthog-js",author:"hey@posthog.com",license:"MIT",scripts:{start:"parcel watch src/loader-globals.js --out-file dist/array.js",serve:"parcel serve src/loader-globals.js --port 3001 --out-file dist/array.js",build:"yarn build-array && yarn build-module && yarn build-es-module && yarn process-types && yarn build-react","build-array":"parcel build src/loader-globals.js --out-file dist/array.js --no-source-maps","build-module":"rollup -i src/loader-module.js -f cjs -o dist/module.js -c rollup.config.js","build-es-module":"rollup -i src/loader-module.js -f es -o dist/es.js -c rollup.config.js","build-react":"cd react; yarn; yarn build;","process-types":"mkdir -p dist; eslint src --ext .ts -c .eslintrc.ts.js --fix && tsc && cp -f src/*.d.ts dist/",lint:"eslint src --fix",prepublishOnly:"yarn lint && yarn test && yarn build && yarn test-react",test:"jest src","test-react":"cd react; yarn test","test-watch":"jest --watch src",cypress:"cypress open"},main:"dist/module.js",module:"dist/es.js",files:["dist/*","react/dist/*"],dependencies:{"@sentry/types":"^6.11.0",fflate:"^0.4.1","rrweb-snapshot":"^1.1.7"},devDependencies:{"@babel/core":"7.12.10","@babel/preset-env":"7.12.11","@rollup/plugin-babel":"^5.2.1","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^8.1.0","@typescript-eslint/eslint-plugin":"^3.5.0","@typescript-eslint/parser":"^3.5.0","babel-eslint":"10.1.0","babel-jest":"^26.6.3",cypress:"^9.2.0",eslint:"7.3.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react":"^7.21.5","eslint-plugin-react-hooks":"^4.2.0","fast-check":"^2.17.0",given2:"^2.1.7",husky:"^4.2.5",jest:"^26.1.0",jsdom:"16.2.2","jsdom-global":"3.0.2","lint-staged":"^10.2.11",localStorage:"1.0.4","node-fetch":"^2.6.1",parcel:"^1.12.4","posthog-js":"link:.",prettier:"^2.0.5",rollup:"^2.18.2",rrweb:"^1.0.6",sinon:"9.0.2",testcafe:"^1.17.1","testcafe-browser-provider-browserstack":"^1.13.2-alpha.1",typescript:"^3.9.6"},husky:{hooks:{"pre-commit":"lint-staged"}},"lint-staged":{"*.{ts,tsx,js,json}":"prettier --write","*.{ts,tsx}":["eslint -c .eslintrc.ts.js --fix","tsc --noEmit --esModuleInterop --jsx react"]},jest:{testPathIgnorePatterns:["/node_modules/","/cypress/","/react/","/test_data/"],moduleFileExtensions:["js","json"],setupFilesAfterEnv:["given2/setup"],clearMocks:!0}};
4
+ module.exports={name:"posthog-js",version:"1.17.4",description:"Posthog-js allows you to automatically capture usage and send events to PostHog.",repository:"https://github.com/PostHog/posthog-js",author:"hey@posthog.com",license:"MIT",scripts:{start:"parcel watch src/loader-globals.js --out-file dist/array.js",serve:"parcel serve src/loader-globals.js --port 3001 --out-file dist/array.js",build:"yarn build-array && yarn build-module && yarn build-es-module && yarn process-types && yarn build-react","build-array":"parcel build src/loader-globals.js --out-file dist/array.js --no-source-maps","build-module":"rollup -i src/loader-module.js -f cjs -o dist/module.js -c rollup.config.js","build-es-module":"rollup -i src/loader-module.js -f es -o dist/es.js -c rollup.config.js","build-react":"cd react; yarn; yarn build;","process-types":"mkdir -p dist; eslint src --ext .ts -c .eslintrc.ts.js --fix && tsc && cp -f src/*.d.ts dist/",lint:"eslint src --fix",prepublishOnly:"yarn lint && yarn test && yarn build && yarn test-react",test:"jest src","test-react":"cd react; yarn test","test-watch":"jest --watch src",cypress:"cypress open"},main:"dist/module.js",module:"dist/es.js",files:["dist/*","react/dist/*"],dependencies:{"@sentry/types":"^6.11.0",fflate:"^0.4.1","rrweb-snapshot":"^1.1.7"},devDependencies:{"@babel/core":"7.12.10","@babel/preset-env":"7.12.11","@rollup/plugin-babel":"^5.2.1","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^8.1.0","@typescript-eslint/eslint-plugin":"^3.5.0","@typescript-eslint/parser":"^3.5.0","babel-eslint":"10.1.0","babel-jest":"^26.6.3",cypress:"^9.2.0",eslint:"7.3.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react":"^7.21.5","eslint-plugin-react-hooks":"^4.2.0","fast-check":"^2.17.0",given2:"^2.1.7",husky:"^4.2.5",jest:"^26.1.0",jsdom:"16.2.2","jsdom-global":"3.0.2","lint-staged":"^10.2.11",localStorage:"1.0.4","node-fetch":"^2.6.1",parcel:"^1.12.4","posthog-js":"link:.",prettier:"^2.0.5",rollup:"^2.18.2",rrweb:"^1.0.6",sinon:"9.0.2",testcafe:"^1.17.1","testcafe-browser-provider-browserstack":"^1.13.2-alpha.1",typescript:"^3.9.6"},husky:{hooks:{"pre-commit":"lint-staged"}},"lint-staged":{"*.{ts,tsx,js,json}":"prettier --write","*.{ts,tsx}":["eslint -c .eslintrc.ts.js --fix","tsc --noEmit --esModuleInterop --jsx react"]},jest:{testPathIgnorePatterns:["/node_modules/","/cypress/","/react/","/test_data/"],moduleFileExtensions:["js","json"],setupFilesAfterEnv:["given2/setup"],clearMocks:!0}};
5
5
  },{}],"itQ5":[function(require,module,exports) {
6
6
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=require("../package.json"),r={DEBUG:!1,LIB_VERSION:e.version},t=r;exports.default=t;
7
7
  },{"../package.json":"EHrm"}],"FOZT":[function(require,module,exports) {
8
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.COPY_IN_PROGRESS_ATTRIBUTE=exports.document=exports.console=exports.userAgent=exports._=exports.window=void 0;var e=n(require("./config"));function n(e){return e&&e.__esModule?e:{default:e}}var r=Array.prototype,o=Function.prototype,t=Object.prototype,i=r.slice,c=t.toString,a=t.hasOwnProperty,s="undefined"!=typeof window?window:{},u=s.navigator||{userAgent:""},d=s.document||{},l=u.userAgent;exports.userAgent=l,exports.document=d,exports.window=s;var f=o.bind,p=r.forEach,h=r.indexOf,w=Array.isArray,g={},v={trim:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}};exports._=v;var b={log:function(){if(e.default.DEBUG&&!v.isUndefined(window.console)&&window.console)try{window.console.log.apply(window.console,arguments)}catch(n){v.each(arguments,function(e){window.console.log(e)})}},error:function(){if(e.default.DEBUG&&!v.isUndefined(window.console)&&window.console){var n=["PostHog error:"].concat(Array.prototype.slice.call(arguments));try{window.console.error.apply(window.console,n)}catch(r){v.each(n,function(e){window.console.error(e)})}}},critical:function(){if(!v.isUndefined(window.console)&&window.console){var e=["PostHog error:"].concat(Array.prototype.slice.call(arguments));try{window.console.error.apply(window.console,e)}catch(n){v.each(e,function(e){window.console.error(e)})}}}};exports.console=b,v.bind=function(e,n){var r,o;if(f&&e.bind===f)return f.apply(e,i.call(arguments,1));if(!v.isFunction(e))throw new TypeError;return r=i.call(arguments,2),o=function(){if(!(this instanceof o))return e.apply(n,r.concat(i.call(arguments)));var t={};t.prototype=e.prototype;var c=new t;t.prototype=null;var a=e.apply(c,r.concat(i.call(arguments)));return Object(a)===a?a:c}},v.bind_instance_methods=function(e){for(var n in e)"function"==typeof e[n]&&(e[n]=v.bind(e[n],e))},v.each=function(e,n,r){if(null!=e)if(p&&e.forEach===p)e.forEach(n,r);else if(e.length===+e.length){for(var o=0,t=e.length;o<t;o++)if(o in e&&n.call(r,e[o],o,e)===g)return}else for(var i in e)if(a.call(e,i)&&n.call(r,e[i],i,e)===g)return},v.extend=function(e){return v.each(i.call(arguments,1),function(n){for(var r in n)void 0!==n[r]&&(e[r]=n[r])}),e},v.isArray=w||function(e){return"[object Array]"===c.call(e)},v.isFunction=function(e){try{return/^\s*\bfunction\b/.test(e)}catch(n){return!1}},v.include=function(e,n){var r=!1;return null===e?r:h&&e.indexOf===h?-1!=e.indexOf(n):(v.each(e,function(e){if(r||(r=e===n))return g}),r)},v.includes=function(e,n){return-1!==e.indexOf(n)},v.isObject=function(e){return e===Object(e)&&!v.isArray(e)},v.isEmptyObject=function(e){if(v.isObject(e)){for(var n in e)if(a.call(e,n))return!1;return!0}return!1},v.isUndefined=function(e){return void 0===e},v.isString=function(e){return"[object String]"==c.call(e)},v.isDate=function(e){return"[object Date]"==c.call(e)},v.isNumber=function(e){return"[object Number]"==c.call(e)},v.encodeDates=function(e){return v.each(e,function(n,r){v.isDate(n)?e[r]=v.formatDate(n):v.isObject(n)&&(e[r]=v.encodeDates(n))}),e},v.timestamp=function(){return Date.now=Date.now||function(){return+new Date},Date.now()},v.formatDate=function(e){function n(e){return e<10?"0"+e:e}return e.getUTCFullYear()+"-"+n(e.getUTCMonth()+1)+"-"+n(e.getUTCDate())+"T"+n(e.getUTCHours())+":"+n(e.getUTCMinutes())+":"+n(e.getUTCSeconds())},v.safewrap=function(n){return function(){try{return n.apply(this,arguments)}catch(r){b.critical("Implementation error. Please turn on debug and contact support@posthog.com."),e.default.DEBUG&&b.critical(r)}}},v.safewrap_class=function(e,n){for(var r=0;r<n.length;r++)e.prototype[n[r]]=v.safewrap(e.prototype[n[r]])},v.safewrap_instance_methods=function(e){for(var n in e)"function"==typeof e[n]&&(e[n]=v.safewrap(e[n]))},v.strip_empty_properties=function(e){var n={};return v.each(e,function(e,r){v.isString(e)&&e.length>0&&(n[r]=e)}),n};var y="undefined"!=typeof Symbol?Symbol("__deepCircularCopyInProgress__"):"__deepCircularCopyInProgress__";function m(e,n){return e!==Object(e)?n?n(e):e:e[y]?void 0:(e[y]=!0,v.isArray(e)?(r=[],v.each(e,function(e){r.push(m(e,n))})):(r={},v.each(e,function(e,o){o!==y&&(r[o]=m(e,n))})),delete e[y],r);var r}exports.COPY_IN_PROGRESS_ATTRIBUTE=y,v.copyAndTruncateStrings=function(e,n){return m(e,function(e){return"string"==typeof e&&null!==n&&(e=e.slice(0,n)),e},{})},v.base64Encode=function(e){var n,r,o,t,i,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=0,s=0,u="",d=[];if(!e)return e;e=v.utf8Encode(e);do{n=(i=e.charCodeAt(a++)<<16|e.charCodeAt(a++)<<8|e.charCodeAt(a++))>>18&63,r=i>>12&63,o=i>>6&63,t=63&i,d[s++]=c.charAt(n)+c.charAt(r)+c.charAt(o)+c.charAt(t)}while(a<e.length);switch(u=d.join(""),e.length%3){case 1:u=u.slice(0,-2)+"==";break;case 2:u=u.slice(0,-1)+"="}return u},v.utf8Encode=function(e){var n,r,o,t,i="";for(n=r=0,o=(e=(e+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,t=0;t<o;t++){var c=e.charCodeAt(t),a=null;c<128?r++:a=c>127&&c<2048?String.fromCharCode(c>>6|192,63&c|128):String.fromCharCode(c>>12|224,c>>6&63|128,63&c|128),null!==a&&(r>n&&(i+=e.substring(n,r)),i+=a,n=r=t+1)}return r>n&&(i+=e.substring(n,e.length)),i},v.UUID=function(){var e=function(){for(var e=1*new Date,n=0;e==1*new Date;)n++;return e.toString(16)+n.toString(16)};return function(){var n=(window.screen.height*window.screen.width).toString(16);return e()+"-"+Math.random().toString(16).replace(".","")+"-"+function(){var e,n,r=l,o=[],t=0;function i(e,n){var r,t=0;for(r=0;r<n.length;r++)t|=o[r]<<8*r;return e^t}for(e=0;e<r.length;e++)n=r.charCodeAt(e),o.unshift(255&n),o.length>=4&&(t=i(t,o),o=[]);return o.length>0&&(t=i(t,o)),t.toString(16)}()+"-"+n+"-"+e()}}(),v.isBlockedUA=function(e){return!!/(google web preview|baiduspider|yandexbot|bingbot|googlebot|yahoo! slurp)/i.test(e)},v.HTTPBuildQuery=function(e,n){var r,o,t=[];return v.isUndefined(n)&&(n="&"),v.each(e,function(e,n){r=encodeURIComponent(e.toString()),o=encodeURIComponent(n),t[t.length]=o+"="+r}),t.join(n)},v.getQueryParam=function(e,n){n=n.replace(/[[]/,"\\[").replace(/[\]]/,"\\]");var r=new RegExp("[\\?&]"+n+"=([^&#]*)").exec(e);if(null===r||r&&"string"!=typeof r[1]&&r[1].length)return"";var o=r[1];try{o=decodeURIComponent(o)}catch(t){b.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},v.getHashParam=function(e,n){var r=e.match(new RegExp(n+"=([^&]*)"));return r?r[1]:null},v.register_event=function(){function e(n){return n&&(n.preventDefault=e.preventDefault,n.stopPropagation=e.stopPropagation),n}return e.preventDefault=function(){this.returnValue=!1},e.stopPropagation=function(){this.cancelBubble=!0},function(n,r,o,t,i){if(n)if(n.addEventListener&&!t)n.addEventListener(r,o,!!i);else{var c="on"+r,a=n[c];n[c]=function(n,r,o){return function(t){if(t=t||e(window.event)){var i,c,a=!0;return v.isFunction(o)&&(i=o(t)),c=r.call(n,t),!1!==i&&!1!==c||(a=!1),a}}}(n,o,a)}else b.error("No valid element provided to register_event")}}(),v.info={campaignParams:function(){var e="utm_source utm_medium utm_campaign utm_content utm_term gclid".split(" "),n="",r={};return v.each(e,function(e){(n=v.getQueryParam(d.URL,e)).length&&(r[e]=n)}),r},searchEngine:function(e){return 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},searchInfo:function(e){var n=v.info.searchEngine(e),r="yahoo"!=n?"q":"p",o={};if(null!==n){o.$search_engine=n;var t=v.getQueryParam(e,r);t.length&&(o.ph_keyword=t)}return o},browser:function(e,n,r){return n=n||"",r||v.includes(e," OPR/")?v.includes(e,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":v.includes(e,"IEMobile")||v.includes(e,"WPDesktop")?"Internet Explorer Mobile":v.includes(e,"SamsungBrowser/")?"Samsung Internet":v.includes(e,"Edge")||v.includes(e,"Edg/")?"Microsoft Edge":v.includes(e,"FBIOS")?"Facebook Mobile":v.includes(e,"Chrome")?"Chrome":v.includes(e,"CriOS")?"Chrome iOS":v.includes(e,"UCWEB")||v.includes(e,"UCBrowser")?"UC Browser":v.includes(e,"FxiOS")?"Firefox iOS":v.includes(n,"Apple")?v.includes(e,"Mobile")?"Mobile Safari":"Safari":v.includes(e,"Android")?"Android Mobile":v.includes(e,"Konqueror")?"Konqueror":v.includes(e,"Firefox")?"Firefox":v.includes(e,"MSIE")||v.includes(e,"Trident/")?"Internet Explorer":v.includes(e,"Gecko")?"Mozilla":""},browserVersion:function(e,n,r){var o={"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+)?)/}[v.info.browser(e,n,r)];if(void 0===o)return null;var t=e.match(o);return t?parseFloat(t[t.length-2]):null},os:function(){var e=l;return/Windows/i.test(e)?/Phone/.test(e)||/WPDesktop/.test(e)?"Windows Phone":"Windows":/(iPhone|iPad|iPod)/.test(e)?"iOS":/Android/.test(e)?"Android":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":/Mac/i.test(e)?"Mac OS X":/Linux/.test(e)?"Linux":/CrOS/.test(e)?"Chrome OS":""},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 n=this.device(e);return"iPad"===n||"Android Tablet"===n?"Tablet":n?"Mobile":"Desktop"},referringDomain:function(e){var n=e.split("/");return n.length>=3?n[2]:""},properties:function(){return v.extend(v.strip_empty_properties({$os:v.info.os(),$browser:v.info.browser(l,u.vendor,window.opera),$device:v.info.device(l),$device_type:v.info.deviceType(l)}),{$current_url:window.location.href,$host:window.location.host,$pathname:window.location.pathname,$browser_version:v.info.browserVersion(l,u.vendor,window.opera),$screen_height:window.screen.height,$screen_width:window.screen.width,$viewport_height:window.innerHeight,$viewport_width:window.innerWidth,$lib:"web",$lib_version:e.default.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:v.timestamp()/1e3})},people_properties:function(){return v.extend(v.strip_empty_properties({$os:v.info.os(),$browser:v.info.browser(l,u.vendor,window.opera)}),{$browser_version:v.info.browserVersion(l,u.vendor,window.opera)})}},v.isObject=v.isObject,v.isBlockedUA=v.isBlockedUA,v.isEmptyObject=v.isEmptyObject,v.info=v.info,v.info.device=v.info.device,v.info.browser=v.info.browser,v.info.browserVersion=v.info.browserVersion,v.info.properties=v.info.properties;
8
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.COPY_IN_PROGRESS_ATTRIBUTE=exports.document=exports.console=exports.userAgent=exports._=exports.window=void 0;var e=n(require("./config"));function n(e){return e&&e.__esModule?e:{default:e}}var r=Array.prototype,o=Function.prototype,t=Object.prototype,i=r.slice,c=t.toString,a=t.hasOwnProperty,s="undefined"!=typeof window?window:{},u=s.navigator||{userAgent:""},d=s.document||{},l=u.userAgent;exports.userAgent=l,exports.document=d,exports.window=s;var f=o.bind,p=r.forEach,h=r.indexOf,w=Array.isArray,g={},v={trim:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}};exports._=v;var b={log:function(){if(e.default.DEBUG&&!v.isUndefined(window.console)&&window.console)try{window.console.log.apply(window.console,arguments)}catch(n){v.each(arguments,function(e){window.console.log(e)})}},error:function(){if(e.default.DEBUG&&!v.isUndefined(window.console)&&window.console){var n=["PostHog error:"].concat(Array.prototype.slice.call(arguments));try{window.console.error.apply(window.console,n)}catch(r){v.each(n,function(e){window.console.error(e)})}}},critical:function(){if(!v.isUndefined(window.console)&&window.console){var e=["PostHog error:"].concat(Array.prototype.slice.call(arguments));try{window.console.error.apply(window.console,e)}catch(n){v.each(e,function(e){window.console.error(e)})}}}};exports.console=b,v.bind=function(e,n){var r,o;if(f&&e.bind===f)return f.apply(e,i.call(arguments,1));if(!v.isFunction(e))throw new TypeError;return r=i.call(arguments,2),o=function(){if(!(this instanceof o))return e.apply(n,r.concat(i.call(arguments)));var t={};t.prototype=e.prototype;var c=new t;t.prototype=null;var a=e.apply(c,r.concat(i.call(arguments)));return Object(a)===a?a:c}},v.bind_instance_methods=function(e){for(var n in e)"function"==typeof e[n]&&(e[n]=v.bind(e[n],e))},v.each=function(e,n,r){if(null!=e)if(p&&e.forEach===p)e.forEach(n,r);else if(e.length===+e.length){for(var o=0,t=e.length;o<t;o++)if(o in e&&n.call(r,e[o],o,e)===g)return}else for(var i in e)if(a.call(e,i)&&n.call(r,e[i],i,e)===g)return},v.extend=function(e){return v.each(i.call(arguments,1),function(n){for(var r in n)void 0!==n[r]&&(e[r]=n[r])}),e},v.isArray=w||function(e){return"[object Array]"===c.call(e)},v.isFunction=function(e){try{return/^\s*\bfunction\b/.test(e)}catch(n){return!1}},v.include=function(e,n){var r=!1;return null===e?r:h&&e.indexOf===h?-1!=e.indexOf(n):(v.each(e,function(e){if(r||(r=e===n))return g}),r)},v.includes=function(e,n){return-1!==e.indexOf(n)},v.isObject=function(e){return e===Object(e)&&!v.isArray(e)},v.isEmptyObject=function(e){if(v.isObject(e)){for(var n in e)if(a.call(e,n))return!1;return!0}return!1},v.isUndefined=function(e){return void 0===e},v.isString=function(e){return"[object String]"==c.call(e)},v.isDate=function(e){return"[object Date]"==c.call(e)},v.isNumber=function(e){return"[object Number]"==c.call(e)},v.encodeDates=function(e){return v.each(e,function(n,r){v.isDate(n)?e[r]=v.formatDate(n):v.isObject(n)&&(e[r]=v.encodeDates(n))}),e},v.timestamp=function(){return Date.now=Date.now||function(){return+new Date},Date.now()},v.formatDate=function(e){function n(e){return e<10?"0"+e:e}return e.getUTCFullYear()+"-"+n(e.getUTCMonth()+1)+"-"+n(e.getUTCDate())+"T"+n(e.getUTCHours())+":"+n(e.getUTCMinutes())+":"+n(e.getUTCSeconds())},v.safewrap=function(n){return function(){try{return n.apply(this,arguments)}catch(r){b.critical("Implementation error. Please turn on debug and contact support@posthog.com."),e.default.DEBUG&&b.critical(r)}}},v.safewrap_class=function(e,n){for(var r=0;r<n.length;r++)e.prototype[n[r]]=v.safewrap(e.prototype[n[r]])},v.safewrap_instance_methods=function(e){for(var n in e)"function"==typeof e[n]&&(e[n]=v.safewrap(e[n]))},v.strip_empty_properties=function(e){var n={};return v.each(e,function(e,r){v.isString(e)&&e.length>0&&(n[r]=e)}),n};var y="undefined"!=typeof Symbol?Symbol("__deepCircularCopyInProgress__"):"__deepCircularCopyInProgress__";function m(e,n,r){return e!==Object(e)?n?n(e,r):e:e[y]?void 0:(e[y]=!0,v.isArray(e)?(o=[],v.each(e,function(e){o.push(m(e,n))})):(o={},v.each(e,function(e,r){r!==y&&(o[r]=m(e,n,r))})),delete e[y],o);var o}exports.COPY_IN_PROGRESS_ATTRIBUTE=y;var _=["$performance_raw"];v.copyAndTruncateStrings=function(e,n){return m(e,function(e,r){return r&&_.indexOf(r)>-1?e:("string"==typeof e&&null!==n&&(e=e.slice(0,n)),e)})},v.base64Encode=function(e){var n,r,o,t,i,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=0,s=0,u="",d=[];if(!e)return e;e=v.utf8Encode(e);do{n=(i=e.charCodeAt(a++)<<16|e.charCodeAt(a++)<<8|e.charCodeAt(a++))>>18&63,r=i>>12&63,o=i>>6&63,t=63&i,d[s++]=c.charAt(n)+c.charAt(r)+c.charAt(o)+c.charAt(t)}while(a<e.length);switch(u=d.join(""),e.length%3){case 1:u=u.slice(0,-2)+"==";break;case 2:u=u.slice(0,-1)+"="}return u},v.utf8Encode=function(e){var n,r,o,t,i="";for(n=r=0,o=(e=(e+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,t=0;t<o;t++){var c=e.charCodeAt(t),a=null;c<128?r++:a=c>127&&c<2048?String.fromCharCode(c>>6|192,63&c|128):String.fromCharCode(c>>12|224,c>>6&63|128,63&c|128),null!==a&&(r>n&&(i+=e.substring(n,r)),i+=a,n=r=t+1)}return r>n&&(i+=e.substring(n,e.length)),i},v.UUID=function(){var e=function(){for(var e=1*new Date,n=0;e==1*new Date;)n++;return e.toString(16)+n.toString(16)};return function(){var n=(window.screen.height*window.screen.width).toString(16);return e()+"-"+Math.random().toString(16).replace(".","")+"-"+function(){var e,n,r=l,o=[],t=0;function i(e,n){var r,t=0;for(r=0;r<n.length;r++)t|=o[r]<<8*r;return e^t}for(e=0;e<r.length;e++)n=r.charCodeAt(e),o.unshift(255&n),o.length>=4&&(t=i(t,o),o=[]);return o.length>0&&(t=i(t,o)),t.toString(16)}()+"-"+n+"-"+e()}}(),v.isBlockedUA=function(e){return!!/(google web preview|baiduspider|yandexbot|bingbot|googlebot|yahoo! slurp)/i.test(e)},v.HTTPBuildQuery=function(e,n){var r,o,t=[];return v.isUndefined(n)&&(n="&"),v.each(e,function(e,n){r=encodeURIComponent(e.toString()),o=encodeURIComponent(n),t[t.length]=o+"="+r}),t.join(n)},v.getQueryParam=function(e,n){n=n.replace(/[[]/,"\\[").replace(/[\]]/,"\\]");var r=new RegExp("[\\?&]"+n+"=([^&#]*)").exec(e);if(null===r||r&&"string"!=typeof r[1]&&r[1].length)return"";var o=r[1];try{o=decodeURIComponent(o)}catch(t){b.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},v.getHashParam=function(e,n){var r=e.match(new RegExp(n+"=([^&]*)"));return r?r[1]:null},v.register_event=function(){function e(n){return n&&(n.preventDefault=e.preventDefault,n.stopPropagation=e.stopPropagation),n}return e.preventDefault=function(){this.returnValue=!1},e.stopPropagation=function(){this.cancelBubble=!0},function(n,r,o,t,i){if(n)if(n.addEventListener&&!t)n.addEventListener(r,o,!!i);else{var c="on"+r,a=n[c];n[c]=function(n,r,o){return function(t){if(t=t||e(window.event)){var i,c,a=!0;return v.isFunction(o)&&(i=o(t)),c=r.call(n,t),!1!==i&&!1!==c||(a=!1),a}}}(n,o,a)}else b.error("No valid element provided to register_event")}}(),v.info={campaignParams:function(){var e="utm_source utm_medium utm_campaign utm_content utm_term gclid".split(" "),n="",r={};return v.each(e,function(e){(n=v.getQueryParam(d.URL,e)).length&&(r[e]=n)}),r},searchEngine:function(e){return 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},searchInfo:function(e){var n=v.info.searchEngine(e),r="yahoo"!=n?"q":"p",o={};if(null!==n){o.$search_engine=n;var t=v.getQueryParam(e,r);t.length&&(o.ph_keyword=t)}return o},browser:function(e,n,r){return n=n||"",r||v.includes(e," OPR/")?v.includes(e,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":v.includes(e,"IEMobile")||v.includes(e,"WPDesktop")?"Internet Explorer Mobile":v.includes(e,"SamsungBrowser/")?"Samsung Internet":v.includes(e,"Edge")||v.includes(e,"Edg/")?"Microsoft Edge":v.includes(e,"FBIOS")?"Facebook Mobile":v.includes(e,"Chrome")?"Chrome":v.includes(e,"CriOS")?"Chrome iOS":v.includes(e,"UCWEB")||v.includes(e,"UCBrowser")?"UC Browser":v.includes(e,"FxiOS")?"Firefox iOS":v.includes(n,"Apple")?v.includes(e,"Mobile")?"Mobile Safari":"Safari":v.includes(e,"Android")?"Android Mobile":v.includes(e,"Konqueror")?"Konqueror":v.includes(e,"Firefox")?"Firefox":v.includes(e,"MSIE")||v.includes(e,"Trident/")?"Internet Explorer":v.includes(e,"Gecko")?"Mozilla":""},browserVersion:function(e,n,r){var o={"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+)?)/}[v.info.browser(e,n,r)];if(void 0===o)return null;var t=e.match(o);return t?parseFloat(t[t.length-2]):null},os:function(){var e=l;return/Windows/i.test(e)?/Phone/.test(e)||/WPDesktop/.test(e)?"Windows Phone":"Windows":/(iPhone|iPad|iPod)/.test(e)?"iOS":/Android/.test(e)?"Android":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":/Mac/i.test(e)?"Mac OS X":/Linux/.test(e)?"Linux":/CrOS/.test(e)?"Chrome OS":""},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 n=this.device(e);return"iPad"===n||"Android Tablet"===n?"Tablet":n?"Mobile":"Desktop"},referringDomain:function(e){var n=e.split("/");return n.length>=3?n[2]:""},properties:function(){return v.extend(v.strip_empty_properties({$os:v.info.os(),$browser:v.info.browser(l,u.vendor,window.opera),$device:v.info.device(l),$device_type:v.info.deviceType(l)}),{$current_url:window.location.href,$host:window.location.host,$pathname:window.location.pathname,$browser_version:v.info.browserVersion(l,u.vendor,window.opera),$screen_height:window.screen.height,$screen_width:window.screen.width,$viewport_height:window.innerHeight,$viewport_width:window.innerWidth,$lib:"web",$lib_version:e.default.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:v.timestamp()/1e3})},people_properties:function(){return v.extend(v.strip_empty_properties({$os:v.info.os(),$browser:v.info.browser(l,u.vendor,window.opera)}),{$browser_version:v.info.browserVersion(l,u.vendor,window.opera)})}},v.isObject=v.isObject,v.isBlockedUA=v.isBlockedUA,v.isEmptyObject=v.isEmptyObject,v.info=v.info,v.info.device=v.info.device,v.info.browser=v.info.browser,v.info.browserVersion=v.info.browserVersion,v.info.properties=v.info.properties;
9
9
  },{"./config":"itQ5"}],"RYfg":[function(require,module,exports) {
10
10
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getClassName=r,exports.getSafeText=n,exports.isElementNode=o,exports.isTag=s,exports.isTextNode=i,exports.shouldCaptureDomEvent=u,exports.shouldCaptureElement=a,exports.isSensitiveElement=p,exports.shouldCaptureValue=l,exports.isAngularStyleAttr=d,exports.loadScript=f,exports.usefulElements=void 0;var e=require("./utils");function t(e){return(t="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})(e)}function r(e){switch(t(e.className)){case"string":return e.className;case"object":return e.className.baseVal||e.getAttribute("class")||"";default:return""}}function n(t){var r="";return a(t)&&!p(t)&&t.childNodes&&t.childNodes.length&&e._.each(t.childNodes,function(t){i(t)&&t.textContent&&(r+=e._.trim(t.textContent).split(/(\s+)/).filter(l).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255))}),e._.trim(r)}function o(e){return e&&1===e.nodeType}function s(e,t){return e&&e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function i(e){return e&&3===e.nodeType}var c=["a","button","form","input","select","textarea","label"];function u(e,t){if(!e||s(e,"html")||!o(e))return!1;for(var r=!1,n=[e],i=!0,u=e;u.parentNode&&!s(u,"body");)if(11!==u.parentNode.nodeType){if(!(i=u.parentNode))break;if(c.indexOf(i.tagName.toLowerCase())>-1)r=!0;else{var a=window.getComputedStyle(i);a&&"pointer"===a.getPropertyValue("cursor")&&(r=!0)}n.push(i),u=i}else n.push(u.parentNode.host),u=u.parentNode.host;var p=window.getComputedStyle(e);if(p&&"pointer"===p.getPropertyValue("cursor")&&"click"===t.type)return!0;var l=e.tagName.toLowerCase();switch(l){case"html":return!1;case"form":return"submit"===t.type;case"input":return"change"===t.type||"click"===t.type;case"select":case"textarea":return"change"===t.type||"click"===t.type;default:return r?"click"===t.type:"click"===t.type&&(c.indexOf(l)>-1||"true"===e.getAttribute("contenteditable"))}}function a(t){for(var n=t;n.parentNode&&!s(n,"body");n=n.parentNode){var o=r(n).split(" ");if(e._.includes(o,"ph-sensitive")||e._.includes(o,"ph-no-capture"))return!1}if(e._.includes(r(t).split(" "),"ph-include"))return!0;var i=t.type||"";if("string"==typeof i)switch(i.toLowerCase()){case"hidden":case"password":return!1}var c=t.name||t.id||"";if("string"==typeof c){if(/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(c.replace(/[^a-zA-Z0-9]/g,"")))return!1}return!0}function p(e){return!!(s(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||s(e,"select")||s(e,"textarea")||"true"===e.getAttribute("contenteditable"))}function l(t){if(null===t||e._.isUndefined(t))return!1;if("string"==typeof t){t=e._.trim(t);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((t||"").replace(/[- ]/g,"")))return!1;if(/(^\d{3}-?\d{2}-?\d{4}$)/.test(t))return!1}return!0}function d(e){return"string"==typeof e&&("_ngcontent"===e.substring(0,10)||"_nghost"===e.substring(0,7))}function f(e,t){var r=document.createElement("script");r.type="text/javascript",r.src=e,r.onload=t;var n=document.getElementsByTagName("script");n.length>0?n[0].parentNode.insertBefore(r,n[0]):document.body.appendChild(r)}exports.usefulElements=c;
11
11
  },{"./utils":"FOZT"}],"Oszc":[function(require,module,exports) {
@@ -29,9 +29,9 @@ module.exports={name:"posthog-js",version:"1.17.0",description:"Posthog-js allow
29
29
  },{}],"Z2N4":[function(require,module,exports) {
30
30
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SessionRecording=exports.MUTATION_SOURCE_TYPE=exports.INCREMENTAL_SNAPSHOT_EVENT_TYPE=exports.META_EVENT_TYPE=exports.FULL_SNAPSHOT_EVENT_TYPE=void 0;var e=require("../autocapture-utils"),t=require("../utils"),n=require("../posthog-persistence"),r=s(require("../config")),i=require("./sessionrecording-utils");function s(e){return e&&e.__esModule?e:{default:e}}function o(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 a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach(function(t){f(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function c(e,t){return h(e)||l(e,t)||p(e,t)||u()}function u(){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 p(e,t){if(e){if("string"==typeof e)return d(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)?d(e,t):void 0}}function d(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 l(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,i=!1,s=void 0;try{for(var o,a=e[Symbol.iterator]();!(r=(o=a.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(c){i=!0,s=c}finally{try{r||null==a.return||a.return()}finally{if(i)throw s}}return n}}function h(e){if(Array.isArray(e))return e}function f(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function b(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 g(e,t,n){return t&&b(e.prototype,t),n&&b(e,n),e}var w="/e/",y=2;exports.FULL_SNAPSHOT_EVENT_TYPE=y;var v=4;exports.META_EVENT_TYPE=v;var S=3;exports.INCREMENTAL_SNAPSHOT_EVENT_TYPE=S;var E=3;exports.MUTATION_SOURCE_TYPE=E;var O=function(){function s(e){_(this,s),this.instance=e,this.captureStarted=!1,this.snapshots=[],this.emit=!1,this.endpoint=w,this.stopRrweb=null,this.windowId=null,this.sessionId=null}return g(s,[{key:"startRecordingIfEnabled",value:function(){this.instance.get_property(n.SESSION_RECORDING_ENABLED)&&!this.instance.get_config("disable_session_recording")&&this._startCapture()}},{key:"started",value:function(){return this.captureStarted}},{key:"stopRecording",value:function(){this.captureStarted&&this.stopRrweb&&(this.stopRrweb(),this.stopRrweb=null,this.captureStarted=!1)}},{key:"afterDecideResponse",value:function(e){var t=!this.instance.get_config("disable_session_recording")&&!!e.sessionRecording;this.instance.persistence&&this.instance.persistence.register(f({},n.SESSION_RECORDING_ENABLED,t)),t&&(e.sessionRecording.endpoint&&(this.endpoint=e.sessionRecording.endpoint),this.submitRecordings())}},{key:"submitRecordings",value:function(){var e=this;this.emit=!0,this._startCapture(),this.snapshots.forEach(function(t){return e._captureSnapshot(t)})}},{key:"_startCapture",value:function(){void 0!==Object.assign&&(this.captureStarted||this.instance.get_config("disable_session_recording")||(this.captureStarted=!0,(0,e.loadScript)(this.instance.get_config("api_host")+"/static/recorder.js?v="+r.default.LIB_VERSION,t._.bind(this._onScriptLoaded,this))))}},{key:"_updateWindowAndSessionIds",value:function(e){var t=this.instance.sessionManager.getSessionAndWindowId(e.timestamp||(new Date).getTime(),e),n=t.windowId,r=t.sessionId;this.windowId===n&&this.sessionId===r||-1!==[y,v].indexOf(e.type)||window.rrweb.record.takeFullSnapshot(),this.windowId=n,this.sessionId=r}},{key:"_onScriptLoaded",value:function(){for(var e=this,t={blockClass:"ph-no-capture",blockSelector:null,ignoreClass:"ph-ignore-input",maskAllInputs:!1,maskInputOptions:{},maskInputFn:null,slimDOMOptions:{},collectFonts:!1},n=this.instance.get_config("session_recording"),r=0,s=Object.entries(n||{});r<s.length;r++){var o=c(s[r],2),u=o[0],p=o[1];u in t&&(t[u]=p)}this.stopRrweb=window.rrweb.record(a({emit:function(t){t=(0,i.filterDataURLsFromLargeDataObjects)(t),e._updateWindowAndSessionIds(t);var n={$snapshot_data:t,$session_id:e.sessionId,$window_id:e.windowId};e.instance._captureMetrics.incr("rrweb-record"),e.instance._captureMetrics.incr("rrweb-record-".concat(t.type)),e.emit?e._captureSnapshot(n):e.snapshots.push(n)}},t)),this.instance._addCaptureHook(function(e){"$pageview"===e&&window.rrweb.record.addCustomEvent("$pageview",{href:window.location.href})})}},{key:"_captureSnapshot",value:function(e){this.instance.capture("$snapshot",e,{transport:"XHR",method:"POST",endpoint:this.endpoint,_forceCompression:!0,_noTruncate:!0,_batchKey:"sessionRecording",_metrics:{rrweb_full_snapshot:e.$snapshot_data.type===y}})}}]),s}();exports.SessionRecording=O;
31
31
  },{"../autocapture-utils":"RYfg","../utils":"FOZT","../posthog-persistence":"MAdm","../config":"itQ5","./sessionrecording-utils":"vmk3"}],"auG7":[function(require,module,exports) {
32
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Decide=void 0;var e=require("./autocapture"),t=require("./utils"),n=require("./posthog-featureflags");function r(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=i(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}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 s,a=!0,c=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return a=e.done,e},e:function(e){c=!0,s=e},f:function(){try{a||null==n.return||n.return()}finally{if(c)throw s}}}}function i(e,t){if(e){if("string"==typeof e)return o(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)?o(e,t):void 0}}function o(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 s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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 c(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),e}var u=function(){function i(e){s(this,i),this.instance=e}return c(i,[{key:"call",value:function(){var e=this,n=JSON.stringify({token:this.instance.get_config("token"),distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups()}),r=t._.base64Encode(n);this.instance._send_request("".concat(this.instance.get_config("api_host"),"/decide/?v=2"),{data:r},{method:"POST"},function(t){return e.parseDecideResponse(t)})}},{key:"parseDecideResponse",value:function(t){var i=this;if(!document||!document.body)return console.log("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(function(){i.parseDecideResponse(t)},500);if(this.instance.toolbar.afterDecideResponse(t),this.instance.sessionRecording.afterDecideResponse(t),e.autocapture.afterDecideResponse(t,this.instance),(0,n.parseFeatureFlagDecideResponse)(t,this.instance.persistence),t.supportedCompression){var o,s={},a=r(t.supportedCompression);try{for(a.s();!(o=a.n()).done;){s[o.value]=!0}}catch(c){a.e(c)}finally{a.f()}this.instance.compression=s}else this.instance.compression={}}}]),i}();exports.Decide=u;
32
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Decide=void 0;var e=require("./autocapture"),t=require("./utils"),n=require("./posthog-featureflags");function r(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=o(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 s,a=!0,c=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return a=e.done,e},e:function(e){c=!0,s=e},f:function(){try{a||null==n.return||n.return()}finally{if(c)throw s}}}}function o(e,t){if(e){if("string"==typeof e)return i(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)?i(e,t):void 0}}function i(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 s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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 c(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),e}var u=function(){function o(e){s(this,o),this.instance=e}return c(o,[{key:"call",value:function(){var e=this,n=JSON.stringify({token:this.instance.get_config("token"),distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups()}),r=t._.base64Encode(n);this.instance._send_request("".concat(this.instance.get_config("api_host"),"/decide/?v=2"),{data:r,verbose:!0},{method:"POST"},function(t){return e.parseDecideResponse(t)})}},{key:"parseDecideResponse",value:function(t){var o=this;if(0!==(null==t?void 0:t.status)){if(!document||!document.body)return console.log("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(function(){o.parseDecideResponse(t)},500);if(this.instance.toolbar.afterDecideResponse(t),this.instance.sessionRecording.afterDecideResponse(t),e.autocapture.afterDecideResponse(t,this.instance),(0,n.parseFeatureFlagDecideResponse)(t,this.instance.persistence),t.supportedCompression){var i,s={},a=r(t.supportedCompression);try{for(a.s();!(i=a.n()).done;){s[i.value]=!0}}catch(c){a.e(c)}finally{a.f()}this.instance.compression=s}else this.instance.compression={}}else console.error("Failed to fetch feature flags from PostHog.")}}]),o}();exports.Decide=u;
33
33
  },{"./autocapture":"gR3r","./utils":"FOZT","./posthog-featureflags":"aVqC"}],"ZEpJ":[function(require,module,exports) {
34
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Toolbar=void 0;var t=require("../autocapture-utils"),e=require("../utils");function o(t,e){var o=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,r)}return o}function r(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?o(Object(r),!0).forEach(function(e){n(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function n(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){for(var o=0;o<e.length;o++){var r=e[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function s(t,e,o){return e&&a(t.prototype,e),o&&a(t,o),t}var c=function(){function o(t){i(this,o),this.instance=t}return s(o,[{key:"afterDecideResponse",value:function(t){var e=t.editorParams||(t.toolbarVersion?{toolbarVersion:t.toolbarVersion}:{});t.isAuthenticated&&e.toolbarVersion&&0===e.toolbarVersion.indexOf("toolbar")&&(this._loadEditor(r(r({},e),{},{apiURL:this.instance.get_config("api_host")})),this.instance.set_config({debug:!0}))}},{key:"maybeLoadEditor",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.location,o=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:window.history;try{if(!o){try{window.localStorage.setItem("test","test"),window.localStorage.removeItem("test")}catch(s){return!1}o=window.localStorage}var n,i=e._.getHashParam(t.hash,"__posthog")||e._.getHashParam(t.hash,"state"),a=i?JSON.parse(decodeURIComponent(i)):null;return a&&("mpeditor"===a.action||"ph_authorize"===a.action)?(n=a)&&Object.keys(n).length>0&&(o.setItem("_postHogEditorParams",JSON.stringify(n)),a.desiredHash?t.hash=a.desiredHash:r?r.replaceState("",document.title,t.pathname+t.search):t.hash=""):delete(n=JSON.parse(o.getItem("_postHogEditorParams")||"{}")).userIntent,n.apiURL=this.instance.get_config("api_host"),!(!n.token||this.instance.get_config("token")!==n.token)&&(this._loadEditor(n),!0)}catch(c){return!1}}},{key:"_loadEditor",value:function(o){var n=this;if(!window._postHogToolbarLoaded){window._postHogToolbarLoaded=!0;var i=o.jsURL||o.apiURL||this.instance.get_config("api_host"),a=i+(i.endsWith("/")?"":"/")+"static/toolbar.js?_ts="+(new Date).getTime(),s="https://app.posthog.com"!==this.instance.get_config("api_host")&&this.instance.get_config("advanced_disable_toolbar_metrics");return o=r(r({},o),s?{instrument:!1}:{}),(0,t.loadScript)(a,function(){window.ph_load_editor(o,n.instance)}),e._.register_event(window,"turbolinks:load",function(){window._postHogToolbarLoaded=!1,n._loadEditor(o)}),!0}return!1}}]),o}();exports.Toolbar=c;
34
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Toolbar=void 0;var t=require("../autocapture-utils"),e=require("../utils");function o(t,e){var o=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,r)}return o}function r(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?o(Object(r),!0).forEach(function(e){n(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function n(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){for(var o=0;o<e.length;o++){var r=e[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function s(t,e,o){return e&&a(t.prototype,e),o&&a(t,o),t}var c=function(){function o(t){i(this,o),this.instance=t}return s(o,[{key:"afterDecideResponse",value:function(t){var e=t.editorParams||(t.toolbarVersion?{toolbarVersion:t.toolbarVersion}:{});t.isAuthenticated&&e.toolbarVersion&&0===e.toolbarVersion.indexOf("toolbar")&&this._loadEditor(r(r({},e),{},{apiURL:this.instance.get_config("api_host")}))}},{key:"maybeLoadEditor",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.location,o=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:window.history;try{if(!o){try{window.localStorage.setItem("test","test"),window.localStorage.removeItem("test")}catch(s){return!1}o=window.localStorage}var n,i=e._.getHashParam(t.hash,"__posthog")||e._.getHashParam(t.hash,"state"),a=i?JSON.parse(decodeURIComponent(i)):null;return a&&("mpeditor"===a.action||"ph_authorize"===a.action)?(n=a)&&Object.keys(n).length>0&&(o.setItem("_postHogEditorParams",JSON.stringify(n)),a.desiredHash?t.hash=a.desiredHash:r?r.replaceState("",document.title,t.pathname+t.search):t.hash=""):delete(n=JSON.parse(o.getItem("_postHogEditorParams")||"{}")).userIntent,n.apiURL=this.instance.get_config("api_host"),!(!n.token||this.instance.get_config("token")!==n.token)&&(this._loadEditor(n),!0)}catch(c){return!1}}},{key:"_loadEditor",value:function(o){var n=this;if(!window._postHogToolbarLoaded){window._postHogToolbarLoaded=!0;var i=o.jsURL||o.apiURL||this.instance.get_config("api_host"),a=i+(i.endsWith("/")?"":"/")+"static/toolbar.js?_ts="+(new Date).getTime(),s="https://app.posthog.com"!==this.instance.get_config("api_host")&&this.instance.get_config("advanced_disable_toolbar_metrics");return o=r(r({},o),s?{instrument:!1}:{}),(0,t.loadScript)(a,function(){window.ph_load_editor(o,n.instance)}),e._.register_event(window,"turbolinks:load",function(){window._postHogToolbarLoaded=!1,n._loadEditor(o)}),!0}return!1}}]),o}();exports.Toolbar=c;
35
35
  },{"../autocapture-utils":"RYfg","../utils":"FOZT"}],"ae0g":[function(require,module,exports) {
36
36
  "use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var n=0;n<t.length;n++){var u=t[n];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(e,u.key,u)}}function n(e,n,u){return n&&t(e.prototype,n),u&&t(e,u),e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.RequestQueueScaffold=void 0;var u=function(){function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3e3;e(this,t),this.isPolling=!0,this._event_queue=[],this._empty_queue_count=0,this._poller=function(){},this._pollInterval=n}return n(t,[{key:"setPollInterval",value:function(e){this._pollInterval=e,this.isPolling&&this.poll()}},{key:"enqueue",value:function(){}},{key:"poll",value:function(){}},{key:"unload",value:function(){}},{key:"getTime",value:function(){return(new Date).getTime()}}]),t}();exports.RequestQueueScaffold=u;
37
37
  },{}],"Je4H":[function(require,module,exports) {
@@ -48,8 +48,10 @@ module.exports={name:"posthog-js",version:"1.17.0",description:"Posthog-js allow
48
48
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.RetryQueue=void 0;var e=require("./base-request-queue"),t=require("./send-request");function r(e){return(r="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})(e)}function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach(function(t){i(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=a(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}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 i,u=!0,c=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return u=e.done,e},e:function(e){c=!0,i=e},f:function(){try{u||null==r.return||r.return()}finally{if(c)throw i}}}}function a(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function s(e,t,r){return t&&f(e.prototype,t),r&&f(e,r),e}function y(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}}),t&&p(e,t)}function p(e,t){return(p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(e){var t=v();return function(){var r,n=w(e);if(t){var o=w(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return b(this,r)}}function b(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?d(e):t}function d(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function v(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}function w(e){return(w=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var O=function(r){y(i,e.RequestQueueScaffold);var n=h(i);function i(e,t){var r;return l(this,i),(r=n.call(this)).captureMetrics=e,r.isPolling=!1,r.queue=[],r.areWeOnline=!0,r.onXHRError=t,"onLine"in window.navigator&&(r.areWeOnline=window.navigator.onLine,window.addEventListener("online",function(){r._handleWeAreNowOnline()}),window.addEventListener("offline",function(){r.areWeOnline=!1})),r}return s(i,[{key:"enqueue",value:function(e){var t=e.retriesPerformedSoFar||0;if(!(t>=10)){var r=3e3*Math.pow(2,t),n=new Date(Date.now()+r);console.warn("Enqueued failed request for retry in ".concat(r)),this.queue.push({retryAt:n,requestData:e}),this.isPolling||(this.isPolling=!0,this.poll())}}},{key:"poll",value:function(){var e=this;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 r,n=u(t);try{for(n.s();!(r=n.n()).done;){var o=r.value.requestData;this._executeXhrRequest(o)}}catch(i){n.e(i)}finally{n.f()}}}},{key:"unload",value:function(){clearTimeout(this._poller);var e,r=u(this.queue);try{for(r.s();!(e=r.n()).done;){var n=e.value.requestData,i=n.url,a=n.data,c=n.options;try{window.navigator.sendBeacon(i,(0,t.encodePostData)(a,o(o({},c),{},{sendBeacon:!0})))}catch(l){this.get_config("debug")&&console.error(l)}}}catch(f){r.e(f)}finally{r.f()}this.queue=[]}},{key:"_executeXhrRequest",value:function(e){var r=e.url,n=e.data,o=e.options,i=e.headers,u=e.callback,a=e.retriesPerformedSoFar;(0,t.xhr)({url:r,data:n||{},options:o||{},headers:i||{},retriesPerformedSoFar:a||0,callback:u,captureMetrics:this.captureMetrics,retryQueue:this,onXHRError:this.onXHRError})}},{key:"_handleWeAreNowOnline",value:function(){this.areWeOnline=!0,this.flush()}}]),i}();exports.RetryQueue=O;
49
49
  },{"./base-request-queue":"ae0g","./send-request":"tOu2"}],"tci7":[function(require,module,exports) {
50
50
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SessionIdManager=void 0;var e=require("./extensions/sessionrecording"),t=require("./posthog-persistence"),n=require("./storage"),i=require("./utils");function s(e,t){return d(e)||u(e,t)||o(e,t)||r()}function r(){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 o(e,t){if(e){if("string"==typeof e)return a(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)?a(e,t):void 0}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function u(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],i=!0,s=!1,r=void 0;try{for(var o,a=e[Symbol.iterator]();!(i=(o=a.next()).done)&&(n.push(o.value),!t||n.length!==t);i=!0);}catch(u){s=!0,r=u}finally{try{i||null==a.return||a.return()}finally{if(s)throw r}}return n}}function d(e){if(Array.isArray(e))return e}function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function h(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function _(e,t,n){return t&&h(e.prototype,t),n&&h(e,n),e}var p=18e5,f=function(){function r(e,t){c(this,r),this.persistence=t,e.persistence_name?this.window_id_storage_key="ph_"+e.persistence_name+"_window_id":this.window_id_storage_key="ph_"+e.token+"_window_id"}return _(r,[{key:"_setWindowId",value:function(e){e!==this.windowId&&(this.windowId=e,!this.persistence.disabled&&n.sessionStore.is_supported()&&n.sessionStore.set(this.window_id_storage_key,e))}},{key:"_getWindowId",value:function(){return this.windowId?this.windowId:!this.persistence.disabled&&n.sessionStore.is_supported()?n.sessionStore.parse(this.window_id_storage_key):null}},{key:"_setSessionId",value:function(e,n){e===this.sessionId&&n===this.timestamp||(this.timestamp=n,this.sessionId=e,this.persistence.register(l({},t.SESSION_ID,[n,e])))}},{key:"_getSessionId",value:function(){return this.sessionId&&this.timestamp?[this.timestamp,this.sessionId]:this.persistence.props[t.SESSION_ID]||[0,null]}},{key:"resetSessionId",value:function(){this._setSessionId(null,null)}},{key:"getSessionAndWindowId",value:function(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=!(r&&r.type===e.INCREMENTAL_SNAPSHOT_EVENT_TYPE&&(null===(t=r.data)||void 0===t?void 0:t.source)===e.MUTATION_SOURCE_TYPE);n=n||(new Date).getTime();var a=s(this._getSessionId(),2),u=a[0],d=a[1],l=this._getWindowId();!d||o&&Math.abs(n-u)>p?(d=i._.UUID(),l=i._.UUID()):l||(l=i._.UUID());var c=0===u||o?n:u;return this._setWindowId(l),this._setSessionId(d,c),{sessionId:d,windowId:l}}}]),r}();exports.SessionIdManager=f;
51
- },{"./extensions/sessionrecording":"Z2N4","./posthog-persistence":"MAdm","./storage":"KZ7Y","./utils":"FOZT"}],"ok3T":[function(require,module,exports) {
52
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.init_from_snippet=Y,exports.init_as_module=G,exports.PostHogLib=void 0;var e,t,o=require("./lz-string"),r=m(require("./config")),i=require("./utils"),n=require("./autocapture"),s=require("./posthog-people"),p=require("./posthog-featureflags"),a=require("./posthog-persistence"),c=require("./extensions/sessionrecording"),_=require("./decide"),u=require("./extensions/toolbar"),d=require("./gdpr-utils"),g=require("./storage"),l=require("./request-queue"),h=require("./capture-metrics"),f=require("./compression"),y=require("./send-request"),b=require("./retry-queue"),v=require("./sessionid");function m(e){return e&&e.__esModule?e:{default:e}}function w(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,r)}return o}function k(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?w(Object(o),!0).forEach(function(t){S(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):w(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}function S(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function q(e,t){return E(e)||O(e,t)||F(e,t)||P()}function P(){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 F(e,t){if(e){if("string"==typeof e)return x(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);return"Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?x(e,t):void 0}}function x(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,r=new Array(t);o<t;o++)r[o]=e[o];return r}function O(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var o=[],r=!0,i=!1,n=void 0;try{for(var s,p=e[Symbol.iterator]();!(r=(s=p.next()).done)&&(o.push(s.value),!t||o.length!==t);r=!0);}catch(a){i=!0,n=a}finally{try{r||null==p.return||p.return()}finally{if(i)throw n}}return o}}function E(e){if(Array.isArray(e))return e}var $=0,I=1,H=function(){},j={},A="posthog",R=i.window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,M=!R&&-1===i.userAgent.indexOf("MSIE")&&-1===i.userAgent.indexOf("Mozilla"),D=function(){return{api_host:"https://app.posthog.com",api_method:"POST",api_transport:"XHR",autocapture:!0,rageclick:!1,cross_subdomain_cookie:-1===i.document.location.hostname.indexOf("herokuapp.com"),persistence:"cookie",persistence_name:"",cookie_name:"",loaded:function(){},store_google:!0,save_referrer:!0,test:!1,verbose:!1,img:!1,capture_pageview:!0,debug:!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_cookie:!1,secure_cookie:"https:"===i.window.location.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,property_blacklist:[],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:!1,maskInputOptions:{},maskInputFn:null,slimDOMOptions:{},collectFonts:!1},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;i.console.error(t)},_onCapture:function(){},_capture_metrics:!1,_capture_performance:!1}},L=function(){};exports.PostHogLib=L;var C=function(o,a,_){var d,g=_===A?t:t[_];if(g&&e===$)d=g;else{if(g&&!i._.isArray(g))return void i.console.error("You have already initialized "+_);d=new L}if(d._init(o,a,_),d.people=new s.PostHogPeople,d.people._init(d),d.featureFlags=new p.PostHogFeatureFlags(d),d.feature_flags=d.featureFlags,d.toolbar=new u.Toolbar(d),d.toolbar.maybeLoadEditor(),d.sessionRecording=new c.SessionRecording(d),d.sessionRecording.startRecordingIfEnabled(),d.__autocapture_enabled=d.get_config("autocapture"),d.get_config("autocapture")){n.autocapture.enabledForProject(d.get_config("token"),100,100)?n.autocapture.isBrowserSupported()?n.autocapture.init(d):(d.__autocapture_enabled=!1,i.console.log("Disabling Automatic Event Collection because this browser is not supported")):(d.__autocapture_enabled=!1,i.console.log("Not in active bucket: disabling Automatic Event Collection."))}return r.default.DEBUG=r.default.DEBUG||d.get_config("debug"),!i._.isUndefined(g)&&i._.isArray(g)&&(d._execute_array.call(d.people,g.people),d._execute_array(g)),d};function U(e){try{return JSON.parse(JSON.stringify(i.window.performance.getEntriesByType(e)))}catch(t){return[]}}L.prototype.init=function(e,o,r){if(i._.isUndefined(r))i.console.error("You must name your new library: init(token, config, name)");else{if(r!==A){var n=C(e,o,r);return t[r]=n,n._loaded(),n}i.console.error("You must initialize the main posthog object right after you include the PostHog js snippet")}},L.prototype._init=function(e,t,o){this.__loaded=!0,this.config={},this._triggered_notifs=[],this.compression={},this.set_config(i._.extend({},D(),t,{name:o,token:e,callback_fn:(o===A?o:A+"."+o)+"._jsc"})),this._jsc=function(){},this._captureMetrics=new h.CaptureMetrics(this.get_config("_capture_metrics"),i._.bind(this.capture,this)),this._requestQueue=new l.RequestQueue(this._captureMetrics,i._.bind(this._handle_queued_event,this)),this._retryQueue=new b.RetryQueue(this._captureMetrics,this.get_config("on_xhr_error")),this.__captureHooks=[],this.__request_queue=[],this.persistence=new a.PostHogPersistence(this.config),this.sessionManager=new v.SessionIdManager(this.config,this.persistence),this._gdpr_init();var r=i._.UUID();this.get_distinct_id()||this.register_once({distinct_id:r,$device_id:r},""),i.window.addEventListener&&i.window.addEventListener("unload",this._handle_unload.bind(this))},L.prototype._loaded=function(){this.featureFlags.setReloadingPaused(!0);try{this.get_config("loaded")(this)}catch(e){i.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 _.Decide(this).call(),this.featureFlags.resetRequestQueue(),this.featureFlags.setReloadingPaused(!1)},L.prototype._start_queue_if_opted_in=function(){this.has_opted_out_capturing()||this.get_config("request_batching")&&this._requestQueue.poll()},L.prototype._dom_loaded=function(){this.has_opted_out_capturing()||i._.each(this.__request_queue,function(e){this._send_request.apply(this,e)},this),delete this.__request_queue,this._start_queue_if_opted_in()},L.prototype._prepare_callback=function(e,t){if(i._.isUndefined(e))return null;if(R){return function(o){e(o,t)}}var o=this._jsc,r=""+Math.floor(1e8*Math.random()),n=this.get_config("callback_fn")+"["+r+"]";return o[r]=function(i){delete o[r],e(i,t)},n},L.prototype._handle_unload=function(){this.get_config("request_batching")?(this.get_config("capture_pageview")&&this.capture("$pageleave"),this.get_config("_capture_metrics")&&(this._requestQueue.updateUnloadMetrics(),this.capture("$capture_metrics",this._captureMetrics.metrics),this._captureMetrics.captureInProgressRequests()),this._requestQueue.unload(),this._retryQueue.unload()):this.get_config("capture_pageview")&&this.capture("$pageleave",null,{transport:"sendbeacon"})},L.prototype._handle_queued_event=function(e,t,o){var r=JSON.stringify(t);this.__compress_and_send_json_request(e,r,o||j,H)},L.prototype.__compress_and_send_json_request=function(e,t,o,r){var i=q((0,f.compressData)((0,f.decideCompression)(this.compression),t,o),2),n=i[0],s=i[1];this._send_request(e,n,s,r)},L.prototype._send_request=function(e,t,o,r){if(M)this.__request_queue.push(arguments);else{var n={method:this.get_config("api_method"),transport:this.get_config("api_transport"),verbose:this.get_config("verbose")};o=i._.extend(n,o||{}),R||(o.method="GET");var s=i.window.navigator.sendBeacon&&"sendbeacon"===o.transport.toLowerCase(),p=o.urlQueryArgs||{};p.ip=this.get_config("ip")?1:0,p._=(new Date).getTime().toString();var a=e.indexOf("?")>-1?"&":"?";if(e+=a+i._.HTTPBuildQuery(p),i._.isObject(t)&&this.get_config("img")){var c=i.document.createElement("img");c.src=e,i.document.body.appendChild(c)}else if(s)try{i.window.navigator.sendBeacon(e,(0,y.encodePostData)(t,k(k({},o),{},{sendBeacon:!0})))}catch(d){this.get_config("debug")&&i.console.error(d)}else if(R)try{(0,y.xhr)({url:e,data:t,headers:this.get_config("xhr_headers"),options:o,captureMetrics:this._captureMetrics,callback:r,retriesPerformedSoFar:0,retryQueue:this._retryQueue,onXHRError:this.get_config("on_xhr_error")})}catch(d){i.console.error(d)}else{var _=i.document.createElement("script");_.type="text/javascript",_.async=!0,_.defer=!0,_.src=e;var u=i.document.getElementsByTagName("script")[0];u.parentNode.insertBefore(_,u)}}},L.prototype._execute_array=function(e){var t,o=[],r=[],n=[];i._.each(e,function(e){e&&(t=e[0],i._.isArray(t)?n.push(e):"function"==typeof e?e.call(this):i._.isArray(e)&&"alias"===t?o.push(e):i._.isArray(e)&&-1!==t.indexOf("capture")&&"function"==typeof this[t]?n.push(e):r.push(e))},this);var s=function(e,t){i._.each(e,function(e){if(i._.isArray(e[0])){var o=t;i._.each(e,function(e){o=o[e[0]].apply(o,e.slice(1))})}else this[e[0]].apply(this,e.slice(1))},t)};s(o,this),s(r,this),s(n,this)},L.prototype.push=function(e){this._execute_array([e])},L.prototype.capture=(0,d.addOptOutCheckPostHogLib)(function(e,t,o){if(this.__loaded){this._captureMetrics.incr("capture"),"$snapshot"===e&&this._captureMetrics.incr("snapshot");var r=(o=o||j).transport;if(r&&(o.transport=r),i._.isUndefined(e)||"string"!=typeof e)i.console.error("No event name provided to posthog.capture");else if(!i._.isBlockedUA(i.userAgent)){var n=this.persistence.remove_event_timer(e);this.persistence.update_search_keyword(i.document.referrer),this.get_config("store_google")&&this.persistence.update_campaign_params(),this.get_config("save_referrer")&&this.persistence.update_referrer_info(i.document.referrer);var s={event:e,properties:this._calculate_event_properties(e,t,n)};"$identify"===e&&o.$set&&(s.$set=o.$set),s=i._.copyAndTruncateStrings(s,o._noTruncate?null:this.get_config("properties_string_max_length")),this.get_config("debug")&&i.console.log("PostHog.js send",s);var p=JSON.stringify(s),a=this.get_config("api_host")+(o.endpoint||"/e/"),c=o!==j;return!this.get_config("request_batching")||c&&!o._batchKey||o.send_instantly?this.__compress_and_send_json_request(a,p,o):(s.timestamp=new Date,this._requestQueue.enqueue(a,s,o)),this._invokeCaptureHooks(e,s),s}}}),L.prototype._addCaptureHook=function(e){this.__captureHooks.push(e)},L.prototype._invokeCaptureHooks=function(e,t){this.config._onCapture(e,t),i._.each(this.__captureHooks,function(t){return t(e)})},L.prototype._calculate_event_properties=function(e,t,o){var r=t||{};if(r.token=this.get_config("token"),"$snapshot"===e){var n=this.persistence.properties();return r.distinct_id=n.distinct_id,r}if(!i._.isUndefined(o)){var s=(new Date).getTime()-o;r.$duration=parseFloat((s/1e3).toFixed(3))}if(this.sessionManager){var p=this.sessionManager.getSessionAndWindowId(),a=p.sessionId,c=p.windowId;r.$session_id=a,r.$window_id=c}if(r=i._.extend({},i._.info.properties(),this.persistence.properties(),r),"$pageview"===e&&this.get_config("_capture_performance")){var _={navigation:U("navigation"),paint:U("paint"),resource:U("resource")};r.$performance_raw=JSON.stringify(_),_.navigation.length>0&&_.navigation[0].duration>=0&&(r.$performance_pageLoaded=_.navigation[0].duration)}var u=this.get_config("property_blacklist");i._.isArray(u)?i._.each(u,function(e){delete r[e]}):i.console.error("Invalid value for property_blacklist config: "+u);var d=this.get_config("sanitize_properties");return d&&(r=d(r,e)),r},L.prototype.register=function(e,t){this.persistence.register(e,t)},L.prototype.register_once=function(e,t,o){this.persistence.register_once(e,t,o)},L.prototype.unregister=function(e){this.persistence.unregister(e)},L.prototype._register_single=function(e,t){var o={};o[e]=t,this.register(o)},L.prototype.getFeatureFlag=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.featureFlags.getFeatureFlag(e,t)},L.prototype.isFeatureEnabled=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.featureFlags.isFeatureEnabled(e,t)},L.prototype.reloadFeatureFlags=function(){return this.featureFlags.reloadFeatureFlags()},L.prototype.onFeatureFlags=function(e){this.featureFlags.addFeatureFlagsHandler(e),e(this.featureFlags.getFlags(),this.featureFlags.getFlagVariants())},L.prototype.identify=function(e,t,o){if(e){this._captureMetrics.incr("identify");var r=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var n=r;this.register_once({$had_persisted_distinct_id:!0,$device_id:n},"")}e!==r&&e!==this.get_property(a.ALIAS_ID_KEY)&&(this.unregister(a.ALIAS_ID_KEY),this.register({distinct_id:e})),e===r||this.get_property("$device_id")&&r!==this.get_property("$device_id")?(t&&this.people.set(t),o&&this.people.set_once(o)):this.capture("$identify",{distinct_id:e,$anon_distinct_id:r},{$set:t||{}},{$set_once:o||{}}),e!==r&&this.reloadFeatureFlags()}else i.console.error("Unique user id has not been set in posthog.identify")},L.prototype.group=function(e,t,o){if(e&&t){this._captureMetrics.incr("group");var r=this.getGroups();this.register({$groups:k(k({},r),{},S({},e,t))}),o&&this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:o}),r[e]!==t&&this.reloadFeatureFlags()}else i.console.error("posthog.group requires a group type and group key")},L.prototype.reset=function(e){var t=this.get_property("$device_id");this.persistence.clear();var o=i._.UUID();this.register_once({distinct_id:o,$device_id:e?o:t},"")},L.prototype.get_distinct_id=function(){return this.get_property("distinct_id")},L.prototype.getGroups=function(){return this.get_property("$groups")||{}},L.prototype.alias=function(e,t){if(e===this.get_property(a.PEOPLE_DISTINCT_ID_KEY))return i.console.critical("Attempting to create alias for existing People user - aborting."),-2;var o=this;return i._.isUndefined(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(a.ALIAS_ID_KEY,e),this.capture("$create_alias",{alias:e,distinct_id:t},function(){o.identify(e)})):(i.console.error("alias matches current distinct_id - skipping api call."),this.identify(e),-1)},L.prototype.set_config=function(e){var t=k({},this.config);i._.isObject(e)&&(i._.extend(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),g.localStore.is_supported()&&"true"===g.localStore.get("ph_debug")&&(this.config.debug=!0),r.default.DEBUG=r.default.DEBUG||this.get_config("debug"),this.sessionRecording&&void 0!==e.disable_session_recording&&t.disable_session_recording!==e.disable_session_recording&&(e.disable_session_recording?this.sessionRecording.stopRecording():this.sessionRecording.startRecordingIfEnabled()))},L.prototype.startSessionRecording=function(){this.set_config({disable_session_recording:!1})},L.prototype.stopSessionRecording=function(){this.set_config({disable_session_recording:!0})},L.prototype.sessionRecordingStarted=function(){return this.sessionRecording.started()},L.prototype.get_config=function(e){return this.config[e]},L.prototype.get_property=function(e){return this.persistence.props[e]},L.prototype.toString=function(){var e=this.get_config("name");return e!==A&&(e=A+"."+e),e},L.prototype._gdpr_init=function(){"localStorage"===this.get_config("opt_out_capturing_persistence_type")&&g.localStore.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")&&!g.cookieStore.get("ph_optout")||(g.cookieStore.remove("ph_optout"),this.opt_out_capturing({clear_persistence:this.get_config("opt_out_persistence_by_default")}))},L.prototype._gdpr_update_persistence=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)},L.prototype._gdpr_call_func=function(e,t){return t=i._.extend({capture:i._.bind(this.capture,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),g.localStore.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})},L.prototype.opt_in_capturing=function(e){e=i._.extend({enable_persistence:!0},e),this._gdpr_call_func(d.optIn,e),this._gdpr_update_persistence(e)},L.prototype.opt_out_capturing=function(e){e=i._.extend({clear_persistence:!0},e),this._gdpr_call_func(d.optOut,e),this._gdpr_update_persistence(e)},L.prototype.has_opted_in_capturing=function(e){return this._gdpr_call_func(d.hasOptedIn,e)},L.prototype.has_opted_out_capturing=function(e){return this._gdpr_call_func(d.hasOptedOut,e)},L.prototype.clear_opt_in_out_capturing=function(e){e=i._.extend({enable_persistence:!0},e),this._gdpr_call_func(d.clearOptInOut,e),this._gdpr_update_persistence(e)},L.prototype.sentry_integration=function(e,t,o,r){this.name="posthog-js",this.setupOnce=function(i){i(function(i){if("error"!==i.level||!e.__loaded)return i;i.tags||(i.tags={}),i.tags["PostHog URL"]=e.config.api_host+"/person/"+e.get_distinct_id();var n={$sentry_event_id:i.event_id,$sentry_exception:i.exception};return t&&o&&(n.$sentry_url=(r||"https://sentry.io/organizations/")+t+"/issues/?project="+o+"&query="+i.event_id),e.capture("$exception",n),i})}},L.prototype.debug=function(e){!1===e?(i.window.console.log("You've disabled debug mode."),localStorage&&localStorage.setItem("ph_debug",void 0),this.set_config({debug:!1})):(i.window.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),localStorage&&localStorage.setItem("ph_debug","true"),this.set_config({debug:!0}))},L.prototype.decodeLZ64=o.LZString.decompressFromBase64,L.prototype.init=L.prototype.init,L.prototype.reset=L.prototype.reset,L.prototype.capture=L.prototype.capture,L.prototype.register=L.prototype.register,L.prototype.register_once=L.prototype.register_once,L.prototype.unregister=L.prototype.unregister,L.prototype.identify=L.prototype.identify,L.prototype.getGroups=L.prototype.getGroups,L.prototype.group=L.prototype.group,L.prototype.alias=L.prototype.alias,L.prototype.set_config=L.prototype.set_config,L.prototype.get_config=L.prototype.get_config,L.prototype.get_property=L.prototype.get_property,L.prototype.get_distinct_id=L.prototype.get_distinct_id,L.prototype.toString=L.prototype.toString,L.prototype.opt_out_captureing=L.prototype.opt_out_captureing,L.prototype.opt_in_captureing=L.prototype.opt_in_captureing,L.prototype.has_opted_out_captureing=L.prototype.has_opted_out_captureing,L.prototype.has_opted_in_captureing=L.prototype.has_opted_in_captureing,L.prototype.clear_opt_in_out_captureing=L.prototype.clear_opt_in_out_captureing,L.prototype.opt_out_capturing=L.prototype.opt_out_capturing,L.prototype.opt_in_capturing=L.prototype.opt_in_capturing,L.prototype.has_opted_out_capturing=L.prototype.has_opted_out_capturing,L.prototype.has_opted_in_capturing=L.prototype.has_opted_in_capturing,L.prototype.clear_opt_in_out_capturing=L.prototype.clear_opt_in_out_capturing,L.prototype.getFeatureFlag=L.prototype.getFeatureFlag,L.prototype.isFeatureEnabled=L.prototype.isFeatureEnabled,L.prototype.reloadFeatureFlags=L.prototype.reloadFeatureFlags,L.prototype.onFeatureFlags=L.prototype.onFeatureFlags,L.prototype.decodeLZ64=L.prototype.decodeLZ64,L.prototype.SentryIntegration=L.prototype.sentry_integration,L.prototype.debug=L.prototype.debug,L.prototype.LIB_VERSION=r.default.LIB_VERSION,L.prototype.startSessionRecording=L.prototype.startSessionRecording,L.prototype.stopSessionRecording=L.prototype.stopSessionRecording,L.prototype.sessionRecordingStarted=L.prototype.sessionRecordingStarted,a.PostHogPersistence.prototype.properties=a.PostHogPersistence.prototype.properties,a.PostHogPersistence.prototype.update_search_keyword=a.PostHogPersistence.prototype.update_search_keyword,a.PostHogPersistence.prototype.update_referrer_info=a.PostHogPersistence.prototype.update_referrer_info,a.PostHogPersistence.prototype.get_cross_subdomain=a.PostHogPersistence.prototype.get_cross_subdomain,a.PostHogPersistence.prototype.clear=a.PostHogPersistence.prototype.clear,i._.safewrap_class(L,["identify"]);var T={},B=function(){i._.each(T,function(e,o){o!==A&&(t[o]=e)}),t._=i._},Q=function(){t.init=function(o,r,n){if(n)return t[n]||(t[n]=T[n]=C(o,r,n),t[n]._loaded()),t[n];var s=t;T[A]?s=T[A]:o&&((s=C(o,r,A))._loaded(),T[A]=s),t=s,e===I&&(i.window[A]=t),B()}},N=function(){function e(){e.done||(e.done=!0,M=!1,i._.each(T,function(e){e._dom_loaded()}))}if(i.document.addEventListener)"complete"===i.document.readyState?e():i.document.addEventListener("DOMContentLoaded",e,!1);else if(i.document.attachEvent){i.document.attachEvent("onreadystatechange",e);var t=!1;try{t=null===i.window.frameElement}catch(o){}i.document.documentElement.doScroll&&t&&function t(){try{i.document.documentElement.doScroll("left")}catch(o){return void setTimeout(t,1)}e()}()}i._.register_event(i.window,"load",e,!0)};function Y(){e=I,i._.isUndefined(i.window.posthog)&&(i.window.posthog=[]),(t=i.window.posthog).__loaded||t.config&&t.persistence?i.console.error("PostHog library has already been downloaded at least once."):(i._.each(t._i,function(e){e&&i._.isArray(e)&&(T[e[e.length-1]]=C.apply(this,e))}),Q(),t.init(),i._.each(T,function(e){e._loaded()}),N())}function G(){return e=$,t=new L,Q(),t.init(),N(),t}
53
- },{"./lz-string":"zdbk","./config":"itQ5","./utils":"FOZT","./autocapture":"gR3r","./posthog-people":"ecEG","./posthog-featureflags":"aVqC","./posthog-persistence":"MAdm","./extensions/sessionrecording":"Z2N4","./decide":"auG7","./extensions/toolbar":"ZEpJ","./gdpr-utils":"rxSh","./storage":"KZ7Y","./request-queue":"Je4H","./capture-metrics":"TeHW","./compression":"Ie9M","./send-request":"tOu2","./retry-queue":"ennf","./sessionid":"tci7"}],"e2xX":[function(require,module,exports) {
51
+ },{"./extensions/sessionrecording":"Z2N4","./posthog-persistence":"MAdm","./storage":"KZ7Y","./utils":"FOZT"}],"eWVp":[function(require,module,exports) {
52
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.optimisePerformanceData=o,exports.getPerformanceEntriesByType=a,exports.deduplicateKeys=i,exports.pageLoadFrom=u,exports.getPerformanceData=c;var e=require("./utils"),r=n(require("./config"));function n(e){return e&&e.__esModule?e:{default:e}}function t(e){return Number(e)===e&&e%1!=0}function o(e){return e.forEach(function(r,n){for(var o in r)t(r[o])&&r[o].toString().match(/^\d+\.\d{4,}$/)&&(e[n][o]=Number(r[o].toFixed(3))),["serverTiming","workerTiming"].includes(o)&&0===r[o].length&&delete e[n][o],"entryType"===o&&"resource"===r[o]&&delete e[n][o],"nextHopProtocol"===o&&delete e[n][o],0===r[o]&&delete e[n][o]}),i(e)}function a(n){try{return o(JSON.parse(JSON.stringify(e.window.performance.getEntriesByType(n))))}catch(t){return r.default.DEBUG&&console.warn("not able to capture performance data ("+n+") - "+t),[]}}function i(e){if(0===e.length)return[];var r=Object.keys(e[0]);return[r,e.map(function(e){return r.map(function(r){return e[r]})})]}function u(e){var r=e.navigation&&e.navigation[0]&&e.navigation[0].indexOf("duration");return e.navigation[1]&&e.navigation[1][0][r]}function c(){var e={navigation:a("navigation"),paint:a("paint"),resource:a("resource")},r={},n=u(e);return n&&(r.$performance_page_loaded=n),r.$performance_raw=JSON.stringify(e),r}
53
+ },{"./utils":"FOZT","./config":"itQ5"}],"ok3T":[function(require,module,exports) {
54
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.init_from_snippet=Y,exports.init_as_module=G,exports.PostHogLib=void 0;var e,t,o=require("./lz-string"),r=w(require("./config")),i=require("./utils"),n=require("./autocapture"),s=require("./posthog-people"),p=require("./posthog-featureflags"),a=require("./posthog-persistence"),c=require("./extensions/sessionrecording"),_=require("./decide"),u=require("./extensions/toolbar"),d=require("./gdpr-utils"),g=require("./storage"),l=require("./request-queue"),h=require("./capture-metrics"),f=require("./compression"),y=require("./send-request"),b=require("./retry-queue"),m=require("./sessionid"),v=require("./apm");function w(e){return e&&e.__esModule?e:{default:e}}function k(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,r)}return o}function q(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?k(Object(o),!0).forEach(function(t){P(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):k(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}function P(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function S(e,t){return $(e)||E(e,t)||x(e,t)||F()}function F(){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 x(e,t){if(e){if("string"==typeof e)return O(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);return"Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?O(e,t):void 0}}function O(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,r=new Array(t);o<t;o++)r[o]=e[o];return r}function E(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var o=[],r=!0,i=!1,n=void 0;try{for(var s,p=e[Symbol.iterator]();!(r=(s=p.next()).done)&&(o.push(s.value),!t||o.length!==t);r=!0);}catch(a){i=!0,n=a}finally{try{r||null==p.return||p.return()}finally{if(i)throw n}}return o}}function $(e){if(Array.isArray(e))return e}var I=0,H=1,j=function(){},A={},R="posthog",M=i.window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,D=!M&&-1===i.userAgent.indexOf("MSIE")&&-1===i.userAgent.indexOf("Mozilla"),L=function(){return{api_host:"https://app.posthog.com",api_method:"POST",api_transport:"XHR",autocapture:!0,rageclick:!1,cross_subdomain_cookie:-1===i.document.location.hostname.indexOf("herokuapp.com"),persistence:"cookie",persistence_name:"",cookie_name:"",loaded:function(){},store_google:!0,save_referrer:!0,test:!1,verbose:!1,img:!1,capture_pageview:!0,debug:!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_cookie:!1,secure_cookie:"https:"===i.window.location.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,property_blacklist:[],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:!1,maskInputOptions:{},maskInputFn:null,slimDOMOptions:{},collectFonts:!1},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;i.console.error(t)},_onCapture:function(){},_capture_metrics:!1,_capture_performance:!1}},C=function(){};exports.PostHogLib=C;var U=function(o,a,_){var d,g=_===R?t:t[_];if(g&&e===I)d=g;else{if(g&&!i._.isArray(g))return void i.console.error("You have already initialized "+_);d=new C}if(d._init(o,a,_),d.people=new s.PostHogPeople,d.people._init(d),d.featureFlags=new p.PostHogFeatureFlags(d),d.feature_flags=d.featureFlags,d.toolbar=new u.Toolbar(d),d.toolbar.maybeLoadEditor(),d.sessionRecording=new c.SessionRecording(d),d.sessionRecording.startRecordingIfEnabled(),d.__autocapture_enabled=d.get_config("autocapture"),d.get_config("autocapture")){n.autocapture.enabledForProject(d.get_config("token"),100,100)?n.autocapture.isBrowserSupported()?n.autocapture.init(d):(d.__autocapture_enabled=!1,i.console.log("Disabling Automatic Event Collection because this browser is not supported")):(d.__autocapture_enabled=!1,i.console.log("Not in active bucket: disabling Automatic Event Collection."))}return r.default.DEBUG=r.default.DEBUG||d.get_config("debug"),!i._.isUndefined(g)&&i._.isArray(g)&&(d._execute_array.call(d.people,g.people),d._execute_array(g)),d};C.prototype.init=function(e,o,r){if(i._.isUndefined(r))i.console.error("You must name your new library: init(token, config, name)");else{if(r!==R){var n=U(e,o,r);return t[r]=n,n._loaded(),n}i.console.error("You must initialize the main posthog object right after you include the PostHog js snippet")}},C.prototype._init=function(e,t,o){this.__loaded=!0,this.config={},this._triggered_notifs=[],this.compression={},this.set_config(i._.extend({},L(),t,{name:o,token:e,callback_fn:(o===R?o:R+"."+o)+"._jsc"})),this._jsc=function(){},this._captureMetrics=new h.CaptureMetrics(this.get_config("_capture_metrics"),i._.bind(this.capture,this)),this._requestQueue=new l.RequestQueue(this._captureMetrics,i._.bind(this._handle_queued_event,this)),this._retryQueue=new b.RetryQueue(this._captureMetrics,this.get_config("on_xhr_error")),this.__captureHooks=[],this.__request_queue=[],this.persistence=new a.PostHogPersistence(this.config),this.sessionManager=new m.SessionIdManager(this.config,this.persistence),this._gdpr_init();var r=i._.UUID();this.get_distinct_id()||this.register_once({distinct_id:r,$device_id:r},""),i.window.addEventListener&&i.window.addEventListener("unload",this._handle_unload.bind(this))},C.prototype._loaded=function(){this.featureFlags.setReloadingPaused(!0);try{this.get_config("loaded")(this)}catch(e){i.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 _.Decide(this).call(),this.featureFlags.resetRequestQueue(),this.featureFlags.setReloadingPaused(!1)},C.prototype._start_queue_if_opted_in=function(){this.has_opted_out_capturing()||this.get_config("request_batching")&&this._requestQueue.poll()},C.prototype._dom_loaded=function(){this.has_opted_out_capturing()||i._.each(this.__request_queue,function(e){this._send_request.apply(this,e)},this),delete this.__request_queue,this._start_queue_if_opted_in()},C.prototype._prepare_callback=function(e,t){if(i._.isUndefined(e))return null;if(M){return function(o){e(o,t)}}var o=this._jsc,r=""+Math.floor(1e8*Math.random()),n=this.get_config("callback_fn")+"["+r+"]";return o[r]=function(i){delete o[r],e(i,t)},n},C.prototype._handle_unload=function(){this.get_config("request_batching")?(this.get_config("capture_pageview")&&this.capture("$pageleave"),this.get_config("_capture_metrics")&&(this._requestQueue.updateUnloadMetrics(),this.capture("$capture_metrics",this._captureMetrics.metrics),this._captureMetrics.captureInProgressRequests()),this._requestQueue.unload(),this._retryQueue.unload()):this.get_config("capture_pageview")&&this.capture("$pageleave",null,{transport:"sendbeacon"})},C.prototype._handle_queued_event=function(e,t,o){var r=JSON.stringify(t);this.__compress_and_send_json_request(e,r,o||A,j)},C.prototype.__compress_and_send_json_request=function(e,t,o,r){var i=S((0,f.compressData)((0,f.decideCompression)(this.compression),t,o),2),n=i[0],s=i[1];this._send_request(e,n,s,r)},C.prototype._send_request=function(e,t,o,r){if(D)this.__request_queue.push(arguments);else{var n={method:this.get_config("api_method"),transport:this.get_config("api_transport"),verbose:this.get_config("verbose")};o=i._.extend(n,o||{}),M||(o.method="GET");var s=i.window.navigator.sendBeacon&&"sendbeacon"===o.transport.toLowerCase(),p=o.urlQueryArgs||{};p.ip=this.get_config("ip")?1:0,p._=(new Date).getTime().toString();var a=e.indexOf("?")>-1?"&":"?";if(e+=a+i._.HTTPBuildQuery(p),i._.isObject(t)&&this.get_config("img")){var c=i.document.createElement("img");c.src=e,i.document.body.appendChild(c)}else if(s)try{i.window.navigator.sendBeacon(e,(0,y.encodePostData)(t,q(q({},o),{},{sendBeacon:!0})))}catch(d){this.get_config("debug")&&i.console.error(d)}else if(M)try{(0,y.xhr)({url:e,data:t,headers:this.get_config("xhr_headers"),options:o,captureMetrics:this._captureMetrics,callback:r,retriesPerformedSoFar:0,retryQueue:this._retryQueue,onXHRError:this.get_config("on_xhr_error")})}catch(d){i.console.error(d)}else{var _=i.document.createElement("script");_.type="text/javascript",_.async=!0,_.defer=!0,_.src=e;var u=i.document.getElementsByTagName("script")[0];u.parentNode.insertBefore(_,u)}}},C.prototype._execute_array=function(e){var t,o=[],r=[],n=[];i._.each(e,function(e){e&&(t=e[0],i._.isArray(t)?n.push(e):"function"==typeof e?e.call(this):i._.isArray(e)&&"alias"===t?o.push(e):i._.isArray(e)&&-1!==t.indexOf("capture")&&"function"==typeof this[t]?n.push(e):r.push(e))},this);var s=function(e,t){i._.each(e,function(e){if(i._.isArray(e[0])){var o=t;i._.each(e,function(e){o=o[e[0]].apply(o,e.slice(1))})}else this[e[0]].apply(this,e.slice(1))},t)};s(o,this),s(r,this),s(n,this)},C.prototype.push=function(e){this._execute_array([e])},C.prototype.capture=(0,d.addOptOutCheckPostHogLib)(function(e,t,o){if(this.__loaded){this._captureMetrics.incr("capture"),"$snapshot"===e&&this._captureMetrics.incr("snapshot");var r=(o=o||A).transport;if(r&&(o.transport=r),i._.isUndefined(e)||"string"!=typeof e)i.console.error("No event name provided to posthog.capture");else if(!i._.isBlockedUA(i.userAgent)){var n=this.persistence.remove_event_timer(e);this.persistence.update_search_keyword(i.document.referrer),this.get_config("store_google")&&this.persistence.update_campaign_params(),this.get_config("save_referrer")&&this.persistence.update_referrer_info(i.document.referrer);var s={event:e,properties:this._calculate_event_properties(e,t,n)};"$identify"===e&&o.$set&&(s.$set=o.$set),s=i._.copyAndTruncateStrings(s,o._noTruncate?null:this.get_config("properties_string_max_length")),this.get_config("debug")&&i.console.log("PostHog.js send",s);var p=JSON.stringify(s),a=this.get_config("api_host")+(o.endpoint||"/e/"),c=o!==A;return!this.get_config("request_batching")||c&&!o._batchKey||o.send_instantly?this.__compress_and_send_json_request(a,p,o):(s.timestamp=new Date,this._requestQueue.enqueue(a,s,o)),this._invokeCaptureHooks(e,s),s}}}),C.prototype._addCaptureHook=function(e){this.__captureHooks.push(e)},C.prototype._invokeCaptureHooks=function(e,t){this.config._onCapture(e,t),i._.each(this.__captureHooks,function(t){return t(e)})},C.prototype._calculate_event_properties=function(e,t,o){var r=t||{};if(r.token=this.get_config("token"),"$snapshot"===e){var n=this.persistence.properties();return r.distinct_id=n.distinct_id,r}if(!i._.isUndefined(o)){var s=(new Date).getTime()-o;r.$duration=parseFloat((s/1e3).toFixed(3))}if(this.sessionManager){var p=this.sessionManager.getSessionAndWindowId(),a=p.sessionId,c=p.windowId;r.$session_id=a,r.$window_id=c}r=i._.extend({},i._.info.properties(),this.persistence.properties(),r),"$pageview"===e&&this.get_config("_capture_performance")&&(r=i._.extend(r,(0,v.getPerformanceData)()));var _=this.get_config("property_blacklist");i._.isArray(_)?i._.each(_,function(e){delete r[e]}):i.console.error("Invalid value for property_blacklist config: "+_);var u=this.get_config("sanitize_properties");return u&&(r=u(r,e)),r},C.prototype.register=function(e,t){this.persistence.register(e,t)},C.prototype.register_once=function(e,t,o){this.persistence.register_once(e,t,o)},C.prototype.unregister=function(e){this.persistence.unregister(e)},C.prototype._register_single=function(e,t){var o={};o[e]=t,this.register(o)},C.prototype.getFeatureFlag=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.featureFlags.getFeatureFlag(e,t)},C.prototype.isFeatureEnabled=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.featureFlags.isFeatureEnabled(e,t)},C.prototype.reloadFeatureFlags=function(){return this.featureFlags.reloadFeatureFlags()},C.prototype.onFeatureFlags=function(e){this.featureFlags.addFeatureFlagsHandler(e),e(this.featureFlags.getFlags(),this.featureFlags.getFlagVariants())},C.prototype.identify=function(e,t,o){if(e){this._captureMetrics.incr("identify");var r=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var n=r;this.register_once({$had_persisted_distinct_id:!0,$device_id:n},"")}e!==r&&e!==this.get_property(a.ALIAS_ID_KEY)&&(this.unregister(a.ALIAS_ID_KEY),this.register({distinct_id:e})),e===r||this.get_property("$device_id")&&r!==this.get_property("$device_id")?(t&&this.people.set(t),o&&this.people.set_once(o)):this.capture("$identify",{distinct_id:e,$anon_distinct_id:r},{$set:t||{}},{$set_once:o||{}}),e!==r&&this.reloadFeatureFlags()}else i.console.error("Unique user id has not been set in posthog.identify")},C.prototype.group=function(e,t,o){if(e&&t){this._captureMetrics.incr("group");var r=this.getGroups();this.register({$groups:q(q({},r),{},P({},e,t))}),o&&this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:o}),r[e]!==t&&this.reloadFeatureFlags()}else i.console.error("posthog.group requires a group type and group key")},C.prototype.reset=function(e){var t=this.get_property("$device_id");this.persistence.clear();var o=i._.UUID();this.register_once({distinct_id:o,$device_id:e?o:t},"")},C.prototype.get_distinct_id=function(){return this.get_property("distinct_id")},C.prototype.getGroups=function(){return this.get_property("$groups")||{}},C.prototype.alias=function(e,t){if(e===this.get_property(a.PEOPLE_DISTINCT_ID_KEY))return i.console.critical("Attempting to create alias for existing People user - aborting."),-2;var o=this;return i._.isUndefined(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(a.ALIAS_ID_KEY,e),this.capture("$create_alias",{alias:e,distinct_id:t},function(){o.identify(e)})):(i.console.error("alias matches current distinct_id - skipping api call."),this.identify(e),-1)},C.prototype.set_config=function(e){var t=q({},this.config);i._.isObject(e)&&(i._.extend(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),g.localStore.is_supported()&&"true"===g.localStore.get("ph_debug")&&(this.config.debug=!0),r.default.DEBUG=r.default.DEBUG||this.get_config("debug"),this.sessionRecording&&void 0!==e.disable_session_recording&&t.disable_session_recording!==e.disable_session_recording&&(e.disable_session_recording?this.sessionRecording.stopRecording():this.sessionRecording.startRecordingIfEnabled()))},C.prototype.startSessionRecording=function(){this.set_config({disable_session_recording:!1})},C.prototype.stopSessionRecording=function(){this.set_config({disable_session_recording:!0})},C.prototype.sessionRecordingStarted=function(){return this.sessionRecording.started()},C.prototype.get_config=function(e){return this.config[e]},C.prototype.get_property=function(e){return this.persistence.props[e]},C.prototype.toString=function(){var e=this.get_config("name");return e!==R&&(e=R+"."+e),e},C.prototype._gdpr_init=function(){"localStorage"===this.get_config("opt_out_capturing_persistence_type")&&g.localStore.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")&&!g.cookieStore.get("ph_optout")||(g.cookieStore.remove("ph_optout"),this.opt_out_capturing({clear_persistence:this.get_config("opt_out_persistence_by_default")}))},C.prototype._gdpr_update_persistence=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)},C.prototype._gdpr_call_func=function(e,t){return t=i._.extend({capture:i._.bind(this.capture,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),g.localStore.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})},C.prototype.opt_in_capturing=function(e){e=i._.extend({enable_persistence:!0},e),this._gdpr_call_func(d.optIn,e),this._gdpr_update_persistence(e)},C.prototype.opt_out_capturing=function(e){e=i._.extend({clear_persistence:!0},e),this._gdpr_call_func(d.optOut,e),this._gdpr_update_persistence(e)},C.prototype.has_opted_in_capturing=function(e){return this._gdpr_call_func(d.hasOptedIn,e)},C.prototype.has_opted_out_capturing=function(e){return this._gdpr_call_func(d.hasOptedOut,e)},C.prototype.clear_opt_in_out_capturing=function(e){e=i._.extend({enable_persistence:!0},e),this._gdpr_call_func(d.clearOptInOut,e),this._gdpr_update_persistence(e)},C.prototype.sentry_integration=function(e,t,o,r){this.name="posthog-js",this.setupOnce=function(i){i(function(i){if("error"!==i.level||!e.__loaded)return i;i.tags||(i.tags={}),i.tags["PostHog URL"]=e.config.api_host+"/person/"+e.get_distinct_id();var n={$sentry_event_id:i.event_id,$sentry_exception:i.exception};return t&&o&&(n.$sentry_url=(r||"https://sentry.io/organizations/")+t+"/issues/?project="+o+"&query="+i.event_id),e.capture("$exception",n),i})}},C.prototype.debug=function(e){!1===e?(i.window.console.log("You've disabled debug mode."),localStorage&&localStorage.setItem("ph_debug",void 0),this.set_config({debug:!1})):(i.window.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}))},C.prototype.decodeLZ64=o.LZString.decompressFromBase64,C.prototype.init=C.prototype.init,C.prototype.reset=C.prototype.reset,C.prototype.capture=C.prototype.capture,C.prototype.register=C.prototype.register,C.prototype.register_once=C.prototype.register_once,C.prototype.unregister=C.prototype.unregister,C.prototype.identify=C.prototype.identify,C.prototype.getGroups=C.prototype.getGroups,C.prototype.group=C.prototype.group,C.prototype.alias=C.prototype.alias,C.prototype.set_config=C.prototype.set_config,C.prototype.get_config=C.prototype.get_config,C.prototype.get_property=C.prototype.get_property,C.prototype.get_distinct_id=C.prototype.get_distinct_id,C.prototype.toString=C.prototype.toString,C.prototype.opt_out_captureing=C.prototype.opt_out_captureing,C.prototype.opt_in_captureing=C.prototype.opt_in_captureing,C.prototype.has_opted_out_captureing=C.prototype.has_opted_out_captureing,C.prototype.has_opted_in_captureing=C.prototype.has_opted_in_captureing,C.prototype.clear_opt_in_out_captureing=C.prototype.clear_opt_in_out_captureing,C.prototype.opt_out_capturing=C.prototype.opt_out_capturing,C.prototype.opt_in_capturing=C.prototype.opt_in_capturing,C.prototype.has_opted_out_capturing=C.prototype.has_opted_out_capturing,C.prototype.has_opted_in_capturing=C.prototype.has_opted_in_capturing,C.prototype.clear_opt_in_out_capturing=C.prototype.clear_opt_in_out_capturing,C.prototype.getFeatureFlag=C.prototype.getFeatureFlag,C.prototype.isFeatureEnabled=C.prototype.isFeatureEnabled,C.prototype.reloadFeatureFlags=C.prototype.reloadFeatureFlags,C.prototype.onFeatureFlags=C.prototype.onFeatureFlags,C.prototype.decodeLZ64=C.prototype.decodeLZ64,C.prototype.SentryIntegration=C.prototype.sentry_integration,C.prototype.debug=C.prototype.debug,C.prototype.LIB_VERSION=r.default.LIB_VERSION,C.prototype.startSessionRecording=C.prototype.startSessionRecording,C.prototype.stopSessionRecording=C.prototype.stopSessionRecording,C.prototype.sessionRecordingStarted=C.prototype.sessionRecordingStarted,a.PostHogPersistence.prototype.properties=a.PostHogPersistence.prototype.properties,a.PostHogPersistence.prototype.update_search_keyword=a.PostHogPersistence.prototype.update_search_keyword,a.PostHogPersistence.prototype.update_referrer_info=a.PostHogPersistence.prototype.update_referrer_info,a.PostHogPersistence.prototype.get_cross_subdomain=a.PostHogPersistence.prototype.get_cross_subdomain,a.PostHogPersistence.prototype.clear=a.PostHogPersistence.prototype.clear,i._.safewrap_class(C,["identify"]);var T={},B=function(){i._.each(T,function(e,o){o!==R&&(t[o]=e)}),t._=i._},Q=function(){t.init=function(o,r,n){if(n)return t[n]||(t[n]=T[n]=U(o,r,n),t[n]._loaded()),t[n];var s=t;T[R]?s=T[R]:o&&((s=U(o,r,R))._loaded(),T[R]=s),t=s,e===H&&(i.window[R]=t),B()}},N=function(){function e(){e.done||(e.done=!0,D=!1,i._.each(T,function(e){e._dom_loaded()}))}if(i.document.addEventListener)"complete"===i.document.readyState?e():i.document.addEventListener("DOMContentLoaded",e,!1);else if(i.document.attachEvent){i.document.attachEvent("onreadystatechange",e);var t=!1;try{t=null===i.window.frameElement}catch(o){}i.document.documentElement.doScroll&&t&&function t(){try{i.document.documentElement.doScroll("left")}catch(o){return void setTimeout(t,1)}e()}()}i._.register_event(i.window,"load",e,!0)};function Y(){e=H,i._.isUndefined(i.window.posthog)&&(i.window.posthog=[]),(t=i.window.posthog).__loaded||t.config&&t.persistence?i.console.error("PostHog library has already been downloaded at least once."):(i._.each(t._i,function(e){e&&i._.isArray(e)&&(T[e[e.length-1]]=U.apply(this,e))}),Q(),t.init(),i._.each(T,function(e){e._loaded()}),N())}function G(){return e=I,t=new C,Q(),t.init(),N(),t}
55
+ },{"./lz-string":"zdbk","./config":"itQ5","./utils":"FOZT","./autocapture":"gR3r","./posthog-people":"ecEG","./posthog-featureflags":"aVqC","./posthog-persistence":"MAdm","./extensions/sessionrecording":"Z2N4","./decide":"auG7","./extensions/toolbar":"ZEpJ","./gdpr-utils":"rxSh","./storage":"KZ7Y","./request-queue":"Je4H","./capture-metrics":"TeHW","./compression":"Ie9M","./send-request":"tOu2","./retry-queue":"ennf","./sessionid":"tci7","./apm":"eWVp"}],"e2xX":[function(require,module,exports) {
54
56
  "use strict";var r=require("./posthog-core");(0,r.init_from_snippet)();
55
57
  },{"./posthog-core":"ok3T"}]},{},["e2xX"], null)
package/dist/es.js CHANGED
@@ -863,7 +863,7 @@ var LZString = {
863
863
  }
864
864
  };
865
865
 
866
- var version = "1.17.0";
866
+ var version = "1.17.4";
867
867
 
868
868
  var Config$1 = {
869
869
  DEBUG: false,
@@ -1171,15 +1171,22 @@ _.strip_empty_properties = function (p) {
1171
1171
  });
1172
1172
 
1173
1173
  return ret;
1174
- }; // Deep copies an object.
1175
- // It handles cycles by replacing all references to them with `undefined`
1176
- // Also supports customizing native values
1177
-
1174
+ };
1178
1175
 
1179
1176
  var COPY_IN_PROGRESS_ATTRIBUTE = typeof Symbol !== 'undefined' ? Symbol('__deepCircularCopyInProgress__') : '__deepCircularCopyInProgress__';
1177
+ /**
1178
+ * Deep copies an object.
1179
+ * It handles cycles by replacing all references to them with `undefined`
1180
+ * Also supports customizing native values
1181
+ *
1182
+ * @param value
1183
+ * @param customizer
1184
+ * @param [key] if provided this is the object key associated with the value to be copied. It allows the customizer function to have context when it runs
1185
+ * @returns {{}|undefined|*}
1186
+ */
1180
1187
 
1181
- function deepCircularCopy(value, customizer) {
1182
- if (value !== Object(value)) return customizer ? customizer(value) : value; // primitive value
1188
+ function deepCircularCopy(value, customizer, key) {
1189
+ if (value !== Object(value)) return customizer ? customizer(value, key) : value; // primitive value
1183
1190
 
1184
1191
  if (value[COPY_IN_PROGRESS_ATTRIBUTE]) return undefined;
1185
1192
  value[COPY_IN_PROGRESS_ATTRIBUTE] = true;
@@ -1196,7 +1203,7 @@ function deepCircularCopy(value, customizer) {
1196
1203
 
1197
1204
  _.each(value, function (val, key) {
1198
1205
  if (key !== COPY_IN_PROGRESS_ATTRIBUTE) {
1199
- result[key] = deepCircularCopy(val, customizer);
1206
+ result[key] = deepCircularCopy(val, customizer, key);
1200
1207
  }
1201
1208
  });
1202
1209
  }
@@ -1205,8 +1212,14 @@ function deepCircularCopy(value, customizer) {
1205
1212
  return result;
1206
1213
  }
1207
1214
 
1215
+ var LONG_STRINGS_ALLOW_LIST = ['$performance_raw'];
1216
+
1208
1217
  _.copyAndTruncateStrings = function (object, maxStringLength) {
1209
- return deepCircularCopy(object, function (value) {
1218
+ return deepCircularCopy(object, function (value, key) {
1219
+ if (key && LONG_STRINGS_ALLOW_LIST.indexOf(key) > -1) {
1220
+ return value;
1221
+ }
1222
+
1210
1223
  if (typeof value === 'string' && maxStringLength !== null) {
1211
1224
  value = value.slice(0, maxStringLength);
1212
1225
  }
@@ -3895,7 +3908,8 @@ var Decide = /*#__PURE__*/function () {
3895
3908
  var encoded_data = _.base64Encode(json_data);
3896
3909
 
3897
3910
  this.instance._send_request("".concat(this.instance.get_config('api_host'), "/decide/?v=2"), {
3898
- data: encoded_data
3911
+ data: encoded_data,
3912
+ verbose: true
3899
3913
  }, {
3900
3914
  method: 'POST'
3901
3915
  }, function (response) {
@@ -3907,6 +3921,11 @@ var Decide = /*#__PURE__*/function () {
3907
3921
  value: function parseDecideResponse(response) {
3908
3922
  var _this2 = this;
3909
3923
 
3924
+ if ((response === null || response === void 0 ? void 0 : response.status) === 0) {
3925
+ console.error('Failed to fetch feature flags from PostHog.');
3926
+ return;
3927
+ }
3928
+
3910
3929
  if (!(document && document.body)) {
3911
3930
  console.log('document not ready yet, trying again in 500 milliseconds...');
3912
3931
  setTimeout(function () {
@@ -3965,10 +3984,6 @@ var Toolbar = /*#__PURE__*/function () {
3965
3984
  this._loadEditor(_objectSpread2(_objectSpread2({}, editorParams), {}, {
3966
3985
  apiURL: this.instance.get_config('api_host')
3967
3986
  }));
3968
-
3969
- this.instance.set_config({
3970
- debug: true
3971
- });
3972
3987
  }
3973
3988
  }
3974
3989
  /**
@@ -5557,6 +5572,94 @@ var SessionIdManager = /*#__PURE__*/function () {
5557
5572
  return SessionIdManager;
5558
5573
  }();
5559
5574
 
5575
+ function isFloat(n) {
5576
+ return Number(n) === n && n % 1 !== 0;
5577
+ }
5578
+
5579
+ function optimisePerformanceData(performanceEntries) {
5580
+ performanceEntries.forEach(function (performanceEntry, index) {
5581
+ for (var performanceEntryItemKey in performanceEntry) {
5582
+ if (isFloat(performanceEntry[performanceEntryItemKey]) && performanceEntry[performanceEntryItemKey].toString().match(/^\d+\.\d{4,}$/)) {
5583
+ performanceEntries[index][performanceEntryItemKey] = Number(performanceEntry[performanceEntryItemKey].toFixed(3));
5584
+ }
5585
+
5586
+ if (['serverTiming', 'workerTiming'].includes(performanceEntryItemKey) && performanceEntry[performanceEntryItemKey].length === 0) {
5587
+ delete performanceEntries[index][performanceEntryItemKey];
5588
+ }
5589
+
5590
+ if (performanceEntryItemKey === 'entryType' && performanceEntry[performanceEntryItemKey] === 'resource') {
5591
+ delete performanceEntries[index][performanceEntryItemKey];
5592
+ }
5593
+
5594
+ if (performanceEntryItemKey === 'nextHopProtocol') {
5595
+ delete performanceEntries[index][performanceEntryItemKey];
5596
+ }
5597
+
5598
+ if (performanceEntry[performanceEntryItemKey] === 0) {
5599
+ delete performanceEntries[index][performanceEntryItemKey];
5600
+ }
5601
+ }
5602
+ });
5603
+ return deduplicateKeys(performanceEntries);
5604
+ }
5605
+ function getPerformanceEntriesByType(type) {
5606
+ // wide support but not available pre IE 10
5607
+ try {
5608
+ // stringifying and then parsing made data collection more reliable
5609
+ var entriesOfType = JSON.parse(JSON.stringify(win.performance.getEntriesByType(type)));
5610
+ return optimisePerformanceData(entriesOfType);
5611
+ } catch (ex) {
5612
+ if (Config$1.DEBUG) {
5613
+ console.warn('not able to capture performance data (' + type + ') - ' + ex);
5614
+ }
5615
+
5616
+ return [];
5617
+ }
5618
+ }
5619
+ /**
5620
+ * https://developer.mozilla.org/en-US/docs/Web/API/Performance/getEntriesByType
5621
+ *
5622
+ * The arrays in the prformance data are populated by getEntriesByType
5623
+ * They contain PerformanceEntry objects for the given performance type.
5624
+ * This means each object in the array shares a set of keys
5625
+ *
5626
+ * @param performanceEntries
5627
+ * @returns {(string[]|*)[]}
5628
+ */
5629
+
5630
+ function deduplicateKeys(performanceEntries) {
5631
+ if (performanceEntries.length === 0) {
5632
+ return [];
5633
+ }
5634
+
5635
+ var keys = Object.keys(performanceEntries[0]);
5636
+ return [keys, performanceEntries.map(function (obj) {
5637
+ return keys.map(function (key) {
5638
+ return obj[key];
5639
+ });
5640
+ })];
5641
+ }
5642
+ function pageLoadFrom(performanceData) {
5643
+ var keyIndex = performanceData.navigation && performanceData.navigation[0] && performanceData.navigation[0].indexOf('duration');
5644
+ return performanceData.navigation[1] && performanceData.navigation[1][0][keyIndex];
5645
+ }
5646
+ function getPerformanceData() {
5647
+ var performanceEntries = {
5648
+ navigation: getPerformanceEntriesByType('navigation'),
5649
+ paint: getPerformanceEntriesByType('paint'),
5650
+ resource: getPerformanceEntriesByType('resource')
5651
+ };
5652
+ var properties = {};
5653
+ var pageLoad = pageLoadFrom(performanceEntries);
5654
+
5655
+ if (pageLoad) {
5656
+ properties['$performance_page_loaded'] = pageLoad;
5657
+ }
5658
+
5659
+ properties['$performance_raw'] = JSON.stringify(performanceEntries);
5660
+ return properties;
5661
+ }
5662
+
5560
5663
  /*
5561
5664
  SIMPLE STYLE GUIDE:
5562
5665
 
@@ -5814,15 +5917,6 @@ PostHogLib.prototype._init = function (token, config, name) {
5814
5917
  }; // Private methods
5815
5918
 
5816
5919
 
5817
- function getPerformanceEntriesByType(type) {
5818
- // wide support but not available pre IE 10
5819
- try {
5820
- return JSON.parse(JSON.stringify(win.performance.getEntriesByType(type)));
5821
- } catch (_unused) {
5822
- return [];
5823
- }
5824
- }
5825
-
5826
5920
  PostHogLib.prototype._loaded = function () {
5827
5921
  // Pause `reloadFeatureFlags` calls in config.loaded callback.
5828
5922
  // These feature flags are loaded in the decide call made right afterwards
@@ -6236,16 +6330,7 @@ PostHogLib.prototype._calculate_event_properties = function (event_name, event_p
6236
6330
  properties = _.extend({}, _.info.properties(), this['persistence'].properties(), properties);
6237
6331
 
6238
6332
  if (event_name === '$pageview' && this.get_config('_capture_performance')) {
6239
- var performanceEntries = {
6240
- navigation: getPerformanceEntriesByType('navigation'),
6241
- paint: getPerformanceEntriesByType('paint'),
6242
- resource: getPerformanceEntriesByType('resource')
6243
- };
6244
- properties['$performance_raw'] = JSON.stringify(performanceEntries);
6245
-
6246
- if (performanceEntries.navigation.length > 0 && performanceEntries.navigation[0].duration >= 0) {
6247
- properties['$performance_pageLoaded'] = performanceEntries.navigation[0].duration;
6248
- }
6333
+ properties = _.extend(properties, getPerformanceData());
6249
6334
  }
6250
6335
 
6251
6336
  var property_blacklist = this.get_config('property_blacklist');
package/dist/module.js CHANGED
@@ -865,7 +865,7 @@ var LZString = {
865
865
  }
866
866
  };
867
867
 
868
- var version = "1.17.0";
868
+ var version = "1.17.4";
869
869
 
870
870
  var Config$1 = {
871
871
  DEBUG: false,
@@ -1173,15 +1173,22 @@ _.strip_empty_properties = function (p) {
1173
1173
  });
1174
1174
 
1175
1175
  return ret;
1176
- }; // Deep copies an object.
1177
- // It handles cycles by replacing all references to them with `undefined`
1178
- // Also supports customizing native values
1179
-
1176
+ };
1180
1177
 
1181
1178
  var COPY_IN_PROGRESS_ATTRIBUTE = typeof Symbol !== 'undefined' ? Symbol('__deepCircularCopyInProgress__') : '__deepCircularCopyInProgress__';
1179
+ /**
1180
+ * Deep copies an object.
1181
+ * It handles cycles by replacing all references to them with `undefined`
1182
+ * Also supports customizing native values
1183
+ *
1184
+ * @param value
1185
+ * @param customizer
1186
+ * @param [key] if provided this is the object key associated with the value to be copied. It allows the customizer function to have context when it runs
1187
+ * @returns {{}|undefined|*}
1188
+ */
1182
1189
 
1183
- function deepCircularCopy(value, customizer) {
1184
- if (value !== Object(value)) return customizer ? customizer(value) : value; // primitive value
1190
+ function deepCircularCopy(value, customizer, key) {
1191
+ if (value !== Object(value)) return customizer ? customizer(value, key) : value; // primitive value
1185
1192
 
1186
1193
  if (value[COPY_IN_PROGRESS_ATTRIBUTE]) return undefined;
1187
1194
  value[COPY_IN_PROGRESS_ATTRIBUTE] = true;
@@ -1198,7 +1205,7 @@ function deepCircularCopy(value, customizer) {
1198
1205
 
1199
1206
  _.each(value, function (val, key) {
1200
1207
  if (key !== COPY_IN_PROGRESS_ATTRIBUTE) {
1201
- result[key] = deepCircularCopy(val, customizer);
1208
+ result[key] = deepCircularCopy(val, customizer, key);
1202
1209
  }
1203
1210
  });
1204
1211
  }
@@ -1207,8 +1214,14 @@ function deepCircularCopy(value, customizer) {
1207
1214
  return result;
1208
1215
  }
1209
1216
 
1217
+ var LONG_STRINGS_ALLOW_LIST = ['$performance_raw'];
1218
+
1210
1219
  _.copyAndTruncateStrings = function (object, maxStringLength) {
1211
- return deepCircularCopy(object, function (value) {
1220
+ return deepCircularCopy(object, function (value, key) {
1221
+ if (key && LONG_STRINGS_ALLOW_LIST.indexOf(key) > -1) {
1222
+ return value;
1223
+ }
1224
+
1212
1225
  if (typeof value === 'string' && maxStringLength !== null) {
1213
1226
  value = value.slice(0, maxStringLength);
1214
1227
  }
@@ -3897,7 +3910,8 @@ var Decide = /*#__PURE__*/function () {
3897
3910
  var encoded_data = _.base64Encode(json_data);
3898
3911
 
3899
3912
  this.instance._send_request("".concat(this.instance.get_config('api_host'), "/decide/?v=2"), {
3900
- data: encoded_data
3913
+ data: encoded_data,
3914
+ verbose: true
3901
3915
  }, {
3902
3916
  method: 'POST'
3903
3917
  }, function (response) {
@@ -3909,6 +3923,11 @@ var Decide = /*#__PURE__*/function () {
3909
3923
  value: function parseDecideResponse(response) {
3910
3924
  var _this2 = this;
3911
3925
 
3926
+ if ((response === null || response === void 0 ? void 0 : response.status) === 0) {
3927
+ console.error('Failed to fetch feature flags from PostHog.');
3928
+ return;
3929
+ }
3930
+
3912
3931
  if (!(document && document.body)) {
3913
3932
  console.log('document not ready yet, trying again in 500 milliseconds...');
3914
3933
  setTimeout(function () {
@@ -3967,10 +3986,6 @@ var Toolbar = /*#__PURE__*/function () {
3967
3986
  this._loadEditor(_objectSpread2(_objectSpread2({}, editorParams), {}, {
3968
3987
  apiURL: this.instance.get_config('api_host')
3969
3988
  }));
3970
-
3971
- this.instance.set_config({
3972
- debug: true
3973
- });
3974
3989
  }
3975
3990
  }
3976
3991
  /**
@@ -5559,6 +5574,94 @@ var SessionIdManager = /*#__PURE__*/function () {
5559
5574
  return SessionIdManager;
5560
5575
  }();
5561
5576
 
5577
+ function isFloat(n) {
5578
+ return Number(n) === n && n % 1 !== 0;
5579
+ }
5580
+
5581
+ function optimisePerformanceData(performanceEntries) {
5582
+ performanceEntries.forEach(function (performanceEntry, index) {
5583
+ for (var performanceEntryItemKey in performanceEntry) {
5584
+ if (isFloat(performanceEntry[performanceEntryItemKey]) && performanceEntry[performanceEntryItemKey].toString().match(/^\d+\.\d{4,}$/)) {
5585
+ performanceEntries[index][performanceEntryItemKey] = Number(performanceEntry[performanceEntryItemKey].toFixed(3));
5586
+ }
5587
+
5588
+ if (['serverTiming', 'workerTiming'].includes(performanceEntryItemKey) && performanceEntry[performanceEntryItemKey].length === 0) {
5589
+ delete performanceEntries[index][performanceEntryItemKey];
5590
+ }
5591
+
5592
+ if (performanceEntryItemKey === 'entryType' && performanceEntry[performanceEntryItemKey] === 'resource') {
5593
+ delete performanceEntries[index][performanceEntryItemKey];
5594
+ }
5595
+
5596
+ if (performanceEntryItemKey === 'nextHopProtocol') {
5597
+ delete performanceEntries[index][performanceEntryItemKey];
5598
+ }
5599
+
5600
+ if (performanceEntry[performanceEntryItemKey] === 0) {
5601
+ delete performanceEntries[index][performanceEntryItemKey];
5602
+ }
5603
+ }
5604
+ });
5605
+ return deduplicateKeys(performanceEntries);
5606
+ }
5607
+ function getPerformanceEntriesByType(type) {
5608
+ // wide support but not available pre IE 10
5609
+ try {
5610
+ // stringifying and then parsing made data collection more reliable
5611
+ var entriesOfType = JSON.parse(JSON.stringify(win.performance.getEntriesByType(type)));
5612
+ return optimisePerformanceData(entriesOfType);
5613
+ } catch (ex) {
5614
+ if (Config$1.DEBUG) {
5615
+ console.warn('not able to capture performance data (' + type + ') - ' + ex);
5616
+ }
5617
+
5618
+ return [];
5619
+ }
5620
+ }
5621
+ /**
5622
+ * https://developer.mozilla.org/en-US/docs/Web/API/Performance/getEntriesByType
5623
+ *
5624
+ * The arrays in the prformance data are populated by getEntriesByType
5625
+ * They contain PerformanceEntry objects for the given performance type.
5626
+ * This means each object in the array shares a set of keys
5627
+ *
5628
+ * @param performanceEntries
5629
+ * @returns {(string[]|*)[]}
5630
+ */
5631
+
5632
+ function deduplicateKeys(performanceEntries) {
5633
+ if (performanceEntries.length === 0) {
5634
+ return [];
5635
+ }
5636
+
5637
+ var keys = Object.keys(performanceEntries[0]);
5638
+ return [keys, performanceEntries.map(function (obj) {
5639
+ return keys.map(function (key) {
5640
+ return obj[key];
5641
+ });
5642
+ })];
5643
+ }
5644
+ function pageLoadFrom(performanceData) {
5645
+ var keyIndex = performanceData.navigation && performanceData.navigation[0] && performanceData.navigation[0].indexOf('duration');
5646
+ return performanceData.navigation[1] && performanceData.navigation[1][0][keyIndex];
5647
+ }
5648
+ function getPerformanceData() {
5649
+ var performanceEntries = {
5650
+ navigation: getPerformanceEntriesByType('navigation'),
5651
+ paint: getPerformanceEntriesByType('paint'),
5652
+ resource: getPerformanceEntriesByType('resource')
5653
+ };
5654
+ var properties = {};
5655
+ var pageLoad = pageLoadFrom(performanceEntries);
5656
+
5657
+ if (pageLoad) {
5658
+ properties['$performance_page_loaded'] = pageLoad;
5659
+ }
5660
+
5661
+ properties['$performance_raw'] = JSON.stringify(performanceEntries);
5662
+ return properties;
5663
+ }
5664
+
5562
5665
  /*
5563
5666
  SIMPLE STYLE GUIDE:
5564
5667
 
@@ -5816,15 +5919,6 @@ PostHogLib.prototype._init = function (token, config, name) {
5816
5919
  }; // Private methods
5817
5920
 
5818
5921
 
5819
- function getPerformanceEntriesByType(type) {
5820
- // wide support but not available pre IE 10
5821
- try {
5822
- return JSON.parse(JSON.stringify(win.performance.getEntriesByType(type)));
5823
- } catch (_unused) {
5824
- return [];
5825
- }
5826
- }
5827
-
5828
5922
  PostHogLib.prototype._loaded = function () {
5829
5923
  // Pause `reloadFeatureFlags` calls in config.loaded callback.
5830
5924
  // These feature flags are loaded in the decide call made right afterwards
@@ -6238,16 +6332,7 @@ PostHogLib.prototype._calculate_event_properties = function (event_name, event_p
6238
6332
  properties = _.extend({}, _.info.properties(), this['persistence'].properties(), properties);
6239
6333
 
6240
6334
  if (event_name === '$pageview' && this.get_config('_capture_performance')) {
6241
- var performanceEntries = {
6242
- navigation: getPerformanceEntriesByType('navigation'),
6243
- paint: getPerformanceEntriesByType('paint'),
6244
- resource: getPerformanceEntriesByType('resource')
6245
- };
6246
- properties['$performance_raw'] = JSON.stringify(performanceEntries);
6247
-
6248
- if (performanceEntries.navigation.length > 0 && performanceEntries.navigation[0].duration >= 0) {
6249
- properties['$performance_pageLoaded'] = performanceEntries.navigation[0].duration;
6250
- }
6335
+ properties = _.extend(properties, getPerformanceData());
6251
6336
  }
6252
6337
 
6253
6338
  var property_blacklist = this.get_config('property_blacklist');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "posthog-js",
3
- "version": "1.17.0",
3
+ "version": "1.17.4",
4
4
  "description": "Posthog-js allows you to automatically capture usage and send events to PostHog.",
5
5
  "repository": "https://github.com/PostHog/posthog-js",
6
6
  "author": "hey@posthog.com",