posthog-js 1.372.4 → 1.372.5

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.
@@ -1,2 +1,2 @@
1
- !function(){"use strict";var r="undefined"!=typeof window?window:void 0,e="undefined"!=typeof globalThis?globalThis:r;"undefined"==typeof self&&(e.self=e),"undefined"==typeof File&&(e.File=function(){}),null!=e&&e.XMLHttpRequest&&new e.XMLHttpRequest;var n=null!=r?r:{};function t(r,e,n,t,i,a,o){try{var u=r[a](o),c=u.value}catch(r){return void n(r)}u.done?e(c):Promise.resolve(c).then(t,i)}function i(r){return function(){var e=this,n=arguments;return new Promise((function(i,a){var o=r.apply(e,n);function u(r){t(o,i,a,u,c,"next",r)}function c(r){t(o,i,a,u,c,"throw",r)}u(void 0)}))}}function a(){return a=Object.assign?Object.assign.bind():function(r){for(var e=1;arguments.length>e;e++){var n=arguments[e];for(var t in n)({}).hasOwnProperty.call(n,t)&&(r[t]=n[t])}return r},a.apply(null,arguments)}var o,u,c,s={}.toString,l=Array.isArray||function(r){return"[object Array]"===s.call(r)},v=r=>void 0===r,f=r=>"[object String]"==s.call(r);function d(r){return null===r||"object"!=typeof r}function h(r,e){return{}.toString.call(r)==="[object "+e+"]"}function p(r){return"undefined"!=typeof Event&&function(r,e){try{return r instanceof e}catch(r){return!1}}(r,Event)}function y(r){var e=globalThis._posthogChunkIds;if(e){var n=Object.keys(e);return c&&n.length===u?c:(u=n.length,c=n.reduce(((n,t)=>{o||(o={});var i=o[t];if(i)n[i[0]]=i[1];else for(var a=r(t),u=a.length-1;u>=0;u--){var c=a[u],s=null==c?void 0:c.filename,l=e[t];if(s&&l){n[s]=l,o[t]=[s,l];break}}return n}),{}))}}var w="?";function g(r,e,n,t,i){var a={platform:r,filename:e,function:"<anonymous>"===n?w:n,in_app:!0};return v(t)||(a.lineno=t),v(i)||(a.colno=i),a}var b=(r,e)=>{var n=-1!==r.indexOf("safari-extension"),t=-1!==r.indexOf("safari-web-extension");return n||t?[-1!==r.indexOf("@")?r.split("@")[0]:w,n?"safari-extension:"+e:"safari-web-extension:"+e]:[r,e]},m=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,E=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,j=/\((\S*)(?::(\d+))(?::(\d+))\)/,k=(r,e)=>{var n=m.exec(r);if(n){var[,t,i,a]=n;return g(e,t,w,+i,+a)}var o=E.exec(r);if(o){if(o[2]&&0===o[2].indexOf("eval")){var u=j.exec(o[2]);u&&(o[2]=u[1],o[3]=u[2],o[4]=u[3])}var[c,s]=b(o[1]||w,o[2]);return g(e,s,c,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},x=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,O=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,A=(r,e)=>{var n=x.exec(r);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){var t=O.exec(n[3]);t&&(n[1]=n[1]||"eval",n[3]=t[1],n[4]=t[2],n[5]="")}var i=n[3],a=n[1]||w;return[a,i]=b(a,i),g(e,i,a,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},S=/\(error: (.*)\)/;var M=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var R=["fatal","error","warning","log","info","debug"];function P(r,e){void 0===e&&(e=40);var n=Object.keys(r);if(n.sort(),!n.length)return"[object has no keys]";for(var t=n.length;t>0;t--){var i=n.slice(0,t).join(", ");if(e>=i.length)return t===n.length?i:i.length>e?i.slice(0,e)+"...":i}return""}var _=function(e,t){var{debugEnabled:i}=void 0===t?{}:t,a={C(t){if(r&&(n.POSTHOG_DEBUG||i)&&!v(r.console)&&r.console){for(var a=("__rrweb_original__"in r.console[t]?r.console[t].__rrweb_original__:r.console[t]),o=arguments.length,u=new Array(o>1?o-1:0),c=1;o>c;c++)u[c-1]=arguments[c];a(e,...u)}},info(){for(var r=arguments.length,e=new Array(r),n=0;r>n;n++)e[n]=arguments[n];a.C("log",...e)},warn(){for(var r=arguments.length,e=new Array(r),n=0;r>n;n++)e[n]=arguments[n];a.C("warn",...e)},error(){for(var r=arguments.length,e=new Array(r),n=0;r>n;n++)e[n]=arguments[n];a.C("error",...e)},critical(){for(var r=arguments.length,n=new Array(r),t=0;r>t;t++)n[t]=arguments[t];console.error(e,...n)},uninitializedWarning(r){a.error("You must initialize PostHog before calling "+r)},createLogger:(r,n)=>_(e+" "+r,n)};return a},C=_("[PostHog.js]").createLogger;C("[Error tracking]");var D=C("[ExceptionAutocapture]"),T=new class{constructor(r,e,n){void 0===n&&(n=[]),this.coercers=r,this.stackParser=e,this.modifiers=n}buildFromUnknown(r,e){void 0===e&&(e={});var n=e&&e.mechanism||{handled:!0,type:"generic"},t=this.buildCoercingContext(n,e,0).apply(r),i=this.buildParsingContext(e),a=this.parseStacktrace(t,i);return{$exception_list:this.convertToExceptionList(a,n),$exception_level:"error"}}modifyFrames(r){var e=this;return i((function*(){for(var n of r)n.stacktrace&&n.stacktrace.frames&&l(n.stacktrace.frames)&&(n.stacktrace.frames=yield e.applyModifiers(n.stacktrace.frames));return r}))()}coerceFallback(r){var e;return{type:"Error",value:"Unknown error",stack:null==(e=r.syntheticException)?void 0:e.stack,synthetic:!0}}parseStacktrace(r,e){var n,t;return null!=r.cause&&(n=this.parseStacktrace(r.cause,e)),""!=r.stack&&null!=r.stack&&(t=this.applyChunkIds(this.stackParser(r.stack,r.synthetic?e.skipFirstLines:0),e.chunkIdMap)),a({},r,{cause:n,stack:t})}applyChunkIds(r,e){return r.map((r=>(r.filename&&e&&(r.chunk_id=e[r.filename]),r)))}applyCoercers(r,e){for(var n of this.coercers)if(n.match(r))return n.coerce(r,e);return this.coerceFallback(e)}applyModifiers(r){var e=this;return i((function*(){var n=r;for(var t of e.modifiers)n=yield t(n);return n}))()}convertToExceptionList(r,e){var n,t,i,o={type:r.type,value:r.value,mechanism:{type:null!==(n=e.type)&&void 0!==n?n:"generic",handled:null===(t=e.handled)||void 0===t||t,synthetic:null!==(i=r.synthetic)&&void 0!==i&&i}};r.stack&&(o.stacktrace={type:"raw",frames:r.stack});var u=[o];return null!=r.cause&&u.push(...this.convertToExceptionList(r.cause,a({},e,{handled:!0}))),u}buildParsingContext(r){var e;return{chunkIdMap:y(this.stackParser),skipFirstLines:null!==(e=r.skipFirstLines)&&void 0!==e?e:1}}buildCoercingContext(r,e,n){void 0===n&&(n=0);var t=(n,t)=>{if(4>=t){var i=this.buildCoercingContext(r,e,t);return this.applyCoercers(n,i)}};return a({},e,{syntheticException:0==n?e.syntheticException:void 0,mechanism:r,apply:r=>t(r,n),next:r=>t(r,n+1)})}}([new class{match(r){return this.isDOMException(r)||this.isDOMError(r)}coerce(r,e){var n=f(r.stack);return{type:this.getType(r),value:this.getValue(r),stack:n?r.stack:void 0,cause:r.cause?e.next(r.cause):void 0,synthetic:!1}}getType(r){return this.isDOMError(r)?"DOMError":"DOMException"}getValue(r){var e=r.name||(this.isDOMError(r)?"DOMError":"DOMException");return r.message?e+": "+r.message:e}isDOMException(r){return h(r,"DOMException")}isDOMError(r){return h(r,"DOMError")}},new class{match(r){return h(r,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(r)}isCustomEventWrappingRejection(r){if(!p(r))return!1;try{var e=r.detail;return null!=e&&"object"==typeof e&&"reason"in e}catch(r){return!1}}coerce(r,e){var n,t=this.getUnhandledRejectionReason(r);return d(t)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(t),stack:null==(n=e.syntheticException)?void 0:n.stack,synthetic:!0}:e.apply(t)}getUnhandledRejectionReason(r){try{if("reason"in r)return r.reason;if("detail"in r&&null!=r.detail&&"object"==typeof r.detail&&"reason"in r.detail)return r.detail.reason}catch(r){}return r}},new class{constructor(){}match(r){return h(r,"ErrorEvent")&&null!=r.error}coerce(r,e){var n;return e.apply(r.error)||{type:"ErrorEvent",value:r.message,stack:null==(n=e.syntheticException)?void 0:n.stack,synthetic:!0}}},new class{match(r){return r instanceof Error}coerce(r,e){return{type:this.getType(r),value:this.getMessage(r,e),stack:this.getStack(r),cause:r.cause?e.next(r.cause):void 0,synthetic:!1}}getType(r){return r.name||r.constructor.name}getMessage(r,e){var n=r.message;return String(n.error&&"string"==typeof n.error.message?n.error.message:n)}getStack(r){return r.stacktrace||r.stack||void 0}},new class{match(r){return p(r)}coerce(r,e){var n,t=r.constructor.name;return{type:t,value:t+" captured as exception with keys: "+P(r),stack:null==(n=e.syntheticException)?void 0:n.stack,synthetic:!0}}},new class{match(r){return"object"==typeof r&&null!==r}coerce(r,e){var n,t=this.getErrorPropertyFromObject(r);return t?e.apply(t):{type:this.getType(r),value:this.getValue(r),stack:null==(n=e.syntheticException)?void 0:n.stack,level:this.isSeverityLevel(r.level)?r.level:"error",synthetic:!0}}getType(r){return p(r)?r.constructor.name:"Error"}getValue(r){if("name"in r&&"string"==typeof r.name){var e="'"+r.name+"' captured as exception";return"message"in r&&"string"==typeof r.message&&(e+=" with message: '"+r.message+"'"),e}if("message"in r&&"string"==typeof r.message)return r.message;var n=this.getObjectClassName(r);return(n&&"Object"!==n?"'"+n+"'":"Object")+" captured as exception with keys: "+P(r)}isSeverityLevel(r){return f(r)&&!(r=>f(r)&&0===r.trim().length)(r)&&R.indexOf(r)>=0}getErrorPropertyFromObject(r){for(var e in r)if({}.hasOwnProperty.call(r,e)){var n=r[e];if(n instanceof Error)return n}}getObjectClassName(r){try{var e=Object.getPrototypeOf(r);return e?e.constructor.name:void 0}catch(r){return}}},new class{match(r){return"string"==typeof r}coerce(r,e){var n,[t,i]=this.getInfos(r);return{type:null!=t?t:"Error",value:null!=i?i:r,stack:null==(n=e.syntheticException)?void 0:n.stack,synthetic:!0}}getInfos(r){var e="Error",n=r,t=r.match(M);return t&&(e=t[1],n=t[2]),[e,n]}},new class{match(r){return d(r)}coerce(r,e){var n;return{type:"Error",value:"Primitive value captured as exception: "+String(r),stack:null==(n=e.syntheticException)?void 0:n.stack,synthetic:!0}}}],function(r){for(var e=arguments.length,n=new Array(e>1?e-1:0),t=1;e>t;t++)n[t-1]=arguments[t];return function(e,t){void 0===t&&(t=0);for(var i=[],o=e.split("\n"),u=t;o.length>u;u++){var c=o[u];if(1024>=c.length){var s=S.test(c)?c.replace(S,"$1"):c;if(!s.match(/\S*Error: /)){for(var l of n){var v=l(s,r);if(v){i.push(v);break}}if(i.length>=50)break}}}return function(r){if(!r.length)return[];var e=Array.from(r);return e.reverse(),e.slice(0,50).map((r=>{return a({},r,{filename:r.filename||(n=e,n[n.length-1]||{}).filename,function:r.function||w});var n}))}(i)}}("web:javascript",k,A)),U={wrapOnError(e){var n=r;n||D.info("window not available, cannot wrap onerror");var t=n.onerror;return n.onerror=function(){for(var r,n=arguments.length,i=new Array(n),a=0;n>a;a++)i[a]=arguments[a];var o=T.buildFromUnknown(i[4]||i[0],{mechanism:{handled:!1}});return e(o),null!==(r=null==t?void 0:t(...i))&&void 0!==r&&r},n.onerror.__POSTHOG_INSTRUMENTED__=!0,()=>{var r;null==(r=n.onerror)||delete r.__POSTHOG_INSTRUMENTED__,n.onerror=t}},wrapUnhandledRejection(e){var n=r;n||D.info("window not available, cannot wrap onUnhandledRejection");var t=n.onunhandledrejection;return n.onunhandledrejection=function(r){var i,a=T.buildFromUnknown(r,{mechanism:{handled:!1}});return e(a),null!==(i=null==t?void 0:t.apply(n,[r]))&&void 0!==i&&i},n.onunhandledrejection.__POSTHOG_INSTRUMENTED__=!0,()=>{var r;null==(r=n.onunhandledrejection)||delete r.__POSTHOG_INSTRUMENTED__,n.onunhandledrejection=t}},wrapConsoleError(r){var e=console;e||D.info("console not available, cannot wrap console.error");var n=e.error;return e.error=function(){for(var e,t=arguments.length,i=new Array(t),a=0;t>a;a++)i[a]=arguments[a];e=1==i.length?i[0]:i.join(" ");var o=i.find((r=>r instanceof Error)),u=T.buildFromUnknown(o||e,{mechanism:{handled:!1},syntheticException:new Error("PostHog syntheticException"),skipFirstLines:2});return r(u),null==n?void 0:n(...i)},e.error.__POSTHOG_INSTRUMENTED__=!0,()=>{var r;null==(r=e.error)||delete r.__POSTHOG_INSTRUMENTED__,e.error=n}}};n.__PosthogExtensions__=n.__PosthogExtensions__||{},n.__PosthogExtensions__.errorWrappingFunctions=U,n.posthogErrorWrappingFunctions=U}();
1
+ !function(){"use strict";var r="undefined"!=typeof window?window:void 0,e="undefined"!=typeof globalThis?globalThis:r;"undefined"==typeof self&&(e.self=e),"undefined"==typeof File&&(e.File=function(){}),null!=e&&e.XMLHttpRequest&&new e.XMLHttpRequest;var n=null!=r?r:{};function t(r,e,n,t,i,a,o){try{var u=r[a](o),c=u.value}catch(r){return void n(r)}u.done?e(c):Promise.resolve(c).then(t,i)}function i(r){return function(){var e=this,n=arguments;return new Promise((function(i,a){var o=r.apply(e,n);function u(r){t(o,i,a,u,c,"next",r)}function c(r){t(o,i,a,u,c,"throw",r)}u(void 0)}))}}function a(){return a=Object.assign?Object.assign.bind():function(r){for(var e=1;arguments.length>e;e++){var n=arguments[e];for(var t in n)({}).hasOwnProperty.call(n,t)&&(r[t]=n[t])}return r},a.apply(null,arguments)}var o,u,c,s={}.toString,l=Array.isArray||function(r){return"[object Array]"===s.call(r)},v=r=>void 0===r,f=r=>"[object String]"==s.call(r);function d(r){return null===r||"object"!=typeof r}function h(r,e){return{}.toString.call(r)==="[object "+e+"]"}function p(r){return"undefined"!=typeof Event&&function(r,e){try{return r instanceof e}catch(r){return!1}}(r,Event)}function y(r){var e=globalThis._posthogChunkIds;if(e){var n=Object.keys(e);return c&&n.length===u?c:(u=n.length,c=n.reduce(((n,t)=>{o||(o={});var i=o[t];if(i)n[i[0]]=i[1];else for(var a=r(t),u=a.length-1;u>=0;u--){var c=a[u],s=null==c?void 0:c.filename,l=e[t];if(s&&l){n[s]=l,o[t]=[s,l];break}}return n}),{}))}}var w="?";function g(r,e,n,t,i){var a={platform:r,filename:e,function:"<anonymous>"===n?w:n,in_app:!0};return v(t)||(a.lineno=t),v(i)||(a.colno=i),a}var b=(r,e)=>{var n=-1!==r.indexOf("safari-extension"),t=-1!==r.indexOf("safari-web-extension");return n||t?[-1!==r.indexOf("@")?r.split("@")[0]:w,n?"safari-extension:"+e:"safari-web-extension:"+e]:[r,e]},m=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,E=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,j=/\((\S*)(?::(\d+))(?::(\d+))\)/,k=(r,e)=>{var n=m.exec(r);if(n){var[,t,i,a]=n;return g(e,t,w,+i,+a)}var o=E.exec(r);if(o){if(o[2]&&0===o[2].indexOf("eval")){var u=j.exec(o[2]);u&&(o[2]=u[1],o[3]=u[2],o[4]=u[3])}var[c,s]=b(o[1]||w,o[2]);return g(e,s,c,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},x=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,O=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,A=(r,e)=>{var n=x.exec(r);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){var t=O.exec(n[3]);t&&(n[1]=n[1]||"eval",n[3]=t[1],n[4]=t[2],n[5]="")}var i=n[3],a=n[1]||w;return[a,i]=b(a,i),g(e,i,a,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},S=/\(error: (.*)\)/;var M=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var R=["fatal","error","warning","log","info","debug"];function P(r,e){void 0===e&&(e=40);var n=Object.keys(r);if(n.sort(),!n.length)return"[object has no keys]";for(var t=n.length;t>0;t--){var i=n.slice(0,t).join(", ");if(e>=i.length)return t===n.length?i:i.length>e?i.slice(0,e)+"...":i}return""}var _=function(e,t){var{debugEnabled:i}=void 0===t?{}:t,a={C(t){if(r&&(n.POSTHOG_DEBUG||i)&&!v(r.console)&&r.console){for(var a=("__rrweb_original__"in r.console[t]?r.console[t].__rrweb_original__:r.console[t]),o=arguments.length,u=new Array(o>1?o-1:0),c=1;o>c;c++)u[c-1]=arguments[c];a(e,...u)}},info(){for(var r=arguments.length,e=new Array(r),n=0;r>n;n++)e[n]=arguments[n];a.C("log",...e)},warn(){for(var r=arguments.length,e=new Array(r),n=0;r>n;n++)e[n]=arguments[n];a.C("warn",...e)},error(){for(var r=arguments.length,e=new Array(r),n=0;r>n;n++)e[n]=arguments[n];a.C("error",...e)},critical(){for(var r=arguments.length,n=new Array(r),t=0;r>t;t++)n[t]=arguments[t];console.error(e,...n)},uninitializedWarning(r){a.error("You must initialize PostHog before calling "+r)},createLogger:(r,n)=>_(e+" "+r,n)};return a},C=_("[PostHog.js]").createLogger;C("[Error tracking]");var D=C("[ExceptionAutocapture]"),T=new class{constructor(r,e,n){void 0===n&&(n=[]),this.coercers=r,this.stackParser=e,this.modifiers=n}buildFromUnknown(r,e){void 0===e&&(e={});var n=e&&e.mechanism||{handled:!0,type:"generic"},t=this.buildCoercingContext(n,e,0).apply(r),i=this.buildParsingContext(e),a=this.parseStacktrace(t,i);return{$exception_list:this.convertToExceptionList(a,n),$exception_level:"error"}}modifyFrames(r){var e=this;return i((function*(){for(var n of r)n.stacktrace&&n.stacktrace.frames&&l(n.stacktrace.frames)&&(n.stacktrace.frames=yield e.applyModifiers(n.stacktrace.frames));return r}))()}coerceFallback(r){var e;return{type:"Error",value:"Unknown error",stack:null==(e=r.syntheticException)?void 0:e.stack,synthetic:!0}}parseStacktrace(r,e){var n,t;return null!=r.cause&&(n=this.parseStacktrace(r.cause,e)),""!=r.stack&&null!=r.stack&&(t=this.applyChunkIds(this.stackParser(r.stack,r.synthetic?e.skipFirstLines:0),e.chunkIdMap)),a({},r,{cause:n,stack:t})}applyChunkIds(r,e){return r.map((r=>(r.filename&&e&&(r.chunk_id=e[r.filename]),r)))}applyCoercers(r,e){for(var n of this.coercers)if(n.match(r))return n.coerce(r,e);return this.coerceFallback(e)}applyModifiers(r){var e=this;return i((function*(){var n=r;for(var t of e.modifiers)n=yield t(n);return n}))()}convertToExceptionList(r,e){var n,t,i,o={type:r.type,value:r.value,mechanism:{type:null!==(n=e.type)&&void 0!==n?n:"generic",handled:null===(t=e.handled)||void 0===t||t,synthetic:null!==(i=r.synthetic)&&void 0!==i&&i}};r.stack&&(o.stacktrace={type:"raw",frames:r.stack});var u=[o];return null!=r.cause&&u.push(...this.convertToExceptionList(r.cause,a({},e,{handled:!0}))),u}buildParsingContext(r){var e;return{chunkIdMap:y(this.stackParser),skipFirstLines:null!==(e=r.skipFirstLines)&&void 0!==e?e:1}}buildCoercingContext(r,e,n){void 0===n&&(n=0);var t=(n,t)=>{if(4>=t){var i=this.buildCoercingContext(r,e,t);return this.applyCoercers(n,i)}};return a({},e,{syntheticException:0==n?e.syntheticException:void 0,mechanism:r,apply:r=>t(r,n),next:r=>t(r,n+1)})}}([new class{match(r){return this.isDOMException(r)||this.isDOMError(r)}coerce(r,e){var n=f(r.stack);return{type:this.getType(r),value:this.getValue(r),stack:n?r.stack:void 0,cause:r.cause?e.next(r.cause):void 0,synthetic:!1}}getType(r){return this.isDOMError(r)?"DOMError":"DOMException"}getValue(r){var e=r.name||(this.isDOMError(r)?"DOMError":"DOMException");return r.message?e+": "+r.message:e}isDOMException(r){return h(r,"DOMException")}isDOMError(r){return h(r,"DOMError")}},new class{match(r){return h(r,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(r)}isCustomEventWrappingRejection(r){if(!p(r))return!1;try{var e=r.detail;return null!=e&&"object"==typeof e&&"reason"in e}catch(r){return!1}}coerce(r,e){var n,t=this.getUnhandledRejectionReason(r);return d(t)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(t),stack:null==(n=e.syntheticException)?void 0:n.stack,synthetic:!0}:e.apply(t)}getUnhandledRejectionReason(r){try{if("reason"in r)return r.reason;if("detail"in r&&null!=r.detail&&"object"==typeof r.detail&&"reason"in r.detail)return r.detail.reason}catch(r){}return r}},new class{constructor(){}match(r){return h(r,"ErrorEvent")&&null!=r.error}coerce(r,e){var n;return e.apply(r.error)||{type:"ErrorEvent",value:r.message,stack:null==(n=e.syntheticException)?void 0:n.stack,synthetic:!0}}},new class{match(r){return r instanceof Error}coerce(r,e){return{type:this.getType(r),value:this.getMessage(r,e),stack:this.getStack(r),cause:r.cause?e.next(r.cause):void 0,synthetic:!1}}getType(r){return r.name||r.constructor.name}getMessage(r,e){var n=r.message;return String(n.error&&"string"==typeof n.error.message?n.error.message:n)}getStack(r){return r.stacktrace||r.stack||void 0}},new class{match(r){return p(r)}coerce(r,e){var n,t=r.constructor.name;return{type:t,value:t+" captured as exception with keys: "+P(r),stack:null==(n=e.syntheticException)?void 0:n.stack,synthetic:!0}}},new class{match(r){return"object"==typeof r&&null!==r}coerce(r,e){var n,t=this.getErrorPropertyFromObject(r);return t?e.apply(t):{type:this.getType(r),value:this.getValue(r),stack:null==(n=e.syntheticException)?void 0:n.stack,level:this.isSeverityLevel(r.level)?r.level:"error",synthetic:!0}}getType(r){return p(r)?r.constructor.name:"Error"}getValue(r){if("name"in r&&"string"==typeof r.name){var e="'"+r.name+"' captured as exception";return"message"in r&&"string"==typeof r.message&&(e+=" with message: '"+r.message+"'"),e}if("message"in r&&"string"==typeof r.message)return r.message;var n=this.getObjectClassName(r);return(n&&"Object"!==n?"'"+n+"'":"Object")+" captured as exception with keys: "+P(r)}isSeverityLevel(r){return f(r)&&!(r=>f(r)&&0===r.trim().length)(r)&&R.indexOf(r)>=0}getErrorPropertyFromObject(r){for(var e in r)if({}.hasOwnProperty.call(r,e)){var n=r[e];if(n instanceof Error)return n}}getObjectClassName(r){try{var e=Object.getPrototypeOf(r);return e?e.constructor.name:void 0}catch(r){return}}},new class{match(r){return"string"==typeof r}coerce(r,e){var n,[t,i]=this.getInfos(r);return{type:null!=t?t:"Error",value:null!=i?i:r,stack:null==(n=e.syntheticException)?void 0:n.stack,synthetic:!0}}getInfos(r){var e="Error",n=r,t=r.match(M);return t&&(e=t[1],n=t[2]),[e,n]}},new class{match(r){return d(r)}coerce(r,e){var n;return{type:"Error",value:"Primitive value captured as exception: "+String(r),stack:null==(n=e.syntheticException)?void 0:n.stack,synthetic:!0}}}],function(r){for(var e=arguments.length,n=new Array(e>1?e-1:0),t=1;e>t;t++)n[t-1]=arguments[t];return function(e,t){void 0===t&&(t=0);for(var i=[],o=e.split("\n"),u=t;o.length>u;u++){var c=o[u];if(1024>=c.length){var s=S.test(c)?c.replace(S,"$1"):c;if(!s.match(/\S*Error: /)){for(var l of n){var v=l(s,r);if(v){i.push(v);break}}if(i.length>=50)break}}}return function(r){if(!r.length)return[];var e=Array.from(r);return e.reverse(),e.slice(0,50).map((r=>{return a({},r,{filename:r.filename||(n=e,n[n.length-1]||{}).filename,function:r.function||w});var n}))}(i)}}("web:javascript",k,A)),U={wrapOnError(e){var n=r;n||D.info("window not available, cannot wrap onerror");var t=n.onerror;return n.onerror=function(){for(var r,n=arguments.length,i=new Array(n),a=0;n>a;a++)i[a]=arguments[a];var o=T.buildFromUnknown(i[4]||i[0],{mechanism:{handled:!1}});return e(o),null!==(r=null==t?void 0:t(...i))&&void 0!==r&&r},n.onerror.__POSTHOG_INSTRUMENTED__=!0,()=>{var r;null==(r=n.onerror)||delete r.__POSTHOG_INSTRUMENTED__,n.onerror=t}},wrapUnhandledRejection(e){var n=r;n||D.info("window not available, cannot wrap onUnhandledRejection");var t=n.onunhandledrejection;return n.onunhandledrejection=function(r){var n,i=T.buildFromUnknown(r,{mechanism:{handled:!1}});return e(i),null!==(n=null==t?void 0:t(r))&&void 0!==n&&n},n.onunhandledrejection.__POSTHOG_INSTRUMENTED__=!0,()=>{var r;null==(r=n.onunhandledrejection)||delete r.__POSTHOG_INSTRUMENTED__,n.onunhandledrejection=t}},wrapConsoleError(r){var e=console;e||D.info("console not available, cannot wrap console.error");var n=e.error;return e.error=function(){for(var e,t=arguments.length,i=new Array(t),a=0;t>a;a++)i[a]=arguments[a];e=1==i.length?i[0]:i.join(" ");var o=i.find((r=>r instanceof Error)),u=T.buildFromUnknown(o||e,{mechanism:{handled:!1},syntheticException:new Error("PostHog syntheticException"),skipFirstLines:2});return r(u),null==n?void 0:n(...i)},e.error.__POSTHOG_INSTRUMENTED__=!0,()=>{var r;null==(r=e.error)||delete r.__POSTHOG_INSTRUMENTED__,e.error=n}}};n.__PosthogExtensions__=n.__PosthogExtensions__||{},n.__PosthogExtensions__.errorWrappingFunctions=U,n.posthogErrorWrappingFunctions=U}();
2
2
  //# sourceMappingURL=exception-autocapture.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"exception-autocapture.js","sources":["../src/utils/globals.ts","../../core/dist/utils/type-utils.mjs","../../core/dist/error-tracking/chunk-ids.mjs","../../core/dist/error-tracking/parsers/base.mjs","../../core/dist/error-tracking/parsers/safari.mjs","../../core/dist/error-tracking/parsers/chrome.mjs","../../core/dist/error-tracking/parsers/gecko.mjs","../../core/dist/error-tracking/parsers/index.mjs","../../core/dist/error-tracking/coercers/string-coercer.mjs","../../core/dist/error-tracking/types.mjs","../../core/dist/error-tracking/coercers/utils.mjs","../src/utils/logger.ts","../src/posthog-exceptions.ts","../src/entrypoints/exception-autocapture.ts","../../core/dist/error-tracking/error-properties-builder.mjs","../../core/dist/error-tracking/coercers/dom-exception-coercer.mjs","../../core/dist/error-tracking/coercers/promise-rejection-event.mjs","../../core/dist/error-tracking/coercers/error-event-coercer.mjs","../../core/dist/error-tracking/coercers/error-coercer.mjs","../../core/dist/error-tracking/coercers/event-coercer.mjs","../../core/dist/error-tracking/coercers/object-coercer.mjs","../../core/dist/utils/index.mjs","../../core/dist/error-tracking/coercers/primitive-coercer.mjs"],"sourcesContent":["import type { PostHog } from '../posthog-core'\nimport { SessionIdManager } from '../sessionid'\nimport {\n DeadClicksAutoCaptureConfig,\n ExternalIntegrationKind,\n Properties,\n RemoteConfig,\n SiteAppLoader,\n SessionStartReason,\n} from '../types'\nimport type {\n ConversationsRemoteConfig,\n GetMessagesResponse,\n GetTicketsOptions,\n GetTicketsResponse,\n MarkAsReadResponse,\n RestoreFromTokenResponse,\n RequestRestoreLinkResponse,\n SendMessageResponse,\n UserProvidedTraits,\n} from '../posthog-conversations-types'\n// only importing types here, so won't affect the bundle\n// eslint-disable-next-line posthog-js/no-external-replay-imports\nimport type { SessionRecordingStatus, TriggerType } from '../extensions/replay/external/triggerMatching'\nimport { eventWithTime } from '../extensions/replay/types/rrweb-types'\nimport { ErrorTracking } from '@posthog/core'\n\n/*\n * Global helpers to protect access to browser globals in a way that is safer for different targets\n * like DOM, SSR, Web workers etc.\n *\n * NOTE: Typically we want the \"window\" but globalThis works for both the typical browser context as\n * well as other contexts such as the web worker context. Window is still exported for any bits that explicitly require it.\n * If in doubt - export the global you need from this file and use that as an optional value. This way the code path is forced\n * to handle the case where the global is not available.\n */\n\n// eslint-disable-next-line no-restricted-globals\nconst win: (Window & typeof globalThis) | undefined = typeof window !== 'undefined' ? window : undefined\n\nexport type AssignableWindow = Window &\n typeof globalThis & {\n /*\n * Main PostHog instance\n */\n posthog: any\n\n /*\n * This is our contract between (potentially) lazily loaded extensions and the SDK\n */\n __PosthogExtensions__?: PostHogExtensions\n\n /**\n * When loading remote config, we assign it to this global configuration\n * for ease of sharing it with the rest of the SDK\n */\n _POSTHOG_REMOTE_CONFIG?: Record<\n string,\n {\n config: RemoteConfig\n siteApps: SiteAppLoader[]\n }\n >\n\n /**\n * If this is set on the window, our logger will log to the console\n * for ease of debugging. Used for testing purposes only.\n *\n * @see {Config.DEBUG} from config.ts\n */\n POSTHOG_DEBUG: any\n\n // Exposed by the browser\n doNotTrack: any\n\n // See entrypoints/customizations.full.ts\n posthogCustomizations: any\n\n /**\n * This is a legacy way to expose these functions, but we still need to support it for backwards compatibility\n * Can be removed once we drop support for 1.161.1\n *\n * See entrypoints/exception-autocapture.ts\n *\n * @deprecated use `__PosthogExtensions__.errorWrappingFunctions` instead\n */\n posthogErrorWrappingFunctions: any\n\n /**\n * This is a legacy way to expose these functions, but we still need to support it for backwards compatibility\n * Can be removed once we drop support for 1.161.1\n *\n * See entrypoints/posthog-recorder.ts\n *\n * @deprecated use `__PosthogExtensions__.rrweb` instead\n */\n rrweb: any\n\n /**\n * This is a legacy way to expose these functions, but we still need to support it for backwards compatibility\n * Can be removed once we drop support for 1.161.1\n *\n * See entrypoints/posthog-recorder.ts\n *\n * @deprecated use `__PosthogExtensions__.rrwebConsoleRecord` instead\n */\n rrwebConsoleRecord: any\n\n /**\n * This is a legacy way to expose these functions, but we still need to support it for backwards compatibility\n * Can be removed once we drop support for 1.161.1\n *\n * See entrypoints/posthog-recorder.ts\n *\n * @deprecated use `__PosthogExtensions__.getRecordNetworkPlugin` instead\n */\n getRecordNetworkPlugin: any\n\n /**\n * This is a legacy way to expose these functions, but we still need to support it for backwards compatibility\n * Can be removed once we drop support for 1.161.1\n *\n * See entrypoints/web-vitals.ts\n *\n * @deprecated use `__PosthogExtensions__.postHogWebVitalsCallbacks` instead\n */\n postHogWebVitalsCallbacks: any\n\n /**\n * This is a legacy way to expose these functions, but we still need to support it for backwards compatibility\n * Can be removed once we drop support for 1.161.1\n *\n * See entrypoints/tracing-headers.ts\n *\n * @deprecated use `__PosthogExtensions__.postHogTracingHeadersPatchFns` instead\n */\n postHogTracingHeadersPatchFns: any\n\n /**\n * This is a legacy way to expose these functions, but we still need to support it for backwards compatibility\n * Can be removed once we drop support for 1.161.1\n *\n * See entrypoints/surveys.ts\n *\n * @deprecated use `__PosthogExtensions__.generateSurveys` instead\n */\n extendPostHogWithSurveys: any\n\n /*\n * These are used to handle our toolbar state.\n * @see {Toolbar} from extensions/toolbar.ts\n */\n ph_load_toolbar: any\n ph_load_editor: any\n ph_toolbar_state: any\n } & Record<`__$$ph_site_app_${string}`, any>\n\n/**\n * This is our contract between (potentially) lazily loaded extensions and the SDK\n * changes to this interface can be breaking changes for users of the SDK\n */\n\nexport type ExternalExtensionKind = 'intercom-integration' | 'crisp-chat-integration'\n\nexport type PostHogExtensionKind =\n | 'toolbar'\n | 'exception-autocapture'\n | 'web-vitals'\n | 'web-vitals-with-attribution'\n | 'recorder'\n | 'lazy-recorder'\n | 'tracing-headers'\n | 'surveys'\n | 'logs'\n | 'conversations'\n | 'product-tours'\n | 'dead-clicks-autocapture'\n | 'remote-config'\n | ExternalExtensionKind\n\nexport interface LazyLoadedSessionRecordingInterface {\n start: (startReason?: SessionStartReason) => void\n stop: () => void\n discard: () => void\n sessionId: string\n status: SessionRecordingStatus\n onRRwebEmit: (rawEvent: eventWithTime) => void\n log: (message: string, level: 'log' | 'warn' | 'error') => void\n sdkDebugProperties: Properties\n overrideLinkedFlag: () => void\n overrideSampling: () => void\n overrideTrigger: (triggerType: TriggerType) => void\n isStarted: boolean\n tryAddCustomEvent(tag: string, payload: any): boolean\n}\n\nexport interface LazyLoadedDeadClicksAutocaptureInterface {\n start: (observerTarget: Node) => void\n stop: () => void\n}\n\nexport interface LazyLoadedConversationsInterface {\n // Widget control\n show: () => void\n hide: () => void\n isVisible: () => boolean\n\n // Lifecycle\n reset: () => void\n\n // Identity verification\n setIdentity: () => void\n clearIdentity: () => void\n\n // API methods\n sendMessage: (message: string, userTraits?: UserProvidedTraits, newTicket?: boolean) => Promise<SendMessageResponse>\n getMessages: (ticketId?: string, after?: string) => Promise<GetMessagesResponse>\n markAsRead: (ticketId?: string) => Promise<MarkAsReadResponse>\n getTickets: (options?: GetTicketsOptions) => Promise<GetTicketsResponse>\n requestRestoreLink: (email: string) => Promise<RequestRestoreLinkResponse>\n restoreFromToken: (restoreToken: string) => Promise<RestoreFromTokenResponse>\n restoreFromUrlToken: () => Promise<RestoreFromTokenResponse | null>\n getCurrentTicketId: () => string | null\n getWidgetSessionId: () => string\n}\n\ninterface PostHogExtensions {\n loadExternalDependency?: (\n posthog: PostHog,\n kind: PostHogExtensionKind,\n callback: (error?: string | Event, event?: Event) => void\n ) => void\n\n loadSiteApp?: (posthog: PostHog, appUrl: string, callback: (error?: string | Event, event?: Event) => void) => void\n\n errorWrappingFunctions?: {\n wrapOnError: (captureFn: (props: ErrorTracking.ErrorProperties) => void) => () => void\n wrapUnhandledRejection: (captureFn: (props: ErrorTracking.ErrorProperties) => void) => () => void\n wrapConsoleError: (captureFn: (props: ErrorTracking.ErrorProperties) => void) => () => void\n }\n rrweb?: { record: any; version: string; wasMaxDepthReached?: () => boolean; resetMaxDepthState?: () => void }\n rrwebPlugins?: { getRecordConsolePlugin: any; getRecordNetworkPlugin?: any }\n generateSurveys?: (posthog: PostHog, isSurveysEnabled: boolean) => any | undefined\n generateProductTours?: (posthog: PostHog, isEnabled: boolean) => any | undefined\n logs?: {\n initializeLogs?: (posthog: PostHog) => any | undefined\n }\n postHogWebVitalsCallbacks?: {\n onLCP: (metric: any) => void\n onCLS: (metric: any) => void\n onFCP: (metric: any) => void\n onINP: (metric: any) => void\n }\n /**\n * @deprecated\n *\n * this was introduced briefly, it is now always a no-op and only kept for backwards compatibility\n */\n loadWebVitalsCallbacks?: (useAttribution?: boolean) => PostHogExtensions['postHogWebVitalsCallbacks']\n tracingHeadersPatchFns?: {\n _patchFetch: (hostnames: string[], distinctId: string, sessionManager?: SessionIdManager) => () => void\n _patchXHR: (hostnames: string[], distinctId: string, sessionManager?: SessionIdManager) => () => void\n }\n initDeadClicksAutocapture?: (\n ph: PostHog,\n config: DeadClicksAutoCaptureConfig\n ) => LazyLoadedDeadClicksAutocaptureInterface\n integrations?: {\n [K in ExternalIntegrationKind]?: { start: (posthog: PostHog) => void; stop: () => void }\n }\n initSessionRecording?: (ph: PostHog) => LazyLoadedSessionRecordingInterface\n initConversations?: (config: ConversationsRemoteConfig, posthog: PostHog) => LazyLoadedConversationsInterface\n}\n\nconst global: typeof globalThis | undefined = typeof globalThis !== 'undefined' ? globalThis : win\n\n// React Native polyfills for posthog-js compatibility\nif (typeof self === 'undefined') {\n ;(global as any).self = global\n}\nif (typeof File === 'undefined') {\n ;(global as any).File = function () {}\n}\n\nexport const navigator = global?.navigator\nexport const document = global?.document\nexport const location = global?.location\nexport const fetch = global?.fetch\nexport const XMLHttpRequest =\n global?.XMLHttpRequest && 'withCredentials' in new global.XMLHttpRequest() ? global.XMLHttpRequest : undefined\nexport const AbortController = global?.AbortController\nexport const CompressionStream = global?.CompressionStream\nexport const userAgent = navigator?.userAgent\nexport const assignableWindow: AssignableWindow = win ?? ({} as any)\n\nexport { win as window }\n","import { knownUnsafeEditableEvent } from \"../types.mjs\";\nimport { includes } from \"./string-utils.mjs\";\nconst nativeIsArray = Array.isArray;\nconst ObjProto = Object.prototype;\nconst type_utils_hasOwnProperty = ObjProto.hasOwnProperty;\nconst type_utils_toString = ObjProto.toString;\nconst isArray = nativeIsArray || function(obj) {\n return '[object Array]' === type_utils_toString.call(obj);\n};\nconst isFunction = (x)=>'function' == typeof x;\nconst isNativeFunction = (x)=>isFunction(x) && -1 !== x.toString().indexOf('[native code]');\nconst isObject = (x)=>x === Object(x) && !isArray(x);\nconst isEmptyObject = (x)=>{\n if (isObject(x)) {\n for(const key in x)if (type_utils_hasOwnProperty.call(x, key)) return false;\n return true;\n }\n return false;\n};\nconst isUndefined = (x)=>void 0 === x;\nconst isString = (x)=>'[object String]' == type_utils_toString.call(x);\nconst isEmptyString = (x)=>isString(x) && 0 === x.trim().length;\nconst isNull = (x)=>null === x;\nconst isNullish = (x)=>isUndefined(x) || isNull(x);\nconst isNumber = (x)=>'[object Number]' == type_utils_toString.call(x) && x === x;\nconst isPositiveNumber = (value)=>isNumber(value) && value > 0;\nconst isBoolean = (x)=>'[object Boolean]' === type_utils_toString.call(x);\nconst isFormData = (x)=>x instanceof FormData;\nconst isFile = (x)=>x instanceof File;\nconst isPlainError = (x)=>x instanceof Error;\nconst isKnownUnsafeEditableEvent = (x)=>includes(knownUnsafeEditableEvent, x);\nfunction isPrimitive(value) {\n return null === value || 'object' != typeof value;\n}\nfunction isBuiltin(candidate, className) {\n return Object.prototype.toString.call(candidate) === `[object ${className}]`;\n}\nfunction isError(candidate) {\n switch(Object.prototype.toString.call(candidate)){\n case '[object Error]':\n case '[object Exception]':\n case '[object DOMException]':\n case '[object DOMError]':\n case '[object WebAssembly.Exception]':\n return true;\n default:\n return isInstanceOf(candidate, Error);\n }\n}\nfunction isErrorEvent(event) {\n return isBuiltin(event, 'ErrorEvent');\n}\nfunction isEvent(candidate) {\n return 'undefined' != typeof Event && isInstanceOf(candidate, Event);\n}\nfunction isPlainObject(candidate) {\n return isBuiltin(candidate, 'Object');\n}\nfunction isInstanceOf(candidate, base) {\n try {\n return candidate instanceof base;\n } catch {\n return false;\n }\n}\nconst yesLikeValues = [\n true,\n 'true',\n 1,\n '1',\n 'yes'\n];\nconst isYesLike = (val)=>includes(yesLikeValues, val);\nconst noLikeValues = [\n false,\n 'false',\n 0,\n '0',\n 'no'\n];\nconst isNoLike = (val)=>includes(noLikeValues, val);\nexport { type_utils_hasOwnProperty as hasOwnProperty, isArray, isBoolean, isBuiltin, isEmptyObject, isEmptyString, isError, isErrorEvent, isEvent, isFile, isFormData, isFunction, isKnownUnsafeEditableEvent, isNativeFunction, isNoLike, isNull, isNullish, isNumber, isObject, isPlainError, isPlainObject, isPositiveNumber, isPrimitive, isString, isUndefined, isYesLike, noLikeValues, yesLikeValues };\n","let parsedStackResults;\nlet lastKeysCount;\nlet cachedFilenameChunkIds;\nfunction getFilenameToChunkIdMap(stackParser) {\n const chunkIdMap = globalThis._posthogChunkIds;\n if (!chunkIdMap) return;\n const chunkIdKeys = Object.keys(chunkIdMap);\n if (cachedFilenameChunkIds && chunkIdKeys.length === lastKeysCount) return cachedFilenameChunkIds;\n lastKeysCount = chunkIdKeys.length;\n cachedFilenameChunkIds = chunkIdKeys.reduce((acc, stackKey)=>{\n if (!parsedStackResults) parsedStackResults = {};\n const result = parsedStackResults[stackKey];\n if (result) acc[result[0]] = result[1];\n else {\n const parsedStack = stackParser(stackKey);\n for(let i = parsedStack.length - 1; i >= 0; i--){\n const stackFrame = parsedStack[i];\n const filename = stackFrame?.filename;\n const chunkId = chunkIdMap[stackKey];\n if (filename && chunkId) {\n acc[filename] = chunkId;\n parsedStackResults[stackKey] = [\n filename,\n chunkId\n ];\n break;\n }\n }\n }\n return acc;\n }, {});\n return cachedFilenameChunkIds;\n}\nexport { getFilenameToChunkIdMap };\n","import { isUndefined } from \"../../utils/index.mjs\";\nconst UNKNOWN_FUNCTION = '?';\nfunction createFrame(platform, filename, func, lineno, colno) {\n const frame = {\n platform,\n filename,\n function: '<anonymous>' === func ? UNKNOWN_FUNCTION : func,\n in_app: true\n };\n if (!isUndefined(lineno)) frame.lineno = lineno;\n if (!isUndefined(colno)) frame.colno = colno;\n return frame;\n}\nexport { UNKNOWN_FUNCTION, createFrame };\n","import { UNKNOWN_FUNCTION } from \"./base.mjs\";\nconst extractSafariExtensionDetails = (func, filename)=>{\n const isSafariExtension = -1 !== func.indexOf('safari-extension');\n const isSafariWebExtension = -1 !== func.indexOf('safari-web-extension');\n return isSafariExtension || isSafariWebExtension ? [\n -1 !== func.indexOf('@') ? func.split('@')[0] : UNKNOWN_FUNCTION,\n isSafariExtension ? `safari-extension:${filename}` : `safari-web-extension:${filename}`\n ] : [\n func,\n filename\n ];\n};\nexport { extractSafariExtensionDetails };\n","import { UNKNOWN_FUNCTION, createFrame } from \"./base.mjs\";\nimport { extractSafariExtensionDetails } from \"./safari.mjs\";\nconst chromeRegexNoFnName = /^\\s*at (\\S+?)(?::(\\d+))(?::(\\d+))\\s*$/i;\nconst chromeRegex = /^\\s*at (?:(.+?\\)(?: \\[.+\\])?|.*?) ?\\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\\/)?.*?)(?::(\\d+))?(?::(\\d+))?\\)?\\s*$/i;\nconst chromeEvalRegex = /\\((\\S*)(?::(\\d+))(?::(\\d+))\\)/;\nconst chromeStackLineParser = (line, platform)=>{\n const noFnParts = chromeRegexNoFnName.exec(line);\n if (noFnParts) {\n const [, filename, line, col] = noFnParts;\n return createFrame(platform, filename, UNKNOWN_FUNCTION, +line, +col);\n }\n const parts = chromeRegex.exec(line);\n if (parts) {\n const isEval = parts[2] && 0 === parts[2].indexOf('eval');\n if (isEval) {\n const subMatch = chromeEvalRegex.exec(parts[2]);\n if (subMatch) {\n parts[2] = subMatch[1];\n parts[3] = subMatch[2];\n parts[4] = subMatch[3];\n }\n }\n const [func, filename] = extractSafariExtensionDetails(parts[1] || UNKNOWN_FUNCTION, parts[2]);\n return createFrame(platform, filename, func, parts[3] ? +parts[3] : void 0, parts[4] ? +parts[4] : void 0);\n }\n};\nexport { chromeStackLineParser };\n","import { UNKNOWN_FUNCTION, createFrame } from \"./base.mjs\";\nimport { extractSafariExtensionDetails } from \"./safari.mjs\";\nconst geckoREgex = /^\\s*(.*?)(?:\\((.*?)\\))?(?:^|@)?((?:[-a-z]+)?:\\/.*?|\\[native code\\]|[^@]*(?:bundle|\\d+\\.js)|\\/[\\w\\-. /=]+)(?::(\\d+))?(?::(\\d+))?\\s*$/i;\nconst geckoEvalRegex = /(\\S+) line (\\d+)(?: > eval line \\d+)* > eval/i;\nconst geckoStackLineParser = (line, platform)=>{\n const parts = geckoREgex.exec(line);\n if (parts) {\n const isEval = parts[3] && parts[3].indexOf(' > eval') > -1;\n if (isEval) {\n const subMatch = geckoEvalRegex.exec(parts[3]);\n if (subMatch) {\n parts[1] = parts[1] || 'eval';\n parts[3] = subMatch[1];\n parts[4] = subMatch[2];\n parts[5] = '';\n }\n }\n let filename = parts[3];\n let func = parts[1] || UNKNOWN_FUNCTION;\n [func, filename] = extractSafariExtensionDetails(func, filename);\n return createFrame(platform, filename, func, parts[4] ? +parts[4] : void 0, parts[5] ? +parts[5] : void 0);\n }\n};\nexport { geckoStackLineParser };\n","import { UNKNOWN_FUNCTION } from \"./base.mjs\";\nimport { chromeStackLineParser } from \"./chrome.mjs\";\nimport { geckoStackLineParser } from \"./gecko.mjs\";\nimport { winjsStackLineParser } from \"./winjs.mjs\";\nimport { opera10StackLineParser, opera11StackLineParser } from \"./opera.mjs\";\nimport { nodeStackLineParser } from \"./node.mjs\";\nconst WEBPACK_ERROR_REGEXP = /\\(error: (.*)\\)/;\nconst STACKTRACE_FRAME_LIMIT = 50;\nfunction reverseAndStripFrames(stack) {\n if (!stack.length) return [];\n const localStack = Array.from(stack);\n localStack.reverse();\n return localStack.slice(0, STACKTRACE_FRAME_LIMIT).map((frame)=>({\n ...frame,\n filename: frame.filename || getLastStackFrame(localStack).filename,\n function: frame.function || UNKNOWN_FUNCTION\n }));\n}\nfunction getLastStackFrame(arr) {\n return arr[arr.length - 1] || {};\n}\nfunction createDefaultStackParser() {\n return createStackParser(\"web:javascript\", chromeStackLineParser, geckoStackLineParser);\n}\nfunction createStackParser(platform, ...parsers) {\n return (stack, skipFirstLines = 0)=>{\n const frames = [];\n const lines = stack.split('\\n');\n for(let i = skipFirstLines; i < lines.length; i++){\n const line = lines[i];\n if (line.length > 1024) continue;\n const cleanedLine = WEBPACK_ERROR_REGEXP.test(line) ? line.replace(WEBPACK_ERROR_REGEXP, '$1') : line;\n if (!cleanedLine.match(/\\S*Error: /)) {\n for (const parser of parsers){\n const frame = parser(cleanedLine, platform);\n if (frame) {\n frames.push(frame);\n break;\n }\n }\n if (frames.length >= STACKTRACE_FRAME_LIMIT) break;\n }\n }\n return reverseAndStripFrames(frames);\n };\n}\nexport { chromeStackLineParser, createDefaultStackParser, createStackParser, geckoStackLineParser, nodeStackLineParser, opera10StackLineParser, opera11StackLineParser, reverseAndStripFrames, winjsStackLineParser };\n","const ERROR_TYPES_PATTERN = /^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;\nclass StringCoercer {\n match(input) {\n return 'string' == typeof input;\n }\n coerce(input, ctx) {\n const [type, value] = this.getInfos(input);\n return {\n type: type ?? 'Error',\n value: value ?? input,\n stack: ctx.syntheticException?.stack,\n synthetic: true\n };\n }\n getInfos(candidate) {\n let type = 'Error';\n let value = candidate;\n const groups = candidate.match(ERROR_TYPES_PATTERN);\n if (groups) {\n type = groups[1];\n value = groups[2];\n }\n return [\n type,\n value\n ];\n }\n}\nexport { StringCoercer };\n","const severityLevels = [\n 'fatal',\n 'error',\n 'warning',\n 'log',\n 'info',\n 'debug'\n];\nexport { severityLevels };\n","function truncate(str, max = 0) {\n if ('string' != typeof str || 0 === max) return str;\n return str.length <= max ? str : `${str.slice(0, max)}...`;\n}\nfunction extractExceptionKeysForMessage(err, maxLength = 40) {\n const keys = Object.keys(err);\n keys.sort();\n if (!keys.length) return '[object has no keys]';\n for(let i = keys.length; i > 0; i--){\n const serialized = keys.slice(0, i).join(', ');\n if (!(serialized.length > maxLength)) {\n if (i === keys.length) return serialized;\n return serialized.length <= maxLength ? serialized : `${serialized.slice(0, maxLength)}...`;\n }\n }\n return '';\n}\nexport { extractExceptionKeysForMessage, truncate };\n","import Config from '../config'\nimport { isUndefined } from '@posthog/core'\nimport { assignableWindow, window } from './globals'\nimport type { Logger } from '@posthog/core'\n\ntype CreateLoggerOptions = {\n debugEnabled?: boolean\n}\n\ntype PosthogJsLogger = Omit<Logger, 'createLogger'> & {\n _log: (level: 'log' | 'warn' | 'error', ...args: any[]) => void\n uninitializedWarning: (methodName: string) => void\n createLogger: (prefix: string, options?: CreateLoggerOptions) => PosthogJsLogger\n}\n\nconst _createLogger = (prefix: string, { debugEnabled }: CreateLoggerOptions = {}): PosthogJsLogger => {\n const logger: PosthogJsLogger = {\n _log: (level: 'log' | 'warn' | 'error', ...args: any[]) => {\n if (\n window &&\n (Config.DEBUG || assignableWindow.POSTHOG_DEBUG || debugEnabled) &&\n !isUndefined(window.console) &&\n window.console\n ) {\n const consoleLog =\n '__rrweb_original__' in window.console[level]\n ? (window.console[level] as any)['__rrweb_original__']\n : window.console[level]\n\n // eslint-disable-next-line no-console\n consoleLog(prefix, ...args)\n }\n },\n\n info: (...args: any[]) => {\n logger._log('log', ...args)\n },\n\n warn: (...args: any[]) => {\n logger._log('warn', ...args)\n },\n\n error: (...args: any[]) => {\n logger._log('error', ...args)\n },\n\n critical: (...args: any[]) => {\n // Critical errors are always logged to the console\n // eslint-disable-next-line no-console\n console.error(prefix, ...args)\n },\n\n uninitializedWarning: (methodName: string) => {\n logger.error(`You must initialize PostHog before calling ${methodName}`)\n },\n\n createLogger: (additionalPrefix: string, options?: CreateLoggerOptions) =>\n _createLogger(`${prefix} ${additionalPrefix}`, options),\n }\n return logger\n}\n\nexport const logger = _createLogger('[PostHog.js]')\n\nexport const createLogger = logger.createLogger\n","import { ERROR_TRACKING_CAPTURE_EXTENSION_EXCEPTIONS, ERROR_TRACKING_SUPPRESSION_RULES } from './constants'\nimport { Extension } from './extensions/types'\nimport { PostHog } from './posthog-core'\nimport { CaptureResult, ErrorTrackingSuppressionRule, Properties, RemoteConfig } from './types'\nimport { createLogger } from './utils/logger'\nimport { propertyComparisons } from './utils/property-utils'\nimport { isString, isArray, isObject, ErrorTracking, isNullish } from '@posthog/core'\n\nconst logger = createLogger('[Error tracking]')\n\nexport function buildErrorPropertiesBuilder() {\n return new ErrorTracking.ErrorPropertiesBuilder(\n [\n new ErrorTracking.DOMExceptionCoercer(),\n new ErrorTracking.PromiseRejectionEventCoercer(),\n new ErrorTracking.ErrorEventCoercer(),\n new ErrorTracking.ErrorCoercer(),\n new ErrorTracking.EventCoercer(),\n new ErrorTracking.ObjectCoercer(),\n new ErrorTracking.StringCoercer(),\n new ErrorTracking.PrimitiveCoercer(),\n ],\n ErrorTracking.createDefaultStackParser()\n )\n}\nexport class PostHogExceptions implements Extension {\n private readonly _instance: PostHog\n private _suppressionRules: ErrorTrackingSuppressionRule[] = []\n private _errorPropertiesBuilder: ErrorTracking.ErrorPropertiesBuilder = buildErrorPropertiesBuilder()\n private _exceptionStepsBuffer: ErrorTracking.ExceptionStepsBuffer\n private _exceptionStepsConfig: ErrorTracking.ResolvedExceptionStepsConfig\n\n constructor(instance: PostHog) {\n this._instance = instance\n this._suppressionRules = this._instance.persistence?.get_property(ERROR_TRACKING_SUPPRESSION_RULES) ?? []\n this._exceptionStepsConfig = ErrorTracking.resolveExceptionStepsConfig(this._getExceptionStepsConfig())\n this._exceptionStepsBuffer = new ErrorTracking.ExceptionStepsBuffer(this._exceptionStepsConfig)\n }\n\n onConfigChange() {\n this._exceptionStepsConfig = ErrorTracking.resolveExceptionStepsConfig(this._getExceptionStepsConfig())\n this._exceptionStepsBuffer.setConfig(this._exceptionStepsConfig)\n }\n\n onRemoteConfig(response: RemoteConfig) {\n if (!('errorTracking' in response)) {\n return\n }\n\n const suppressionRules = response.errorTracking?.suppressionRules ?? []\n const captureExtensionExceptions = response.errorTracking?.captureExtensionExceptions\n\n // store this in-memory in case persistence is disabled\n this._suppressionRules = suppressionRules\n\n if (this._instance.persistence) {\n this._instance.persistence.register({\n [ERROR_TRACKING_SUPPRESSION_RULES]: this._suppressionRules,\n [ERROR_TRACKING_CAPTURE_EXTENSION_EXCEPTIONS]: captureExtensionExceptions,\n })\n }\n }\n\n private get _captureExtensionExceptions() {\n const enabled_server_side = !!this._instance.get_property(ERROR_TRACKING_CAPTURE_EXTENSION_EXCEPTIONS)\n const enabled_client_side = this._instance.config.error_tracking.captureExtensionExceptions\n return enabled_client_side ?? enabled_server_side ?? false\n }\n\n buildProperties(\n input: unknown,\n metadata?: { handled?: boolean; syntheticException?: Error }\n ): ErrorTracking.ErrorProperties {\n return this._errorPropertiesBuilder.buildFromUnknown(input, {\n syntheticException: metadata?.syntheticException,\n mechanism: {\n handled: metadata?.handled,\n },\n })\n }\n\n addExceptionStep(message: string, properties?: Properties): void {\n if (!this._exceptionStepsConfig.enabled) {\n return\n }\n\n try {\n if (!isString(message) || message.trim().length === 0) {\n logger.warn('Ignoring exception step because message must be a non-empty string')\n return\n }\n\n const userProperties = this._coerceExceptionStepProperties(properties)\n\n const { sanitizedProperties, droppedKeys } = ErrorTracking.stripReservedExceptionStepFields(userProperties)\n\n if (droppedKeys.length > 0) {\n logger.warn('Ignoring reserved exception step fields', { droppedKeys })\n }\n\n this._exceptionStepsBuffer.add({\n [ErrorTracking.EXCEPTION_STEP_INTERNAL_FIELDS.MESSAGE]: message,\n [ErrorTracking.EXCEPTION_STEP_INTERNAL_FIELDS.TIMESTAMP]: new Date().toISOString(),\n ...sanitizedProperties,\n })\n } catch (error) {\n logger.error('Failed to add exception step. Ignoring breadcrumb.', error)\n }\n }\n\n sendExceptionEvent(properties: Properties): CaptureResult | undefined {\n try {\n const exceptionList = properties.$exception_list\n\n if (this._isExceptionList(exceptionList)) {\n if (this._matchesSuppressionRule(exceptionList)) {\n this._addDroppedExceptionStep('Exception dropped: matched a suppression rule')\n logger.info('Skipping exception capture because a suppression rule matched')\n return\n }\n\n if (!this._captureExtensionExceptions && this._isExtensionException(exceptionList)) {\n this._addDroppedExceptionStep('Exception dropped: thrown by a browser extension')\n logger.info('Skipping exception capture because it was thrown by an extension')\n return\n }\n\n if (\n !this._instance.config.error_tracking.__capturePostHogExceptions &&\n this._isPostHogException(exceptionList)\n ) {\n this._addDroppedExceptionStep('Exception dropped: thrown by the PostHog SDK')\n logger.info('Skipping exception capture because it was thrown by the PostHog SDK')\n return\n }\n }\n\n const propertiesForExceptionCapture =\n this._exceptionStepsConfig.enabled && isNullish(properties.$exception_steps)\n ? this._addBufferedExceptionSteps(properties)\n : properties\n\n try {\n const result = this._instance.capture('$exception', propertiesForExceptionCapture, {\n _noTruncate: true,\n _batchKey: 'exceptionEvent',\n _originatedFromCaptureException: true,\n })\n\n if (result) {\n this._exceptionStepsBuffer.clear()\n }\n\n return result\n } catch (error) {\n logger.error('Failed to capture exception event. Dropping this exception.', error)\n this._exceptionStepsBuffer.clear()\n return\n }\n } catch (error) {\n logger.error('Failed to process exception event. Ignoring this exception.', error)\n return\n }\n }\n\n private _addBufferedExceptionSteps(properties: Properties): Properties {\n try {\n const exceptionSteps = this._exceptionStepsBuffer.getAttachable()\n\n if (exceptionSteps.length === 0) {\n return properties\n }\n\n return {\n ...properties,\n $exception_steps: exceptionSteps,\n }\n } catch (error) {\n logger.error('Failed to read buffered exception steps. Capturing exception without steps.', error)\n return properties\n }\n }\n\n private _addDroppedExceptionStep(message: string): void {\n if (this._exceptionStepsConfig.enabled) {\n this._exceptionStepsBuffer.add({\n [ErrorTracking.EXCEPTION_STEP_INTERNAL_FIELDS.MESSAGE]: message,\n [ErrorTracking.EXCEPTION_STEP_INTERNAL_FIELDS.TIMESTAMP]: new Date().toISOString(),\n })\n }\n }\n\n private _coerceExceptionStepProperties(properties?: Properties): Record<string, unknown> {\n if (!isObject(properties)) {\n return {}\n }\n\n return { ...(properties as Record<string, unknown>) }\n }\n\n private _getExceptionStepsConfig(): ErrorTracking.ExceptionStepsConfig {\n return this._instance.config.error_tracking?.exception_steps ?? {}\n }\n\n private _matchesSuppressionRule(exceptionList: ErrorTracking.ExceptionList): boolean {\n if (exceptionList.length === 0) {\n return false\n }\n\n const exceptionValues = exceptionList.reduce(\n (acc, { type, value }) => {\n if (isString(type) && type.length > 0) {\n acc['$exception_types'].push(type)\n }\n if (isString(value) && value.length > 0) {\n acc['$exception_values'].push(value)\n }\n return acc\n },\n {\n $exception_types: [] as string[],\n $exception_values: [] as string[],\n }\n )\n\n return this._suppressionRules.some((rule) => {\n const results = rule.values.map((v) => {\n const compare = propertyComparisons[v.operator]\n const targets = isArray(v.value) ? v.value : [v.value]\n const values = exceptionValues[v.key] ?? []\n return targets.length > 0 ? compare(targets, values) : false\n })\n return rule.type === 'OR' ? results.some(Boolean) : results.every(Boolean)\n })\n }\n\n private _isExtensionException(exceptionList: ErrorTracking.ExceptionList): boolean {\n const frames = exceptionList.flatMap((e) => e.stacktrace?.frames ?? [])\n return frames.some((f) => f.filename && f.filename.startsWith('chrome-extension://'))\n }\n\n private _isPostHogException(exceptionList: ErrorTracking.ExceptionList): boolean {\n if (exceptionList.length > 0) {\n const exception = exceptionList[0]\n const frames = exception.stacktrace?.frames ?? []\n const lastFrame = frames[frames.length - 1]\n return lastFrame?.filename?.includes('posthog.com/static') ?? false\n }\n\n return false\n }\n\n private _isExceptionList(candidate: unknown): candidate is ErrorTracking.ExceptionList {\n return !isNullish(candidate) && isArray(candidate)\n }\n}\n","import { assignableWindow, window } from '../utils/globals'\nimport { ErrorEventArgs } from '../types'\nimport { createLogger } from '../utils/logger'\nimport type { ErrorTracking } from '@posthog/core'\nimport { buildErrorPropertiesBuilder } from '../posthog-exceptions'\n\nconst logger = createLogger('[ExceptionAutocapture]')\nconst errorPropertiesBuilder = buildErrorPropertiesBuilder()\n\nconst wrapOnError = (captureFn: (props: ErrorTracking.ErrorProperties) => void) => {\n const win = window as any\n if (!win) {\n logger.info('window not available, cannot wrap onerror')\n }\n const originalOnError = win.onerror\n\n win.onerror = function (...args: ErrorEventArgs): boolean {\n const error = args[4]\n const event = args[0]\n const errorProperties = errorPropertiesBuilder.buildFromUnknown(error || event, {\n mechanism: { handled: false },\n })\n captureFn(errorProperties)\n return originalOnError?.(...args) ?? false\n }\n win.onerror.__POSTHOG_INSTRUMENTED__ = true\n\n return () => {\n delete win.onerror?.__POSTHOG_INSTRUMENTED__\n win.onerror = originalOnError\n }\n}\n\nconst wrapUnhandledRejection = (captureFn: (props: ErrorTracking.ErrorProperties) => void) => {\n const win = window as any\n if (!win) {\n logger.info('window not available, cannot wrap onUnhandledRejection')\n }\n\n const originalOnUnhandledRejection = win.onunhandledrejection\n\n win.onunhandledrejection = function (ev: PromiseRejectionEvent): boolean {\n const errorProperties = errorPropertiesBuilder.buildFromUnknown(ev, {\n mechanism: { handled: false },\n })\n captureFn(errorProperties)\n return originalOnUnhandledRejection?.apply(win, [ev]) ?? false\n }\n win.onunhandledrejection.__POSTHOG_INSTRUMENTED__ = true\n\n return () => {\n delete win.onunhandledrejection?.__POSTHOG_INSTRUMENTED__\n win.onunhandledrejection = originalOnUnhandledRejection\n }\n}\n\nconst wrapConsoleError = (captureFn: (props: ErrorTracking.ErrorProperties) => void) => {\n const con = console as any\n if (!con) {\n logger.info('console not available, cannot wrap console.error')\n }\n\n const originalConsoleError = con.error\n\n con.error = function (...args: any[]): void {\n let event\n if (args.length == 1) {\n event = args[0]\n } else {\n event = args.join(' ')\n }\n const error = args.find((arg) => arg instanceof Error)\n const errorProperties = errorPropertiesBuilder.buildFromUnknown(error || event, {\n mechanism: { handled: false },\n syntheticException: new Error('PostHog syntheticException'),\n skipFirstLines: 2,\n })\n captureFn(errorProperties)\n return originalConsoleError?.(...args)\n }\n con.error.__POSTHOG_INSTRUMENTED__ = true\n\n return () => {\n delete con.error?.__POSTHOG_INSTRUMENTED__\n con.error = originalConsoleError\n }\n}\n\nconst posthogErrorWrappingFunctions = {\n wrapOnError,\n wrapUnhandledRejection,\n wrapConsoleError,\n}\n\nassignableWindow.__PosthogExtensions__ = assignableWindow.__PosthogExtensions__ || {}\nassignableWindow.__PosthogExtensions__.errorWrappingFunctions = posthogErrorWrappingFunctions\n\n// we used to put these on window, and now we put them on __PosthogExtensions__\n// but that means that old clients which lazily load this extension are looking in the wrong place\n// yuck,\n// so we also put them directly on the window\n// when 1.161.1 is the oldest version seen in production we can remove this\nassignableWindow.posthogErrorWrappingFunctions = posthogErrorWrappingFunctions\n\nexport default posthogErrorWrappingFunctions\n","import { isArray } from \"../utils/index.mjs\";\nimport { getFilenameToChunkIdMap } from \"./chunk-ids.mjs\";\nconst MAX_CAUSE_RECURSION = 4;\nclass ErrorPropertiesBuilder {\n constructor(coercers, stackParser, modifiers = []){\n this.coercers = coercers;\n this.stackParser = stackParser;\n this.modifiers = modifiers;\n }\n buildFromUnknown(input, hint = {}) {\n const providedMechanism = hint && hint.mechanism;\n const mechanism = providedMechanism || {\n handled: true,\n type: 'generic'\n };\n const coercingContext = this.buildCoercingContext(mechanism, hint, 0);\n const exceptionWithCause = coercingContext.apply(input);\n const parsingContext = this.buildParsingContext(hint);\n const exceptionWithStack = this.parseStacktrace(exceptionWithCause, parsingContext);\n const exceptionList = this.convertToExceptionList(exceptionWithStack, mechanism);\n return {\n $exception_list: exceptionList,\n $exception_level: 'error'\n };\n }\n async modifyFrames(exceptionList) {\n for (const exc of exceptionList)if (exc.stacktrace && exc.stacktrace.frames && isArray(exc.stacktrace.frames)) exc.stacktrace.frames = await this.applyModifiers(exc.stacktrace.frames);\n return exceptionList;\n }\n coerceFallback(ctx) {\n return {\n type: 'Error',\n value: 'Unknown error',\n stack: ctx.syntheticException?.stack,\n synthetic: true\n };\n }\n parseStacktrace(err, ctx) {\n let cause;\n if (null != err.cause) cause = this.parseStacktrace(err.cause, ctx);\n let stack;\n if ('' != err.stack && null != err.stack) stack = this.applyChunkIds(this.stackParser(err.stack, err.synthetic ? ctx.skipFirstLines : 0), ctx.chunkIdMap);\n return {\n ...err,\n cause,\n stack\n };\n }\n applyChunkIds(frames, chunkIdMap) {\n return frames.map((frame)=>{\n if (frame.filename && chunkIdMap) frame.chunk_id = chunkIdMap[frame.filename];\n return frame;\n });\n }\n applyCoercers(input, ctx) {\n for (const adapter of this.coercers)if (adapter.match(input)) return adapter.coerce(input, ctx);\n return this.coerceFallback(ctx);\n }\n async applyModifiers(frames) {\n let newFrames = frames;\n for (const modifier of this.modifiers)newFrames = await modifier(newFrames);\n return newFrames;\n }\n convertToExceptionList(exceptionWithStack, mechanism) {\n const currentException = {\n type: exceptionWithStack.type,\n value: exceptionWithStack.value,\n mechanism: {\n type: mechanism.type ?? 'generic',\n handled: mechanism.handled ?? true,\n synthetic: exceptionWithStack.synthetic ?? false\n }\n };\n if (exceptionWithStack.stack) currentException.stacktrace = {\n type: 'raw',\n frames: exceptionWithStack.stack\n };\n const exceptionList = [\n currentException\n ];\n if (null != exceptionWithStack.cause) exceptionList.push(...this.convertToExceptionList(exceptionWithStack.cause, {\n ...mechanism,\n handled: true\n }));\n return exceptionList;\n }\n buildParsingContext(hint) {\n const context = {\n chunkIdMap: getFilenameToChunkIdMap(this.stackParser),\n skipFirstLines: hint.skipFirstLines ?? 1\n };\n return context;\n }\n buildCoercingContext(mechanism, hint, depth = 0) {\n const coerce = (input, depth)=>{\n if (!(depth <= MAX_CAUSE_RECURSION)) return;\n {\n const ctx = this.buildCoercingContext(mechanism, hint, depth);\n return this.applyCoercers(input, ctx);\n }\n };\n const context = {\n ...hint,\n syntheticException: 0 == depth ? hint.syntheticException : void 0,\n mechanism,\n apply: (input)=>coerce(input, depth),\n next: (input)=>coerce(input, depth + 1)\n };\n return context;\n }\n}\nexport { ErrorPropertiesBuilder };\n","import { isBuiltin, isString } from \"../../utils/index.mjs\";\nclass DOMExceptionCoercer {\n match(err) {\n return this.isDOMException(err) || this.isDOMError(err);\n }\n coerce(err, ctx) {\n const hasStack = isString(err.stack);\n return {\n type: this.getType(err),\n value: this.getValue(err),\n stack: hasStack ? err.stack : void 0,\n cause: err.cause ? ctx.next(err.cause) : void 0,\n synthetic: false\n };\n }\n getType(candidate) {\n return this.isDOMError(candidate) ? 'DOMError' : 'DOMException';\n }\n getValue(err) {\n const name = err.name || (this.isDOMError(err) ? 'DOMError' : 'DOMException');\n const message = err.message ? `${name}: ${err.message}` : name;\n return message;\n }\n isDOMException(err) {\n return isBuiltin(err, 'DOMException');\n }\n isDOMError(err) {\n return isBuiltin(err, 'DOMError');\n }\n}\nexport { DOMExceptionCoercer };\n","import { isBuiltin, isEvent, isPrimitive } from \"../../utils/index.mjs\";\nclass PromiseRejectionEventCoercer {\n match(err) {\n return isBuiltin(err, 'PromiseRejectionEvent') || this.isCustomEventWrappingRejection(err);\n }\n isCustomEventWrappingRejection(err) {\n if (!isEvent(err)) return false;\n try {\n const detail = err.detail;\n return null != detail && 'object' == typeof detail && 'reason' in detail;\n } catch {\n return false;\n }\n }\n coerce(err, ctx) {\n const reason = this.getUnhandledRejectionReason(err);\n if (isPrimitive(reason)) return {\n type: 'UnhandledRejection',\n value: `Non-Error promise rejection captured with value: ${String(reason)}`,\n stack: ctx.syntheticException?.stack,\n synthetic: true\n };\n return ctx.apply(reason);\n }\n getUnhandledRejectionReason(error) {\n try {\n if ('reason' in error) return error.reason;\n if ('detail' in error && null != error.detail && 'object' == typeof error.detail && 'reason' in error.detail) return error.detail.reason;\n } catch {}\n return error;\n }\n}\nexport { PromiseRejectionEventCoercer };\n","import { isErrorEvent } from \"../../utils/index.mjs\";\nclass ErrorEventCoercer {\n constructor(){}\n match(err) {\n return isErrorEvent(err) && void 0 != err.error;\n }\n coerce(err, ctx) {\n const exceptionLike = ctx.apply(err.error);\n if (!exceptionLike) return {\n type: 'ErrorEvent',\n value: err.message,\n stack: ctx.syntheticException?.stack,\n synthetic: true\n };\n return exceptionLike;\n }\n}\nexport { ErrorEventCoercer };\n","import { isPlainError } from \"../../utils/index.mjs\";\nclass ErrorCoercer {\n match(err) {\n return isPlainError(err);\n }\n coerce(err, ctx) {\n return {\n type: this.getType(err),\n value: this.getMessage(err, ctx),\n stack: this.getStack(err),\n cause: err.cause ? ctx.next(err.cause) : void 0,\n synthetic: false\n };\n }\n getType(err) {\n return err.name || err.constructor.name;\n }\n getMessage(err, _ctx) {\n const message = err.message;\n if (message.error && 'string' == typeof message.error.message) return String(message.error.message);\n return String(message);\n }\n getStack(err) {\n return err.stacktrace || err.stack || void 0;\n }\n}\nexport { ErrorCoercer };\n","import { isEvent } from \"../../utils/index.mjs\";\nimport { extractExceptionKeysForMessage } from \"./utils.mjs\";\nclass EventCoercer {\n match(err) {\n return isEvent(err);\n }\n coerce(evt, ctx) {\n const constructorName = evt.constructor.name;\n return {\n type: constructorName,\n value: `${constructorName} captured as exception with keys: ${extractExceptionKeysForMessage(evt)}`,\n stack: ctx.syntheticException?.stack,\n synthetic: true\n };\n }\n}\nexport { EventCoercer };\n","import { isEmptyString, isError, isEvent, isString } from \"../../utils/index.mjs\";\nimport { severityLevels } from \"../types.mjs\";\nimport { extractExceptionKeysForMessage } from \"./utils.mjs\";\nclass ObjectCoercer {\n match(candidate) {\n return 'object' == typeof candidate && null !== candidate;\n }\n coerce(candidate, ctx) {\n const errorProperty = this.getErrorPropertyFromObject(candidate);\n if (errorProperty) return ctx.apply(errorProperty);\n return {\n type: this.getType(candidate),\n value: this.getValue(candidate),\n stack: ctx.syntheticException?.stack,\n level: this.isSeverityLevel(candidate.level) ? candidate.level : 'error',\n synthetic: true\n };\n }\n getType(err) {\n return isEvent(err) ? err.constructor.name : 'Error';\n }\n getValue(err) {\n if ('name' in err && 'string' == typeof err.name) {\n let message = `'${err.name}' captured as exception`;\n if ('message' in err && 'string' == typeof err.message) message += ` with message: '${err.message}'`;\n return message;\n }\n if ('message' in err && 'string' == typeof err.message) return err.message;\n const className = this.getObjectClassName(err);\n const keys = extractExceptionKeysForMessage(err);\n return `${className && 'Object' !== className ? `'${className}'` : 'Object'} captured as exception with keys: ${keys}`;\n }\n isSeverityLevel(x) {\n return isString(x) && !isEmptyString(x) && severityLevels.indexOf(x) >= 0;\n }\n getErrorPropertyFromObject(obj) {\n for(const prop in obj)if (Object.prototype.hasOwnProperty.call(obj, prop)) {\n const value = obj[prop];\n if (isError(value)) return value;\n }\n }\n getObjectClassName(obj) {\n try {\n const prototype = Object.getPrototypeOf(obj);\n return prototype ? prototype.constructor.name : void 0;\n } catch (e) {\n return;\n }\n }\n}\nexport { ObjectCoercer };\n","export * from \"./bot-detection.mjs\";\nexport * from \"./bucketed-rate-limiter.mjs\";\nexport * from \"./number-utils.mjs\";\nexport * from \"./string-utils.mjs\";\nexport * from \"./type-utils.mjs\";\nexport * from \"./promise-queue.mjs\";\nexport * from \"./logger.mjs\";\nexport * from \"./user-agent-utils.mjs\";\nconst STRING_FORMAT = 'utf8';\nfunction assert(truthyValue, message) {\n if (!truthyValue || 'string' != typeof truthyValue || isEmpty(truthyValue)) throw new Error(message);\n}\nfunction isEmpty(truthyValue) {\n if (0 === truthyValue.trim().length) return true;\n return false;\n}\nfunction removeTrailingSlash(url) {\n return url?.replace(/\\/+$/, '');\n}\nasync function retriable(fn, props) {\n let lastError = null;\n for(let i = 0; i < props.retryCount + 1; i++){\n if (i > 0) await new Promise((r)=>setTimeout(r, props.retryDelay));\n try {\n const res = await fn();\n return res;\n } catch (e) {\n lastError = e;\n if (!props.retryCheck(e)) throw e;\n }\n }\n throw lastError;\n}\nfunction currentTimestamp() {\n return new Date().getTime();\n}\nfunction currentISOTime() {\n return new Date().toISOString();\n}\nfunction safeSetTimeout(fn, timeout) {\n const t = setTimeout(fn, timeout);\n t?.unref && t?.unref();\n return t;\n}\nconst isPromise = (obj)=>obj && 'function' == typeof obj.then;\nconst isError = (x)=>x instanceof Error;\nfunction getFetch() {\n return 'undefined' != typeof fetch ? fetch : void 0 !== globalThis.fetch ? globalThis.fetch : void 0;\n}\nfunction allSettled(promises) {\n return Promise.all(promises.map((p)=>(p ?? Promise.resolve()).then((value)=>({\n status: 'fulfilled',\n value\n }), (reason)=>({\n status: 'rejected',\n reason\n }))));\n}\nexport { STRING_FORMAT, allSettled, assert, currentISOTime, currentTimestamp, getFetch, isError, isPromise, removeTrailingSlash, retriable, safeSetTimeout };\n","import { isPrimitive } from \"../../utils/index.mjs\";\nclass PrimitiveCoercer {\n match(candidate) {\n return isPrimitive(candidate);\n }\n coerce(value, ctx) {\n return {\n type: 'Error',\n value: `Primitive value captured as exception: ${String(value)}`,\n stack: ctx.syntheticException?.stack,\n synthetic: true\n };\n }\n}\nexport { PrimitiveCoercer };\n"],"names":["win","window","undefined","global","globalThis","self","File","XMLHttpRequest","assignableWindow","parsedStackResults","lastKeysCount","cachedFilenameChunkIds","type_utils_toString","Object","prototype","toString","isArray","Array","obj","call","isUndefined","x","isString","isPrimitive","value","isBuiltin","candidate","className","isEvent","Event","base","_unused","isInstanceOf","getFilenameToChunkIdMap","stackParser","chunkIdMap","_posthogChunkIds","chunkIdKeys","keys","length","reduce","acc","stackKey","result","parsedStack","i","stackFrame","filename","chunkId","UNKNOWN_FUNCTION","createFrame","platform","func","lineno","colno","frame","function","in_app","extractSafariExtensionDetails","isSafariExtension","indexOf","isSafariWebExtension","split","chromeRegexNoFnName","chromeRegex","chromeEvalRegex","chromeStackLineParser","line","noFnParts","exec","col","parts","subMatch","geckoREgex","geckoEvalRegex","geckoStackLineParser","WEBPACK_ERROR_REGEXP","ERROR_TYPES_PATTERN","severityLevels","extractExceptionKeysForMessage","err","maxLength","sort","serialized","slice","join","_createLogger","prefix","_temp","debugEnabled","logger","_log","level","POSTHOG_DEBUG","console","consoleLog","_len","arguments","args","_key","info","_len2","_key2","warn","_len3","_key3","error","_len4","_key4","critical","_len5","_key5","uninitializedWarning","methodName","createLogger","additionalPrefix","options","errorPropertiesBuilder","constructor","coercers","modifiers","this","buildFromUnknown","input","hint","mechanism","handled","type","exceptionWithCause","buildCoercingContext","apply","parsingContext","buildParsingContext","exceptionWithStack","parseStacktrace","$exception_list","convertToExceptionList","$exception_level","modifyFrames","exceptionList","_this","_asyncToGenerator","exc","stacktrace","frames","applyModifiers","coerceFallback","ctx","_ctx$syntheticExcepti","stack","syntheticException","synthetic","cause","applyChunkIds","skipFirstLines","_extends","map","chunk_id","applyCoercers","adapter","match","coerce","_this2","newFrames","modifier","_mechanism$type","_mechanism$handled","_exceptionWithStack$s","currentException","push","_hint$skipFirstLines","depth","next","isDOMException","isDOMError","hasStack","getType","getValue","name","message","isCustomEventWrappingRejection","detail","reason","getUnhandledRejectionReason","String","_unused2","Error","getMessage","getStack","_ctx","evt","constructorName","errorProperty","getErrorPropertyFromObject","isSeverityLevel","getObjectClassName","trim","isEmptyString","prop","hasOwnProperty","getPrototypeOf","e","getInfos","groups","parsers","lines","cleanedLine","test","replace","parser","localStack","from","reverse","arr","reverseAndStripFrames","createStackParser","posthogErrorWrappingFunctions","wrapOnError","captureFn","originalOnError","onerror","_originalOnError","errorProperties","__POSTHOG_INSTRUMENTED__","_win$onerror","wrapUnhandledRejection","originalOnUnhandledRejection","onunhandledrejection","ev","_originalOnUnhandledR","_win$onunhandledrejec","wrapConsoleError","con","originalConsoleError","event","find","arg","_con$error","__PosthogExtensions__","errorWrappingFunctions"],"mappings":"yBAsCA,IAAMA,EAAkE,oBAAXC,OAAyBA,YAASC,EA4OzFC,EAA8D,oBAAfC,WAA6BA,WAAaJ,EAG3E,oBAATK,OACLF,EAAeE,KAAOF,GAER,oBAATG,OACLH,EAAeG,KAAO,WAAa,SAQrCH,GAAAA,EAAQI,gBAAuC,IAAIJ,EAAOI,eAIvD,IAAMC,EAAqCR,QAAAA,EAAQ,CAAA,shBCnS1D,ICFIS,EACAC,EACAC,EDGEC,EAFWC,CAAOC,EAEaC,SAC/BC,EAJgBC,MAAMD,SAIK,SAASE,GACtC,MAAO,mBAAqBN,EAAoBO,KAAKD,EACzD,EAWME,EAAeC,QAAI,IAAWA,EAC9BC,EAAYD,GAAI,mBAAqBT,EAAoBO,KAAKE,GAWpE,SAASE,EAAYC,GACjB,OAAO,OAASA,GAAS,iBAAmBA,CAChD,CACA,SAASC,EAAUC,EAAWC,GAC1B,MAAOd,CAAOC,EAAUC,SAASI,KAAKO,KAAU,WAAgBC,EAAS,GAC7E,CAgBA,SAASC,EAAQF,GACb,MAAO,oBAAsBG,OAKjC,SAAsBH,EAAWI,GAC7B,IACI,OAAOJ,aAAqBI,CAChC,CAAE,MAAAC,GACE,OAAO,CACX,CACJ,CAX0CC,CAAaN,EAAWG,MAClE,CCnDA,SAASI,EAAwBC,GAC7B,IAAMC,EAAa/B,WAAWgC,iBAC9B,GAAKD,EAAL,CACA,IAAME,EAAcxB,OAAOyB,KAAKH,GAChC,OAAIxB,GAA0B0B,EAAYE,SAAW7B,EAAsBC,GAC3ED,EAAgB2B,EAAYE,OAC5B5B,EAAyB0B,EAAYG,QAAO,CAACC,EAAKC,KACzCjC,IAAoBA,EAAqB,CAAA,GAC9C,IAAMkC,EAASlC,EAAm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,GASLjO,EAAiBsO,sBAAwBtO,EAAiBsO,uBAAyB,CAAA,EACnFtO,EAAiBsO,sBAAsBC,uBAAyBvB,EAOhEhN,EAAiBgN,8BAAgCA"}
1
+ {"version":3,"file":"exception-autocapture.js","sources":["../src/utils/globals.ts","../../core/dist/utils/type-utils.mjs","../../core/dist/error-tracking/chunk-ids.mjs","../../core/dist/error-tracking/parsers/base.mjs","../../core/dist/error-tracking/parsers/safari.mjs","../../core/dist/error-tracking/parsers/chrome.mjs","../../core/dist/error-tracking/parsers/gecko.mjs","../../core/dist/error-tracking/parsers/index.mjs","../../core/dist/error-tracking/coercers/string-coercer.mjs","../../core/dist/error-tracking/types.mjs","../../core/dist/error-tracking/coercers/utils.mjs","../src/utils/logger.ts","../src/posthog-exceptions.ts","../src/entrypoints/exception-autocapture.ts","../../core/dist/error-tracking/error-properties-builder.mjs","../../core/dist/error-tracking/coercers/dom-exception-coercer.mjs","../../core/dist/error-tracking/coercers/promise-rejection-event.mjs","../../core/dist/error-tracking/coercers/error-event-coercer.mjs","../../core/dist/error-tracking/coercers/error-coercer.mjs","../../core/dist/error-tracking/coercers/event-coercer.mjs","../../core/dist/error-tracking/coercers/object-coercer.mjs","../../core/dist/utils/index.mjs","../../core/dist/error-tracking/coercers/primitive-coercer.mjs"],"sourcesContent":["import type { PostHog } from '../posthog-core'\nimport { SessionIdManager } from '../sessionid'\nimport {\n DeadClicksAutoCaptureConfig,\n ExternalIntegrationKind,\n Properties,\n RemoteConfig,\n SiteAppLoader,\n SessionStartReason,\n} from '../types'\nimport type {\n ConversationsRemoteConfig,\n GetMessagesResponse,\n GetTicketsOptions,\n GetTicketsResponse,\n MarkAsReadResponse,\n RestoreFromTokenResponse,\n RequestRestoreLinkResponse,\n SendMessageResponse,\n UserProvidedTraits,\n} from '../posthog-conversations-types'\n// only importing types here, so won't affect the bundle\n// eslint-disable-next-line posthog-js/no-external-replay-imports\nimport type { SessionRecordingStatus, TriggerType } from '../extensions/replay/external/triggerMatching'\nimport { eventWithTime } from '../extensions/replay/types/rrweb-types'\nimport { ErrorTracking } from '@posthog/core'\n\n/*\n * Global helpers to protect access to browser globals in a way that is safer for different targets\n * like DOM, SSR, Web workers etc.\n *\n * NOTE: Typically we want the \"window\" but globalThis works for both the typical browser context as\n * well as other contexts such as the web worker context. Window is still exported for any bits that explicitly require it.\n * If in doubt - export the global you need from this file and use that as an optional value. This way the code path is forced\n * to handle the case where the global is not available.\n */\n\n// eslint-disable-next-line no-restricted-globals\nconst win: (Window & typeof globalThis) | undefined = typeof window !== 'undefined' ? window : undefined\n\nexport type AssignableWindow = Window &\n typeof globalThis & {\n /*\n * Main PostHog instance\n */\n posthog: any\n\n /*\n * This is our contract between (potentially) lazily loaded extensions and the SDK\n */\n __PosthogExtensions__?: PostHogExtensions\n\n /**\n * When loading remote config, we assign it to this global configuration\n * for ease of sharing it with the rest of the SDK\n */\n _POSTHOG_REMOTE_CONFIG?: Record<\n string,\n {\n config: RemoteConfig\n siteApps: SiteAppLoader[]\n }\n >\n\n /**\n * If this is set on the window, our logger will log to the console\n * for ease of debugging. Used for testing purposes only.\n *\n * @see {Config.DEBUG} from config.ts\n */\n POSTHOG_DEBUG: any\n\n // Exposed by the browser\n doNotTrack: any\n\n // See entrypoints/customizations.full.ts\n posthogCustomizations: any\n\n /**\n * This is a legacy way to expose these functions, but we still need to support it for backwards compatibility\n * Can be removed once we drop support for 1.161.1\n *\n * See entrypoints/exception-autocapture.ts\n *\n * @deprecated use `__PosthogExtensions__.errorWrappingFunctions` instead\n */\n posthogErrorWrappingFunctions: any\n\n /**\n * This is a legacy way to expose these functions, but we still need to support it for backwards compatibility\n * Can be removed once we drop support for 1.161.1\n *\n * See entrypoints/posthog-recorder.ts\n *\n * @deprecated use `__PosthogExtensions__.rrweb` instead\n */\n rrweb: any\n\n /**\n * This is a legacy way to expose these functions, but we still need to support it for backwards compatibility\n * Can be removed once we drop support for 1.161.1\n *\n * See entrypoints/posthog-recorder.ts\n *\n * @deprecated use `__PosthogExtensions__.rrwebConsoleRecord` instead\n */\n rrwebConsoleRecord: any\n\n /**\n * This is a legacy way to expose these functions, but we still need to support it for backwards compatibility\n * Can be removed once we drop support for 1.161.1\n *\n * See entrypoints/posthog-recorder.ts\n *\n * @deprecated use `__PosthogExtensions__.getRecordNetworkPlugin` instead\n */\n getRecordNetworkPlugin: any\n\n /**\n * This is a legacy way to expose these functions, but we still need to support it for backwards compatibility\n * Can be removed once we drop support for 1.161.1\n *\n * See entrypoints/web-vitals.ts\n *\n * @deprecated use `__PosthogExtensions__.postHogWebVitalsCallbacks` instead\n */\n postHogWebVitalsCallbacks: any\n\n /**\n * This is a legacy way to expose these functions, but we still need to support it for backwards compatibility\n * Can be removed once we drop support for 1.161.1\n *\n * See entrypoints/tracing-headers.ts\n *\n * @deprecated use `__PosthogExtensions__.postHogTracingHeadersPatchFns` instead\n */\n postHogTracingHeadersPatchFns: any\n\n /**\n * This is a legacy way to expose these functions, but we still need to support it for backwards compatibility\n * Can be removed once we drop support for 1.161.1\n *\n * See entrypoints/surveys.ts\n *\n * @deprecated use `__PosthogExtensions__.generateSurveys` instead\n */\n extendPostHogWithSurveys: any\n\n /*\n * These are used to handle our toolbar state.\n * @see {Toolbar} from extensions/toolbar.ts\n */\n ph_load_toolbar: any\n ph_load_editor: any\n ph_toolbar_state: any\n } & Record<`__$$ph_site_app_${string}`, any>\n\n/**\n * This is our contract between (potentially) lazily loaded extensions and the SDK\n * changes to this interface can be breaking changes for users of the SDK\n */\n\nexport type ExternalExtensionKind = 'intercom-integration' | 'crisp-chat-integration'\n\nexport type PostHogExtensionKind =\n | 'toolbar'\n | 'exception-autocapture'\n | 'web-vitals'\n | 'web-vitals-with-attribution'\n | 'recorder'\n | 'lazy-recorder'\n | 'tracing-headers'\n | 'surveys'\n | 'logs'\n | 'conversations'\n | 'product-tours'\n | 'dead-clicks-autocapture'\n | 'remote-config'\n | ExternalExtensionKind\n\nexport interface LazyLoadedSessionRecordingInterface {\n start: (startReason?: SessionStartReason) => void\n stop: () => void\n discard: () => void\n sessionId: string\n status: SessionRecordingStatus\n onRRwebEmit: (rawEvent: eventWithTime) => void\n log: (message: string, level: 'log' | 'warn' | 'error') => void\n sdkDebugProperties: Properties\n overrideLinkedFlag: () => void\n overrideSampling: () => void\n overrideTrigger: (triggerType: TriggerType) => void\n isStarted: boolean\n tryAddCustomEvent(tag: string, payload: any): boolean\n}\n\nexport interface LazyLoadedDeadClicksAutocaptureInterface {\n start: (observerTarget: Node) => void\n stop: () => void\n}\n\nexport interface LazyLoadedConversationsInterface {\n // Widget control\n show: () => void\n hide: () => void\n isVisible: () => boolean\n\n // Lifecycle\n reset: () => void\n\n // Identity verification\n setIdentity: () => void\n clearIdentity: () => void\n\n // API methods\n sendMessage: (message: string, userTraits?: UserProvidedTraits, newTicket?: boolean) => Promise<SendMessageResponse>\n getMessages: (ticketId?: string, after?: string) => Promise<GetMessagesResponse>\n markAsRead: (ticketId?: string) => Promise<MarkAsReadResponse>\n getTickets: (options?: GetTicketsOptions) => Promise<GetTicketsResponse>\n requestRestoreLink: (email: string) => Promise<RequestRestoreLinkResponse>\n restoreFromToken: (restoreToken: string) => Promise<RestoreFromTokenResponse>\n restoreFromUrlToken: () => Promise<RestoreFromTokenResponse | null>\n getCurrentTicketId: () => string | null\n getWidgetSessionId: () => string\n}\n\ninterface PostHogExtensions {\n loadExternalDependency?: (\n posthog: PostHog,\n kind: PostHogExtensionKind,\n callback: (error?: string | Event, event?: Event) => void\n ) => void\n\n loadSiteApp?: (posthog: PostHog, appUrl: string, callback: (error?: string | Event, event?: Event) => void) => void\n\n errorWrappingFunctions?: {\n wrapOnError: (captureFn: (props: ErrorTracking.ErrorProperties) => void) => () => void\n wrapUnhandledRejection: (captureFn: (props: ErrorTracking.ErrorProperties) => void) => () => void\n wrapConsoleError: (captureFn: (props: ErrorTracking.ErrorProperties) => void) => () => void\n }\n rrweb?: { record: any; version: string; wasMaxDepthReached?: () => boolean; resetMaxDepthState?: () => void }\n rrwebPlugins?: { getRecordConsolePlugin: any; getRecordNetworkPlugin?: any }\n generateSurveys?: (posthog: PostHog, isSurveysEnabled: boolean) => any | undefined\n generateProductTours?: (posthog: PostHog, isEnabled: boolean) => any | undefined\n logs?: {\n initializeLogs?: (posthog: PostHog) => any | undefined\n }\n postHogWebVitalsCallbacks?: {\n onLCP: (metric: any) => void\n onCLS: (metric: any) => void\n onFCP: (metric: any) => void\n onINP: (metric: any) => void\n }\n /**\n * @deprecated\n *\n * this was introduced briefly, it is now always a no-op and only kept for backwards compatibility\n */\n loadWebVitalsCallbacks?: (useAttribution?: boolean) => PostHogExtensions['postHogWebVitalsCallbacks']\n tracingHeadersPatchFns?: {\n _patchFetch: (hostnames: string[], distinctId: string, sessionManager?: SessionIdManager) => () => void\n _patchXHR: (hostnames: string[], distinctId: string, sessionManager?: SessionIdManager) => () => void\n }\n initDeadClicksAutocapture?: (\n ph: PostHog,\n config: DeadClicksAutoCaptureConfig\n ) => LazyLoadedDeadClicksAutocaptureInterface\n integrations?: {\n [K in ExternalIntegrationKind]?: { start: (posthog: PostHog) => void; stop: () => void }\n }\n initSessionRecording?: (ph: PostHog) => LazyLoadedSessionRecordingInterface\n initConversations?: (config: ConversationsRemoteConfig, posthog: PostHog) => LazyLoadedConversationsInterface\n}\n\nconst global: typeof globalThis | undefined = typeof globalThis !== 'undefined' ? globalThis : win\n\n// React Native polyfills for posthog-js compatibility\nif (typeof self === 'undefined') {\n ;(global as any).self = global\n}\nif (typeof File === 'undefined') {\n ;(global as any).File = function () {}\n}\n\nexport const navigator = global?.navigator\nexport const document = global?.document\nexport const location = global?.location\nexport const fetch = global?.fetch\nexport const XMLHttpRequest =\n global?.XMLHttpRequest && 'withCredentials' in new global.XMLHttpRequest() ? global.XMLHttpRequest : undefined\nexport const AbortController = global?.AbortController\nexport const CompressionStream = global?.CompressionStream\nexport const userAgent = navigator?.userAgent\nexport const assignableWindow: AssignableWindow = win ?? ({} as any)\n\nexport { win as window }\n","import { knownUnsafeEditableEvent } from \"../types.mjs\";\nimport { includes } from \"./string-utils.mjs\";\nconst nativeIsArray = Array.isArray;\nconst ObjProto = Object.prototype;\nconst type_utils_hasOwnProperty = ObjProto.hasOwnProperty;\nconst type_utils_toString = ObjProto.toString;\nconst isArray = nativeIsArray || function(obj) {\n return '[object Array]' === type_utils_toString.call(obj);\n};\nconst isFunction = (x)=>'function' == typeof x;\nconst isNativeFunction = (x)=>isFunction(x) && -1 !== x.toString().indexOf('[native code]');\nconst isObject = (x)=>x === Object(x) && !isArray(x);\nconst isEmptyObject = (x)=>{\n if (isObject(x)) {\n for(const key in x)if (type_utils_hasOwnProperty.call(x, key)) return false;\n return true;\n }\n return false;\n};\nconst isUndefined = (x)=>void 0 === x;\nconst isString = (x)=>'[object String]' == type_utils_toString.call(x);\nconst isEmptyString = (x)=>isString(x) && 0 === x.trim().length;\nconst isNull = (x)=>null === x;\nconst isNullish = (x)=>isUndefined(x) || isNull(x);\nconst isNumber = (x)=>'[object Number]' == type_utils_toString.call(x) && x === x;\nconst isPositiveNumber = (value)=>isNumber(value) && value > 0;\nconst isBoolean = (x)=>'[object Boolean]' === type_utils_toString.call(x);\nconst isFormData = (x)=>x instanceof FormData;\nconst isFile = (x)=>x instanceof File;\nconst isPlainError = (x)=>x instanceof Error;\nconst isKnownUnsafeEditableEvent = (x)=>includes(knownUnsafeEditableEvent, x);\nfunction isPrimitive(value) {\n return null === value || 'object' != typeof value;\n}\nfunction isBuiltin(candidate, className) {\n return Object.prototype.toString.call(candidate) === `[object ${className}]`;\n}\nfunction isError(candidate) {\n switch(Object.prototype.toString.call(candidate)){\n case '[object Error]':\n case '[object Exception]':\n case '[object DOMException]':\n case '[object DOMError]':\n case '[object WebAssembly.Exception]':\n return true;\n default:\n return isInstanceOf(candidate, Error);\n }\n}\nfunction isErrorEvent(event) {\n return isBuiltin(event, 'ErrorEvent');\n}\nfunction isEvent(candidate) {\n return 'undefined' != typeof Event && isInstanceOf(candidate, Event);\n}\nfunction isPlainObject(candidate) {\n return isBuiltin(candidate, 'Object');\n}\nfunction isInstanceOf(candidate, base) {\n try {\n return candidate instanceof base;\n } catch {\n return false;\n }\n}\nconst yesLikeValues = [\n true,\n 'true',\n 1,\n '1',\n 'yes'\n];\nconst isYesLike = (val)=>includes(yesLikeValues, val);\nconst noLikeValues = [\n false,\n 'false',\n 0,\n '0',\n 'no'\n];\nconst isNoLike = (val)=>includes(noLikeValues, val);\nexport { type_utils_hasOwnProperty as hasOwnProperty, isArray, isBoolean, isBuiltin, isEmptyObject, isEmptyString, isError, isErrorEvent, isEvent, isFile, isFormData, isFunction, isKnownUnsafeEditableEvent, isNativeFunction, isNoLike, isNull, isNullish, isNumber, isObject, isPlainError, isPlainObject, isPositiveNumber, isPrimitive, isString, isUndefined, isYesLike, noLikeValues, yesLikeValues };\n","let parsedStackResults;\nlet lastKeysCount;\nlet cachedFilenameChunkIds;\nfunction getFilenameToChunkIdMap(stackParser) {\n const chunkIdMap = globalThis._posthogChunkIds;\n if (!chunkIdMap) return;\n const chunkIdKeys = Object.keys(chunkIdMap);\n if (cachedFilenameChunkIds && chunkIdKeys.length === lastKeysCount) return cachedFilenameChunkIds;\n lastKeysCount = chunkIdKeys.length;\n cachedFilenameChunkIds = chunkIdKeys.reduce((acc, stackKey)=>{\n if (!parsedStackResults) parsedStackResults = {};\n const result = parsedStackResults[stackKey];\n if (result) acc[result[0]] = result[1];\n else {\n const parsedStack = stackParser(stackKey);\n for(let i = parsedStack.length - 1; i >= 0; i--){\n const stackFrame = parsedStack[i];\n const filename = stackFrame?.filename;\n const chunkId = chunkIdMap[stackKey];\n if (filename && chunkId) {\n acc[filename] = chunkId;\n parsedStackResults[stackKey] = [\n filename,\n chunkId\n ];\n break;\n }\n }\n }\n return acc;\n }, {});\n return cachedFilenameChunkIds;\n}\nexport { getFilenameToChunkIdMap };\n","import { isUndefined } from \"../../utils/index.mjs\";\nconst UNKNOWN_FUNCTION = '?';\nfunction createFrame(platform, filename, func, lineno, colno) {\n const frame = {\n platform,\n filename,\n function: '<anonymous>' === func ? UNKNOWN_FUNCTION : func,\n in_app: true\n };\n if (!isUndefined(lineno)) frame.lineno = lineno;\n if (!isUndefined(colno)) frame.colno = colno;\n return frame;\n}\nexport { UNKNOWN_FUNCTION, createFrame };\n","import { UNKNOWN_FUNCTION } from \"./base.mjs\";\nconst extractSafariExtensionDetails = (func, filename)=>{\n const isSafariExtension = -1 !== func.indexOf('safari-extension');\n const isSafariWebExtension = -1 !== func.indexOf('safari-web-extension');\n return isSafariExtension || isSafariWebExtension ? [\n -1 !== func.indexOf('@') ? func.split('@')[0] : UNKNOWN_FUNCTION,\n isSafariExtension ? `safari-extension:${filename}` : `safari-web-extension:${filename}`\n ] : [\n func,\n filename\n ];\n};\nexport { extractSafariExtensionDetails };\n","import { UNKNOWN_FUNCTION, createFrame } from \"./base.mjs\";\nimport { extractSafariExtensionDetails } from \"./safari.mjs\";\nconst chromeRegexNoFnName = /^\\s*at (\\S+?)(?::(\\d+))(?::(\\d+))\\s*$/i;\nconst chromeRegex = /^\\s*at (?:(.+?\\)(?: \\[.+\\])?|.*?) ?\\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\\/)?.*?)(?::(\\d+))?(?::(\\d+))?\\)?\\s*$/i;\nconst chromeEvalRegex = /\\((\\S*)(?::(\\d+))(?::(\\d+))\\)/;\nconst chromeStackLineParser = (line, platform)=>{\n const noFnParts = chromeRegexNoFnName.exec(line);\n if (noFnParts) {\n const [, filename, line, col] = noFnParts;\n return createFrame(platform, filename, UNKNOWN_FUNCTION, +line, +col);\n }\n const parts = chromeRegex.exec(line);\n if (parts) {\n const isEval = parts[2] && 0 === parts[2].indexOf('eval');\n if (isEval) {\n const subMatch = chromeEvalRegex.exec(parts[2]);\n if (subMatch) {\n parts[2] = subMatch[1];\n parts[3] = subMatch[2];\n parts[4] = subMatch[3];\n }\n }\n const [func, filename] = extractSafariExtensionDetails(parts[1] || UNKNOWN_FUNCTION, parts[2]);\n return createFrame(platform, filename, func, parts[3] ? +parts[3] : void 0, parts[4] ? +parts[4] : void 0);\n }\n};\nexport { chromeStackLineParser };\n","import { UNKNOWN_FUNCTION, createFrame } from \"./base.mjs\";\nimport { extractSafariExtensionDetails } from \"./safari.mjs\";\nconst geckoREgex = /^\\s*(.*?)(?:\\((.*?)\\))?(?:^|@)?((?:[-a-z]+)?:\\/.*?|\\[native code\\]|[^@]*(?:bundle|\\d+\\.js)|\\/[\\w\\-. /=]+)(?::(\\d+))?(?::(\\d+))?\\s*$/i;\nconst geckoEvalRegex = /(\\S+) line (\\d+)(?: > eval line \\d+)* > eval/i;\nconst geckoStackLineParser = (line, platform)=>{\n const parts = geckoREgex.exec(line);\n if (parts) {\n const isEval = parts[3] && parts[3].indexOf(' > eval') > -1;\n if (isEval) {\n const subMatch = geckoEvalRegex.exec(parts[3]);\n if (subMatch) {\n parts[1] = parts[1] || 'eval';\n parts[3] = subMatch[1];\n parts[4] = subMatch[2];\n parts[5] = '';\n }\n }\n let filename = parts[3];\n let func = parts[1] || UNKNOWN_FUNCTION;\n [func, filename] = extractSafariExtensionDetails(func, filename);\n return createFrame(platform, filename, func, parts[4] ? +parts[4] : void 0, parts[5] ? +parts[5] : void 0);\n }\n};\nexport { geckoStackLineParser };\n","import { UNKNOWN_FUNCTION } from \"./base.mjs\";\nimport { chromeStackLineParser } from \"./chrome.mjs\";\nimport { geckoStackLineParser } from \"./gecko.mjs\";\nimport { winjsStackLineParser } from \"./winjs.mjs\";\nimport { opera10StackLineParser, opera11StackLineParser } from \"./opera.mjs\";\nimport { nodeStackLineParser } from \"./node.mjs\";\nconst WEBPACK_ERROR_REGEXP = /\\(error: (.*)\\)/;\nconst STACKTRACE_FRAME_LIMIT = 50;\nfunction reverseAndStripFrames(stack) {\n if (!stack.length) return [];\n const localStack = Array.from(stack);\n localStack.reverse();\n return localStack.slice(0, STACKTRACE_FRAME_LIMIT).map((frame)=>({\n ...frame,\n filename: frame.filename || getLastStackFrame(localStack).filename,\n function: frame.function || UNKNOWN_FUNCTION\n }));\n}\nfunction getLastStackFrame(arr) {\n return arr[arr.length - 1] || {};\n}\nfunction createDefaultStackParser() {\n return createStackParser(\"web:javascript\", chromeStackLineParser, geckoStackLineParser);\n}\nfunction createStackParser(platform, ...parsers) {\n return (stack, skipFirstLines = 0)=>{\n const frames = [];\n const lines = stack.split('\\n');\n for(let i = skipFirstLines; i < lines.length; i++){\n const line = lines[i];\n if (line.length > 1024) continue;\n const cleanedLine = WEBPACK_ERROR_REGEXP.test(line) ? line.replace(WEBPACK_ERROR_REGEXP, '$1') : line;\n if (!cleanedLine.match(/\\S*Error: /)) {\n for (const parser of parsers){\n const frame = parser(cleanedLine, platform);\n if (frame) {\n frames.push(frame);\n break;\n }\n }\n if (frames.length >= STACKTRACE_FRAME_LIMIT) break;\n }\n }\n return reverseAndStripFrames(frames);\n };\n}\nexport { chromeStackLineParser, createDefaultStackParser, createStackParser, geckoStackLineParser, nodeStackLineParser, opera10StackLineParser, opera11StackLineParser, reverseAndStripFrames, winjsStackLineParser };\n","const ERROR_TYPES_PATTERN = /^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;\nclass StringCoercer {\n match(input) {\n return 'string' == typeof input;\n }\n coerce(input, ctx) {\n const [type, value] = this.getInfos(input);\n return {\n type: type ?? 'Error',\n value: value ?? input,\n stack: ctx.syntheticException?.stack,\n synthetic: true\n };\n }\n getInfos(candidate) {\n let type = 'Error';\n let value = candidate;\n const groups = candidate.match(ERROR_TYPES_PATTERN);\n if (groups) {\n type = groups[1];\n value = groups[2];\n }\n return [\n type,\n value\n ];\n }\n}\nexport { StringCoercer };\n","const severityLevels = [\n 'fatal',\n 'error',\n 'warning',\n 'log',\n 'info',\n 'debug'\n];\nexport { severityLevels };\n","function truncate(str, max = 0) {\n if ('string' != typeof str || 0 === max) return str;\n return str.length <= max ? str : `${str.slice(0, max)}...`;\n}\nfunction extractExceptionKeysForMessage(err, maxLength = 40) {\n const keys = Object.keys(err);\n keys.sort();\n if (!keys.length) return '[object has no keys]';\n for(let i = keys.length; i > 0; i--){\n const serialized = keys.slice(0, i).join(', ');\n if (!(serialized.length > maxLength)) {\n if (i === keys.length) return serialized;\n return serialized.length <= maxLength ? serialized : `${serialized.slice(0, maxLength)}...`;\n }\n }\n return '';\n}\nexport { extractExceptionKeysForMessage, truncate };\n","import Config from '../config'\nimport { isUndefined } from '@posthog/core'\nimport { assignableWindow, window } from './globals'\nimport type { Logger } from '@posthog/core'\n\ntype CreateLoggerOptions = {\n debugEnabled?: boolean\n}\n\ntype PosthogJsLogger = Omit<Logger, 'createLogger'> & {\n _log: (level: 'log' | 'warn' | 'error', ...args: any[]) => void\n uninitializedWarning: (methodName: string) => void\n createLogger: (prefix: string, options?: CreateLoggerOptions) => PosthogJsLogger\n}\n\nconst _createLogger = (prefix: string, { debugEnabled }: CreateLoggerOptions = {}): PosthogJsLogger => {\n const logger: PosthogJsLogger = {\n _log: (level: 'log' | 'warn' | 'error', ...args: any[]) => {\n if (\n window &&\n (Config.DEBUG || assignableWindow.POSTHOG_DEBUG || debugEnabled) &&\n !isUndefined(window.console) &&\n window.console\n ) {\n const consoleLog =\n '__rrweb_original__' in window.console[level]\n ? (window.console[level] as any)['__rrweb_original__']\n : window.console[level]\n\n // eslint-disable-next-line no-console\n consoleLog(prefix, ...args)\n }\n },\n\n info: (...args: any[]) => {\n logger._log('log', ...args)\n },\n\n warn: (...args: any[]) => {\n logger._log('warn', ...args)\n },\n\n error: (...args: any[]) => {\n logger._log('error', ...args)\n },\n\n critical: (...args: any[]) => {\n // Critical errors are always logged to the console\n // eslint-disable-next-line no-console\n console.error(prefix, ...args)\n },\n\n uninitializedWarning: (methodName: string) => {\n logger.error(`You must initialize PostHog before calling ${methodName}`)\n },\n\n createLogger: (additionalPrefix: string, options?: CreateLoggerOptions) =>\n _createLogger(`${prefix} ${additionalPrefix}`, options),\n }\n return logger\n}\n\nexport const logger = _createLogger('[PostHog.js]')\n\nexport const createLogger = logger.createLogger\n","import { ERROR_TRACKING_CAPTURE_EXTENSION_EXCEPTIONS, ERROR_TRACKING_SUPPRESSION_RULES } from './constants'\nimport { Extension } from './extensions/types'\nimport { PostHog } from './posthog-core'\nimport { CaptureResult, ErrorTrackingSuppressionRule, Properties, RemoteConfig } from './types'\nimport { createLogger } from './utils/logger'\nimport { propertyComparisons } from './utils/property-utils'\nimport { isString, isArray, isObject, ErrorTracking, isNullish } from '@posthog/core'\n\nconst logger = createLogger('[Error tracking]')\n\nexport function buildErrorPropertiesBuilder() {\n return new ErrorTracking.ErrorPropertiesBuilder(\n [\n new ErrorTracking.DOMExceptionCoercer(),\n new ErrorTracking.PromiseRejectionEventCoercer(),\n new ErrorTracking.ErrorEventCoercer(),\n new ErrorTracking.ErrorCoercer(),\n new ErrorTracking.EventCoercer(),\n new ErrorTracking.ObjectCoercer(),\n new ErrorTracking.StringCoercer(),\n new ErrorTracking.PrimitiveCoercer(),\n ],\n ErrorTracking.createDefaultStackParser()\n )\n}\nexport class PostHogExceptions implements Extension {\n private readonly _instance: PostHog\n private _suppressionRules: ErrorTrackingSuppressionRule[] = []\n private _errorPropertiesBuilder: ErrorTracking.ErrorPropertiesBuilder = buildErrorPropertiesBuilder()\n private _exceptionStepsBuffer: ErrorTracking.ExceptionStepsBuffer\n private _exceptionStepsConfig: ErrorTracking.ResolvedExceptionStepsConfig\n\n constructor(instance: PostHog) {\n this._instance = instance\n this._suppressionRules = this._instance.persistence?.get_property(ERROR_TRACKING_SUPPRESSION_RULES) ?? []\n this._exceptionStepsConfig = ErrorTracking.resolveExceptionStepsConfig(this._getExceptionStepsConfig())\n this._exceptionStepsBuffer = new ErrorTracking.ExceptionStepsBuffer(this._exceptionStepsConfig)\n }\n\n onConfigChange() {\n this._exceptionStepsConfig = ErrorTracking.resolveExceptionStepsConfig(this._getExceptionStepsConfig())\n this._exceptionStepsBuffer.setConfig(this._exceptionStepsConfig)\n }\n\n onRemoteConfig(response: RemoteConfig) {\n if (!('errorTracking' in response)) {\n return\n }\n\n const suppressionRules = response.errorTracking?.suppressionRules ?? []\n const captureExtensionExceptions = response.errorTracking?.captureExtensionExceptions\n\n // store this in-memory in case persistence is disabled\n this._suppressionRules = suppressionRules\n\n if (this._instance.persistence) {\n this._instance.persistence.register({\n [ERROR_TRACKING_SUPPRESSION_RULES]: this._suppressionRules,\n [ERROR_TRACKING_CAPTURE_EXTENSION_EXCEPTIONS]: captureExtensionExceptions,\n })\n }\n }\n\n private get _captureExtensionExceptions() {\n const enabled_server_side = !!this._instance.get_property(ERROR_TRACKING_CAPTURE_EXTENSION_EXCEPTIONS)\n const enabled_client_side = this._instance.config.error_tracking.captureExtensionExceptions\n return enabled_client_side ?? enabled_server_side ?? false\n }\n\n buildProperties(\n input: unknown,\n metadata?: { handled?: boolean; syntheticException?: Error }\n ): ErrorTracking.ErrorProperties {\n return this._errorPropertiesBuilder.buildFromUnknown(input, {\n syntheticException: metadata?.syntheticException,\n mechanism: {\n handled: metadata?.handled,\n },\n })\n }\n\n addExceptionStep(message: string, properties?: Properties): void {\n if (!this._exceptionStepsConfig.enabled) {\n return\n }\n\n try {\n if (!isString(message) || message.trim().length === 0) {\n logger.warn('Ignoring exception step because message must be a non-empty string')\n return\n }\n\n const userProperties = this._coerceExceptionStepProperties(properties)\n\n const { sanitizedProperties, droppedKeys } = ErrorTracking.stripReservedExceptionStepFields(userProperties)\n\n if (droppedKeys.length > 0) {\n logger.warn('Ignoring reserved exception step fields', { droppedKeys })\n }\n\n this._exceptionStepsBuffer.add({\n [ErrorTracking.EXCEPTION_STEP_INTERNAL_FIELDS.MESSAGE]: message,\n [ErrorTracking.EXCEPTION_STEP_INTERNAL_FIELDS.TIMESTAMP]: new Date().toISOString(),\n ...sanitizedProperties,\n })\n } catch (error) {\n logger.error('Failed to add exception step. Ignoring breadcrumb.', error)\n }\n }\n\n sendExceptionEvent(properties: Properties): CaptureResult | undefined {\n try {\n const exceptionList = properties.$exception_list\n\n if (this._isExceptionList(exceptionList)) {\n if (this._matchesSuppressionRule(exceptionList)) {\n this._addDroppedExceptionStep('Exception dropped: matched a suppression rule')\n logger.info('Skipping exception capture because a suppression rule matched')\n return\n }\n\n if (!this._captureExtensionExceptions && this._isExtensionException(exceptionList)) {\n this._addDroppedExceptionStep('Exception dropped: thrown by a browser extension')\n logger.info('Skipping exception capture because it was thrown by an extension')\n return\n }\n\n if (\n !this._instance.config.error_tracking.__capturePostHogExceptions &&\n this._isPostHogException(exceptionList)\n ) {\n this._addDroppedExceptionStep('Exception dropped: thrown by the PostHog SDK')\n logger.info('Skipping exception capture because it was thrown by the PostHog SDK')\n return\n }\n }\n\n const propertiesForExceptionCapture =\n this._exceptionStepsConfig.enabled && isNullish(properties.$exception_steps)\n ? this._addBufferedExceptionSteps(properties)\n : properties\n\n try {\n const result = this._instance.capture('$exception', propertiesForExceptionCapture, {\n _noTruncate: true,\n _batchKey: 'exceptionEvent',\n _originatedFromCaptureException: true,\n })\n\n if (result) {\n this._exceptionStepsBuffer.clear()\n }\n\n return result\n } catch (error) {\n logger.error('Failed to capture exception event. Dropping this exception.', error)\n this._exceptionStepsBuffer.clear()\n return\n }\n } catch (error) {\n logger.error('Failed to process exception event. Ignoring this exception.', error)\n return\n }\n }\n\n private _addBufferedExceptionSteps(properties: Properties): Properties {\n try {\n const exceptionSteps = this._exceptionStepsBuffer.getAttachable()\n\n if (exceptionSteps.length === 0) {\n return properties\n }\n\n return {\n ...properties,\n $exception_steps: exceptionSteps,\n }\n } catch (error) {\n logger.error('Failed to read buffered exception steps. Capturing exception without steps.', error)\n return properties\n }\n }\n\n private _addDroppedExceptionStep(message: string): void {\n if (this._exceptionStepsConfig.enabled) {\n this._exceptionStepsBuffer.add({\n [ErrorTracking.EXCEPTION_STEP_INTERNAL_FIELDS.MESSAGE]: message,\n [ErrorTracking.EXCEPTION_STEP_INTERNAL_FIELDS.TIMESTAMP]: new Date().toISOString(),\n })\n }\n }\n\n private _coerceExceptionStepProperties(properties?: Properties): Record<string, unknown> {\n if (!isObject(properties)) {\n return {}\n }\n\n return { ...(properties as Record<string, unknown>) }\n }\n\n private _getExceptionStepsConfig(): ErrorTracking.ExceptionStepsConfig {\n return this._instance.config.error_tracking?.exception_steps ?? {}\n }\n\n private _matchesSuppressionRule(exceptionList: ErrorTracking.ExceptionList): boolean {\n if (exceptionList.length === 0) {\n return false\n }\n\n const exceptionValues = exceptionList.reduce(\n (acc, { type, value }) => {\n if (isString(type) && type.length > 0) {\n acc['$exception_types'].push(type)\n }\n if (isString(value) && value.length > 0) {\n acc['$exception_values'].push(value)\n }\n return acc\n },\n {\n $exception_types: [] as string[],\n $exception_values: [] as string[],\n }\n )\n\n return this._suppressionRules.some((rule) => {\n const results = rule.values.map((v) => {\n const compare = propertyComparisons[v.operator]\n const targets = isArray(v.value) ? v.value : [v.value]\n const values = exceptionValues[v.key] ?? []\n return targets.length > 0 ? compare(targets, values) : false\n })\n return rule.type === 'OR' ? results.some(Boolean) : results.every(Boolean)\n })\n }\n\n private _isExtensionException(exceptionList: ErrorTracking.ExceptionList): boolean {\n const frames = exceptionList.flatMap((e) => e.stacktrace?.frames ?? [])\n return frames.some((f) => f.filename && f.filename.startsWith('chrome-extension://'))\n }\n\n private _isPostHogException(exceptionList: ErrorTracking.ExceptionList): boolean {\n if (exceptionList.length > 0) {\n const exception = exceptionList[0]\n const frames = exception.stacktrace?.frames ?? []\n const lastFrame = frames[frames.length - 1]\n return lastFrame?.filename?.includes('posthog.com/static') ?? false\n }\n\n return false\n }\n\n private _isExceptionList(candidate: unknown): candidate is ErrorTracking.ExceptionList {\n return !isNullish(candidate) && isArray(candidate)\n }\n}\n","import { assignableWindow, window } from '../utils/globals'\nimport { ErrorEventArgs } from '../types'\nimport { createLogger } from '../utils/logger'\nimport type { ErrorTracking } from '@posthog/core'\nimport { buildErrorPropertiesBuilder } from '../posthog-exceptions'\n\nconst logger = createLogger('[ExceptionAutocapture]')\nconst errorPropertiesBuilder = buildErrorPropertiesBuilder()\n\nconst wrapOnError = (captureFn: (props: ErrorTracking.ErrorProperties) => void) => {\n const win = window as any\n if (!win) {\n logger.info('window not available, cannot wrap onerror')\n }\n const originalOnError = win.onerror\n\n win.onerror = function (...args: ErrorEventArgs): boolean {\n const error = args[4]\n const event = args[0]\n const errorProperties = errorPropertiesBuilder.buildFromUnknown(error || event, {\n mechanism: { handled: false },\n })\n captureFn(errorProperties)\n return originalOnError?.(...args) ?? false\n }\n win.onerror.__POSTHOG_INSTRUMENTED__ = true\n\n return () => {\n delete win.onerror?.__POSTHOG_INSTRUMENTED__\n win.onerror = originalOnError\n }\n}\n\nconst wrapUnhandledRejection = (captureFn: (props: ErrorTracking.ErrorProperties) => void) => {\n const win = window as any\n if (!win) {\n logger.info('window not available, cannot wrap onUnhandledRejection')\n }\n\n const originalOnUnhandledRejection = win.onunhandledrejection\n\n win.onunhandledrejection = function (ev: PromiseRejectionEvent): boolean {\n const errorProperties = errorPropertiesBuilder.buildFromUnknown(ev, {\n mechanism: { handled: false },\n })\n captureFn(errorProperties)\n return originalOnUnhandledRejection?.(ev) ?? false\n }\n win.onunhandledrejection.__POSTHOG_INSTRUMENTED__ = true\n\n return () => {\n delete win.onunhandledrejection?.__POSTHOG_INSTRUMENTED__\n win.onunhandledrejection = originalOnUnhandledRejection\n }\n}\n\nconst wrapConsoleError = (captureFn: (props: ErrorTracking.ErrorProperties) => void) => {\n const con = console as any\n if (!con) {\n logger.info('console not available, cannot wrap console.error')\n }\n\n const originalConsoleError = con.error\n\n con.error = function (...args: any[]): void {\n let event\n if (args.length == 1) {\n event = args[0]\n } else {\n event = args.join(' ')\n }\n const error = args.find((arg) => arg instanceof Error)\n const errorProperties = errorPropertiesBuilder.buildFromUnknown(error || event, {\n mechanism: { handled: false },\n syntheticException: new Error('PostHog syntheticException'),\n skipFirstLines: 2,\n })\n captureFn(errorProperties)\n return originalConsoleError?.(...args)\n }\n con.error.__POSTHOG_INSTRUMENTED__ = true\n\n return () => {\n delete con.error?.__POSTHOG_INSTRUMENTED__\n con.error = originalConsoleError\n }\n}\n\nconst posthogErrorWrappingFunctions = {\n wrapOnError,\n wrapUnhandledRejection,\n wrapConsoleError,\n}\n\nassignableWindow.__PosthogExtensions__ = assignableWindow.__PosthogExtensions__ || {}\nassignableWindow.__PosthogExtensions__.errorWrappingFunctions = posthogErrorWrappingFunctions\n\n// we used to put these on window, and now we put them on __PosthogExtensions__\n// but that means that old clients which lazily load this extension are looking in the wrong place\n// yuck,\n// so we also put them directly on the window\n// when 1.161.1 is the oldest version seen in production we can remove this\nassignableWindow.posthogErrorWrappingFunctions = posthogErrorWrappingFunctions\n\nexport default posthogErrorWrappingFunctions\n","import { isArray } from \"../utils/index.mjs\";\nimport { getFilenameToChunkIdMap } from \"./chunk-ids.mjs\";\nconst MAX_CAUSE_RECURSION = 4;\nclass ErrorPropertiesBuilder {\n constructor(coercers, stackParser, modifiers = []){\n this.coercers = coercers;\n this.stackParser = stackParser;\n this.modifiers = modifiers;\n }\n buildFromUnknown(input, hint = {}) {\n const providedMechanism = hint && hint.mechanism;\n const mechanism = providedMechanism || {\n handled: true,\n type: 'generic'\n };\n const coercingContext = this.buildCoercingContext(mechanism, hint, 0);\n const exceptionWithCause = coercingContext.apply(input);\n const parsingContext = this.buildParsingContext(hint);\n const exceptionWithStack = this.parseStacktrace(exceptionWithCause, parsingContext);\n const exceptionList = this.convertToExceptionList(exceptionWithStack, mechanism);\n return {\n $exception_list: exceptionList,\n $exception_level: 'error'\n };\n }\n async modifyFrames(exceptionList) {\n for (const exc of exceptionList)if (exc.stacktrace && exc.stacktrace.frames && isArray(exc.stacktrace.frames)) exc.stacktrace.frames = await this.applyModifiers(exc.stacktrace.frames);\n return exceptionList;\n }\n coerceFallback(ctx) {\n return {\n type: 'Error',\n value: 'Unknown error',\n stack: ctx.syntheticException?.stack,\n synthetic: true\n };\n }\n parseStacktrace(err, ctx) {\n let cause;\n if (null != err.cause) cause = this.parseStacktrace(err.cause, ctx);\n let stack;\n if ('' != err.stack && null != err.stack) stack = this.applyChunkIds(this.stackParser(err.stack, err.synthetic ? ctx.skipFirstLines : 0), ctx.chunkIdMap);\n return {\n ...err,\n cause,\n stack\n };\n }\n applyChunkIds(frames, chunkIdMap) {\n return frames.map((frame)=>{\n if (frame.filename && chunkIdMap) frame.chunk_id = chunkIdMap[frame.filename];\n return frame;\n });\n }\n applyCoercers(input, ctx) {\n for (const adapter of this.coercers)if (adapter.match(input)) return adapter.coerce(input, ctx);\n return this.coerceFallback(ctx);\n }\n async applyModifiers(frames) {\n let newFrames = frames;\n for (const modifier of this.modifiers)newFrames = await modifier(newFrames);\n return newFrames;\n }\n convertToExceptionList(exceptionWithStack, mechanism) {\n const currentException = {\n type: exceptionWithStack.type,\n value: exceptionWithStack.value,\n mechanism: {\n type: mechanism.type ?? 'generic',\n handled: mechanism.handled ?? true,\n synthetic: exceptionWithStack.synthetic ?? false\n }\n };\n if (exceptionWithStack.stack) currentException.stacktrace = {\n type: 'raw',\n frames: exceptionWithStack.stack\n };\n const exceptionList = [\n currentException\n ];\n if (null != exceptionWithStack.cause) exceptionList.push(...this.convertToExceptionList(exceptionWithStack.cause, {\n ...mechanism,\n handled: true\n }));\n return exceptionList;\n }\n buildParsingContext(hint) {\n const context = {\n chunkIdMap: getFilenameToChunkIdMap(this.stackParser),\n skipFirstLines: hint.skipFirstLines ?? 1\n };\n return context;\n }\n buildCoercingContext(mechanism, hint, depth = 0) {\n const coerce = (input, depth)=>{\n if (!(depth <= MAX_CAUSE_RECURSION)) return;\n {\n const ctx = this.buildCoercingContext(mechanism, hint, depth);\n return this.applyCoercers(input, ctx);\n }\n };\n const context = {\n ...hint,\n syntheticException: 0 == depth ? hint.syntheticException : void 0,\n mechanism,\n apply: (input)=>coerce(input, depth),\n next: (input)=>coerce(input, depth + 1)\n };\n return context;\n }\n}\nexport { ErrorPropertiesBuilder };\n","import { isBuiltin, isString } from \"../../utils/index.mjs\";\nclass DOMExceptionCoercer {\n match(err) {\n return this.isDOMException(err) || this.isDOMError(err);\n }\n coerce(err, ctx) {\n const hasStack = isString(err.stack);\n return {\n type: this.getType(err),\n value: this.getValue(err),\n stack: hasStack ? err.stack : void 0,\n cause: err.cause ? ctx.next(err.cause) : void 0,\n synthetic: false\n };\n }\n getType(candidate) {\n return this.isDOMError(candidate) ? 'DOMError' : 'DOMException';\n }\n getValue(err) {\n const name = err.name || (this.isDOMError(err) ? 'DOMError' : 'DOMException');\n const message = err.message ? `${name}: ${err.message}` : name;\n return message;\n }\n isDOMException(err) {\n return isBuiltin(err, 'DOMException');\n }\n isDOMError(err) {\n return isBuiltin(err, 'DOMError');\n }\n}\nexport { DOMExceptionCoercer };\n","import { isBuiltin, isEvent, isPrimitive } from \"../../utils/index.mjs\";\nclass PromiseRejectionEventCoercer {\n match(err) {\n return isBuiltin(err, 'PromiseRejectionEvent') || this.isCustomEventWrappingRejection(err);\n }\n isCustomEventWrappingRejection(err) {\n if (!isEvent(err)) return false;\n try {\n const detail = err.detail;\n return null != detail && 'object' == typeof detail && 'reason' in detail;\n } catch {\n return false;\n }\n }\n coerce(err, ctx) {\n const reason = this.getUnhandledRejectionReason(err);\n if (isPrimitive(reason)) return {\n type: 'UnhandledRejection',\n value: `Non-Error promise rejection captured with value: ${String(reason)}`,\n stack: ctx.syntheticException?.stack,\n synthetic: true\n };\n return ctx.apply(reason);\n }\n getUnhandledRejectionReason(error) {\n try {\n if ('reason' in error) return error.reason;\n if ('detail' in error && null != error.detail && 'object' == typeof error.detail && 'reason' in error.detail) return error.detail.reason;\n } catch {}\n return error;\n }\n}\nexport { PromiseRejectionEventCoercer };\n","import { isErrorEvent } from \"../../utils/index.mjs\";\nclass ErrorEventCoercer {\n constructor(){}\n match(err) {\n return isErrorEvent(err) && void 0 != err.error;\n }\n coerce(err, ctx) {\n const exceptionLike = ctx.apply(err.error);\n if (!exceptionLike) return {\n type: 'ErrorEvent',\n value: err.message,\n stack: ctx.syntheticException?.stack,\n synthetic: true\n };\n return exceptionLike;\n }\n}\nexport { ErrorEventCoercer };\n","import { isPlainError } from \"../../utils/index.mjs\";\nclass ErrorCoercer {\n match(err) {\n return isPlainError(err);\n }\n coerce(err, ctx) {\n return {\n type: this.getType(err),\n value: this.getMessage(err, ctx),\n stack: this.getStack(err),\n cause: err.cause ? ctx.next(err.cause) : void 0,\n synthetic: false\n };\n }\n getType(err) {\n return err.name || err.constructor.name;\n }\n getMessage(err, _ctx) {\n const message = err.message;\n if (message.error && 'string' == typeof message.error.message) return String(message.error.message);\n return String(message);\n }\n getStack(err) {\n return err.stacktrace || err.stack || void 0;\n }\n}\nexport { ErrorCoercer };\n","import { isEvent } from \"../../utils/index.mjs\";\nimport { extractExceptionKeysForMessage } from \"./utils.mjs\";\nclass EventCoercer {\n match(err) {\n return isEvent(err);\n }\n coerce(evt, ctx) {\n const constructorName = evt.constructor.name;\n return {\n type: constructorName,\n value: `${constructorName} captured as exception with keys: ${extractExceptionKeysForMessage(evt)}`,\n stack: ctx.syntheticException?.stack,\n synthetic: true\n };\n }\n}\nexport { EventCoercer };\n","import { isEmptyString, isError, isEvent, isString } from \"../../utils/index.mjs\";\nimport { severityLevels } from \"../types.mjs\";\nimport { extractExceptionKeysForMessage } from \"./utils.mjs\";\nclass ObjectCoercer {\n match(candidate) {\n return 'object' == typeof candidate && null !== candidate;\n }\n coerce(candidate, ctx) {\n const errorProperty = this.getErrorPropertyFromObject(candidate);\n if (errorProperty) return ctx.apply(errorProperty);\n return {\n type: this.getType(candidate),\n value: this.getValue(candidate),\n stack: ctx.syntheticException?.stack,\n level: this.isSeverityLevel(candidate.level) ? candidate.level : 'error',\n synthetic: true\n };\n }\n getType(err) {\n return isEvent(err) ? err.constructor.name : 'Error';\n }\n getValue(err) {\n if ('name' in err && 'string' == typeof err.name) {\n let message = `'${err.name}' captured as exception`;\n if ('message' in err && 'string' == typeof err.message) message += ` with message: '${err.message}'`;\n return message;\n }\n if ('message' in err && 'string' == typeof err.message) return err.message;\n const className = this.getObjectClassName(err);\n const keys = extractExceptionKeysForMessage(err);\n return `${className && 'Object' !== className ? `'${className}'` : 'Object'} captured as exception with keys: ${keys}`;\n }\n isSeverityLevel(x) {\n return isString(x) && !isEmptyString(x) && severityLevels.indexOf(x) >= 0;\n }\n getErrorPropertyFromObject(obj) {\n for(const prop in obj)if (Object.prototype.hasOwnProperty.call(obj, prop)) {\n const value = obj[prop];\n if (isError(value)) return value;\n }\n }\n getObjectClassName(obj) {\n try {\n const prototype = Object.getPrototypeOf(obj);\n return prototype ? prototype.constructor.name : void 0;\n } catch (e) {\n return;\n }\n }\n}\nexport { ObjectCoercer };\n","export * from \"./bot-detection.mjs\";\nexport * from \"./bucketed-rate-limiter.mjs\";\nexport * from \"./number-utils.mjs\";\nexport * from \"./string-utils.mjs\";\nexport * from \"./type-utils.mjs\";\nexport * from \"./promise-queue.mjs\";\nexport * from \"./logger.mjs\";\nexport * from \"./user-agent-utils.mjs\";\nconst STRING_FORMAT = 'utf8';\nfunction assert(truthyValue, message) {\n if (!truthyValue || 'string' != typeof truthyValue || isEmpty(truthyValue)) throw new Error(message);\n}\nfunction isEmpty(truthyValue) {\n if (0 === truthyValue.trim().length) return true;\n return false;\n}\nfunction removeTrailingSlash(url) {\n return url?.replace(/\\/+$/, '');\n}\nasync function retriable(fn, props) {\n let lastError = null;\n for(let i = 0; i < props.retryCount + 1; i++){\n if (i > 0) await new Promise((r)=>setTimeout(r, props.retryDelay));\n try {\n const res = await fn();\n return res;\n } catch (e) {\n lastError = e;\n if (!props.retryCheck(e)) throw e;\n }\n }\n throw lastError;\n}\nfunction currentTimestamp() {\n return new Date().getTime();\n}\nfunction currentISOTime() {\n return new Date().toISOString();\n}\nfunction safeSetTimeout(fn, timeout) {\n const t = setTimeout(fn, timeout);\n t?.unref && t?.unref();\n return t;\n}\nconst isPromise = (obj)=>obj && 'function' == typeof obj.then;\nconst isError = (x)=>x instanceof Error;\nfunction getFetch() {\n return 'undefined' != typeof fetch ? fetch : void 0 !== globalThis.fetch ? globalThis.fetch : void 0;\n}\nfunction allSettled(promises) {\n return Promise.all(promises.map((p)=>(p ?? Promise.resolve()).then((value)=>({\n status: 'fulfilled',\n value\n }), (reason)=>({\n status: 'rejected',\n reason\n }))));\n}\nexport { STRING_FORMAT, allSettled, assert, currentISOTime, currentTimestamp, getFetch, isError, isPromise, removeTrailingSlash, retriable, safeSetTimeout };\n","import { isPrimitive } from \"../../utils/index.mjs\";\nclass PrimitiveCoercer {\n match(candidate) {\n return isPrimitive(candidate);\n }\n coerce(value, ctx) {\n return {\n type: 'Error',\n value: `Primitive value captured as exception: ${String(value)}`,\n stack: ctx.syntheticException?.stack,\n synthetic: true\n };\n }\n}\nexport { PrimitiveCoercer };\n"],"names":["win","window","undefined","global","globalThis","self","File","XMLHttpRequest","assignableWindow","parsedStackResults","lastKeysCount","cachedFilenameChunkIds","type_utils_toString","Object","prototype","toString","isArray","Array","obj","call","isUndefined","x","isString","isPrimitive","value","isBuiltin","candidate","className","isEvent","Event","base","_unused","isInstanceOf","getFilenameToChunkIdMap","stackParser","chunkIdMap","_posthogChunkIds","chunkIdKeys","keys","length","reduce","acc","stackKey","result","parsedStack","i","stackFrame","filename","chunkId","UNKNOWN_FUNCTION","createFrame","platform","func","lineno","colno","frame","function","in_app","extractSafariExtensionDetails","isSafariExtension","indexOf","isSafariWebExtension","split","chromeRegexNoFnName","chromeRegex","chromeEvalRegex","chromeStackLineParser","line","noFnParts","exec","col","parts","subMatch","geckoREgex","geckoEvalRegex","geckoStackLineParser","WEBPACK_ERROR_REGEXP","ERROR_TYPES_PATTERN","severityLevels","extractExceptionKeysForMessage","err","maxLength","sort","serialized","slice","join","_createLogger","prefix","_temp","debugEnabled","logger","_log","level","POSTHOG_DEBUG","console","consoleLog","_len","arguments","args","_key","info","_len2","_key2","warn","_len3","_key3","error","_len4","_key4","critical","_len5","_key5","uninitializedWarning","methodName","createLogger","additionalPrefix","options","errorPropertiesBuilder","constructor","coercers","modifiers","this","buildFromUnknown","input","hint","mechanism","handled","type","exceptionWithCause","buildCoercingContext","apply","parsingContext","buildParsingContext","exceptionWithStack","parseStacktrace","$exception_list","convertToExceptionList","$exception_level","modifyFrames","exceptionList","_this","_asyncToGenerator","exc","stacktrace","frames","applyModifiers","coerceFallback","ctx","_ctx$syntheticExcepti","stack","syntheticException","synthetic","cause","applyChunkIds","skipFirstLines","_extends","map","chunk_id","applyCoercers","adapter","match","coerce","_this2","newFrames","modifier","_mechanism$type","_mechanism$handled","_exceptionWithStack$s","currentException","push","_hint$skipFirstLines","depth","next","isDOMException","isDOMError","hasStack","getType","getValue","name","message","isCustomEventWrappingRejection","detail","reason","getUnhandledRejectionReason","String","_unused2","Error","getMessage","getStack","_ctx","evt","constructorName","errorProperty","getErrorPropertyFromObject","isSeverityLevel","getObjectClassName","trim","isEmptyString","prop","hasOwnProperty","getPrototypeOf","e","getInfos","groups","parsers","lines","cleanedLine","test","replace","parser","localStack","from","reverse","arr","reverseAndStripFrames","createStackParser","posthogErrorWrappingFunctions","wrapOnError","captureFn","originalOnError","onerror","_originalOnError","errorProperties","__POSTHOG_INSTRUMENTED__","_win$onerror","wrapUnhandledRejection","originalOnUnhandledRejection","onunhandledrejection","ev","_originalOnUnhandledR","_win$onunhandledrejec","wrapConsoleError","con","originalConsoleError","event","find","arg","_con$error","__PosthogExtensions__","errorWrappingFunctions"],"mappings":"yBAsCA,IAAMA,EAAkE,oBAAXC,OAAyBA,YAASC,EA4OzFC,EAA8D,oBAAfC,WAA6BA,WAAaJ,EAG3E,oBAATK,OACLF,EAAeE,KAAOF,GAER,oBAATG,OACLH,EAAeG,KAAO,WAAa,SAQrCH,GAAAA,EAAQI,gBAAuC,IAAIJ,EAAOI,eAIvD,IAAMC,EAAqCR,QAAAA,EAAQ,CAAA,shBCnS1D,ICFIS,EACAC,EACAC,EDGEC,EAFWC,CAAOC,EAEaC,SAC/BC,EAJgBC,MAAMD,SAIK,SAASE,GACtC,MAAO,mBAAqBN,EAAoBO,KAAKD,EACzD,EAWME,EAAeC,QAAI,IAAWA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