@walkeros/web-destination-posthog 4.7.0-next-1790722899482 → 4.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -3
- package/dist/index.browser.js +1 -1
- package/dist/index.es5.js +1 -1
- package/dist/walkerOS.json +12 -11
- package/package.json +4 -4
package/dist/index.browser.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Destination=(()=>{var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,s={};((t,i)=>{for(var r in i)e(t,r,{get:i[r],enumerable:!0})})(s,{DestinationPostHog:()=>al,default:()=>hl,destinationPostHog:()=>cl});var n=Object.defineProperty,o=(e,t)=>{for(var i in t)n(e,i,{get:t[i],enumerable:!0})};function a(e,t){if("collector"===e)return"collector";if(!t)throw new Error(`stepId(${e}) requires an id`);return`${e}.${t}`}o({},{stepId:()=>a});function l(e,t){const i=e.destinations[t];if(!i)throw new Error(`Destination not found: ${t}`);return i}o({},{getDestination:()=>l});o({},{Level:()=>c});var u,c=((u=c||{})[u.ERROR=0]="ERROR",u[u.WARN=1]="WARN",u[u.INFO=2]="INFO",u[u.DEBUG=3]="DEBUG",u);function h(e,t){const i=e.transformers[t];if(!i)throw new Error(`Transformer not found: ${t}`);return i}o({},{getTransformer:()=>h});function d(e,t){const i=e.sources[t];if(!i)throw new Error(`Source not found: ${t}`);return i}o({},{getSource:()=>d});function p(e,t){const i=e.stores[t];if(!i)throw new Error(`Store not found: ${t}`);return i}async function v(e,t){return await e.get(t)}function g(e){return Array.isArray(e)}function _(e){return void 0!==e}function f(e){return"object"==typeof e&&null!==e&&!g(e)&&"[object Object]"===Object.prototype.toString.call(e)}function m(e){return"string"==typeof e}function y(e,t="",i){const r=t.split(".");let s=e;for(let e=0;e<r.length;e++){const t=r[e];if("*"===t&&g(s)){const t=r.slice(e+1).join("."),n=[];for(const e of s){const r=y(e,t,i);n.push(r)}return n}if(s=f(s)||g(s)?s[t]:void 0,void 0===s)break}return _(s)?s:i}function b(e){return function(e){return"boolean"==typeof e}(e)||m(e)||function(e){return"number"==typeof e&&!Number.isNaN(e)}(e)||!_(e)||g(e)&&e.every(b)||f(e)&&Object.values(e).every(b)}function w(e){return b(e)?e:void 0}function x(e,t,i){return async function(...r){try{return await e(...r)}catch(e){if(!t)return;return await t(e)}finally{await(null==i?void 0:i())}}}o({},{getStore:()=>p,getStoreValue:()=>v});var E=class e extends Error{constructor(t,i){super(t,i),this.name="FatalError",Object.setPrototypeOf(this,e.prototype)}};async function k(e,t={},i={}){var r,s;if(!_(e))return;const n=f(e)&&e.consent||i.consent||(null==(r=i.collector)?void 0:r.consent),o=null!=(s=i.event)?s:f(e)?e:{};if(!i.collector)throw new Error("getMappingValue: context.collector is required");const a={event:o,mapping:t,collector:i.collector,logger:i.collector.logger,consent:n},l=g(t)?t:[t];for(const t of l){const r=await x(S,e=>{if(e instanceof E)throw e;i.collector&&i.collector.status.failed++,a.logger.error("mapping processing failed",{event:o,error:e})})(e,t,{...a,mapping:t});if(_(r))return r}}async function S(e,t,i){return(g(t)?t:[t]).reduce(async(t,r)=>{const s=await t;if(s)return s;const n=m(r)?{key:r}:r;if(!Object.keys(n).length)return;const{condition:o,consent:a,fn:l,key:u,loop:c,map:h,set:d,validate:p,value:v}=n,f={...i,mapping:r};if(o&&!await x(o,e=>{if(e instanceof E)throw e;return f.logger.error("mapping condition failed",{event:f.event,error:e}),!1})(e,f))return;if(a&&!function(e,t={},i={}){const r={...t,...i},s={};let n=!e||0===Object.keys(e).length;return Object.keys(r).forEach(t=>{r[t]&&(s[t]=!0,e&&e[t]&&(n=!0))}),!!n&&s}(a,f.consent))return v;let b=_(v)?v:e;if(c){const[t,i]=c,r="this"===t?[e]:await k(e,t,f);b=g(r)?(await Promise.all(r.map(e=>k(e,i,f)))).filter(_):void 0}else h?b=await Object.entries(h).reduce(async(t,[i,r])=>{const s=await t,n=await k(e,r,f);return _(n)&&(s[i]=n),s},Promise.resolve({})):d?b=await Promise.all(d.map(t=>S(e,t,f))):u?b=y(e,u,v):l&&(b=await x(l,e=>{if(e instanceof E)throw e;f.logger.error("mapping fn failed",{event:f.event,error:e})})(e,f));p&&!await x(p,e=>{if(e instanceof E)throw e;return f.logger.error("mapping validate failed",{event:f.event,error:e}),!1})(b,f)&&(b=void 0);const P=w(b);return _(P)?P:w(v)},Promise.resolve(void 0))}var P="undefined"!=typeof window?window:void 0,F="undefined"!=typeof globalThis?globalThis:P;"undefined"==typeof self&&(F.self=F),"undefined"==typeof File&&(F.File=function(){});var $,I=null==F?void 0:F.navigator,R=null==F?void 0:F.document,M=null==F?void 0:F.location,O=null==F?void 0:F.fetch,C=null!=F&&F.XMLHttpRequest&&"withCredentials"in new F.XMLHttpRequest?F.XMLHttpRequest:void 0,T=null==F?void 0:F.AbortController,A=null==F?void 0:F.CompressionStream,q=null==I?void 0:I.userAgent,L=null!=P?P:{},D="1.376.4",N={DEBUG:!1,LIB_VERSION:D,LIB_NAME:"web",JS_SDK_VERSION:D};function j(e,t,i,r,s,n,o){try{var a=e[n](o),l=a.value}catch(e){return void i(e)}a.done?t(l):Promise.resolve(l).then(r,s)}function H(e){return function(){var t=this,i=arguments;return new Promise(function(r,s){var n=e.apply(t,i);function o(e){j(n,r,s,o,a,"next",e)}function a(e){j(n,r,s,o,a,"throw",e)}o(void 0)})}}function z(){return z=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var i=arguments[t];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},z.apply(null,arguments)}function U(e,t){if(null==e)return{};var i={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;i[r]=e[r]}return i}var B,V=((B={}).GZipJS="gzip-js",B.Base64="base64",B),W=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"],G="NativeGzipValidationError",X=e=>e.length>=2&&31===e[0]&&139===e[1],K=e=>!(!e||"object"!=typeof e)&&"NotReadableError"===("name"in e?String(e.name):""),Y=e=>{var t=new Error("Native gzip produced invalid output: "+e);throw t.name=G,t},J=function(){var e=H(function*(e,t){18>e.size&&Y("too-short");var i=new Uint8Array(yield e.slice(0,10).arrayBuffer());X(i)&&8===i[2]||Y("invalid-header");var r=new DataView(yield e.slice(e.size-8).arrayBuffer());r.getUint32(0,!0)!==(e=>{for(var t=(()=>{if($)return $;$=[];for(var e=0;256>e;e++){for(var t=e,i=0;8>i;i++)t=1&t?3988292384^t>>>1:t>>>1;$[e]=t>>>0}return $})(),i=4294967295,r=0;e.length>r;r++)i=t[255&(i^e[r])]^i>>>8;return(4294967295^i)>>>0})(t)&&Y("invalid-crc");var s=t.length>>>0;r.getUint32(4,!0)!==s&&Y("invalid-size")});return function(t,i){return e.apply(this,arguments)}}();function Z(){return Z=H(function*(e,t,i){void 0===t&&(t=!0);try{var r=(new TextEncoder).encode(e),s=new CompressionStream("gzip"),n=s.writable.getWriter(),o=n.write(r).then(()=>n.close()).catch((u=H(function*(e){try{yield n.abort(e)}catch(e){}throw e}),function(e){return u.apply(this,arguments)})),a=new Response(s.readable).blob(),[l]=yield Promise.all([a,o]);return yield J(l,r),l}catch(u){if(null!=i&&i.rethrow)throw u;return t&&console.error("Failed to gzip compress data",u),null}var u}),Z.apply(this,arguments)}var Q=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],ee=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var i=e.toLowerCase();return Q.concat(t).some(e=>{var t=e.toLowerCase();return-1!==i.indexOf(t)})};function te(e,t){return-1!==e.indexOf(t)}var ie=function(e){return e.trim()},re=function(e){return e.replace(/^\$/,"")},se=Object.prototype,ne=se.hasOwnProperty,oe=se.toString,ae=Array.isArray||function(e){return"[object Array]"===oe.call(e)},le=e=>"function"==typeof e,ue=e=>e===Object(e)&&!ae(e),ce=e=>{if(ue(e)){for(var t in e)if(ne.call(e,t))return!1;return!0}return!1},he=e=>void 0===e,de=e=>"[object String]"==oe.call(e),pe=e=>de(e)&&0===e.trim().length,ve=e=>null===e,ge=e=>he(e)||ve(e),_e=e=>"[object Number]"==oe.call(e)&&e==e,fe=e=>_e(e)&&e>0,me=e=>"[object Boolean]"===oe.call(e),ye=e=>te(W,e);function be(e){return null===e||"object"!=typeof e}function we(e,t){return{}.toString.call(e)==="[object "+t+"]"}function xe(e){return"undefined"!=typeof Event&&function(e,t){try{return e instanceof t}catch(e){return!1}}(e,Event)}var Ee=[!0,"true",1,"1","yes"],ke=e=>te(Ee,e),Se=[!1,"false",0,"0","no"];function Pe(e,t,i,r,s){return t>i&&(r.warn("min cannot be greater than max."),t=i),_e(e)?e>i?(r.warn(" cannot be greater than max: "+i+". Using max value instead."),i):t>e?(r.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(r.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+s),Pe(s||i,t,i,r))}var Fe,$e,Ie,Re=class{constructor(e){this.$t={},this.zt=e.zt,this.Zt=Pe(e.bucketSize,0,100,e.Gt),this.Qt=Pe(e.refillRate,0,this.Zt,e.Gt),this.Jt=Pe(e.refillInterval,0,864e5,e.Gt)}Kt(e,t){var i=Math.floor((t-e.lastAccess)/this.Jt);i>0&&(e.tokens=Math.min(e.tokens+i*this.Qt,this.Zt),e.lastAccess=e.lastAccess+i*this.Jt)}consumeRateLimit(e){var t,i=Date.now(),r=String(e),s=this.$t[r];return s?this.Kt(s,i):this.$t[r]=s={tokens:this.Zt,lastAccess:i},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(t=this.zt)||t.call(this,e)),0===s.tokens)}stop(){this.$t={}}},Me="Mobile",Oe="iOS",Ce="Android",Te="Tablet",Ae=Ce+" "+Te,qe="iPad",Le="Apple",De=Le+" Watch",Ne="Safari",je="BlackBerry",He="Samsung",ze=He+"Browser",Ue=He+" Internet",Be="Chrome",Ve=Be+" OS",We=Be+" "+Oe,Ge="Internet Explorer",Xe=Ge+" "+Me,Ke="Opera",Ye=Ke+" Mini",Je="Edge",Ze="Microsoft "+Je,Qe="Firefox",et=Qe+" "+Oe,tt="Nintendo",it="PlayStation",rt="Xbox",st=Ce+" "+Me,nt=Me+" "+Ne,ot="Windows",at=ot+" Phone",lt="Nokia",ut="Ouya",ct="Generic",ht=ct+" "+Me.toLowerCase(),dt=ct+" "+Te.toLowerCase(),pt="Konqueror",vt="Oculus Browser",gt="(\\d+(\\.\\d+)?)",_t=new RegExp("Version/"+gt),ft=new RegExp(rt,"i"),mt=new RegExp(it+" \\w+","i"),yt=new RegExp(tt+" \\w+","i"),bt=new RegExp(je+"|PlayBook|BB10","i"),wt={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},xt=function(e,t){return t=t||"",te(e," OPR/")&&te(e,"Mini")?Ye:te(e," OPR/")?Ke:bt.test(e)?je:te(e,"IE"+Me)||te(e,"WPDesktop")?Xe:te(e,"OculusBrowser")?vt:te(e,ze)?Ue:te(e,Je)||te(e,"Edg/")?Ze:te(e,"FBIOS")?"Facebook "+Me:te(e,"UCWEB")||te(e,"UCBrowser")?"UC Browser":te(e,"CriOS")?We:te(e,"CrMo")||te(e,Be)?Be:te(e,Ce)&&te(e,Ne)?st:te(e,"FxiOS")?et:te(e.toLowerCase(),pt.toLowerCase())?pt:(i=e,(r=t)&&te(r,Le)||te(s=i,Ne)&&!te(s,Be)&&!te(s,Ce)?te(e,Me)?nt:Ne:te(e,Qe)?Qe:te(e,"MSIE")||te(e,"Trident/")?Ge:te(e,"Gecko")?Qe:"");var i,r,s},Et={[Xe]:[new RegExp("rv:"+gt)],[Ze]:[new RegExp(Je+"?\\/"+gt)],[Be]:[new RegExp("("+Be+"|CrMo)\\/"+gt)],[We]:[new RegExp("CriOS\\/"+gt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+gt)],[Ne]:[_t],[nt]:[_t],[Ke]:[new RegExp("(Opera|OPR)\\/"+gt)],[Qe]:[new RegExp(Qe+"\\/"+gt)],[et]:[new RegExp("FxiOS\\/"+gt)],[pt]:[new RegExp("Konqueror[:/]?"+gt,"i")],[je]:[new RegExp(je+" "+gt),_t],[st]:[new RegExp("android\\s"+gt,"i")],[Ue]:[new RegExp(ze+"\\/"+gt)],[vt]:[new RegExp("OculusBrowser\\/"+gt)],[Ge]:[new RegExp("(rv:|MSIE )"+gt)],Mozilla:[new RegExp("rv:"+gt)]},kt=function(e,t){var i=xt(e,t),r=Et[i];if(he(r))return null;for(var s=0;r.length>s;s++){var n=e.match(r[s]);if(n)return parseFloat(n[n.length-2])}return null},St=[[new RegExp(rt+"; "+rt+" (.*?)[);]","i"),e=>[rt,e&&e[1]||""]],[new RegExp(tt,"i"),[tt,""]],[new RegExp(it,"i"),[it,""]],[bt,[je,""]],[new RegExp(ot,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[at,""];if(new RegExp(Me).test(t)&&!/IEMobile\b/.test(t))return[ot+" "+Me,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var r=wt[i[1]]||"";return/arm/i.test(t)&&(r="RT"),[ot,r]}return[ot,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[Oe,[e[3],e[4],e[5]||"0"].join(".")]:[Oe,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=he(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+Ce+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Ce+")","i"),e=>e&&e[2]?[Ce,[e[2],e[3],e[4]||"0"].join(".")]:[Ce,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Ve,""]],[/Linux|debian/i,["Linux",""]]],Pt=function(e){return yt.test(e)?tt:mt.test(e)?it:ft.test(e)?rt:new RegExp(ut,"i").test(e)?ut:new RegExp("("+at+"|WPDesktop)","i").test(e)?at:/iPad/.test(e)?qe:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?De:bt.test(e)?je:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(lt,"i").test(e)?lt:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(Me).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?Ce:Ae:new RegExp("(pda|"+Me+")","i").test(e)?ht:new RegExp(Te,"i").test(e)&&!new RegExp(Te+" pc","i").test(e)?dt:""},Ft=e=>e instanceof Error,$t={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},It=$t.info;function Rt(e){if(me(e))return{boolValue:e};if("number"==typeof e)return Number.isFinite(e)?Number.isInteger(e)?{intValue:e}:{doubleValue:e}:{stringValue:String(e)};if("string"==typeof e)return{stringValue:e};if(ae(e))return{arrayValue:{values:e.map(e=>Rt(e))}};try{return{stringValue:JSON.stringify(e)}}catch(t){return{stringValue:String(e)}}}function Mt(e){var t=[];for(var i in e){var r=e[i];ve(r)||he(r)||t.push({key:i,value:Rt(r)})}return t}function Ot(e){var t=globalThis._posthogChunkIds;if(t){var i=Object.keys(t);return Ie&&i.length===$e||($e=i.length,Ie=i.reduce((i,r)=>{Fe||(Fe={});var s=Fe[r];if(s)i[s[0]]=s[1];else for(var n=e(r),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,u=t[r];if(l&&u){i[l]=u,Fe[r]=[l,u];break}}return i},{})),Ie}}var Ct=class{constructor(e,t,i){void 0===i&&(i=[]),this.coercers=e,this.stackParser=t,this.modifiers=i}buildFromUnknown(e,t){void 0===t&&(t={});var i=t&&t.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(i,t,0).apply(e),s=this.buildParsingContext(t),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,i),$exception_level:"error"}}modifyFrames(e){var t=this;return H(function*(){for(var i of e)i.stacktrace&&i.stacktrace.frames&&ae(i.stacktrace.frames)&&(i.stacktrace.frames=yield t.applyModifiers(i.stacktrace.frames));return e})()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:null==(t=e.syntheticException)?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var i,r;return null!=e.cause&&(i=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack&&(r=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),z({},e,{cause:i,stack:r})}applyChunkIds(e,t){return e.map(e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e))}applyCoercers(e,t){for(var i of this.coercers)if(i.match(e))return i.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return H(function*(){var i=e;for(var r of t.modifiers)i=yield r(i);return i})()}convertToExceptionList(e,t){var i,r,s,n={type:e.type,value:e.value,mechanism:{type:null!==(i=t.type)&&void 0!==i?i:"generic",handled:null===(r=t.handled)||void 0===r||r,synthetic:null!==(s=e.synthetic)&&void 0!==s&&s}};e.stack&&(n.stacktrace={type:"raw",frames:e.stack});var o=[n];return null!=e.cause&&o.push(...this.convertToExceptionList(e.cause,z({},t,{handled:!0}))),o}buildParsingContext(e){var t;return{chunkIdMap:Ot(this.stackParser),skipFirstLines:null!==(t=e.skipFirstLines)&&void 0!==t?t:1}}buildCoercingContext(e,t,i){void 0===i&&(i=0);var r=(i,r)=>{if(4>=r){var s=this.buildCoercingContext(e,t,r);return this.applyCoercers(i,s)}};return z({},t,{syntheticException:0==i?t.syntheticException:void 0,mechanism:e,apply:e=>r(e,i),next:e=>r(e,i+1)})}},Tt="?";function At(e,t,i,r,s){var n={platform:e,filename:t,function:"<anonymous>"===i?Tt:i,in_app:!0};return he(r)||(n.lineno=r),he(s)||(n.colno=s),n}var qt=(e,t)=>{var i=-1!==e.indexOf("safari-extension"),r=-1!==e.indexOf("safari-web-extension");return i||r?[-1!==e.indexOf("@")?e.split("@")[0]:Tt,i?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},Lt=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Dt=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Nt=/\((\S*)(?::(\d+))(?::(\d+))\)/,jt=(e,t)=>{var i=Lt.exec(e);if(i){var[,r,s,n]=i;return At(t,r,Tt,+s,+n)}var o=Dt.exec(e);if(o){if(o[2]&&0===o[2].indexOf("eval")){var a=Nt.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,u]=qt(o[1]||Tt,o[2]);return At(t,u,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},Ht=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,zt=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Ut=(e,t)=>{var i=Ht.exec(e);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var r=zt.exec(i[3]);r&&(i[1]=i[1]||"eval",i[3]=r[1],i[4]=r[2],i[5]="")}var s=i[3],n=i[1]||Tt;return[n,s]=qt(n,s),At(t,s,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},Bt=/\(error: (.*)\)/,Vt=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var i=de(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:i?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}isDOMException(e){return we(e,"DOMException")}isDOMError(e){return we(e,"DOMError")}},Wt=class{match(e){return e instanceof Error}coerce(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var i=e.message;return String(i.error&&"string"==typeof i.error.message?i.error.message:i)}getStack(e){return e.stacktrace||e.stack||void 0}},Gt=class{constructor(){}match(e){return we(e,"ErrorEvent")&&null!=e.error}coerce(e,t){var i;return t.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}},Xt=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Kt=class{match(e){return"string"==typeof e}coerce(e,t){var i,[r,s]=this.getInfos(e);return{type:null!=r?r:"Error",value:null!=s?s:e,stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}getInfos(e){var t="Error",i=e,r=e.match(Xt);return r&&(t=r[1],i=r[2]),[t,i]}},Yt=["fatal","error","warning","log","info","debug"];function Jt(e,t){void 0===t&&(t=40);var i=Object.keys(e);if(i.sort(),!i.length)return"[object has no keys]";for(var r=i.length;r>0;r--){var s=i.slice(0,r).join(", ");if(t>=s.length)return r===i.length?s:s.length>t?s.slice(0,t)+"...":s}return""}var Zt=class{match(e){return"object"==typeof e&&null!==e}coerce(e,t){var i,r=this.getErrorPropertyFromObject(e);return r?t.apply(r):{type:this.getType(e),value:this.getValue(e),stack:null==(i=t.syntheticException)?void 0:i.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return xe(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&"string"==typeof e.name){var t="'"+e.name+"' captured as exception";return"message"in e&&"string"==typeof e.message&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&"string"==typeof e.message)return e.message;var i=this.getObjectClassName(e);return(i&&"Object"!==i?"'"+i+"'":"Object")+" captured as exception with keys: "+Jt(e)}isSeverityLevel(e){return de(e)&&!pe(e)&&Yt.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if({}.hasOwnProperty.call(e,t)){var i=e[t];if(Ft(i))return i}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}},Qt=class{match(e){return xe(e)}coerce(e,t){var i,r=e.constructor.name;return{type:r,value:r+" captured as exception with keys: "+Jt(e),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}},ei=class{match(e){return be(e)}coerce(e,t){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}},ti=class{match(e){return we(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!xe(e))return!1;try{var t=e.detail;return null!=t&&"object"==typeof t&&"reason"in t}catch(e){return!1}}coerce(e,t){var i,r=this.getUnhandledRejectionReason(e);return be(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}:t.apply(r)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&null!=e.detail&&"object"==typeof e.detail&&"reason"in e.detail)return e.detail.reason}catch(e){}return e}},ii="$message",ri="$timestamp",si=new Set([ii,ri]),ni={enabled:!0,max_bytes:32768};function oi(e){var t;return e?{enabled:null!==(t=e.enabled)&&void 0!==t?t:ni.enabled,max_bytes:li(e.max_bytes,ni.max_bytes)}:z({},ni)}var ai=class{constructor(e){this.Yt=[],this.Xt=0,this.qt=oi(e)}setConfig(e){this.qt=oi(e),this.er()}add(e){var t=function(e){var t=function(e){var t=new WeakSet;try{return JSON.stringify(e,(e,i)=>{if("bigint"==typeof i)return i.toString();if("function"!=typeof i&&"symbol"!=typeof i){if(i instanceof Date)return i.toISOString();if(i instanceof Error)return{name:i.name,message:i.message,stack:i.stack};if(i&&"object"==typeof i){if(t.has(i))return"[Circular]";t.add(i)}return i}})}catch(e){return}}(e);if(t)try{var i=JSON.parse(t);if(!ue(i))return;var r=i,s=r[ii],n=r[ri];if(!de(s)||0===s.trim().length)return;if(!de(n)&&!_e(n))return;return{step:r,json:t}}catch(e){return}}(e);if(t){var i=function(e){if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e).length;for(var t=encodeURIComponent(e),i=0,r=0;t.length>r;r++)"%"===t[r]?(i+=1,r+=2):i+=1;return i}(t.json);i>this.qt.max_bytes||(this.Yt.push({step:t.step,bytes:i}),this.Xt+=i,this.er())}}getAttachable(){return this.Yt.map(e=>e.step)}clear(){this.Yt=[],this.Xt=0}size(){return this.Yt.length}er(){for(;this.Xt>this.qt.max_bytes&&this.Yt.length>0;){var e=this.Yt.shift();e&&(this.Xt-=e.bytes)}}};function li(e,t){if(!_e(e)||e===1/0||e===-1/0)return t;var i=Math.floor(e);return 0>i?t:i}var ui=function(e,t){var{debugEnabled:i}=void 0===t?{}:t,r={k(t){if(P&&(N.DEBUG||L.POSTHOG_DEBUG||i)&&!he(P.console)&&P.console){for(var r=("__rrweb_original__"in P.console[t]?P.console[t].__rrweb_original__:P.console[t]),s=arguments.length,n=new Array(s>1?s-1:0),o=1;s>o;o++)n[o-1]=arguments[o];r(e,...n)}},debug(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];r.k("debug",...t)},info(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];r.k("log",...t)},warn(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];r.k("warn",...t)},error(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];r.k("error",...t)},critical(){for(var t=arguments.length,i=new Array(t),r=0;t>r;r++)i[r]=arguments[r];console.error(e,...i)},uninitializedWarning(e){r.error("You must initialize PostHog before calling "+e)},createLogger:(t,i)=>ui(e+" "+t,i)};return r},ci=ui("[PostHog.js]"),hi=ci.createLogger,di=hi("[ExternalScriptsLoader]"),pi=(e,t,i)=>{if(e.config.disable_external_dependency_loading)return di.warn(t+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var r=null==R?void 0:R.querySelectorAll("script");if(r)for(var s,n=function(){if(r[o].src===t){var e=r[o];return e.__posthog_loading_callback_fired?{v:i()}:(e.addEventListener("load",t=>{e.__posthog_loading_callback_fired=!0,i(void 0,t)}),e.onerror=e=>i(e),{v:void 0})}},o=0;r.length>o;o++)if(s=n())return s.v;var a=()=>{if(!R)return i("document not found");var r=R.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=t,r.onload=e=>{r.__posthog_loading_callback_fired=!0,i(void 0,e)},r.onerror=e=>i(e),e.config.prepare_external_dependency_script&&(r=e.config.prepare_external_dependency_script(r)),!r)return i("prepare_external_dependency_script returned null");if("head"===e.config.external_scripts_inject_target)R.head.appendChild(r);else{var s,n=R.querySelectorAll("body > script");n.length>0?null==(s=n[0].parentNode)||s.insertBefore(r,n[0]):R.body.appendChild(r)}};null!=R&&R.body?a():null==R||R.addEventListener("DOMContentLoaded",a)};L.__PosthogExtensions__=L.__PosthogExtensions__||{},L.__PosthogExtensions__.loadExternalDependency=(e,t,i)=>{if("remote-config"!==t){var r;if(e.config.__preview_external_dependency_versioned_paths)r=e.requestRouter.endpointFor("assets","/static/"+e.version+"/"+t+".js");else{var s="/static/"+t+".js?v="+e.version;if("toolbar"===t){var n=3e5;s=s+"&t="+Math.floor(Date.now()/n)*n}r=e.requestRouter.endpointFor("assets",s)}pi(e,r,i)}else{var o=e.requestRouter.endpointFor("assets","/array/"+e.config.token+"/config.js");pi(e,o,i)}},L.__PosthogExtensions__.loadSiteApp=(e,t,i)=>{var r=e.requestRouter.endpointFor("api",t);pi(e,r,i)};var vi="$people_distinct_id",gi="$device_id",_i="__alias",fi="__timers",mi="$autocapture_disabled_server_side",yi="$heatmaps_enabled_server_side",bi="$exception_capture_enabled_server_side",wi="$error_tracking_suppression_rules",xi="$error_tracking_capture_extension_exceptions",Ei="$web_vitals_enabled_server_side",ki="$dead_clicks_enabled_server_side",Si="$product_tours_enabled_server_side",Pi="$web_vitals_allowed_metrics",Fi="$session_recording_remote_config",$i="$replay_override_sampling",Ii="$replay_override_linked_flag",Ri="$replay_override_url_trigger",Mi="$replay_override_event_trigger",Oi="$sesid",Ci="$session_is_sampled",Ti="$enabled_feature_flags",Ai="$active_feature_flags",qi="$early_access_features",Li="$feature_flag_details",Di="$feature_flag_payloads",Ni="$feature_flag_request_id",ji="$override_feature_flags",Hi="$override_feature_flag_payloads",zi="$stored_person_properties",Ui="$stored_group_properties",Bi="$surveys",Vi="$surveys_activated",Wi="ph_product_tours",Gi="$flag_call_reported",Xi="$flag_call_reported_session_id",Ki="$feature_flag_errors",Yi="$feature_flag_evaluated_at",Ji="$user_state",Zi="$client_session_props",Qi="$capture_rate_limit",er="$initial_campaign_params",tr="$initial_referrer_info",ir="$initial_person_info",rr="$epp",sr="__POSTHOG_TOOLBAR__",nr="$posthog_cookieless",or="$sdk_debug_extensions_init_method",ar="$sdk_debug_extensions_init_time_ms",lr="$sdk_debug_recording_script_not_loaded",ur="PostHog loadExternalDependency extension not found.",cr="on_reject",hr="always",dr="anonymous",pr="identified",vr="identified_only",gr="visibilitychange",_r="beforeunload",fr="$pageview",mr="$pageleave",yr="$identify",br="$groupidentify";function wr(e,t){ae(e)&&e.forEach(t)}function xr(e,t){if(!ge(e))if(ae(e))e.forEach(t);else if((e=>e instanceof FormData)(e))e.forEach((e,i)=>t(e,i));else for(var i in e)ne.call(e,i)&&t(e[i],i)}var Er=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;t>r;r++)i[r-1]=arguments[r];for(var s of i)for(var n in s)void 0!==s[n]&&(e[n]=s[n]);return e};function kr(e){for(var t=Object.keys(e),i=t.length,r=new Array(i);i--;)r[i]=[t[i],e[t[i]]];return r}var Sr=function(e){try{return e()}catch(e){return}},Pr=function(e){return function(){try{for(var t=arguments.length,i=new Array(t),r=0;t>r;r++)i[r]=arguments[r];return e.apply(this,i)}catch(e){ci.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),ci.critical(e)}}},Fr=function(e){var t={};return xr(e,function(e,i){(de(e)&&e.length>0||_e(e))&&(t[i]=e)}),t},$r=["herokuapp.com","vercel.app","netlify.app"];function Ir(e){var t=null==e?void 0:e.hostname;if(!de(t))return!1;var i=t.split(".").slice(-2).join(".");for(var r of $r)if(i===r)return!1;return!0}function Rr(e,t,i,r){var{capture:s=!1,passive:n=!0}=null!=r?r:{};null==e||e.addEventListener(t,i,{capture:s,passive:n})}function Mr(e){return"ph_toolbar_internal"===e.name}Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return _e(e)&&isFinite(e)&&Math.floor(e)===e});var Or,Cr=class e{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,i,r,s){if(!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(r)||!Number.isInteger(s)||0>t||0>i||0>r||0>s||t>0xffffffffffff||i>4095||r>1073741823||s>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=t/Math.pow(2,40),n[1]=t/Math.pow(2,32),n[2]=t/Math.pow(2,24),n[3]=t/Math.pow(2,16),n[4]=t/Math.pow(2,8),n[5]=t,n[6]=112|i>>>8,n[7]=i,n[8]=128|r>>>24,n[9]=r>>>16,n[10]=r>>>8,n[11]=r,n[12]=s>>>24,n[13]=s>>>16,n[14]=s>>>8,n[15]=s,new e(n)}toString(){for(var e="",t=0;this.bytes.length>t;t++)e=e+(this.bytes[t]>>>4).toString(16)+(15&this.bytes[t]).toString(16),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new e(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var t=0;16>t;t++){var i=this.bytes[t]-e.bytes[t];if(0!==i)return Math.sign(i)}return 0}},Tr=class{constructor(){this.S=0,this.C=0,this.I=new qr}generate(){var e=this.generateOrAbort();if(he(e)){this.S=0;var t=this.generateOrAbort();if(he(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.S)this.S=e,this.T();else{if(this.S>=e+1e4)return;this.C++,this.C>4398046511103&&(this.S++,this.T())}return Cr.fromFieldsV7(this.S,Math.trunc(this.C/Math.pow(2,30)),this.C&Math.pow(2,30)-1,this.I.nextUint32())}T(){this.C=1024*this.I.nextUint32()+(1023&this.I.nextUint32())}},Ar=e=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};P&&!he(P.crypto)&&crypto.getRandomValues&&(Ar=e=>crypto.getRandomValues(e));var qr=class{constructor(){this.M=new Uint32Array(8),this.O=1/0}nextUint32(){return this.M.length>this.O||(Ar(this.M),this.O=0),this.M[this.O++]}},Lr=()=>Dr().toString(),Dr=()=>(Or||(Or=new Tr)).generate(),Nr="",jr=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,Hr={R:()=>!!R,D(e){ci.error("cookieStore error: "+e)},A(e){if(R){try{for(var t=e+"=",i=R.cookie.split(";").filter(e=>e.length),r=0;i.length>r;r++){for(var s=i[r];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(t))return decodeURIComponent(s.substring(t.length,s.length))}}catch(e){}return null}},F(e){var t;try{t=JSON.parse(Hr.A(e))||{}}catch(e){}return t},N(e,t,i,r,s){if(R)try{var n="",o="",a=function(e,t){if(t){var i=function(e,t){if(void 0===t&&(t=R),Nr)return Nr;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var i=e.split("."),r=Math.min(i.length,8),s="dmn_chk_"+Lr();!Nr&&r--;){var n=i.slice(r).join("."),o=s+"=1;domain=."+n+";path=/";t.cookie=o+";max-age=3",t.cookie.includes(s)&&(t.cookie=o+";max-age=0",Nr=n)}return Nr}(e);if(!i){var r=(s=e.match(jr))?s[0]:"";r!==i&&ci.info("Warning: cookie subdomain discovery mismatch",r,i),i=r}return i?"; domain=."+i:""}var s;return""}(R.location.hostname,r);if(i){var l=new Date;l.setTime(l.getTime()+864e5*i),n="; expires="+l.toUTCString()}s&&(o="; secure");var u=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+a+o;return u.length>3686.4&&ci.warn("cookieStore warning: large cookie, len="+u.length),R.cookie=u,u}catch(e){return}},q(e,t){if(null!=R&&R.cookie)try{Hr.N(e,"",-1,t)}catch(e){return}}},zr=null,Ur={R(){if(!ve(zr))return zr;var e=!0;if(he(P))e=!1;else try{var t="__mplssupport__";Ur.N(t,"xyz"),'"xyz"'!==Ur.A(t)&&(e=!1),Ur.q(t)}catch(t){e=!1}return e||ci.error("localStorage unsupported; falling back to cookie store"),zr=e,e},D(e){ci.error("localStorage error: "+e)},A(e){try{return null==P?void 0:P.localStorage.getItem(e)}catch(e){Ur.D(e)}return null},F(e){try{return JSON.parse(Ur.A(e))||{}}catch(e){}return null},N(e,t){try{null==P||P.localStorage.setItem(e,JSON.stringify(t))}catch(e){Ur.D(e)}},q(e){try{null==P||P.localStorage.removeItem(e)}catch(e){Ur.D(e)}}},Br=[gi,"distinct_id",Oi,Ci,rr,ir,Ji],Vr={},Wr={R:()=>!0,D(e){ci.error("memoryStorage error: "+e)},A:e=>Vr[e]||null,F:e=>Vr[e]||null,N(e,t){Vr[e]=t},q(e){delete Vr[e]}},Gr=null,Xr={R(){if(!ve(Gr))return Gr;if(Gr=!0,he(P))Gr=!1;else try{var e="__support__";Xr.N(e,"xyz"),'"xyz"'!==Xr.A(e)&&(Gr=!1),Xr.q(e)}catch(e){Gr=!1}return Gr},D(e){ci.error("sessionStorage error: ",e)},A(e){try{return null==P?void 0:P.sessionStorage.getItem(e)}catch(e){Xr.D(e)}return null},F(e){try{return JSON.parse(Xr.A(e))||null}catch(e){}return null},N(e,t){try{null==P||P.sessionStorage.setItem(e,JSON.stringify(t))}catch(e){Xr.D(e)}},q(e){try{null==P||P.sessionStorage.removeItem(e)}catch(e){Xr.D(e)}}},Kr=class{constructor(e){this._instance=e}get qt(){return this._instance.config}get consent(){return this.rr()?0:this.ir}isOptedOut(){return this.qt.cookieless_mode===hr||this.isRejected()||-1===this.consent&&this.qt.cookieless_mode===cr}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.qt.opt_out_capturing_by_default}optInOut(e){this.nr.N(this.sr,e?1:0,this.qt.cookie_expiration,this.qt.cross_subdomain_cookie,this.qt.secure_cookie)}reset(){this.nr.q(this.sr,this.qt.cross_subdomain_cookie)}get sr(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:i}=this._instance.config;return i||(t?t+e:"__ph_opt_in_out_"+e)}get ir(){var e=this.nr.A(this.sr);return ke(e)?1:te(Se,e)?0:-1}get nr(){var e=this.qt.opt_out_capturing_persistence_type,t="localStorage"===e?Ur:Hr;if(!this.ar||this.ar!==t){this.ar=t;var i="localStorage"===e?Hr:Ur;i.A(this.sr)&&(this.ar.A(this.sr)||this.optInOut(ke(i.A(this.sr))),i.q(this.sr,this.qt.cross_subdomain_cookie))}return this.ar}rr(){return!!this.qt.respect_dnt&&[null==I?void 0:I.doNotTrack,null==I?void 0:I.msDoNotTrack,L.doNotTrack].some(e=>ke(e))}},Yr=hi("[Dead Clicks]"),Jr=()=>!0,Zr=e=>{var t,i=!(null==(t=e.instance.persistence)||!t.get_property(ki)),r=e.instance.config.capture_dead_clicks;return me(r)?r:!!ue(r)||i},Qr=class{get lazyLoadedDeadClicksAutocapture(){return this.ur}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(e){"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[ki]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.lr(()=>{this.hr()}):this.stop()}lr(e){var t,i;null!=(t=L.__PosthogExtensions__)&&t.initDeadClicksAutocapture&&e(),null==(i=L.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",t=>{t?Yr.error("failed to load script",t):e()})}hr(){var e;if(R){if(!this.ur&&null!=(e=L.__PosthogExtensions__)&&e.initDeadClicksAutocapture){var t=ue(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.ur=L.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.ur.start(R),Yr.info("starting...")}}else Yr.error("`document` not found. Cannot start.")}stop(){this.ur&&(this.ur.stop(),this.ur=void 0,Yr.info("stopping..."))}},es=hi("[SegmentIntegration]"),ts="posthog-js";function is(e,t){var{organization:i,projectId:r,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:o=!0}=void 0===t?{}:t;return t=>{var a,l,u,c,h;if("*"!==n&&!n.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var d=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=d,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var p,v=(null==(a=t.exception)?void 0:a.values)||[],g=v.map(e=>z({},e,{stacktrace:e.stacktrace?z({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map(e=>z({},e,{platform:"web:javascript"}))}):void 0})),_={$exception_message:(null==(l=v[0])?void 0:l.value)||t.message,$exception_type:null==(u=v[0])?void 0:u.type,$exception_level:t.level,$exception_list:g,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(c=v[0])?void 0:c.value)||t.message,$sentry_exception_type:null==(h=v[0])?void 0:h.type,$sentry_tags:t.tags};return i&&r&&(_.$sentry_url=(s||"https://sentry.io/organizations/")+i+"/issues/?project="+r+"&query="+t.event_id),o&&(null==(p=e.exceptions)||p.sendExceptionEvent(_)),t}}var rs=class{constructor(e,t,i,r,s,n){this.name=ts,this.setupOnce=function(o){o(is(e,{organization:t,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}},ss=class{constructor(e){this.cr=(e,t,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength)&&(ci.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:i}),this.dr=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.vr()}vr(){var e;this.pr=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(this.cr)}destroy(){var e;null==(e=this.pr)||e.call(this),this.pr=void 0}doPageView(e,t){var i,r=this.gr(e,t);return this.dr={pathname:null!==(i=null==P?void 0:P.location.pathname)&&void 0!==i?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),r}doPageLeave(e){var t;return this.gr(e,null==(t=this.dr)?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null==(e=this.dr)?void 0:e.pageViewId}}gr(e,t){var i=this.dr;if(!i)return{$pageview_id:t};var r={$pageview_id:t,$prev_pageview_id:i.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:u,maxContentY:c}=s;if(!(he(n)||he(o)||he(a)||he(l)||he(u)||he(c))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),c=Math.ceil(c);var h=n>1?Pe(o/n,0,1,ci):1,d=n>1?Pe(a/n,0,1,ci):1,p=l>1?Pe(u/l,0,1,ci):1,v=l>1?Pe(c/l,0,1,ci):1;r=Er(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:h,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:d,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:c,$prev_pageview_max_content_percentage:v})}}return i.pathname&&(r.$prev_pageview_pathname=i.pathname),i.timestamp&&(r.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),r}},ns={[vi]:{exposure:"hidden"},[_i]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[fi]:{exposure:"hidden"},[mi]:{exposure:"event"},[yi]:{exposure:"hidden"},[bi]:{exposure:"event"},[wi]:{exposure:"hidden"},[xi]:{exposure:"event"},[Ei]:{exposure:"event"},[ki]:{exposure:"event"},[Si]:{exposure:"hidden"},[Pi]:{exposure:"event"},[Fi]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[Oi]:{exposure:"hidden"},[Ci]:{exposure:"event"},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},[Ti]:{exposure:"derived",shouldSkipFromEventProperties:(e,t)=>t(),transformToEventProperties(e){if(!ue(e))return{};for(var t={},i=Object.keys(e),r=0;i.length>r;r++)t["$feature/"+i[r]]=e[i[r]];return t}},[Ai]:{exposure:"event"},[qi]:{exposure:"hidden"},[Li]:{exposure:"hidden"},[Di]:{exposure:"event"},[Ni]:{exposure:"event"},[ji]:{exposure:"event"},[Hi]:{exposure:"hidden"},[zi]:{exposure:"hidden"},[Ui]:{exposure:"hidden"},[Bi]:{exposure:"hidden"},[Vi]:{exposure:"event"},[Wi]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[Gi]:{exposure:"hidden"},[Xi]:{exposure:"hidden"},[Ki]:{exposure:"hidden"},[Yi]:{exposure:"hidden"},[Ji]:{exposure:"hidden"},[Zi]:{exposure:"hidden"},[Qi]:{exposure:"hidden"},[er]:{exposure:"hidden"},[tr]:{exposure:"hidden"},[ir]:{exposure:"hidden"},[rr]:{exposure:"hidden"},[$i]:{exposure:"event"},[Ii]:{exposure:"event"},[Ri]:{exposure:"event"},[Mi]:{exposure:"event"},[or]:{exposure:"event"},[ar]:{exposure:"event"},[lr]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},os=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],as=e=>{var t=null==R?void 0:R.createElement("a");return he(t)?null:(t.href=e,t)},ls=function(e,t){for(var i,r=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===t){i=n;break}}if(!ae(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(e){ci.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},us=function(e,t,i){if(!e||!t||!t.length)return e;for(var r=e.split("#"),s=r[1],n=(r[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),u=[],c=0;l.length>c;c++){var h=l[c].split("=");ae(h)&&(t.includes(h[0])?u.push(h[0]+"="+i):u.push(l[c]))}var d=a;return null!=o&&(d+="?"+u.join("&")),null!=s&&(d+="#"+s),d},cs=function(e,t){var i=e.match(new RegExp(t+"=([^&]*)"));return i?i[1]:null},hs="https?://(.*)",ds=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],ps=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...ds],vs="<masked>",gs=["li_fat_id"];function _s(e,t,i){if(!R)return{};var r,s=t?[...ds,...i||[]]:[],n=fs(us(R.URL,s,vs),e),o=(r={},xr(gs,function(e){var t=Hr.A(e);r[e]=t||null}),r);return Er(o,n)}function fs(e,t){var i=ps.concat(t||[]),r={};return xr(i,function(t){var i=ls(e,t);r[t]=i||null}),r}function ms(e){var t,i=(t=e)?0===t.search(hs+"google.([^/?]*)")?"google":0===t.search(hs+"bing.com")?"bing":0===t.search(hs+"yahoo.com")?"yahoo":0===t.search(hs+"duckduckgo.com")?"duckduckgo":null:null,r="yahoo"!=i?"q":"p",s={};if(!ve(i)){s.$search_engine=i;var n=R?ls(R.referrer,r):"";n.length&&(s.ph_keyword=n)}return s}function ys(){return navigator.language||navigator.userLanguage}var bs="$direct";function ws(){return(null==R?void 0:R.referrer)||bs}function xs(e,t){var i=e?[...ds,...t||[]]:[],r=null==M?void 0:M.href.substring(0,1e3);return{r:ws().substring(0,1e3),u:r?us(r,i,vs):void 0}}function Es(e){var t,{r:i,u:r}=e,s={$referrer:i,$referring_domain:null==i?void 0:i==bs?bs:null==(t=as(i))?void 0:t.host};if(r){s.$current_url=r;var n=as(r);s.$host=null==n?void 0:n.host,s.$pathname=null==n?void 0:n.pathname;var o=fs(r);Er(s,o)}if(i){var a=ms(i);Er(s,a)}return s}function ks(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function Ss(){try{return(new Date).getTimezoneOffset()}catch(e){return}}var Ps,Fs,$s,Is,Rs=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Ms=class{constructor(e,t){var i,r;this.qt=e,this.props={},this.mr=!1,this.yr=(r="",(i=e).token&&(r=i.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),i.persistence_name?"ph_"+i.persistence_name:"ph_"+r+"_posthog"),this.nr=this.br(e),this.load(),e.debug&&ci.info("Persistence loaded",e.persistence,z({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this._r}br(e){-1===Rs.indexOf(e.persistence.toLowerCase())&&(ci.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=function(e){void 0===e&&(e=[]);var t=[...Br,...e];return z({},Ur,{F(e){try{var t={};try{t=Hr.F(e)||{}}catch(e){}var i=Er(t,JSON.parse(Ur.A(e)||"{}"));return Ur.N(e,i),i}catch(e){}return null},N(e,i,r,s,n,o){try{Ur.N(e,i,void 0,void 0,o);var a={};t.forEach(e=>{i[e]&&(a[e]=i[e])}),Object.keys(a).length&&Hr.N(e,a,r,s,n,o)}catch(e){Ur.D(e)}},q(e,t){try{null==P||P.localStorage.removeItem(e),Hr.q(e,t)}catch(e){Ur.D(e)}}})}(e.cookie_persisted_properties||[]),i=e.persistence.toLowerCase();return"localstorage"===i&&Ur.R()?Ur:"localstorage+cookie"===i&&t.R()?t:"sessionstorage"===i&&Xr.R()?Xr:"memory"===i?Wr:"cookie"===i?Hr:t.R()?t:Hr}wr(e){var t=null!=e?e:this.qt.feature_flag_cache_ttl_ms;if(!t||0>=t)return!1;var i=this.props[Yi];return!i||"number"!=typeof i||Date.now()-i>t}properties(){var e={};return xr(this.props,(t,i)=>{var r=(e=>{var t=ns[e];if(t)return t;for(var[i,r]of os)if(0===e.indexOf(i))return r})(i);if("derived"===(null==r?void 0:r.exposure)){if(null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(t,i===Ti?()=>this.wr():()=>!1))return;r.transformToEventProperties&&Er(e,r.transformToEventProperties(t))}else r&&"event"!==r.exposure||(e[i]=t)}),e}load(){if(!this._r){var e=this.nr.F(this.yr);e&&(this.props=Er({},e))}}save(){this._r||this.nr.N(this.yr,this.props,this.Sr,this.kr,this.Cr,this.qt.debug)}remove(){this.nr.q(this.yr,!1),this.nr.q(this.yr,!0)}clear(){this.remove(),this.props={}}register_once(e,t,i){if(ue(e)){he(t)&&(t="None"),this.Sr=he(i)?this.Ir:i;var r=!1;if(xr(e,(e,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==t||(this.Tr(i,e),r=!0)}),r)return this.save(),!0}return!1}register(e,t){if(ue(e)){this.Sr=he(t)?this.Ir:t;var i=!1;if(xr(e,(t,r)=>{e.hasOwnProperty(r)&&this.props[r]!==t&&(this.Tr(r,t),i=!0)}),i)return this.save(),!0}return!1}unregister(e){e in this.props&&(this.Er(e),this.save())}update_campaign_params(){if(!this.mr){var e=_s(this.qt.custom_campaign_params,this.qt.mask_personal_data_properties,this.qt.custom_personal_data_properties);ce(Fr(e))||this.register(e),this.mr=!0}}update_search_keyword(){var e;this.register((e=null==R?void 0:R.referrer)?ms(e):{})}update_referrer_info(){var e;this.register_once({$referrer:ws(),$referring_domain:null!=R&&R.referrer&&(null==(e=as(R.referrer))?void 0:e.host)||bs},void 0)}set_initial_person_info(){this.props[er]||this.props[tr]||this.register_once({[ir]:xs(this.qt.mask_personal_data_properties,this.qt.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};xr([tr,er],t=>{var i=this.props[t];i&&xr(i,function(t,i){e["$initial_"+re(i)]=t})});var t,i,r=this.props[ir];if(r){var s=(t=Es(r),i={},xr(t,function(e,t){i["$initial_"+re(t)]=e}),i);Er(e,s)}return e}safe_merge(e){return xr(this.props,function(t,i){i in e||(e[i]=t)}),e}update_config(e,t,i){if(this.Ir=this.Sr=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!i),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence||!((e,t)=>{if(e.length!==t.length)return!1;var i=[...e].sort(),r=[...t].sort();return i.every((e,t)=>e===r[t])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[])){var r=this.br(e),s=this.props;this.clear(),this.nr=r,this.props=s,this.save()}}set_disabled(e){this._r=e,this._r?this.remove():this.save()}set_cross_subdomain(e){e!==this.kr&&(this.kr=e,this.remove(),this.save())}set_secure(e){e!==this.Cr&&(this.Cr=e,this.remove(),this.save())}set_event_timer(e,t){var i=this.props[fi]||{};i[e]=t,this.Tr(fi,i),this.save()}remove_event_timer(e){var t=this.props[fi]||{},i=t[e];return he(i)||(delete t[e],this.Tr(fi,t),this.save()),i}get_property(e){return this.props[e]}set_property(e,t){this.Tr(e,t),this.save()}Tr(e,t){this.props[e]=t}Er(e){delete this.props[e]}},Os="events",Cs="cancelEvents",Ts="popover",As="api",qs="widget",Ls="survey shown",Ds="survey dismissed",Ns="survey sent",js="$survey_id",Hs="$survey_iteration",zs="$survey_last_seen_date",Us="popover",Bs="inline",Vs="product tour shown",Ws="$product_tour_last_seen_date",Gs="$product_tour_type",Xs=hi("[RateLimiter]"),Ks=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach(e=>{Xs.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4})}catch(e){return void Xs.warn('could not rate limit - continuing. Error: "'+(null==e?void 0:e.message)+'"',{text:t})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return(null==(e=this.instance.config.rate_limiting)?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max((null==(e=this.instance.config.rate_limiting)?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var t,i,r;void 0===e&&(e=!1);var{captureEventsBurstLimit:s,captureEventsPerSecond:n}=this,o=(new Date).getTime(),a=null!==(t=null==(i=this.instance.persistence)?void 0:i.get_property(Qi))&&void 0!==t?t:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>s&&(a.tokens=s);var l=1>a.tokens;return l||e||(a.tokens=Math.max(0,a.tokens-1)),!l||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+n+" events per second and "+s+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,null==(r=this.instance.persistence)||r.set_property(Qi,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}},Ys=hi("[RemoteConfig]"),Js=class{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=L._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}Mr(e){var t,i;null!=(t=L.__PosthogExtensions__)&&t.loadExternalDependency?null==(i=L.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):e()}Pr(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(t){e(t.json)}})}load(){try{if(this.remoteConfig)return Ys.info("Using preloaded remote config",this.remoteConfig),this.Rr(this.remoteConfig),void this.Or();if(this._instance.Lr())return void Ys.warn("Remote config is disabled. Falling back to local config.");this.Mr(e=>{if(!e)return Ys.info("No config found after loading remote JS config. Falling back to JSON."),void this.Pr(e=>{this.Rr(e),this.Or()});this.Rr(e),this.Or()})}catch(e){Ys.error("Error loading remote config",e)}}stop(){this.Fr&&(clearInterval(this.Fr),this.Fr=void 0)}refresh(){!this._instance.Lr()&&R&&"hidden"!==R.visibilityState&&this._instance.reloadFeatureFlags()}Or(){var e;if(!this.Fr){var t=null!==(e=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==e?e:3e5;0!==t&&(this.Fr=setInterval(()=>{this.refresh()},t))}}Rr(e){var t;e||Ys.error("Failed to fetch remote config from PostHog."),this._instance.Rr(null!=e?e:{}),!1!==(null==e?void 0:e.hasFeatureFlags)&&(this._instance.config.advanced_disable_feature_flags_on_first_load||null==(t=this._instance.featureFlags)||t.ensureFlagsLoaded())}},Zs="gzip-js",Qs="base64",en=Uint8Array,tn=Uint16Array,rn=Uint32Array,sn=new en([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),nn=new en([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),on=new en([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),an=function(e,t){for(var i=new tn(31),r=0;31>r;++r)i[r]=t+=1<<e[r-1];var s=new rn(i[30]);for(r=1;30>r;++r)for(var n=i[r];i[r+1]>n;++n)s[n]=n-i[r]<<5|r;return[i,s]},ln=an(sn,2),un=ln[1];for(ln[0][28]=258,un[258]=28,Fs=an(nn,0)[1],$s=new tn(32768),Is=0;32768>Is;++Is)Ps=(43690&Is)>>>1|(21845&Is)<<1,$s[Is]=((65280&(Ps=(61680&(Ps=(52428&Ps)>>>2|(13107&Ps)<<2))>>>4|(3855&Ps)<<4))>>>8|(255&Ps)<<8)>>>1;var cn=function(e,t,i){for(var r=e.length,s=0,n=new tn(t);r>s;++s)++n[e[s]-1];var o,a=new tn(t);for(s=0;t>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new tn(1<<t);var l=15-t;for(s=0;r>s;++s)if(e[s])for(var u=s<<4|e[s],c=t-e[s],h=a[e[s]-1]++<<c,d=h|(1<<c)-1;d>=h;++h)o[$s[h]>>>l]=u}else for(o=new tn(r),s=0;r>s;++s)o[s]=$s[a[e[s]-1]++]>>>15-e[s];return o},hn=new en(288);for(Is=0;144>Is;++Is)hn[Is]=8;for(Is=144;256>Is;++Is)hn[Is]=9;for(Is=256;280>Is;++Is)hn[Is]=7;for(Is=280;288>Is;++Is)hn[Is]=8;var dn=new en(32);for(Is=0;32>Is;++Is)dn[Is]=5;var pn=cn(hn,9,0),vn=cn(dn,5,0),gn=function(e){return(e/8|0)+(7&e&&1)},_n=function(e,t,i){(null==i||i>e.length)&&(i=e.length);var r=new(e instanceof tn?tn:e instanceof rn?rn:en)(i-t);return r.set(e.subarray(t,i)),r},fn=function(e,t,i){var r=t/8|0;e[r]|=i<<=7&t,e[r+1]|=i>>>8},mn=function(e,t,i){var r=t/8|0;e[r]|=i<<=7&t,e[r+1]|=i>>>8,e[r+2]|=i>>>16},yn=function(e,t){for(var i=[],r=0;e.length>r;++r)e[r]&&i.push({s:r,f:e[r]});var s=i.length,n=i.slice();if(!s)return[new en(0),0];if(1==s){var o=new en(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort(function(e,t){return e.f-t.f}),i.push({s:-1,f:25001});var a=i[0],l=i[1],u=0,c=1,h=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=s-1;)a=i[i[h].f>i[u].f?u++:h++],l=i[u!=c&&i[h].f>i[u].f?u++:h++],i[c++]={s:-1,f:a.f+l.f,l:a,r:l};var d=n[0].s;for(r=1;s>r;++r)n[r].s>d&&(d=n[r].s);var p=new tn(d+1),v=bn(i[c-1],p,0);if(v>t){r=0;var g=0,_=v-t,f=1<<_;for(n.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});s>r;++r){var m=n[r].s;if(t>=p[m])break;g+=f-(1<<v-p[m]),p[m]=t}for(g>>>=_;g>0;){var y=n[r].s;t>p[y]?g-=1<<t-p[y]++-1:++r}for(;r>=0&&g;--r){var b=n[r].s;p[b]==t&&(--p[b],++g)}v=t}return[new en(p),v]},bn=function(e,t,i){return-1==e.s?Math.max(bn(e.l,t,i+1),bn(e.r,t,i+1)):t[e.s]=i},wn=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new tn(++t),r=0,s=e[0],n=1,o=function(e){i[r++]=e},a=1;t>=a;++a)if(e[a]==s&&a!=t)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=e[a]}return[i.subarray(0,r),t]},xn=function(e,t){for(var i=0,r=0;t.length>r;++r)i+=e[r]*t[r];return i},En=function(e,t,i){var r=i.length,s=gn(t+2);e[s]=255&r,e[s+1]=r>>>8,e[s+2]=255^e[s],e[s+3]=255^e[s+1];for(var n=0;r>n;++n)e[s+n+4]=i[n];return 8*(s+4+r)},kn=function(e,t,i,r,s,n,o,a,l,u,c){fn(t,c++,i),++s[256];for(var h=yn(s,15),d=h[0],p=h[1],v=yn(n,15),g=v[0],_=v[1],f=wn(d),m=f[0],y=f[1],b=wn(g),w=b[0],x=b[1],E=new tn(19),k=0;m.length>k;++k)E[31&m[k]]++;for(k=0;w.length>k;++k)E[31&w[k]]++;for(var S=yn(E,7),P=S[0],F=S[1],$=19;$>4&&!P[on[$-1]];--$);var I,R,M,O,C=u+5<<3,T=xn(s,hn)+xn(n,dn)+o,A=xn(s,d)+xn(n,g)+o+14+3*$+xn(E,P)+(2*E[16]+3*E[17]+7*E[18]);if(T>=C&&A>=C)return En(t,c,e.subarray(l,l+u));if(fn(t,c,1+(T>A)),c+=2,T>A){I=cn(d,p,0),R=d,M=cn(g,_,0),O=g;var q=cn(P,F,0);for(fn(t,c,y-257),fn(t,c+5,x-1),fn(t,c+10,$-4),c+=14,k=0;$>k;++k)fn(t,c+3*k,P[on[k]]);c+=3*$;for(var L=[m,w],D=0;2>D;++D){var N=L[D];for(k=0;N.length>k;++k)fn(t,c,q[j=31&N[k]]),c+=P[j],j>15&&(fn(t,c,N[k]>>>5&127),c+=N[k]>>>12)}}else I=pn,R=hn,M=vn,O=dn;for(k=0;a>k;++k)if(r[k]>255){var j;mn(t,c,I[257+(j=r[k]>>>18&31)]),c+=R[j+257],j>7&&(fn(t,c,r[k]>>>23&31),c+=sn[j]);var H=31&r[k];mn(t,c,M[H]),c+=O[H],H>3&&(mn(t,c,r[k]>>>5&8191),c+=nn[H])}else mn(t,c,I[r[k]]),c+=R[r[k]];return mn(t,c,I[256]),c+R[256]},Sn=new rn([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Pn=function(){for(var e=new rn(256),t=0;256>t;++t){for(var i=t,r=9;--r;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e}(),Fn=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};var $n=!!C||!!O,In="text/plain",Rn=!1,Mn=(e,t)=>{var[i,r]=e.split("#"),[s,n]=i.split("?");if(!n)return e;var o=n.split("&").filter(e=>e.split("=")[0]!==t).join("&");return s+(o?"?"+o:"")+(r?"#"+r:"")},On=function(e,t,i){var r;void 0===i&&(i=!0);var[s,n]=e.split("?"),o=z({},t),a=null!==(r=null==n?void 0:n.split("&").map(e=>{var t,[r,s]=e.split("="),n=i&&null!==(t=o[r])&&void 0!==t?t:s;return delete o[r],r+"="+n}))&&void 0!==r?r:[],l=function(e,t){var i,r;void 0===t&&(t="&");var s=[];return xr(e,function(e,t){he(e)||he(t)||"undefined"===t||(i=encodeURIComponent(e instanceof File?e.name:e.toString()),r=encodeURIComponent(t),s[s.length]=r+"="+i)}),s.join(t)}(o);return l&&a.push(l),s+"?"+a.join("&")},Cn=(e,t)=>JSON.stringify(e,(e,t)=>"bigint"==typeof t?t.toString():t,t),Tn=e=>{if(e.tr)return e.tr;var t,{data:i,compression:r}=e;if(i){if(r===Zs){var s=function(e,t){void 0===t&&(t={});var i=function(){var e=4294967295;return{p(t){for(var i=e,r=0;t.length>r;++r)i=Pn[255&i^t[r]]^i>>>8;e=i},d:()=>4294967295^e}}(),r=e.length;i.p(e);var s,n,o,a,l=(a=10+((s=t).filename&&s.filename.length+1||0),function(e,t,i,r){var s=e.length,n=new en(r+s+5*(1+Math.floor(s/7e3))+8),o=n.subarray(r,n.length-8),a=0;if(!t||8>s)for(var l=0;s>=l;l+=65535){var u=l+65535;s>u?a=En(o,a,e.subarray(l,u)):(o[l]=!0,a=En(o,a,e.subarray(l,s)))}else{for(var c=Sn[t-1],h=c>>>13,d=8191&c,p=(1<<i)-1,v=new tn(32768),g=new tn(p+1),_=Math.ceil(i/3),f=2*_,m=function(t){return(e[t]^e[t+1]<<_^e[t+2]<<f)&p},y=new rn(25e3),b=new tn(288),w=new tn(32),x=0,E=0,k=(l=0,0),S=0,P=0;s>l;++l){var F=m(l),$=32767&l,I=g[F];if(v[$]=I,g[F]=$,l>=S){var R=s-l;if((x>7e3||k>24576)&&R>423){a=kn(e,o,0,y,b,w,E,k,P,l-P,a),k=x=E=0,P=l;for(var M=0;286>M;++M)b[M]=0;for(M=0;30>M;++M)w[M]=0}var O=2,C=0,T=d,A=$-I&32767;if(R>2&&F==m(l-A))for(var q=Math.min(h,R)-1,L=Math.min(32767,l),D=Math.min(258,R);L>=A&&--T&&$!=I;){if(e[l+O]==e[l+O-A]){for(var N=0;D>N&&e[l+N]==e[l+N-A];++N);if(N>O){if(O=N,C=A,N>q)break;var j=Math.min(A,N-2),H=0;for(M=0;j>M;++M){var z=l-A+M+32768&32767,U=z-v[z]+32768&32767;U>H&&(H=U,I=z)}}}A+=($=I)-(I=v[$])+32768&32767}if(C){y[k++]=268435456|un[O]<<18|Fs[C];var B=31&un[O],V=31&Fs[C];E+=sn[B]+nn[V],++b[257+B],++w[V],S=l+O,++x}else y[k++]=e[l],++b[e[l]]}}a=kn(e,o,!0,y,b,w,E,k,P,l-P,a)}return _n(n,0,r+gn(a)+8)}(n=e,null==(o=t).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+o.mem,a)),u=l.length;return function(e,t){var i=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=2>t.level?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&Fn(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var r=0;i.length>=r;++r)e[r+10]=i.charCodeAt(r)}}(l,t),Fn(l,u-8,i.d()),Fn(l,u-4,r),l}(function(e){var t=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var i=new en(e.length+(e.length>>>1)),r=0,s=function(e){i[r++]=e},n=0;t>n;++n){if(r+5>i.length){var o=new en(r+8+(t-n<<1));o.set(i),i=o}var a=e.charCodeAt(n);128>a?s(a):2048>a?(s(192|a>>>6),s(128|63&a)):a>55295&&57344>a?(s(240|(a=65536+(1047552&a)|1023&e.charCodeAt(++n))>>>18),s(128|a>>>12&63),s(128|a>>>6&63),s(128|63&a)):(s(224|a>>>12),s(128|a>>>6&63),s(128|63&a))}return _n(i,0,r)}(Cn(i)),{mtime:0});return{contentType:In,body:s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength),estimatedSize:s.byteLength}}if(r===Qs){var n=(e=>"data="+encodeURIComponent("string"==typeof e?e:Cn(e)))((t=Cn(i))?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16)))):t);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=Cn(i);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},An=e=>{var t,i,r,s=Tn(e);return!s||(i=e.compression,r=ls(e.url,"compression"),i!==V.GZipJS&&r!==V.GZipJS&&"gzip"!==r)||((t=s.body)instanceof ArrayBuffer?X(new Uint8Array(t)):ArrayBuffer.isView(t)&&X(new Uint8Array(t.buffer,t.byteOffset,t.byteLength)))?{url:e.url,encodedBody:s}:(Rn=!0,{url:Mn(e.url,"compression"),encodedBody:Tn(z({},e,{compression:void 0,tr:void 0}))})},qn=function(){var e=H(function*(e){var t=Cn(e.data),i=yield function(e,t,i){return Z.apply(this,arguments)}(t,N.DEBUG,{rethrow:!0});if(!i)return e;var r=yield i.arrayBuffer();return z({},e,{tr:{contentType:In,body:r,estimatedSize:r.byteLength}})});return function(t){return e.apply(this,arguments)}}(),Ln=(e,t)=>On(e,{_:(new Date).getTime().toString(),ver:N.JS_SDK_VERSION,compression:t}),Dn=[];O&&Dn.push({transport:"fetch",method(e){var t,{url:i,encodedBody:r}=An(e),{contentType:s,body:n,estimatedSize:o}=null!=r?r:{},a=new Headers;xr(e.headers,function(e,t){a.append(t,e)}),s&&a.append("Content-Type",s);var l=null;if(T){var u=new T;l={signal:u.signal,timeout:setTimeout(()=>u.abort(),e.timeout)}}O(i,z({method:(null==e?void 0:e.method)||"GET",headers:a,keepalive:"POST"===e.method&&52428.8>(o||0),body:n,signal:null==(t=l)?void 0:t.signal},e.fetchOptions)).then(t=>t.text().then(i=>{var r={statusCode:t.status,text:i};if(200===t.status)try{r.json=JSON.parse(i)}catch(e){ci.error(e)}null==e.callback||e.callback(r)})).catch(t=>{ci.error(t),null==e.callback||e.callback({statusCode:0,error:t})}).finally(()=>l?clearTimeout(l.timeout):null)}}),C&&Dn.push({transport:"XHR",method(e){var t=new C,{url:i,encodedBody:r}=An(e);t.open(e.method||"GET",i,!0);var{contentType:s,body:n}=null!=r?r:{};xr(e.headers,function(e,i){t.setRequestHeader(i,e)}),s&&t.setRequestHeader("Content-Type",s),e.timeout&&(t.timeout=e.timeout),e.disableXHRCredentials||(t.withCredentials=!0),t.onreadystatechange=()=>{if(4===t.readyState){var i={statusCode:t.status,text:t.responseText};if(200===t.status)try{i.json=JSON.parse(t.responseText)}catch(e){}null==e.callback||e.callback(i)}},t.send(n)}}),null!=I&&I.sendBeacon&&Dn.push({transport:"sendBeacon",method(e){try{var{url:t,encodedBody:i}=An(e),r=On(t,{beacon:"1"}),{contentType:s,body:n}=null!=i?i:{};if(!n)return;var o=n instanceof Blob?n:new Blob([n],{type:s});I.sendBeacon(r,o)}catch(e){}}});var Nn=3e3,jn=class{constructor(e,t){this.Ar=!0,this.Nr=[],this.$r=Pe((null==t?void 0:t.flush_interval_ms)||Nn,250,5e3,ci.createLogger("flush interval"),Nn),this.Dr=e}enqueue(e){this.Nr.push(e),this.qr||this.jr()}unload(){this.Hr();var e=this.Nr.length>0?this.Ur():{},t=Object.values(e);[...t.filter(e=>0===e.url.indexOf("/e")),...t.filter(e=>0!==e.url.indexOf("/e"))].map(e=>{this.Dr(z({},e,{transport:"sendBeacon"}))})}enable(){this.Ar=!1,this.jr()}jr(){var e=this;this.Ar||(this.qr=setTimeout(()=>{if(this.Hr(),this.Nr.length>0){var t=this.Ur(),i=function(){var i=t[r],s=(new Date).getTime();i.data&&ae(i.data)&&xr(i.data,e=>{e.offset=Math.abs(e.timestamp-s),delete e.timestamp}),e.Dr(i)};for(var r in t)i()}},this.$r))}Hr(){clearTimeout(this.qr),this.qr=void 0}Ur(){var e={};return xr(this.Nr,t=>{var i,r=t,s=(r?r.batchKey:null)||r.url;he(e[s])&&(e[s]=z({},r,{data:[]})),null==(i=e[s].data)||i.push(r.data)}),this.Nr=[],e}},Hn=["retriesPerformedSoFar"],zn=class{constructor(e){this.Br=!1,this.zr=3e3,this.Nr=[],this._instance=e,this.Nr=[],this.Vr=!0,!he(P)&&"onLine"in P.navigator&&(this.Vr=P.navigator.onLine,this.Wr=()=>{this.Vr=!0,this.Zr()},this.Gr=()=>{this.Vr=!1},Rr(P,"online",this.Wr),Rr(P,"offline",this.Gr))}get length(){return this.Nr.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,i=U(e,Hn);fe(t)&&(i.url=On(i.url,{retry_count:t})),this._instance._send_request(z({},i,{callback:e=>{200===e.statusCode||e.statusCode>=400&&500>e.statusCode||(null!=t?t:0)>=10?null==i.callback||i.callback(e):this.Qr(z({retriesPerformedSoFar:t},i))}}))}Qr(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var i,r,s,n,o,a=(i=t,r=3e3*Math.pow(2,i),s=r/2,n=Math.min(18e5,r),o=Math.random()-.5,Math.ceil(n+o*(n-s))),l=Date.now()+a;this.Nr.push({retryAt:l,requestOptions:e});var u="Enqueued failed request for retry in "+a;navigator.onLine||(u+=" (Browser is offline)"),ci.warn(u),this.Br||(this.Br=!0,this.Jr())}Jr(){if(this.Kr&&clearTimeout(this.Kr),0===this.Nr.length)return this.Br=!1,void(this.Kr=void 0);this.Kr=setTimeout(()=>{this.Vr&&this.Nr.length>0&&this.Zr(),this.Jr()},this.zr)}Zr(){var e=Date.now(),t=[],i=this.Nr.filter(i=>e>i.retryAt||(t.push(i),!1));if(this.Nr=t,i.length>0)for(var{requestOptions:r}of i)this.retriableRequest(r)}unload(){for(var{requestOptions:e}of(this.Kr&&(clearTimeout(this.Kr),this.Kr=void 0),this.Br=!1,he(P)||(this.Wr&&(P.removeEventListener("online",this.Wr),this.Wr=void 0),this.Gr&&(P.removeEventListener("offline",this.Gr),this.Gr=void 0)),this.Nr))try{this._instance._send_request(z({},e,{transport:"sendBeacon"}))}catch(e){ci.error(e)}this.Nr=[]}},Un=class{constructor(e){this.Yr=()=>{var e,t,i,r;this.Xr||(this.Xr={});var s=this.scrollElement(),n=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=n+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;this.Xr.lastScrollY=Math.ceil(n),this.Xr.maxScrollY=Math.max(n,null!==(e=this.Xr.maxScrollY)&&void 0!==e?e:0),this.Xr.maxScrollHeight=Math.max(o,null!==(t=this.Xr.maxScrollHeight)&&void 0!==t?t:0),this.Xr.lastContentY=a,this.Xr.maxContentY=Math.max(a,null!==(i=this.Xr.maxContentY)&&void 0!==i?i:0),this.Xr.maxContentHeight=Math.max(l,null!==(r=this.Xr.maxContentHeight)&&void 0!==r?r:0)},this._instance=e}get ei(){return this._instance.config.scroll_root_selector}getContext(){return this.Xr}resetContext(){var e=this.Xr;return setTimeout(this.Yr,0),e}startMeasuringScrollPosition(){Rr(P,"scroll",this.Yr,{capture:!0}),Rr(P,"scrollend",this.Yr,{capture:!0}),Rr(P,"resize",this.Yr)}scrollElement(){if(!this.ei)return null==P?void 0:P.document.documentElement;var e=ae(this.ei)?this.ei:[this.ei];for(var t of e){var i=null==P?void 0:P.document.querySelector(t);if(i)return i}}scrollY(){if(this.ei){var e=this.scrollElement();return e&&e.scrollTop||0}return P&&(P.scrollY||P.pageYOffset||P.document.documentElement.scrollTop)||0}scrollX(){if(this.ei){var e=this.scrollElement();return e&&e.scrollLeft||0}return P&&(P.scrollX||P.pageXOffset||P.document.documentElement.scrollLeft)||0}},Bn=e=>xs(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties),Vn=class{constructor(e,t,i,r){this.ti=e=>{var t=this.ri();if(!t||t.sessionId!==e){var i={sessionId:e,props:this.ii(this._instance)};this.ni.register({[Zi]:i})}},this._instance=e,this.si=t,this.ni=i,this.ii=r||Bn,this.si.onSessionId(this.ti)}ri(){return this.ni.props[Zi]}getSetOnceProps(){var e,t=null==(e=this.ri())?void 0:e.props;return t?"r"in t?Es(t):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return xr(Fr(this.getSetOnceProps()),(t,i)=>{"$current_url"===i&&(i="url"),e["$session_entry_"+re(i)]=t}),e}},Wn=class{constructor(){this.oi={}}on(e,t){return this.oi[e]||(this.oi[e]=[]),this.oi[e].push(t),()=>{this.oi[e]=this.oi[e].filter(e=>e!==t)}}emit(e,t){for(var i of this.oi[e]||[])i(t);for(var r of this.oi["*"]||[])r(e,t)}},Gn=hi("[SessionId]"),Xn=class{on(e,t){return this.ai.on(e,t)}constructor(e,t,i){var r;if(this.ui=[],this.li=void 0,this.ai=new Wn,this.hi=(e,t)=>!(!fe(e)||!fe(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===hr)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.qt=e.config,this.ni=e.persistence,this.ci=void 0,this.di=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.vi=t||Lr,this.fi=i||Lr;var s=this.qt.persistence_name||this.qt.token;if(this._sessionTimeoutMs=1e3*Pe(this.qt.session_idle_timeout_seconds||1800,60,36e3,Gn.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.pi(),this.gi="ph_"+s+"_window_id",this.mi="ph_"+s+"_primary_window_exists",this.yi()){var n=Xr.F(this.gi),o=Xr.F(this.mi);n&&!o?this.ci=n:Xr.q(this.gi),Xr.N(this.mi,!0)}if(null!=(r=this.qt.bootstrap)&&r.sessionID)try{var a=(()=>{var e=this.qt.bootstrap.sessionID.replace(/-/g,"");if(32!==e.length)throw new Error("Not a valid UUID");if("7"!==e[12])throw new Error("Not a UUIDv7");return parseInt(e.substring(0,12),16)})();this.bi(this.qt.bootstrap.sessionID,(new Date).getTime(),a)}catch(e){Gn.error("Invalid sessionID in bootstrap",e)}this.wi()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return he(this.ui)&&(this.ui=[]),this.ui.push(e),this.di&&e(this.di,this.ci),()=>{this.ui=this.ui.filter(t=>t!==e)}}yi(){return"memory"!==this.qt.persistence&&!this.ni._r&&Xr.R()}xi(e){e!==this.ci&&(this.ci=e,this.yi()&&Xr.N(this.gi,e))}Si(){return this.ci?this.ci:this.yi()?Xr.F(this.gi):null}bi(e,t,i){e===this.di&&t===this._sessionActivityTimestamp&&i===this._sessionStartTimestamp||(this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this.di=e,this.ni.register({[Oi]:[t,e,i]}))}ki(){var e=this.ni.props[Oi];return ae(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.bi(null,null,null)}destroy(){clearTimeout(this.Ci),this.Ci=void 0,this.li&&P&&(P.removeEventListener(_r,this.li,{capture:!1}),this.li=void 0),this.ui=[]}wi(){this.li=()=>{this.yi()&&Xr.q(this.mi)},Rr(P,_r,this.li,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),this.qt.cookieless_mode===hr)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||(new Date).getTime(),[r,s,n]=this.ki(),o=this.Si(),a=fe(n)&&Math.abs(i-n)>864e5,l=!1,u=!s,c=!u&&!e&&this.hi(i,r);u||c||a?(s=this.vi(),o=this.fi(),Gn.info("new session ID generated",{sessionId:s,windowId:o,changeReason:{noSessionId:u,activityTimeout:c,sessionPastMaximumLength:a}}),n=i,l=!0):o||(o=this.fi(),l=!0);var h=fe(r)&&e&&!a?r:i,d=fe(n)?n:(new Date).getTime();return this.xi(o),this.bi(s,h,d),e||this.pi(),l&&this.ui.forEach(e=>e(s,o,l?{noSessionId:u,activityTimeout:c,sessionPastMaximumLength:a}:void 0)),{sessionId:s,windowId:o,sessionStartTimestamp:d,changeReason:l?{noSessionId:u,activityTimeout:c,sessionPastMaximumLength:a}:void 0,lastActivityTimestamp:r}}pi(){clearTimeout(this.Ci),this.Ci=setTimeout(()=>{var[e]=this.ki();if(this.hi((new Date).getTime(),e)){var t=this.di;this.resetSessionId(),this.ai.emit("forcedIdleReset",{idleSessionId:t})}},1.1*this.sessionTimeoutMs)}},Kn=function(e,t){if(!e)return!1;var i=e.userAgent;if(i&&ee(i,t))return!0;try{var r=null==e?void 0:e.userAgentData;if(null!=r&&r.brands&&r.brands.some(e=>ee(null==e?void 0:e.brand,t)))return!0}catch(e){}return!!e.webdriver},Yn=function(e,t){if(!function(e){try{new RegExp(e)}catch(e){return!1}return!0}(t))return!1;try{return new RegExp(t).test(e)}catch(e){return!1}};function Jn(e,t,i){return Cn({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var Zn={exact:(e,t)=>t.some(t=>e.some(e=>t===e)),is_not:(e,t)=>t.every(t=>e.every(e=>t!==e)),regex:(e,t)=>t.some(t=>e.some(e=>Yn(t,e))),not_regex:(e,t)=>t.every(t=>e.every(e=>!Yn(t,e))),icontains:(e,t)=>t.map(Qn).some(t=>e.map(Qn).some(e=>t.includes(e))),not_icontains:(e,t)=>t.map(Qn).every(t=>e.map(Qn).every(e=>!t.includes(e))),gt:(e,t)=>t.some(t=>{var i=parseFloat(t);return!isNaN(i)&&e.some(e=>i>parseFloat(e))}),lt:(e,t)=>t.some(t=>{var i=parseFloat(t);return!isNaN(i)&&e.some(e=>i<parseFloat(e))})},Qn=e=>e.toLowerCase();function eo(e,t){return!e||Object.entries(e).every(e=>{var[i,r]=e,s=null==t?void 0:t[i];if(he(s)||ve(s))return!1;var n=[String(s)],o=Zn[r.operator];return!!o&&o(r.values,n)})}var to,io="custom",ro="i.posthog.com",so=/^\/static\//,no=class{constructor(e){this.Ii={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,t=null==(e=this.instance.config.ui_host)?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+ro,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this.Ii[this.apiHost]||(this.Ii[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":io),this.Ii[this.apiHost]}Ti(e){var t=this.instance.config.__preview_external_dependency_versioned_paths;if("string"==typeof t&&so.test(e))return t.trim().replace(/\/$/,"")||void 0}endpointFor(e,t){if(void 0===t&&(t=""),t&&(t="/"===t[0]?t:"/"+t),"ui"===e)return this.uiHost+t;if("flags"===e)return this.flagsApiHost+t;if("assets"===e){var i=this.Ti(t);if(i)return""+i+t}if(this.region===io)return this.apiHost+t;var r=ro+t;switch(e){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}},oo=hi("[Surveys]"),ao="seenSurvey_",lo=[Ts,qs,As],uo={ignoreConditions:!1,ignoreDelay:!1,displayType:Us},co=hi("[PostHog ExternalIntegrations]"),ho={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},po=class{constructor(e){this._instance=e}lr(e,t){var i;null==(i=L.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,e=>{if(e)return co.error("failed to load script",e);t()})}startIfEnabledOrStop(){var e=this,t=function(t){var i,s,n;!r||null!=(i=L.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[t]||e.lr(ho[t],()=>{var i;null==(i=L.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[t])||i.start(e._instance)}),!r&&null!=(s=L.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[t]&&(null==(n=L.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[t])||n.stop())};for(var[i,r]of Object.entries(null!==(s=this._instance.config.integrations)&&void 0!==s?s:{})){var s;t(i)}}},vo={},go=0,_o=()=>{},fo='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',mo="Surveys module not available",yo="sanitize_properties is deprecated. Use before_send instead",bo="Invalid value for property_denylist config: ",wo="posthog",xo=!$n&&-1===(null==q?void 0:q.indexOf("MSIE"))&&-1===(null==q?void 0:q.indexOf("Mozilla")),Eo=e=>{var t;return z({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Ir(null==R?void 0:R.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:_o,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,debug:M&&de(null==M?void 0:M.search)&&-1!==M.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==P||null==(t=P.location)?void 0:t.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(e){ci.error("Bad HTTP status: "+e.statusCode+" "+e.text)},get_device_id:e=>e,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:vr,before_send:void 0,request_queue_config:{flush_interval_ms:Nn},error_tracking:{},_onCapture:_o,__preview_eager_load_replay:!1},(e=>({rageclick:!e||"2025-11-30">e||{content_ignorelist:!0},capture_pageview:!e||"2025-05-24">e||"history_change",session_recording:e&&e>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:e&&e>="2026-01-30"?"head":"body",internal_or_test_user_hostname:e&&e>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0}))(e))},ko=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["store_google","save_campaign_params"],["verbose","debug"]],So=e=>{var t={};for(var[i,r]of ko)he(e[i])||(t[r]=e[i]);var s=Er({},t,e);return ae(e.property_blacklist)&&(he(e.property_denylist)?s.property_denylist=e.property_blacklist:ae(e.property_denylist)?s.property_denylist=[...e.property_blacklist,...e.property_denylist]:ci.error(bo+e.property_denylist)),s},Po=class{constructor(){this.__forceAllowLocalhost=!1}get Ei(){return this.__forceAllowLocalhost}set Ei(e){ci.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},Fo=class e{Mi(e,t){if(e){var i=this.Pi.indexOf(e);-1!==i&&this.Pi.splice(i,1)}return this.Pi.push(t),null==t.initialize||t.initialize(),t}Ri(){return this.config.cookieless_mode===hr||this.config.cookieless_mode===cr&&this.consent.isRejected()}get decideEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}get flagsEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}constructor(){var t;this.webPerformance=new Po,this.Oi=!1,this.version=N.LIB_VERSION,this.Li=new Wn,this.Pi=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Eo(),this.SentryIntegration=rs,this.sentryIntegration=e=>{return t=is(this,e),{name:ts,processEvent:e=>t(e)};var t},this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Fi=!1,this.Ai=null,this.Ni=null,this.$i=null,this.scrollManager=new Un(this),this.pageViewManager=new ss(this),this.rateLimiter=new Ks(this),this.requestRouter=new no(this),this.consent=new Kr(this),this.externalIntegrations=new po(this);var i=null!==(t=e.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(e,t,i)=>{var r=de(e)?{[e]:t}:e;this.setPersonProperties(r),null==i||i({})},set_once:(e,t,i)=>{var r=de(e)?{[e]:t}:e;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",e=>ci.info('send "'+(null==e?void 0:e.event)+'"',e))}init(t,i,r){if(r&&r!==wo){var s,n=null!==(s=vo[r])&&void 0!==s?s:new e;return n._init(t,i,r),vo[r]=n,vo[wo][r]=n,n}return this._init(t,i,r)}_init(e,t,i){var r,s;if(void 0===t&&(t={}),he(e)||pe(e))return ci.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},t.debug=this.Di(t.debug),this.qi=t,this.ji=[],t.person_profiles?this.Ni=t.person_profiles:t.process_person&&(this.Ni=t.process_person),this.set_config(Er({},Eo(t.defaults),So(t),{name:i,token:e})),this.config.on_xhr_error&&ci.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:Zs;var n=this.Hi();this.persistence=new Ms(this.config,n),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Ms(z({},this.config,{persistence:"sessionStorage"}),n);var o=z({},this.persistence.props),a=z({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Ui=new jn(e=>this.Bi(e),this.config.request_queue_config),this.zi=new zn(this),this.__request_queue=[];var l=this.Ri();if(l||(this.sessionManager=new Xn(this),this.sessionPropsManager=new Vn(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(ci.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Vi(l)},0)):(ci.info("Initializing extensions synchronously"),this.Vi(l)),N.DEBUG=N.DEBUG||this.config.debug,N.DEBUG&&ci.info("Starting in debug mode",{this:this,config:t,thisC:z({},this.config),p:o,s:a}),!this.config.identity_distinct_id||null!=(r=t.bootstrap)&&r.distinctID||(t.bootstrap=z({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(s=t.bootstrap)?void 0:s.distinctID)){var u=t.bootstrap.distinctID,c=this.get_distinct_id(),h=this.persistence.get_property(Ji);if(t.bootstrap.isIdentifiedID&&null!=c&&c!==u&&h===dr)this.identify(u);else if(t.bootstrap.isIdentifiedID&&null!=c&&c!==u&&h===pr)ci.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var d=this.config.get_device_id(Lr()),p=t.bootstrap.isIdentifiedID?d:u;this.persistence.set_property(Ji,t.bootstrap.isIdentifiedID?pr:dr),this.register({distinct_id:u,$device_id:p})}}if(l)this.register_once({distinct_id:nr,$device_id:null},"");else if(!this.get_distinct_id()){var v=this.config.get_device_id(Lr());this.register_once({distinct_id:v,$device_id:v},""),this.persistence.set_property(Ji,dr)}return Rr(P,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),t.segment?function(e,t){var i=e.config.segment;if(!i)return t();!function(e,t){var i=e.config.segment;if(!i)return t();var r=i=>{var r=()=>i.anonymousId()||Lr();e.config.get_device_id=r,i.id()&&(e.register({distinct_id:i.id(),$device_id:r()}),e.persistence.set_property(Ji,pr)),t()},s=i.user();"then"in s&&le(s.then)?s.then(r):r(s)}(e,()=>{i.register((e=>{Promise&&Promise.resolve||es.warn("This browser does not have Promise support, and can not use the segment integration");var t=(t,i)=>{if(!i)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(es.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(es.info("UserId set, identifying with PostHog"),e.identify(t.event.userId));var r=e.calculateEventProperties(i,t.event.properties);return t.event.properties=Object.assign({},r,t.event.properties),t};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>t(e,e.event.event),page:e=>t(e,fr),identify:e=>t(e,yr),screen:e=>t(e,"$screen")}})(e)).then(()=>{t()})})}(this,()=>this.Wi()):this.Wi(),le(this.config._onCapture)&&this.config._onCapture!==_o&&(ci.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",e=>this.config._onCapture(e.event,e))),this.config.ip&&ci.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}Vi(t){var i,r,s,n,o,a,l,u=performance.now(),c=z({},e.__defaultExtensionClasses,this.config.__extensionClasses),h=[];c.featureFlags&&this.Pi.push(this.featureFlags=null!==(i=this.featureFlags)&&void 0!==i?i:new c.featureFlags(this)),c.exceptions&&this.Pi.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new c.exceptions(this)),c.historyAutocapture&&this.Pi.push(this.historyAutocapture=new c.historyAutocapture(this)),c.tracingHeaders&&this.Pi.push(new c.tracingHeaders(this)),c.siteApps&&this.Pi.push(this.siteApps=new c.siteApps(this)),c.sessionRecording&&!t&&this.Pi.push(this.sessionRecording=new c.sessionRecording(this)),this.config.disable_scroll_properties||h.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),c.autocapture&&this.Pi.push(this.autocapture=new c.autocapture(this)),c.surveys&&this.Pi.push(this.surveys=null!==(s=this.surveys)&&void 0!==s?s:new c.surveys(this)),c.logs&&this.Pi.push(this.logs=null!==(n=this.logs)&&void 0!==n?n:new c.logs(this)),c.conversations&&this.Pi.push(this.conversations=null!==(o=this.conversations)&&void 0!==o?o:new c.conversations(this)),c.productTours&&this.Pi.push(this.productTours=new c.productTours(this)),c.heatmaps&&this.Pi.push(this.heatmaps=new c.heatmaps(this)),c.webVitalsAutocapture&&this.Pi.push(this.webVitalsAutocapture=new c.webVitalsAutocapture(this)),c.exceptionObserver&&this.Pi.push(this.exceptionObserver=new c.exceptionObserver(this)),c.deadClicksAutocapture&&this.Pi.push(this.deadClicksAutocapture=new c.deadClicksAutocapture(this,Zr)),c.toolbar&&this.Pi.push(this.toolbar=null!==(a=this.toolbar)&&void 0!==a?a:new c.toolbar(this)),c.experiments&&this.Pi.push(this.experiments=null!==(l=this.experiments)&&void 0!==l?l:new c.experiments(this)),this.Pi.forEach(e=>{e.initialize&&h.push(()=>{null==e.initialize||e.initialize()})}),h.push(()=>{if(this.Zi){var e=this.Zi;this.Zi=void 0,this.Rr(e)}}),this.Gi(h,u)}Gi(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout(()=>{this.Gi(e,t)},0);var i=e.shift();if(i)try{i()}catch(e){ci.error("Error initializing extension:",e)}}var r=Math.round(performance.now()-t);this.register_for_session({[or]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[ar]:r}),this.config.__preview_deferred_init_extensions&&ci.info("PostHog extensions initialized ("+r+"ms)")}Rr(e){var t;if(!R||!R.body)return ci.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Rr(e)},500);this.config.__preview_deferred_init_extensions&&(this.Zi=e),this.Qi=e,this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=te(e.supportedCompression,Zs)?Zs:te(e.supportedCompression,Qs)?Qs:void 0),null!=(t=e.analytics)&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Ni?this.Ni:vr}),this.Pi.forEach(t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e))}Wi(){try{this.config.loaded(this)}catch(e){ci.critical("`loaded` function failed",e)}if(this.Ji(),this.config.internal_or_test_user_hostname&&null!=M&&M.hostname){var e=M.hostname,t=this.config.internal_or_test_user_hostname;("string"==typeof t?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.Ri())&&this.Ki()},1),this.Yi=new Js(this),this.Yi.load()}Ji(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this.Ui)||e.enable())}_dom_loaded(){this.is_capturing()&&wr(this.__request_queue,e=>this.Bi(e)),this.__request_queue=[],this.Ji()}_handle_unload(){var e,t,i,r;null==(e=this.surveys)||e.handlePageUnload(),this.config.request_batching?(this.Xi()&&this.capture(mr),null==(t=this.logs)||t.flushLogs("sendBeacon"),null==(i=this.Ui)||i.unload(),null==(r=this.zi)||r.unload()):this.Xi()&&this.capture(mr,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(xo?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=On(e.url,{ip:this.config.ip?1:0}),e.headers=z({},this.config.request_headers,e.headers),e.compression="best-available"===e.compression?this.compression:e.compression,e.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(e=>{var t,i,r,s=z({},e);s.timeout=s.timeout||6e4,s.url=Ln(s.url,s.compression);var n=null!==(t=s.transport)&&void 0!==t?t:"fetch",o=Dn.filter(e=>!s.disableTransport||!e.transport||!s.disableTransport.includes(e.transport)),a=null!==(i=null==(r=function(e){for(var t=0;e.length>t;t++)if(e[t].transport===n)return e[t]}(o))?void 0:r.method)&&void 0!==i?i:o[0].method;if(!a)throw new Error("No available transport method");"sendBeacon"!==n&&s.data&&s.compression===Zs&&A&&!Rn?qn(s).then(e=>{a(e)}).catch(t=>{if(K(t))return Rn=!0,void a(z({},s,{compression:void 0,url:Ln(e.url,void 0)}));(e=>{if(!e||"object"!=typeof e)return!1;var t="name"in e?String(e.name):"";return K(e)||t===G})(t)&&(Rn=!0),a(s)}):a(s)})(z({},e,{callback:t=>{var i,r;this.rateLimiter.checkForLimiting(t),400>t.statusCode||null==(i=(r=this.config).on_request_error)||i.call(r,t),null==e.callback||e.callback(t)}}))))}Bi(e){this.zi?this.zi.retriableRequest(e):this._send_request(e)}_execute_array(e){go++;try{var t,i=[],r=[],s=[];wr(e,e=>{if(e)if(ae(t=e[0]))s.push(e);else if(le(e))try{e.call(this)}catch(t){ci.error("Error executing queued PostHog call",e,t)}else ae(e)&&"alias"===t?i.push(e):ae(e)&&-1!==t.indexOf("capture")&&le(this[t])?s.push(e):r.push(e)});var n=function(e,t){wr(e,function(e){try{if(ae(e[0])){var i=t;xr(e,function(e){i=i[e[0]].apply(i,e.slice(1))})}else t[e[0]].apply(t,e.slice(1))}catch(t){ci.error("Error executing queued PostHog call",e,t)}})};n(i,this),n(r,this),n(s,this)}finally{go--}}push(t){if(go>0&&ae(t)&&de(t[0])){var i=e.prototype[t[0]];le(i)&&i.apply(this,t.slice(1))}else this._execute_array([t])}capture(e,t,i){var r,s,n,o,a;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Ui){if(this.is_capturing())if(!he(e)&&de(e)){var l=!this.config.opt_out_useragent_filter&&this._is_bot();if(!l||this.config.__preview_capture_bot_pageviews){var u=null!=i&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==u||!u.isRateLimited){null!=t&&t.$current_url&&!de(null==t?void 0:t.$current_url)&&(ci.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==t||delete t.$current_url),"$exception"!==e||null!=i&&i.en||ci.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var c=new Date,h=(null==i?void 0:i.timestamp)||c,d=(null==i?void 0:i.uuid)||Lr(),p={uuid:d,event:e,properties:this.calculateEventProperties(e,t||{},h,d)};e===fr&&this.config.__preview_capture_bot_pageviews&&l&&(p.event="$bot_pageview",p.properties.$browser_type="bot"),u&&(p.properties.$lib_rate_limit_remaining_tokens=u.remainingTokens),(null==i?void 0:i.$set)&&(p.$set=null==i?void 0:i.$set);var v,g,_,f=this.tn(null==i?void 0:i.$set_once,e!==br,e===yr);if(f&&(p.$set_once=f),null!=i&&i._noTruncate||(s=this.config.properties_string_max_length,n=p,o=e=>de(e)?e.slice(0,s):e,a=new Set,p=function e(t,i){return t!==Object(t)?o?o(t):t:a.has(t)?void 0:(a.add(t),ae(t)?(r=[],wr(t,t=>{r.push(e(t))})):(r={},xr(t,(t,i)=>{a.has(t)||(r[i]=e(t,i))})),r);var r}(n)),p.timestamp=h,he(null==i?void 0:i.timestamp)||(p.properties.$event_time_override_provided=!0,p.properties.$event_time_override_system_time=c),e===Ds||e===Ns){var m=null==t?void 0:t[js],y=null==t?void 0:t[Hs];(e=>{try{var t=(s=""+ao+(r=i=e).id,r.current_iteration&&r.current_iteration>0&&(s=""+ao+r.id+"_"+r.current_iteration),s);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(i){oo.error("Failed to persist survey seen state",i)}var i,r,s})({id:m,current_iteration:y}),p.$set=z({},p.$set,{[(v={id:m,current_iteration:y},g=e===Ns?"responded":"dismissed",_="$survey_"+g+"/"+v.id,v.current_iteration&&v.current_iteration>0&&(_="$survey_"+g+"/"+v.id+"/"+v.current_iteration),_)]:!0})}else e===Ls&&(p.$set=z({},p.$set,{[zs]:(new Date).toISOString()}));if(e===Vs){var b=null==t?void 0:t[Gs];b&&(p.$set=z({},p.$set,{[Ws+"/"+b]:(new Date).toISOString()}))}var w=z({},p.properties.$set,p.$set);if(ce(w)||this.setPersonPropertiesForFlags(w),!ge(this.config.before_send)){var x=this.rn(p);if(!x)return;p=x}this.Li.emit("eventCaptured",p);var E={method:"POST",url:null!==(r=null==i?void 0:i._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:p,compression:"best-available",batchKey:null==i?void 0:i._batchKey,transport:null==i?void 0:i.transport};return!this.config.request_batching||i&&(null==i||!i._batchKey)||null!=i&&i.send_instantly?this.Bi(E):this.Ui.enqueue(E),p}ci.critical("This capture call is ignored due to client rate limiting.")}}else ci.error("No event name provided to posthog.capture")}else ci.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",t=>e(t.event,t))}calculateEventProperties(e,t,i,r,s){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return t;var n=s?void 0:this.persistence.remove_event_timer(e),o=z({},t);if(o.token=this.config.token,o.$config_defaults=this.config.defaults,this.Ri()&&(o.$cookieless_mode=!0),"$snapshot"===e){var a=z({},this.persistence.properties(),this.sessionPersistence.properties());return o.distinct_id=a.distinct_id,(!de(o.distinct_id)&&!_e(o.distinct_id)||pe(o.distinct_id))&&ci.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),o}var l,u=function(e,t){var i,r,s,n;if(!q)return{};var o,a,l,u,c,h,d,p,v=e?[...ds,...t||[]]:[],[g,_]=function(e){for(var t=0;St.length>t;t++){var[i,r]=St[t],s=i.exec(e),n=s&&(le(r)?r(s,e):r);if(n)return n}return["",""]}(q);return Er(Fr({$os:g,$os_version:_,$browser:xt(q,navigator.vendor),$device:Pt(q),$device_type:(a=q,l={userAgentDataPlatform:null==(i=navigator)||null==(i=i.userAgentData)?void 0:i.platform,maxTouchPoints:null==(r=navigator)?void 0:r.maxTouchPoints,screenWidth:null==P||null==(s=P.screen)?void 0:s.width,screenHeight:null==P||null==(n=P.screen)?void 0:n.height,devicePixelRatio:null==P?void 0:P.devicePixelRatio},p=Pt(a),p===qe||p===Ae||"Kobo"===p||"Kindle Fire"===p||p===dt?Te:p===tt||p===rt||p===it||p===ut?"Console":p===De?"Wearable":p?Me:"Android"===(null==l?void 0:l.userAgentDataPlatform)&&(null!==(u=null==l?void 0:l.maxTouchPoints)&&void 0!==u?u:0)>0?600>Math.min(null!==(c=null==l?void 0:l.screenWidth)&&void 0!==c?c:0,null!==(h=null==l?void 0:l.screenHeight)&&void 0!==h?h:0)/(null!==(d=null==l?void 0:l.devicePixelRatio)&&void 0!==d?d:1)?Me:Te:"Desktop"),$timezone:ks(),$timezone_offset:Ss()}),{$current_url:us(null==M?void 0:M.href,v,vs),$host:null==M?void 0:M.host,$pathname:null==M?void 0:M.pathname,$raw_user_agent:q.length>1e3?q.substring(0,997)+"...":q,$browser_version:kt(q,navigator.vendor),$browser_language:ys(),$browser_language_prefix:(o=ys(),"string"==typeof o?o.split("-")[0]:void 0),$screen_height:null==P?void 0:P.screen.height,$screen_width:null==P?void 0:P.screen.width,$viewport_height:null==P?void 0:P.innerHeight,$viewport_width:null==P?void 0:P.innerWidth,$lib:N.LIB_NAME,$lib_version:N.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:c,windowId:h}=this.sessionManager.checkAndGetSessionAndWindowId(s,i.getTime());o.$session_id=c,o.$window_id=h}this.sessionPropsManager&&Er(o,this.sessionPropsManager.getSessionProps());try{var d;this.sessionRecording&&Er(o,this.sessionRecording.sdkDebugProperties),o.$sdk_debug_retry_queue_size=null==(d=this.zi)?void 0:d.length}catch(e){o.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===io&&(o.$lib_custom_api_host=this.config.api_host),l=e!==fr||s?e!==mr||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,r),o=Er(o,l),e===fr&&R&&(o.title=R.title),!he(n)){var p=i.getTime()-n;o.$duration=parseFloat((p/1e3).toFixed(3))}q&&this.config.opt_out_useragent_filter&&(o.$browser_type=this._is_bot()?"bot":"browser"),(o=Er({},u,this.persistence.properties(),this.sessionPersistence.properties(),o)).$is_identified=this._isIdentified(),ae(this.config.property_denylist)?xr(this.config.property_denylist,function(e){delete o[e]}):ci.error(bo+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var v=this.config.sanitize_properties;v&&(ci.error(yo),o=v(o,e));var g=this.nn();return o.$process_person_profile=g,g&&!s&&this.sn("_calculate_event_properties"),o}tn(e,t,i){var r;if(void 0===t&&(t=!0),void 0===i&&(i=!1),!this.persistence||!this.nn())return e;if(this.Oi&&!i)return e;var s=this.persistence.get_initial_props(),n=null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps(),o=Er({},s,n||{},e||{}),a=this.config.sanitize_properties;return a&&(ci.error(yo),o=a(o,"$set_once")),t&&(this.Oi=!0),ce(o)?void 0:o}register(e,t){var i;null==(i=this.persistence)||i.register(e,t)}register_once(e,t,i){var r;null==(r=this.persistence)||r.register_once(e,t,i)}register_for_session(e){var t;null==(t=this.sessionPersistence)||t.register(e)}unregister(e){var t;null==(t=this.persistence)||t.unregister(e)}unregister_for_session(e){var t;null==(t=this.sessionPersistence)||t.unregister(e)}an(e,t){this.register({[e]:t})}getFeatureFlag(e,t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return null==(t=this.featureFlags)?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagResult(e,t)}isFeatureEnabled(e,t){var i;return null==(i=this.featureFlags)?void 0:i.isFeatureEnabled(e,t)}reloadFeatureFlags(){var e;null==(e=this.featureFlags)||e.reloadFeatureFlags()}updateFlags(e,t,i){var r;null==(r=this.featureFlags)||r.updateFlags(e,t,i)}updateEarlyAccessFeatureEnrollment(e,t,i){var r;null==(r=this.featureFlags)||r.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t,i){var r;return void 0===t&&(t=!1),null==(r=this.featureFlags)?void 0:r.getEarlyAccessFeatures(e,t,i)}on(e,t){return this.Li.on(e,t)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:mo}),()=>{})}onSessionId(e){var t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.onSessionId(e))&&void 0!==t?t:()=>{}}getSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:mo})}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:mo})}renderSurvey(e,t){var i;null==(i=this.surveys)||i.renderSurvey(e,t)}displaySurvey(e,t){var i;void 0===t&&(t=uo),null==(i=this.surveys)||i.displaySurvey(e,t)}cancelPendingSurvey(e){var t;null==(t=this.surveys)||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,i;return null!==(t=null==(i=this.surveys)?void 0:i.canRenderSurvey(e))&&void 0!==t?t:{visible:!1,disabledReason:mo}}canRenderSurveyAsync(e,t){var i,r;return void 0===t&&(t=!1),null!==(i=null==(r=this.surveys)?void 0:r.canRenderSurveyAsync(e,t))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:mo})}un(e){return!e||pe(e)?(ci.critical("Unique user id has not been set in posthog.identify"),!1):e===nr?(ci.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(ci.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(e,t,i){if(!this.__loaded||!this.persistence)return ci.uninitializedWarning("posthog.identify");if(_e(e)&&(e=e.toString(),ci.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.un(e)&&this.sn("posthog.identify")){var r=this.get_distinct_id();this.register({$user_id:e}),this.get_property(gi)||this.register_once({$had_persisted_distinct_id:!0,$device_id:r},""),e!==r&&e!==this.get_property(_i)&&(this.unregister(_i),this.register({distinct_id:e}));var s,n=(this.persistence.get_property(Ji)||dr)===dr;e!==r&&n?(this.persistence.set_property(Ji,pr),this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!1),this.capture(yr,{distinct_id:e,$anon_distinct_id:r},{$set:t||{},$set_once:i||{}}),this.$i=Jn(e,t,i),null==(s=this.featureFlags)||s.setAnonymousDistinctId(r)):(t||i)&&this.setPersonProperties(t,i),e!==r&&(this.reloadFeatureFlags(),this.unregister(Gi))}}setPersonProperties(e,t){if((e||t)&&this.sn("posthog.setPersonProperties")){var i=Jn(this.get_distinct_id(),e,t);this.$i!==i?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.$i=i):ci.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,i){if(e&&t){var r=this.getGroups(),s=r[e]!==t;if(s&&this.resetGroupPropertiesForFlags(e),this.register({$groups:z({},r,{[e]:t})}),s||i){var n={$group_type:e,$group_key:t};i&&(n.$group_set=i),this.capture(br,n)}i&&this.setGroupPropertiesForFlags({[e]:i}),s&&!i&&this.reloadFeatureFlags()}else ci.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){var i;void 0===t&&(t=!0),null==(i=this.featureFlags)||i.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){var e;null==(e=this.featureFlags)||e.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,t){var i;void 0===t&&(t=!0),this.sn("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;null==(t=this.featureFlags)||t.resetGroupPropertiesForFlags(e)}reset(e){var t,i,r,s,n,o,a,l;if(ci.info("reset"),!this.__loaded)return ci.uninitializedWarning("posthog.reset");var u,c=this.get_property(gi),h=this.get_property(Fi);if(this.consent.reset(),null==(t=this.persistence)||t.clear(),null==(i=this.sessionPersistence)||i.clear(),he(h)||null==(u=this.persistence)||u.register({[Fi]:h}),null==(r=this.surveys)||r.reset(),null==(s=this.Yi)||s.stop(),null==(n=this.featureFlags)||n.reset(),null==(o=this.conversations)||o.reset(),null==(a=this.persistence)||a.set_property(Ji,dr),null==(l=this.sessionManager)||l.resetSessionId(),this.$i=null,this.config.cookieless_mode===hr)this.register_once({distinct_id:nr,$device_id:null},"");else{var d=this.config.get_device_id(Lr());this.register_once({distinct_id:d,$device_id:e?d:c},"")}this.register({$last_posthog_reset:(new Date).toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}setIdentity(e,t){var i;this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),null==(i=this.conversations)||i.ln()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(e=this.conversations)||e.hn()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return null!==(e=null==(t=this.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==e?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(null!=e&&e.withTimestamp&&i){var s,n=null!==(s=e.timestampLookBack)&&void 0!==s?s:10;if(!i)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return r}alias(e,t){return e===this.get_property(vi)?(ci.critical("Attempting to create alias for existing People user - aborting."),-2):this.sn("posthog.alias")?(he(t)&&(t=this.get_distinct_id()),e!==t?(this.an(_i,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(ci.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=z({},this.config);if(ue(e)){var i,r,s,n,o,a,l,u,c,h;Er(this.config,So(e));var d=this.Hi();null==(i=this.persistence)||i.update_config(this.config,t,d),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Ms(z({},this.config,{persistence:"sessionStorage"}),d);var p=this.Di(this.config.debug);me(p)&&(this.config.debug=p),me(this.config.debug)&&(this.config.debug?(N.DEBUG=!0,Ur.R()&&Ur.N("ph_debug",!0),ci.info("set_config",{config:e,oldConfig:t,newConfig:z({},this.config)})):(N.DEBUG=!1,Ur.R()&&Ur.q("ph_debug"))),null==(r=this.exceptionObserver)||r.onConfigChange(),null==(s=this.exceptions)||s.onConfigChange(),null==(n=this.sessionRecording)||n.startIfEnabledOrStop(),null==(o=this.autocapture)||o.startIfEnabled(),null==(a=this.heatmaps)||a.startIfEnabled(),null==(l=this.exceptionObserver)||l.startIfEnabledOrStop(),null==(u=this.deadClicksAutocapture)||u.startIfEnabledOrStop(),null==(c=this.surveys)||c.loadIfEnabled(),this.cn(),null==(h=this.externalIntegrations)||h.startIfEnabledOrStop()}}_overrideSDKInfo(e,t){N.LIB_NAME=e,N.LIB_VERSION=t}startSessionRecording(e){var t,i,r,s,n,o=!0===e,a={sampling:o||!(null==e||!e.sampling),linked_flag:o||!(null==e||!e.linked_flag),url_trigger:o||!(null==e||!e.url_trigger),event_trigger:o||!(null==e||!e.event_trigger)};Object.values(a).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(r=this.sessionRecording)||r.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!(null==(e=this.sessionRecording)||!e.started)}captureException(e,t){if(this.exceptions){var i=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(e,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(z({},r,t))}}addExceptionStep(e,t){var i;null==(i=this.exceptions)||i.addExceptionStep(e,t)}captureLog(e){var t;null==(t=this.logs)||t.captureLog(e)}get logger(){var t,i;return null!==(t=null==(i=this.logs)?void 0:i.logger)&&void 0!==t?t:e.dn}startExceptionAutocapture(e){this.set_config({capture_exceptions:null==e||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,i;return null!==(t=null==(i=this.toolbar)?void 0:i.loadToolbar(e))&&void 0!==t&&t}get_property(e){var t;return null==(t=this.persistence)?void 0:t.props[e]}getSessionProperty(e){var t;return null==(t=this.sessionPersistence)?void 0:t.props[e]}toString(){var e,t=null!==(e=this.config.name)&&void 0!==e?e:wo;return t!==wo&&(t=wo+"."+t),t}_isIdentified(){var e,t;return(null==(e=this.persistence)?void 0:e.get_property(Ji))===pr||(null==(t=this.sessionPersistence)?void 0:t.get_property(Ji))===pr}nn(){var e,t;return!("never"===this.config.person_profiles||this.config.person_profiles===vr&&!this._isIdentified()&&ce(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[_i])&&(null==(t=this.persistence)||null==(t=t.props)||!t[rr]))}Xi(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&(!0===this.config.capture_pageview||"history_change"===this.config.capture_pageview)}createPersonProfile(){this.nn()||this.sn("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.sn("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}sn(e){return"never"===this.config.person_profiles?(ci.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.an(rr,!0),!0)}Hi(){if("always"===this.config.cookieless_mode)return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==cr)}cn(){var e,t,i,r,s=this.Hi();return(null==(e=this.persistence)?void 0:e._r)!==s&&(null==(i=this.persistence)||i.set_disabled(s)),(null==(t=this.sessionPersistence)?void 0:t._r)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s)),s}opt_in_capturing(t){var i;if(this.config.cookieless_mode!==hr){if(this.Ri()){var r,s,n,o,a;this.reset(!0),null==(r=this.sessionManager)||r.destroy(),null==(s=this.pageViewManager)||s.destroy(),this.sessionManager=new Xn(this),this.pageViewManager=new ss(this),this.persistence&&(this.sessionPropsManager=new Vn(this,this.sessionManager,this.persistence));var l,u=null!==(n=null==(o=this.config.__extensionClasses)?void 0:o.sessionRecording)&&void 0!==n?n:null==(a=e.__defaultExtensionClasses)?void 0:a.sessionRecording;u&&(this.sessionRecording=this.Mi(this.sessionRecording,new u(this)),this.Qi&&(null==(l=this.sessionRecording)||null==l.onRemoteConfig||l.onRemoteConfig(this.Qi)))}var c,h;this.consent.optInOut(!0),this.cn(),this.Ji(),null==(i=this.sessionRecording)||i.startIfEnabledOrStop(),this.config.cookieless_mode==cr&&(null==(c=this.surveys)||c.loadIfEnabled()),(he(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!==(h=null==t?void 0:t.captureEventName)&&void 0!==h?h:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Ki()}else ci.warn(fo)}opt_out_capturing(){var e,t,i;this.config.cookieless_mode!==hr?(this.config.cookieless_mode===cr&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.cn(),this.config.cookieless_mode===cr&&(this.register({distinct_id:nr,$device_id:null}),null==(e=this.sessionRecording)||e.stopRecording(),this.sessionRecording=void 0,null==(t=this.sessionManager)||t.destroy(),null==(i=this.pageViewManager)||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.Ki(),this.Ji())):ci.warn(fo)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return 1===e?"granted":0===e?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===hr||(this.config.cookieless_mode===cr?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.cn()}_is_bot(){return I?Kn(I,this.config.custom_blocked_useragents):void 0}Ki(){R&&("visible"===R.visibilityState?this.Fi||(this.Fi=!0,this.capture(fr,{title:R.title},{send_instantly:!0}),this.Ai&&(R.removeEventListener(gr,this.Ai),this.Ai=null)):this.Ai||(this.Ai=this.Ki.bind(this),Rr(R,gr,this.Ai)))}debug(e){!1===e?(null==P||P.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==P||P.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}Lr(){var e,t,i,r,s,n,o=this.qi||{};return"advanced_disable_flags"in o?!!o.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(ci.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(i="advanced_disable_decide",r=ci,s=(t="advanced_disable_flags")in(e=o)&&!ge(e[t]),n=i in e&&!ge(e[i]),s?e[t]:!!n&&(r&&r.warn("Config field '"+i+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[i]))}rn(e){if(ge(this.config.before_send))return e;var t=ae(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var r of t){if(i=r(i),ge(i)){var s="Event '"+e.event+"' was rejected in beforeSend function";return ye(e.event)?ci.warn(s+". This can cause unexpected behavior."):ci.info(s),null}i.properties&&!ce(i.properties)||ci.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return i}getPageViewId(){var e;return null==(e=this.pageViewManager.dr)?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}Di(e){var t=me(e)&&!e,i=Ur.R()&&"true"===Ur.A("ph_debug");return!t&&(!!i||e)}};Fo.__defaultExtensionClasses={},Fo.dn={trace:to=()=>{},debug:to,info:to,warn:to,error:to,fatal:to},function(e,t){for(var i=0;t.length>i;i++)e.prototype[t[i]]=Pr(e.prototype[t[i]])}(Fo,["identify"]);function $o(e){return e instanceof Element&&(e.id===sr||!(null==e.closest||!e.closest(".toolbar-global-fade-container")))}function Io(e){return!!e&&1===e.nodeType}function Ro(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Mo(e){return!!e&&3===e.nodeType}function Oo(e){return!!e&&11===e.nodeType&&Io(e.host)}function Co(e){return e?ie(e).split(/\s+/):[]}function To(e){var t=null==P?void 0:P.location.href;return!!(t&&e&&e.some(e=>t.match(e)))}function Ao(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return Co(t)}function qo(e){return ge(e)?null:ie(e).split(/(\s+)/).filter(e=>ea(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Lo(e){var t="";return Wo(e)&&!Go(e)&&e.childNodes&&e.childNodes.length&&xr(e.childNodes,function(e){var i;Mo(e)&&e.textContent&&(t+=null!==(i=qo(e.textContent))&&void 0!==i?i:"")}),ie(t)}function Do(e){return he(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var No=["a","button","form","input","select","textarea","label"];function jo(e,t){if(he(t))return!0;var i,r=function(e){if(t.some(t=>e.matches(t)))return{v:!0}};for(var s of e)if(i=r(s))return i.v;return!1}function Ho(e){var t=e.parentNode;return!(!t||!Io(t))&&t}var zo=["next","previous","prev",">","<"],Uo=[".ph-no-rageclick",".ph-no-capture"],Bo=e=>!e||Ro(e,"html")||!Io(e),Vo=(e,t)=>{if(!P||Bo(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,r=[e],s=e;s.parentNode&&!Ro(s,"body");)if(Oo(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=Ho(s);if(!n)break;if(t||No.indexOf(n.tagName.toLowerCase())>-1)i=!0;else{var o=P.getComputedStyle(n);o&&"pointer"===o.getPropertyValue("cursor")&&(i=!0)}r.push(n),s=n}return{parentIsUsefulElement:i,targetElementList:r}};function Wo(e){for(var t=e;t.parentNode&&!Ro(t,"body");t=t.parentNode){var i=Ao(t);if(te(i,"ph-sensitive")||te(i,"ph-no-capture"))return!1}if(te(Ao(e),"ph-include"))return!0;var r=e.type||"";if(de(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=e.name||e.id||"";return!de(s)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,""))}function Go(e){return!!(Ro(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Ro(e,"select")||Ro(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var Xo="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",Ko=new RegExp("^(?:"+Xo+")$"),Yo=new RegExp(Xo),Jo="\\d{3}-?\\d{2}-?\\d{4}",Zo=new RegExp("^("+Jo+")$"),Qo=new RegExp("("+Jo+")");function ea(e,t){if(void 0===t&&(t=!0),ge(e))return!1;if(de(e)){if(e=ie(e),(t?Ko:Yo).test((e||"").replace(/[- ]/g,"")))return!1;if((t?Zo:Qo).test(e))return!1}return!0}function ta(e){var t=Lo(e);return ea(t=(t+" "+ia(e)).trim())?t:""}function ia(e){var t="";return e&&e.childNodes&&e.childNodes.length&&xr(e.childNodes,function(e){var i;if(e&&"span"===(null==(i=e.tagName)?void 0:i.toLowerCase()))try{var r=Lo(e);t=(t+" "+r).trim(),e.childNodes&&e.childNodes.length&&(t=(t+" "+ia(e)).trim())}catch(e){ci.error("[AutoCapture]",e)}}),t}function ra(e){return e.replace(/"|\\"/g,'\\"')}function sa(e){var t=e.attr__class;return t?ae(t)?t:Co(t):void 0}var na=class{constructor(e){this.disabled=!1===e;var t=ue(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,i){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(e-r.x)+Math.abs(t-r.y)<this.thresholdPx&&this.timeoutMs>i-r.timestamp){if(this.clicks.push({x:e,y:t,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:i}];return!1}},oa="$copy_autocapture",aa=hi("[AutoCapture]");function la(e,t){return t.length>e?t.slice(0,e)+"...":t}function ua(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!Io(t));return t}var ca=hi("[ExceptionAutocapture]");function ha(e,t,i){try{if(!(t in e))return()=>{};var r=e[t],s=i(r);return le(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=s,()=>{e[t]=r}}catch(e){return()=>{}}}var da=hi("[TracingHeaders]"),pa=hi("[Web Vitals]"),va=9e5,ga="disabled",_a="lazy_loading",fa="awaiting_config",ma="missing_config";hi("[SessionRecording]"),hi("[SessionRecording]");var ya="[SessionRecording]",ba=hi(ya),wa=hi("[Heatmaps]");function xa(e){return ue(e)&&"clientX"in e&&"clientY"in e&&_e(e.clientX)&&_e(e.clientY)}var Ea=hi("[Product Tours]"),ka=["$set_once","$set"],Sa=hi("[SiteApps]"),Pa="Error while initializing PostHog app with config id ";function Fa(e,t,i){if(ge(e))return!1;switch(i){case"exact":return e===t;case"contains":var r=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch(e){return!1}default:return!1}}var $a,Ia=class{constructor(e){this.vn=new Wn,this.fn=(e,t)=>this.pn(e,t)&&this.gn(e,t)&&this.mn(e,t)&&this.yn(e,t),this.pn=(e,t)=>null==t||!t.event||(null==e?void 0:e.event)===(null==t?void 0:t.event),this._instance=e,this.bn=new Set,this._n=new Set}init(){var e,t;he(null==(e=this._instance)?void 0:e._addCaptureHook)||null==(t=this._instance)||t._addCaptureHook((e,t)=>{this.on(e,t)})}register(e){var t,i;if(!he(null==(t=this._instance)?void 0:t._addCaptureHook)&&(e.forEach(e=>{var t,i;null==(t=this._n)||t.add(e),null==(i=e.steps)||i.forEach(e=>{var t;null==(t=this.bn)||t.add((null==e?void 0:e.event)||"")})}),null!=(i=this._instance)&&i.autocapture)){var r,s=new Set;e.forEach(e=>{var t;null==(t=e.steps)||t.forEach(e=>{null!=e&&e.selector&&s.add(null==e?void 0:e.selector)})}),null==(r=this._instance)||r.autocapture.setElementSelectors(s)}}on(e,t){var i;null!=t&&0!=e.length&&(this.bn.has(e)||this.bn.has(null==t?void 0:t.event))&&this._n&&(null==(i=this._n)?void 0:i.size)>0&&this._n.forEach(e=>{this.wn(t,e)&&this.vn.emit("actionCaptured",e.name)})}xn(e){this.onAction("actionCaptured",t=>e(t))}wn(e,t){if(null==(null==t?void 0:t.steps))return!1;for(var i of t.steps)if(this.fn(e,i))return!0;return!1}onAction(e,t){return this.vn.on(e,t)}gn(e,t){if(null!=t&&t.url){var i,r=null==e||null==(i=e.properties)?void 0:i.$current_url;if(!r||"string"!=typeof r)return!1;if(!Fa(r,t.url,t.url_matching||"contains"))return!1}return!0}mn(e,t){return!!this.Sn(e,t)&&!!this.kn(e,t)&&!!this.Cn(e,t)}Sn(e,t){var i;if(null==t||!t.href)return!0;var r=this.In(e);if(r.length>0)return r.some(e=>Fa(e.href,t.href,t.href_matching||"exact"));var s,n=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";return!!n&&Fa((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",t.href,t.href_matching||"exact")}kn(e,t){var i;if(null==t||!t.text)return!0;var r=this.In(e);if(r.length>0)return r.some(e=>Fa(e.text,t.text,t.text_matching||"exact")||Fa(e.$el_text,t.text,t.text_matching||"exact"));var s,n,o,a=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";return!!a&&(s=function(e){for(var t,i=[],r=/(?::|")text="(.*?)"/g;!ge(t=r.exec(e));)i.includes(t[1])||i.push(t[1]);return i}(a),n=t.text,o=t.text_matching||"exact",s.some(e=>Fa(e,n,o)))}Cn(e,t){var i,r;if(null==t||!t.selector)return!0;var s=null==e||null==(i=e.properties)?void 0:i.$element_selectors;if(null!=s&&s.includes(t.selector))return!0;var n=(null==e||null==(r=e.properties)?void 0:r.$elements_chain)||"";if(t.selector_regex&&n)try{return new RegExp(t.selector_regex).test(n)}catch(e){return!1}return!1}In(e){var t;return null==(null==e||null==(t=e.properties)?void 0:t.$elements)?[]:null==e?void 0:e.properties.$elements}yn(e,t){return null==t||!t.properties||0===t.properties.length||eo(t.properties.reduce((e,t)=>{var i=ae(t.value)?t.value.map(String):null!=t.value?[String(t.value)]:[];return e[t.key]={values:i,operator:t.operator||"exact"},e},{}),null==e?void 0:e.properties)}},Ra=class{constructor(e){this._instance=e,this.Tn=new Map,this.En=new Map,this.Mn=new Map}Pn(e,t){return!!e&&eo(e.propertyFilters,null==t?void 0:t.properties)}Rn(e,t){var i=new Map;return e.forEach(e=>{var r;null==(r=e.conditions)||null==(r=r[t])||null==(r=r.values)||r.forEach(t=>{if(null!=t&&t.name){var r=i.get(t.name)||[];r.push(e.id),i.set(t.name,r)}})}),i}On(e,t,i){var r=(i===Os?this.Tn:this.En).get(e),s=[];return this.Ln(e=>{s=e.filter(e=>null==r?void 0:r.includes(e.id))}),s.filter(r=>{var s,n=null==(s=r.conditions)||null==(s=s[i])||null==(s=s.values)?void 0:s.find(t=>t.name===e);return this.Pn(n,t)})}register(e){var t;he(null==(t=this._instance)?void 0:t._addCaptureHook)||(this.Fn(e),this.An(e))}An(e){var t=e.filter(e=>{var t,i;return(null==(t=e.conditions)?void 0:t.actions)&&(null==(i=e.conditions)||null==(i=i.actions)||null==(i=i.values)?void 0:i.length)>0});0!==t.length&&(null==this.Nn&&(this.Nn=new Ia(this._instance),this.Nn.init(),this.Nn.xn(e=>{this.onAction(e)})),t.forEach(e=>{var t,i,r,s,n;e.conditions&&null!=(t=e.conditions)&&t.actions&&null!=(i=e.conditions)&&null!=(i=i.actions)&&i.values&&(null==(r=e.conditions)||null==(r=r.actions)||null==(r=r.values)?void 0:r.length)>0&&(null==(s=this.Nn)||s.register(e.conditions.actions.values),null==(n=e.conditions)||null==(n=n.actions)||null==(n=n.values)||n.forEach(t=>{if(t&&t.name){var i=this.Mn.get(t.name);i&&i.push(e.id),this.Mn.set(t.name,i||[e.id])}}))}))}Fn(e){var t,i=e.filter(e=>{var t,i;return(null==(t=e.conditions)?void 0:t.events)&&(null==(i=e.conditions)||null==(i=i.events)||null==(i=i.values)?void 0:i.length)>0}),r=e.filter(e=>{var t,i;return(null==(t=e.conditions)?void 0:t.cancelEvents)&&(null==(i=e.conditions)||null==(i=i.cancelEvents)||null==(i=i.values)?void 0:i.length)>0});0===i.length&&0===r.length||(null==(t=this._instance)||t._addCaptureHook((e,t)=>{this.onEvent(e,t)}),this.Tn=this.Rn(e,Os),this.En=this.Rn(e,Cs))}onEvent(e,t){var i,r=this.le(),s=this.$n(),n=this.Dn(),o=(null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[s])||[];if(n===e&&t&&o.length>0){var a,l;r.info("event matched, removing item from activated items",{event:e,eventPayload:t,existingActivatedItems:o});var u=(null==t||null==(a=t.properties)?void 0:a.$survey_id)||(null==t||null==(l=t.properties)?void 0:l.$product_tour_id);if(u){var c=o.indexOf(u);0>c||(o.splice(c,1),this.qn(o))}}else{if(this.En.has(e)){var h=this.On(e,t,Cs);h.length>0&&(r.info("cancel event matched, cancelling items",{event:e,itemsToCancel:h.map(e=>e.id)}),h.forEach(e=>{var t=o.indexOf(e.id);0>t||o.splice(t,1),this.jn(e.id)}),this.qn(o))}if(this.Tn.has(e)){r.info("event name matched",{event:e,eventPayload:t,items:this.Tn.get(e)});var d=this.On(e,t,Os);this.qn(o.concat(d.map(e=>e.id)||[]))}}}onAction(e){var t,i=this.$n(),r=(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i])||[];this.Mn.has(e)&&this.qn(r.concat(this.Mn.get(e)||[]))}qn(e){var t=this.le(),i=[...new Set(e)].filter(e=>!this.Hn(e));t.info("updating activated items",{activatedItems:i}),this.Un(i)}getActivatedIds(){var e,t=this.$n();return(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t])||[]}getEventToItemsMap(){return this.Tn}Bn(){return this.Nn}},Ma=class extends Ra{constructor(e){super(e)}$n(){return Vi}Dn(){return Ls}Ln(e){var t;null==(t=this._instance)||t.getSurveys(e)}jn(e){var t;null==(t=this._instance)||t.cancelPendingSurvey(e)}le(){return oo}Un(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({[Vi]:e})}Hn(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},Oa="SDK is not enabled or survey functionality is not yet loaded",Ca="Disabled. Not loading surveys.",Ta=null!=P&&P.location?cs(P.location.hash,"__posthog")||cs(location.hash,"state"):null,Aa="_postHogToolbarParams",qa=hi("[Toolbar]"),La=hi("[FeatureFlags]"),Da=hi("[FeatureFlags]",{debugEnabled:!0}),Na="\" failed. Feature flags didn't load in time.",ja=e=>{for(var t={},i=0;e.length>i;i++)t[e[i]]=!0;return t},Ha=e=>{var t={};for(var[i,r]of kr(e||{}))r&&(t[i]=r);return t},za=hi("[Error tracking]"),Ua="Refusing to render web experiment since the viewer is a likely bot",Ba={icontains:(e,t)=>!!P&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!P&&-1===t.href.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>!!P&&Yn(t.href,e),not_regex:(e,t)=>!!P&&!Yn(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e},Va=hi("[Conversations]"),Wa="Conversations not available yet.",Ga={featureFlags:class{constructor(e){this.Kn=!1,this.Yn=!1,this.Xn=!1,this.es=!1,this.ts=!1,this.rs=!1,this.ns=!1,this.ss=!1,this._instance=e,this.featureFlagEventHandlers=[]}get qt(){return this._instance.config}get ni(){return this._instance.persistence}os(e){return this._instance.get_property(e)}us(){var e,t;return null!==(e=null==(t=this.ni)?void 0:t.wr(this.qt.feature_flag_cache_ttl_ms))&&void 0!==e&&e}ls(){return!!this.us()&&(this.ss||this.Xn||(this.ss=!0,La.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}hs(){var e,t=null!==(e=this.qt.evaluation_contexts)&&void 0!==e?e:this.qt.evaluation_environments;return!this.qt.evaluation_environments||this.qt.evaluation_contexts||this.ns||(La.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.ns=!0),null!=t&&t.length?t.filter(e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||La.error("Invalid evaluation context found:",e,"Expected non-empty string"),t}):[]}cs(){return this.hs().length>0}ds(){var e=this.qt.flag_keys;if(!he(e)){if(ae(e))return e.filter(e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||La.error("Invalid flag key found:",e,"Expected non-empty string"),t});La.error("Invalid flag_keys found:",e,"Expected array of non-empty strings")}}initialize(){var e,t,{config:i}=this._instance,r=null!==(e=null==(t=i.bootstrap)?void 0:t.featureFlags)&&void 0!==e?e:{};if(Object.keys(r).length){var s,n,o=null!==(s=null==(n=i.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==s?s:{},a=Object.keys(r).filter(e=>!!r[e]).reduce((e,t)=>(e[t]=r[t]||!1,e),{}),l=Object.keys(o).filter(e=>a[e]).reduce((e,t)=>(o[t]&&(e[t]=o[t]),e),{});this.receivedFeatureFlags({featureFlags:a,featureFlagPayloads:l})}}updateFlags(e,t,i){var r=null!=i&&i.merge?this.getFlagVariants():{},s=null!=i&&i.merge?this.getFlagPayloads():{},n=z({},r,e),o=z({},s,t),a={};for(var[l,u]of Object.entries(n)){var c="string"==typeof u;a[l]={key:l,enabled:!!c||Boolean(u),variant:c?u:void 0,reason:void 0,metadata:he(null==o?void 0:o[l])?void 0:{id:0,version:void 0,description:void 0,payload:o[l]}}}this.receivedFeatureFlags({flags:a})}get hasLoadedFlags(){return this.Yn}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this.os(Li),t=this.os(ji),i=this.os(Hi);if(!i&&!t)return e||{};var r=Er({},e||{}),s=[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])];for(var n of s){var o,a,l=r[n],u=null==t?void 0:t[n],c=he(u)?null!==(o=null==l?void 0:l.enabled)&&void 0!==o&&o:!!u,h=he(u)?l.variant:"string"==typeof u?u:void 0,d=null==i?void 0:i[n],p=z({},l,{enabled:c,variant:c?null!=h?h:null==l?void 0:l.variant:void 0});c!==(null==l?void 0:l.enabled)&&(p.original_enabled=null==l?void 0:l.enabled),h!==(null==l?void 0:l.variant)&&(p.original_variant=null==l?void 0:l.variant),d&&(p.metadata=z({},null==l?void 0:l.metadata,{payload:d,original_payload:null==l||null==(a=l.metadata)?void 0:a.payload})),r[n]=p}return this.Kn||(La.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:r}),this.Kn=!0),r}getFlagVariants(){var e=this.os(Ti),t=this.os(ji);if(!t)return e||{};for(var i=Er({},e),r=Object.keys(t),s=0;r.length>s;s++)i[r[s]]=t[r[s]];return this.Kn||(La.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this.Kn=!0),i}getFlagPayloads(){var e=this.os(Di),t=this.os(Hi);if(!t)return e||{};for(var i=Er({},e||{}),r=Object.keys(t),s=0;r.length>s;s++)i[r[s]]=t[r[s]];return this.Kn||(La.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this.Kn=!0),i}reloadFeatureFlags(){this.es||this.qt.advanced_disable_feature_flags||this.vs||(this._instance.Li.emit("featureFlagsReloading",!0),this.vs=setTimeout(()=>{this.fs()},5))}ps(){clearTimeout(this.vs),this.vs=void 0}ensureFlagsLoaded(){this.Yn||this.Xn||this.vs||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.es=e}fs(e){var t;if(this.ps(),!this._instance.Lr())if(this.Xn)this.ts=!0;else{var i=this.qt.token,r=this.os(gi),s={token:i,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:z({},(null==(t=this.ni)?void 0:t.get_initial_props())||{},this.os(zi)||{}),group_properties:this.os(Ui),timezone:ks()};ve(r)||he(r)||(s.$device_id=r),(null!=e&&e.disableFlags||this.qt.advanced_disable_feature_flags)&&(s.disable_flags=!0),this.cs()&&(s.evaluation_contexts=this.hs());var n=this.ds();he(n)||(s.flag_keys=n);var o=!!this.qt.advanced_only_evaluate_survey_feature_flags,a=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.qt.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.Xn=!0,this._instance._send_request({method:"POST",url:a,data:s,compression:this.qt.disable_compression?void 0:Qs,timeout:this.qt.feature_flag_request_timeout_ms,callback:e=>{var t,i,r,n=!0;if(200===e.statusCode&&(this.ts||(this.$anon_distinct_id=void 0),n=!1),this.Xn=!1,!s.disable_flags||this.ts){this.rs=!n;var a=[];e.error?e.error instanceof Error?a.push("AbortError"===e.error.name?"timeout":"connection_error"):a.push("unknown_error"):200!==e.statusCode&&a.push("api_error_"+e.statusCode),null!=(t=e.json)&&t.errorsWhileComputingFlags&&a.push("errors_while_computing_flags");var l,u=!(null==(i=e.json)||null==(i=i.quotaLimited)||!i.includes("feature_flags"));u&&a.push("quota_limited"),null==(r=this.ni)||r.register({[Ki]:a}),u?La.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):(s.disable_flags||this.receivedFeatureFlags(null!==(l=e.json)&&void 0!==l?l:{},n,{partialResponse:o}),this.ts&&(this.ts=!1,this.fs()))}}})}}getFeatureFlag(e,t){var i;if(void 0===t&&(t={}),!t.fresh||this.rs)if(this.Yn||this.getFlags()&&this.getFlags().length>0){if(!this.ls()){var r=this.getFeatureFlagResult(e,t);return null!==(i=null==r?void 0:r.variant)&&void 0!==i?i:null==r?void 0:r.enabled}}else La.warn('getFeatureFlag for key "'+e+Na)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return null==t?void 0:t.payload}getFeatureFlagResult(e,t){if(void 0===t&&(t={}),!t.fresh||this.rs)if(this.Yn||this.getFlags()&&this.getFlags().length>0){if(!this.ls()){var i=this.getFlagVariants(),r=e in i,s=i[e],n=this.getFlagPayloads()[e],o=String(s),a=this.os(Ni)||void 0,l=this.os(Yi)||void 0,u=this.os(Gi)||{};if(this.qt.advanced_feature_flags_dedup_per_session){var c,h=this._instance.get_session_id(),d=this.os(Xi);h&&h!==d&&(u={},null==(c=this.ni)||c.register({[Gi]:u,[Xi]:h}))}if((t.send_event||!("send_event"in t))&&(!(e in u)||!u[e].includes(o))){var p,v,g,_,f,m,y,b,w,x;ae(u[e])?u[e].push(o):u[e]=[o],null==(p=this.ni)||p.register({[Gi]:u});var E=this.getFeatureFlagDetails(e),k=[...null!==(v=this.os(Ki))&&void 0!==v?v:[]];he(s)&&k.push("flag_missing");var S={$feature_flag:e,$feature_flag_response:s,$feature_flag_payload:n||null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(null==(g=this.qt.bootstrap)||null==(g=g.featureFlags)?void 0:g[e])||null,$feature_flag_bootstrapped_payload:(null==(_=this.qt.bootstrap)||null==(_=_.featureFlagPayloads)?void 0:_[e])||null,$used_bootstrap_value:!this.rs};he(null==E||null==(f=E.metadata)?void 0:f.version)||(S.$feature_flag_version=E.metadata.version);var P,F=null!==(m=null==E||null==(y=E.reason)?void 0:y.description)&&void 0!==m?m:null==E||null==(b=E.reason)?void 0:b.code;F&&(S.$feature_flag_reason=F),null!=E&&null!=(w=E.metadata)&&w.id&&(S.$feature_flag_id=E.metadata.id),he(null==E?void 0:E.original_variant)&&he(null==E?void 0:E.original_enabled)||(S.$feature_flag_original_response=he(E.original_variant)?E.original_enabled:E.original_variant),null!=E&&null!=(x=E.metadata)&&x.original_payload&&(S.$feature_flag_original_payload=null==E||null==(P=E.metadata)?void 0:P.original_payload),k.length&&(S.$feature_flag_error=k.join(",")),this._instance.capture("$feature_flag_called",S)}if(r){var $=n;if(!he(n))try{$=JSON.parse(n)}catch(e){}return{key:e,enabled:!!s,variant:"string"==typeof s?s:void 0,payload:$}}}}else La.warn('getFeatureFlagResult for key "'+e+Na)}getRemoteConfigPayload(e,t){var i=this.qt.token,r={distinct_id:this._instance.get_distinct_id(),token:i};this.cs()&&(r.evaluation_contexts=this.hs());var s=this.ds();he(s)||(r.flag_keys=s),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:r,compression:this.qt.disable_compression?void 0:Qs,timeout:this.qt.feature_flag_request_timeout_ms,callback(i){var r,s=null==(r=i.json)?void 0:r.featureFlagPayloads;t((null==s?void 0:s[e])||void 0)}})}isFeatureEnabled(e,t){if(void 0===t&&(t={}),!t.fresh||this.rs){if(this.Yn||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlag(e,t);return he(i)?void 0:!!i}La.warn('isFeatureEnabled for key "'+e+Na)}}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t,i){if(this.ni){this.Yn=!0;var r=this.getFlagVariants(),s=this.getFlagPayloads(),n=this.getFlagsWithDetails();!function(e,t,i,r,s,n){void 0===i&&(i={}),void 0===r&&(r={}),void 0===s&&(s={});var o,a,l=((a=(o=e).flags)?(o.featureFlags=Object.fromEntries(Object.keys(a).map(e=>{var t;return[e,null!==(t=a[e].variant)&&void 0!==t?t:a[e].enabled]})),o.featureFlagPayloads=Object.fromEntries(Object.keys(a).filter(e=>a[e].enabled).filter(e=>{var t;return null==(t=a[e].metadata)?void 0:t.payload}).map(e=>{var t;return[e,null==(t=a[e].metadata)?void 0:t.payload]}))):La.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),o),u=l.flags,c=l.featureFlags,h=l.featureFlagPayloads;if(c){var d=e.requestId,p=e.evaluatedAt;if(ae(c)){La.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var v={};if(c)for(var g=0;c.length>g;g++)v[c[g]]=!0;t&&t.register({[Ai]:c,[Ti]:v})}else{var _=c,f=h,m=u;if(null!=n&&n.partialResponse)_=z({},i,_),f=z({},r,f),m=z({},s,m);else if(e.errorsWhileComputingFlags)if(u){var y=new Set(Object.keys(u).filter(e=>{var t;return!(null!=(t=u[e])&&t.failed)}));_=z({},i,Object.fromEntries(Object.entries(_).filter(e=>{var[t]=e;return y.has(t)}))),f=z({},r,Object.fromEntries(Object.entries(f||{}).filter(e=>{var[t]=e;return y.has(t)}))),m=z({},s,Object.fromEntries(Object.entries(m||{}).filter(e=>{var[t]=e;return y.has(t)})))}else _=z({},i,_),f=z({},r,f),m=z({},s,m);t&&t.register(z({[Ai]:Object.keys(Ha(_)),[Ti]:_||{},[Di]:f||{},[Li]:m||{}},d?{[Ni]:d}:{},p?{[Yi]:p}:{}))}}}(e,this.ni,r,s,n,i),t||(this.ss=!1),this.gs(t)}}override(e,t){void 0===t&&(t=!1),La.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this.ni)return La.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===e)return this.ni.unregister(ji),this.ni.unregister(Hi),this.gs(),Da.info("All overrides cleared");if(ae(e)){var t=ja(e);return this.ni.register({[ji]:t}),this.gs(),Da.info("Flag overrides set",{flags:e})}if(e&&"object"==typeof e&&("flags"in e||"payloads"in e)){var i,r=e;if(this.Kn=Boolean(null!==(i=r.suppressWarning)&&void 0!==i&&i),"flags"in r)if(!1===r.flags)this.ni.unregister(ji),Da.info("Flag overrides cleared");else if(r.flags){if(ae(r.flags)){var s=ja(r.flags);this.ni.register({[ji]:s})}else this.ni.register({[ji]:r.flags});Da.info("Flag overrides set",{flags:r.flags})}return"payloads"in r&&(!1===r.payloads?(this.ni.unregister(Hi),Da.info("Payload overrides cleared")):r.payloads&&(this.ni.register({[Hi]:r.payloads}),Da.info("Payload overrides set",{payloads:r.payloads}))),void this.gs()}if(e&&"object"==typeof e)return this.ni.register({[ji]:e}),this.gs(),Da.info("Flag overrides set",{flags:e});La.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.Yn){var{flags:t,flagVariants:i}=this.ys();e(t,i)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var r,s=(this.os(qi)||[]).find(t=>t.flagKey===e),n={["$feature_enrollment/"+e]:t},o={$feature_flag:e,$feature_enrollment:t,$set:n};s&&(o.$early_access_feature_name=s.name),i&&(o.$feature_enrollment_stage=i),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(n,!1);var a=z({},this.getFlagVariants(),{[e]:t});null==(r=this.ni)||r.register({[Ai]:Object.keys(Ha(a)),[Ti]:a}),this.gs()}getEarlyAccessFeatures(e,t,i){void 0===t&&(t=!1);var r=this.os(qi),s=i?"&"+i.map(e=>"stage="+e).join("&"):"";if(r&&!t)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.qt.token+s),method:"GET",callback:t=>{var i,r;if(t.json){var s=t.json.earlyAccessFeatures;return null==(i=this.ni)||i.unregister(qi),null==(r=this.ni)||r.register({[qi]:s}),e(s)}}})}ys(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(e=>t[e]),flagVariants:Object.keys(t).filter(e=>t[e]).reduce((e,i)=>(e[i]=t[i],e),{})}}gs(e){var{flags:t,flagVariants:i}=this.ys();this.featureFlagEventHandlers.forEach(r=>r(t,i,{errorsLoading:e}))}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=this.os(zi)||{},r=(null==e?void 0:e.$set)||(null!=e&&e.$set_once?{}:e),s=null==e?void 0:e.$set_once,n={};if(s)for(var o in s)({}).hasOwnProperty.call(s,o)&&(o in i||(n[o]=s[o]));this._instance.register({[zi]:z({},i,n,r)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(zi)}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=this.os(Ui)||{};0!==Object.keys(i).length&&Object.keys(i).forEach(t=>{i[t]=z({},i[t],e[t]),delete e[t]}),this._instance.register({[Ui]:z({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.os(Ui)||{};this._instance.register({[Ui]:z({},t,{[e]:{}})})}else this._instance.unregister(Ui)}reset(){this.Yn=!1,this.Xn=!1,this.es=!1,this.ts=!1,this.rs=!1,this.$anon_distinct_id=void 0,this.ps(),this.Kn=!1}}},Xa={sessionRecording:class{get qt(){return this._instance.config}get ni(){return this._instance.persistence}get started(){var e;return!(null==(e=this.bs)||!e.isStarted)}get status(){var e,t;return this._s===fa||this._s===ma?this._s:null!==(e=null==(t=this.bs)?void 0:t.status)&&void 0!==e?e:this._s}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this._s=ga,this.ws=void 0,this._instance=e,!this._instance.sessionManager)throw ba.error("started without valid sessionManager"),new Error(ya+" started without valid sessionManager. This is a bug.");if(this.qt.cookieless_mode===hr)throw new Error(ya+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get xs(){var e,t=!(null==(e=this._instance.get_property(Fi))||!e.enabled),i=!this.qt.disable_session_recording,r=this.qt.disable_session_recording||this._instance.consent.isOptedOut();return P&&t&&i&&!r}startIfEnabledOrStop(e){var t;if(!this.xs||null==(t=this.bs)||!t.isStarted){var i=!he(Object.assign)&&!he(Array.from);this.xs&&i?(this.Ss(e),ba.info("starting")):(this._s=ga,this.stopRecording())}}Ss(e){var t,i,r;this.xs&&(this._s!==fa&&this._s!==ma&&(this._s=_a),null!=L&&null!=(t=L.__PosthogExtensions__)&&null!=(t=t.rrweb)&&t.record&&null!=(i=L.__PosthogExtensions__)&&i.initSessionRecording?this.ks(e):null==(r=L.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.Cs,t=>{if(t)return ba.error("could not load recorder",t);this.ks(e)}))}stopRecording(){var e,t;null==(e=this.ws)||e.call(this),this.ws=void 0,null==(t=this.bs)||t.stop()}Is(){var e,t;null==(e=this.ws)||e.call(this),this.ws=void 0,null==(t=this.bs)||t.discard()}Ts(){var e;null==(e=this.ni)||e.unregister(Ci)}Es(e,t){if(ge(e))return null;var i,r=_e(e)?e:parseFloat(e);return"number"!=typeof(i=r)||!Number.isFinite(i)||0>i||i>1?(ba.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):r}Ms(e){if(this.ni){var t,i,r=this.ni,s=()=>{var t,i=!1===e.sessionRecording?void 0:e.sessionRecording,s=this.Es(null==(t=this.qt.session_recording)?void 0:t.sampleRate,"session_recording.sampleRate"),n=this.Es(null==i?void 0:i.sampleRate,"remote config sampleRate"),o=null!=s?s:n;ge(o)&&this.Ts();var a=null==i?void 0:i.minimumDurationMilliseconds;r.register({[Fi]:z({cache_timestamp:Date.now(),enabled:!!i},i,{networkPayloadCapture:z({capturePerformance:e.capturePerformance},null==i?void 0:i.networkPayloadCapture),canvasRecording:{enabled:null==i?void 0:i.recordCanvas,fps:null==i?void 0:i.canvasFps,quality:null==i?void 0:i.canvasQuality},sampleRate:o,minimumDurationMilliseconds:he(a)?null:a,endpoint:null==i?void 0:i.endpoint,triggerMatchType:null==i?void 0:i.triggerMatchType,masking:null==i?void 0:i.masking,urlTriggers:null==i?void 0:i.urlTriggers,version:null==i?void 0:i.version,triggerGroups:null==i?void 0:i.triggerGroups})})};s(),null==(t=this.ws)||t.call(this),this.ws=null==(i=this._instance.sessionManager)?void 0:i.onSessionId(s)}}onRemoteConfig(e){return"sessionRecording"in e?!1===e.sessionRecording?(this.Ms(e),void this.Is()):(this.Ms(e),void this.startIfEnabledOrStop()):(this._s===fa&&(this._s=ma,ba.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t){var i;void 0===t&&(t="log"),null!=(i=this.bs)&&i.log?this.bs.log(e,t):ba.warn("log called before recorder was ready")}get Cs(){var e,t,i=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.get_property(Fi);return(null==i||null==(t=i.scriptConfig)?void 0:t.script)||"lazy-recorder"}Ps(){var e,t,i=this._instance.get_property(Fi);if(!i)return!1;try{t="object"==typeof i?i:JSON.parse(i)}catch(e){return ba.warn("persisted remote config for session recording is invalid and will be ignored",e),!1}var r=null!==(e=t.cache_timestamp)&&void 0!==e?e:Date.now();return 36e5>=Date.now()-r}ks(e){var t,i;if(null==(t=L.__PosthogExtensions__)||!t.initSessionRecording)return ba.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[lr]:!0});if(this.bs||(this.bs=null==(i=L.__PosthogExtensions__)?void 0:i.initSessionRecording(this._instance),this.bs._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Ps()){if(this._s===ma||this._s===fa)return;return this._s=fa,ba.info("persisted remote config is stale, requesting fresh config before starting"),void new Js(this._instance).load()}this._s=_a,this.bs.start(e)}onRRwebEmit(e){var t;null==(t=this.bs)||null==t.onRRwebEmit||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.bs||null==(t=this.ni)||t.register({[Ii]:!0}),null==(e=this.bs)||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.bs||null==(t=this.ni)||t.register({[$i]:!0}),null==(e=this.bs)||e.overrideSampling()}overrideTrigger(e){var t,i;this.bs||null==(i=this.ni)||i.register({["url"===e?Ri:Mi]:!0}),null==(t=this.bs)||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return(null==(e=this.bs)?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var i;return!(null==(i=this.bs)||!i.tryAddCustomEvent(e,t))}}},Ka={autocapture:class{constructor(e){this.Rs=!1,this.Os=null,this.Ls=!1,this.instance=e,this.rageclicks=new na(e.config.rageclick),this.Fs=null}initialize(){this.startIfEnabled()}get qt(){var e,t,i=ue(this.instance.config.autocapture)?this.instance.config.autocapture:{};return i.url_allowlist=null==(e=i.url_allowlist)?void 0:e.map(e=>new RegExp(e)),i.url_ignorelist=null==(t=i.url_ignorelist)?void 0:t.map(e=>new RegExp(e)),i}As(){if(this.isBrowserSupported()){if(P&&R){var e=e=>{e=e||(null==P?void 0:P.event);try{this.Ns(e)}catch(e){aa.error("Failed to capture event",e)}};if(Rr(R,"submit",e,{capture:!0}),Rr(R,"change",e,{capture:!0}),Rr(R,"click",e,{capture:!0}),this.qt.capture_copied_text){var t=e=>{e=e||(null==P?void 0:P.event);try{this.Ns(e,oa)}catch(e){aa.error("Failed to capture copy/cut event",e)}};Rr(R,"copy",t,{capture:!0}),Rr(R,"cut",t,{capture:!0})}}}else aa.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.Rs&&(this.As(),this.Rs=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.Ls=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[mi]:!!e.autocapture_opt_out}),this.Os=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.Fs=e}getElementSelectors(e){var t,i=[];return null==(t=this.Fs)||t.forEach(t=>{var r=null==R?void 0:R.querySelectorAll(t);null==r||r.forEach(r=>{e===r&&i.push(t)})}),i}get isEnabled(){var e,t,i=null==(e=this.instance.persistence)?void 0:e.props[mi];if(ve(this.Os)&&!me(i)&&!this.instance.Lr())return!1;var r=null!==(t=this.Os)&&void 0!==t?t:!!i;return!!this.instance.config.autocapture&&!r}Ns(e,t){if(void 0===t&&(t="$autocapture"),this.isEnabled){var i,r=Do(e);Mo(r)&&(r=r.parentNode||null),"$autocapture"===t&&"click"===e.type&&e instanceof MouseEvent&&this.instance.config.rageclick&&null!=(i=this.rageclicks)&&i.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime())&&function(e,t){if(!P||Bo(e))return!1;var i,r,s;if(me(t)?(i=!!t&&Uo,r=void 0):(i=null!==(s=null==t?void 0:t.css_selector_ignorelist)&&void 0!==s?s:Uo,r=null==t?void 0:t.content_ignorelist),!1===i)return!1;var{targetElementList:n}=Vo(e,!1);return!function(e,t){if(!1===e||he(e))return!1;var i;if(!0===e)i=zo;else{if(!ae(e))return!1;if(e.length>10)return ci.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;i=e.map(e=>e.toLowerCase())}return t.some(e=>{var{safeText:t,ariaLabel:r}=e;return i.some(e=>t.includes(e)||r.includes(e))})}(r,n.map(e=>{var t;return{safeText:Lo(e).toLowerCase(),ariaLabel:(null==(t=e.getAttribute("aria-label"))?void 0:t.toLowerCase().trim())||""}}))&&!jo(n,i)}(r,this.instance.config.rageclick)&&this.Ns(e,"$rageclick");var s=t===oa;if(r&&function(e,t,i,r,s){var n,o,a,l;if(void 0===i&&(i=void 0),!P||Bo(e))return!1;if(null!=(n=i)&&n.url_allowlist&&!To(i.url_allowlist))return!1;if(null!=(o=i)&&o.url_ignorelist&&To(i.url_ignorelist))return!1;if(null!=(a=i)&&a.dom_event_allowlist){var u=i.dom_event_allowlist;if(u&&!u.some(e=>t.type===e))return!1}var{parentIsUsefulElement:c,targetElementList:h}=Vo(e,r);if(!function(e,t){var i=null==t?void 0:t.element_allowlist;if(he(i))return!0;var r,s=function(e){if(i.some(t=>e.tagName.toLowerCase()===t))return{v:!0}};for(var n of e)if(r=s(n))return r.v;return!1}(h,i))return!1;if(!jo(h,null==(l=i)?void 0:l.css_selector_allowlist))return!1;var d=P.getComputedStyle(e);if(d&&"pointer"===d.getPropertyValue("cursor")&&"click"===t.type)return!0;var p=e.tagName.toLowerCase();switch(p){case"html":return!1;case"form":return(s||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(t.type)>=0;default:return c?(s||["click"]).indexOf(t.type)>=0:(s||["click"]).indexOf(t.type)>=0&&(No.indexOf(p)>-1||"true"===e.getAttribute("contenteditable"))}}(r,e,this.qt,s,s?["copy","cut"]:void 0)){var{props:n,explicitNoCapture:o}=function(e,t){var i,r,{e:s,maskAllElementAttributes:n,maskAllText:o,elementAttributeIgnoreList:a,elementsChainAsString:l}=t;if(!Io(e))return{props:{}};for(var u=[e],c=e;c.parentNode&&!Ro(c,"body");)if(Oo(c.parentNode))u.push(c.parentNode.host),c=c.parentNode.host;else{if(!Io(c.parentNode))break;u.push(c.parentNode),c=c.parentNode}var h,d,p=[],v={},g=!1,_=!1;if(xr(u,e=>{var t=Wo(e);if(Ro(e,"a")){var i=e.getAttribute("href");g=t&&!!i&&ea(i)&&i}te(Ao(e),"ph-no-capture")&&(_=!0),p.push(function(e,t,i,r){var s=e.tagName.toLowerCase(),n={tag_name:s};No.indexOf(s)>-1&&!i&&(n.$el_text="a"===s.toLowerCase()||"button"===s.toLowerCase()?la(1024,ta(e)):la(1024,Lo(e)));var o=Ao(e);o.length>0&&(n.classes=o.filter(function(e){return""!==e})),xr(e.attributes,function(i){var s;if((!Go(e)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==r||!r.includes(i.name))&&!t&&ea(i.value)&&(!de(s=i.name)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7))){var o=i.value;"class"===i.name&&(o=Co(o).join(" ")),n["attr__"+i.name]=la(1024,o)}});for(var a=1,l=1,u=e;u=ua(u);)a++,u.tagName===e.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}(e,n,o,a));var r=function(e){if(!Wo(e))return{};var t={};return xr(e.attributes,function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){var i=e.name.replace("data-ph-capture-attribute-",""),r=e.value;i&&r&&ea(r)&&(t[i]=r)}}),t}(e);Er(v,r)}),_)return{props:{},explicitNoCapture:_};if(o||(p[0].$el_text=Ro(e,"a")||Ro(e,"button")?ta(e):Lo(e)),g){var f,m;p[0].attr__href=g;var y=null==(f=as(g))?void 0:f.host,b=null==P||null==(m=P.location)?void 0:m.host;y&&b&&y!==b&&(h=g)}return{props:Er({$event_type:s.type,$ce_version:1},l?{}:{$elements:p},{$elements_chain:(d=p,function(e){return e.map(e=>{var t,i,r="";if(e.tag_name&&(r+=e.tag_name),e.attr_class)for(var s of(e.attr_class.sort(),e.attr_class))r+="."+s.replace(/"/g,"");var n=z({},e.text?{text:e.text}:{},{"nth-child":null!==(t=e.nth_child)&&void 0!==t?t:0,"nth-of-type":null!==(i=e.nth_of_type)&&void 0!==i?i:0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),o={};return kr(n).sort((e,t)=>{var[i]=e,[r]=t;return i.localeCompare(r)}).forEach(e=>{var[t,i]=e;return o[ra(t.toString())]=ra(i.toString())}),(r+=":")+kr(o).map(e=>{var[t,i]=e;return t+'="'+i+'"'}).join("")}).join(";")}(function(e){return e.map(e=>{var t,i,r={text:null==(t=e.$el_text)?void 0:t.slice(0,400),tag_name:e.tag_name,href:null==(i=e.attr__href)?void 0:i.slice(0,2048),attr_class:sa(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return kr(e).filter(e=>{var[t]=e;return 0===t.indexOf("attr__")}).forEach(e=>{var[t,i]=e;return r.attributes[t]=i}),r})}(d)))},null!=(i=p[0])&&i.$el_text?{$el_text:null==(r=p[0])?void 0:r.$el_text}:{},h&&"click"===s.type?{$external_click_url:h}:{},v)}}(r,{e:e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.qt.element_attribute_ignorelist,elementsChainAsString:this.Ls});if(o)return!1;var a=this.getElementSelectors(r);if(a&&a.length>0&&(n.$element_selectors=a),t===oa){var l,u=qo(null==P||null==(l=P.getSelection())?void 0:l.toString()),c=e.type||"clipboard";if(!u)return!1;n.$selected_content=u,n.$copy_type=c}return this.instance.capture(t,n),!0}}}isBrowserSupported(){return le(null==R?void 0:R.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this.$s=(null==P||null==(t=P.location)?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(ci.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.Ds&&this.Ds(),this.Ds=void 0,ci.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(P&&P.history){var i=this;null!=(e=P.history.pushState)&&e.__posthog_wrapped__||ha(P.history,"pushState",e=>function(t,r,s){e.call(this,t,r,s),i.qs("pushState")}),null!=(t=P.history.replaceState)&&t.__posthog_wrapped__||ha(P.history,"replaceState",e=>function(t,r,s){e.call(this,t,r,s),i.qs("replaceState")}),this.js()}}qs(e){try{var t,i=null==P||null==(t=P.location)?void 0:t.pathname;if(!i)return;i!==this.$s&&this.isEnabled&&this._instance.capture(fr,{navigation_type:e}),this.$s=i}catch(t){ci.error("Error capturing "+e+" pageview",t)}}js(){if(!this.Ds){var e=()=>{this.qs("popstate")};Rr(P,"popstate",e),this.Ds=()=>{P&&P.removeEventListener("popstate",e)}}}},heatmaps:class{get qt(){return this.instance.config}constructor(e){var t;this.Hs=!1,this.Rs=!1,this.Us=null,this.instance=e,this.Hs=!(null==(t=this.instance.persistence)||!t.props[yi]),this.rageclicks=new na(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return ue(this.qt.capture_heatmaps)&&this.qt.capture_heatmaps.flush_interval_milliseconds&&(e=this.qt.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return ge(this.qt.capture_heatmaps)?ge(this.qt.enable_heatmaps)?this.Hs:this.qt.enable_heatmaps:!1!==this.qt.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.Rs)return;wa.info("starting..."),this.Bs(),this.At()}else{var e;clearInterval(null!==(e=this.Us)&&void 0!==e?e:void 0),this.zs(),this.getAndClearBuffer()}}onRemoteConfig(e){if("heatmaps"in e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[yi]:t}),this.Hs=t,this.startIfEnabled()}}getAndClearBuffer(){var e=this.M;return this.M=void 0,e}Vs(e){this.Mt(e.originalEvent,"deadclick")}At(){this.Us&&clearInterval(this.Us),this.Us="visible"===(null==R?void 0:R.visibilityState)?setInterval(this.Zr.bind(this),this.flushIntervalMilliseconds):null}Bs(){P&&R&&(this.Ws=this.Zr.bind(this),Rr(P,_r,this.Ws),this.Zs=e=>this.Mt(e||(null==P?void 0:P.event)),Rr(R,"click",this.Zs,{capture:!0}),this.Gs=e=>this.Qs(e||(null==P?void 0:P.event)),Rr(R,"mousemove",this.Gs,{capture:!0}),this.Js=new Qr(this.instance,Jr,this.Vs.bind(this)),this.Js.startIfEnabledOrStop(),this.Ks=this.At.bind(this),Rr(R,gr,this.Ks),this.Rs=!0)}zs(){var e;P&&R&&(this.Ws&&P.removeEventListener(_r,this.Ws),this.Zs&&R.removeEventListener("click",this.Zs,{capture:!0}),this.Gs&&R.removeEventListener("mousemove",this.Gs,{capture:!0}),this.Ks&&R.removeEventListener(gr,this.Ks),clearTimeout(this.Ys),null==(e=this.Js)||e.stop(),this.Rs=!1)}Xs(e,t){var i=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),n=function(e,t,i){for(var r=e;r&&Io(r)&&!Ro(r,"body");){if(r===i)return!1;if(te(t,null==P?void 0:P.getComputedStyle(r).position))return!0;r=Ho(r)}return!1}(Do(e),["fixed","sticky"],s);return{x:e.clientX+(n?0:r),y:e.clientY+(n?0:i),target_fixed:n,type:t}}Mt(e,t){var i;if(void 0===t&&(t="click"),!$o(e.target)&&xa(e)){var r=this.Xs(e,t);null!=(i=this.rageclicks)&&i.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&this.eo(z({},r,{type:"rageclick"})),this.eo(r)}}Qs(e){!$o(e.target)&&xa(e)&&(clearTimeout(this.Ys),this.Ys=setTimeout(()=>{this.eo(this.Xs(e,"mousemove"))},500))}eo(e){if(P){var t=P.location.href,i=this.qt.custom_personal_data_properties,r=this.qt.mask_personal_data_properties?[...ds,...i||[]]:[],s=us(t,r,vs);this.M=this.M||{},this.M[s]||(this.M[s]=[]),this.M[s].push(e)}}Zr(){this.M&&!ce(this.M)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Qr,webVitalsAutocapture:class{constructor(e){var t;this.Hs=!1,this.Rs=!1,this.M={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.ro=()=>{clearTimeout(this.io),0!==this.M.metrics.length&&(this._instance.capture("$web_vitals",this.M.metrics.reduce((e,t)=>z({},e,{["$web_vitals_"+t.name+"_event"]:z({},t),["$web_vitals_"+t.name+"_value"]:t.value}),{})),this.M={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.ht=e=>{var t;this.M=this.M||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var i=this.no();if(!he(i))if(ge(null==e?void 0:e.name)||ge(null==e?void 0:e.value))pa.error("Invalid metric received",e);else if(!this.so||this.so>e.value){this.M.url!==i&&(this.ro(),this.io=setTimeout(this.ro,this.flushToCaptureTimeoutMs)),he(this.M.url)&&(this.M.url=i),this.M.firstMetricTimestamp=he(this.M.firstMetricTimestamp)?Date.now():this.M.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0);var r=null==(t=this._instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0),s=z({},e,{$current_url:i,timestamp:Date.now()});he(r)||(s.$session_id=r.sessionId,s.$window_id=r.windowId),this.M.metrics.push(s),this.M.metrics.length===this.allowedMetrics.length&&this.ro()}else pa.error("Ignoring metric with value >= "+this.so,e)},this.oo=()=>{if(!this.Rs){var e,t,i,r,s=L.__PosthogExtensions__;he(s)||he(s.postHogWebVitalsCallbacks)||({onLCP:e,onCLS:t,onFCP:i,onINP:r}=s.postHogWebVitalsCallbacks),e&&t&&i&&r?(this.allowedMetrics.indexOf("LCP")>-1&&e(this.ht.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&t(this.ht.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this.ht.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&r(this.ht.bind(this)),this.Rs=!0):pa.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.Hs=!(null==(t=this._instance.persistence)||!t.props[Ei]),this.startIfEnabled()}get ao(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,i=ue(this.ao)?null==(e=this.ao)?void 0:e.web_vitals_allowed_metrics:void 0;return ge(i)?(null==(t=this._instance.persistence)?void 0:t.props[Pi])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(ue(this.ao)?this.ao.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=ue(this.ao)?this.ao.web_vitals_attribution:void 0;return null!=e&&e}get so(){var e=ue(this.ao)&&_e(this.ao.__web_vitals_max_value)?this.ao.__web_vitals_max_value:va;return e>0&&6e4>=e?va:e}get isEnabled(){var e=null==M?void 0:M.protocol;if("http:"!==e&&"https:"!==e)return pa.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=ue(this.ao)?this.ao.web_vitals:me(this.ao)?this.ao:void 0;return me(t)?t:this.Hs}startIfEnabled(){this.isEnabled&&!this.Rs&&(pa.info("enabled, starting..."),this.lr(this.oo))}onRemoteConfig(e){if("capturePerformance"in e){var t=ue(e.capturePerformance)&&!!e.capturePerformance.web_vitals,i=ue(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Ei]:t}),this._instance.persistence.register({[Pi]:i})),this.Hs=t,this.startIfEnabled()}}lr(e){var t,i;null!=(t=L.__PosthogExtensions__)&&t.postHogWebVitalsCallbacks?e():null==(i=L.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",t=>{t?pa.error("failed to load script",t):e()})}no(){var e=P?P.location.href:void 0;if(e){var t=this._instance.config.custom_personal_data_properties,i=this._instance.config.mask_personal_data_properties?[...ds,...t||[]]:[];return us(e,i,vs)}pa.error("Could not determine current URL")}}},Ya={exceptionObserver:class{constructor(e){var t,i,r;this.oo=()=>{var e;if(P&&this.isEnabled&&null!=(e=L.__PosthogExtensions__)&&e.errorWrappingFunctions){var t=L.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=L.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=L.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.uo&&this.qt.capture_unhandled_errors&&(this.uo=t(this.captureException.bind(this))),!this.lo&&this.qt.capture_unhandled_rejections&&(this.lo=i(this.captureException.bind(this))),!this.ho&&this.qt.capture_console_errors&&(this.ho=r(this.captureException.bind(this)))}catch(e){ca.error("failed to start",e),this.co()}}},this._instance=e,this.do=!(null==(t=this._instance.persistence)||!t.props[bi]),this.vo=new Re({refillRate:null!==(i=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)&&void 0!==i?i:1,bucketSize:null!==(r=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)&&void 0!==r?r:10,refillInterval:1e4,Gt:ca}),this.qt=this.fo(),this.startIfEnabledOrStop()}fo(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return ue(e)?t=z({},t,e):(he(e)?this.do:e)&&(t=z({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.qt.capture_console_errors||this.qt.capture_unhandled_errors||this.qt.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(ca.info("enabled"),this.co(),this.lr(this.oo)):this.co()}lr(e){var t,i;null!=(t=L.__PosthogExtensions__)&&t.errorWrappingFunctions&&e(),null==(i=L.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",t=>{if(t)return ca.error("failed to load script",t);e()})}co(){var e,t,i;null==(e=this.uo)||e.call(this),this.uo=void 0,null==(t=this.lo)||t.call(this),this.lo=void 0,null==(i=this.ho)||i.call(this),this.ho=void 0}onRemoteConfig(e){"autocaptureExceptions"in e&&(this.do=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[bi]:this.do}),this.qt=this.fo(),this.startIfEnabledOrStop())}onConfigChange(){this.qt=this.fo()}captureException(e){var t,i,r,s=null!==(t=null==e||null==(i=e.$exception_list)||null==(i=i[0])?void 0:i.type)&&void 0!==t?t:"Exception";this.vo.consumeRateLimit(s)?ca.info("Skipping exception capture because of client rate limiting.",{exception:s}):null==(r=this._instance.exceptions)||r.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,i;this.po=[],this.mo=new Ct([new Vt,new ti,new Gt,new Wt,new Qt,new Zt,new Kt,new ei],function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;t>r;r++)i[r-1]=arguments[r];return function(t,r){void 0===r&&(r=0);for(var s=[],n=t.split("\n"),o=r;n.length>o;o++){var a=n[o];if(1024>=a.length){var l=Bt.test(a)?a.replace(Bt,"$1"):a;if(!l.match(/\S*Error: /)){for(var u of i){var c=u(l,e);if(c){s.push(c);break}}if(s.length>=50)break}}}return function(e){if(!e.length)return[];var t=Array.from(e);return t.reverse(),t.slice(0,50).map(e=>{return z({},e,{filename:e.filename||(i=t,i[i.length-1]||{}).filename,function:e.function||Tt});var i})}(s)}}("web:javascript",jt,Ut)),this._instance=e,this.po=null!==(t=null==(i=this._instance.persistence)?void 0:i.get_property(wi))&&void 0!==t?t:[],this.yo=oi(this.bo()),this._o=new ai(this.yo)}onConfigChange(){this.yo=oi(this.bo()),this._o.setConfig(this.yo)}onRemoteConfig(e){var t,i,r;if("errorTracking"in e){var s=null!==(t=null==(i=e.errorTracking)?void 0:i.suppressionRules)&&void 0!==t?t:[],n=null==(r=e.errorTracking)?void 0:r.captureExtensionExceptions;this.po=s,this._instance.persistence&&this._instance.persistence.register({[wi]:this.po,[xi]:n})}}get wo(){var e,t=!!this._instance.get_property(xi),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(e=null!=i?i:t)&&void 0!==e&&e}buildProperties(e,t){return this.mo.buildFromUnknown(e,{syntheticException:null==t?void 0:t.syntheticException,mechanism:{handled:null==t?void 0:t.handled}})}addExceptionStep(e,t){if(this.yo.enabled)try{if(!de(e)||0===e.trim().length)return void za.warn("Ignoring exception step because message must be a non-empty string");var i=this.xo(t),{sanitizedProperties:r,droppedKeys:s}=function(e){if(!e)return{sanitizedProperties:{},droppedKeys:[]};var t=[];return{sanitizedProperties:Object.keys(e).reduce((i,r)=>si.has(r)?(t.push(r),i):(i[r]=e[r],i),{}),droppedKeys:t}}(i);s.length>0&&za.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this._o.add(z({[ii]:e,[ri]:(new Date).toISOString()},r))}catch(e){za.error("Failed to add exception step. Ignoring breadcrumb.",e)}}sendExceptionEvent(e){try{var t=e.$exception_list;if(this.So(t)){if(this.ko(t))return this.Co("Exception dropped: matched a suppression rule"),void za.info("Skipping exception capture because a suppression rule matched");if(!this.wo&&this.Io(t))return this.Co("Exception dropped: thrown by a browser extension"),void za.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.To(t))return this.Co("Exception dropped: thrown by the PostHog SDK"),void za.info("Skipping exception capture because it was thrown by the PostHog SDK")}var i=this.yo.enabled&&ge(e.$exception_steps)?this.Eo(e):e;try{var r=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",en:!0});return r&&this._o.clear(),r}catch(e){return za.error("Failed to capture exception event. Dropping this exception.",e),void this._o.clear()}}catch(e){return void za.error("Failed to process exception event. Ignoring this exception.",e)}}Eo(e){try{var t=this._o.getAttachable();return 0===t.length?e:z({},e,{$exception_steps:t})}catch(t){return za.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}Co(e){this.yo.enabled&&this._o.add({[ii]:e,[ri]:(new Date).toISOString()})}xo(e){return ue(e)?z({},e):{}}bo(){var e,t;return null!==(e=null==(t=this._instance.config.error_tracking)?void 0:t.exception_steps)&&void 0!==e?e:{}}ko(e){if(0===e.length)return!1;var t=e.reduce((e,t)=>{var{type:i,value:r}=t;return de(i)&&i.length>0&&e.$exception_types.push(i),de(r)&&r.length>0&&e.$exception_values.push(r),e},{$exception_types:[],$exception_values:[]});return this.po.some(e=>{var i=e.values.map(e=>{var i,r=Zn[e.operator],s=ae(e.value)?e.value:[e.value],n=null!==(i=t[e.key])&&void 0!==i?i:[];return s.length>0&&r(s,n)});return"OR"===e.type?i.some(Boolean):i.every(Boolean)})}Io(e){return e.flatMap(e=>{var t,i;return null!==(t=null==(i=e.stacktrace)?void 0:i.frames)&&void 0!==t?t:[]}).some(e=>e.filename&&e.filename.startsWith("chrome-extension://"))}To(e){if(e.length>0){var t,i,r,s,n=null!==(t=null==(i=e[0].stacktrace)?void 0:i.frames)&&void 0!==t?t:[],o=n[n.length-1];return null!==(r=null==o||null==(s=o.filename)?void 0:s.includes("posthog.com/static"))&&void 0!==r&&r}return!1}So(e){return!ge(e)&&ae(e)}}},Ja=z({productTours:class{get ni(){return this._instance.persistence}constructor(e){this.Mo=null,this.Po=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){"productTours"in e&&(this.ni&&this.ni.register({[Si]:!!e.productTours}),this.loadIfEnabled())}loadIfEnabled(){var e,t;this.Mo||(e=this._instance).config.disable_product_tours||null==(t=e.persistence)||!t.get_property(Si)||this.lr(()=>this.Ro())}lr(e){var t,i;null!=(t=L.__PosthogExtensions__)&&t.generateProductTours?e():null==(i=L.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"product-tours",t=>{t?Ea.error("Could not load product tours script",t):e()})}Ro(){var e;!this.Mo&&null!=(e=L.__PosthogExtensions__)&&e.generateProductTours&&(this.Mo=L.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(void 0===t&&(t=!1),!ae(this.Po)||t){var i=this.ni;if(i){var r=i.props[Wi];if(ae(r)&&!t)return this.Po=r,void e(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:t=>{var r=t.statusCode;if(200!==r||!t.json){var s="Product Tours API could not be loaded, status: "+r;return Ea.error(s),void e([],{isLoaded:!1,error:s})}var n=ae(t.json.product_tours)?t.json.product_tours:[];this.Po=n,i&&i.register({[Wi]:n}),e(n,{isLoaded:!0})}})}else e(this.Po,{isLoaded:!0})}getActiveProductTours(e){ge(this.Mo)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.Mo.getActiveProductTours(e)}showProductTour(e){var t;null==(t=this.Mo)||t.showTourById(e)}previewTour(e){this.Mo?this.Mo.previewTour(e):this.lr(()=>{var t;this.Ro(),null==(t=this.Mo)||t.previewTour(e)})}dismissProductTour(){var e;null==(e=this.Mo)||e.dismissTour("user_clicked_skip")}nextStep(){var e;null==(e=this.Mo)||e.nextStep()}previousStep(){var e;null==(e=this.Mo)||e.previousStep()}clearCache(){var e;this.Po=null,null==(e=this.ni)||e.unregister(Wi)}resetTour(e){var t;null==(t=this.Mo)||t.resetTour(e)}resetAllTours(){var e;null==(e=this.Mo)||e.resetAllTours()}cancelPendingTour(e){var t;null==(t=this.Mo)||t.cancelPendingTour(e)}}},Ga),Za={siteApps:class{constructor(e){this._instance=e,this.Oo=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Lo(e,t){if(t){var i=this.globalsForEvent(t);this.Oo.push(i),this.Oo.length>1e3&&(this.Oo=this.Oo.slice(10))}}get siteAppLoaders(){var e;return null==(e=L._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.siteApps}initialize(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.Lo.bind(this));this.Fo=()=>{e(),this.Oo=[],this.Fo=void 0}}}globalsForEvent(e){var t,i,r,s,n,o,a;if(!e)throw new Error("Event payload is required");var l={},u=this._instance.get_property("$groups")||[],c=this._instance.get_property("$stored_group_properties")||{};for(var[h,d]of Object.entries(c))l[h]={id:u[h],type:h,properties:d};var{$set_once:p,$set:v}=e;return{event:z({},U(e,ka),{properties:z({},e.properties,v?{$set:z({},null!==(t=null==(i=e.properties)?void 0:i.$set)&&void 0!==t?t:{},v)}:{},p?{$set_once:z({},null!==(r=null==(s=e.properties)?void 0:s.$set_once)&&void 0!==r?r:{},p)}:{}),elements_chain:null!==(n=null==(o=e.properties)?void 0:o.$elements_chain)&&void 0!==n?n:"",distinct_id:null==(a=e.properties)?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}setupSiteApp(e){var t=this.apps[e.id],i=()=>{var i;!t.errored&&this.Oo.length&&(Sa.info("Processing "+this.Oo.length+" events for site app with id "+e.id),this.Oo.forEach(e=>null==t.processEvent?void 0:t.processEvent(e)),t.processedBuffer=!0),Object.values(this.apps).every(e=>e.processedBuffer||e.errored)&&(null==(i=this.Fo)||i.call(this))},r=!1,s=s=>{t.errored=!s,t.loaded=!0,Sa.info("Site app with id "+e.id+" "+(s?"loaded":"errored")),r&&i()};try{var{processEvent:n}=e.init({posthog:this._instance,callback(e){s(e)}});n&&(t.processEvent=n),r=!0}catch(t){Sa.error(Pa+e.id,t),s(!1)}if(r&&t.loaded)try{i()}catch(i){Sa.error("Error while processing buffered events PostHog app with config id "+e.id,i),t.errored=!0}}Ao(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var i of e)this.setupSiteApp(i)}No(e){if(0!==Object.keys(this.apps).length){var t=this.globalsForEvent(e);for(var i of Object.values(this.apps))try{null==i.processEvent||i.processEvent(t)}catch(t){Sa.error("Error while processing event "+e.event+" for site app "+i.id,t)}}}onRemoteConfig(e){var t,i,r,s=this;if(null!=(t=this.siteAppLoaders)&&t.length)return this.isEnabled?(this.Ao(),void this._instance.on("eventCaptured",e=>this.No(e))):void Sa.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this.Fo)||i.call(this),null!=(r=e.siteApps)&&r.length)if(this.isEnabled){var n=function(e){var t;L["__$$ph_site_app_"+e]=s._instance,null==(t=L.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(s._instance,a,t=>{if(t)return Sa.error(Pa+e,t)})};for(var{id:o,url:a}of e.siteApps)n(o)}else Sa.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},Qa={tracingHeaders:class{constructor(e){this.$o=void 0,this.Do=void 0,this.oo=()=>{var e,t,i=this.qo()||[];he(this.$o)&&(null==(e=L.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)||e._patchXHR(i,this._instance.get_distinct_id(),this._instance.sessionManager)),he(this.Do)&&(null==(t=L.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)||t._patchFetch(i,this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}initialize(){this.startIfEnabledOrStop()}lr(e){var t,i;null!=(t=L.__PosthogExtensions__)&&t.tracingHeadersPatchFns&&e(),null==(i=L.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",t=>{if(t)return da.error("failed to load script",t);e()})}qo(){var e;return null!==(e=this._instance.config.addTracingHeaders)&&void 0!==e?e:this._instance.config.__add_tracing_headers}startIfEnabledOrStop(){var e,t;this.qo()?this.lr(this.oo):(null==(e=this.$o)||e.call(this),null==(t=this.Do)||t.call(this),this.$o=void 0,this.Do=void 0)}}},el=z({surveys:class{get qt(){return this._instance.config}constructor(e){this.jo=void 0,this._surveyManager=null,this.Ho=!1,this.Uo=[],this.Bo=null,this._instance=e,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this.qt.disable_surveys){var t=e.surveys;if(ge(t))return oo.warn("Flags not loaded yet. Not loading surveys.");var i=ae(t);this.jo=i?t.length>0:t,oo.info("flags response received, isSurveysEnabled: "+this.jo),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var i=localStorage.key(t);(null!=i&&i.startsWith(ao)||null!=i&&i.startsWith("inProgressSurvey_"))&&e.push(i)}e.forEach(e=>localStorage.removeItem(e))}loadIfEnabled(){if(!this._surveyManager)if(this.Ho)oo.info("Already initializing surveys, skipping...");else if(this.qt.disable_surveys)oo.info(Ca);else if(this.qt.cookieless_mode&&this._instance.consent.isOptedOut())oo.info("Not loading surveys in cookieless mode without consent.");else{var e=null==L?void 0:L.__PosthogExtensions__;if(e){if(!he(this.jo)||this.qt.advanced_enable_surveys){var t=this.jo||this.qt.advanced_enable_surveys;this.Ho=!0;try{var i=e.generateSurveys;if(i)return void this.zo(i,t);var r=e.loadExternalDependency;if(!r)return void this.Vo(ur);r(this._instance,"surveys",i=>{i||!e.generateSurveys?this.Vo("Could not load surveys script",i):this.zo(e.generateSurveys,t)})}catch(e){throw this.Vo("Error initializing surveys",e),e}finally{this.Ho=!1}}}else oo.error("PostHog Extensions not found.")}}zo(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new Ma(this._instance),oo.info("Surveys loaded successfully"),this.Wo({isLoaded:!0})}Vo(e,t){oo.error(e,t),this.Wo({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Uo.push(e),this._surveyManager&&this.Wo({isLoaded:!0}),()=>{this.Uo=this.Uo.filter(t=>t!==e)}}getSurveys(e,t){if(void 0===t&&(t=!1),this.qt.disable_surveys)return oo.info(Ca),e([]);var i,r=this._instance.get_property(Bi);if(r&&!t)return e(r,{isLoaded:!0});"undefined"!=typeof Promise&&this.Bo?this.Bo.then(t=>{var{surveys:i,context:r}=t;return e(i,r)}):("undefined"!=typeof Promise&&(this.Bo=new Promise(e=>{i=e})),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.qt.token),method:"GET",timeout:this.qt.surveys_request_timeout_ms,callback:t=>{var r;this.Bo=null;var s=t.statusCode;if(200!==s||!t.json){var n="Surveys API could not be loaded, status: "+s;oo.error(n);var o={isLoaded:!1,error:n};return e([],o),void(null==i||i({surveys:[],context:o}))}var a,l=t.json.surveys||[],u=l.filter(e=>{return!(!(t=e).start_date||t.end_date)&&(function(e){var t;return!(null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)||!t.length)}(e)||function(e){var t;return!(null==(t=e.conditions)||null==(t=t.actions)||null==(t=t.values)||!t.length)}(e));var t});u.length>0&&(null==(a=this._surveyEventReceiver)||a.register(u)),null==(r=this._instance.persistence)||r.register({[Bi]:l});var c={isLoaded:!0};e(l,c),null==i||i({surveys:l,context:c})}}))}Wo(e){for(var t of this.Uo)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){oo.error("Error in survey callback",e)}}getActiveMatchingSurveys(e,t){if(void 0===t&&(t=!1),!ge(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);oo.warn("init was not called")}Zo(e){var t=null;return this.getSurveys(i=>{var r;t=null!==(r=i.find(t=>t.id===e))&&void 0!==r?r:null}),t}Go(e){if(ge(this._surveyManager))return{eligible:!1,reason:Oa};var t="string"==typeof e?this.Zo(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(ge(this._surveyManager))return oo.warn("init was not called"),{visible:!1,disabledReason:Oa};var t=this.Go(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return ge(this._surveyManager)?(oo.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Oa})):new Promise(i=>{this.getSurveys(t=>{var r,s=null!==(r=t.find(t=>t.id===e))&&void 0!==r?r:null;if(s){var n=this.Go(s);i({visible:n.eligible,disabledReason:n.reason})}else i({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,i){var r;if(ge(this._surveyManager))oo.warn("init was not called");else{var s="string"==typeof e?this.Zo(e):e;if(null!=s&&s.id)if(lo.includes(s.type)){var n=null==R?void 0:R.querySelector(t);if(n)return null!=(r=s.appearance)&&r.surveyPopupDelaySeconds?(oo.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout(()=>{var e,t;oo.info("Rendering survey "+s.id+" with delay of "+(null==(e=s.appearance)?void 0:e.surveyPopupDelaySeconds)+" seconds"),null==(t=this._surveyManager)||t.renderSurvey(s,n,i),oo.info("Survey "+s.id+" rendered")},1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,n,i);oo.warn("Survey element not found")}else oo.warn("Surveys of type "+s.type+" cannot be rendered in the app");else oo.warn("Survey not found")}}displaySurvey(e,t){var i;if(ge(this._surveyManager))oo.warn("init was not called");else{var r=this.Zo(e);if(r){var s=r;if(null!=(i=r.appearance)&&i.surveyPopupDelaySeconds&&t.ignoreDelay&&(s=z({},r,{appearance:z({},r.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==Us&&t.initialResponses&&oo.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===t.ignoreConditions){var n=this.canRenderSurvey(r);if(!n.visible)return void oo.warn("Survey is not eligible to be displayed: ",n.disabledReason)}t.displayType!==Bs?this._surveyManager.handlePopoverSurvey(s,t):this.renderSurvey(s,t.selector,t.properties)}else oo.warn("Survey not found")}}cancelPendingSurvey(e){ge(this._surveyManager)?oo.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;null==(e=this._surveyManager)||e.handlePageUnload()}}},Ga),tl={toolbar:class{constructor(e){this.instance=e}Qo(e){L.ph_toolbar_state=e}Jo(){var e;return null!==(e=L.ph_toolbar_state)&&void 0!==e?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,t,i){if(void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===i&&(i=void 0),Mr(this.instance.config))return!1;if(!P||!R)return!1;e=null!=e?e:P.location,i=null!=i?i:P.history;try{if(!t){try{P.localStorage.setItem("test","test"),P.localStorage.removeItem("test")}catch(e){return!1}t=null==P?void 0:P.localStorage}var r,s=Ta||cs(e.hash,"__posthog")||cs(e.hash,"state"),n=s?Sr(()=>JSON.parse(atob(decodeURIComponent(s))))||Sr(()=>JSON.parse(decodeURIComponent(s))):null;return n&&"ph_authorize"===n.action?((r=n).source="url",r&&Object.keys(r).length>0&&(n.desiredHash?e.hash=n.desiredHash:i?i.replaceState(i.state,"",e.pathname+e.search):e.hash="")):((r=JSON.parse(t.getItem(Aa)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(e){return!1}}Ko(e){var t=L.ph_load_toolbar||L.ph_load_editor;!ge(t)&&le(t)?t(e,this.instance):qa.warn("No toolbar load function found")}loadToolbar(e){var t=!(null==R||!R.getElementById(sr));if(!P||t)return!1;var i="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,r=z({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},i?{instrument:!1}:{});if(P.localStorage.setItem(Aa,JSON.stringify(z({},r,{source:void 0}))),2===this.Jo())this.Ko(r);else if(0===this.Jo()){var s;this.Qo(1),null==(s=L.__PosthogExtensions__)||null==s.loadExternalDependency||s.loadExternalDependency(this.instance,"toolbar",e=>{if(e)return qa.error("[Toolbar] Failed to load",e),void this.Qo(0);this.Qo(2),this.Ko(r)}),Rr(P,"turbolinks:load",()=>{this.Qo(0),this.loadToolbar(r)})}return!0}Yo(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,i){return void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===i&&(i=void 0),this.maybeLoadToolbar(e,t,i)}}},il=z({experiments:class e{get qt(){return this._instance.config}constructor(t){var i=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),i.getWebExperiments(t=>{e.zn("retrieved web experiments from the server"),i.Vn=new Map,t.forEach(t=>{if(t.feature_flag_key){var r;i.Vn&&(e.zn("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(r=i.Vn)||r.set(t.feature_flag_key,t));var s=i._instance.getFeatureFlag(t.feature_flag_key);de(s)&&t.variants[s]&&i.Wn(t.name,s,t.variants[s].transforms)}else if(t.variants)for(var n in t.variants){var o=t.variants[n];e.Zn(o)&&i.Wn(t.name,n,o.transforms)}})},t)},this._instance=t,this._instance.onFeatureFlags(e=>{this.onFeatureFlags(e)})}initialize(){}onFeatureFlags(t){if(this._is_bot())e.zn(Ua);else if(!this.qt.disable_web_experiments){if(ge(this.Vn))return this.Vn=new Map,this.loadIfEnabled(),void this.previewWebExperiment();e.zn("applying feature flags",t),t.forEach(e=>{var t;if(this.Vn&&null!=(t=this.Vn)&&t.has(e)){var i,r=this._instance.getFeatureFlag(e),s=null==(i=this.Vn)?void 0:i.get(e);r&&null!=s&&s.variants[r]&&this.Wn(s.name,r,s.variants[r].transforms)}})}}previewWebExperiment(){var t=e.getWindowLocation();if(null!=t&&t.search){var i=ls(null==t?void 0:t.search,"__experiment_id"),r=ls(null==t?void 0:t.search,"__experiment_variant");i&&r&&(e.zn("previewing web experiments "+i+" && "+r),this.getWebExperiments(e=>{this.Gn(parseInt(i),r,e)},!1,!0))}}loadIfEnabled(){this.qt.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this.qt.disable_web_experiments&&!i)return e([]);var r=this._instance.get_property("$web_experiments");if(r&&!t)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.qt.token),method:"GET",callback:t=>e(200===t.statusCode&&t.json&&t.json.experiments||[])})}Gn(t,i,r){var s=r.filter(e=>e.id===t);s&&s.length>0&&(e.zn("Previewing web experiment ["+s[0].name+"] with variant ["+i+"]"),this.Wn(s[0].name,i,s[0].variants[i].transforms))}static Zn(t){return!ge(t.conditions)&&e.Qn(t)&&e.Jn(t)}static Qn(t){var i;if(ge(t.conditions)||ge(null==(i=t.conditions)?void 0:i.url))return!0;var r,s,n,o=e.getWindowLocation();return!!o&&(null==(r=t.conditions)||!r.url||Ba[null!==(s=null==(n=t.conditions)?void 0:n.urlMatchType)&&void 0!==s?s:"icontains"](t.conditions.url,o))}static getWindowLocation(){return null==P?void 0:P.location}static Jn(e){var t;if(ge(e.conditions)||ge(null==(t=e.conditions)?void 0:t.utm))return!0;var i=_s();if(i.utm_source){var r,s,n,o,a,l,u,c,h=null==(r=e.conditions)||null==(r=r.utm)||!r.utm_campaign||(null==(s=e.conditions)||null==(s=s.utm)?void 0:s.utm_campaign)==i.utm_campaign,d=null==(n=e.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=e.conditions)||null==(o=o.utm)?void 0:o.utm_source)==i.utm_source,p=null==(a=e.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=e.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==i.utm_medium,v=null==(u=e.conditions)||null==(u=u.utm)||!u.utm_term||(null==(c=e.conditions)||null==(c=c.utm)?void 0:c.utm_term)==i.utm_term;return h&&p&&v&&d}return!1}static zn(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;t>r;r++)i[r-1]=arguments[r];ci.info("[WebExperiments] "+e,i)}Wn(t,i,r){this._is_bot()?e.zn(Ua):"control"!==i?r.forEach(r=>{if(r.selector){var s;e.zn("applying transform of variant "+i+" for experiment "+t+" ",r);var n=null==(s=document)?void 0:s.querySelectorAll(r.selector);null==n||n.forEach(e=>{var t=e;r.html&&(t.innerHTML=r.html),r.css&&t.setAttribute("style",r.css)})}}):e.zn("Control variants leave the page unmodified.")}_is_bot(){return I&&this._instance?Kn(I,this.qt.custom_blocked_useragents):void 0}}},Ga),rl={conversations:class{constructor(e){this.Xo=void 0,this._conversationsManager=null,this.ea=!1,this.ta=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var t=e.conversations;ge(t)||(me(t)?this.Xo=t:(this.Xo=t.enabled,this.ta=t),this.loadIfEnabled())}}reset(){var e;null==(e=this._conversationsManager)||e.reset(),this._conversationsManager=null,this.Xo=void 0,this.ta=null}loadIfEnabled(){if(!(this._conversationsManager||this.ea||this._instance.config.disable_conversations||Mr(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=null==L?void 0:L.__PosthogExtensions__;if(e&&!he(this.Xo)&&this.Xo)if(this.ta&&this.ta.token){this.ea=!0;try{var t=e.initConversations;if(t)return this.ra(t),void(this.ea=!1);var i=e.loadExternalDependency;if(!i)return void this.ia(ur);i(this._instance,"conversations",t=>{t||!e.initConversations?this.ia("Could not load conversations script",t):this.ra(e.initConversations),this.ea=!1})}catch(e){this.ia("Error initializing conversations",e),this.ea=!1}}else Va.error("Conversations enabled but missing token in remote config.")}}ra(e){if(this.ta)try{this._conversationsManager=e(this.ta,this._instance),Va.info("Conversations loaded successfully")}catch(e){this.ia("Error completing conversations initialization",e)}else Va.error("Cannot complete initialization: remote config is null")}ia(e,t){Va.error(e,t),this._conversationsManager=null,this.ea=!1}show(){this._conversationsManager?this._conversationsManager.show():Va.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Xo&&!ve(this._conversationsManager)}isVisible(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.isVisible())&&void 0!==e&&e}sendMessage(e,t,i){var r=this;return H(function*(){return r._conversationsManager?r._conversationsManager.sendMessage(e,t,i):(Va.warn(Wa),null)})()}getMessages(e,t){var i=this;return H(function*(){return i._conversationsManager?i._conversationsManager.getMessages(e,t):(Va.warn(Wa),null)})()}markAsRead(e){var t=this;return H(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Va.warn(Wa),null)})()}getTickets(e){var t=this;return H(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Va.warn(Wa),null)})()}requestRestoreLink(e){var t=this;return H(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(Va.warn(Wa),null)})()}restoreFromToken(e){var t=this;return H(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(Va.warn(Wa),null)})()}restoreFromUrlToken(){var e=this;return H(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(Va.warn(Wa),null)})()}getCurrentTicketId(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.getCurrentTicketId())&&void 0!==e?e:null}getWidgetSessionId(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.getWidgetSessionId())&&void 0!==e?e:null}ln(){var e;null==(e=this._conversationsManager)||e.setIdentity()}hn(){var e;null==(e=this._conversationsManager)||e.clearIdentity()}}},sl={logs:class{constructor(e){var t;this.na=!1,this.sa=!1,this.Gt=hi("[logs]"),this.oa=[],this.aa=0,this.ua=0,this.la=!1,this._instance=e,this._instance&&null!=(t=this._instance.config.logs)&&t.captureConsoleLogs&&(this.na=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t,i=null==(t=e.logs)?void 0:t.captureConsoleLogs;!ge(i)&&i&&(this.na=!0,this.loadIfEnabled())}reset(){this.oa=[],this.qr&&(clearTimeout(this.qr),this.qr=void 0),this.aa=0,this.ua=0,this.la=!1}loadIfEnabled(){if(this.na&&!this.sa){var e=null==L?void 0:L.__PosthogExtensions__;if(e){var t=e.loadExternalDependency;t?t(this._instance,"logs",t=>{var i;t||null==(i=e.logs)||!i.initializeLogs?this.Gt.error("Could not load logs script",t):(e.logs.initializeLogs(this._instance),this.sa=!0)}):this.Gt.error(ur)}else this.Gt.error("PostHog Extensions not found.")}}captureLog(e){var t,i,r,s,n,o;if(this._instance.is_capturing())if(e&&e.body){var a=null!==(t=null==(i=this._instance.config.logs)?void 0:i.flushIntervalMs)&&void 0!==t?t:3e3,l=null!==(r=null==(s=this._instance.config.logs)?void 0:s.maxLogsPerInterval)&&void 0!==r?r:1e3,u=Date.now();if(a>u-this.ua||(this.ua=u,this.aa=0,this.la=!1),l>this.aa){this.aa++;var c=function(e,t){var i=e.level||"info",{text:r,number:s}=$t[i]||It,n=String(Date.now())+"000000",o={};t.distinctId&&(o.posthogDistinctId=t.distinctId),t.sessionId&&(o.sessionId=t.sessionId),t.currentUrl&&(o["url.full"]=t.currentUrl),t.screenName&&(o["screen.name"]=t.screenName),t.appState&&(o["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(o.feature_flags=t.activeFeatureFlags);var a=z({},o,e.attributes||{}),l={timeUnixNano:n,observedTimeUnixNano:n,severityNumber:s,severityText:r,body:{stringValue:e.body},attributes:Mt(a)};return e.trace_id&&(l.traceId=e.trace_id),e.span_id&&(l.spanId=e.span_id),he(e.trace_flags)||(l.flags=e.trace_flags),l}(e,this.ha());this.oa.push({record:c}),(null!==(n=null==(o=this._instance.config.logs)?void 0:o.maxBufferSize)&&void 0!==n?n:100)>this.oa.length?this.ca():this.flushLogs()}else this.la||(this.Gt.warn("captureLog dropping logs: exceeded "+l+" logs per "+a+"ms"),this.la=!0)}else this.Gt.warn("captureLog requires a body")}get logger(){return this.da||(this.da={trace:(e,t)=>this.captureLog({body:e,level:"trace",attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:"debug",attributes:t}),info:(e,t)=>this.captureLog({body:e,level:"info",attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:"warn",attributes:t}),error:(e,t)=>this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this.da}flushLogs(e){if(this.qr&&(clearTimeout(this.qr),this.qr=void 0),0!==this.oa.length){var t=this.oa;this.oa=[];var i=this._instance.config.logs,r=z({"service.name":(null==i?void 0:i.serviceName)||"unknown_service"},(null==i?void 0:i.environment)&&{"deployment.environment":i.environment},(null==i?void 0:i.serviceVersion)&&{"service.version":i.serviceVersion},null==i?void 0:i.resourceAttributes),s=(o=t.map(e=>e.record),a=r,l=N.LIB_NAME,u=N.LIB_VERSION,{resourceLogs:[{resource:{attributes:Mt(a)},scopeLogs:[{scope:{name:l,version:u},logRecords:o}]}]}),n=this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token);this._instance.Bi({method:"POST",url:n,data:s,compression:"best-available",batchKey:"logs",transport:e})}var o,a,l,u}ca(){var e,t;this.qr||(this.qr=setTimeout(()=>{this.qr=void 0,this.flushLogs()},null!==(e=null==(t=this._instance.config.logs)?void 0:t.flushIntervalMs)&&void 0!==e?e:3e3))}ha(){var e,t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var{sessionId:i}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=i}if(null!=L&&null!=(e=L.location)&&e.href&&(t.currentUrl=L.location.href),this._instance.featureFlags){var r=this._instance.featureFlags.getFlags();r&&r.length>0&&(t.activeFeatureFlags=r)}return t}}},nl=z({},Ga,Xa,Ka,Ya,Ja,Za,el,Qa,tl,il,rl,sl);Fo.__defaultExtensionClasses=z({},nl);var ol=($a=vo[wo]=new Fo,function(){function e(){e.done||(e.done=!0,xo=!1,xr(vo,function(e){e._dom_loaded()}))}null!=R&&R.addEventListener?"complete"===R.readyState?e():Rr(R,"DOMContentLoaded",e,{capture:!1}):P&&ci.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),$a),al={};function ll(e){var t;return null!=(t=null==e?void 0:e.posthog)?t:ol}var ul,cl={type:"posthog",config:{},async init({config:e,env:t}){const i=e.settings;if(!(null==i?void 0:i.apiKey))return!1;const r=ll(t),{apiKey:s,identify:n,group:o,_state:a,...l}=i,u={autocapture:!1,capture_pageview:!1,capture_pageleave:!1,...l};let c=!1;r.init(s,{...u,loaded:()=>{c=!0}}),c||await Promise.resolve();return{...e,settings:{...i,_state:{lastIdentity:{},lastGroup:{}}}}},async push(e,{config:t,rule:i,env:r,data:s,collector:n}){var o,a;const l=ll(r),u=t.settings||{},c=(null==i?void 0:i.settings)||{},h=u._state||{};if(void 0!==c.reset){("boolean"==typeof c.reset?c.reset:await k(e,c.reset,{collector:n}))&&(l.reset(),h.lastIdentity={},h.lastGroup={})}const d=null!=(o=c.identify)?o:u.identify;if(void 0!==d){const t=await k(e,d,{collector:n});f(t)&&(h.lastIdentity=function(e,t,i={}){const r={...i},s=t.distinctId,n=f(t.$set)?t.$set:void 0,o=f(t.$set_once)?t.$set_once:void 0;return m(s)&&""!==s?(s!==i.distinctId||n||o)&&(e.identify(s,n,o),r.distinctId=s):(n||o)&&e.setPersonProperties(n,o),r}(l,t,h.lastIdentity))}const p=null!=(a=c.group)?a:u.group;if(void 0!==p){const t=await k(e,p,{collector:n});f(t)&&(h.lastGroup=function(e,t,i={}){const r={...i},s=t.type,n=t.key,o=f(t.properties)?t.properties:void 0;return m(s)&&m(n)&&(s!==i.type||n!==i.key||o)&&(e.group(s,n,o),r.type=s,r.key=n),r}(l,t,h.lastGroup))}if(!0!==(null==i?void 0:i.silent)){const t=m(null==i?void 0:i.name)?i.name:e.name,r=f(s)?s:{};l.capture(t,r)}u._state=h},on(e,t){var i;if("consent"!==e||!(null==t?void 0:t.data))return;const r=ll(t.env),s=t.data,n=null==(i=t.config)?void 0:i.consent;if(!n||0===Object.keys(n).length)return;Object.keys(n).every(e=>!0===s[e])?r.opt_in_capturing():r.opt_out_capturing()}},hl=cl;return ul=s,((s,n,o,a)=>{if(n&&"object"==typeof n||"function"==typeof n)for(let l of i(n))r.call(s,l)||l===o||e(s,l,{get:()=>n[l],enumerable:!(a=t(n,l))||a.enumerable});return s})(e({},"__esModule",{value:!0}),ul)})();
|
|
1
|
+
"use strict";var Destination=(()=>{var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,s={};((t,i)=>{for(var r in i)e(t,r,{get:i[r],enumerable:!0})})(s,{DestinationPostHog:()=>ll,default:()=>dl,destinationPostHog:()=>hl});var n=Object.defineProperty,o=(e,t)=>{for(var i in t)n(e,i,{get:t[i],enumerable:!0})};function a(e,t){if("collector"===e)return"collector";if(!t)throw new Error(`stepId(${e}) requires an id`);return`${e}.${t}`}o({},{stepId:()=>a});function l(e,t){const i=e.destinations[t];if(!i)throw new Error(`Destination not found: ${t}`);return i}o({},{getDestination:()=>l});o({},{Level:()=>c});var u,c=((u=c||{})[u.ERROR=0]="ERROR",u[u.WARN=1]="WARN",u[u.INFO=2]="INFO",u[u.DEBUG=3]="DEBUG",u);function h(e,t){const i=e.transformers[t];if(!i)throw new Error(`Transformer not found: ${t}`);return i}o({},{getTransformer:()=>h});function d(e,t){const i=e.sources[t];if(!i)throw new Error(`Source not found: ${t}`);return i}o({},{getSource:()=>d});function p(e,t){const i=e.stores[t];if(!i)throw new Error(`Store not found: ${t}`);return i}async function v(e,t){return await e.get(t)}function g(e){return Array.isArray(e)}function _(e){return void 0!==e}function f(e){return"object"==typeof e&&null!==e&&!g(e)&&"[object Object]"===Object.prototype.toString.call(e)}function m(e){return"string"==typeof e}function y(e,t="",i){const r=t.split(".");let s=e;for(let e=0;e<r.length;e++){const t=r[e];if("*"===t&&g(s)){const t=r.slice(e+1).join("."),n=[];for(const e of s){const r=y(e,t,i);n.push(r)}return n}if(s=f(s)||g(s)?s[t]:void 0,void 0===s)break}return _(s)?s:i}function b(e){return function(e){return"boolean"==typeof e}(e)||m(e)||function(e){return"number"==typeof e&&!Number.isNaN(e)}(e)||!_(e)||g(e)&&e.every(b)||f(e)&&Object.values(e).every(b)}function w(e){return b(e)?e:void 0}function x(e,t,i){return async function(...r){try{return await e(...r)}catch(e){if(!t)return;return await t(e)}finally{await(null==i?void 0:i())}}}o({},{getStore:()=>p,getStoreValue:()=>v});var E=class e extends Error{constructor(t,i){super(t,i),this.name="FatalError",Object.setPrototypeOf(this,e.prototype)}};async function k(e,t={},i={}){var r,s;if(!_(e))return;const n=f(e)&&e.consent||i.consent||(null==(r=i.collector)?void 0:r.consent),o=null!=(s=i.event)?s:f(e)?e:{};return S(e,t,{...i,consent:n,event:o})}async function S(e,t={},i={}){var r,s;const n=i.consent||(null==(r=i.collector)?void 0:r.consent),o=null!=(s=i.event)?s:{};if(!i.collector)throw new Error("getMappingValue: context.collector is required");const a={event:o,mapping:t,collector:i.collector,logger:i.collector.logger,consent:n},l=g(t)?t:[t];for(const t of l){const r=await x(P,e=>{if(e instanceof E)throw e;i.collector&&i.collector.status.failed++,a.logger.error("mapping processing failed",{event:o,error:e})})(e,t,{...a,mapping:t});if(_(r))return r}}async function P(e,t,i){return(g(t)?t:[t]).reduce(async(t,r)=>{const s=await t;if(s)return s;const n=m(r)?{key:r}:r;if(!Object.keys(n).length)return;const{condition:o,consent:a,fn:l,key:u,loop:c,map:h,set:d,validate:p,value:v}=n,f={...i,mapping:r};if(o&&!await x(o,e=>{if(e instanceof E)throw e;return f.logger.error("mapping condition failed",{event:f.event,error:e}),!1})(e,f))return;if(a&&!function(e,t={},i={}){const r={...t,...i},s={};let n=!e||0===Object.keys(e).length;return Object.keys(r).forEach(t=>{r[t]&&(s[t]=!0,e&&e[t]&&(n=!0))}),!!n&&s}(a,f.consent))return v;let b=_(v)?v:e;if(c){const[t,i]=c,r="this"===t?[e]:await S(e,t,f);b=g(r)?(await Promise.all(r.map(e=>k(e,i,f)))).filter(_):void 0}else h?b=await Object.entries(h).reduce(async(t,[i,r])=>{const s=await t,n=await S(e,r,f);return _(n)&&(s[i]=n),s},Promise.resolve({})):d?b=await Promise.all(d.map(t=>P(e,t,f))):u?b=y(e,u,v):l&&(b=await x(l,e=>{if(e instanceof E)throw e;f.logger.error("mapping fn failed",{event:f.event,error:e})})(e,f));p&&!await x(p,e=>{if(e instanceof E)throw e;return f.logger.error("mapping validate failed",{event:f.event,error:e}),!1})(b,f)&&(b=void 0);const F=w(b);return _(F)?F:w(v)},Promise.resolve(void 0))}var F="undefined"!=typeof window?window:void 0,$="undefined"!=typeof globalThis?globalThis:F;"undefined"==typeof self&&($.self=$),"undefined"==typeof File&&($.File=function(){});var I,R=null==$?void 0:$.navigator,M=null==$?void 0:$.document,O=null==$?void 0:$.location,C=null==$?void 0:$.fetch,T=null!=$&&$.XMLHttpRequest&&"withCredentials"in new $.XMLHttpRequest?$.XMLHttpRequest:void 0,A=null==$?void 0:$.AbortController,q=null==$?void 0:$.CompressionStream,L=null==R?void 0:R.userAgent,D=null!=F?F:{},N="1.376.4",j={DEBUG:!1,LIB_VERSION:N,LIB_NAME:"web",JS_SDK_VERSION:N};function H(e,t,i,r,s,n,o){try{var a=e[n](o),l=a.value}catch(e){return void i(e)}a.done?t(l):Promise.resolve(l).then(r,s)}function z(e){return function(){var t=this,i=arguments;return new Promise(function(r,s){var n=e.apply(t,i);function o(e){H(n,r,s,o,a,"next",e)}function a(e){H(n,r,s,o,a,"throw",e)}o(void 0)})}}function U(){return U=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var i=arguments[t];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},U.apply(null,arguments)}function B(e,t){if(null==e)return{};var i={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;i[r]=e[r]}return i}var V,W=((V={}).GZipJS="gzip-js",V.Base64="base64",V),G=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"],X="NativeGzipValidationError",K=e=>e.length>=2&&31===e[0]&&139===e[1],Y=e=>!(!e||"object"!=typeof e)&&"NotReadableError"===("name"in e?String(e.name):""),J=e=>{var t=new Error("Native gzip produced invalid output: "+e);throw t.name=X,t},Z=function(){var e=z(function*(e,t){18>e.size&&J("too-short");var i=new Uint8Array(yield e.slice(0,10).arrayBuffer());K(i)&&8===i[2]||J("invalid-header");var r=new DataView(yield e.slice(e.size-8).arrayBuffer());r.getUint32(0,!0)!==(e=>{for(var t=(()=>{if(I)return I;I=[];for(var e=0;256>e;e++){for(var t=e,i=0;8>i;i++)t=1&t?3988292384^t>>>1:t>>>1;I[e]=t>>>0}return I})(),i=4294967295,r=0;e.length>r;r++)i=t[255&(i^e[r])]^i>>>8;return(4294967295^i)>>>0})(t)&&J("invalid-crc");var s=t.length>>>0;r.getUint32(4,!0)!==s&&J("invalid-size")});return function(t,i){return e.apply(this,arguments)}}();function Q(){return Q=z(function*(e,t,i){void 0===t&&(t=!0);try{var r=(new TextEncoder).encode(e),s=new CompressionStream("gzip"),n=s.writable.getWriter(),o=n.write(r).then(()=>n.close()).catch((u=z(function*(e){try{yield n.abort(e)}catch(e){}throw e}),function(e){return u.apply(this,arguments)})),a=new Response(s.readable).blob(),[l]=yield Promise.all([a,o]);return yield Z(l,r),l}catch(u){if(null!=i&&i.rethrow)throw u;return t&&console.error("Failed to gzip compress data",u),null}var u}),Q.apply(this,arguments)}var ee=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],te=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var i=e.toLowerCase();return ee.concat(t).some(e=>{var t=e.toLowerCase();return-1!==i.indexOf(t)})};function ie(e,t){return-1!==e.indexOf(t)}var re=function(e){return e.trim()},se=function(e){return e.replace(/^\$/,"")},ne=Object.prototype,oe=ne.hasOwnProperty,ae=ne.toString,le=Array.isArray||function(e){return"[object Array]"===ae.call(e)},ue=e=>"function"==typeof e,ce=e=>e===Object(e)&&!le(e),he=e=>{if(ce(e)){for(var t in e)if(oe.call(e,t))return!1;return!0}return!1},de=e=>void 0===e,pe=e=>"[object String]"==ae.call(e),ve=e=>pe(e)&&0===e.trim().length,ge=e=>null===e,_e=e=>de(e)||ge(e),fe=e=>"[object Number]"==ae.call(e)&&e==e,me=e=>fe(e)&&e>0,ye=e=>"[object Boolean]"===ae.call(e),be=e=>ie(G,e);function we(e){return null===e||"object"!=typeof e}function xe(e,t){return{}.toString.call(e)==="[object "+t+"]"}function Ee(e){return"undefined"!=typeof Event&&function(e,t){try{return e instanceof t}catch(e){return!1}}(e,Event)}var ke=[!0,"true",1,"1","yes"],Se=e=>ie(ke,e),Pe=[!1,"false",0,"0","no"];function Fe(e,t,i,r,s){return t>i&&(r.warn("min cannot be greater than max."),t=i),fe(e)?e>i?(r.warn(" cannot be greater than max: "+i+". Using max value instead."),i):t>e?(r.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(r.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+s),Fe(s||i,t,i,r))}var $e,Ie,Re,Me=class{constructor(e){this.$t={},this.zt=e.zt,this.Zt=Fe(e.bucketSize,0,100,e.Gt),this.Qt=Fe(e.refillRate,0,this.Zt,e.Gt),this.Jt=Fe(e.refillInterval,0,864e5,e.Gt)}Kt(e,t){var i=Math.floor((t-e.lastAccess)/this.Jt);i>0&&(e.tokens=Math.min(e.tokens+i*this.Qt,this.Zt),e.lastAccess=e.lastAccess+i*this.Jt)}consumeRateLimit(e){var t,i=Date.now(),r=String(e),s=this.$t[r];return s?this.Kt(s,i):this.$t[r]=s={tokens:this.Zt,lastAccess:i},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(t=this.zt)||t.call(this,e)),0===s.tokens)}stop(){this.$t={}}},Oe="Mobile",Ce="iOS",Te="Android",Ae="Tablet",qe=Te+" "+Ae,Le="iPad",De="Apple",Ne=De+" Watch",je="Safari",He="BlackBerry",ze="Samsung",Ue=ze+"Browser",Be=ze+" Internet",Ve="Chrome",We=Ve+" OS",Ge=Ve+" "+Ce,Xe="Internet Explorer",Ke=Xe+" "+Oe,Ye="Opera",Je=Ye+" Mini",Ze="Edge",Qe="Microsoft "+Ze,et="Firefox",tt=et+" "+Ce,it="Nintendo",rt="PlayStation",st="Xbox",nt=Te+" "+Oe,ot=Oe+" "+je,at="Windows",lt=at+" Phone",ut="Nokia",ct="Ouya",ht="Generic",dt=ht+" "+Oe.toLowerCase(),pt=ht+" "+Ae.toLowerCase(),vt="Konqueror",gt="Oculus Browser",_t="(\\d+(\\.\\d+)?)",ft=new RegExp("Version/"+_t),mt=new RegExp(st,"i"),yt=new RegExp(rt+" \\w+","i"),bt=new RegExp(it+" \\w+","i"),wt=new RegExp(He+"|PlayBook|BB10","i"),xt={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},Et=function(e,t){return t=t||"",ie(e," OPR/")&&ie(e,"Mini")?Je:ie(e," OPR/")?Ye:wt.test(e)?He:ie(e,"IE"+Oe)||ie(e,"WPDesktop")?Ke:ie(e,"OculusBrowser")?gt:ie(e,Ue)?Be:ie(e,Ze)||ie(e,"Edg/")?Qe:ie(e,"FBIOS")?"Facebook "+Oe:ie(e,"UCWEB")||ie(e,"UCBrowser")?"UC Browser":ie(e,"CriOS")?Ge:ie(e,"CrMo")||ie(e,Ve)?Ve:ie(e,Te)&&ie(e,je)?nt:ie(e,"FxiOS")?tt:ie(e.toLowerCase(),vt.toLowerCase())?vt:(i=e,(r=t)&&ie(r,De)||ie(s=i,je)&&!ie(s,Ve)&&!ie(s,Te)?ie(e,Oe)?ot:je:ie(e,et)?et:ie(e,"MSIE")||ie(e,"Trident/")?Xe:ie(e,"Gecko")?et:"");var i,r,s},kt={[Ke]:[new RegExp("rv:"+_t)],[Qe]:[new RegExp(Ze+"?\\/"+_t)],[Ve]:[new RegExp("("+Ve+"|CrMo)\\/"+_t)],[Ge]:[new RegExp("CriOS\\/"+_t)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+_t)],[je]:[ft],[ot]:[ft],[Ye]:[new RegExp("(Opera|OPR)\\/"+_t)],[et]:[new RegExp(et+"\\/"+_t)],[tt]:[new RegExp("FxiOS\\/"+_t)],[vt]:[new RegExp("Konqueror[:/]?"+_t,"i")],[He]:[new RegExp(He+" "+_t),ft],[nt]:[new RegExp("android\\s"+_t,"i")],[Be]:[new RegExp(Ue+"\\/"+_t)],[gt]:[new RegExp("OculusBrowser\\/"+_t)],[Xe]:[new RegExp("(rv:|MSIE )"+_t)],Mozilla:[new RegExp("rv:"+_t)]},St=function(e,t){var i=Et(e,t),r=kt[i];if(de(r))return null;for(var s=0;r.length>s;s++){var n=e.match(r[s]);if(n)return parseFloat(n[n.length-2])}return null},Pt=[[new RegExp(st+"; "+st+" (.*?)[);]","i"),e=>[st,e&&e[1]||""]],[new RegExp(it,"i"),[it,""]],[new RegExp(rt,"i"),[rt,""]],[wt,[He,""]],[new RegExp(at,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[lt,""];if(new RegExp(Oe).test(t)&&!/IEMobile\b/.test(t))return[at+" "+Oe,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var r=xt[i[1]]||"";return/arm/i.test(t)&&(r="RT"),[at,r]}return[at,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[Ce,[e[3],e[4],e[5]||"0"].join(".")]:[Ce,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=de(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+Te+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Te+")","i"),e=>e&&e[2]?[Te,[e[2],e[3],e[4]||"0"].join(".")]:[Te,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[We,""]],[/Linux|debian/i,["Linux",""]]],Ft=function(e){return bt.test(e)?it:yt.test(e)?rt:mt.test(e)?st:new RegExp(ct,"i").test(e)?ct:new RegExp("("+lt+"|WPDesktop)","i").test(e)?lt:/iPad/.test(e)?Le:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?Ne:wt.test(e)?He:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(ut,"i").test(e)?ut:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(Oe).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?Te:qe:new RegExp("(pda|"+Oe+")","i").test(e)?dt:new RegExp(Ae,"i").test(e)&&!new RegExp(Ae+" pc","i").test(e)?pt:""},$t=e=>e instanceof Error,It={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},Rt=It.info;function Mt(e){if(ye(e))return{boolValue:e};if("number"==typeof e)return Number.isFinite(e)?Number.isInteger(e)?{intValue:e}:{doubleValue:e}:{stringValue:String(e)};if("string"==typeof e)return{stringValue:e};if(le(e))return{arrayValue:{values:e.map(e=>Mt(e))}};try{return{stringValue:JSON.stringify(e)}}catch(t){return{stringValue:String(e)}}}function Ot(e){var t=[];for(var i in e){var r=e[i];ge(r)||de(r)||t.push({key:i,value:Mt(r)})}return t}function Ct(e){var t=globalThis._posthogChunkIds;if(t){var i=Object.keys(t);return Re&&i.length===Ie||(Ie=i.length,Re=i.reduce((i,r)=>{$e||($e={});var s=$e[r];if(s)i[s[0]]=s[1];else for(var n=e(r),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,u=t[r];if(l&&u){i[l]=u,$e[r]=[l,u];break}}return i},{})),Re}}var Tt=class{constructor(e,t,i){void 0===i&&(i=[]),this.coercers=e,this.stackParser=t,this.modifiers=i}buildFromUnknown(e,t){void 0===t&&(t={});var i=t&&t.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(i,t,0).apply(e),s=this.buildParsingContext(t),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,i),$exception_level:"error"}}modifyFrames(e){var t=this;return z(function*(){for(var i of e)i.stacktrace&&i.stacktrace.frames&&le(i.stacktrace.frames)&&(i.stacktrace.frames=yield t.applyModifiers(i.stacktrace.frames));return e})()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:null==(t=e.syntheticException)?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var i,r;return null!=e.cause&&(i=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack&&(r=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),U({},e,{cause:i,stack:r})}applyChunkIds(e,t){return e.map(e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e))}applyCoercers(e,t){for(var i of this.coercers)if(i.match(e))return i.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return z(function*(){var i=e;for(var r of t.modifiers)i=yield r(i);return i})()}convertToExceptionList(e,t){var i,r,s,n={type:e.type,value:e.value,mechanism:{type:null!==(i=t.type)&&void 0!==i?i:"generic",handled:null===(r=t.handled)||void 0===r||r,synthetic:null!==(s=e.synthetic)&&void 0!==s&&s}};e.stack&&(n.stacktrace={type:"raw",frames:e.stack});var o=[n];return null!=e.cause&&o.push(...this.convertToExceptionList(e.cause,U({},t,{handled:!0}))),o}buildParsingContext(e){var t;return{chunkIdMap:Ct(this.stackParser),skipFirstLines:null!==(t=e.skipFirstLines)&&void 0!==t?t:1}}buildCoercingContext(e,t,i){void 0===i&&(i=0);var r=(i,r)=>{if(4>=r){var s=this.buildCoercingContext(e,t,r);return this.applyCoercers(i,s)}};return U({},t,{syntheticException:0==i?t.syntheticException:void 0,mechanism:e,apply:e=>r(e,i),next:e=>r(e,i+1)})}},At="?";function qt(e,t,i,r,s){var n={platform:e,filename:t,function:"<anonymous>"===i?At:i,in_app:!0};return de(r)||(n.lineno=r),de(s)||(n.colno=s),n}var Lt=(e,t)=>{var i=-1!==e.indexOf("safari-extension"),r=-1!==e.indexOf("safari-web-extension");return i||r?[-1!==e.indexOf("@")?e.split("@")[0]:At,i?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},Dt=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Nt=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,jt=/\((\S*)(?::(\d+))(?::(\d+))\)/,Ht=(e,t)=>{var i=Dt.exec(e);if(i){var[,r,s,n]=i;return qt(t,r,At,+s,+n)}var o=Nt.exec(e);if(o){if(o[2]&&0===o[2].indexOf("eval")){var a=jt.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,u]=Lt(o[1]||At,o[2]);return qt(t,u,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},zt=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Ut=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Bt=(e,t)=>{var i=zt.exec(e);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var r=Ut.exec(i[3]);r&&(i[1]=i[1]||"eval",i[3]=r[1],i[4]=r[2],i[5]="")}var s=i[3],n=i[1]||At;return[n,s]=Lt(n,s),qt(t,s,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},Vt=/\(error: (.*)\)/,Wt=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var i=pe(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:i?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}isDOMException(e){return xe(e,"DOMException")}isDOMError(e){return xe(e,"DOMError")}},Gt=class{match(e){return e instanceof Error}coerce(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var i=e.message;return String(i.error&&"string"==typeof i.error.message?i.error.message:i)}getStack(e){return e.stacktrace||e.stack||void 0}},Xt=class{constructor(){}match(e){return xe(e,"ErrorEvent")&&null!=e.error}coerce(e,t){var i;return t.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}},Kt=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Yt=class{match(e){return"string"==typeof e}coerce(e,t){var i,[r,s]=this.getInfos(e);return{type:null!=r?r:"Error",value:null!=s?s:e,stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}getInfos(e){var t="Error",i=e,r=e.match(Kt);return r&&(t=r[1],i=r[2]),[t,i]}},Jt=["fatal","error","warning","log","info","debug"];function Zt(e,t){void 0===t&&(t=40);var i=Object.keys(e);if(i.sort(),!i.length)return"[object has no keys]";for(var r=i.length;r>0;r--){var s=i.slice(0,r).join(", ");if(t>=s.length)return r===i.length?s:s.length>t?s.slice(0,t)+"...":s}return""}var Qt=class{match(e){return"object"==typeof e&&null!==e}coerce(e,t){var i,r=this.getErrorPropertyFromObject(e);return r?t.apply(r):{type:this.getType(e),value:this.getValue(e),stack:null==(i=t.syntheticException)?void 0:i.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return Ee(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&"string"==typeof e.name){var t="'"+e.name+"' captured as exception";return"message"in e&&"string"==typeof e.message&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&"string"==typeof e.message)return e.message;var i=this.getObjectClassName(e);return(i&&"Object"!==i?"'"+i+"'":"Object")+" captured as exception with keys: "+Zt(e)}isSeverityLevel(e){return pe(e)&&!ve(e)&&Jt.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if({}.hasOwnProperty.call(e,t)){var i=e[t];if($t(i))return i}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}},ei=class{match(e){return Ee(e)}coerce(e,t){var i,r=e.constructor.name;return{type:r,value:r+" captured as exception with keys: "+Zt(e),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}},ti=class{match(e){return we(e)}coerce(e,t){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}},ii=class{match(e){return xe(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!Ee(e))return!1;try{var t=e.detail;return null!=t&&"object"==typeof t&&"reason"in t}catch(e){return!1}}coerce(e,t){var i,r=this.getUnhandledRejectionReason(e);return we(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}:t.apply(r)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&null!=e.detail&&"object"==typeof e.detail&&"reason"in e.detail)return e.detail.reason}catch(e){}return e}},ri="$message",si="$timestamp",ni=new Set([ri,si]),oi={enabled:!0,max_bytes:32768};function ai(e){var t;return e?{enabled:null!==(t=e.enabled)&&void 0!==t?t:oi.enabled,max_bytes:ui(e.max_bytes,oi.max_bytes)}:U({},oi)}var li=class{constructor(e){this.Yt=[],this.Xt=0,this.qt=ai(e)}setConfig(e){this.qt=ai(e),this.er()}add(e){var t=function(e){var t=function(e){var t=new WeakSet;try{return JSON.stringify(e,(e,i)=>{if("bigint"==typeof i)return i.toString();if("function"!=typeof i&&"symbol"!=typeof i){if(i instanceof Date)return i.toISOString();if(i instanceof Error)return{name:i.name,message:i.message,stack:i.stack};if(i&&"object"==typeof i){if(t.has(i))return"[Circular]";t.add(i)}return i}})}catch(e){return}}(e);if(t)try{var i=JSON.parse(t);if(!ce(i))return;var r=i,s=r[ri],n=r[si];if(!pe(s)||0===s.trim().length)return;if(!pe(n)&&!fe(n))return;return{step:r,json:t}}catch(e){return}}(e);if(t){var i=function(e){if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e).length;for(var t=encodeURIComponent(e),i=0,r=0;t.length>r;r++)"%"===t[r]?(i+=1,r+=2):i+=1;return i}(t.json);i>this.qt.max_bytes||(this.Yt.push({step:t.step,bytes:i}),this.Xt+=i,this.er())}}getAttachable(){return this.Yt.map(e=>e.step)}clear(){this.Yt=[],this.Xt=0}size(){return this.Yt.length}er(){for(;this.Xt>this.qt.max_bytes&&this.Yt.length>0;){var e=this.Yt.shift();e&&(this.Xt-=e.bytes)}}};function ui(e,t){if(!fe(e)||e===1/0||e===-1/0)return t;var i=Math.floor(e);return 0>i?t:i}var ci=function(e,t){var{debugEnabled:i}=void 0===t?{}:t,r={k(t){if(F&&(j.DEBUG||D.POSTHOG_DEBUG||i)&&!de(F.console)&&F.console){for(var r=("__rrweb_original__"in F.console[t]?F.console[t].__rrweb_original__:F.console[t]),s=arguments.length,n=new Array(s>1?s-1:0),o=1;s>o;o++)n[o-1]=arguments[o];r(e,...n)}},debug(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];r.k("debug",...t)},info(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];r.k("log",...t)},warn(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];r.k("warn",...t)},error(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];r.k("error",...t)},critical(){for(var t=arguments.length,i=new Array(t),r=0;t>r;r++)i[r]=arguments[r];console.error(e,...i)},uninitializedWarning(e){r.error("You must initialize PostHog before calling "+e)},createLogger:(t,i)=>ci(e+" "+t,i)};return r},hi=ci("[PostHog.js]"),di=hi.createLogger,pi=di("[ExternalScriptsLoader]"),vi=(e,t,i)=>{if(e.config.disable_external_dependency_loading)return pi.warn(t+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var r=null==M?void 0:M.querySelectorAll("script");if(r)for(var s,n=function(){if(r[o].src===t){var e=r[o];return e.__posthog_loading_callback_fired?{v:i()}:(e.addEventListener("load",t=>{e.__posthog_loading_callback_fired=!0,i(void 0,t)}),e.onerror=e=>i(e),{v:void 0})}},o=0;r.length>o;o++)if(s=n())return s.v;var a=()=>{if(!M)return i("document not found");var r=M.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=t,r.onload=e=>{r.__posthog_loading_callback_fired=!0,i(void 0,e)},r.onerror=e=>i(e),e.config.prepare_external_dependency_script&&(r=e.config.prepare_external_dependency_script(r)),!r)return i("prepare_external_dependency_script returned null");if("head"===e.config.external_scripts_inject_target)M.head.appendChild(r);else{var s,n=M.querySelectorAll("body > script");n.length>0?null==(s=n[0].parentNode)||s.insertBefore(r,n[0]):M.body.appendChild(r)}};null!=M&&M.body?a():null==M||M.addEventListener("DOMContentLoaded",a)};D.__PosthogExtensions__=D.__PosthogExtensions__||{},D.__PosthogExtensions__.loadExternalDependency=(e,t,i)=>{if("remote-config"!==t){var r;if(e.config.__preview_external_dependency_versioned_paths)r=e.requestRouter.endpointFor("assets","/static/"+e.version+"/"+t+".js");else{var s="/static/"+t+".js?v="+e.version;if("toolbar"===t){var n=3e5;s=s+"&t="+Math.floor(Date.now()/n)*n}r=e.requestRouter.endpointFor("assets",s)}vi(e,r,i)}else{var o=e.requestRouter.endpointFor("assets","/array/"+e.config.token+"/config.js");vi(e,o,i)}},D.__PosthogExtensions__.loadSiteApp=(e,t,i)=>{var r=e.requestRouter.endpointFor("api",t);vi(e,r,i)};var gi="$people_distinct_id",_i="$device_id",fi="__alias",mi="__timers",yi="$autocapture_disabled_server_side",bi="$heatmaps_enabled_server_side",wi="$exception_capture_enabled_server_side",xi="$error_tracking_suppression_rules",Ei="$error_tracking_capture_extension_exceptions",ki="$web_vitals_enabled_server_side",Si="$dead_clicks_enabled_server_side",Pi="$product_tours_enabled_server_side",Fi="$web_vitals_allowed_metrics",$i="$session_recording_remote_config",Ii="$replay_override_sampling",Ri="$replay_override_linked_flag",Mi="$replay_override_url_trigger",Oi="$replay_override_event_trigger",Ci="$sesid",Ti="$session_is_sampled",Ai="$enabled_feature_flags",qi="$active_feature_flags",Li="$early_access_features",Di="$feature_flag_details",Ni="$feature_flag_payloads",ji="$feature_flag_request_id",Hi="$override_feature_flags",zi="$override_feature_flag_payloads",Ui="$stored_person_properties",Bi="$stored_group_properties",Vi="$surveys",Wi="$surveys_activated",Gi="ph_product_tours",Xi="$flag_call_reported",Ki="$flag_call_reported_session_id",Yi="$feature_flag_errors",Ji="$feature_flag_evaluated_at",Zi="$user_state",Qi="$client_session_props",er="$capture_rate_limit",tr="$initial_campaign_params",ir="$initial_referrer_info",rr="$initial_person_info",sr="$epp",nr="__POSTHOG_TOOLBAR__",or="$posthog_cookieless",ar="$sdk_debug_extensions_init_method",lr="$sdk_debug_extensions_init_time_ms",ur="$sdk_debug_recording_script_not_loaded",cr="PostHog loadExternalDependency extension not found.",hr="on_reject",dr="always",pr="anonymous",vr="identified",gr="identified_only",_r="visibilitychange",fr="beforeunload",mr="$pageview",yr="$pageleave",br="$identify",wr="$groupidentify";function xr(e,t){le(e)&&e.forEach(t)}function Er(e,t){if(!_e(e))if(le(e))e.forEach(t);else if((e=>e instanceof FormData)(e))e.forEach((e,i)=>t(e,i));else for(var i in e)oe.call(e,i)&&t(e[i],i)}var kr=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;t>r;r++)i[r-1]=arguments[r];for(var s of i)for(var n in s)void 0!==s[n]&&(e[n]=s[n]);return e};function Sr(e){for(var t=Object.keys(e),i=t.length,r=new Array(i);i--;)r[i]=[t[i],e[t[i]]];return r}var Pr=function(e){try{return e()}catch(e){return}},Fr=function(e){return function(){try{for(var t=arguments.length,i=new Array(t),r=0;t>r;r++)i[r]=arguments[r];return e.apply(this,i)}catch(e){hi.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),hi.critical(e)}}},$r=function(e){var t={};return Er(e,function(e,i){(pe(e)&&e.length>0||fe(e))&&(t[i]=e)}),t},Ir=["herokuapp.com","vercel.app","netlify.app"];function Rr(e){var t=null==e?void 0:e.hostname;if(!pe(t))return!1;var i=t.split(".").slice(-2).join(".");for(var r of Ir)if(i===r)return!1;return!0}function Mr(e,t,i,r){var{capture:s=!1,passive:n=!0}=null!=r?r:{};null==e||e.addEventListener(t,i,{capture:s,passive:n})}function Or(e){return"ph_toolbar_internal"===e.name}Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return fe(e)&&isFinite(e)&&Math.floor(e)===e});var Cr,Tr=class e{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,i,r,s){if(!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(r)||!Number.isInteger(s)||0>t||0>i||0>r||0>s||t>0xffffffffffff||i>4095||r>1073741823||s>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=t/Math.pow(2,40),n[1]=t/Math.pow(2,32),n[2]=t/Math.pow(2,24),n[3]=t/Math.pow(2,16),n[4]=t/Math.pow(2,8),n[5]=t,n[6]=112|i>>>8,n[7]=i,n[8]=128|r>>>24,n[9]=r>>>16,n[10]=r>>>8,n[11]=r,n[12]=s>>>24,n[13]=s>>>16,n[14]=s>>>8,n[15]=s,new e(n)}toString(){for(var e="",t=0;this.bytes.length>t;t++)e=e+(this.bytes[t]>>>4).toString(16)+(15&this.bytes[t]).toString(16),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new e(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var t=0;16>t;t++){var i=this.bytes[t]-e.bytes[t];if(0!==i)return Math.sign(i)}return 0}},Ar=class{constructor(){this.S=0,this.C=0,this.I=new Lr}generate(){var e=this.generateOrAbort();if(de(e)){this.S=0;var t=this.generateOrAbort();if(de(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.S)this.S=e,this.T();else{if(this.S>=e+1e4)return;this.C++,this.C>4398046511103&&(this.S++,this.T())}return Tr.fromFieldsV7(this.S,Math.trunc(this.C/Math.pow(2,30)),this.C&Math.pow(2,30)-1,this.I.nextUint32())}T(){this.C=1024*this.I.nextUint32()+(1023&this.I.nextUint32())}},qr=e=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};F&&!de(F.crypto)&&crypto.getRandomValues&&(qr=e=>crypto.getRandomValues(e));var Lr=class{constructor(){this.M=new Uint32Array(8),this.O=1/0}nextUint32(){return this.M.length>this.O||(qr(this.M),this.O=0),this.M[this.O++]}},Dr=()=>Nr().toString(),Nr=()=>(Cr||(Cr=new Ar)).generate(),jr="",Hr=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,zr={R:()=>!!M,D(e){hi.error("cookieStore error: "+e)},A(e){if(M){try{for(var t=e+"=",i=M.cookie.split(";").filter(e=>e.length),r=0;i.length>r;r++){for(var s=i[r];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(t))return decodeURIComponent(s.substring(t.length,s.length))}}catch(e){}return null}},F(e){var t;try{t=JSON.parse(zr.A(e))||{}}catch(e){}return t},N(e,t,i,r,s){if(M)try{var n="",o="",a=function(e,t){if(t){var i=function(e,t){if(void 0===t&&(t=M),jr)return jr;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var i=e.split("."),r=Math.min(i.length,8),s="dmn_chk_"+Dr();!jr&&r--;){var n=i.slice(r).join("."),o=s+"=1;domain=."+n+";path=/";t.cookie=o+";max-age=3",t.cookie.includes(s)&&(t.cookie=o+";max-age=0",jr=n)}return jr}(e);if(!i){var r=(s=e.match(Hr))?s[0]:"";r!==i&&hi.info("Warning: cookie subdomain discovery mismatch",r,i),i=r}return i?"; domain=."+i:""}var s;return""}(M.location.hostname,r);if(i){var l=new Date;l.setTime(l.getTime()+864e5*i),n="; expires="+l.toUTCString()}s&&(o="; secure");var u=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+a+o;return u.length>3686.4&&hi.warn("cookieStore warning: large cookie, len="+u.length),M.cookie=u,u}catch(e){return}},q(e,t){if(null!=M&&M.cookie)try{zr.N(e,"",-1,t)}catch(e){return}}},Ur=null,Br={R(){if(!ge(Ur))return Ur;var e=!0;if(de(F))e=!1;else try{var t="__mplssupport__";Br.N(t,"xyz"),'"xyz"'!==Br.A(t)&&(e=!1),Br.q(t)}catch(t){e=!1}return e||hi.error("localStorage unsupported; falling back to cookie store"),Ur=e,e},D(e){hi.error("localStorage error: "+e)},A(e){try{return null==F?void 0:F.localStorage.getItem(e)}catch(e){Br.D(e)}return null},F(e){try{return JSON.parse(Br.A(e))||{}}catch(e){}return null},N(e,t){try{null==F||F.localStorage.setItem(e,JSON.stringify(t))}catch(e){Br.D(e)}},q(e){try{null==F||F.localStorage.removeItem(e)}catch(e){Br.D(e)}}},Vr=[_i,"distinct_id",Ci,Ti,sr,rr,Zi],Wr={},Gr={R:()=>!0,D(e){hi.error("memoryStorage error: "+e)},A:e=>Wr[e]||null,F:e=>Wr[e]||null,N(e,t){Wr[e]=t},q(e){delete Wr[e]}},Xr=null,Kr={R(){if(!ge(Xr))return Xr;if(Xr=!0,de(F))Xr=!1;else try{var e="__support__";Kr.N(e,"xyz"),'"xyz"'!==Kr.A(e)&&(Xr=!1),Kr.q(e)}catch(e){Xr=!1}return Xr},D(e){hi.error("sessionStorage error: ",e)},A(e){try{return null==F?void 0:F.sessionStorage.getItem(e)}catch(e){Kr.D(e)}return null},F(e){try{return JSON.parse(Kr.A(e))||null}catch(e){}return null},N(e,t){try{null==F||F.sessionStorage.setItem(e,JSON.stringify(t))}catch(e){Kr.D(e)}},q(e){try{null==F||F.sessionStorage.removeItem(e)}catch(e){Kr.D(e)}}},Yr=class{constructor(e){this._instance=e}get qt(){return this._instance.config}get consent(){return this.rr()?0:this.ir}isOptedOut(){return this.qt.cookieless_mode===dr||this.isRejected()||-1===this.consent&&this.qt.cookieless_mode===hr}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.qt.opt_out_capturing_by_default}optInOut(e){this.nr.N(this.sr,e?1:0,this.qt.cookie_expiration,this.qt.cross_subdomain_cookie,this.qt.secure_cookie)}reset(){this.nr.q(this.sr,this.qt.cross_subdomain_cookie)}get sr(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:i}=this._instance.config;return i||(t?t+e:"__ph_opt_in_out_"+e)}get ir(){var e=this.nr.A(this.sr);return Se(e)?1:ie(Pe,e)?0:-1}get nr(){var e=this.qt.opt_out_capturing_persistence_type,t="localStorage"===e?Br:zr;if(!this.ar||this.ar!==t){this.ar=t;var i="localStorage"===e?zr:Br;i.A(this.sr)&&(this.ar.A(this.sr)||this.optInOut(Se(i.A(this.sr))),i.q(this.sr,this.qt.cross_subdomain_cookie))}return this.ar}rr(){return!!this.qt.respect_dnt&&[null==R?void 0:R.doNotTrack,null==R?void 0:R.msDoNotTrack,D.doNotTrack].some(e=>Se(e))}},Jr=di("[Dead Clicks]"),Zr=()=>!0,Qr=e=>{var t,i=!(null==(t=e.instance.persistence)||!t.get_property(Si)),r=e.instance.config.capture_dead_clicks;return ye(r)?r:!!ce(r)||i},es=class{get lazyLoadedDeadClicksAutocapture(){return this.ur}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(e){"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[Si]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.lr(()=>{this.hr()}):this.stop()}lr(e){var t,i;null!=(t=D.__PosthogExtensions__)&&t.initDeadClicksAutocapture&&e(),null==(i=D.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",t=>{t?Jr.error("failed to load script",t):e()})}hr(){var e;if(M){if(!this.ur&&null!=(e=D.__PosthogExtensions__)&&e.initDeadClicksAutocapture){var t=ce(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.ur=D.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.ur.start(M),Jr.info("starting...")}}else Jr.error("`document` not found. Cannot start.")}stop(){this.ur&&(this.ur.stop(),this.ur=void 0,Jr.info("stopping..."))}},ts=di("[SegmentIntegration]"),is="posthog-js";function rs(e,t){var{organization:i,projectId:r,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:o=!0}=void 0===t?{}:t;return t=>{var a,l,u,c,h;if("*"!==n&&!n.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var d=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=d,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var p,v=(null==(a=t.exception)?void 0:a.values)||[],g=v.map(e=>U({},e,{stacktrace:e.stacktrace?U({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map(e=>U({},e,{platform:"web:javascript"}))}):void 0})),_={$exception_message:(null==(l=v[0])?void 0:l.value)||t.message,$exception_type:null==(u=v[0])?void 0:u.type,$exception_level:t.level,$exception_list:g,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(c=v[0])?void 0:c.value)||t.message,$sentry_exception_type:null==(h=v[0])?void 0:h.type,$sentry_tags:t.tags};return i&&r&&(_.$sentry_url=(s||"https://sentry.io/organizations/")+i+"/issues/?project="+r+"&query="+t.event_id),o&&(null==(p=e.exceptions)||p.sendExceptionEvent(_)),t}}var ss=class{constructor(e,t,i,r,s,n){this.name=is,this.setupOnce=function(o){o(rs(e,{organization:t,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}},ns=class{constructor(e){this.cr=(e,t,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength)&&(hi.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:i}),this.dr=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.vr()}vr(){var e;this.pr=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(this.cr)}destroy(){var e;null==(e=this.pr)||e.call(this),this.pr=void 0}doPageView(e,t){var i,r=this.gr(e,t);return this.dr={pathname:null!==(i=null==F?void 0:F.location.pathname)&&void 0!==i?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),r}doPageLeave(e){var t;return this.gr(e,null==(t=this.dr)?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null==(e=this.dr)?void 0:e.pageViewId}}gr(e,t){var i=this.dr;if(!i)return{$pageview_id:t};var r={$pageview_id:t,$prev_pageview_id:i.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:u,maxContentY:c}=s;if(!(de(n)||de(o)||de(a)||de(l)||de(u)||de(c))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),c=Math.ceil(c);var h=n>1?Fe(o/n,0,1,hi):1,d=n>1?Fe(a/n,0,1,hi):1,p=l>1?Fe(u/l,0,1,hi):1,v=l>1?Fe(c/l,0,1,hi):1;r=kr(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:h,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:d,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:c,$prev_pageview_max_content_percentage:v})}}return i.pathname&&(r.$prev_pageview_pathname=i.pathname),i.timestamp&&(r.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),r}},os={[gi]:{exposure:"hidden"},[fi]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[mi]:{exposure:"hidden"},[yi]:{exposure:"event"},[bi]:{exposure:"hidden"},[wi]:{exposure:"event"},[xi]:{exposure:"hidden"},[Ei]:{exposure:"event"},[ki]:{exposure:"event"},[Si]:{exposure:"event"},[Pi]:{exposure:"hidden"},[Fi]:{exposure:"event"},[$i]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[Ci]:{exposure:"hidden"},[Ti]:{exposure:"event"},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},[Ai]:{exposure:"derived",shouldSkipFromEventProperties:(e,t)=>t(),transformToEventProperties(e){if(!ce(e))return{};for(var t={},i=Object.keys(e),r=0;i.length>r;r++)t["$feature/"+i[r]]=e[i[r]];return t}},[qi]:{exposure:"event"},[Li]:{exposure:"hidden"},[Di]:{exposure:"hidden"},[Ni]:{exposure:"event"},[ji]:{exposure:"event"},[Hi]:{exposure:"event"},[zi]:{exposure:"hidden"},[Ui]:{exposure:"hidden"},[Bi]:{exposure:"hidden"},[Vi]:{exposure:"hidden"},[Wi]:{exposure:"event"},[Gi]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[Xi]:{exposure:"hidden"},[Ki]:{exposure:"hidden"},[Yi]:{exposure:"hidden"},[Ji]:{exposure:"hidden"},[Zi]:{exposure:"hidden"},[Qi]:{exposure:"hidden"},[er]:{exposure:"hidden"},[tr]:{exposure:"hidden"},[ir]:{exposure:"hidden"},[rr]:{exposure:"hidden"},[sr]:{exposure:"hidden"},[Ii]:{exposure:"event"},[Ri]:{exposure:"event"},[Mi]:{exposure:"event"},[Oi]:{exposure:"event"},[ar]:{exposure:"event"},[lr]:{exposure:"event"},[ur]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},as=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],ls=e=>{var t=null==M?void 0:M.createElement("a");return de(t)?null:(t.href=e,t)},us=function(e,t){for(var i,r=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===t){i=n;break}}if(!le(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(e){hi.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},cs=function(e,t,i){if(!e||!t||!t.length)return e;for(var r=e.split("#"),s=r[1],n=(r[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),u=[],c=0;l.length>c;c++){var h=l[c].split("=");le(h)&&(t.includes(h[0])?u.push(h[0]+"="+i):u.push(l[c]))}var d=a;return null!=o&&(d+="?"+u.join("&")),null!=s&&(d+="#"+s),d},hs=function(e,t){var i=e.match(new RegExp(t+"=([^&]*)"));return i?i[1]:null},ds="https?://(.*)",ps=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],vs=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...ps],gs="<masked>",_s=["li_fat_id"];function fs(e,t,i){if(!M)return{};var r,s=t?[...ps,...i||[]]:[],n=ms(cs(M.URL,s,gs),e),o=(r={},Er(_s,function(e){var t=zr.A(e);r[e]=t||null}),r);return kr(o,n)}function ms(e,t){var i=vs.concat(t||[]),r={};return Er(i,function(t){var i=us(e,t);r[t]=i||null}),r}function ys(e){var t,i=(t=e)?0===t.search(ds+"google.([^/?]*)")?"google":0===t.search(ds+"bing.com")?"bing":0===t.search(ds+"yahoo.com")?"yahoo":0===t.search(ds+"duckduckgo.com")?"duckduckgo":null:null,r="yahoo"!=i?"q":"p",s={};if(!ge(i)){s.$search_engine=i;var n=M?us(M.referrer,r):"";n.length&&(s.ph_keyword=n)}return s}function bs(){return navigator.language||navigator.userLanguage}var ws="$direct";function xs(){return(null==M?void 0:M.referrer)||ws}function Es(e,t){var i=e?[...ps,...t||[]]:[],r=null==O?void 0:O.href.substring(0,1e3);return{r:xs().substring(0,1e3),u:r?cs(r,i,gs):void 0}}function ks(e){var t,{r:i,u:r}=e,s={$referrer:i,$referring_domain:null==i?void 0:i==ws?ws:null==(t=ls(i))?void 0:t.host};if(r){s.$current_url=r;var n=ls(r);s.$host=null==n?void 0:n.host,s.$pathname=null==n?void 0:n.pathname;var o=ms(r);kr(s,o)}if(i){var a=ys(i);kr(s,a)}return s}function Ss(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function Ps(){try{return(new Date).getTimezoneOffset()}catch(e){return}}var Fs,$s,Is,Rs,Ms=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Os=class{constructor(e,t){var i,r;this.qt=e,this.props={},this.mr=!1,this.yr=(r="",(i=e).token&&(r=i.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),i.persistence_name?"ph_"+i.persistence_name:"ph_"+r+"_posthog"),this.nr=this.br(e),this.load(),e.debug&&hi.info("Persistence loaded",e.persistence,U({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this._r}br(e){-1===Ms.indexOf(e.persistence.toLowerCase())&&(hi.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=function(e){void 0===e&&(e=[]);var t=[...Vr,...e];return U({},Br,{F(e){try{var t={};try{t=zr.F(e)||{}}catch(e){}var i=kr(t,JSON.parse(Br.A(e)||"{}"));return Br.N(e,i),i}catch(e){}return null},N(e,i,r,s,n,o){try{Br.N(e,i,void 0,void 0,o);var a={};t.forEach(e=>{i[e]&&(a[e]=i[e])}),Object.keys(a).length&&zr.N(e,a,r,s,n,o)}catch(e){Br.D(e)}},q(e,t){try{null==F||F.localStorage.removeItem(e),zr.q(e,t)}catch(e){Br.D(e)}}})}(e.cookie_persisted_properties||[]),i=e.persistence.toLowerCase();return"localstorage"===i&&Br.R()?Br:"localstorage+cookie"===i&&t.R()?t:"sessionstorage"===i&&Kr.R()?Kr:"memory"===i?Gr:"cookie"===i?zr:t.R()?t:zr}wr(e){var t=null!=e?e:this.qt.feature_flag_cache_ttl_ms;if(!t||0>=t)return!1;var i=this.props[Ji];return!i||"number"!=typeof i||Date.now()-i>t}properties(){var e={};return Er(this.props,(t,i)=>{var r=(e=>{var t=os[e];if(t)return t;for(var[i,r]of as)if(0===e.indexOf(i))return r})(i);if("derived"===(null==r?void 0:r.exposure)){if(null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(t,i===Ai?()=>this.wr():()=>!1))return;r.transformToEventProperties&&kr(e,r.transformToEventProperties(t))}else r&&"event"!==r.exposure||(e[i]=t)}),e}load(){if(!this._r){var e=this.nr.F(this.yr);e&&(this.props=kr({},e))}}save(){this._r||this.nr.N(this.yr,this.props,this.Sr,this.kr,this.Cr,this.qt.debug)}remove(){this.nr.q(this.yr,!1),this.nr.q(this.yr,!0)}clear(){this.remove(),this.props={}}register_once(e,t,i){if(ce(e)){de(t)&&(t="None"),this.Sr=de(i)?this.Ir:i;var r=!1;if(Er(e,(e,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==t||(this.Tr(i,e),r=!0)}),r)return this.save(),!0}return!1}register(e,t){if(ce(e)){this.Sr=de(t)?this.Ir:t;var i=!1;if(Er(e,(t,r)=>{e.hasOwnProperty(r)&&this.props[r]!==t&&(this.Tr(r,t),i=!0)}),i)return this.save(),!0}return!1}unregister(e){e in this.props&&(this.Er(e),this.save())}update_campaign_params(){if(!this.mr){var e=fs(this.qt.custom_campaign_params,this.qt.mask_personal_data_properties,this.qt.custom_personal_data_properties);he($r(e))||this.register(e),this.mr=!0}}update_search_keyword(){var e;this.register((e=null==M?void 0:M.referrer)?ys(e):{})}update_referrer_info(){var e;this.register_once({$referrer:xs(),$referring_domain:null!=M&&M.referrer&&(null==(e=ls(M.referrer))?void 0:e.host)||ws},void 0)}set_initial_person_info(){this.props[tr]||this.props[ir]||this.register_once({[rr]:Es(this.qt.mask_personal_data_properties,this.qt.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};Er([ir,tr],t=>{var i=this.props[t];i&&Er(i,function(t,i){e["$initial_"+se(i)]=t})});var t,i,r=this.props[rr];if(r){var s=(t=ks(r),i={},Er(t,function(e,t){i["$initial_"+se(t)]=e}),i);kr(e,s)}return e}safe_merge(e){return Er(this.props,function(t,i){i in e||(e[i]=t)}),e}update_config(e,t,i){if(this.Ir=this.Sr=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!i),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence||!((e,t)=>{if(e.length!==t.length)return!1;var i=[...e].sort(),r=[...t].sort();return i.every((e,t)=>e===r[t])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[])){var r=this.br(e),s=this.props;this.clear(),this.nr=r,this.props=s,this.save()}}set_disabled(e){this._r=e,this._r?this.remove():this.save()}set_cross_subdomain(e){e!==this.kr&&(this.kr=e,this.remove(),this.save())}set_secure(e){e!==this.Cr&&(this.Cr=e,this.remove(),this.save())}set_event_timer(e,t){var i=this.props[mi]||{};i[e]=t,this.Tr(mi,i),this.save()}remove_event_timer(e){var t=this.props[mi]||{},i=t[e];return de(i)||(delete t[e],this.Tr(mi,t),this.save()),i}get_property(e){return this.props[e]}set_property(e,t){this.Tr(e,t),this.save()}Tr(e,t){this.props[e]=t}Er(e){delete this.props[e]}},Cs="events",Ts="cancelEvents",As="popover",qs="api",Ls="widget",Ds="survey shown",Ns="survey dismissed",js="survey sent",Hs="$survey_id",zs="$survey_iteration",Us="$survey_last_seen_date",Bs="popover",Vs="inline",Ws="product tour shown",Gs="$product_tour_last_seen_date",Xs="$product_tour_type",Ks=di("[RateLimiter]"),Ys=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach(e=>{Ks.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4})}catch(e){return void Ks.warn('could not rate limit - continuing. Error: "'+(null==e?void 0:e.message)+'"',{text:t})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return(null==(e=this.instance.config.rate_limiting)?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max((null==(e=this.instance.config.rate_limiting)?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var t,i,r;void 0===e&&(e=!1);var{captureEventsBurstLimit:s,captureEventsPerSecond:n}=this,o=(new Date).getTime(),a=null!==(t=null==(i=this.instance.persistence)?void 0:i.get_property(er))&&void 0!==t?t:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>s&&(a.tokens=s);var l=1>a.tokens;return l||e||(a.tokens=Math.max(0,a.tokens-1)),!l||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+n+" events per second and "+s+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,null==(r=this.instance.persistence)||r.set_property(er,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}},Js=di("[RemoteConfig]"),Zs=class{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=D._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}Mr(e){var t,i;null!=(t=D.__PosthogExtensions__)&&t.loadExternalDependency?null==(i=D.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):e()}Pr(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(t){e(t.json)}})}load(){try{if(this.remoteConfig)return Js.info("Using preloaded remote config",this.remoteConfig),this.Rr(this.remoteConfig),void this.Or();if(this._instance.Lr())return void Js.warn("Remote config is disabled. Falling back to local config.");this.Mr(e=>{if(!e)return Js.info("No config found after loading remote JS config. Falling back to JSON."),void this.Pr(e=>{this.Rr(e),this.Or()});this.Rr(e),this.Or()})}catch(e){Js.error("Error loading remote config",e)}}stop(){this.Fr&&(clearInterval(this.Fr),this.Fr=void 0)}refresh(){!this._instance.Lr()&&M&&"hidden"!==M.visibilityState&&this._instance.reloadFeatureFlags()}Or(){var e;if(!this.Fr){var t=null!==(e=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==e?e:3e5;0!==t&&(this.Fr=setInterval(()=>{this.refresh()},t))}}Rr(e){var t;e||Js.error("Failed to fetch remote config from PostHog."),this._instance.Rr(null!=e?e:{}),!1!==(null==e?void 0:e.hasFeatureFlags)&&(this._instance.config.advanced_disable_feature_flags_on_first_load||null==(t=this._instance.featureFlags)||t.ensureFlagsLoaded())}},Qs="gzip-js",en="base64",tn=Uint8Array,rn=Uint16Array,sn=Uint32Array,nn=new tn([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),on=new tn([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),an=new tn([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ln=function(e,t){for(var i=new rn(31),r=0;31>r;++r)i[r]=t+=1<<e[r-1];var s=new sn(i[30]);for(r=1;30>r;++r)for(var n=i[r];i[r+1]>n;++n)s[n]=n-i[r]<<5|r;return[i,s]},un=ln(nn,2),cn=un[1];for(un[0][28]=258,cn[258]=28,$s=ln(on,0)[1],Is=new rn(32768),Rs=0;32768>Rs;++Rs)Fs=(43690&Rs)>>>1|(21845&Rs)<<1,Is[Rs]=((65280&(Fs=(61680&(Fs=(52428&Fs)>>>2|(13107&Fs)<<2))>>>4|(3855&Fs)<<4))>>>8|(255&Fs)<<8)>>>1;var hn=function(e,t,i){for(var r=e.length,s=0,n=new rn(t);r>s;++s)++n[e[s]-1];var o,a=new rn(t);for(s=0;t>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new rn(1<<t);var l=15-t;for(s=0;r>s;++s)if(e[s])for(var u=s<<4|e[s],c=t-e[s],h=a[e[s]-1]++<<c,d=h|(1<<c)-1;d>=h;++h)o[Is[h]>>>l]=u}else for(o=new rn(r),s=0;r>s;++s)o[s]=Is[a[e[s]-1]++]>>>15-e[s];return o},dn=new tn(288);for(Rs=0;144>Rs;++Rs)dn[Rs]=8;for(Rs=144;256>Rs;++Rs)dn[Rs]=9;for(Rs=256;280>Rs;++Rs)dn[Rs]=7;for(Rs=280;288>Rs;++Rs)dn[Rs]=8;var pn=new tn(32);for(Rs=0;32>Rs;++Rs)pn[Rs]=5;var vn=hn(dn,9,0),gn=hn(pn,5,0),_n=function(e){return(e/8|0)+(7&e&&1)},fn=function(e,t,i){(null==i||i>e.length)&&(i=e.length);var r=new(e instanceof rn?rn:e instanceof sn?sn:tn)(i-t);return r.set(e.subarray(t,i)),r},mn=function(e,t,i){var r=t/8|0;e[r]|=i<<=7&t,e[r+1]|=i>>>8},yn=function(e,t,i){var r=t/8|0;e[r]|=i<<=7&t,e[r+1]|=i>>>8,e[r+2]|=i>>>16},bn=function(e,t){for(var i=[],r=0;e.length>r;++r)e[r]&&i.push({s:r,f:e[r]});var s=i.length,n=i.slice();if(!s)return[new tn(0),0];if(1==s){var o=new tn(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort(function(e,t){return e.f-t.f}),i.push({s:-1,f:25001});var a=i[0],l=i[1],u=0,c=1,h=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=s-1;)a=i[i[h].f>i[u].f?u++:h++],l=i[u!=c&&i[h].f>i[u].f?u++:h++],i[c++]={s:-1,f:a.f+l.f,l:a,r:l};var d=n[0].s;for(r=1;s>r;++r)n[r].s>d&&(d=n[r].s);var p=new rn(d+1),v=wn(i[c-1],p,0);if(v>t){r=0;var g=0,_=v-t,f=1<<_;for(n.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});s>r;++r){var m=n[r].s;if(t>=p[m])break;g+=f-(1<<v-p[m]),p[m]=t}for(g>>>=_;g>0;){var y=n[r].s;t>p[y]?g-=1<<t-p[y]++-1:++r}for(;r>=0&&g;--r){var b=n[r].s;p[b]==t&&(--p[b],++g)}v=t}return[new tn(p),v]},wn=function(e,t,i){return-1==e.s?Math.max(wn(e.l,t,i+1),wn(e.r,t,i+1)):t[e.s]=i},xn=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new rn(++t),r=0,s=e[0],n=1,o=function(e){i[r++]=e},a=1;t>=a;++a)if(e[a]==s&&a!=t)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=e[a]}return[i.subarray(0,r),t]},En=function(e,t){for(var i=0,r=0;t.length>r;++r)i+=e[r]*t[r];return i},kn=function(e,t,i){var r=i.length,s=_n(t+2);e[s]=255&r,e[s+1]=r>>>8,e[s+2]=255^e[s],e[s+3]=255^e[s+1];for(var n=0;r>n;++n)e[s+n+4]=i[n];return 8*(s+4+r)},Sn=function(e,t,i,r,s,n,o,a,l,u,c){mn(t,c++,i),++s[256];for(var h=bn(s,15),d=h[0],p=h[1],v=bn(n,15),g=v[0],_=v[1],f=xn(d),m=f[0],y=f[1],b=xn(g),w=b[0],x=b[1],E=new rn(19),k=0;m.length>k;++k)E[31&m[k]]++;for(k=0;w.length>k;++k)E[31&w[k]]++;for(var S=bn(E,7),P=S[0],F=S[1],$=19;$>4&&!P[an[$-1]];--$);var I,R,M,O,C=u+5<<3,T=En(s,dn)+En(n,pn)+o,A=En(s,d)+En(n,g)+o+14+3*$+En(E,P)+(2*E[16]+3*E[17]+7*E[18]);if(T>=C&&A>=C)return kn(t,c,e.subarray(l,l+u));if(mn(t,c,1+(T>A)),c+=2,T>A){I=hn(d,p,0),R=d,M=hn(g,_,0),O=g;var q=hn(P,F,0);for(mn(t,c,y-257),mn(t,c+5,x-1),mn(t,c+10,$-4),c+=14,k=0;$>k;++k)mn(t,c+3*k,P[an[k]]);c+=3*$;for(var L=[m,w],D=0;2>D;++D){var N=L[D];for(k=0;N.length>k;++k)mn(t,c,q[j=31&N[k]]),c+=P[j],j>15&&(mn(t,c,N[k]>>>5&127),c+=N[k]>>>12)}}else I=vn,R=dn,M=gn,O=pn;for(k=0;a>k;++k)if(r[k]>255){var j;yn(t,c,I[257+(j=r[k]>>>18&31)]),c+=R[j+257],j>7&&(mn(t,c,r[k]>>>23&31),c+=nn[j]);var H=31&r[k];yn(t,c,M[H]),c+=O[H],H>3&&(yn(t,c,r[k]>>>5&8191),c+=on[H])}else yn(t,c,I[r[k]]),c+=R[r[k]];return yn(t,c,I[256]),c+R[256]},Pn=new sn([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Fn=function(){for(var e=new sn(256),t=0;256>t;++t){for(var i=t,r=9;--r;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e}(),$n=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};var In=!!T||!!C,Rn="text/plain",Mn=!1,On=(e,t)=>{var[i,r]=e.split("#"),[s,n]=i.split("?");if(!n)return e;var o=n.split("&").filter(e=>e.split("=")[0]!==t).join("&");return s+(o?"?"+o:"")+(r?"#"+r:"")},Cn=function(e,t,i){var r;void 0===i&&(i=!0);var[s,n]=e.split("?"),o=U({},t),a=null!==(r=null==n?void 0:n.split("&").map(e=>{var t,[r,s]=e.split("="),n=i&&null!==(t=o[r])&&void 0!==t?t:s;return delete o[r],r+"="+n}))&&void 0!==r?r:[],l=function(e,t){var i,r;void 0===t&&(t="&");var s=[];return Er(e,function(e,t){de(e)||de(t)||"undefined"===t||(i=encodeURIComponent(e instanceof File?e.name:e.toString()),r=encodeURIComponent(t),s[s.length]=r+"="+i)}),s.join(t)}(o);return l&&a.push(l),s+"?"+a.join("&")},Tn=(e,t)=>JSON.stringify(e,(e,t)=>"bigint"==typeof t?t.toString():t,t),An=e=>{if(e.tr)return e.tr;var t,{data:i,compression:r}=e;if(i){if(r===Qs){var s=function(e,t){void 0===t&&(t={});var i=function(){var e=4294967295;return{p(t){for(var i=e,r=0;t.length>r;++r)i=Fn[255&i^t[r]]^i>>>8;e=i},d:()=>4294967295^e}}(),r=e.length;i.p(e);var s,n,o,a,l=(a=10+((s=t).filename&&s.filename.length+1||0),function(e,t,i,r){var s=e.length,n=new tn(r+s+5*(1+Math.floor(s/7e3))+8),o=n.subarray(r,n.length-8),a=0;if(!t||8>s)for(var l=0;s>=l;l+=65535){var u=l+65535;s>u?a=kn(o,a,e.subarray(l,u)):(o[l]=!0,a=kn(o,a,e.subarray(l,s)))}else{for(var c=Pn[t-1],h=c>>>13,d=8191&c,p=(1<<i)-1,v=new rn(32768),g=new rn(p+1),_=Math.ceil(i/3),f=2*_,m=function(t){return(e[t]^e[t+1]<<_^e[t+2]<<f)&p},y=new sn(25e3),b=new rn(288),w=new rn(32),x=0,E=0,k=(l=0,0),S=0,P=0;s>l;++l){var F=m(l),$=32767&l,I=g[F];if(v[$]=I,g[F]=$,l>=S){var R=s-l;if((x>7e3||k>24576)&&R>423){a=Sn(e,o,0,y,b,w,E,k,P,l-P,a),k=x=E=0,P=l;for(var M=0;286>M;++M)b[M]=0;for(M=0;30>M;++M)w[M]=0}var O=2,C=0,T=d,A=$-I&32767;if(R>2&&F==m(l-A))for(var q=Math.min(h,R)-1,L=Math.min(32767,l),D=Math.min(258,R);L>=A&&--T&&$!=I;){if(e[l+O]==e[l+O-A]){for(var N=0;D>N&&e[l+N]==e[l+N-A];++N);if(N>O){if(O=N,C=A,N>q)break;var j=Math.min(A,N-2),H=0;for(M=0;j>M;++M){var z=l-A+M+32768&32767,U=z-v[z]+32768&32767;U>H&&(H=U,I=z)}}}A+=($=I)-(I=v[$])+32768&32767}if(C){y[k++]=268435456|cn[O]<<18|$s[C];var B=31&cn[O],V=31&$s[C];E+=nn[B]+on[V],++b[257+B],++w[V],S=l+O,++x}else y[k++]=e[l],++b[e[l]]}}a=Sn(e,o,!0,y,b,w,E,k,P,l-P,a)}return fn(n,0,r+_n(a)+8)}(n=e,null==(o=t).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+o.mem,a)),u=l.length;return function(e,t){var i=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=2>t.level?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&$n(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var r=0;i.length>=r;++r)e[r+10]=i.charCodeAt(r)}}(l,t),$n(l,u-8,i.d()),$n(l,u-4,r),l}(function(e){var t=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var i=new tn(e.length+(e.length>>>1)),r=0,s=function(e){i[r++]=e},n=0;t>n;++n){if(r+5>i.length){var o=new tn(r+8+(t-n<<1));o.set(i),i=o}var a=e.charCodeAt(n);128>a?s(a):2048>a?(s(192|a>>>6),s(128|63&a)):a>55295&&57344>a?(s(240|(a=65536+(1047552&a)|1023&e.charCodeAt(++n))>>>18),s(128|a>>>12&63),s(128|a>>>6&63),s(128|63&a)):(s(224|a>>>12),s(128|a>>>6&63),s(128|63&a))}return fn(i,0,r)}(Tn(i)),{mtime:0});return{contentType:Rn,body:s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength),estimatedSize:s.byteLength}}if(r===en){var n=(e=>"data="+encodeURIComponent("string"==typeof e?e:Tn(e)))((t=Tn(i))?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16)))):t);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=Tn(i);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},qn=e=>{var t,i,r,s=An(e);return!s||(i=e.compression,r=us(e.url,"compression"),i!==W.GZipJS&&r!==W.GZipJS&&"gzip"!==r)||((t=s.body)instanceof ArrayBuffer?K(new Uint8Array(t)):ArrayBuffer.isView(t)&&K(new Uint8Array(t.buffer,t.byteOffset,t.byteLength)))?{url:e.url,encodedBody:s}:(Mn=!0,{url:On(e.url,"compression"),encodedBody:An(U({},e,{compression:void 0,tr:void 0}))})},Ln=function(){var e=z(function*(e){var t=Tn(e.data),i=yield function(e,t,i){return Q.apply(this,arguments)}(t,j.DEBUG,{rethrow:!0});if(!i)return e;var r=yield i.arrayBuffer();return U({},e,{tr:{contentType:Rn,body:r,estimatedSize:r.byteLength}})});return function(t){return e.apply(this,arguments)}}(),Dn=(e,t)=>Cn(e,{_:(new Date).getTime().toString(),ver:j.JS_SDK_VERSION,compression:t}),Nn=[];C&&Nn.push({transport:"fetch",method(e){var t,{url:i,encodedBody:r}=qn(e),{contentType:s,body:n,estimatedSize:o}=null!=r?r:{},a=new Headers;Er(e.headers,function(e,t){a.append(t,e)}),s&&a.append("Content-Type",s);var l=null;if(A){var u=new A;l={signal:u.signal,timeout:setTimeout(()=>u.abort(),e.timeout)}}C(i,U({method:(null==e?void 0:e.method)||"GET",headers:a,keepalive:"POST"===e.method&&52428.8>(o||0),body:n,signal:null==(t=l)?void 0:t.signal},e.fetchOptions)).then(t=>t.text().then(i=>{var r={statusCode:t.status,text:i};if(200===t.status)try{r.json=JSON.parse(i)}catch(e){hi.error(e)}null==e.callback||e.callback(r)})).catch(t=>{hi.error(t),null==e.callback||e.callback({statusCode:0,error:t})}).finally(()=>l?clearTimeout(l.timeout):null)}}),T&&Nn.push({transport:"XHR",method(e){var t=new T,{url:i,encodedBody:r}=qn(e);t.open(e.method||"GET",i,!0);var{contentType:s,body:n}=null!=r?r:{};Er(e.headers,function(e,i){t.setRequestHeader(i,e)}),s&&t.setRequestHeader("Content-Type",s),e.timeout&&(t.timeout=e.timeout),e.disableXHRCredentials||(t.withCredentials=!0),t.onreadystatechange=()=>{if(4===t.readyState){var i={statusCode:t.status,text:t.responseText};if(200===t.status)try{i.json=JSON.parse(t.responseText)}catch(e){}null==e.callback||e.callback(i)}},t.send(n)}}),null!=R&&R.sendBeacon&&Nn.push({transport:"sendBeacon",method(e){try{var{url:t,encodedBody:i}=qn(e),r=Cn(t,{beacon:"1"}),{contentType:s,body:n}=null!=i?i:{};if(!n)return;var o=n instanceof Blob?n:new Blob([n],{type:s});R.sendBeacon(r,o)}catch(e){}}});var jn=3e3,Hn=class{constructor(e,t){this.Ar=!0,this.Nr=[],this.$r=Fe((null==t?void 0:t.flush_interval_ms)||jn,250,5e3,hi.createLogger("flush interval"),jn),this.Dr=e}enqueue(e){this.Nr.push(e),this.qr||this.jr()}unload(){this.Hr();var e=this.Nr.length>0?this.Ur():{},t=Object.values(e);[...t.filter(e=>0===e.url.indexOf("/e")),...t.filter(e=>0!==e.url.indexOf("/e"))].map(e=>{this.Dr(U({},e,{transport:"sendBeacon"}))})}enable(){this.Ar=!1,this.jr()}jr(){var e=this;this.Ar||(this.qr=setTimeout(()=>{if(this.Hr(),this.Nr.length>0){var t=this.Ur(),i=function(){var i=t[r],s=(new Date).getTime();i.data&&le(i.data)&&Er(i.data,e=>{e.offset=Math.abs(e.timestamp-s),delete e.timestamp}),e.Dr(i)};for(var r in t)i()}},this.$r))}Hr(){clearTimeout(this.qr),this.qr=void 0}Ur(){var e={};return Er(this.Nr,t=>{var i,r=t,s=(r?r.batchKey:null)||r.url;de(e[s])&&(e[s]=U({},r,{data:[]})),null==(i=e[s].data)||i.push(r.data)}),this.Nr=[],e}},zn=["retriesPerformedSoFar"],Un=class{constructor(e){this.Br=!1,this.zr=3e3,this.Nr=[],this._instance=e,this.Nr=[],this.Vr=!0,!de(F)&&"onLine"in F.navigator&&(this.Vr=F.navigator.onLine,this.Wr=()=>{this.Vr=!0,this.Zr()},this.Gr=()=>{this.Vr=!1},Mr(F,"online",this.Wr),Mr(F,"offline",this.Gr))}get length(){return this.Nr.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,i=B(e,zn);me(t)&&(i.url=Cn(i.url,{retry_count:t})),this._instance._send_request(U({},i,{callback:e=>{200===e.statusCode||e.statusCode>=400&&500>e.statusCode||(null!=t?t:0)>=10?null==i.callback||i.callback(e):this.Qr(U({retriesPerformedSoFar:t},i))}}))}Qr(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var i,r,s,n,o,a=(i=t,r=3e3*Math.pow(2,i),s=r/2,n=Math.min(18e5,r),o=Math.random()-.5,Math.ceil(n+o*(n-s))),l=Date.now()+a;this.Nr.push({retryAt:l,requestOptions:e});var u="Enqueued failed request for retry in "+a;navigator.onLine||(u+=" (Browser is offline)"),hi.warn(u),this.Br||(this.Br=!0,this.Jr())}Jr(){if(this.Kr&&clearTimeout(this.Kr),0===this.Nr.length)return this.Br=!1,void(this.Kr=void 0);this.Kr=setTimeout(()=>{this.Vr&&this.Nr.length>0&&this.Zr(),this.Jr()},this.zr)}Zr(){var e=Date.now(),t=[],i=this.Nr.filter(i=>e>i.retryAt||(t.push(i),!1));if(this.Nr=t,i.length>0)for(var{requestOptions:r}of i)this.retriableRequest(r)}unload(){for(var{requestOptions:e}of(this.Kr&&(clearTimeout(this.Kr),this.Kr=void 0),this.Br=!1,de(F)||(this.Wr&&(F.removeEventListener("online",this.Wr),this.Wr=void 0),this.Gr&&(F.removeEventListener("offline",this.Gr),this.Gr=void 0)),this.Nr))try{this._instance._send_request(U({},e,{transport:"sendBeacon"}))}catch(e){hi.error(e)}this.Nr=[]}},Bn=class{constructor(e){this.Yr=()=>{var e,t,i,r;this.Xr||(this.Xr={});var s=this.scrollElement(),n=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=n+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;this.Xr.lastScrollY=Math.ceil(n),this.Xr.maxScrollY=Math.max(n,null!==(e=this.Xr.maxScrollY)&&void 0!==e?e:0),this.Xr.maxScrollHeight=Math.max(o,null!==(t=this.Xr.maxScrollHeight)&&void 0!==t?t:0),this.Xr.lastContentY=a,this.Xr.maxContentY=Math.max(a,null!==(i=this.Xr.maxContentY)&&void 0!==i?i:0),this.Xr.maxContentHeight=Math.max(l,null!==(r=this.Xr.maxContentHeight)&&void 0!==r?r:0)},this._instance=e}get ei(){return this._instance.config.scroll_root_selector}getContext(){return this.Xr}resetContext(){var e=this.Xr;return setTimeout(this.Yr,0),e}startMeasuringScrollPosition(){Mr(F,"scroll",this.Yr,{capture:!0}),Mr(F,"scrollend",this.Yr,{capture:!0}),Mr(F,"resize",this.Yr)}scrollElement(){if(!this.ei)return null==F?void 0:F.document.documentElement;var e=le(this.ei)?this.ei:[this.ei];for(var t of e){var i=null==F?void 0:F.document.querySelector(t);if(i)return i}}scrollY(){if(this.ei){var e=this.scrollElement();return e&&e.scrollTop||0}return F&&(F.scrollY||F.pageYOffset||F.document.documentElement.scrollTop)||0}scrollX(){if(this.ei){var e=this.scrollElement();return e&&e.scrollLeft||0}return F&&(F.scrollX||F.pageXOffset||F.document.documentElement.scrollLeft)||0}},Vn=e=>Es(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties),Wn=class{constructor(e,t,i,r){this.ti=e=>{var t=this.ri();if(!t||t.sessionId!==e){var i={sessionId:e,props:this.ii(this._instance)};this.ni.register({[Qi]:i})}},this._instance=e,this.si=t,this.ni=i,this.ii=r||Vn,this.si.onSessionId(this.ti)}ri(){return this.ni.props[Qi]}getSetOnceProps(){var e,t=null==(e=this.ri())?void 0:e.props;return t?"r"in t?ks(t):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return Er($r(this.getSetOnceProps()),(t,i)=>{"$current_url"===i&&(i="url"),e["$session_entry_"+se(i)]=t}),e}},Gn=class{constructor(){this.oi={}}on(e,t){return this.oi[e]||(this.oi[e]=[]),this.oi[e].push(t),()=>{this.oi[e]=this.oi[e].filter(e=>e!==t)}}emit(e,t){for(var i of this.oi[e]||[])i(t);for(var r of this.oi["*"]||[])r(e,t)}},Xn=di("[SessionId]"),Kn=class{on(e,t){return this.ai.on(e,t)}constructor(e,t,i){var r;if(this.ui=[],this.li=void 0,this.ai=new Gn,this.hi=(e,t)=>!(!me(e)||!me(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===dr)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.qt=e.config,this.ni=e.persistence,this.ci=void 0,this.di=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.vi=t||Dr,this.fi=i||Dr;var s=this.qt.persistence_name||this.qt.token;if(this._sessionTimeoutMs=1e3*Fe(this.qt.session_idle_timeout_seconds||1800,60,36e3,Xn.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.pi(),this.gi="ph_"+s+"_window_id",this.mi="ph_"+s+"_primary_window_exists",this.yi()){var n=Kr.F(this.gi),o=Kr.F(this.mi);n&&!o?this.ci=n:Kr.q(this.gi),Kr.N(this.mi,!0)}if(null!=(r=this.qt.bootstrap)&&r.sessionID)try{var a=(()=>{var e=this.qt.bootstrap.sessionID.replace(/-/g,"");if(32!==e.length)throw new Error("Not a valid UUID");if("7"!==e[12])throw new Error("Not a UUIDv7");return parseInt(e.substring(0,12),16)})();this.bi(this.qt.bootstrap.sessionID,(new Date).getTime(),a)}catch(e){Xn.error("Invalid sessionID in bootstrap",e)}this.wi()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return de(this.ui)&&(this.ui=[]),this.ui.push(e),this.di&&e(this.di,this.ci),()=>{this.ui=this.ui.filter(t=>t!==e)}}yi(){return"memory"!==this.qt.persistence&&!this.ni._r&&Kr.R()}xi(e){e!==this.ci&&(this.ci=e,this.yi()&&Kr.N(this.gi,e))}Si(){return this.ci?this.ci:this.yi()?Kr.F(this.gi):null}bi(e,t,i){e===this.di&&t===this._sessionActivityTimestamp&&i===this._sessionStartTimestamp||(this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this.di=e,this.ni.register({[Ci]:[t,e,i]}))}ki(){var e=this.ni.props[Ci];return le(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.bi(null,null,null)}destroy(){clearTimeout(this.Ci),this.Ci=void 0,this.li&&F&&(F.removeEventListener(fr,this.li,{capture:!1}),this.li=void 0),this.ui=[]}wi(){this.li=()=>{this.yi()&&Kr.q(this.mi)},Mr(F,fr,this.li,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),this.qt.cookieless_mode===dr)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||(new Date).getTime(),[r,s,n]=this.ki(),o=this.Si(),a=me(n)&&Math.abs(i-n)>864e5,l=!1,u=!s,c=!u&&!e&&this.hi(i,r);u||c||a?(s=this.vi(),o=this.fi(),Xn.info("new session ID generated",{sessionId:s,windowId:o,changeReason:{noSessionId:u,activityTimeout:c,sessionPastMaximumLength:a}}),n=i,l=!0):o||(o=this.fi(),l=!0);var h=me(r)&&e&&!a?r:i,d=me(n)?n:(new Date).getTime();return this.xi(o),this.bi(s,h,d),e||this.pi(),l&&this.ui.forEach(e=>e(s,o,l?{noSessionId:u,activityTimeout:c,sessionPastMaximumLength:a}:void 0)),{sessionId:s,windowId:o,sessionStartTimestamp:d,changeReason:l?{noSessionId:u,activityTimeout:c,sessionPastMaximumLength:a}:void 0,lastActivityTimestamp:r}}pi(){clearTimeout(this.Ci),this.Ci=setTimeout(()=>{var[e]=this.ki();if(this.hi((new Date).getTime(),e)){var t=this.di;this.resetSessionId(),this.ai.emit("forcedIdleReset",{idleSessionId:t})}},1.1*this.sessionTimeoutMs)}},Yn=function(e,t){if(!e)return!1;var i=e.userAgent;if(i&&te(i,t))return!0;try{var r=null==e?void 0:e.userAgentData;if(null!=r&&r.brands&&r.brands.some(e=>te(null==e?void 0:e.brand,t)))return!0}catch(e){}return!!e.webdriver},Jn=function(e,t){if(!function(e){try{new RegExp(e)}catch(e){return!1}return!0}(t))return!1;try{return new RegExp(t).test(e)}catch(e){return!1}};function Zn(e,t,i){return Tn({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var Qn={exact:(e,t)=>t.some(t=>e.some(e=>t===e)),is_not:(e,t)=>t.every(t=>e.every(e=>t!==e)),regex:(e,t)=>t.some(t=>e.some(e=>Jn(t,e))),not_regex:(e,t)=>t.every(t=>e.every(e=>!Jn(t,e))),icontains:(e,t)=>t.map(eo).some(t=>e.map(eo).some(e=>t.includes(e))),not_icontains:(e,t)=>t.map(eo).every(t=>e.map(eo).every(e=>!t.includes(e))),gt:(e,t)=>t.some(t=>{var i=parseFloat(t);return!isNaN(i)&&e.some(e=>i>parseFloat(e))}),lt:(e,t)=>t.some(t=>{var i=parseFloat(t);return!isNaN(i)&&e.some(e=>i<parseFloat(e))})},eo=e=>e.toLowerCase();function to(e,t){return!e||Object.entries(e).every(e=>{var[i,r]=e,s=null==t?void 0:t[i];if(de(s)||ge(s))return!1;var n=[String(s)],o=Qn[r.operator];return!!o&&o(r.values,n)})}var io,ro="custom",so="i.posthog.com",no=/^\/static\//,oo=class{constructor(e){this.Ii={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,t=null==(e=this.instance.config.ui_host)?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+so,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this.Ii[this.apiHost]||(this.Ii[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":ro),this.Ii[this.apiHost]}Ti(e){var t=this.instance.config.__preview_external_dependency_versioned_paths;if("string"==typeof t&&no.test(e))return t.trim().replace(/\/$/,"")||void 0}endpointFor(e,t){if(void 0===t&&(t=""),t&&(t="/"===t[0]?t:"/"+t),"ui"===e)return this.uiHost+t;if("flags"===e)return this.flagsApiHost+t;if("assets"===e){var i=this.Ti(t);if(i)return""+i+t}if(this.region===ro)return this.apiHost+t;var r=so+t;switch(e){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}},ao=di("[Surveys]"),lo="seenSurvey_",uo=[As,Ls,qs],co={ignoreConditions:!1,ignoreDelay:!1,displayType:Bs},ho=di("[PostHog ExternalIntegrations]"),po={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},vo=class{constructor(e){this._instance=e}lr(e,t){var i;null==(i=D.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,e=>{if(e)return ho.error("failed to load script",e);t()})}startIfEnabledOrStop(){var e=this,t=function(t){var i,s,n;!r||null!=(i=D.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[t]||e.lr(po[t],()=>{var i;null==(i=D.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[t])||i.start(e._instance)}),!r&&null!=(s=D.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[t]&&(null==(n=D.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[t])||n.stop())};for(var[i,r]of Object.entries(null!==(s=this._instance.config.integrations)&&void 0!==s?s:{})){var s;t(i)}}},go={},_o=0,fo=()=>{},mo='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',yo="Surveys module not available",bo="sanitize_properties is deprecated. Use before_send instead",wo="Invalid value for property_denylist config: ",xo="posthog",Eo=!In&&-1===(null==L?void 0:L.indexOf("MSIE"))&&-1===(null==L?void 0:L.indexOf("Mozilla")),ko=e=>{var t;return U({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Rr(null==M?void 0:M.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:fo,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,debug:O&&pe(null==O?void 0:O.search)&&-1!==O.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==F||null==(t=F.location)?void 0:t.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(e){hi.error("Bad HTTP status: "+e.statusCode+" "+e.text)},get_device_id:e=>e,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:gr,before_send:void 0,request_queue_config:{flush_interval_ms:jn},error_tracking:{},_onCapture:fo,__preview_eager_load_replay:!1},(e=>({rageclick:!e||"2025-11-30">e||{content_ignorelist:!0},capture_pageview:!e||"2025-05-24">e||"history_change",session_recording:e&&e>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:e&&e>="2026-01-30"?"head":"body",internal_or_test_user_hostname:e&&e>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0}))(e))},So=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["store_google","save_campaign_params"],["verbose","debug"]],Po=e=>{var t={};for(var[i,r]of So)de(e[i])||(t[r]=e[i]);var s=kr({},t,e);return le(e.property_blacklist)&&(de(e.property_denylist)?s.property_denylist=e.property_blacklist:le(e.property_denylist)?s.property_denylist=[...e.property_blacklist,...e.property_denylist]:hi.error(wo+e.property_denylist)),s},Fo=class{constructor(){this.__forceAllowLocalhost=!1}get Ei(){return this.__forceAllowLocalhost}set Ei(e){hi.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},$o=class e{Mi(e,t){if(e){var i=this.Pi.indexOf(e);-1!==i&&this.Pi.splice(i,1)}return this.Pi.push(t),null==t.initialize||t.initialize(),t}Ri(){return this.config.cookieless_mode===dr||this.config.cookieless_mode===hr&&this.consent.isRejected()}get decideEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}get flagsEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}constructor(){var t;this.webPerformance=new Fo,this.Oi=!1,this.version=j.LIB_VERSION,this.Li=new Gn,this.Pi=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=ko(),this.SentryIntegration=ss,this.sentryIntegration=e=>{return t=rs(this,e),{name:is,processEvent:e=>t(e)};var t},this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Fi=!1,this.Ai=null,this.Ni=null,this.$i=null,this.scrollManager=new Bn(this),this.pageViewManager=new ns(this),this.rateLimiter=new Ys(this),this.requestRouter=new oo(this),this.consent=new Yr(this),this.externalIntegrations=new vo(this);var i=null!==(t=e.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(e,t,i)=>{var r=pe(e)?{[e]:t}:e;this.setPersonProperties(r),null==i||i({})},set_once:(e,t,i)=>{var r=pe(e)?{[e]:t}:e;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",e=>hi.info('send "'+(null==e?void 0:e.event)+'"',e))}init(t,i,r){if(r&&r!==xo){var s,n=null!==(s=go[r])&&void 0!==s?s:new e;return n._init(t,i,r),go[r]=n,go[xo][r]=n,n}return this._init(t,i,r)}_init(e,t,i){var r,s;if(void 0===t&&(t={}),de(e)||ve(e))return hi.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},t.debug=this.Di(t.debug),this.qi=t,this.ji=[],t.person_profiles?this.Ni=t.person_profiles:t.process_person&&(this.Ni=t.process_person),this.set_config(kr({},ko(t.defaults),Po(t),{name:i,token:e})),this.config.on_xhr_error&&hi.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:Qs;var n=this.Hi();this.persistence=new Os(this.config,n),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Os(U({},this.config,{persistence:"sessionStorage"}),n);var o=U({},this.persistence.props),a=U({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Ui=new Hn(e=>this.Bi(e),this.config.request_queue_config),this.zi=new Un(this),this.__request_queue=[];var l=this.Ri();if(l||(this.sessionManager=new Kn(this),this.sessionPropsManager=new Wn(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(hi.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Vi(l)},0)):(hi.info("Initializing extensions synchronously"),this.Vi(l)),j.DEBUG=j.DEBUG||this.config.debug,j.DEBUG&&hi.info("Starting in debug mode",{this:this,config:t,thisC:U({},this.config),p:o,s:a}),!this.config.identity_distinct_id||null!=(r=t.bootstrap)&&r.distinctID||(t.bootstrap=U({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(s=t.bootstrap)?void 0:s.distinctID)){var u=t.bootstrap.distinctID,c=this.get_distinct_id(),h=this.persistence.get_property(Zi);if(t.bootstrap.isIdentifiedID&&null!=c&&c!==u&&h===pr)this.identify(u);else if(t.bootstrap.isIdentifiedID&&null!=c&&c!==u&&h===vr)hi.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var d=this.config.get_device_id(Dr()),p=t.bootstrap.isIdentifiedID?d:u;this.persistence.set_property(Zi,t.bootstrap.isIdentifiedID?vr:pr),this.register({distinct_id:u,$device_id:p})}}if(l)this.register_once({distinct_id:or,$device_id:null},"");else if(!this.get_distinct_id()){var v=this.config.get_device_id(Dr());this.register_once({distinct_id:v,$device_id:v},""),this.persistence.set_property(Zi,pr)}return Mr(F,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),t.segment?function(e,t){var i=e.config.segment;if(!i)return t();!function(e,t){var i=e.config.segment;if(!i)return t();var r=i=>{var r=()=>i.anonymousId()||Dr();e.config.get_device_id=r,i.id()&&(e.register({distinct_id:i.id(),$device_id:r()}),e.persistence.set_property(Zi,vr)),t()},s=i.user();"then"in s&&ue(s.then)?s.then(r):r(s)}(e,()=>{i.register((e=>{Promise&&Promise.resolve||ts.warn("This browser does not have Promise support, and can not use the segment integration");var t=(t,i)=>{if(!i)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(ts.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(ts.info("UserId set, identifying with PostHog"),e.identify(t.event.userId));var r=e.calculateEventProperties(i,t.event.properties);return t.event.properties=Object.assign({},r,t.event.properties),t};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>t(e,e.event.event),page:e=>t(e,mr),identify:e=>t(e,br),screen:e=>t(e,"$screen")}})(e)).then(()=>{t()})})}(this,()=>this.Wi()):this.Wi(),ue(this.config._onCapture)&&this.config._onCapture!==fo&&(hi.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",e=>this.config._onCapture(e.event,e))),this.config.ip&&hi.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}Vi(t){var i,r,s,n,o,a,l,u=performance.now(),c=U({},e.__defaultExtensionClasses,this.config.__extensionClasses),h=[];c.featureFlags&&this.Pi.push(this.featureFlags=null!==(i=this.featureFlags)&&void 0!==i?i:new c.featureFlags(this)),c.exceptions&&this.Pi.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new c.exceptions(this)),c.historyAutocapture&&this.Pi.push(this.historyAutocapture=new c.historyAutocapture(this)),c.tracingHeaders&&this.Pi.push(new c.tracingHeaders(this)),c.siteApps&&this.Pi.push(this.siteApps=new c.siteApps(this)),c.sessionRecording&&!t&&this.Pi.push(this.sessionRecording=new c.sessionRecording(this)),this.config.disable_scroll_properties||h.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),c.autocapture&&this.Pi.push(this.autocapture=new c.autocapture(this)),c.surveys&&this.Pi.push(this.surveys=null!==(s=this.surveys)&&void 0!==s?s:new c.surveys(this)),c.logs&&this.Pi.push(this.logs=null!==(n=this.logs)&&void 0!==n?n:new c.logs(this)),c.conversations&&this.Pi.push(this.conversations=null!==(o=this.conversations)&&void 0!==o?o:new c.conversations(this)),c.productTours&&this.Pi.push(this.productTours=new c.productTours(this)),c.heatmaps&&this.Pi.push(this.heatmaps=new c.heatmaps(this)),c.webVitalsAutocapture&&this.Pi.push(this.webVitalsAutocapture=new c.webVitalsAutocapture(this)),c.exceptionObserver&&this.Pi.push(this.exceptionObserver=new c.exceptionObserver(this)),c.deadClicksAutocapture&&this.Pi.push(this.deadClicksAutocapture=new c.deadClicksAutocapture(this,Qr)),c.toolbar&&this.Pi.push(this.toolbar=null!==(a=this.toolbar)&&void 0!==a?a:new c.toolbar(this)),c.experiments&&this.Pi.push(this.experiments=null!==(l=this.experiments)&&void 0!==l?l:new c.experiments(this)),this.Pi.forEach(e=>{e.initialize&&h.push(()=>{null==e.initialize||e.initialize()})}),h.push(()=>{if(this.Zi){var e=this.Zi;this.Zi=void 0,this.Rr(e)}}),this.Gi(h,u)}Gi(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout(()=>{this.Gi(e,t)},0);var i=e.shift();if(i)try{i()}catch(e){hi.error("Error initializing extension:",e)}}var r=Math.round(performance.now()-t);this.register_for_session({[ar]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[lr]:r}),this.config.__preview_deferred_init_extensions&&hi.info("PostHog extensions initialized ("+r+"ms)")}Rr(e){var t;if(!M||!M.body)return hi.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Rr(e)},500);this.config.__preview_deferred_init_extensions&&(this.Zi=e),this.Qi=e,this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=ie(e.supportedCompression,Qs)?Qs:ie(e.supportedCompression,en)?en:void 0),null!=(t=e.analytics)&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Ni?this.Ni:gr}),this.Pi.forEach(t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e))}Wi(){try{this.config.loaded(this)}catch(e){hi.critical("`loaded` function failed",e)}if(this.Ji(),this.config.internal_or_test_user_hostname&&null!=O&&O.hostname){var e=O.hostname,t=this.config.internal_or_test_user_hostname;("string"==typeof t?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.Ri())&&this.Ki()},1),this.Yi=new Zs(this),this.Yi.load()}Ji(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this.Ui)||e.enable())}_dom_loaded(){this.is_capturing()&&xr(this.__request_queue,e=>this.Bi(e)),this.__request_queue=[],this.Ji()}_handle_unload(){var e,t,i,r;null==(e=this.surveys)||e.handlePageUnload(),this.config.request_batching?(this.Xi()&&this.capture(yr),null==(t=this.logs)||t.flushLogs("sendBeacon"),null==(i=this.Ui)||i.unload(),null==(r=this.zi)||r.unload()):this.Xi()&&this.capture(yr,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(Eo?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=Cn(e.url,{ip:this.config.ip?1:0}),e.headers=U({},this.config.request_headers,e.headers),e.compression="best-available"===e.compression?this.compression:e.compression,e.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(e=>{var t,i,r,s=U({},e);s.timeout=s.timeout||6e4,s.url=Dn(s.url,s.compression);var n=null!==(t=s.transport)&&void 0!==t?t:"fetch",o=Nn.filter(e=>!s.disableTransport||!e.transport||!s.disableTransport.includes(e.transport)),a=null!==(i=null==(r=function(e){for(var t=0;e.length>t;t++)if(e[t].transport===n)return e[t]}(o))?void 0:r.method)&&void 0!==i?i:o[0].method;if(!a)throw new Error("No available transport method");"sendBeacon"!==n&&s.data&&s.compression===Qs&&q&&!Mn?Ln(s).then(e=>{a(e)}).catch(t=>{if(Y(t))return Mn=!0,void a(U({},s,{compression:void 0,url:Dn(e.url,void 0)}));(e=>{if(!e||"object"!=typeof e)return!1;var t="name"in e?String(e.name):"";return Y(e)||t===X})(t)&&(Mn=!0),a(s)}):a(s)})(U({},e,{callback:t=>{var i,r;this.rateLimiter.checkForLimiting(t),400>t.statusCode||null==(i=(r=this.config).on_request_error)||i.call(r,t),null==e.callback||e.callback(t)}}))))}Bi(e){this.zi?this.zi.retriableRequest(e):this._send_request(e)}_execute_array(e){_o++;try{var t,i=[],r=[],s=[];xr(e,e=>{if(e)if(le(t=e[0]))s.push(e);else if(ue(e))try{e.call(this)}catch(t){hi.error("Error executing queued PostHog call",e,t)}else le(e)&&"alias"===t?i.push(e):le(e)&&-1!==t.indexOf("capture")&&ue(this[t])?s.push(e):r.push(e)});var n=function(e,t){xr(e,function(e){try{if(le(e[0])){var i=t;Er(e,function(e){i=i[e[0]].apply(i,e.slice(1))})}else t[e[0]].apply(t,e.slice(1))}catch(t){hi.error("Error executing queued PostHog call",e,t)}})};n(i,this),n(r,this),n(s,this)}finally{_o--}}push(t){if(_o>0&&le(t)&&pe(t[0])){var i=e.prototype[t[0]];ue(i)&&i.apply(this,t.slice(1))}else this._execute_array([t])}capture(e,t,i){var r,s,n,o,a;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Ui){if(this.is_capturing())if(!de(e)&&pe(e)){var l=!this.config.opt_out_useragent_filter&&this._is_bot();if(!l||this.config.__preview_capture_bot_pageviews){var u=null!=i&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==u||!u.isRateLimited){null!=t&&t.$current_url&&!pe(null==t?void 0:t.$current_url)&&(hi.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==t||delete t.$current_url),"$exception"!==e||null!=i&&i.en||hi.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var c=new Date,h=(null==i?void 0:i.timestamp)||c,d=(null==i?void 0:i.uuid)||Dr(),p={uuid:d,event:e,properties:this.calculateEventProperties(e,t||{},h,d)};e===mr&&this.config.__preview_capture_bot_pageviews&&l&&(p.event="$bot_pageview",p.properties.$browser_type="bot"),u&&(p.properties.$lib_rate_limit_remaining_tokens=u.remainingTokens),(null==i?void 0:i.$set)&&(p.$set=null==i?void 0:i.$set);var v,g,_,f=this.tn(null==i?void 0:i.$set_once,e!==wr,e===br);if(f&&(p.$set_once=f),null!=i&&i._noTruncate||(s=this.config.properties_string_max_length,n=p,o=e=>pe(e)?e.slice(0,s):e,a=new Set,p=function e(t,i){return t!==Object(t)?o?o(t):t:a.has(t)?void 0:(a.add(t),le(t)?(r=[],xr(t,t=>{r.push(e(t))})):(r={},Er(t,(t,i)=>{a.has(t)||(r[i]=e(t,i))})),r);var r}(n)),p.timestamp=h,de(null==i?void 0:i.timestamp)||(p.properties.$event_time_override_provided=!0,p.properties.$event_time_override_system_time=c),e===Ns||e===js){var m=null==t?void 0:t[Hs],y=null==t?void 0:t[zs];(e=>{try{var t=(s=""+lo+(r=i=e).id,r.current_iteration&&r.current_iteration>0&&(s=""+lo+r.id+"_"+r.current_iteration),s);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(i){ao.error("Failed to persist survey seen state",i)}var i,r,s})({id:m,current_iteration:y}),p.$set=U({},p.$set,{[(v={id:m,current_iteration:y},g=e===js?"responded":"dismissed",_="$survey_"+g+"/"+v.id,v.current_iteration&&v.current_iteration>0&&(_="$survey_"+g+"/"+v.id+"/"+v.current_iteration),_)]:!0})}else e===Ds&&(p.$set=U({},p.$set,{[Us]:(new Date).toISOString()}));if(e===Ws){var b=null==t?void 0:t[Xs];b&&(p.$set=U({},p.$set,{[Gs+"/"+b]:(new Date).toISOString()}))}var w=U({},p.properties.$set,p.$set);if(he(w)||this.setPersonPropertiesForFlags(w),!_e(this.config.before_send)){var x=this.rn(p);if(!x)return;p=x}this.Li.emit("eventCaptured",p);var E={method:"POST",url:null!==(r=null==i?void 0:i._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:p,compression:"best-available",batchKey:null==i?void 0:i._batchKey,transport:null==i?void 0:i.transport};return!this.config.request_batching||i&&(null==i||!i._batchKey)||null!=i&&i.send_instantly?this.Bi(E):this.Ui.enqueue(E),p}hi.critical("This capture call is ignored due to client rate limiting.")}}else hi.error("No event name provided to posthog.capture")}else hi.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",t=>e(t.event,t))}calculateEventProperties(e,t,i,r,s){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return t;var n=s?void 0:this.persistence.remove_event_timer(e),o=U({},t);if(o.token=this.config.token,o.$config_defaults=this.config.defaults,this.Ri()&&(o.$cookieless_mode=!0),"$snapshot"===e){var a=U({},this.persistence.properties(),this.sessionPersistence.properties());return o.distinct_id=a.distinct_id,(!pe(o.distinct_id)&&!fe(o.distinct_id)||ve(o.distinct_id))&&hi.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),o}var l,u=function(e,t){var i,r,s,n;if(!L)return{};var o,a,l,u,c,h,d,p,v=e?[...ps,...t||[]]:[],[g,_]=function(e){for(var t=0;Pt.length>t;t++){var[i,r]=Pt[t],s=i.exec(e),n=s&&(ue(r)?r(s,e):r);if(n)return n}return["",""]}(L);return kr($r({$os:g,$os_version:_,$browser:Et(L,navigator.vendor),$device:Ft(L),$device_type:(a=L,l={userAgentDataPlatform:null==(i=navigator)||null==(i=i.userAgentData)?void 0:i.platform,maxTouchPoints:null==(r=navigator)?void 0:r.maxTouchPoints,screenWidth:null==F||null==(s=F.screen)?void 0:s.width,screenHeight:null==F||null==(n=F.screen)?void 0:n.height,devicePixelRatio:null==F?void 0:F.devicePixelRatio},p=Ft(a),p===Le||p===qe||"Kobo"===p||"Kindle Fire"===p||p===pt?Ae:p===it||p===st||p===rt||p===ct?"Console":p===Ne?"Wearable":p?Oe:"Android"===(null==l?void 0:l.userAgentDataPlatform)&&(null!==(u=null==l?void 0:l.maxTouchPoints)&&void 0!==u?u:0)>0?600>Math.min(null!==(c=null==l?void 0:l.screenWidth)&&void 0!==c?c:0,null!==(h=null==l?void 0:l.screenHeight)&&void 0!==h?h:0)/(null!==(d=null==l?void 0:l.devicePixelRatio)&&void 0!==d?d:1)?Oe:Ae:"Desktop"),$timezone:Ss(),$timezone_offset:Ps()}),{$current_url:cs(null==O?void 0:O.href,v,gs),$host:null==O?void 0:O.host,$pathname:null==O?void 0:O.pathname,$raw_user_agent:L.length>1e3?L.substring(0,997)+"...":L,$browser_version:St(L,navigator.vendor),$browser_language:bs(),$browser_language_prefix:(o=bs(),"string"==typeof o?o.split("-")[0]:void 0),$screen_height:null==F?void 0:F.screen.height,$screen_width:null==F?void 0:F.screen.width,$viewport_height:null==F?void 0:F.innerHeight,$viewport_width:null==F?void 0:F.innerWidth,$lib:j.LIB_NAME,$lib_version:j.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:c,windowId:h}=this.sessionManager.checkAndGetSessionAndWindowId(s,i.getTime());o.$session_id=c,o.$window_id=h}this.sessionPropsManager&&kr(o,this.sessionPropsManager.getSessionProps());try{var d;this.sessionRecording&&kr(o,this.sessionRecording.sdkDebugProperties),o.$sdk_debug_retry_queue_size=null==(d=this.zi)?void 0:d.length}catch(e){o.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===ro&&(o.$lib_custom_api_host=this.config.api_host),l=e!==mr||s?e!==yr||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,r),o=kr(o,l),e===mr&&M&&(o.title=M.title),!de(n)){var p=i.getTime()-n;o.$duration=parseFloat((p/1e3).toFixed(3))}L&&this.config.opt_out_useragent_filter&&(o.$browser_type=this._is_bot()?"bot":"browser"),(o=kr({},u,this.persistence.properties(),this.sessionPersistence.properties(),o)).$is_identified=this._isIdentified(),le(this.config.property_denylist)?Er(this.config.property_denylist,function(e){delete o[e]}):hi.error(wo+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var v=this.config.sanitize_properties;v&&(hi.error(bo),o=v(o,e));var g=this.nn();return o.$process_person_profile=g,g&&!s&&this.sn("_calculate_event_properties"),o}tn(e,t,i){var r;if(void 0===t&&(t=!0),void 0===i&&(i=!1),!this.persistence||!this.nn())return e;if(this.Oi&&!i)return e;var s=this.persistence.get_initial_props(),n=null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps(),o=kr({},s,n||{},e||{}),a=this.config.sanitize_properties;return a&&(hi.error(bo),o=a(o,"$set_once")),t&&(this.Oi=!0),he(o)?void 0:o}register(e,t){var i;null==(i=this.persistence)||i.register(e,t)}register_once(e,t,i){var r;null==(r=this.persistence)||r.register_once(e,t,i)}register_for_session(e){var t;null==(t=this.sessionPersistence)||t.register(e)}unregister(e){var t;null==(t=this.persistence)||t.unregister(e)}unregister_for_session(e){var t;null==(t=this.sessionPersistence)||t.unregister(e)}an(e,t){this.register({[e]:t})}getFeatureFlag(e,t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return null==(t=this.featureFlags)?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagResult(e,t)}isFeatureEnabled(e,t){var i;return null==(i=this.featureFlags)?void 0:i.isFeatureEnabled(e,t)}reloadFeatureFlags(){var e;null==(e=this.featureFlags)||e.reloadFeatureFlags()}updateFlags(e,t,i){var r;null==(r=this.featureFlags)||r.updateFlags(e,t,i)}updateEarlyAccessFeatureEnrollment(e,t,i){var r;null==(r=this.featureFlags)||r.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t,i){var r;return void 0===t&&(t=!1),null==(r=this.featureFlags)?void 0:r.getEarlyAccessFeatures(e,t,i)}on(e,t){return this.Li.on(e,t)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:yo}),()=>{})}onSessionId(e){var t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.onSessionId(e))&&void 0!==t?t:()=>{}}getSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:yo})}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:yo})}renderSurvey(e,t){var i;null==(i=this.surveys)||i.renderSurvey(e,t)}displaySurvey(e,t){var i;void 0===t&&(t=co),null==(i=this.surveys)||i.displaySurvey(e,t)}cancelPendingSurvey(e){var t;null==(t=this.surveys)||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,i;return null!==(t=null==(i=this.surveys)?void 0:i.canRenderSurvey(e))&&void 0!==t?t:{visible:!1,disabledReason:yo}}canRenderSurveyAsync(e,t){var i,r;return void 0===t&&(t=!1),null!==(i=null==(r=this.surveys)?void 0:r.canRenderSurveyAsync(e,t))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:yo})}un(e){return!e||ve(e)?(hi.critical("Unique user id has not been set in posthog.identify"),!1):e===or?(hi.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(hi.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(e,t,i){if(!this.__loaded||!this.persistence)return hi.uninitializedWarning("posthog.identify");if(fe(e)&&(e=e.toString(),hi.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.un(e)&&this.sn("posthog.identify")){var r=this.get_distinct_id();this.register({$user_id:e}),this.get_property(_i)||this.register_once({$had_persisted_distinct_id:!0,$device_id:r},""),e!==r&&e!==this.get_property(fi)&&(this.unregister(fi),this.register({distinct_id:e}));var s,n=(this.persistence.get_property(Zi)||pr)===pr;e!==r&&n?(this.persistence.set_property(Zi,vr),this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!1),this.capture(br,{distinct_id:e,$anon_distinct_id:r},{$set:t||{},$set_once:i||{}}),this.$i=Zn(e,t,i),null==(s=this.featureFlags)||s.setAnonymousDistinctId(r)):(t||i)&&this.setPersonProperties(t,i),e!==r&&(this.reloadFeatureFlags(),this.unregister(Xi))}}setPersonProperties(e,t){if((e||t)&&this.sn("posthog.setPersonProperties")){var i=Zn(this.get_distinct_id(),e,t);this.$i!==i?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.$i=i):hi.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,i){if(e&&t){var r=this.getGroups(),s=r[e]!==t;if(s&&this.resetGroupPropertiesForFlags(e),this.register({$groups:U({},r,{[e]:t})}),s||i){var n={$group_type:e,$group_key:t};i&&(n.$group_set=i),this.capture(wr,n)}i&&this.setGroupPropertiesForFlags({[e]:i}),s&&!i&&this.reloadFeatureFlags()}else hi.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){var i;void 0===t&&(t=!0),null==(i=this.featureFlags)||i.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){var e;null==(e=this.featureFlags)||e.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,t){var i;void 0===t&&(t=!0),this.sn("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;null==(t=this.featureFlags)||t.resetGroupPropertiesForFlags(e)}reset(e){var t,i,r,s,n,o,a,l;if(hi.info("reset"),!this.__loaded)return hi.uninitializedWarning("posthog.reset");var u,c=this.get_property(_i),h=this.get_property($i);if(this.consent.reset(),null==(t=this.persistence)||t.clear(),null==(i=this.sessionPersistence)||i.clear(),de(h)||null==(u=this.persistence)||u.register({[$i]:h}),null==(r=this.surveys)||r.reset(),null==(s=this.Yi)||s.stop(),null==(n=this.featureFlags)||n.reset(),null==(o=this.conversations)||o.reset(),null==(a=this.persistence)||a.set_property(Zi,pr),null==(l=this.sessionManager)||l.resetSessionId(),this.$i=null,this.config.cookieless_mode===dr)this.register_once({distinct_id:or,$device_id:null},"");else{var d=this.config.get_device_id(Dr());this.register_once({distinct_id:d,$device_id:e?d:c},"")}this.register({$last_posthog_reset:(new Date).toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}setIdentity(e,t){var i;this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),null==(i=this.conversations)||i.ln()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(e=this.conversations)||e.hn()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return null!==(e=null==(t=this.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==e?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(null!=e&&e.withTimestamp&&i){var s,n=null!==(s=e.timestampLookBack)&&void 0!==s?s:10;if(!i)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return r}alias(e,t){return e===this.get_property(gi)?(hi.critical("Attempting to create alias for existing People user - aborting."),-2):this.sn("posthog.alias")?(de(t)&&(t=this.get_distinct_id()),e!==t?(this.an(fi,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(hi.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=U({},this.config);if(ce(e)){var i,r,s,n,o,a,l,u,c,h;kr(this.config,Po(e));var d=this.Hi();null==(i=this.persistence)||i.update_config(this.config,t,d),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Os(U({},this.config,{persistence:"sessionStorage"}),d);var p=this.Di(this.config.debug);ye(p)&&(this.config.debug=p),ye(this.config.debug)&&(this.config.debug?(j.DEBUG=!0,Br.R()&&Br.N("ph_debug",!0),hi.info("set_config",{config:e,oldConfig:t,newConfig:U({},this.config)})):(j.DEBUG=!1,Br.R()&&Br.q("ph_debug"))),null==(r=this.exceptionObserver)||r.onConfigChange(),null==(s=this.exceptions)||s.onConfigChange(),null==(n=this.sessionRecording)||n.startIfEnabledOrStop(),null==(o=this.autocapture)||o.startIfEnabled(),null==(a=this.heatmaps)||a.startIfEnabled(),null==(l=this.exceptionObserver)||l.startIfEnabledOrStop(),null==(u=this.deadClicksAutocapture)||u.startIfEnabledOrStop(),null==(c=this.surveys)||c.loadIfEnabled(),this.cn(),null==(h=this.externalIntegrations)||h.startIfEnabledOrStop()}}_overrideSDKInfo(e,t){j.LIB_NAME=e,j.LIB_VERSION=t}startSessionRecording(e){var t,i,r,s,n,o=!0===e,a={sampling:o||!(null==e||!e.sampling),linked_flag:o||!(null==e||!e.linked_flag),url_trigger:o||!(null==e||!e.url_trigger),event_trigger:o||!(null==e||!e.event_trigger)};Object.values(a).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(r=this.sessionRecording)||r.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!(null==(e=this.sessionRecording)||!e.started)}captureException(e,t){if(this.exceptions){var i=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(e,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(U({},r,t))}}addExceptionStep(e,t){var i;null==(i=this.exceptions)||i.addExceptionStep(e,t)}captureLog(e){var t;null==(t=this.logs)||t.captureLog(e)}get logger(){var t,i;return null!==(t=null==(i=this.logs)?void 0:i.logger)&&void 0!==t?t:e.dn}startExceptionAutocapture(e){this.set_config({capture_exceptions:null==e||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,i;return null!==(t=null==(i=this.toolbar)?void 0:i.loadToolbar(e))&&void 0!==t&&t}get_property(e){var t;return null==(t=this.persistence)?void 0:t.props[e]}getSessionProperty(e){var t;return null==(t=this.sessionPersistence)?void 0:t.props[e]}toString(){var e,t=null!==(e=this.config.name)&&void 0!==e?e:xo;return t!==xo&&(t=xo+"."+t),t}_isIdentified(){var e,t;return(null==(e=this.persistence)?void 0:e.get_property(Zi))===vr||(null==(t=this.sessionPersistence)?void 0:t.get_property(Zi))===vr}nn(){var e,t;return!("never"===this.config.person_profiles||this.config.person_profiles===gr&&!this._isIdentified()&&he(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[fi])&&(null==(t=this.persistence)||null==(t=t.props)||!t[sr]))}Xi(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&(!0===this.config.capture_pageview||"history_change"===this.config.capture_pageview)}createPersonProfile(){this.nn()||this.sn("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.sn("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}sn(e){return"never"===this.config.person_profiles?(hi.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.an(sr,!0),!0)}Hi(){if("always"===this.config.cookieless_mode)return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==hr)}cn(){var e,t,i,r,s=this.Hi();return(null==(e=this.persistence)?void 0:e._r)!==s&&(null==(i=this.persistence)||i.set_disabled(s)),(null==(t=this.sessionPersistence)?void 0:t._r)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s)),s}opt_in_capturing(t){var i;if(this.config.cookieless_mode!==dr){if(this.Ri()){var r,s,n,o,a;this.reset(!0),null==(r=this.sessionManager)||r.destroy(),null==(s=this.pageViewManager)||s.destroy(),this.sessionManager=new Kn(this),this.pageViewManager=new ns(this),this.persistence&&(this.sessionPropsManager=new Wn(this,this.sessionManager,this.persistence));var l,u=null!==(n=null==(o=this.config.__extensionClasses)?void 0:o.sessionRecording)&&void 0!==n?n:null==(a=e.__defaultExtensionClasses)?void 0:a.sessionRecording;u&&(this.sessionRecording=this.Mi(this.sessionRecording,new u(this)),this.Qi&&(null==(l=this.sessionRecording)||null==l.onRemoteConfig||l.onRemoteConfig(this.Qi)))}var c,h;this.consent.optInOut(!0),this.cn(),this.Ji(),null==(i=this.sessionRecording)||i.startIfEnabledOrStop(),this.config.cookieless_mode==hr&&(null==(c=this.surveys)||c.loadIfEnabled()),(de(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!==(h=null==t?void 0:t.captureEventName)&&void 0!==h?h:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Ki()}else hi.warn(mo)}opt_out_capturing(){var e,t,i;this.config.cookieless_mode!==dr?(this.config.cookieless_mode===hr&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.cn(),this.config.cookieless_mode===hr&&(this.register({distinct_id:or,$device_id:null}),null==(e=this.sessionRecording)||e.stopRecording(),this.sessionRecording=void 0,null==(t=this.sessionManager)||t.destroy(),null==(i=this.pageViewManager)||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.Ki(),this.Ji())):hi.warn(mo)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return 1===e?"granted":0===e?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===dr||(this.config.cookieless_mode===hr?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.cn()}_is_bot(){return R?Yn(R,this.config.custom_blocked_useragents):void 0}Ki(){M&&("visible"===M.visibilityState?this.Fi||(this.Fi=!0,this.capture(mr,{title:M.title},{send_instantly:!0}),this.Ai&&(M.removeEventListener(_r,this.Ai),this.Ai=null)):this.Ai||(this.Ai=this.Ki.bind(this),Mr(M,_r,this.Ai)))}debug(e){!1===e?(null==F||F.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==F||F.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}Lr(){var e,t,i,r,s,n,o=this.qi||{};return"advanced_disable_flags"in o?!!o.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(hi.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(i="advanced_disable_decide",r=hi,s=(t="advanced_disable_flags")in(e=o)&&!_e(e[t]),n=i in e&&!_e(e[i]),s?e[t]:!!n&&(r&&r.warn("Config field '"+i+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[i]))}rn(e){if(_e(this.config.before_send))return e;var t=le(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var r of t){if(i=r(i),_e(i)){var s="Event '"+e.event+"' was rejected in beforeSend function";return be(e.event)?hi.warn(s+". This can cause unexpected behavior."):hi.info(s),null}i.properties&&!he(i.properties)||hi.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return i}getPageViewId(){var e;return null==(e=this.pageViewManager.dr)?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}Di(e){var t=ye(e)&&!e,i=Br.R()&&"true"===Br.A("ph_debug");return!t&&(!!i||e)}};$o.__defaultExtensionClasses={},$o.dn={trace:io=()=>{},debug:io,info:io,warn:io,error:io,fatal:io},function(e,t){for(var i=0;t.length>i;i++)e.prototype[t[i]]=Fr(e.prototype[t[i]])}($o,["identify"]);function Io(e){return e instanceof Element&&(e.id===nr||!(null==e.closest||!e.closest(".toolbar-global-fade-container")))}function Ro(e){return!!e&&1===e.nodeType}function Mo(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Oo(e){return!!e&&3===e.nodeType}function Co(e){return!!e&&11===e.nodeType&&Ro(e.host)}function To(e){return e?re(e).split(/\s+/):[]}function Ao(e){var t=null==F?void 0:F.location.href;return!!(t&&e&&e.some(e=>t.match(e)))}function qo(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return To(t)}function Lo(e){return _e(e)?null:re(e).split(/(\s+)/).filter(e=>ta(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Do(e){var t="";return Go(e)&&!Xo(e)&&e.childNodes&&e.childNodes.length&&Er(e.childNodes,function(e){var i;Oo(e)&&e.textContent&&(t+=null!==(i=Lo(e.textContent))&&void 0!==i?i:"")}),re(t)}function No(e){return de(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var jo=["a","button","form","input","select","textarea","label"];function Ho(e,t){if(de(t))return!0;var i,r=function(e){if(t.some(t=>e.matches(t)))return{v:!0}};for(var s of e)if(i=r(s))return i.v;return!1}function zo(e){var t=e.parentNode;return!(!t||!Ro(t))&&t}var Uo=["next","previous","prev",">","<"],Bo=[".ph-no-rageclick",".ph-no-capture"],Vo=e=>!e||Mo(e,"html")||!Ro(e),Wo=(e,t)=>{if(!F||Vo(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,r=[e],s=e;s.parentNode&&!Mo(s,"body");)if(Co(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=zo(s);if(!n)break;if(t||jo.indexOf(n.tagName.toLowerCase())>-1)i=!0;else{var o=F.getComputedStyle(n);o&&"pointer"===o.getPropertyValue("cursor")&&(i=!0)}r.push(n),s=n}return{parentIsUsefulElement:i,targetElementList:r}};function Go(e){for(var t=e;t.parentNode&&!Mo(t,"body");t=t.parentNode){var i=qo(t);if(ie(i,"ph-sensitive")||ie(i,"ph-no-capture"))return!1}if(ie(qo(e),"ph-include"))return!0;var r=e.type||"";if(pe(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=e.name||e.id||"";return!pe(s)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,""))}function Xo(e){return!!(Mo(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Mo(e,"select")||Mo(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var Ko="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",Yo=new RegExp("^(?:"+Ko+")$"),Jo=new RegExp(Ko),Zo="\\d{3}-?\\d{2}-?\\d{4}",Qo=new RegExp("^("+Zo+")$"),ea=new RegExp("("+Zo+")");function ta(e,t){if(void 0===t&&(t=!0),_e(e))return!1;if(pe(e)){if(e=re(e),(t?Yo:Jo).test((e||"").replace(/[- ]/g,"")))return!1;if((t?Qo:ea).test(e))return!1}return!0}function ia(e){var t=Do(e);return ta(t=(t+" "+ra(e)).trim())?t:""}function ra(e){var t="";return e&&e.childNodes&&e.childNodes.length&&Er(e.childNodes,function(e){var i;if(e&&"span"===(null==(i=e.tagName)?void 0:i.toLowerCase()))try{var r=Do(e);t=(t+" "+r).trim(),e.childNodes&&e.childNodes.length&&(t=(t+" "+ra(e)).trim())}catch(e){hi.error("[AutoCapture]",e)}}),t}function sa(e){return e.replace(/"|\\"/g,'\\"')}function na(e){var t=e.attr__class;return t?le(t)?t:To(t):void 0}var oa=class{constructor(e){this.disabled=!1===e;var t=ce(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,i){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(e-r.x)+Math.abs(t-r.y)<this.thresholdPx&&this.timeoutMs>i-r.timestamp){if(this.clicks.push({x:e,y:t,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:i}];return!1}},aa="$copy_autocapture",la=di("[AutoCapture]");function ua(e,t){return t.length>e?t.slice(0,e)+"...":t}function ca(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!Ro(t));return t}var ha=di("[ExceptionAutocapture]");function da(e,t,i){try{if(!(t in e))return()=>{};var r=e[t],s=i(r);return ue(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=s,()=>{e[t]=r}}catch(e){return()=>{}}}var pa=di("[TracingHeaders]"),va=di("[Web Vitals]"),ga=9e5,_a="disabled",fa="lazy_loading",ma="awaiting_config",ya="missing_config";di("[SessionRecording]"),di("[SessionRecording]");var ba="[SessionRecording]",wa=di(ba),xa=di("[Heatmaps]");function Ea(e){return ce(e)&&"clientX"in e&&"clientY"in e&&fe(e.clientX)&&fe(e.clientY)}var ka=di("[Product Tours]"),Sa=["$set_once","$set"],Pa=di("[SiteApps]"),Fa="Error while initializing PostHog app with config id ";function $a(e,t,i){if(_e(e))return!1;switch(i){case"exact":return e===t;case"contains":var r=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch(e){return!1}default:return!1}}var Ia,Ra=class{constructor(e){this.vn=new Gn,this.fn=(e,t)=>this.pn(e,t)&&this.gn(e,t)&&this.mn(e,t)&&this.yn(e,t),this.pn=(e,t)=>null==t||!t.event||(null==e?void 0:e.event)===(null==t?void 0:t.event),this._instance=e,this.bn=new Set,this._n=new Set}init(){var e,t;de(null==(e=this._instance)?void 0:e._addCaptureHook)||null==(t=this._instance)||t._addCaptureHook((e,t)=>{this.on(e,t)})}register(e){var t,i;if(!de(null==(t=this._instance)?void 0:t._addCaptureHook)&&(e.forEach(e=>{var t,i;null==(t=this._n)||t.add(e),null==(i=e.steps)||i.forEach(e=>{var t;null==(t=this.bn)||t.add((null==e?void 0:e.event)||"")})}),null!=(i=this._instance)&&i.autocapture)){var r,s=new Set;e.forEach(e=>{var t;null==(t=e.steps)||t.forEach(e=>{null!=e&&e.selector&&s.add(null==e?void 0:e.selector)})}),null==(r=this._instance)||r.autocapture.setElementSelectors(s)}}on(e,t){var i;null!=t&&0!=e.length&&(this.bn.has(e)||this.bn.has(null==t?void 0:t.event))&&this._n&&(null==(i=this._n)?void 0:i.size)>0&&this._n.forEach(e=>{this.wn(t,e)&&this.vn.emit("actionCaptured",e.name)})}xn(e){this.onAction("actionCaptured",t=>e(t))}wn(e,t){if(null==(null==t?void 0:t.steps))return!1;for(var i of t.steps)if(this.fn(e,i))return!0;return!1}onAction(e,t){return this.vn.on(e,t)}gn(e,t){if(null!=t&&t.url){var i,r=null==e||null==(i=e.properties)?void 0:i.$current_url;if(!r||"string"!=typeof r)return!1;if(!$a(r,t.url,t.url_matching||"contains"))return!1}return!0}mn(e,t){return!!this.Sn(e,t)&&!!this.kn(e,t)&&!!this.Cn(e,t)}Sn(e,t){var i;if(null==t||!t.href)return!0;var r=this.In(e);if(r.length>0)return r.some(e=>$a(e.href,t.href,t.href_matching||"exact"));var s,n=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";return!!n&&$a((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",t.href,t.href_matching||"exact")}kn(e,t){var i;if(null==t||!t.text)return!0;var r=this.In(e);if(r.length>0)return r.some(e=>$a(e.text,t.text,t.text_matching||"exact")||$a(e.$el_text,t.text,t.text_matching||"exact"));var s,n,o,a=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";return!!a&&(s=function(e){for(var t,i=[],r=/(?::|")text="(.*?)"/g;!_e(t=r.exec(e));)i.includes(t[1])||i.push(t[1]);return i}(a),n=t.text,o=t.text_matching||"exact",s.some(e=>$a(e,n,o)))}Cn(e,t){var i,r;if(null==t||!t.selector)return!0;var s=null==e||null==(i=e.properties)?void 0:i.$element_selectors;if(null!=s&&s.includes(t.selector))return!0;var n=(null==e||null==(r=e.properties)?void 0:r.$elements_chain)||"";if(t.selector_regex&&n)try{return new RegExp(t.selector_regex).test(n)}catch(e){return!1}return!1}In(e){var t;return null==(null==e||null==(t=e.properties)?void 0:t.$elements)?[]:null==e?void 0:e.properties.$elements}yn(e,t){return null==t||!t.properties||0===t.properties.length||to(t.properties.reduce((e,t)=>{var i=le(t.value)?t.value.map(String):null!=t.value?[String(t.value)]:[];return e[t.key]={values:i,operator:t.operator||"exact"},e},{}),null==e?void 0:e.properties)}},Ma=class{constructor(e){this._instance=e,this.Tn=new Map,this.En=new Map,this.Mn=new Map}Pn(e,t){return!!e&&to(e.propertyFilters,null==t?void 0:t.properties)}Rn(e,t){var i=new Map;return e.forEach(e=>{var r;null==(r=e.conditions)||null==(r=r[t])||null==(r=r.values)||r.forEach(t=>{if(null!=t&&t.name){var r=i.get(t.name)||[];r.push(e.id),i.set(t.name,r)}})}),i}On(e,t,i){var r=(i===Cs?this.Tn:this.En).get(e),s=[];return this.Ln(e=>{s=e.filter(e=>null==r?void 0:r.includes(e.id))}),s.filter(r=>{var s,n=null==(s=r.conditions)||null==(s=s[i])||null==(s=s.values)?void 0:s.find(t=>t.name===e);return this.Pn(n,t)})}register(e){var t;de(null==(t=this._instance)?void 0:t._addCaptureHook)||(this.Fn(e),this.An(e))}An(e){var t=e.filter(e=>{var t,i;return(null==(t=e.conditions)?void 0:t.actions)&&(null==(i=e.conditions)||null==(i=i.actions)||null==(i=i.values)?void 0:i.length)>0});0!==t.length&&(null==this.Nn&&(this.Nn=new Ra(this._instance),this.Nn.init(),this.Nn.xn(e=>{this.onAction(e)})),t.forEach(e=>{var t,i,r,s,n;e.conditions&&null!=(t=e.conditions)&&t.actions&&null!=(i=e.conditions)&&null!=(i=i.actions)&&i.values&&(null==(r=e.conditions)||null==(r=r.actions)||null==(r=r.values)?void 0:r.length)>0&&(null==(s=this.Nn)||s.register(e.conditions.actions.values),null==(n=e.conditions)||null==(n=n.actions)||null==(n=n.values)||n.forEach(t=>{if(t&&t.name){var i=this.Mn.get(t.name);i&&i.push(e.id),this.Mn.set(t.name,i||[e.id])}}))}))}Fn(e){var t,i=e.filter(e=>{var t,i;return(null==(t=e.conditions)?void 0:t.events)&&(null==(i=e.conditions)||null==(i=i.events)||null==(i=i.values)?void 0:i.length)>0}),r=e.filter(e=>{var t,i;return(null==(t=e.conditions)?void 0:t.cancelEvents)&&(null==(i=e.conditions)||null==(i=i.cancelEvents)||null==(i=i.values)?void 0:i.length)>0});0===i.length&&0===r.length||(null==(t=this._instance)||t._addCaptureHook((e,t)=>{this.onEvent(e,t)}),this.Tn=this.Rn(e,Cs),this.En=this.Rn(e,Ts))}onEvent(e,t){var i,r=this.le(),s=this.$n(),n=this.Dn(),o=(null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[s])||[];if(n===e&&t&&o.length>0){var a,l;r.info("event matched, removing item from activated items",{event:e,eventPayload:t,existingActivatedItems:o});var u=(null==t||null==(a=t.properties)?void 0:a.$survey_id)||(null==t||null==(l=t.properties)?void 0:l.$product_tour_id);if(u){var c=o.indexOf(u);0>c||(o.splice(c,1),this.qn(o))}}else{if(this.En.has(e)){var h=this.On(e,t,Ts);h.length>0&&(r.info("cancel event matched, cancelling items",{event:e,itemsToCancel:h.map(e=>e.id)}),h.forEach(e=>{var t=o.indexOf(e.id);0>t||o.splice(t,1),this.jn(e.id)}),this.qn(o))}if(this.Tn.has(e)){r.info("event name matched",{event:e,eventPayload:t,items:this.Tn.get(e)});var d=this.On(e,t,Cs);this.qn(o.concat(d.map(e=>e.id)||[]))}}}onAction(e){var t,i=this.$n(),r=(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i])||[];this.Mn.has(e)&&this.qn(r.concat(this.Mn.get(e)||[]))}qn(e){var t=this.le(),i=[...new Set(e)].filter(e=>!this.Hn(e));t.info("updating activated items",{activatedItems:i}),this.Un(i)}getActivatedIds(){var e,t=this.$n();return(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t])||[]}getEventToItemsMap(){return this.Tn}Bn(){return this.Nn}},Oa=class extends Ma{constructor(e){super(e)}$n(){return Wi}Dn(){return Ds}Ln(e){var t;null==(t=this._instance)||t.getSurveys(e)}jn(e){var t;null==(t=this._instance)||t.cancelPendingSurvey(e)}le(){return ao}Un(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({[Wi]:e})}Hn(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},Ca="SDK is not enabled or survey functionality is not yet loaded",Ta="Disabled. Not loading surveys.",Aa=null!=F&&F.location?hs(F.location.hash,"__posthog")||hs(location.hash,"state"):null,qa="_postHogToolbarParams",La=di("[Toolbar]"),Da=di("[FeatureFlags]"),Na=di("[FeatureFlags]",{debugEnabled:!0}),ja="\" failed. Feature flags didn't load in time.",Ha=e=>{for(var t={},i=0;e.length>i;i++)t[e[i]]=!0;return t},za=e=>{var t={};for(var[i,r]of Sr(e||{}))r&&(t[i]=r);return t},Ua=di("[Error tracking]"),Ba="Refusing to render web experiment since the viewer is a likely bot",Va={icontains:(e,t)=>!!F&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!F&&-1===t.href.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>!!F&&Jn(t.href,e),not_regex:(e,t)=>!!F&&!Jn(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e},Wa=di("[Conversations]"),Ga="Conversations not available yet.",Xa={featureFlags:class{constructor(e){this.Kn=!1,this.Yn=!1,this.Xn=!1,this.es=!1,this.ts=!1,this.rs=!1,this.ns=!1,this.ss=!1,this._instance=e,this.featureFlagEventHandlers=[]}get qt(){return this._instance.config}get ni(){return this._instance.persistence}os(e){return this._instance.get_property(e)}us(){var e,t;return null!==(e=null==(t=this.ni)?void 0:t.wr(this.qt.feature_flag_cache_ttl_ms))&&void 0!==e&&e}ls(){return!!this.us()&&(this.ss||this.Xn||(this.ss=!0,Da.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}hs(){var e,t=null!==(e=this.qt.evaluation_contexts)&&void 0!==e?e:this.qt.evaluation_environments;return!this.qt.evaluation_environments||this.qt.evaluation_contexts||this.ns||(Da.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.ns=!0),null!=t&&t.length?t.filter(e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||Da.error("Invalid evaluation context found:",e,"Expected non-empty string"),t}):[]}cs(){return this.hs().length>0}ds(){var e=this.qt.flag_keys;if(!de(e)){if(le(e))return e.filter(e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||Da.error("Invalid flag key found:",e,"Expected non-empty string"),t});Da.error("Invalid flag_keys found:",e,"Expected array of non-empty strings")}}initialize(){var e,t,{config:i}=this._instance,r=null!==(e=null==(t=i.bootstrap)?void 0:t.featureFlags)&&void 0!==e?e:{};if(Object.keys(r).length){var s,n,o=null!==(s=null==(n=i.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==s?s:{},a=Object.keys(r).filter(e=>!!r[e]).reduce((e,t)=>(e[t]=r[t]||!1,e),{}),l=Object.keys(o).filter(e=>a[e]).reduce((e,t)=>(o[t]&&(e[t]=o[t]),e),{});this.receivedFeatureFlags({featureFlags:a,featureFlagPayloads:l})}}updateFlags(e,t,i){var r=null!=i&&i.merge?this.getFlagVariants():{},s=null!=i&&i.merge?this.getFlagPayloads():{},n=U({},r,e),o=U({},s,t),a={};for(var[l,u]of Object.entries(n)){var c="string"==typeof u;a[l]={key:l,enabled:!!c||Boolean(u),variant:c?u:void 0,reason:void 0,metadata:de(null==o?void 0:o[l])?void 0:{id:0,version:void 0,description:void 0,payload:o[l]}}}this.receivedFeatureFlags({flags:a})}get hasLoadedFlags(){return this.Yn}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this.os(Di),t=this.os(Hi),i=this.os(zi);if(!i&&!t)return e||{};var r=kr({},e||{}),s=[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])];for(var n of s){var o,a,l=r[n],u=null==t?void 0:t[n],c=de(u)?null!==(o=null==l?void 0:l.enabled)&&void 0!==o&&o:!!u,h=de(u)?l.variant:"string"==typeof u?u:void 0,d=null==i?void 0:i[n],p=U({},l,{enabled:c,variant:c?null!=h?h:null==l?void 0:l.variant:void 0});c!==(null==l?void 0:l.enabled)&&(p.original_enabled=null==l?void 0:l.enabled),h!==(null==l?void 0:l.variant)&&(p.original_variant=null==l?void 0:l.variant),d&&(p.metadata=U({},null==l?void 0:l.metadata,{payload:d,original_payload:null==l||null==(a=l.metadata)?void 0:a.payload})),r[n]=p}return this.Kn||(Da.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:r}),this.Kn=!0),r}getFlagVariants(){var e=this.os(Ai),t=this.os(Hi);if(!t)return e||{};for(var i=kr({},e),r=Object.keys(t),s=0;r.length>s;s++)i[r[s]]=t[r[s]];return this.Kn||(Da.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this.Kn=!0),i}getFlagPayloads(){var e=this.os(Ni),t=this.os(zi);if(!t)return e||{};for(var i=kr({},e||{}),r=Object.keys(t),s=0;r.length>s;s++)i[r[s]]=t[r[s]];return this.Kn||(Da.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this.Kn=!0),i}reloadFeatureFlags(){this.es||this.qt.advanced_disable_feature_flags||this.vs||(this._instance.Li.emit("featureFlagsReloading",!0),this.vs=setTimeout(()=>{this.fs()},5))}ps(){clearTimeout(this.vs),this.vs=void 0}ensureFlagsLoaded(){this.Yn||this.Xn||this.vs||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.es=e}fs(e){var t;if(this.ps(),!this._instance.Lr())if(this.Xn)this.ts=!0;else{var i=this.qt.token,r=this.os(_i),s={token:i,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:U({},(null==(t=this.ni)?void 0:t.get_initial_props())||{},this.os(Ui)||{}),group_properties:this.os(Bi),timezone:Ss()};ge(r)||de(r)||(s.$device_id=r),(null!=e&&e.disableFlags||this.qt.advanced_disable_feature_flags)&&(s.disable_flags=!0),this.cs()&&(s.evaluation_contexts=this.hs());var n=this.ds();de(n)||(s.flag_keys=n);var o=!!this.qt.advanced_only_evaluate_survey_feature_flags,a=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.qt.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.Xn=!0,this._instance._send_request({method:"POST",url:a,data:s,compression:this.qt.disable_compression?void 0:en,timeout:this.qt.feature_flag_request_timeout_ms,callback:e=>{var t,i,r,n=!0;if(200===e.statusCode&&(this.ts||(this.$anon_distinct_id=void 0),n=!1),this.Xn=!1,!s.disable_flags||this.ts){this.rs=!n;var a=[];e.error?e.error instanceof Error?a.push("AbortError"===e.error.name?"timeout":"connection_error"):a.push("unknown_error"):200!==e.statusCode&&a.push("api_error_"+e.statusCode),null!=(t=e.json)&&t.errorsWhileComputingFlags&&a.push("errors_while_computing_flags");var l,u=!(null==(i=e.json)||null==(i=i.quotaLimited)||!i.includes("feature_flags"));u&&a.push("quota_limited"),null==(r=this.ni)||r.register({[Yi]:a}),u?Da.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):(s.disable_flags||this.receivedFeatureFlags(null!==(l=e.json)&&void 0!==l?l:{},n,{partialResponse:o}),this.ts&&(this.ts=!1,this.fs()))}}})}}getFeatureFlag(e,t){var i;if(void 0===t&&(t={}),!t.fresh||this.rs)if(this.Yn||this.getFlags()&&this.getFlags().length>0){if(!this.ls()){var r=this.getFeatureFlagResult(e,t);return null!==(i=null==r?void 0:r.variant)&&void 0!==i?i:null==r?void 0:r.enabled}}else Da.warn('getFeatureFlag for key "'+e+ja)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return null==t?void 0:t.payload}getFeatureFlagResult(e,t){if(void 0===t&&(t={}),!t.fresh||this.rs)if(this.Yn||this.getFlags()&&this.getFlags().length>0){if(!this.ls()){var i=this.getFlagVariants(),r=e in i,s=i[e],n=this.getFlagPayloads()[e],o=String(s),a=this.os(ji)||void 0,l=this.os(Ji)||void 0,u=this.os(Xi)||{};if(this.qt.advanced_feature_flags_dedup_per_session){var c,h=this._instance.get_session_id(),d=this.os(Ki);h&&h!==d&&(u={},null==(c=this.ni)||c.register({[Xi]:u,[Ki]:h}))}if((t.send_event||!("send_event"in t))&&(!(e in u)||!u[e].includes(o))){var p,v,g,_,f,m,y,b,w,x;le(u[e])?u[e].push(o):u[e]=[o],null==(p=this.ni)||p.register({[Xi]:u});var E=this.getFeatureFlagDetails(e),k=[...null!==(v=this.os(Yi))&&void 0!==v?v:[]];de(s)&&k.push("flag_missing");var S={$feature_flag:e,$feature_flag_response:s,$feature_flag_payload:n||null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(null==(g=this.qt.bootstrap)||null==(g=g.featureFlags)?void 0:g[e])||null,$feature_flag_bootstrapped_payload:(null==(_=this.qt.bootstrap)||null==(_=_.featureFlagPayloads)?void 0:_[e])||null,$used_bootstrap_value:!this.rs};de(null==E||null==(f=E.metadata)?void 0:f.version)||(S.$feature_flag_version=E.metadata.version);var P,F=null!==(m=null==E||null==(y=E.reason)?void 0:y.description)&&void 0!==m?m:null==E||null==(b=E.reason)?void 0:b.code;F&&(S.$feature_flag_reason=F),null!=E&&null!=(w=E.metadata)&&w.id&&(S.$feature_flag_id=E.metadata.id),de(null==E?void 0:E.original_variant)&&de(null==E?void 0:E.original_enabled)||(S.$feature_flag_original_response=de(E.original_variant)?E.original_enabled:E.original_variant),null!=E&&null!=(x=E.metadata)&&x.original_payload&&(S.$feature_flag_original_payload=null==E||null==(P=E.metadata)?void 0:P.original_payload),k.length&&(S.$feature_flag_error=k.join(",")),this._instance.capture("$feature_flag_called",S)}if(r){var $=n;if(!de(n))try{$=JSON.parse(n)}catch(e){}return{key:e,enabled:!!s,variant:"string"==typeof s?s:void 0,payload:$}}}}else Da.warn('getFeatureFlagResult for key "'+e+ja)}getRemoteConfigPayload(e,t){var i=this.qt.token,r={distinct_id:this._instance.get_distinct_id(),token:i};this.cs()&&(r.evaluation_contexts=this.hs());var s=this.ds();de(s)||(r.flag_keys=s),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:r,compression:this.qt.disable_compression?void 0:en,timeout:this.qt.feature_flag_request_timeout_ms,callback(i){var r,s=null==(r=i.json)?void 0:r.featureFlagPayloads;t((null==s?void 0:s[e])||void 0)}})}isFeatureEnabled(e,t){if(void 0===t&&(t={}),!t.fresh||this.rs){if(this.Yn||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlag(e,t);return de(i)?void 0:!!i}Da.warn('isFeatureEnabled for key "'+e+ja)}}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t,i){if(this.ni){this.Yn=!0;var r=this.getFlagVariants(),s=this.getFlagPayloads(),n=this.getFlagsWithDetails();!function(e,t,i,r,s,n){void 0===i&&(i={}),void 0===r&&(r={}),void 0===s&&(s={});var o,a,l=((a=(o=e).flags)?(o.featureFlags=Object.fromEntries(Object.keys(a).map(e=>{var t;return[e,null!==(t=a[e].variant)&&void 0!==t?t:a[e].enabled]})),o.featureFlagPayloads=Object.fromEntries(Object.keys(a).filter(e=>a[e].enabled).filter(e=>{var t;return null==(t=a[e].metadata)?void 0:t.payload}).map(e=>{var t;return[e,null==(t=a[e].metadata)?void 0:t.payload]}))):Da.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),o),u=l.flags,c=l.featureFlags,h=l.featureFlagPayloads;if(c){var d=e.requestId,p=e.evaluatedAt;if(le(c)){Da.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var v={};if(c)for(var g=0;c.length>g;g++)v[c[g]]=!0;t&&t.register({[qi]:c,[Ai]:v})}else{var _=c,f=h,m=u;if(null!=n&&n.partialResponse)_=U({},i,_),f=U({},r,f),m=U({},s,m);else if(e.errorsWhileComputingFlags)if(u){var y=new Set(Object.keys(u).filter(e=>{var t;return!(null!=(t=u[e])&&t.failed)}));_=U({},i,Object.fromEntries(Object.entries(_).filter(e=>{var[t]=e;return y.has(t)}))),f=U({},r,Object.fromEntries(Object.entries(f||{}).filter(e=>{var[t]=e;return y.has(t)}))),m=U({},s,Object.fromEntries(Object.entries(m||{}).filter(e=>{var[t]=e;return y.has(t)})))}else _=U({},i,_),f=U({},r,f),m=U({},s,m);t&&t.register(U({[qi]:Object.keys(za(_)),[Ai]:_||{},[Ni]:f||{},[Di]:m||{}},d?{[ji]:d}:{},p?{[Ji]:p}:{}))}}}(e,this.ni,r,s,n,i),t||(this.ss=!1),this.gs(t)}}override(e,t){void 0===t&&(t=!1),Da.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this.ni)return Da.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===e)return this.ni.unregister(Hi),this.ni.unregister(zi),this.gs(),Na.info("All overrides cleared");if(le(e)){var t=Ha(e);return this.ni.register({[Hi]:t}),this.gs(),Na.info("Flag overrides set",{flags:e})}if(e&&"object"==typeof e&&("flags"in e||"payloads"in e)){var i,r=e;if(this.Kn=Boolean(null!==(i=r.suppressWarning)&&void 0!==i&&i),"flags"in r)if(!1===r.flags)this.ni.unregister(Hi),Na.info("Flag overrides cleared");else if(r.flags){if(le(r.flags)){var s=Ha(r.flags);this.ni.register({[Hi]:s})}else this.ni.register({[Hi]:r.flags});Na.info("Flag overrides set",{flags:r.flags})}return"payloads"in r&&(!1===r.payloads?(this.ni.unregister(zi),Na.info("Payload overrides cleared")):r.payloads&&(this.ni.register({[zi]:r.payloads}),Na.info("Payload overrides set",{payloads:r.payloads}))),void this.gs()}if(e&&"object"==typeof e)return this.ni.register({[Hi]:e}),this.gs(),Na.info("Flag overrides set",{flags:e});Da.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.Yn){var{flags:t,flagVariants:i}=this.ys();e(t,i)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var r,s=(this.os(Li)||[]).find(t=>t.flagKey===e),n={["$feature_enrollment/"+e]:t},o={$feature_flag:e,$feature_enrollment:t,$set:n};s&&(o.$early_access_feature_name=s.name),i&&(o.$feature_enrollment_stage=i),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(n,!1);var a=U({},this.getFlagVariants(),{[e]:t});null==(r=this.ni)||r.register({[qi]:Object.keys(za(a)),[Ai]:a}),this.gs()}getEarlyAccessFeatures(e,t,i){void 0===t&&(t=!1);var r=this.os(Li),s=i?"&"+i.map(e=>"stage="+e).join("&"):"";if(r&&!t)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.qt.token+s),method:"GET",callback:t=>{var i,r;if(t.json){var s=t.json.earlyAccessFeatures;return null==(i=this.ni)||i.unregister(Li),null==(r=this.ni)||r.register({[Li]:s}),e(s)}}})}ys(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(e=>t[e]),flagVariants:Object.keys(t).filter(e=>t[e]).reduce((e,i)=>(e[i]=t[i],e),{})}}gs(e){var{flags:t,flagVariants:i}=this.ys();this.featureFlagEventHandlers.forEach(r=>r(t,i,{errorsLoading:e}))}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=this.os(Ui)||{},r=(null==e?void 0:e.$set)||(null!=e&&e.$set_once?{}:e),s=null==e?void 0:e.$set_once,n={};if(s)for(var o in s)({}).hasOwnProperty.call(s,o)&&(o in i||(n[o]=s[o]));this._instance.register({[Ui]:U({},i,n,r)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(Ui)}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=this.os(Bi)||{};0!==Object.keys(i).length&&Object.keys(i).forEach(t=>{i[t]=U({},i[t],e[t]),delete e[t]}),this._instance.register({[Bi]:U({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.os(Bi)||{};this._instance.register({[Bi]:U({},t,{[e]:{}})})}else this._instance.unregister(Bi)}reset(){this.Yn=!1,this.Xn=!1,this.es=!1,this.ts=!1,this.rs=!1,this.$anon_distinct_id=void 0,this.ps(),this.Kn=!1}}},Ka={sessionRecording:class{get qt(){return this._instance.config}get ni(){return this._instance.persistence}get started(){var e;return!(null==(e=this.bs)||!e.isStarted)}get status(){var e,t;return this._s===ma||this._s===ya?this._s:null!==(e=null==(t=this.bs)?void 0:t.status)&&void 0!==e?e:this._s}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this._s=_a,this.ws=void 0,this._instance=e,!this._instance.sessionManager)throw wa.error("started without valid sessionManager"),new Error(ba+" started without valid sessionManager. This is a bug.");if(this.qt.cookieless_mode===dr)throw new Error(ba+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get xs(){var e,t=!(null==(e=this._instance.get_property($i))||!e.enabled),i=!this.qt.disable_session_recording,r=this.qt.disable_session_recording||this._instance.consent.isOptedOut();return F&&t&&i&&!r}startIfEnabledOrStop(e){var t;if(!this.xs||null==(t=this.bs)||!t.isStarted){var i=!de(Object.assign)&&!de(Array.from);this.xs&&i?(this.Ss(e),wa.info("starting")):(this._s=_a,this.stopRecording())}}Ss(e){var t,i,r;this.xs&&(this._s!==ma&&this._s!==ya&&(this._s=fa),null!=D&&null!=(t=D.__PosthogExtensions__)&&null!=(t=t.rrweb)&&t.record&&null!=(i=D.__PosthogExtensions__)&&i.initSessionRecording?this.ks(e):null==(r=D.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.Cs,t=>{if(t)return wa.error("could not load recorder",t);this.ks(e)}))}stopRecording(){var e,t;null==(e=this.ws)||e.call(this),this.ws=void 0,null==(t=this.bs)||t.stop()}Is(){var e,t;null==(e=this.ws)||e.call(this),this.ws=void 0,null==(t=this.bs)||t.discard()}Ts(){var e;null==(e=this.ni)||e.unregister(Ti)}Es(e,t){if(_e(e))return null;var i,r=fe(e)?e:parseFloat(e);return"number"!=typeof(i=r)||!Number.isFinite(i)||0>i||i>1?(wa.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):r}Ms(e){if(this.ni){var t,i,r=this.ni,s=()=>{var t,i=!1===e.sessionRecording?void 0:e.sessionRecording,s=this.Es(null==(t=this.qt.session_recording)?void 0:t.sampleRate,"session_recording.sampleRate"),n=this.Es(null==i?void 0:i.sampleRate,"remote config sampleRate"),o=null!=s?s:n;_e(o)&&this.Ts();var a=null==i?void 0:i.minimumDurationMilliseconds;r.register({[$i]:U({cache_timestamp:Date.now(),enabled:!!i},i,{networkPayloadCapture:U({capturePerformance:e.capturePerformance},null==i?void 0:i.networkPayloadCapture),canvasRecording:{enabled:null==i?void 0:i.recordCanvas,fps:null==i?void 0:i.canvasFps,quality:null==i?void 0:i.canvasQuality},sampleRate:o,minimumDurationMilliseconds:de(a)?null:a,endpoint:null==i?void 0:i.endpoint,triggerMatchType:null==i?void 0:i.triggerMatchType,masking:null==i?void 0:i.masking,urlTriggers:null==i?void 0:i.urlTriggers,version:null==i?void 0:i.version,triggerGroups:null==i?void 0:i.triggerGroups})})};s(),null==(t=this.ws)||t.call(this),this.ws=null==(i=this._instance.sessionManager)?void 0:i.onSessionId(s)}}onRemoteConfig(e){return"sessionRecording"in e?!1===e.sessionRecording?(this.Ms(e),void this.Is()):(this.Ms(e),void this.startIfEnabledOrStop()):(this._s===ma&&(this._s=ya,wa.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t){var i;void 0===t&&(t="log"),null!=(i=this.bs)&&i.log?this.bs.log(e,t):wa.warn("log called before recorder was ready")}get Cs(){var e,t,i=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.get_property($i);return(null==i||null==(t=i.scriptConfig)?void 0:t.script)||"lazy-recorder"}Ps(){var e,t,i=this._instance.get_property($i);if(!i)return!1;try{t="object"==typeof i?i:JSON.parse(i)}catch(e){return wa.warn("persisted remote config for session recording is invalid and will be ignored",e),!1}var r=null!==(e=t.cache_timestamp)&&void 0!==e?e:Date.now();return 36e5>=Date.now()-r}ks(e){var t,i;if(null==(t=D.__PosthogExtensions__)||!t.initSessionRecording)return wa.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[ur]:!0});if(this.bs||(this.bs=null==(i=D.__PosthogExtensions__)?void 0:i.initSessionRecording(this._instance),this.bs._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Ps()){if(this._s===ya||this._s===ma)return;return this._s=ma,wa.info("persisted remote config is stale, requesting fresh config before starting"),void new Zs(this._instance).load()}this._s=fa,this.bs.start(e)}onRRwebEmit(e){var t;null==(t=this.bs)||null==t.onRRwebEmit||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.bs||null==(t=this.ni)||t.register({[Ri]:!0}),null==(e=this.bs)||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.bs||null==(t=this.ni)||t.register({[Ii]:!0}),null==(e=this.bs)||e.overrideSampling()}overrideTrigger(e){var t,i;this.bs||null==(i=this.ni)||i.register({["url"===e?Mi:Oi]:!0}),null==(t=this.bs)||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return(null==(e=this.bs)?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var i;return!(null==(i=this.bs)||!i.tryAddCustomEvent(e,t))}}},Ya={autocapture:class{constructor(e){this.Rs=!1,this.Os=null,this.Ls=!1,this.instance=e,this.rageclicks=new oa(e.config.rageclick),this.Fs=null}initialize(){this.startIfEnabled()}get qt(){var e,t,i=ce(this.instance.config.autocapture)?this.instance.config.autocapture:{};return i.url_allowlist=null==(e=i.url_allowlist)?void 0:e.map(e=>new RegExp(e)),i.url_ignorelist=null==(t=i.url_ignorelist)?void 0:t.map(e=>new RegExp(e)),i}As(){if(this.isBrowserSupported()){if(F&&M){var e=e=>{e=e||(null==F?void 0:F.event);try{this.Ns(e)}catch(e){la.error("Failed to capture event",e)}};if(Mr(M,"submit",e,{capture:!0}),Mr(M,"change",e,{capture:!0}),Mr(M,"click",e,{capture:!0}),this.qt.capture_copied_text){var t=e=>{e=e||(null==F?void 0:F.event);try{this.Ns(e,aa)}catch(e){la.error("Failed to capture copy/cut event",e)}};Mr(M,"copy",t,{capture:!0}),Mr(M,"cut",t,{capture:!0})}}}else la.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.Rs&&(this.As(),this.Rs=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.Ls=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[yi]:!!e.autocapture_opt_out}),this.Os=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.Fs=e}getElementSelectors(e){var t,i=[];return null==(t=this.Fs)||t.forEach(t=>{var r=null==M?void 0:M.querySelectorAll(t);null==r||r.forEach(r=>{e===r&&i.push(t)})}),i}get isEnabled(){var e,t,i=null==(e=this.instance.persistence)?void 0:e.props[yi];if(ge(this.Os)&&!ye(i)&&!this.instance.Lr())return!1;var r=null!==(t=this.Os)&&void 0!==t?t:!!i;return!!this.instance.config.autocapture&&!r}Ns(e,t){if(void 0===t&&(t="$autocapture"),this.isEnabled){var i,r=No(e);Oo(r)&&(r=r.parentNode||null),"$autocapture"===t&&"click"===e.type&&e instanceof MouseEvent&&this.instance.config.rageclick&&null!=(i=this.rageclicks)&&i.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime())&&function(e,t){if(!F||Vo(e))return!1;var i,r,s;if(ye(t)?(i=!!t&&Bo,r=void 0):(i=null!==(s=null==t?void 0:t.css_selector_ignorelist)&&void 0!==s?s:Bo,r=null==t?void 0:t.content_ignorelist),!1===i)return!1;var{targetElementList:n}=Wo(e,!1);return!function(e,t){if(!1===e||de(e))return!1;var i;if(!0===e)i=Uo;else{if(!le(e))return!1;if(e.length>10)return hi.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;i=e.map(e=>e.toLowerCase())}return t.some(e=>{var{safeText:t,ariaLabel:r}=e;return i.some(e=>t.includes(e)||r.includes(e))})}(r,n.map(e=>{var t;return{safeText:Do(e).toLowerCase(),ariaLabel:(null==(t=e.getAttribute("aria-label"))?void 0:t.toLowerCase().trim())||""}}))&&!Ho(n,i)}(r,this.instance.config.rageclick)&&this.Ns(e,"$rageclick");var s=t===aa;if(r&&function(e,t,i,r,s){var n,o,a,l;if(void 0===i&&(i=void 0),!F||Vo(e))return!1;if(null!=(n=i)&&n.url_allowlist&&!Ao(i.url_allowlist))return!1;if(null!=(o=i)&&o.url_ignorelist&&Ao(i.url_ignorelist))return!1;if(null!=(a=i)&&a.dom_event_allowlist){var u=i.dom_event_allowlist;if(u&&!u.some(e=>t.type===e))return!1}var{parentIsUsefulElement:c,targetElementList:h}=Wo(e,r);if(!function(e,t){var i=null==t?void 0:t.element_allowlist;if(de(i))return!0;var r,s=function(e){if(i.some(t=>e.tagName.toLowerCase()===t))return{v:!0}};for(var n of e)if(r=s(n))return r.v;return!1}(h,i))return!1;if(!Ho(h,null==(l=i)?void 0:l.css_selector_allowlist))return!1;var d=F.getComputedStyle(e);if(d&&"pointer"===d.getPropertyValue("cursor")&&"click"===t.type)return!0;var p=e.tagName.toLowerCase();switch(p){case"html":return!1;case"form":return(s||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(t.type)>=0;default:return c?(s||["click"]).indexOf(t.type)>=0:(s||["click"]).indexOf(t.type)>=0&&(jo.indexOf(p)>-1||"true"===e.getAttribute("contenteditable"))}}(r,e,this.qt,s,s?["copy","cut"]:void 0)){var{props:n,explicitNoCapture:o}=function(e,t){var i,r,{e:s,maskAllElementAttributes:n,maskAllText:o,elementAttributeIgnoreList:a,elementsChainAsString:l}=t;if(!Ro(e))return{props:{}};for(var u=[e],c=e;c.parentNode&&!Mo(c,"body");)if(Co(c.parentNode))u.push(c.parentNode.host),c=c.parentNode.host;else{if(!Ro(c.parentNode))break;u.push(c.parentNode),c=c.parentNode}var h,d,p=[],v={},g=!1,_=!1;if(Er(u,e=>{var t=Go(e);if(Mo(e,"a")){var i=e.getAttribute("href");g=t&&!!i&&ta(i)&&i}ie(qo(e),"ph-no-capture")&&(_=!0),p.push(function(e,t,i,r){var s=e.tagName.toLowerCase(),n={tag_name:s};jo.indexOf(s)>-1&&!i&&(n.$el_text="a"===s.toLowerCase()||"button"===s.toLowerCase()?ua(1024,ia(e)):ua(1024,Do(e)));var o=qo(e);o.length>0&&(n.classes=o.filter(function(e){return""!==e})),Er(e.attributes,function(i){var s;if((!Xo(e)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==r||!r.includes(i.name))&&!t&&ta(i.value)&&(!pe(s=i.name)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7))){var o=i.value;"class"===i.name&&(o=To(o).join(" ")),n["attr__"+i.name]=ua(1024,o)}});for(var a=1,l=1,u=e;u=ca(u);)a++,u.tagName===e.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}(e,n,o,a));var r=function(e){if(!Go(e))return{};var t={};return Er(e.attributes,function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){var i=e.name.replace("data-ph-capture-attribute-",""),r=e.value;i&&r&&ta(r)&&(t[i]=r)}}),t}(e);kr(v,r)}),_)return{props:{},explicitNoCapture:_};if(o||(p[0].$el_text=Mo(e,"a")||Mo(e,"button")?ia(e):Do(e)),g){var f,m;p[0].attr__href=g;var y=null==(f=ls(g))?void 0:f.host,b=null==F||null==(m=F.location)?void 0:m.host;y&&b&&y!==b&&(h=g)}return{props:kr({$event_type:s.type,$ce_version:1},l?{}:{$elements:p},{$elements_chain:(d=p,function(e){return e.map(e=>{var t,i,r="";if(e.tag_name&&(r+=e.tag_name),e.attr_class)for(var s of(e.attr_class.sort(),e.attr_class))r+="."+s.replace(/"/g,"");var n=U({},e.text?{text:e.text}:{},{"nth-child":null!==(t=e.nth_child)&&void 0!==t?t:0,"nth-of-type":null!==(i=e.nth_of_type)&&void 0!==i?i:0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),o={};return Sr(n).sort((e,t)=>{var[i]=e,[r]=t;return i.localeCompare(r)}).forEach(e=>{var[t,i]=e;return o[sa(t.toString())]=sa(i.toString())}),(r+=":")+Sr(o).map(e=>{var[t,i]=e;return t+'="'+i+'"'}).join("")}).join(";")}(function(e){return e.map(e=>{var t,i,r={text:null==(t=e.$el_text)?void 0:t.slice(0,400),tag_name:e.tag_name,href:null==(i=e.attr__href)?void 0:i.slice(0,2048),attr_class:na(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return Sr(e).filter(e=>{var[t]=e;return 0===t.indexOf("attr__")}).forEach(e=>{var[t,i]=e;return r.attributes[t]=i}),r})}(d)))},null!=(i=p[0])&&i.$el_text?{$el_text:null==(r=p[0])?void 0:r.$el_text}:{},h&&"click"===s.type?{$external_click_url:h}:{},v)}}(r,{e:e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.qt.element_attribute_ignorelist,elementsChainAsString:this.Ls});if(o)return!1;var a=this.getElementSelectors(r);if(a&&a.length>0&&(n.$element_selectors=a),t===aa){var l,u=Lo(null==F||null==(l=F.getSelection())?void 0:l.toString()),c=e.type||"clipboard";if(!u)return!1;n.$selected_content=u,n.$copy_type=c}return this.instance.capture(t,n),!0}}}isBrowserSupported(){return ue(null==M?void 0:M.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this.$s=(null==F||null==(t=F.location)?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(hi.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.Ds&&this.Ds(),this.Ds=void 0,hi.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(F&&F.history){var i=this;null!=(e=F.history.pushState)&&e.__posthog_wrapped__||da(F.history,"pushState",e=>function(t,r,s){e.call(this,t,r,s),i.qs("pushState")}),null!=(t=F.history.replaceState)&&t.__posthog_wrapped__||da(F.history,"replaceState",e=>function(t,r,s){e.call(this,t,r,s),i.qs("replaceState")}),this.js()}}qs(e){try{var t,i=null==F||null==(t=F.location)?void 0:t.pathname;if(!i)return;i!==this.$s&&this.isEnabled&&this._instance.capture(mr,{navigation_type:e}),this.$s=i}catch(t){hi.error("Error capturing "+e+" pageview",t)}}js(){if(!this.Ds){var e=()=>{this.qs("popstate")};Mr(F,"popstate",e),this.Ds=()=>{F&&F.removeEventListener("popstate",e)}}}},heatmaps:class{get qt(){return this.instance.config}constructor(e){var t;this.Hs=!1,this.Rs=!1,this.Us=null,this.instance=e,this.Hs=!(null==(t=this.instance.persistence)||!t.props[bi]),this.rageclicks=new oa(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return ce(this.qt.capture_heatmaps)&&this.qt.capture_heatmaps.flush_interval_milliseconds&&(e=this.qt.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return _e(this.qt.capture_heatmaps)?_e(this.qt.enable_heatmaps)?this.Hs:this.qt.enable_heatmaps:!1!==this.qt.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.Rs)return;xa.info("starting..."),this.Bs(),this.At()}else{var e;clearInterval(null!==(e=this.Us)&&void 0!==e?e:void 0),this.zs(),this.getAndClearBuffer()}}onRemoteConfig(e){if("heatmaps"in e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[bi]:t}),this.Hs=t,this.startIfEnabled()}}getAndClearBuffer(){var e=this.M;return this.M=void 0,e}Vs(e){this.Mt(e.originalEvent,"deadclick")}At(){this.Us&&clearInterval(this.Us),this.Us="visible"===(null==M?void 0:M.visibilityState)?setInterval(this.Zr.bind(this),this.flushIntervalMilliseconds):null}Bs(){F&&M&&(this.Ws=this.Zr.bind(this),Mr(F,fr,this.Ws),this.Zs=e=>this.Mt(e||(null==F?void 0:F.event)),Mr(M,"click",this.Zs,{capture:!0}),this.Gs=e=>this.Qs(e||(null==F?void 0:F.event)),Mr(M,"mousemove",this.Gs,{capture:!0}),this.Js=new es(this.instance,Zr,this.Vs.bind(this)),this.Js.startIfEnabledOrStop(),this.Ks=this.At.bind(this),Mr(M,_r,this.Ks),this.Rs=!0)}zs(){var e;F&&M&&(this.Ws&&F.removeEventListener(fr,this.Ws),this.Zs&&M.removeEventListener("click",this.Zs,{capture:!0}),this.Gs&&M.removeEventListener("mousemove",this.Gs,{capture:!0}),this.Ks&&M.removeEventListener(_r,this.Ks),clearTimeout(this.Ys),null==(e=this.Js)||e.stop(),this.Rs=!1)}Xs(e,t){var i=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),n=function(e,t,i){for(var r=e;r&&Ro(r)&&!Mo(r,"body");){if(r===i)return!1;if(ie(t,null==F?void 0:F.getComputedStyle(r).position))return!0;r=zo(r)}return!1}(No(e),["fixed","sticky"],s);return{x:e.clientX+(n?0:r),y:e.clientY+(n?0:i),target_fixed:n,type:t}}Mt(e,t){var i;if(void 0===t&&(t="click"),!Io(e.target)&&Ea(e)){var r=this.Xs(e,t);null!=(i=this.rageclicks)&&i.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&this.eo(U({},r,{type:"rageclick"})),this.eo(r)}}Qs(e){!Io(e.target)&&Ea(e)&&(clearTimeout(this.Ys),this.Ys=setTimeout(()=>{this.eo(this.Xs(e,"mousemove"))},500))}eo(e){if(F){var t=F.location.href,i=this.qt.custom_personal_data_properties,r=this.qt.mask_personal_data_properties?[...ps,...i||[]]:[],s=cs(t,r,gs);this.M=this.M||{},this.M[s]||(this.M[s]=[]),this.M[s].push(e)}}Zr(){this.M&&!he(this.M)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:es,webVitalsAutocapture:class{constructor(e){var t;this.Hs=!1,this.Rs=!1,this.M={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.ro=()=>{clearTimeout(this.io),0!==this.M.metrics.length&&(this._instance.capture("$web_vitals",this.M.metrics.reduce((e,t)=>U({},e,{["$web_vitals_"+t.name+"_event"]:U({},t),["$web_vitals_"+t.name+"_value"]:t.value}),{})),this.M={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.ht=e=>{var t;this.M=this.M||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var i=this.no();if(!de(i))if(_e(null==e?void 0:e.name)||_e(null==e?void 0:e.value))va.error("Invalid metric received",e);else if(!this.so||this.so>e.value){this.M.url!==i&&(this.ro(),this.io=setTimeout(this.ro,this.flushToCaptureTimeoutMs)),de(this.M.url)&&(this.M.url=i),this.M.firstMetricTimestamp=de(this.M.firstMetricTimestamp)?Date.now():this.M.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0);var r=null==(t=this._instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0),s=U({},e,{$current_url:i,timestamp:Date.now()});de(r)||(s.$session_id=r.sessionId,s.$window_id=r.windowId),this.M.metrics.push(s),this.M.metrics.length===this.allowedMetrics.length&&this.ro()}else va.error("Ignoring metric with value >= "+this.so,e)},this.oo=()=>{if(!this.Rs){var e,t,i,r,s=D.__PosthogExtensions__;de(s)||de(s.postHogWebVitalsCallbacks)||({onLCP:e,onCLS:t,onFCP:i,onINP:r}=s.postHogWebVitalsCallbacks),e&&t&&i&&r?(this.allowedMetrics.indexOf("LCP")>-1&&e(this.ht.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&t(this.ht.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this.ht.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&r(this.ht.bind(this)),this.Rs=!0):va.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.Hs=!(null==(t=this._instance.persistence)||!t.props[ki]),this.startIfEnabled()}get ao(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,i=ce(this.ao)?null==(e=this.ao)?void 0:e.web_vitals_allowed_metrics:void 0;return _e(i)?(null==(t=this._instance.persistence)?void 0:t.props[Fi])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(ce(this.ao)?this.ao.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=ce(this.ao)?this.ao.web_vitals_attribution:void 0;return null!=e&&e}get so(){var e=ce(this.ao)&&fe(this.ao.__web_vitals_max_value)?this.ao.__web_vitals_max_value:ga;return e>0&&6e4>=e?ga:e}get isEnabled(){var e=null==O?void 0:O.protocol;if("http:"!==e&&"https:"!==e)return va.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=ce(this.ao)?this.ao.web_vitals:ye(this.ao)?this.ao:void 0;return ye(t)?t:this.Hs}startIfEnabled(){this.isEnabled&&!this.Rs&&(va.info("enabled, starting..."),this.lr(this.oo))}onRemoteConfig(e){if("capturePerformance"in e){var t=ce(e.capturePerformance)&&!!e.capturePerformance.web_vitals,i=ce(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[ki]:t}),this._instance.persistence.register({[Fi]:i})),this.Hs=t,this.startIfEnabled()}}lr(e){var t,i;null!=(t=D.__PosthogExtensions__)&&t.postHogWebVitalsCallbacks?e():null==(i=D.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",t=>{t?va.error("failed to load script",t):e()})}no(){var e=F?F.location.href:void 0;if(e){var t=this._instance.config.custom_personal_data_properties,i=this._instance.config.mask_personal_data_properties?[...ps,...t||[]]:[];return cs(e,i,gs)}va.error("Could not determine current URL")}}},Ja={exceptionObserver:class{constructor(e){var t,i,r;this.oo=()=>{var e;if(F&&this.isEnabled&&null!=(e=D.__PosthogExtensions__)&&e.errorWrappingFunctions){var t=D.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=D.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=D.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.uo&&this.qt.capture_unhandled_errors&&(this.uo=t(this.captureException.bind(this))),!this.lo&&this.qt.capture_unhandled_rejections&&(this.lo=i(this.captureException.bind(this))),!this.ho&&this.qt.capture_console_errors&&(this.ho=r(this.captureException.bind(this)))}catch(e){ha.error("failed to start",e),this.co()}}},this._instance=e,this.do=!(null==(t=this._instance.persistence)||!t.props[wi]),this.vo=new Me({refillRate:null!==(i=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)&&void 0!==i?i:1,bucketSize:null!==(r=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)&&void 0!==r?r:10,refillInterval:1e4,Gt:ha}),this.qt=this.fo(),this.startIfEnabledOrStop()}fo(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return ce(e)?t=U({},t,e):(de(e)?this.do:e)&&(t=U({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.qt.capture_console_errors||this.qt.capture_unhandled_errors||this.qt.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(ha.info("enabled"),this.co(),this.lr(this.oo)):this.co()}lr(e){var t,i;null!=(t=D.__PosthogExtensions__)&&t.errorWrappingFunctions&&e(),null==(i=D.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",t=>{if(t)return ha.error("failed to load script",t);e()})}co(){var e,t,i;null==(e=this.uo)||e.call(this),this.uo=void 0,null==(t=this.lo)||t.call(this),this.lo=void 0,null==(i=this.ho)||i.call(this),this.ho=void 0}onRemoteConfig(e){"autocaptureExceptions"in e&&(this.do=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[wi]:this.do}),this.qt=this.fo(),this.startIfEnabledOrStop())}onConfigChange(){this.qt=this.fo()}captureException(e){var t,i,r,s=null!==(t=null==e||null==(i=e.$exception_list)||null==(i=i[0])?void 0:i.type)&&void 0!==t?t:"Exception";this.vo.consumeRateLimit(s)?ha.info("Skipping exception capture because of client rate limiting.",{exception:s}):null==(r=this._instance.exceptions)||r.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,i;this.po=[],this.mo=new Tt([new Wt,new ii,new Xt,new Gt,new ei,new Qt,new Yt,new ti],function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;t>r;r++)i[r-1]=arguments[r];return function(t,r){void 0===r&&(r=0);for(var s=[],n=t.split("\n"),o=r;n.length>o;o++){var a=n[o];if(1024>=a.length){var l=Vt.test(a)?a.replace(Vt,"$1"):a;if(!l.match(/\S*Error: /)){for(var u of i){var c=u(l,e);if(c){s.push(c);break}}if(s.length>=50)break}}}return function(e){if(!e.length)return[];var t=Array.from(e);return t.reverse(),t.slice(0,50).map(e=>{return U({},e,{filename:e.filename||(i=t,i[i.length-1]||{}).filename,function:e.function||At});var i})}(s)}}("web:javascript",Ht,Bt)),this._instance=e,this.po=null!==(t=null==(i=this._instance.persistence)?void 0:i.get_property(xi))&&void 0!==t?t:[],this.yo=ai(this.bo()),this._o=new li(this.yo)}onConfigChange(){this.yo=ai(this.bo()),this._o.setConfig(this.yo)}onRemoteConfig(e){var t,i,r;if("errorTracking"in e){var s=null!==(t=null==(i=e.errorTracking)?void 0:i.suppressionRules)&&void 0!==t?t:[],n=null==(r=e.errorTracking)?void 0:r.captureExtensionExceptions;this.po=s,this._instance.persistence&&this._instance.persistence.register({[xi]:this.po,[Ei]:n})}}get wo(){var e,t=!!this._instance.get_property(Ei),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(e=null!=i?i:t)&&void 0!==e&&e}buildProperties(e,t){return this.mo.buildFromUnknown(e,{syntheticException:null==t?void 0:t.syntheticException,mechanism:{handled:null==t?void 0:t.handled}})}addExceptionStep(e,t){if(this.yo.enabled)try{if(!pe(e)||0===e.trim().length)return void Ua.warn("Ignoring exception step because message must be a non-empty string");var i=this.xo(t),{sanitizedProperties:r,droppedKeys:s}=function(e){if(!e)return{sanitizedProperties:{},droppedKeys:[]};var t=[];return{sanitizedProperties:Object.keys(e).reduce((i,r)=>ni.has(r)?(t.push(r),i):(i[r]=e[r],i),{}),droppedKeys:t}}(i);s.length>0&&Ua.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this._o.add(U({[ri]:e,[si]:(new Date).toISOString()},r))}catch(e){Ua.error("Failed to add exception step. Ignoring breadcrumb.",e)}}sendExceptionEvent(e){try{var t=e.$exception_list;if(this.So(t)){if(this.ko(t))return this.Co("Exception dropped: matched a suppression rule"),void Ua.info("Skipping exception capture because a suppression rule matched");if(!this.wo&&this.Io(t))return this.Co("Exception dropped: thrown by a browser extension"),void Ua.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.To(t))return this.Co("Exception dropped: thrown by the PostHog SDK"),void Ua.info("Skipping exception capture because it was thrown by the PostHog SDK")}var i=this.yo.enabled&&_e(e.$exception_steps)?this.Eo(e):e;try{var r=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",en:!0});return r&&this._o.clear(),r}catch(e){return Ua.error("Failed to capture exception event. Dropping this exception.",e),void this._o.clear()}}catch(e){return void Ua.error("Failed to process exception event. Ignoring this exception.",e)}}Eo(e){try{var t=this._o.getAttachable();return 0===t.length?e:U({},e,{$exception_steps:t})}catch(t){return Ua.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}Co(e){this.yo.enabled&&this._o.add({[ri]:e,[si]:(new Date).toISOString()})}xo(e){return ce(e)?U({},e):{}}bo(){var e,t;return null!==(e=null==(t=this._instance.config.error_tracking)?void 0:t.exception_steps)&&void 0!==e?e:{}}ko(e){if(0===e.length)return!1;var t=e.reduce((e,t)=>{var{type:i,value:r}=t;return pe(i)&&i.length>0&&e.$exception_types.push(i),pe(r)&&r.length>0&&e.$exception_values.push(r),e},{$exception_types:[],$exception_values:[]});return this.po.some(e=>{var i=e.values.map(e=>{var i,r=Qn[e.operator],s=le(e.value)?e.value:[e.value],n=null!==(i=t[e.key])&&void 0!==i?i:[];return s.length>0&&r(s,n)});return"OR"===e.type?i.some(Boolean):i.every(Boolean)})}Io(e){return e.flatMap(e=>{var t,i;return null!==(t=null==(i=e.stacktrace)?void 0:i.frames)&&void 0!==t?t:[]}).some(e=>e.filename&&e.filename.startsWith("chrome-extension://"))}To(e){if(e.length>0){var t,i,r,s,n=null!==(t=null==(i=e[0].stacktrace)?void 0:i.frames)&&void 0!==t?t:[],o=n[n.length-1];return null!==(r=null==o||null==(s=o.filename)?void 0:s.includes("posthog.com/static"))&&void 0!==r&&r}return!1}So(e){return!_e(e)&&le(e)}}},Za=U({productTours:class{get ni(){return this._instance.persistence}constructor(e){this.Mo=null,this.Po=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){"productTours"in e&&(this.ni&&this.ni.register({[Pi]:!!e.productTours}),this.loadIfEnabled())}loadIfEnabled(){var e,t;this.Mo||(e=this._instance).config.disable_product_tours||null==(t=e.persistence)||!t.get_property(Pi)||this.lr(()=>this.Ro())}lr(e){var t,i;null!=(t=D.__PosthogExtensions__)&&t.generateProductTours?e():null==(i=D.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"product-tours",t=>{t?ka.error("Could not load product tours script",t):e()})}Ro(){var e;!this.Mo&&null!=(e=D.__PosthogExtensions__)&&e.generateProductTours&&(this.Mo=D.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(void 0===t&&(t=!1),!le(this.Po)||t){var i=this.ni;if(i){var r=i.props[Gi];if(le(r)&&!t)return this.Po=r,void e(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:t=>{var r=t.statusCode;if(200!==r||!t.json){var s="Product Tours API could not be loaded, status: "+r;return ka.error(s),void e([],{isLoaded:!1,error:s})}var n=le(t.json.product_tours)?t.json.product_tours:[];this.Po=n,i&&i.register({[Gi]:n}),e(n,{isLoaded:!0})}})}else e(this.Po,{isLoaded:!0})}getActiveProductTours(e){_e(this.Mo)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.Mo.getActiveProductTours(e)}showProductTour(e){var t;null==(t=this.Mo)||t.showTourById(e)}previewTour(e){this.Mo?this.Mo.previewTour(e):this.lr(()=>{var t;this.Ro(),null==(t=this.Mo)||t.previewTour(e)})}dismissProductTour(){var e;null==(e=this.Mo)||e.dismissTour("user_clicked_skip")}nextStep(){var e;null==(e=this.Mo)||e.nextStep()}previousStep(){var e;null==(e=this.Mo)||e.previousStep()}clearCache(){var e;this.Po=null,null==(e=this.ni)||e.unregister(Gi)}resetTour(e){var t;null==(t=this.Mo)||t.resetTour(e)}resetAllTours(){var e;null==(e=this.Mo)||e.resetAllTours()}cancelPendingTour(e){var t;null==(t=this.Mo)||t.cancelPendingTour(e)}}},Xa),Qa={siteApps:class{constructor(e){this._instance=e,this.Oo=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Lo(e,t){if(t){var i=this.globalsForEvent(t);this.Oo.push(i),this.Oo.length>1e3&&(this.Oo=this.Oo.slice(10))}}get siteAppLoaders(){var e;return null==(e=D._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.siteApps}initialize(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.Lo.bind(this));this.Fo=()=>{e(),this.Oo=[],this.Fo=void 0}}}globalsForEvent(e){var t,i,r,s,n,o,a;if(!e)throw new Error("Event payload is required");var l={},u=this._instance.get_property("$groups")||[],c=this._instance.get_property("$stored_group_properties")||{};for(var[h,d]of Object.entries(c))l[h]={id:u[h],type:h,properties:d};var{$set_once:p,$set:v}=e;return{event:U({},B(e,Sa),{properties:U({},e.properties,v?{$set:U({},null!==(t=null==(i=e.properties)?void 0:i.$set)&&void 0!==t?t:{},v)}:{},p?{$set_once:U({},null!==(r=null==(s=e.properties)?void 0:s.$set_once)&&void 0!==r?r:{},p)}:{}),elements_chain:null!==(n=null==(o=e.properties)?void 0:o.$elements_chain)&&void 0!==n?n:"",distinct_id:null==(a=e.properties)?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}setupSiteApp(e){var t=this.apps[e.id],i=()=>{var i;!t.errored&&this.Oo.length&&(Pa.info("Processing "+this.Oo.length+" events for site app with id "+e.id),this.Oo.forEach(e=>null==t.processEvent?void 0:t.processEvent(e)),t.processedBuffer=!0),Object.values(this.apps).every(e=>e.processedBuffer||e.errored)&&(null==(i=this.Fo)||i.call(this))},r=!1,s=s=>{t.errored=!s,t.loaded=!0,Pa.info("Site app with id "+e.id+" "+(s?"loaded":"errored")),r&&i()};try{var{processEvent:n}=e.init({posthog:this._instance,callback(e){s(e)}});n&&(t.processEvent=n),r=!0}catch(t){Pa.error(Fa+e.id,t),s(!1)}if(r&&t.loaded)try{i()}catch(i){Pa.error("Error while processing buffered events PostHog app with config id "+e.id,i),t.errored=!0}}Ao(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var i of e)this.setupSiteApp(i)}No(e){if(0!==Object.keys(this.apps).length){var t=this.globalsForEvent(e);for(var i of Object.values(this.apps))try{null==i.processEvent||i.processEvent(t)}catch(t){Pa.error("Error while processing event "+e.event+" for site app "+i.id,t)}}}onRemoteConfig(e){var t,i,r,s=this;if(null!=(t=this.siteAppLoaders)&&t.length)return this.isEnabled?(this.Ao(),void this._instance.on("eventCaptured",e=>this.No(e))):void Pa.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this.Fo)||i.call(this),null!=(r=e.siteApps)&&r.length)if(this.isEnabled){var n=function(e){var t;D["__$$ph_site_app_"+e]=s._instance,null==(t=D.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(s._instance,a,t=>{if(t)return Pa.error(Fa+e,t)})};for(var{id:o,url:a}of e.siteApps)n(o)}else Pa.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},el={tracingHeaders:class{constructor(e){this.$o=void 0,this.Do=void 0,this.oo=()=>{var e,t,i=this.qo()||[];de(this.$o)&&(null==(e=D.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)||e._patchXHR(i,this._instance.get_distinct_id(),this._instance.sessionManager)),de(this.Do)&&(null==(t=D.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)||t._patchFetch(i,this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}initialize(){this.startIfEnabledOrStop()}lr(e){var t,i;null!=(t=D.__PosthogExtensions__)&&t.tracingHeadersPatchFns&&e(),null==(i=D.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",t=>{if(t)return pa.error("failed to load script",t);e()})}qo(){var e;return null!==(e=this._instance.config.addTracingHeaders)&&void 0!==e?e:this._instance.config.__add_tracing_headers}startIfEnabledOrStop(){var e,t;this.qo()?this.lr(this.oo):(null==(e=this.$o)||e.call(this),null==(t=this.Do)||t.call(this),this.$o=void 0,this.Do=void 0)}}},tl=U({surveys:class{get qt(){return this._instance.config}constructor(e){this.jo=void 0,this._surveyManager=null,this.Ho=!1,this.Uo=[],this.Bo=null,this._instance=e,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this.qt.disable_surveys){var t=e.surveys;if(_e(t))return ao.warn("Flags not loaded yet. Not loading surveys.");var i=le(t);this.jo=i?t.length>0:t,ao.info("flags response received, isSurveysEnabled: "+this.jo),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var i=localStorage.key(t);(null!=i&&i.startsWith(lo)||null!=i&&i.startsWith("inProgressSurvey_"))&&e.push(i)}e.forEach(e=>localStorage.removeItem(e))}loadIfEnabled(){if(!this._surveyManager)if(this.Ho)ao.info("Already initializing surveys, skipping...");else if(this.qt.disable_surveys)ao.info(Ta);else if(this.qt.cookieless_mode&&this._instance.consent.isOptedOut())ao.info("Not loading surveys in cookieless mode without consent.");else{var e=null==D?void 0:D.__PosthogExtensions__;if(e){if(!de(this.jo)||this.qt.advanced_enable_surveys){var t=this.jo||this.qt.advanced_enable_surveys;this.Ho=!0;try{var i=e.generateSurveys;if(i)return void this.zo(i,t);var r=e.loadExternalDependency;if(!r)return void this.Vo(cr);r(this._instance,"surveys",i=>{i||!e.generateSurveys?this.Vo("Could not load surveys script",i):this.zo(e.generateSurveys,t)})}catch(e){throw this.Vo("Error initializing surveys",e),e}finally{this.Ho=!1}}}else ao.error("PostHog Extensions not found.")}}zo(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new Oa(this._instance),ao.info("Surveys loaded successfully"),this.Wo({isLoaded:!0})}Vo(e,t){ao.error(e,t),this.Wo({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Uo.push(e),this._surveyManager&&this.Wo({isLoaded:!0}),()=>{this.Uo=this.Uo.filter(t=>t!==e)}}getSurveys(e,t){if(void 0===t&&(t=!1),this.qt.disable_surveys)return ao.info(Ta),e([]);var i,r=this._instance.get_property(Vi);if(r&&!t)return e(r,{isLoaded:!0});"undefined"!=typeof Promise&&this.Bo?this.Bo.then(t=>{var{surveys:i,context:r}=t;return e(i,r)}):("undefined"!=typeof Promise&&(this.Bo=new Promise(e=>{i=e})),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.qt.token),method:"GET",timeout:this.qt.surveys_request_timeout_ms,callback:t=>{var r;this.Bo=null;var s=t.statusCode;if(200!==s||!t.json){var n="Surveys API could not be loaded, status: "+s;ao.error(n);var o={isLoaded:!1,error:n};return e([],o),void(null==i||i({surveys:[],context:o}))}var a,l=t.json.surveys||[],u=l.filter(e=>{return!(!(t=e).start_date||t.end_date)&&(function(e){var t;return!(null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)||!t.length)}(e)||function(e){var t;return!(null==(t=e.conditions)||null==(t=t.actions)||null==(t=t.values)||!t.length)}(e));var t});u.length>0&&(null==(a=this._surveyEventReceiver)||a.register(u)),null==(r=this._instance.persistence)||r.register({[Vi]:l});var c={isLoaded:!0};e(l,c),null==i||i({surveys:l,context:c})}}))}Wo(e){for(var t of this.Uo)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){ao.error("Error in survey callback",e)}}getActiveMatchingSurveys(e,t){if(void 0===t&&(t=!1),!_e(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);ao.warn("init was not called")}Zo(e){var t=null;return this.getSurveys(i=>{var r;t=null!==(r=i.find(t=>t.id===e))&&void 0!==r?r:null}),t}Go(e){if(_e(this._surveyManager))return{eligible:!1,reason:Ca};var t="string"==typeof e?this.Zo(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(_e(this._surveyManager))return ao.warn("init was not called"),{visible:!1,disabledReason:Ca};var t=this.Go(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return _e(this._surveyManager)?(ao.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Ca})):new Promise(i=>{this.getSurveys(t=>{var r,s=null!==(r=t.find(t=>t.id===e))&&void 0!==r?r:null;if(s){var n=this.Go(s);i({visible:n.eligible,disabledReason:n.reason})}else i({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,i){var r;if(_e(this._surveyManager))ao.warn("init was not called");else{var s="string"==typeof e?this.Zo(e):e;if(null!=s&&s.id)if(uo.includes(s.type)){var n=null==M?void 0:M.querySelector(t);if(n)return null!=(r=s.appearance)&&r.surveyPopupDelaySeconds?(ao.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout(()=>{var e,t;ao.info("Rendering survey "+s.id+" with delay of "+(null==(e=s.appearance)?void 0:e.surveyPopupDelaySeconds)+" seconds"),null==(t=this._surveyManager)||t.renderSurvey(s,n,i),ao.info("Survey "+s.id+" rendered")},1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,n,i);ao.warn("Survey element not found")}else ao.warn("Surveys of type "+s.type+" cannot be rendered in the app");else ao.warn("Survey not found")}}displaySurvey(e,t){var i;if(_e(this._surveyManager))ao.warn("init was not called");else{var r=this.Zo(e);if(r){var s=r;if(null!=(i=r.appearance)&&i.surveyPopupDelaySeconds&&t.ignoreDelay&&(s=U({},r,{appearance:U({},r.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==Bs&&t.initialResponses&&ao.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===t.ignoreConditions){var n=this.canRenderSurvey(r);if(!n.visible)return void ao.warn("Survey is not eligible to be displayed: ",n.disabledReason)}t.displayType!==Vs?this._surveyManager.handlePopoverSurvey(s,t):this.renderSurvey(s,t.selector,t.properties)}else ao.warn("Survey not found")}}cancelPendingSurvey(e){_e(this._surveyManager)?ao.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;null==(e=this._surveyManager)||e.handlePageUnload()}}},Xa),il={toolbar:class{constructor(e){this.instance=e}Qo(e){D.ph_toolbar_state=e}Jo(){var e;return null!==(e=D.ph_toolbar_state)&&void 0!==e?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,t,i){if(void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===i&&(i=void 0),Or(this.instance.config))return!1;if(!F||!M)return!1;e=null!=e?e:F.location,i=null!=i?i:F.history;try{if(!t){try{F.localStorage.setItem("test","test"),F.localStorage.removeItem("test")}catch(e){return!1}t=null==F?void 0:F.localStorage}var r,s=Aa||hs(e.hash,"__posthog")||hs(e.hash,"state"),n=s?Pr(()=>JSON.parse(atob(decodeURIComponent(s))))||Pr(()=>JSON.parse(decodeURIComponent(s))):null;return n&&"ph_authorize"===n.action?((r=n).source="url",r&&Object.keys(r).length>0&&(n.desiredHash?e.hash=n.desiredHash:i?i.replaceState(i.state,"",e.pathname+e.search):e.hash="")):((r=JSON.parse(t.getItem(qa)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(e){return!1}}Ko(e){var t=D.ph_load_toolbar||D.ph_load_editor;!_e(t)&&ue(t)?t(e,this.instance):La.warn("No toolbar load function found")}loadToolbar(e){var t=!(null==M||!M.getElementById(nr));if(!F||t)return!1;var i="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,r=U({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},i?{instrument:!1}:{});if(F.localStorage.setItem(qa,JSON.stringify(U({},r,{source:void 0}))),2===this.Jo())this.Ko(r);else if(0===this.Jo()){var s;this.Qo(1),null==(s=D.__PosthogExtensions__)||null==s.loadExternalDependency||s.loadExternalDependency(this.instance,"toolbar",e=>{if(e)return La.error("[Toolbar] Failed to load",e),void this.Qo(0);this.Qo(2),this.Ko(r)}),Mr(F,"turbolinks:load",()=>{this.Qo(0),this.loadToolbar(r)})}return!0}Yo(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,i){return void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===i&&(i=void 0),this.maybeLoadToolbar(e,t,i)}}},rl=U({experiments:class e{get qt(){return this._instance.config}constructor(t){var i=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),i.getWebExperiments(t=>{e.zn("retrieved web experiments from the server"),i.Vn=new Map,t.forEach(t=>{if(t.feature_flag_key){var r;i.Vn&&(e.zn("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(r=i.Vn)||r.set(t.feature_flag_key,t));var s=i._instance.getFeatureFlag(t.feature_flag_key);pe(s)&&t.variants[s]&&i.Wn(t.name,s,t.variants[s].transforms)}else if(t.variants)for(var n in t.variants){var o=t.variants[n];e.Zn(o)&&i.Wn(t.name,n,o.transforms)}})},t)},this._instance=t,this._instance.onFeatureFlags(e=>{this.onFeatureFlags(e)})}initialize(){}onFeatureFlags(t){if(this._is_bot())e.zn(Ba);else if(!this.qt.disable_web_experiments){if(_e(this.Vn))return this.Vn=new Map,this.loadIfEnabled(),void this.previewWebExperiment();e.zn("applying feature flags",t),t.forEach(e=>{var t;if(this.Vn&&null!=(t=this.Vn)&&t.has(e)){var i,r=this._instance.getFeatureFlag(e),s=null==(i=this.Vn)?void 0:i.get(e);r&&null!=s&&s.variants[r]&&this.Wn(s.name,r,s.variants[r].transforms)}})}}previewWebExperiment(){var t=e.getWindowLocation();if(null!=t&&t.search){var i=us(null==t?void 0:t.search,"__experiment_id"),r=us(null==t?void 0:t.search,"__experiment_variant");i&&r&&(e.zn("previewing web experiments "+i+" && "+r),this.getWebExperiments(e=>{this.Gn(parseInt(i),r,e)},!1,!0))}}loadIfEnabled(){this.qt.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this.qt.disable_web_experiments&&!i)return e([]);var r=this._instance.get_property("$web_experiments");if(r&&!t)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.qt.token),method:"GET",callback:t=>e(200===t.statusCode&&t.json&&t.json.experiments||[])})}Gn(t,i,r){var s=r.filter(e=>e.id===t);s&&s.length>0&&(e.zn("Previewing web experiment ["+s[0].name+"] with variant ["+i+"]"),this.Wn(s[0].name,i,s[0].variants[i].transforms))}static Zn(t){return!_e(t.conditions)&&e.Qn(t)&&e.Jn(t)}static Qn(t){var i;if(_e(t.conditions)||_e(null==(i=t.conditions)?void 0:i.url))return!0;var r,s,n,o=e.getWindowLocation();return!!o&&(null==(r=t.conditions)||!r.url||Va[null!==(s=null==(n=t.conditions)?void 0:n.urlMatchType)&&void 0!==s?s:"icontains"](t.conditions.url,o))}static getWindowLocation(){return null==F?void 0:F.location}static Jn(e){var t;if(_e(e.conditions)||_e(null==(t=e.conditions)?void 0:t.utm))return!0;var i=fs();if(i.utm_source){var r,s,n,o,a,l,u,c,h=null==(r=e.conditions)||null==(r=r.utm)||!r.utm_campaign||(null==(s=e.conditions)||null==(s=s.utm)?void 0:s.utm_campaign)==i.utm_campaign,d=null==(n=e.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=e.conditions)||null==(o=o.utm)?void 0:o.utm_source)==i.utm_source,p=null==(a=e.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=e.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==i.utm_medium,v=null==(u=e.conditions)||null==(u=u.utm)||!u.utm_term||(null==(c=e.conditions)||null==(c=c.utm)?void 0:c.utm_term)==i.utm_term;return h&&p&&v&&d}return!1}static zn(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;t>r;r++)i[r-1]=arguments[r];hi.info("[WebExperiments] "+e,i)}Wn(t,i,r){this._is_bot()?e.zn(Ba):"control"!==i?r.forEach(r=>{if(r.selector){var s;e.zn("applying transform of variant "+i+" for experiment "+t+" ",r);var n=null==(s=document)?void 0:s.querySelectorAll(r.selector);null==n||n.forEach(e=>{var t=e;r.html&&(t.innerHTML=r.html),r.css&&t.setAttribute("style",r.css)})}}):e.zn("Control variants leave the page unmodified.")}_is_bot(){return R&&this._instance?Yn(R,this.qt.custom_blocked_useragents):void 0}}},Xa),sl={conversations:class{constructor(e){this.Xo=void 0,this._conversationsManager=null,this.ea=!1,this.ta=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var t=e.conversations;_e(t)||(ye(t)?this.Xo=t:(this.Xo=t.enabled,this.ta=t),this.loadIfEnabled())}}reset(){var e;null==(e=this._conversationsManager)||e.reset(),this._conversationsManager=null,this.Xo=void 0,this.ta=null}loadIfEnabled(){if(!(this._conversationsManager||this.ea||this._instance.config.disable_conversations||Or(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=null==D?void 0:D.__PosthogExtensions__;if(e&&!de(this.Xo)&&this.Xo)if(this.ta&&this.ta.token){this.ea=!0;try{var t=e.initConversations;if(t)return this.ra(t),void(this.ea=!1);var i=e.loadExternalDependency;if(!i)return void this.ia(cr);i(this._instance,"conversations",t=>{t||!e.initConversations?this.ia("Could not load conversations script",t):this.ra(e.initConversations),this.ea=!1})}catch(e){this.ia("Error initializing conversations",e),this.ea=!1}}else Wa.error("Conversations enabled but missing token in remote config.")}}ra(e){if(this.ta)try{this._conversationsManager=e(this.ta,this._instance),Wa.info("Conversations loaded successfully")}catch(e){this.ia("Error completing conversations initialization",e)}else Wa.error("Cannot complete initialization: remote config is null")}ia(e,t){Wa.error(e,t),this._conversationsManager=null,this.ea=!1}show(){this._conversationsManager?this._conversationsManager.show():Wa.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Xo&&!ge(this._conversationsManager)}isVisible(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.isVisible())&&void 0!==e&&e}sendMessage(e,t,i){var r=this;return z(function*(){return r._conversationsManager?r._conversationsManager.sendMessage(e,t,i):(Wa.warn(Ga),null)})()}getMessages(e,t){var i=this;return z(function*(){return i._conversationsManager?i._conversationsManager.getMessages(e,t):(Wa.warn(Ga),null)})()}markAsRead(e){var t=this;return z(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Wa.warn(Ga),null)})()}getTickets(e){var t=this;return z(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Wa.warn(Ga),null)})()}requestRestoreLink(e){var t=this;return z(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(Wa.warn(Ga),null)})()}restoreFromToken(e){var t=this;return z(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(Wa.warn(Ga),null)})()}restoreFromUrlToken(){var e=this;return z(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(Wa.warn(Ga),null)})()}getCurrentTicketId(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.getCurrentTicketId())&&void 0!==e?e:null}getWidgetSessionId(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.getWidgetSessionId())&&void 0!==e?e:null}ln(){var e;null==(e=this._conversationsManager)||e.setIdentity()}hn(){var e;null==(e=this._conversationsManager)||e.clearIdentity()}}},nl={logs:class{constructor(e){var t;this.na=!1,this.sa=!1,this.Gt=di("[logs]"),this.oa=[],this.aa=0,this.ua=0,this.la=!1,this._instance=e,this._instance&&null!=(t=this._instance.config.logs)&&t.captureConsoleLogs&&(this.na=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t,i=null==(t=e.logs)?void 0:t.captureConsoleLogs;!_e(i)&&i&&(this.na=!0,this.loadIfEnabled())}reset(){this.oa=[],this.qr&&(clearTimeout(this.qr),this.qr=void 0),this.aa=0,this.ua=0,this.la=!1}loadIfEnabled(){if(this.na&&!this.sa){var e=null==D?void 0:D.__PosthogExtensions__;if(e){var t=e.loadExternalDependency;t?t(this._instance,"logs",t=>{var i;t||null==(i=e.logs)||!i.initializeLogs?this.Gt.error("Could not load logs script",t):(e.logs.initializeLogs(this._instance),this.sa=!0)}):this.Gt.error(cr)}else this.Gt.error("PostHog Extensions not found.")}}captureLog(e){var t,i,r,s,n,o;if(this._instance.is_capturing())if(e&&e.body){var a=null!==(t=null==(i=this._instance.config.logs)?void 0:i.flushIntervalMs)&&void 0!==t?t:3e3,l=null!==(r=null==(s=this._instance.config.logs)?void 0:s.maxLogsPerInterval)&&void 0!==r?r:1e3,u=Date.now();if(a>u-this.ua||(this.ua=u,this.aa=0,this.la=!1),l>this.aa){this.aa++;var c=function(e,t){var i=e.level||"info",{text:r,number:s}=It[i]||Rt,n=String(Date.now())+"000000",o={};t.distinctId&&(o.posthogDistinctId=t.distinctId),t.sessionId&&(o.sessionId=t.sessionId),t.currentUrl&&(o["url.full"]=t.currentUrl),t.screenName&&(o["screen.name"]=t.screenName),t.appState&&(o["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(o.feature_flags=t.activeFeatureFlags);var a=U({},o,e.attributes||{}),l={timeUnixNano:n,observedTimeUnixNano:n,severityNumber:s,severityText:r,body:{stringValue:e.body},attributes:Ot(a)};return e.trace_id&&(l.traceId=e.trace_id),e.span_id&&(l.spanId=e.span_id),de(e.trace_flags)||(l.flags=e.trace_flags),l}(e,this.ha());this.oa.push({record:c}),(null!==(n=null==(o=this._instance.config.logs)?void 0:o.maxBufferSize)&&void 0!==n?n:100)>this.oa.length?this.ca():this.flushLogs()}else this.la||(this.Gt.warn("captureLog dropping logs: exceeded "+l+" logs per "+a+"ms"),this.la=!0)}else this.Gt.warn("captureLog requires a body")}get logger(){return this.da||(this.da={trace:(e,t)=>this.captureLog({body:e,level:"trace",attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:"debug",attributes:t}),info:(e,t)=>this.captureLog({body:e,level:"info",attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:"warn",attributes:t}),error:(e,t)=>this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this.da}flushLogs(e){if(this.qr&&(clearTimeout(this.qr),this.qr=void 0),0!==this.oa.length){var t=this.oa;this.oa=[];var i=this._instance.config.logs,r=U({"service.name":(null==i?void 0:i.serviceName)||"unknown_service"},(null==i?void 0:i.environment)&&{"deployment.environment":i.environment},(null==i?void 0:i.serviceVersion)&&{"service.version":i.serviceVersion},null==i?void 0:i.resourceAttributes),s=(o=t.map(e=>e.record),a=r,l=j.LIB_NAME,u=j.LIB_VERSION,{resourceLogs:[{resource:{attributes:Ot(a)},scopeLogs:[{scope:{name:l,version:u},logRecords:o}]}]}),n=this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token);this._instance.Bi({method:"POST",url:n,data:s,compression:"best-available",batchKey:"logs",transport:e})}var o,a,l,u}ca(){var e,t;this.qr||(this.qr=setTimeout(()=>{this.qr=void 0,this.flushLogs()},null!==(e=null==(t=this._instance.config.logs)?void 0:t.flushIntervalMs)&&void 0!==e?e:3e3))}ha(){var e,t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var{sessionId:i}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=i}if(null!=D&&null!=(e=D.location)&&e.href&&(t.currentUrl=D.location.href),this._instance.featureFlags){var r=this._instance.featureFlags.getFlags();r&&r.length>0&&(t.activeFeatureFlags=r)}return t}}},ol=U({},Xa,Ka,Ya,Ja,Za,Qa,tl,el,il,rl,sl,nl);$o.__defaultExtensionClasses=U({},ol);var al=(Ia=go[xo]=new $o,function(){function e(){e.done||(e.done=!0,Eo=!1,Er(go,function(e){e._dom_loaded()}))}null!=M&&M.addEventListener?"complete"===M.readyState?e():Mr(M,"DOMContentLoaded",e,{capture:!1}):F&&hi.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),Ia),ll={};function ul(e){var t;return null!=(t=null==e?void 0:e.posthog)?t:al}var cl,hl={type:"posthog",config:{},async init({config:e,env:t}){const i=e.settings;if(!(null==i?void 0:i.apiKey))return!1;const r=ul(t),{apiKey:s,identify:n,group:o,_state:a,...l}=i,u={autocapture:!1,capture_pageview:!1,capture_pageleave:!1,...l};let c=!1;r.init(s,{...u,loaded:()=>{c=!0}}),c||await Promise.resolve();return{...e,settings:{...i,_state:{lastIdentity:{},lastGroup:{}}}}},async push(e,{config:t,rule:i,env:r,data:s,collector:n}){var o,a;const l=ul(r),u=t.settings||{},c=(null==i?void 0:i.settings)||{},h=u._state||{};if(void 0!==c.reset){("boolean"==typeof c.reset?c.reset:await k(e,c.reset,{collector:n}))&&(l.reset(),h.lastIdentity={},h.lastGroup={})}const d=null!=(o=c.identify)?o:u.identify;if(void 0!==d){const t=await k(e,d,{collector:n});f(t)&&(h.lastIdentity=function(e,t,i={}){const r={...i},s=t.distinctId,n=f(t.$set)?t.$set:void 0,o=f(t.$set_once)?t.$set_once:void 0;return m(s)&&""!==s?(s!==i.distinctId||n||o)&&(e.identify(s,n,o),r.distinctId=s):(n||o)&&e.setPersonProperties(n,o),r}(l,t,h.lastIdentity))}const p=null!=(a=c.group)?a:u.group;if(void 0!==p){const t=await k(e,p,{collector:n});f(t)&&(h.lastGroup=function(e,t,i={}){const r={...i},s=t.type,n=t.key,o=f(t.properties)?t.properties:void 0;return m(s)&&m(n)&&(s!==i.type||n!==i.key||o)&&(e.group(s,n,o),r.type=s,r.key=n),r}(l,t,h.lastGroup))}if(!0!==(null==i?void 0:i.silent)){const t=m(null==i?void 0:i.name)?i.name:e.name,r=f(s)?s:{};l.capture(t,r)}u._state=h},on(e,t){var i;if("consent"!==e||!(null==t?void 0:t.data))return;const r=ul(t.env),s=t.data,n=null==(i=t.config)?void 0:i.consent;if(!n||0===Object.keys(n).length)return;Object.keys(n).every(e=>!0===s[e])?r.opt_in_capturing():r.opt_out_capturing()}},dl=hl;return cl=s,((s,n,o,a)=>{if(n&&"object"==typeof n||"function"==typeof n)for(let l of i(n))r.call(s,l)||l===o||e(s,l,{get:()=>n[l],enumerable:!(a=t(n,l))||a.enumerable});return s})(e({},"__esModule",{value:!0}),cl)})();
|