PageSourceSearch

https://travelpal.ai/_next/static/chunks/0-z-3z7g8p.r~.js?dpl=dpl_2XmuBcuLVsN7H7zxMC7MxroQPy8Q

js travelpal.ai collected 2026-10-02 13:16:18 UTC 182,978 bytes, 4 lines download raw bytes

1;!function(){try { var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&((e._debugIds|| (e._debugIds={}))[n]="4e283454-ce03-0a41-e0bd-5138ff249f39")}catch(e){}}();
2(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,604570,e=>{"use strict";var t="u">typeof window?window:void 0,i="u">typeof globalThis?globalThis:t;"u"<typeof self&&(i.self=i),"u"<typeof File&&(i.File=function(){});var s=null==i?void 0:i.navigator,r=null==i?void 0:i.document,n=null==i?void 0:i.location,o=null==i?void 0:i.fetch,a=null!=i&&i.XMLHttpRequest&&"withCredentials"in new i.XMLHttpRequest?i.XMLHttpRequest:void 0,l=null==i?void 0:i.AbortController,u=null==i?void 0:i.CompressionStream,c=null==s?void 0:s.userAgent,h=null!=t?t:{},d="1.370.0",p={DEBUG:!1,LIB_VERSION:d,LIB_NAME:"web",JS_SDK_VERSION:d};function g(e,t,i,s,r,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(s,r)}function v(e){return function(){var t=this,i=arguments;return new Promise(function(s,r){var n=e.apply(t,i);function o(e){g(n,s,r,o,a,"next",e)}function a(e){g(n,s,r,o,a,"throw",e)}o(void 0)})}}function _(){return(_=Object.assign.bind()).apply(null,arguments)}function f(e,t){if(null==e)return{};var i={};for(var s in e)if(({}).hasOwnProperty.call(e,s)){if(-1!==t.indexOf(s))continue;i[s]=e[s]}return i}function m(){return(m=v(function*(e,t,i){void 0===t&&(t=!0);try{var s=new Blob([e],{type:"text/plain"}).stream().pipeThrough(new CompressionStream("gzip"));return yield new Response(s).blob()}catch(e){if(null!=i&&i.rethrow)throw e;return t&&console.error("Failed to gzip compress data",e),null}})).apply(this,arguments)}var y=["$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"],b=["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"],w=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var i=e.toLowerCase();return b.concat(t).some(e=>{var t=e.toLowerCase();return -1!==i.indexOf(t)})};function x(e,t){return -1!==e.indexOf(t)}var E=function(e){return e.trim()},k=function(e){return e.replace(/^\$/,"")},S=Object.prototype,R=S.hasOwnProperty,P=S.toString,F=Array.isArray||function(e){return"[object Array]"===P.call(e)},$=e=>"function"==typeof e,T=e=>e===Object(e)&&!F(e),I=e=>{if(T(e)){for(var t in e)if(R.call(e,t))return!1;return!0}return!1},C=e=>void 0===e,O=e=>"[object String]"==P.call(e),M=e=>O(e)&&0===e.trim().length,L=e=>null===e,A=e=>C(e)||L(e),D=e=>"[object Number]"==P.call(e)&&e==e,N=e=>D(e)&&e>0,j=e=>"[object Boolean]"===P.call(e),q=e=>x(y,e);function H(e){return null===e||"object"!=typeof e}function U(e,t){return({}).toString.call(e)==="[object "+t+"]"}function z(e){return"u">typeof Event&&function(e,t){try{return e instanceof t}catch(e){return!1}}(e,Event)}var W=[!0,"true",1,"1","yes"],B=[!1,"false",0,"0","no"];function G(e,t,i,s,r){return t>i&&(s.warn("min cannot be greater than max."),t=i),D(e)?e>i?(s.warn(" cannot be  greater than max: "+i+". Using max value instead."),i):t>e?(s.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(s.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+r),G(r||i,t,i,s))}class V{constructor(e){this.Pt={},this.Dt=e.Dt,this.jt=G(e.bucketSize,0,100,e.qt),this.$t=G(e.refillRate,0,this.jt,e.qt),this.Ht=G(e.refillInterval,0,864e5,e.qt)}Vt(e,t){var i=Math.floor((t-e.lastAccess)/this.Ht);i>0&&(e.tokens=Math.min(e.tokens+i*this.$t,this.jt),e.lastAccess=e.lastAccess+i*this.Ht)}consumeRateLimit(e){var t,i=Date.now(),s=String(e),r=this.Pt[s];return r?this.Vt(r,i):this.Pt[s]=r={tokens:this.jt,lastAccess:i},0===r.tokens||(r.tokens--,0===r.tokens&&(null==(t=this.Dt)||t.call(this,e)),0===r.tokens)}stop(){this.Pt={}}}var Q,J,Y,K="Mobile",X="Android",Z="Tablet",ee=X+" "+Z,et="iPad",ei="Apple",es=ei+" Watch",er="Safari",en="BlackBerry",eo="Samsung",ea=eo+"Browser",el=eo+" Internet",eu="Chrome",ec=eu+" OS",eh=eu+" iOS",ed="Internet Explorer",ep=ed+" "+K,eg="Opera",ev=eg+" Mini",e_="Edge",ef="Microsoft "+e_,em="Firefox",ey=em+" iOS",eb="Nintendo",ew="PlayStation",ex="Xbox",eE=X+" "+K,ek=K+" "+er,eS="Windows",eR=eS+" Phone",eP="Nokia",eF="Ouya",e$="Generic",eT=e$+" "+K.toLowerCase(),eI=e$+" "+Z.toLowerCase(),eC="Konqueror",eO="(\\d+(\\.\\d+)?)",eM=RegExp("Version/"+eO),eL=RegExp(ex,"i"),eA=RegExp(ew+" \\w+","i"),eD=RegExp(eb+" \\w+","i"),eN=RegExp(en+"|PlayBook|BB10","i"),ej={"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"},eq=function(e,t){var i;return t=t||"",x(e," OPR/")&&x(e,"Mini")?ev:x(e," OPR/")?eg:eN.test(e)?en:x(e,"IE"+K)||x(e,"WPDesktop")?ep:x(e,ea)?el:x(e,e_)||x(e,"Edg/")?ef:x(e,"FBIOS")?"Facebook "+K:x(e,"UCWEB")||x(e,"UCBrowser")?"UC Browser":x(e,"CriOS")?eh:x(e,"CrMo")||x(e,eu)?eu:x(e,X)&&x(e,er)?eE:x(e,"FxiOS")?ey:x(e.toLowerCase(),eC.toLowerCase())?eC:(i=t)&&x(i,ei)||x(e,er)&&!x(e,eu)&&!x(e,X)?x(e,K)?ek:er:x(e,em)?em:x(e,"MSIE")||x(e,"Trident/")?ed:x(e,"Gecko")?em:""},eH={[ep]:[RegExp("rv:"+eO)],[ef]:[RegExp(e_+"?\\/"+eO)],[eu]:[RegExp("("+eu+"|CrMo)\\/"+eO)],[eh]:[RegExp("CriOS\\/"+eO)],"UC Browser":[RegExp("(UCBrowser|UCWEB)\\/"+eO)],[er]:[eM],[ek]:[eM],[eg]:[RegExp("(Opera|OPR)\\/"+eO)],[em]:[RegExp(em+"\\/"+eO)],[ey]:[RegExp("FxiOS\\/"+eO)],[eC]:[RegExp("Konqueror[:/]?"+eO,"i")],[en]:[RegExp(en+" "+eO),eM],[eE]:[RegExp("android\\s"+eO,"i")],[el]:[RegExp(ea+"\\/"+eO)],[ed]:[RegExp("(rv:|MSIE )"+eO)],Mozilla:[RegExp("rv:"+eO)]},eU=function(e,t){var i=eH[eq(e,t)];if(C(i))return null;for(var s=0;i.length>s;s++){var r=e.match(i[s]);if(r)return parseFloat(r[r.length-2])}return null},ez=[[RegExp(ex+"; "+ex+" (.*?)[);]","i"),e=>[ex,e&&e[1]||""]],[RegExp(eb,"i"),[eb,""]],[RegExp(ew,"i"),[ew,""]],[eN,[en,""]],[RegExp(eS,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[eR,""];if(new RegExp(K).test(t)&&!/IEMobile\b/.test(t))return[eS+" "+K,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var s=ej[i[1]]||"";return/arm/i.test(t)&&(s="RT"),[eS,s]}return[eS,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?["iOS",[e[3],e[4],e[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=C(e[2])?e[3]:e[2]),["watchOS",t]}],[RegExp("("+X+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+X+")","i"),e=>e&&e[2]?[X,[e[2],e[3],e[4]||"0"].join(".")]:[X,""]],[/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/,[ec,""]],[/Linux|debian/i,["Linux",""]]],eW=function(e){return eD.test(e)?eb:eA.test(e)?ew:eL.test(e)?ex:RegExp(eF,"i").test(e)?eF:RegExp("("+eR+"|WPDesktop)","i").test(e)?eR:/iPad/.test(e)?et:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?es:eN.test(e)?en:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":RegExp(eP,"i").test(e)?eP:/(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(K).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)?X:ee:RegExp("(pda|"+K+")","i").test(e)?eT:RegExp(Z,"i").test(e)&&!RegExp(Z+" pc","i").test(e)?eI:""},eB=e=>e instanceof Error;class eG{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"},s=this.buildCoercingContext(i,t,0).apply(e),r=this.buildParsingContext(t),n=this.parseStacktrace(s,r);return{$exception_list:this.convertToExceptionList(n,i),$exception_level:"error"}}modifyFrames(e){var t=this;return v(function*(){for(var i of e)i.stacktrace&&i.stacktrace.frames&&F(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,s;return null!=e.cause&&(i=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack&&(s=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.ski
2pFirstLines:0),t.chunkIdMap)),_({},e,{cause:i,stack:s})}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 v(function*(){var i=e;for(var s of t.modifiers)i=yield s(i);return i})()}convertToExceptionList(e,t){var i,s,r,n={type:e.type,value:e.value,mechanism:{type:null!=(i=t.type)?i:"generic",handled:null==(s=t.handled)||s,synthetic:null!=(r=e.synthetic)&&r}};e.stack&&(n.stacktrace={type:"raw",frames:e.stack});var o=[n];return null!=e.cause&&o.push(...this.convertToExceptionList(e.cause,_({},t,{handled:!0}))),o}buildParsingContext(e){var t;return{chunkIdMap:function(e){var t=globalThis._posthogChunkIds;if(t){var i=Object.keys(t);return Y&&i.length===J||(J=i.length,Y=i.reduce((i,s)=>{Q||(Q={});var r=Q[s];if(r)i[r[0]]=r[1];else for(var n=e(s),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,u=t[s];if(l&&u){i[l]=u,Q[s]=[l,u];break}}return i},{})),Y}}(this.stackParser),skipFirstLines:null!=(t=e.skipFirstLines)?t:1}}buildCoercingContext(e,t,i){void 0===i&&(i=0);var s=(i,s)=>{if(4>=s){var r=this.buildCoercingContext(e,t,s);return this.applyCoercers(i,r)}};return _({},t,{syntheticException:0==i?t.syntheticException:void 0,mechanism:e,apply:e=>s(e,i),next:e=>s(e,i+1)})}}function eV(e,t,i,s,r){var n={platform:e,filename:t,function:"<anonymous>"===i?"?":i,in_app:!0};return C(s)||(n.lineno=s),C(r)||(n.colno=r),n}var eQ=(e,t)=>{var i=-1!==e.indexOf("safari-extension"),s=-1!==e.indexOf("safari-web-extension");return i||s?[-1!==e.indexOf("@")?e.split("@")[0]:"?",i?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},eJ=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,eY=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,eK=/\((\S*)(?::(\d+))(?::(\d+))\)/,eX=(e,t)=>{var i=eJ.exec(e);if(i){var[,s,r,n]=i;return eV(t,s,"?",+r,+n)}var o=eY.exec(e);if(o){if(o[2]&&0===o[2].indexOf("eval")){var a=eK.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,u]=eQ(o[1]||"?",o[2]);return eV(t,u,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},eZ=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,e0=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,e1=(e,t)=>{var i=eZ.exec(e);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var s=e0.exec(i[3]);s&&(i[1]=i[1]||"eval",i[3]=s[1],i[4]=s[2],i[5]="")}var r=i[3],n=i[1]||"?";return[n,r]=eQ(n,r),eV(t,r,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},e2=/\(error: (.*)\)/;class e3{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var i=O(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 U(e,"DOMException")}isDOMError(e){return U(e,"DOMError")}}class e5{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}}class e8{match(e){return U(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}}}var e6=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class e4{match(e){return"string"==typeof e}coerce(e,t){var i,[s,r]=this.getInfos(e);return{type:null!=s?s:"Error",value:null!=r?r:e,stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}getInfos(e){var t="Error",i=e,s=e.match(e6);return s&&(t=s[1],i=s[2]),[t,i]}}var e7=["fatal","error","warning","log","info","debug"];function e9(e,t){void 0===t&&(t=40);var i=Object.keys(e);if(i.sort(),!i.length)return"[object has no keys]";for(var s=i.length;s>0;s--){var r=i.slice(0,s).join(", ");
2if(t>=r.length)return s===i.length?r:r.length>t?r.slice(0,t)+"...":r}return""}class te{match(e){return"object"==typeof e&&null!==e}coerce(e,t){var i,s=this.getErrorPropertyFromObject(e);return s?t.apply(s):{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 z(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: "+e9(e)}isSeverityLevel(e){return O(e)&&!M(e)&&e7.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if(({}).hasOwnProperty.call(e,t)){var i=e[t];if(eB(i))return i}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}}class tt{match(e){return z(e)}coerce(e,t){var i,s=e.constructor.name;return{type:s,value:s+" captured as exception with keys: "+e9(e),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}class ti{match(e){return H(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}}}class ts{match(e){return U(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!z(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,s=this.getUnhandledRejectionReason(e);return H(s)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(s),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}:t.apply(s)}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}}var tr="$message",tn="$timestamp",to=new Set([tr,tn]),ta={enabled:!0,max_bytes:32768};function tl(e){var t;return e?{enabled:null!=(t=e.enabled)?t:ta.enabled,max_bytes:function(e,t){if(!D(e)||e===1/0||e===-1/0)return t;var i=Math.floor(e);return 0>i?t:i}(e.max_bytes,ta.max_bytes)}:_({},ta)}class tu{constructor(e){this.zt=[],this.Ut=0,this.Rt=tl(e)}setConfig(e){this.Rt=tl(e),this.Yt()}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(!T(i))return;var s=i[tr],r=i[tn];if(!O(s)||0===s.trim().length||!O(r)&&!D(r))return;return{step:i,json:t}}catch(e){return}}(e);if(t){var i=function(e){if("u">typeof TextEncoder)return(new TextEncoder).encode(e).length;for(var t=encodeURIComponent(e),i=0,s=0;t.length>s;s++)"%"===t[s]?(i+=1,s+=2):i+=1;return i}(t.json);i>this.Rt.max_bytes||(this.zt.push({step:t.step,bytes:i}),this.Ut+=i,this.Yt())}}getAttachable(){return this.zt.map(e=>e.step)}clear(){this.zt=[],this.Ut=0}size(){return this.zt.length}Yt(){for(;this.Ut>this.Rt.max_bytes&&this.zt.length>0;){var e=this.zt.shift();e&&(this.Ut-=e.bytes)}}}var tc=function(e,i){var{debugEnabled:s}=void 0===i?{}:i,r={C(i){if(t&&(p.DEBUG||h.POSTHOG_DEBUG||s)&&!C(t.console)&&t.console){for(var r=("__rrweb_original__"in t.console[i])?t.console[i].__rrweb_original__:t.console[i],n=arguments.length,o=Array(n>1?n-1:0),a=1;n>a;a++)o[a-1]=arguments[a];r(e,...o)}},info(){for(var e=arguments.length,t=Array(e),i=0;e>i;i++)t[i]=arguments[i];r.C("log",...t)},warn(){for(var e=arguments.length,t=Array(e),i=0;e>i;i++)t[i]=arguments[i];r.C("warn",...t)},error(){for(var e=arguments.length,t=Array(e),i=0;e>i;i++)t[i]=arguments[i];r.C("error",...t)},critical(){for(var t=arguments.length,i=Array(t),s=0;t>s;s++)i[s]=arguments[s];console.error(e,...i)},uninitializedWarning(e){r.error("You must initialize PostHog before calling "+e)},createLogger:(t,i)=>tc(e+" "+t,i)};return r},th=tc("[PostHog.js]"),td=th.createLogger,tp=td("[ExternalScriptsLoader]"),tg=(e,t,i)=>{if(e.config.disable_external_dependency_loading)return tp.warn(t+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var s=null==r?void 0:r.querySelectorAll("script");
2if(s){for(var n,o=0;s.length>o;o++)if(n=function(){if(s[o].src===t){var e=s[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})}}())return n.v}var a=()=>{if(!r)return i("document not found");var s=r.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=t,s.onload=e=>{s.__posthog_loading_callback_fired=!0,i(void 0,e)},s.onerror=e=>i(e),e.config.prepare_external_dependency_script&&(s=e.config.prepare_external_dependency_script(s)),!s)return i("prepare_external_dependency_script returned null");if("head"===e.config.external_scripts_inject_target)r.head.appendChild(s);else{var n,o=r.querySelectorAll("body > script");o.length>0?null==(n=o[0].parentNode)||n.insertBefore(s,o[0]):r.body.appendChild(s)}};null!=r&&r.body?a():null==r||r.addEventListener("DOMContentLoaded",a)};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.loadExternalDependency=(e,t,i)=>{if("remote-config"!==t){var s;if(e.config.__preview_external_dependency_versioned_paths)s=e.requestRouter.endpointFor("assets","/static/"+e.version+"/"+t+".js");else{var r="/static/"+t+".js?v="+e.version;"toolbar"===t&&(r=r+"&t="+3e5*Math.floor(Date.now()/3e5)),s=e.requestRouter.endpointFor("assets",r)}tg(e,s,i)}else{var n=e.requestRouter.endpointFor("assets","/array/"+e.config.token+"/config.js");tg(e,n,i)}},h.__PosthogExtensions__.loadSiteApp=(e,t,i)=>{var s=e.requestRouter.endpointFor("api",t);tg(e,s,i)};var tv="$people_distinct_id",t_="$device_id",tf="__alias",tm="__timers",ty="$autocapture_disabled_server_side",tb="$heatmaps_enabled_server_side",tw="$exception_capture_enabled_server_side",tx="$error_tracking_suppression_rules",tE="$error_tracking_capture_extension_exceptions",tk="$web_vitals_enabled_server_side",tS="$dead_clicks_enabled_server_side",tR="$product_tours_enabled_server_side",tP="$web_vitals_allowed_metrics",tF="$session_recording_remote_config",t$="$sesid",tT="$session_is_sampled",tI="$enabled_feature_flags",tC="$early_access_features",tO="$feature_flag_details",tM="$feature_flag_payloads",tL="$override_feature_flag_payloads",tA="$stored_person_properties",tD="$stored_group_properties",tN="$surveys",tj="ph_product_tours",tq="$flag_call_reported",tH="$flag_call_reported_session_id",tU="$feature_flag_errors",tz="$feature_flag_evaluated_at",tW="$user_state",tB="$client_session_props",tG="$capture_rate_limit",tV="$initial_campaign_params",tQ="$initial_referrer_info",tJ="$initial_person_info",tY="$epp",tK="__POSTHOG_TOOLBAR__",tX="$posthog_cookieless",tZ=[tv,tf,"__cmpns",tm,"$session_recording_enabled_server_side",tb,t$,tI,tx,tW,tC,tO,tD,tA,tN,tq,tH,tU,tz,tB,tG,tV,tQ,tY,tJ,tj,"$product_tours_activated",tR,tF,tL],t0="PostHog loadExternalDependency extension not found.",t1="on_reject",t2="always",t3="anonymous",t5="identified",t8="identified_only",t6="visibilitychange",t4="beforeunload",t7="$pageview",t9="$pageleave",ie="$identify",it="$groupidentify";function ii(e,t){F(e)&&e.forEach(t)}function is(e,t){if(!A(e))if(F(e))e.forEach(t);else if(e instanceof FormData)e.forEach((e,i)=>t(e,i));else for(var i in e)R.call(e,i)&&t(e[i],i)}var ir=function(e){for(var t=arguments.length,i=Array(t>1?t-1:0),s=1;t>s;s++)i[s-1]=arguments[s];for(var r of i)for(var n in r)void 0!==r[n]&&(e[n]=r[n]);return e};function io(e){for(var t=Object.keys(e),i=t.length,s=Array(i);i--;)s[i]=[t[i],e[t[i]]];return s}var ia=function(e){try{return e()}catch(e){return}},il=function(e){return function(){try{for(var t=arguments.length,i=Array(t),s=0;t>s;s++)i[s]=arguments[s];return e.apply(this,i)}catch(e){th.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),th.critical(e)}}},iu=function(e){var t={};return is(e,function(e,i){(O(e)&&e.length>0||D(e))&&(t[i]=e)}),t},ic=["herokuapp.com","vercel.app","netlify.app"];function ih(e,t,i,s){var{capture:r=!1,passive:n=!0}=null!=s?s:{};null==e||e.addEventListener(t,i,{capture:r,passive:n})}function id(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 D(e)&&isFinite(e)&&Math.floor(e)===e});class ip{constructor(e){if(this.bytes=e,16!==e.length)throw TypeError("not 128-bit length")}static fromFieldsV7(e,t,i,s){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||0>e||0>t||0>i||0>s||e>0xffffffffffff||t>4095||i>0x3fffffff||s>0xffffffff)throw RangeError("invalid field value");
2var r=new Uint8Array(16);return r[0]=e/0x10000000000,r[1]=e/0x100000000,r[2]=e/0x1000000,r[3]=e/65536,r[4]=e/256,r[5]=e,r[6]=112|t>>>8,r[7]=t,r[8]=128|i>>>24,r[9]=i>>>16,r[10]=i>>>8,r[11]=i,r[12]=s>>>24,r[13]=s>>>16,r[14]=s>>>8,r[15]=s,new ip(r)}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 Error("Invalid UUIDv7 was generated");return e}clone(){return new ip(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}}class ig{constructor(){this.I=0,this.S=0,this.k=new im}generate(){var e=this.generateOrAbort();if(C(e)){this.I=0;var t=this.generateOrAbort();if(C(t))throw Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.I)this.I=e,this.A();else{if(this.I>=e+1e4)return;this.S++,this.S>0x3ffffffffff&&(this.I++,this.A())}return ip.fromFieldsV7(this.I,Math.trunc(this.S/0x40000000),0x3fffffff&this.S,this.k.nextUint32())}A(){this.S=1024*this.k.nextUint32()+(1023&this.k.nextUint32())}}var iv,i_=e=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw 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};t&&!C(t.crypto)&&crypto.getRandomValues&&(i_=e=>crypto.getRandomValues(e));class im{constructor(){this.T=new Uint32Array(8),this.N=1/0}nextUint32(){return this.T.length>this.N||(i_(this.T),this.N=0),this.T[this.N++]}}var iy=()=>ib().toString(),ib=()=>(iv||(iv=new ig)).generate(),iw="",ix=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,iE={Gt:()=>!!r,Xt(e){th.error("cookieStore error: "+e)},Jt(e){if(r){try{for(var t=e+"=",i=r.cookie.split(";").filter(e=>e.length),s=0;i.length>s;s++){for(var n=i[s];" "==n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(t))return decodeURIComponent(n.substring(t.length,n.length))}}catch(e){}return null}},Kt(e){var t;try{t=JSON.parse(iE.Jt(e))||{}}catch(e){}return t},Qt(e,t,i,s,n){if(r)try{var o="",a="",l=function(e,t){if(t){var i=function(e,t){if(void 0===t&&(t=r),iw)return iw;if(!t||["localhost","127.0.0.1"].includes(e))return"";for(var i=e.split("."),s=Math.min(i.length,8),n="dmn_chk_"+iy();!iw&&s--;){var o=i.slice(s).join("."),a=n+"=1;domain=."+o+";path=/";t.cookie=a+";max-age=3",t.cookie.includes(n)&&(t.cookie=a+";max-age=0",iw=o)}return iw}(e);if(!i){var s,n=(s=e.match(ix))?s[0]:"";n!==i&&th.info("Warning: cookie subdomain discovery mismatch",n,i),i=n}return i?"; domain=."+i:""}return""}(r.location.hostname,s);if(i){var u=new Date;u.setTime(u.getTime()+864e5*i),o="; expires="+u.toUTCString()}n&&(a="; secure");var c=e+"="+encodeURIComponent(JSON.stringify(t))+o+"; SameSite=Lax; path=/"+l+a;return c.length>3686.4&&th.warn("cookieStore warning: large cookie, len="+c.length),r.cookie=c,c}catch(e){return}},ti(e,t){if(null!=r&&r.cookie)try{iE.Qt(e,"",-1,t)}catch(e){return}}},ik=null,iS={Gt(){if(!L(ik))return ik;var e=!0;if(C(t))e=!1;else try{var i="__mplssupport__";iS.Qt(i,"xyz"),'"xyz"'!==iS.Jt(i)&&(e=!1),iS.ti(i)}catch(t){e=!1}return e||th.error("localStorage unsupported; falling back to cookie store"),ik=e,e},Xt(e){th.error("localStorage error: "+e)},Jt(e){try{return null==t?void 0:t.localStorage.getItem(e)}catch(e){iS.Xt(e)}return null},Kt(e){try{return JSON.parse(iS.Jt(e))||{}}catch(e){}return null},Qt(e,i){try{null==t||t.localStorage.setItem(e,JSON.stringify(i))}catch(e){iS.Xt(e)}},ti(e){try{null==t||t.localStorage.removeItem(e)}catch(e){iS.Xt(e)}}},iR=[t_,"distinct_id",t$,tT,tY,tJ,tW],iP={},iF={Gt:()=>!0,Xt(e){th.error("memoryStorage error: "+e)},Jt:e=>iP[e]||null,Kt:e=>iP[e]||null,Qt(e,t){iP[e]=t},ti(e){delete iP[e]}},i$=null,iT={Gt(){if(!L(i$))return i$;if(i$=!0,C(t))i$=!1;else try{var e="__support__";iT.Qt(e,"xyz"),'"xyz"'!==iT.Jt(e)&&(i$=!1),iT.ti(e)}catch(e){i$=!1}return i$},Xt(e){th.error("sessionStorage error: ",e)},Jt(e){try{return null==t?void 0:t.sessionStorage.getItem(e)}catch(e){iT.Xt(e)}return null}
2,Kt(e){try{return JSON.parse(iT.Jt(e))||null}catch(e){}return null},Qt(e,i){try{null==t||t.sessionStorage.setItem(e,JSON.stringify(i))}catch(e){iT.Xt(e)}},ti(e){try{null==t||t.sessionStorage.removeItem(e)}catch(e){iT.Xt(e)}}};class iI{constructor(e){this._instance=e}get Rt(){return this._instance.config}get consent(){return this.ei()?0:this.ii}isOptedOut(){return this.Rt.cookieless_mode===t2||this.isRejected()||-1===this.consent&&this.Rt.cookieless_mode===t1}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Rt.opt_out_capturing_by_default}optInOut(e){this.ri.Qt(this.ni,+!!e,this.Rt.cookie_expiration,this.Rt.cross_subdomain_cookie,this.Rt.secure_cookie)}reset(){this.ri.ti(this.ni,this.Rt.cross_subdomain_cookie)}get ni(){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 ii(){var e=this.ri.Jt(this.ni);return x(W,e)?1:x(B,e)?0:-1}get ri(){var e=this.Rt.opt_out_capturing_persistence_type,t="localStorage"===e?iS:iE;if(!this.si||this.si!==t){this.si=t;var i="localStorage"===e?iE:iS;i.Jt(this.ni)&&(this.si.Jt(this.ni)||this.optInOut(x(W,i.Jt(this.ni))),i.ti(this.ni,this.Rt.cross_subdomain_cookie))}return this.si}ei(){return!!this.Rt.respect_dnt&&[null==s?void 0:s.doNotTrack,null==s?void 0:s.msDoNotTrack,h.doNotTrack].some(e=>x(W,e))}}var iC=td("[Dead Clicks]"),iO=()=>!0,iM=e=>{var t,i=!(null==(t=e.instance.persistence)||!t.get_property(tS)),s=e.instance.config.capture_dead_clicks;return j(s)?s:!!T(s)||i};class iL{get lazyLoadedDeadClicksAutocapture(){return this.oi}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({[tS]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.ai(()=>{this.li()}):this.stop()}ai(e){var t,i;null!=(t=h.__PosthogExtensions__)&&t.initDeadClicksAutocapture&&e(),null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",t=>{t?iC.error("failed to load script",t):e()})}li(){var e;if(r){if(!this.oi&&null!=(e=h.__PosthogExtensions__)&&e.initDeadClicksAutocapture){var t=T(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.oi=h.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.oi.start(r),iC.info("starting...")}}else iC.error("`document` not found. Cannot start.")}stop(){this.oi&&(this.oi.stop(),this.oi=void 0,iC.info("stopping..."))}}var iA=td("[SegmentIntegration]"),iD="posthog-js";function iN(e,t){var{organization:i,projectId:s,prefix:r,severityAllowList:n=["error"],sendExceptionsToPostHog:o=!0}=void 0===t?{}:t;return t=>{if("*"!==n&&!n.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var a=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=a,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var l,u,c,h,d,p,g=(null==(l=t.exception)?void 0:l.values)||[],v=g.map(e=>_({},e,{stacktrace:e.stacktrace?_({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map(e=>_({},e,{platform:"web:javascript"}))}):void 0})),f={$exception_message:(null==(u=g[0])?void 0:u.value)||t.message,$exception_type:null==(c=g[0])?void 0:c.type,$exception_level:t.level,$exception_list:v,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(h=g[0])?void 0:h.value)||t.message,$sentry_exception_type:null==(d=g[0])?void 0:d.type,$sentry_tags:t.tags};return i&&s&&(f.$sentry_url=(r||"https://sentry.io/organizations/")+i+"/issues/?project="+s+"&query="+t.event_id),o&&(null==(p=e.exceptions)||p.sendExceptionEvent(f)),t}}class ij{constructor(e,t,i,s,r,n){this.name=iD,this.setupOnce=function(o){o(iN(e,{organization:t,projectId:i,prefix:s,severityAllowList:r,sendExceptionsToPostHog:null==n||n}))}}}class iq{constructor(e){this.ui=(e,t,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength)&&(th.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:i}),this.hi=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.ci()}ci(){var e;this.di=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(this.ui)}destroy(){var e;null==(e=this.di)||e.call(this),this.di=void 0}doPageView(e,i){var s,r=this.vi(e,i);return this.hi={pathname:null!=(s=null==t?void 0:t.location.pathname)?s:"",pageViewId:i,timestamp:e},this._instance.scrollManager.resetContext(),r}doPageLeave(e){var t;return this.vi(e,null==(t=this.hi)?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null==(e=this.hi)?void 0:e.pageViewId}}vi(e,t){var i=this.hi;if(!i)return{$pageview_id:t};var s={$pageview_id:t,$prev_pageview_id:i.pageViewId},r=this._instance.scrollManager.getContext();if(r&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:u,maxContentY:c}=r;if(!(C(n)||C(o)||C(a)||C(l)||C(u)||C(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?G(o/n,0,1,th):1,d=n>1?G(a/n,0,1,th):1,p=l>1?G(u/l,0,1,th):1,g=l>1?G(c/l,0,1,th):1;s=ir(s,{$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:g})}}return i.pathname&&(s.$prev_pageview_pathname=i.pathname),i.timestamp&&(s.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),s}}var iH=e=>{var t=null==r?void 0:r.createElement("a");return C(t)?null:(t.href=e,t)},iU=function(e,t){for(var i,s=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;s.length>r;r++){var n=s[r].split("=");if(n[0]===t){i=n;break}}if(!F(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(e){th.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},iz=function(e,t,i){if(!e||!t||!t.length)return e;for(var s=e.split("#"),r=s[1],n=(s[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),u=[],c=0;l.length>c;c++){var h=l[c].split("=");F(h)&&(t.includes(h[0])?u.push(h[0]+"="+i):u.push(l[c]))}var d=a;return null!=o&&(d+="?"+u.join("&")),null!=r&&(d+="#"+r),d},iW=function(e,t){var i=e.match(RegExp(t+"=([^&]*)"));return i?i[1]:null},iB="https?://(.*)",iG=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],iV=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...iG],iQ="<masked>",iJ=["li_fat_id"];function iY(e,t,i){if(!r)return{};var s,n=t?[...iG,...i||[]]:[],o=iK(iz(r.URL,n,iQ),e);return ir((s={},is(iJ,function(e){var t=iE.Jt(e);s[e]=t||null}),s),o)}function iK(e,t){var i=iV.concat(t||[]),s={};return is(i,function(t){var i=iU(e,t);s[t]=i||null}),s}function iX(e){var t=e?0===e.search(iB+"google.([^/?]*)")?"google":0===e.search(iB+"bing.com")?"bing":0===e.search(iB+"yahoo.com")?"yahoo":0===e.search(iB+"duckduckgo.com")?"duckduckgo":null:null,i={};if(!L(t)){i.$search_engine=t;var s=r?iU(r.referrer,"yahoo"!=t?"q":"p"):"";s.length&&(i.ph_keyword=s)}return i}function iZ(){return navigator.language||navigator.userLanguage}var i0="$direct";function i1(){return(null==r?void 0:r.referrer)||i0}function i2(e,t){var i=e?[...iG,...t||[]]:[],s=null==n?void 0:n.href.substring(0,1e3);return{r:i1().substring(0,1e3),u:s?iz(s,i,iQ):void 0}}function i3(e){var t,{r:i,u:s}=e,r={$referrer:i,$referring_domain:null==i?void 0:i==i0?i0:null==(t=iH(i))?void 0:t.host};
2if(s){r.$current_url=s;var n=iH(s);r.$host=null==n?void 0:n.host,r.$pathname=null==n?void 0:n.pathname,ir(r,iK(s))}return i&&ir(r,iX(i)),r}function i5(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}var i8=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class i6{constructor(e,t){this.Rt=e,this.props={},this.fi=!1,this.pi=(e=>{var t="";return e.token&&(t=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+t+"_posthog"})(e),this.ri=this.gi(e),this.load(),e.debug&&th.info("Persistence loaded",e.persistence,_({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this.mi}gi(e){-1===i8.indexOf(e.persistence.toLowerCase())&&(th.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var i,s,r=(void 0===(i=e.cookie_persisted_properties||[])&&(i=[]),s=[...iR,...i],_({},iS,{Kt(e){try{var t={};try{t=iE.Kt(e)||{}}catch(e){}var i=ir(t,JSON.parse(iS.Jt(e)||"{}"));return iS.Qt(e,i),i}catch(e){}return null},Qt(e,t,i,r,n,o){try{iS.Qt(e,t,void 0,void 0,o);var a={};s.forEach(e=>{t[e]&&(a[e]=t[e])}),Object.keys(a).length&&iE.Qt(e,a,i,r,n,o)}catch(e){iS.Xt(e)}},ti(e,i){try{null==t||t.localStorage.removeItem(e),iE.ti(e,i)}catch(e){iS.Xt(e)}}})),n=e.persistence.toLowerCase();return"localstorage"===n&&iS.Gt()?iS:"localstorage+cookie"===n&&r.Gt()?r:"sessionstorage"===n&&iT.Gt()?iT:"memory"===n?iF:"cookie"===n?iE:r.Gt()?r:iE}yi(e){var t=null!=e?e:this.Rt.feature_flag_cache_ttl_ms;if(!t||0>=t)return!1;var i=this.props[tz];return!i||"number"!=typeof i||Date.now()-i>t}properties(){var e={};return is(this.props,(t,i)=>{if(i===tI&&T(t)){if(!this.yi())for(var s=Object.keys(t),r=0;s.length>r;r++)e["$feature/"+s[r]]=t[s[r]]}else -1===tZ.indexOf(i)&&(e[i]=t)}),e}load(){if(!this.mi){var e=this.ri.Kt(this.pi);e&&(this.props=ir({},e))}}save(){this.mi||this.ri.Qt(this.pi,this.props,this.bi,this.wi,this.Ii,this.Rt.debug)}remove(){this.ri.ti(this.pi,!1),this.ri.ti(this.pi,!0)}clear(){this.remove(),this.props={}}register_once(e,t,i){if(T(e)){C(t)&&(t="None"),this.bi=C(i)?this.Ci:i;var s=!1;if(is(e,(e,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==t||(this.props[i]=e,s=!0)}),s)return this.save(),!0}return!1}register(e,t){if(T(e)){this.bi=C(t)?this.Ci:t;var i=!1;if(is(e,(t,s)=>{e.hasOwnProperty(s)&&this.props[s]!==t&&(this.props[s]=t,i=!0)}),i)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.fi){var e=iY(this.Rt.custom_campaign_params,this.Rt.mask_personal_data_properties,this.Rt.custom_personal_data_properties);I(iu(e))||this.register(e),this.fi=!0}}update_search_keyword(){var e;this.register((e=null==r?void 0:r.referrer)?iX(e):{})}update_referrer_info(){var e;this.register_once({$referrer:i1(),$referring_domain:null!=r&&r.referrer&&(null==(e=iH(r.referrer))?void 0:e.host)||i0},void 0)}set_initial_person_info(){this.props[tV]||this.props[tQ]||this.register_once({[tJ]:i2(this.Rt.mask_personal_data_properties,this.Rt.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};is([tQ,tV],t=>{var i=this.props[t];i&&is(i,function(t,i){e["$initial_"+k(i)]=t})});var t,i,s=this.props[tJ];return s&&ir(e,(t=i3(s),i={},is(t,function(e,t){i["$initial_"+k(t)]=e}),i)),e}safe_merge(e){return is(this.props,function(t,i){i in e||(e[i]=t)}),e}update_config(e,t,i){if(this.Ci=this.bi=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(),s=[...t].sort();return i.every((e,t)=>e===s[t])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[])){var s=this.gi(e),r=this.props;this.clear(),this.ri=s,this.props=r,this.save()}}set_disabled(e){this.mi=e,this.mi?this.remove():this.save()}set_cross_subdomain(e){e!==this.wi&&(this.wi=e,this.remove(),this.save())}set_secure(e){e!==this.Ii&&(this.Ii=e,this.remove(),this.save())}set_event_timer(e,t){var i=this.props[tm]||{};i[e]=t,this.props[tm]=i,this.save()}remove_event_timer(e){var t=(this.props[tm]||{})[e];return C(t)||(delete this.props[tm][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}}var i4="events",i7="cancelEvents",i9="survey shown",se="survey sent",st="popover",si=td("[RateLimiter]");class ss{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;
2if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach(e=>{si.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4})}catch(e){return void si.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){void 0===e&&(e=!1);var t,i,s,{captureEventsBurstLimit:r,captureEventsPerSecond:n}=this,o=(new Date).getTime(),a=null!=(t=null==(i=this.instance.persistence)?void 0:i.get_property(tG))?t:{tokens:r,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>r&&(a.tokens=r);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 "+r+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,null==(s=this.instance.persistence)||s.set_property(tG,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}var sr=td("[RemoteConfig]");class sn{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=h._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}Si(e){var t,i;null!=(t=h.__PosthogExtensions__)&&t.loadExternalDependency?null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):e()}xi(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 sr.info("Using preloaded remote config",this.remoteConfig),this.ki(this.remoteConfig),void this.Ti();if(this._instance.Ai())return void sr.warn("Remote config is disabled. Falling back to local config.");this.Si(e=>{e?(this.ki(e),this.Ti()):(sr.info("No config found after loading remote JS config. Falling back to JSON."),this.xi(e=>{this.ki(e),this.Ti()}))})}catch(e){sr.error("Error loading remote config",e)}}stop(){this.Ei&&(clearInterval(this.Ei),this.Ei=void 0)}refresh(){this._instance.Ai()||"hidden"===(null==r?void 0:r.visibilityState)||this._instance.reloadFeatureFlags()}Ti(){var e;if(!this.Ei){var t=null!=(e=this._instance.config.remote_config_refresh_interval_ms)?e:3e5;0!==t&&(this.Ei=setInterval(()=>{this.refresh()},t))}}ki(e){var t;e||sr.error("Failed to fetch remote config from PostHog."),this._instance.ki(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())}}var so="gzip-js",sa="base64",sl=Uint8Array,su=Uint16Array,sc=Uint32Array,sh=new sl([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]),sd=new sl([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]),sp=new sl([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),sg=function(e,t){for(var i=new su(31),s=0;31>s;++s)i[s]=t+=1<<e[s-1];var r=new sc(i[30]);for(s=1;30>s;++s)for(var n=i[s];i[s+1]>n;++n)r[n]=n-i[s]<<5|s;return[i,r]},sv=sg(sh,2),s_=sv[1];sv[0][28]=258,s_[258]=28;for(var sf=sg(sd,0)[1],sm=new su(32768),sy=0;32768>sy;++sy){var sb=(43690&sy)>>>1|(21845&sy)<<1;sm[sy]=((65280&(sb=(61680&(sb=(52428&sb)>>>2|(13107&sb)<<2))>>>4|(3855&sb)<<4))>>>8|(255&sb)<<8)>>>1}var sw=function(e,t,i){for(var s=e.length,r=0,n=new su(t);s>r;++r)++n[e[r]-1];var o,a=new su(t);for(r=0;t>r;++r)a[r]=a[r-1]+n[r-1]<<1;if(i){o=new su(1<<t);var l=15-t;for(r=0;s>r;++r)if(e[r])for(var u=r<<4|e[r],c=t-e[r],h=a[e[r]-1]++<<c,d=h|(1<<c)-1;d>=h;++h)o[sm[h]>>>l]=u}else for(o=new su(s),r=0;s>r;++r)o[r]=sm[a[e[r]-1]++]>>>15-e[r];return o},sx=new sl(288);for(sy=0;144>sy;++sy)sx[sy]=8;for(sy=144;256>sy;++sy)sx[sy]=9;for(sy=256;280>sy;++sy)sx[sy]=7;for(sy=280;288>sy;++sy)sx[sy]=8;var sE=new sl(32);for(sy=0;32>sy;++sy)sE[sy]=5;var sk=sw(sx,9,0),sS=sw(sE,5,0),sR=function(e){return(e/8|0)+(7&e&&1)},sP=function(e,t,i){(null==i||i>e.length)&&(i=e.length);var s=new(e instanceof su?su:e instanceof sc?sc:sl)(i-t);return s.set(e.subarray(t,i)),s},sF=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8},s$=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8,e[s+2]|=i>>>16},sT=function(e,t){for(var i=[],s=0;e.length>s;++s)e[s]&&i.push({s:s,f:e[s]});var r=i.length,n=i.slice();if(!r)return[new sl(0),0];if(1==r){var o=new sl(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!=r-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(s=1;r>s;++s)n[s].s>d&&(d=n[s].s);var p=new su(d+1),g=sI(i[c-1],p,0);if(g>t){s=0;var v=0,_=g-t,f=1<<_;for(n.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});r>s;++s){var m=n[s].s;if(t>=p[m])break;v+=f-(1<<g-p[m]),p[m]=t}for(v>>>=_;v>0;){var y=n[s].s;t>p[y]?v-=1<<t-p[y]++-1:++s}for(;s>=0&&v;--s){var b=n[s].s;p[b]==t&&(--p[b],++v)}g=t}return[new sl(p),g]},sI=function(e,t,i){return -1==e.s?Math.max(sI(e.l,t,i+1),sI(e.r,t,i+1)):t[e.s]=i},sC=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new su(++t),s=0,r=e[0],n=1,o=function(e){i[s++]=e},a=1;t>=a;++a)if(e[a]==r&&a!=t)++n;else{if(!r&&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(r),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(r);n=1,r=e[a]}return[i.subarray(0,s),t]},sO=function(e,t){for(var i=0,s=0;t.length>s;++s)i+=e[s]*t[s];return i},sM=function(e,t,i){var s=i.length,r=sR(t+2);e[r]=255&s,e[r+1]=s>>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var n=0;s>n;++n)e[r+n+4]=i[n];return 8*(r+4+s)},sL=function(e,t,i,s,r,n,o,a,l,u,c){sF(t,c++,i),++r[256];for(var h=sT(r,15),d=h[0],p=h[1],g=sT(n,15),v=g[0],_=g[1],f=sC(d),m=f[0],y=f[1],b=sC(v),w=b[0],x=b[1],E=new su(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=sT(E,7),R=S[0],P=S[1],F=19;F>4&&!R[sp[F-1]];--F);
2var $,T,I,C,O=u+5<<3,M=sO(r,sx)+sO(n,sE)+o,L=sO(r,d)+sO(n,v)+o+14+3*F+sO(E,R)+(2*E[16]+3*E[17]+7*E[18]);if(M>=O&&L>=O)return sM(t,c,e.subarray(l,l+u));if(sF(t,c,1+(M>L)),c+=2,M>L){$=sw(d,p,0),T=d,I=sw(v,_,0),C=v;var A=sw(R,P,0);for(sF(t,c,y-257),sF(t,c+5,x-1),sF(t,c+10,F-4),c+=14,k=0;F>k;++k)sF(t,c+3*k,R[sp[k]]);c+=3*F;for(var D=[m,w],N=0;2>N;++N){var j=D[N];for(k=0;j.length>k;++k)sF(t,c,A[q=31&j[k]]),c+=R[q],q>15&&(sF(t,c,j[k]>>>5&127),c+=j[k]>>>12)}}else $=sk,T=sx,I=sS,C=sE;for(k=0;a>k;++k)if(s[k]>255){s$(t,c,$[257+(q=s[k]>>>18&31)]),c+=T[q+257],q>7&&(sF(t,c,s[k]>>>23&31),c+=sh[q]);var q,H=31&s[k];s$(t,c,I[H]),c+=C[H],H>3&&(s$(t,c,s[k]>>>5&8191),c+=sd[H])}else s$(t,c,$[s[k]]),c+=T[s[k]];return s$(t,c,$[256]),c+T[256]},sA=new sc([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),sD=function(){for(var e=new sc(256),t=0;256>t;++t){for(var i=t,s=9;--s;)i=(1&i&&0xedb88320)^i>>>1;e[t]=i}return e}(),sN=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8},sj=!!a||!!o,sq="text/plain",sH=!1,sU=function(e,t,i){void 0===i&&(i=!0);var s,r,n,o,a,[l,u]=e.split("?"),c=_({},t),h=null!=(a=null==u?void 0:u.split("&").map(e=>{var t,[s,r]=e.split("="),n=i&&null!=(t=c[s])?t:r;return delete c[s],s+"="+n}))?a:[],d=(void 0===s&&(s="&"),o=[],is(c,function(e,t){C(e)||C(t)||"undefined"===t||(r=encodeURIComponent(e instanceof File?e.name:e.toString()),n=encodeURIComponent(t),o[o.length]=n+"="+r)}),o.join(s));return d&&h.push(d),l+"?"+h.join("&")},sz=(e,t)=>JSON.stringify(e,(e,t)=>"bigint"==typeof t?t.toString():t,t),sW=e=>{if(e.Wt)return e.Wt;var{data:t,compression:i}=e;if(t){if(i===so){var s,r,n,o,a,l,u,c,h=(s=function(e){var t=e.length;if("u">typeof TextEncoder)return(new TextEncoder).encode(e);for(var i=new sl(e.length+(e.length>>>1)),s=0,r=function(e){i[s++]=e},n=0;t>n;++n){if(s+5>i.length){var o=new sl(s+8+(t-n<<1));o.set(i),i=o}var a=e.charCodeAt(n);128>a?r(a):(2048>a?r(192|a>>>6):(a>55295&&57344>a?(r(240|(a=65536+(1047552&a)|1023&e.charCodeAt(++n))>>>18),r(128|a>>>12&63)):r(224|a>>>12),r(128|a>>>6&63)),r(128|63&a))}return sP(i,0,s)}(sz(t)),r={mtime:0},n=0xffffffff,o={p(e){for(var t=n,i=0;e.length>i;++i)t=sD[255&t^e[i]]^t>>>8;n=t},d:()=>0xffffffff^n},a=s.length,o.p(s),c=(l=10+(r.filename&&r.filename.length+1||0),u=function(e,t,i,s){var r=e.length,n=new sl(s+r+5*(1+Math.floor(r/7e3))+8),o=n.subarray(s,n.length-8),a=0;if(!t||8>r)for(var l=0;r>=l;l+=65535){var u=l+65535;r>u?a=sM(o,a,e.subarray(l,u)):(o[l]=!0,a=sM(o,a,e.subarray(l,r)))}else{for(var c=sA[t-1],h=c>>>13,d=8191&c,p=(1<<i)-1,g=new su(32768),v=new su(p+1),_=Math.ceil(i/3),f=2*_,m=function(t){return(e[t]^e[t+1]<<_^e[t+2]<<f)&p},y=new sc(25e3),b=new su(288),w=new su(32),x=0,E=0,k=(l=0,0),S=0,R=0;r>l;++l){var P=m(l),F=32767&l,$=v[P];if(g[F]=$,v[P]=F,l>=S){var T=r-l;if((x>7e3||k>24576)&&T>423){a=sL(e,o,0,y,b,w,E,k,R,l-R,a),k=x=E=0,R=l;for(var I=0;286>I;++I)b[I]=0;for(I=0;30>I;++I)w[I]=0}var C=2,O=0,M=d,L=F-$&32767;if(T>2&&P==m(l-L))for(var A=Math.min(h,T)-1,D=Math.min(32767,l),N=Math.min(258,T);D>=L&&--M&&F!=$;){if(e[l+C]==e[l+C-L]){for(var j=0;N>j&&e[l+j]==e[l+j-L];++j);if(j>C){if(C=j,O=L,j>A)break;var q=Math.min(L,j-2),H=0;for(I=0;q>I;++I){var U=l-L+I+32768&32767,z=U-g[U]+32768&32767;z>H&&(H=z,$=U)}}}L+=(F=$)-($=g[F])+32768&32767}if(O){y[k++]=0x10000000|s_[C]<<18|sf[O];var W=31&s_[C],B=31&sf[O];E+=sh[W]+sd[B],++b[257+W],++w[B],S=l+C,++x}else y[k++]=e[l],++b[e[l]]}}a=sL(e,o,!0,y,b,w,E,k,R,l-R,a)}return sP(n,0,s+sR(a)+8)}(s,null==r.level?6:r.level,null==r.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(s.length)))):12+r.mem,l)).length,function(e,t){var i=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=2>t.level?4:2*(9==t.level),e[9]=3,0!=t.mtime&&sN(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var s=0;i.length>=s;++s)e[s+10]=i.charCodeAt(s)}}(u,r),sN(u,c-8,o.d()),sN(u,c-4,a),u);return{contentType:sq,body:h.buffer.slice(h.byteOffset,h.byteOffset+h.byteLength),estimatedSize:h.byteLength}}if(i===sa){let e;var d,p="data="+encodeURIComponent("string"==typeof(e=(d=sz(t))?btoa(encodeURIComponent(d).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16)))):d)?e:sz(e));return{contentType:"application/x-www-form-urlencoded",body:p,estimatedSize:new Blob([p]).size}}var g=sz(t);return{contentType:"application/json",body:g,estimatedSize:new Blob([g]).size}}},sB=(rh=v(function*(e){var t=sz(e.data),i=yield function(e,t,i){return m.apply(this,arguments)}(t,p.DEBUG,{rethrow:!0});if(!i)return e;var s=yield i.arrayBuffer();return _({},e,{Wt:{contentType:sq,body:s,estimatedSize:s.byteLength}})}),function(e){return rh.apply(this,arguments)}),sG=(e,t)=>
2sU(e,{_:(new Date).getTime().toString(),ver:p.JS_SDK_VERSION,compression:t}),sV=[];o&&sV.push({transport:"fetch",method(e){var t,i,{contentType:s,body:r,estimatedSize:n}=null!=(t=sW(e))?t:{},a=new Headers;is(e.headers,function(e,t){a.append(t,e)}),s&&a.append("Content-Type",s);var u=e.url,c=null;if(l){var h=new l;c={signal:h.signal,timeout:setTimeout(()=>h.abort(),e.timeout)}}o(u,_({method:(null==e?void 0:e.method)||"GET",headers:a,keepalive:"POST"===e.method&&52428.8>(n||0),body:r,signal:null==(i=c)?void 0:i.signal},e.fetchOptions)).then(t=>t.text().then(i=>{var s={statusCode:t.status,text:i};if(200===t.status)try{s.json=JSON.parse(i)}catch(e){th.error(e)}null==e.callback||e.callback(s)})).catch(t=>{th.error(t),null==e.callback||e.callback({statusCode:0,error:t})}).finally(()=>c?clearTimeout(c.timeout):null)}}),a&&sV.push({transport:"XHR",method(e){var t,i=new a;i.open(e.method||"GET",e.url,!0);var{contentType:s,body:r}=null!=(t=sW(e))?t:{};is(e.headers,function(e,t){i.setRequestHeader(t,e)}),s&&i.setRequestHeader("Content-Type",s),e.timeout&&(i.timeout=e.timeout),e.disableXHRCredentials||(i.withCredentials=!0),i.onreadystatechange=()=>{if(4===i.readyState){var t={statusCode:i.status,text:i.responseText};if(200===i.status)try{t.json=JSON.parse(i.responseText)}catch(e){}null==e.callback||e.callback(t)}},i.send(r)}}),null!=s&&s.sendBeacon&&sV.push({transport:"sendBeacon",method(e){var t=sU(e.url,{beacon:"1"});try{var i,{contentType:r,body:n}=null!=(i=sW(e))?i:{};if(!n)return;var o=n instanceof Blob?n:new Blob([n],{type:r});s.sendBeacon(t,o)}catch(e){}}});class sQ{constructor(e,t){this.Ri=!0,this.Ni=[],this.Mi=G((null==t?void 0:t.flush_interval_ms)||3e3,250,5e3,th.createLogger("flush interval"),3e3),this.Fi=e}enqueue(e){this.Ni.push(e),this.Oi||this.Pi()}unload(){this.Li();var e=Object.values(this.Ni.length>0?this.Di():{});[...e.filter(e=>0===e.url.indexOf("/e")),...e.filter(e=>0!==e.url.indexOf("/e"))].map(e=>{this.Fi(_({},e,{transport:"sendBeacon"}))})}enable(){this.Ri=!1,this.Pi()}Pi(){var e=this;this.Ri||(this.Oi=setTimeout(()=>{if(this.Li(),this.Ni.length>0){var t=this.Di();for(var i in t)!function(){var s=t[i],r=(new Date).getTime();s.data&&F(s.data)&&is(s.data,e=>{e.offset=Math.abs(e.timestamp-r),delete e.timestamp}),e.Fi(s)}()}},this.Mi))}Li(){clearTimeout(this.Oi),this.Oi=void 0}Di(){var e={};return is(this.Ni,t=>{var i,s=(t?t.batchKey:null)||t.url;C(e[s])&&(e[s]=_({},t,{data:[]})),null==(i=e[s].data)||i.push(t.data)}),this.Ni=[],e}}var sJ=["retriesPerformedSoFar"];class sY{constructor(e){this.Bi=!1,this.ji=3e3,this.Ni=[],this._instance=e,this.Ni=[],this.qi=!0,!C(t)&&"onLine"in t.navigator&&(this.qi=t.navigator.onLine,this.Zi=()=>{this.qi=!0,this.$i()},this.Hi=()=>{this.qi=!1},ih(t,"online",this.Zi),ih(t,"offline",this.Hi))}get length(){return this.Ni.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,i=f(e,sJ);N(t)&&(i.url=sU(i.url,{retry_count:t})),this._instance._send_request(_({},i,{callback:e=>{200===e.statusCode||e.statusCode>=400&&500>e.statusCode||(null!=t?t:0)>=10?null==i.callback||i.callback(e):this.Vi(_({retriesPerformedSoFar:t},i))}}))}Vi(e){var t,i,s=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=s+1;var r=Math.ceil((i=Math.min(18e5,t=3e3*Math.pow(2,s)))+(Math.random()-.5)*(i-t/2)),n=Date.now()+r;this.Ni.push({retryAt:n,requestOptions:e});var o="Enqueued failed request for retry in "+r;navigator.onLine||(o+=" (Browser is offline)"),th.warn(o),this.Bi||(this.Bi=!0,this.zi())}zi(){(this.Ui&&clearTimeout(this.Ui),0===this.Ni.length)?(this.Bi=!1,this.Ui=void 0):this.Ui=setTimeout(()=>{this.qi&&this.Ni.length>0&&this.$i(),this.zi()},this.ji)}$i(){var e=Date.now(),t=[],i=this.Ni.filter(i=>e>i.retryAt||(t.push(i),!1));if(this.Ni=t,i.length>0)for(var{requestOptions:s}of i)this.retriableRequest(s)}unload(){for(var{requestOptions:e}of(this.Ui&&(clearTimeout(this.Ui),this.Ui=void 0),this.Bi=!1,C(t)||(this.Zi&&(t.removeEventListener("online",this.Zi),this.Zi=void 0),this.Hi&&(t.removeEventListener("offline",this.Hi),this.Hi=void 0)),this.Ni))try{this._instance._send_request(_({},e,{transport:"sendBeacon"}))}catch(e){th.error(e)}this.Ni=[]}}class sK{constructor(e){this.Yi=()=>{this.Wi||(this.Wi={});var e,t,i,s,r=this.scrollElement(),n=this.scrollY(),o=r?Math.max(0,r.scrollHeight-r.clientHeight):0,a=n+((null==r?void 0:r.clientHeight)||0),l=(null==r?void 0:r.scrollHeight)||0;this.Wi.lastScrollY=Math.ceil(n),this.Wi.maxScrollY=Math.max(n,null!=(e=this.Wi.maxScrollY)?e:0),this.Wi.maxScrollHeight=Math.max(o,null!=(t=this.Wi.maxScrollHeight)?t:0),this.Wi.lastContentY=a,this.Wi.maxContentY=Math.max(a,null!=(i=this.Wi.maxContentY)?i:0),this.Wi.maxContentHeight=Math.max(l,null!=(s=this.Wi.maxContentHeight)?s:0)},this._instance=e}get Gi(){return this._instance.config.scroll_root_selector}getContext(){return this.Wi}resetContext(){var e=this.Wi;return setTimeout(this.Yi,0),e}startMeasuringScrollPosition(){ih(t,"scroll",this.Yi,{capture:!0}),ih(t,"scrollend",this.Yi,{capture:!0}),ih(t,"resize",this.Yi)}scrollElement(){if(!this.Gi)return null==t?void 0:t.document.documentElement;for(var e of F(this.Gi)?this.Gi:[this.Gi]){var i=null==t?void 0:t.document.querySelector(e);
2if(i)return i}}scrollY(){if(this.Gi){var e=this.scrollElement();return e&&e.scrollTop||0}return t&&(t.scrollY||t.pageYOffset||t.document.documentElement.scrollTop)||0}scrollX(){if(this.Gi){var e=this.scrollElement();return e&&e.scrollLeft||0}return t&&(t.scrollX||t.pageXOffset||t.document.documentElement.scrollLeft)||0}}var sX=e=>i2(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties);class sZ{constructor(e,t,i,s){this.Xi=e=>{var t=this.Ji();if(!t||t.sessionId!==e){var i={sessionId:e,props:this.Ki(this._instance)};this.Qi.register({[tB]:i})}},this._instance=e,this.tr=t,this.Qi=i,this.Ki=s||sX,this.tr.onSessionId(this.Xi)}Ji(){return this.Qi.props[tB]}getSetOnceProps(){var e,t=null==(e=this.Ji())?void 0:e.props;return t?"r"in t?i3(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 is(iu(this.getSetOnceProps()),(t,i)=>{"$current_url"===i&&(i="url"),e["$session_entry_"+k(i)]=t}),e}}class s0{constructor(){this.er={}}on(e,t){return this.er[e]||(this.er[e]=[]),this.er[e].push(t),()=>{this.er[e]=this.er[e].filter(e=>e!==t)}}emit(e,t){for(var i of this.er[e]||[])i(t);for(var s of this.er["*"]||[])s(e,t)}}var s1=td("[SessionId]");class s2{on(e,t){return this.ir.on(e,t)}constructor(e,t,i){if(this.rr=[],this.nr=void 0,this.ir=new s0,this.sr=(e,t)=>!(!N(e)||!N(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===t2)throw Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Rt=e.config,this.Qi=e.persistence,this.ar=void 0,this.lr=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.ur=t||iy,this.hr=i||iy;var s,r=this.Rt.persistence_name||this.Rt.token;if(this._sessionTimeoutMs=1e3*G(this.Rt.session_idle_timeout_seconds||1800,60,36e3,s1.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.cr(),this.dr="ph_"+r+"_window_id",this.vr="ph_"+r+"_primary_window_exists",this.pr()){var n=iT.Kt(this.dr),o=iT.Kt(this.vr);n&&!o?this.ar=n:iT.ti(this.dr),iT.Qt(this.vr,!0)}if(null!=(s=this.Rt.bootstrap)&&s.sessionID)try{var a=(e=>{var t=this.Rt.bootstrap.sessionID.replace(/-/g,"");if(32!==t.length)throw Error("Not a valid UUID");if("7"!==t[12])throw Error("Not a UUIDv7");return parseInt(t.substring(0,12),16)})();this.gr(this.Rt.bootstrap.sessionID,(new Date).getTime(),a)}catch(e){s1.error("Invalid sessionID in bootstrap",e)}this.mr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return C(this.rr)&&(this.rr=[]),this.rr.push(e),this.lr&&e(this.lr,this.ar),()=>{this.rr=this.rr.filter(t=>t!==e)}}pr(){return"memory"!==this.Rt.persistence&&!this.Qi.mi&&iT.Gt()}yr(e){e!==this.ar&&(this.ar=e,this.pr()&&iT.Qt(this.dr,e))}br(){return this.ar?this.ar:this.pr()?iT.Kt(this.dr):null}gr(e,t,i){e===this.lr&&t===this._sessionActivityTimestamp&&i===this._sessionStartTimestamp||(this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this.lr=e,this.Qi.register({[t$]:[t,e,i]}))}wr(){var e=this.Qi.props[t$];return F(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.gr(null,null,null)}destroy(){clearTimeout(this._r),this._r=void 0,this.nr&&t&&(t.removeEventListener(t4,this.nr,{capture:!1}),this.nr=void 0),this.rr=[]}mr(){this.nr=()=>{this.pr()&&iT.ti(this.vr)},ih(t,t4,this.nr,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),this.Rt.cookieless_mode===t2)throw Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||(new Date).getTime(),[s,r,n]=this.wr(),o=this.br(),a=N(n)&&Math.abs(i-n)>864e5,l=!1,u=!r,c=!u&&!e&&this.sr(i,s);u||c||a?(r=this.ur(),o=this.hr(),s1.info("new session ID generated",{sessionId:r,windowId:o,changeReason:{noSessionId:u,activityTimeout:c,sessionPastMaximumLength:a}}),n=i,l=!0):o||(o=this.hr(),l=!0);var h=N(s)&&e&&!a?s:i,d=N(n)?n:(new Date).getTime();return this.yr(o),this.gr(r,h,d),e||this.cr(),l&&this.rr.forEach(e
2=>e(r,o,l?{noSessionId:u,activityTimeout:c,sessionPastMaximumLength:a}:void 0)),{sessionId:r,windowId:o,sessionStartTimestamp:d,changeReason:l?{noSessionId:u,activityTimeout:c,sessionPastMaximumLength:a}:void 0,lastActivityTimestamp:s}}cr(){clearTimeout(this._r),this._r=setTimeout(()=>{var[e]=this.wr();if(this.sr((new Date).getTime(),e)){var t=this.lr;this.resetSessionId(),this.ir.emit("forcedIdleReset",{idleSessionId:t})}},1.1*this.sessionTimeoutMs)}}var s3=function(e,t){if(!e)return!1;var i=e.userAgent;if(i&&w(i,t))return!0;try{var s=null==e?void 0:e.userAgentData;if(null!=s&&s.brands&&s.brands.some(e=>w(null==e?void 0:e.brand,t)))return!0}catch(e){}return!!e.webdriver},s5=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 s8(e,t,i){return sz({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var s6={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=>s5(t,e))),not_regex:(e,t)=>t.every(t=>e.every(e=>!s5(t,e))),icontains:(e,t)=>t.map(s4).some(t=>e.map(s4).some(e=>t.includes(e))),not_icontains:(e,t)=>t.map(s4).every(t=>e.map(s4).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))})},s4=e=>e.toLowerCase();function s7(e,t){return!e||Object.entries(e).every(e=>{var[i,s]=e,r=null==t?void 0:t[i];if(C(r)||L(r))return!1;var n=[String(r)],o=s6[s.operator];return!!o&&o(s.values,n)})}var s9="custom",re="i.posthog.com",rt=/^\/static\//;class ri{constructor(e){this.Ir={},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("."+re,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this.Ir[this.apiHost]||(this.Ir[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":s9),this.Ir[this.apiHost]}Cr(e){var t=this.instance.config.__preview_external_dependency_versioned_paths;if("string"==typeof t&&rt.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.Cr(t);if(i)return""+i+t}if(this.region===s9)return this.apiHost+t;var s=re+t;switch(e){case"assets":return"https://"+this.region+"-assets."+s;case"api":return"https://"+this.region+"."+s}}}var rs=td("[Surveys]"),rr="seenSurvey_",rn=e=>{var t;return t=""+rr+e.id,e.current_iteration&&e.current_iteration>0&&(t=""+rr+e.id+"_"+e.current_iteration),t},ro=["popover","widget","api"],ra={ignoreConditions:!1,ignoreDelay:!1,displayType:st},rl=td("[PostHog ExternalIntegrations]"),ru={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class rc{constructor(e){this._instance=e}ai(e,t){var i;null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,e=>{if(e)return rl.error("failed to load script",e);t()})}startIfEnabledOrStop(){var e,t=this,i=function(e){var i,s,n;!r||null!=(i=h.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[e]||t.ai(ru[e],()=>{var i;null==(i=h.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[e])||i.start(t._instance)}),!r&&null!=(s=h.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[e]&&(null==(n=h.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[e])||n.stop())};for(var[s,r]of Object.entries(null!=(e=this._instance.config.integrations)?e:{}))i(s)}}var rh,rd,rp={},rg=0,rv=()=>{},r_='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',rf="Surveys module not available",rm="sanitize_properties is deprecated. Use before_send instead",ry="Invalid value for property_denylist config: ",rb="posthog",rw=!sj&&-1===(null==c?void 0:c.indexOf("MSIE"))&&-1===(null==c?void 0:c.indexOf("Mozilla")),rx=e=>{var i;return _({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:function(e){var t=null==e?void 0:e.hostname;
2if(!O(t))return!1;var i=t.split(".").slice(-2).join(".");for(var s of ic)if(i===s)return!1;return!0}(null==r?void 0:r.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:rv,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:n&&O(null==n?void 0:n.search)&&-1!==n.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==t||null==(i=t.location)?void 0:i.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){th.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:t8,before_send:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:rv,__preview_eager_load_replay:!1},{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})},rE=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["store_google","save_campaign_params"],["verbose","debug"]],rk=e=>{var t={};for(var[i,s]of rE)C(e[i])||(t[s]=e[i]);var r=ir({},t,e);return F(e.property_blacklist)&&(C(e.property_denylist)?r.property_denylist=e.property_blacklist:F(e.property_denylist)?r.property_denylist=[...e.property_blacklist,...e.property_denylist]:th.error(ry+e.property_denylist)),r};class rS{constructor(){this.__forceAllowLocalhost=!1}get Sr(){return this.__forceAllowLocalhost}set Sr(e){th.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class rR{kr(e,t){if(e){var i=this.Tr.indexOf(e);-1!==i&&this.Tr.splice(i,1)}return this.Tr.push(t),null==t.initialize||t.initialize(),t}Ar(){return this.config.cookieless_mode===t2||this.config.cookieless_mode===t1&&this.consent.isRejected()}get decideEndpointWasHit(){var e,t;return null!=(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&e}get flagsEndpointWasHit(){var e,t;return null!=(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&e}constructor(){this.webPerformance=new rS,this.Er=!1,this.version=p.LIB_VERSION,this.Rr=new s0,this.Tr=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=rx(),this.SentryIntegration=ij,this.sentryIntegration=e=>{var t;return t=iN(this,e),{name:iD,processEvent:e=>t(e)}},this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Nr=!1,this.Mr=null,this.Fr=null,this.Or=null,this.scrollManager=new sK(this),this.pageViewM
2anager=new iq(this),this.rateLimiter=new ss(this),this.requestRouter=new ri(this),this.consent=new iI(this),this.externalIntegrations=new rc(this);var e,t=null!=(e=rR.__defaultExtensionClasses)?e:{};this.featureFlags=t.featureFlags&&new t.featureFlags(this),this.toolbar=t.toolbar&&new t.toolbar(this),this.surveys=t.surveys&&new t.surveys(this),this.conversations=t.conversations&&new t.conversations(this),this.logs=t.logs&&new t.logs(this),this.experiments=t.experiments&&new t.experiments(this),this.exceptions=t.exceptions&&new t.exceptions(this),this.people={set:(e,t,i)=>{var s=O(e)?{[e]:t}:e;this.setPersonProperties(s),null==i||i({})},set_once:(e,t,i)=>{var s=O(e)?{[e]:t}:e;this.setPersonProperties(void 0,s),null==i||i({})}},this.on("eventCaptured",e=>th.info('send "'+(null==e?void 0:e.event)+'"',e))}init(e,t,i){if(i&&i!==rb){var s,r=null!=(s=rp[i])?s:new rR;return r._init(e,t,i),rp[i]=r,rp[rb][i]=r,r}return this._init(e,t,i)}_init(e,i,s){if(void 0===i&&(i={}),C(e)||M(e))return th.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={},i.debug=this.Pr(i.debug),this.Lr=i,this.Dr=[],i.person_profiles?this.Fr=i.person_profiles:i.process_person&&(this.Fr=i.process_person),this.set_config(ir({},rx(i.defaults),rk(i),{name:s,token:e})),this.config.on_xhr_error&&th.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:so;var r,n,o=this.Br();this.persistence=new i6(this.config,o),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new i6(_({},this.config,{persistence:"sessionStorage"}),o);var a=_({},this.persistence.props),l=_({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.jr=new sQ(e=>this.qr(e),this.config.request_queue_config),this.Zr=new sY(this),this.__request_queue=[];var u=this.Ar();if(u||(this.sessionManager=new s2(this),this.sessionPropsManager=new sZ(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(th.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.$r(u)},0)):(th.info("Initializing extensions synchronously"),this.$r(u)),p.DEBUG=p.DEBUG||this.config.debug,p.DEBUG&&th.info("Starting in debug mode",{this:this,config:i,thisC:_({},this.config),p:a,s:l}),!this.config.identity_distinct_id||null!=(r=i.bootstrap)&&r.distinctID||(i.bootstrap=_({},i.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(n=i.bootstrap)?void 0:n.distinctID)){var c=i.bootstrap.distinctID,h=this.get_distinct_id(),d=this.persistence.get_property(tW);if(i.bootstrap.isIdentifiedID&&null!=h&&h!==c&&d===t3)this.identify(c);else if(i.bootstrap.isIdentifiedID&&null!=h&&h!==c&&d===t5)th.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 g=this.config.get_device_id(iy()),v=i.bootstrap.isIdentifiedID?g:c;this.persistence.set_property(tW,i.bootstrap.isIdentifiedID?t5:t3),this.register({distinct_id:c,$device_id:v})}}if(u)this.register_once({distinct_id:tX,$device_id:null},"");else if(!this.get_distinct_id()){var f=this.config.get_device_id(iy());this.register_once({distinct_id:f,$device_id:f},""),this.persistence.set_property(tW,t3)}return ih(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),i.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 s=i=>{var s=()=>i.anonymousId()||iy();e.config.get_device_id=s,i.id()&&(e.register({distinct_id:i.id(),$device_id:s()}),e.persistence.set_property(tW,t5)),t()},r=i.user();"then"in r&&$(r.then)?r.then(s):s(r)}(e,()=>{var s;i.register((Promise&&Promise.resolve||iA.warn("This browser does not have Promise support, and can not use the segment integration"),s=(t,i)=>{if(!i)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(iA.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(iA.info("UserId set, identifying with PostHog"),e.identify(t.event.userId)
2);var s=e.calculateEventProperties(i,t.event.properties);return t.event.properties=Object.assign({},s,t.event.properties),t},{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>s(e,e.event.event),page:e=>s(e,t7),identify:e=>s(e,ie),screen:e=>s(e,"$screen")})).then(()=>{t()})})}(this,()=>this.Hr()):this.Hr(),$(this.config._onCapture)&&this.config._onCapture!==rv&&(th.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",e=>this.config._onCapture(e.event,e))),this.config.ip&&th.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}$r(e){var t,i,s,r,n,o,a,l=performance.now(),u=_({},rR.__defaultExtensionClasses,this.config.__extensionClasses),c=[];u.featureFlags&&this.Tr.push(this.featureFlags=null!=(t=this.featureFlags)?t:new u.featureFlags(this)),u.exceptions&&this.Tr.push(this.exceptions=null!=(i=this.exceptions)?i:new u.exceptions(this)),u.historyAutocapture&&this.Tr.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this.Tr.push(new u.tracingHeaders(this)),u.siteApps&&this.Tr.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!e&&this.Tr.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||c.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),u.autocapture&&this.Tr.push(this.autocapture=new u.autocapture(this)),u.surveys&&this.Tr.push(this.surveys=null!=(s=this.surveys)?s:new u.surveys(this)),u.logs&&this.Tr.push(this.logs=null!=(r=this.logs)?r:new u.logs(this)),u.conversations&&this.Tr.push(this.conversations=null!=(n=this.conversations)?n:new u.conversations(this)),u.productTours&&this.Tr.push(this.productTours=new u.productTours(this)),u.heatmaps&&this.Tr.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this.Tr.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this.Tr.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this.Tr.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,iM)),u.toolbar&&this.Tr.push(this.toolbar=null!=(o=this.toolbar)?o:new u.toolbar(this)),u.experiments&&this.Tr.push(this.experiments=null!=(a=this.experiments)?a:new u.experiments(this)),this.Tr.forEach(e=>{e.initialize&&c.push(()=>{null==e.initialize||e.initialize()})}),c.push(()=>{if(this.Vr){var e=this.Vr;this.Vr=void 0,this.ki(e)}}),this.zr(c,l)}zr(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout(()=>{this.zr(e,t)},0);var i=e.shift();if(i)try{i()}catch(e){th.error("Error initializing extension:",e)}}var s=Math.round(performance.now()-t);this.register_for_session({$sdk_debug_extensions_init_method:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",$sdk_debug_extensions_init_time_ms:s}),this.config.__preview_deferred_init_extensions&&th.info("PostHog extensions initialized ("+s+"ms)")}ki(e){var t;r&&r.body?(this.config.__preview_deferred_init_extensions&&(this.Vr=e),this.Ur=e,this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=x(e.supportedCompression,so)?so:x(e.supportedCompression,sa)?sa:void 0),null!=(t=e.analytics)&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Fr?this.Fr:t8}),this.Tr.forEach(t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e))):(th.info("document not ready yet, trying again in 500 milliseconds..."),setTimeout(()=>{this.ki(e)},500))}Hr(){try{this.config.loaded(this)}catch(e){th.critical("`loaded` function failed",e)}if(this.Yr(),this.config.internal_or_test_user_hostname&&null!=n&&n.hostname){var e=n.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.Ar())&&this.Wr()},1),this.Gr=new sn(this),this.Gr.load()}Yr(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this.jr)||e.enable())}_dom_loaded(){this.is_capturing()&&ii(this.__request_queue,e=>this.qr(e)),this.__request_queue=[],this.Yr()}_handle_unload(){var e,t,i,s;null==(e=this.surveys)||e.handlePageUnload(),this.config.request_batching?(this.Xr()&&this.capture(t9),null==(t=this.logs)||t.flushLogs("sendBeacon"),null==(i=this.jr)||i.unload(),null==(s=this.Zr)||s.unload()):this.Xr()&&this.capture(t9,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(rw?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=sU(e.url,{ip:+!!this.config.ip}),e.headers=_({},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,
2(e=>{var t,i,s,r=_({},e);r.timeout=r.timeout||6e4,r.url=sG(r.url,r.compression);var n=null!=(t=r.transport)?t:"fetch",o=sV.filter(e=>!r.disableTransport||!e.transport||!r.disableTransport.includes(e.transport)),a=null!=(i=null==(s=function(e){for(var t=0;e.length>t;t++)if(e[t].transport===n)return e[t]}(o))?void 0:s.method)?i:o[0].method;if(!a)throw Error("No available transport method");"sendBeacon"!==n&&r.data&&r.compression===so&&u&&!sH?sB(r).then(e=>{a(e)}).catch(t=>{t&&"object"==typeof t&&"NotReadableError"===("name"in t?String(t.name):"")?(sH=!0,a(_({},r,{compression:void 0,url:sG(e.url,void 0)}))):a(r)}):a(r)})(_({},e,{callback:t=>{var i,s;this.rateLimiter.checkForLimiting(t),400>t.statusCode||null==(i=(s=this.config).on_request_error)||i.call(s,t),null==e.callback||e.callback(t)}}))))}qr(e){this.Zr?this.Zr.retriableRequest(e):this._send_request(e)}_execute_array(e){rg++;try{var t,i=[],s=[],r=[];ii(e,e=>{e&&(F(t=e[0])?r.push(e):$(e)?e.call(this):F(e)&&"alias"===t?i.push(e):F(e)&&-1!==t.indexOf("capture")&&$(this[t])?r.push(e):s.push(e))});var n=function(e,t){ii(e,function(e){if(F(e[0])){var i=t;is(e,function(e){i=i[e[0]].apply(i,e.slice(1))})}else t[e[0]].apply(t,e.slice(1))})};n(i,this),n(s,this),n(r,this)}finally{rg--}}push(e){if(rg>0&&F(e)&&O(e[0])){var t=rR.prototype[e[0]];$(t)&&t.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,t,i){var s,r,n,o,a;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.jr){if(this.is_capturing())if(!C(e)&&O(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&&!O(null==t?void 0:t.$current_url)&&(th.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.Jr||th.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=iy(),p={uuid:d,event:e,properties:this.calculateEventProperties(e,t||{},h,d)};e===t7&&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 g,v=this.Kr(null==i?void 0:i.$set_once,e!==it,e===ie);if(v&&(p.$set_once=v),null!=i&&i._noTruncate||(r=this.config.properties_string_max_length,n=p,o=e=>O(e)?e.slice(0,r):e,a=new Set,p=function e(t,i){var s;return t!==Object(t)?o?o(t):t:a.has(t)?void 0:(a.add(t),F(t)?(s=[],ii(t,t=>{s.push(e(t))})):(s={},is(t,(t,i)=>{a.has(t)||(s[i]=e(t,i))})),s)}(n)),p.timestamp=h,C(null==i?void 0:i.timestamp)||(p.properties.$event_time_override_provided=!0,p.properties.$event_time_override_system_time=c),"survey dismissed"===e||e===se){var f,m,y,b=null==t?void 0:t.$survey_id,w=null==t?void 0:t.$survey_iteration;g={id:b,current_iteration:w},localStorage.getItem(rn(g))||localStorage.setItem(rn(g),"true"),p.$set=_({},p.$set,{[(f={id:b,current_iteration:w},y="$survey_"+(m=e===se?"responded":"dismissed")+"/"+f.id,f.current_iteration&&f.current_iteration>0&&(y="$survey_"+m+"/"+f.id+"/"+f.current_iteration),y)]:!0})}else e===i9&&(p.$set=_({},p.$set,{$survey_last_seen_date:(new Date).toISOString()}));if("product tour shown"===e){var x=null==t?void 0:t.$product_tour_type;x&&(p.$set=_({},p.$set,{["$product_tour_last_seen_date/"+x]:(new Date).toISOString()}))}var E=_({},p.properties.$set,p.$set);if(I(E)||this.setPersonPropertiesForFlags(E),!A(this.config.before_send)){var k=this.Qr(p);if(!k)return;p=k}this.Rr.emit("eventCaptured",p);var S={method:"POST",url:null!=(s=null==i?void 0:i._url)?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:p,compression:"best-available",batchKey:null==i?void 0:i._batchKey};return!this.config.request_batching||i&&(null==i||!i._batchKey)||null!=i&&i.send_instantly?this.qr(S):this.jr.enqueue(S),p}th.critical("This capture call is ignored due to client rate limiting.")}}else th.error("No event name provided to posthog.capture")}else th.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",t=>e(t.event,t))}calculateEventProperties(e,i,s,o,a){if(s=s||new Date,!this.persistence||!this.sessionPersistence)return i;var l,u=a?void 0:this.persistence.remove_event_timer(e),h=_({},i);if(h.token=this.config.token,h.$config_defaults=this.config.defaults,this.Ar()&&(h.$cookieless_mode=!0),"$snapshot"===e){var d=_({},this.persistence.properties(),this.sessionPersistence.properties());return h.distinct_id=d.distinct_id,(!O(h.distinct_id)&&!D(h.distinct_id)||M(h.distinct_id))&&th.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),h}var g,v=function(e,i){if(!c)return{};var s,r,o,a,l,u,h,d,g,v,_,f=e?[...iG,...i||[]]:[],[m,y]=function(e){for(var t=0;ez.length>t;t++){var[i,s]=ez[t],r=i.exec(e),n=r&&($(s)?s(r,e):s);if(n)return n}return["",""]}(c);return ir(iu({$os:m,$os_version:y,$browser:eq(c,navigator.vendor),$device:eW(c),$device_type:(u={userAgentDataPlatform:null==(s=navigator)||null==(s=s.userAgentData)?void 0:s.platform,maxTouchPoints:null==(r=navigator)?void 0:r.maxTouchPoints,screenWidth:null==t||null==(o=t.screen)?void 0:o.width,screenHeight:null==t||null==(a=t.screen)?void 0:a.height,devicePixelRatio:null==t?void 0:t.devicePixelRatio},(_=eW(c))===et||_===ee||"Kobo"===_||"Kindle Fire"===_||_===eI?Z:_===eb||_===ex||_===ew||_===eF?"Console":_===es?"Wearable":_?K:"Android"===(null==u?void 0:u.userAgentDataPlatform)&&(null!=(h=null==u?void 0:u.maxTouchPoints)?h:0)>0?600>Math.min(null!=(d=null==u?void 0:u.screenWidth)?d:0,null!=(g=null==u?void 0:u.screenHeight)?g:0)/(null!=(v=null==u?void 0:u.devicePixelRatio)?v:1)?K:Z:"Desktop"),$timezone:i5(),$timezone_offset:function(){try{return(new Date).getTimezoneOffset()}catch(e){return}}()}),{$current_url:iz(null==n?void 0:n.href,f,iQ),$host:null==n?void 0:n.host,$pathname:null==n?void 0:n.pathname,$raw_user_agent:c.length>1e3?c.substring(0,997)+"...":c,$browser_version:eU(c,navigator.vendor),$browser_language:iZ(),$browser_language_prefix:"string"==typeof(l=iZ())?l.split("-")[0]:void 0,$screen_height:null==t?void 0:t.screen.height,$screen_width:null==t?void 0:t.screen.width,$viewport_height:null==t?void 0:t.innerHe
2ight,$viewport_width:null==t?void 0:t.innerWidth,$lib:p.LIB_NAME,$lib_version:p.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:f,windowId:m}=this.sessionManager.checkAndGetSessionAndWindowId(a,s.getTime());h.$session_id=f,h.$window_id=m}this.sessionPropsManager&&ir(h,this.sessionPropsManager.getSessionProps());try{this.sessionRecording&&ir(h,this.sessionRecording.sdkDebugProperties),h.$sdk_debug_retry_queue_size=null==(l=this.Zr)?void 0:l.length}catch(e){h.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===s9&&(h.$lib_custom_api_host=this.config.api_host),g=e!==t7||a?e!==t9||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(s):this.pageViewManager.doPageView(s,o),h=ir(h,g),e===t7&&r&&(h.title=r.title),!C(u)){var y=s.getTime()-u;h.$duration=parseFloat((y/1e3).toFixed(3))}c&&this.config.opt_out_useragent_filter&&(h.$browser_type=this._is_bot()?"bot":"browser"),(h=ir({},v,this.persistence.properties(),this.sessionPersistence.properties(),h)).$is_identified=this._isIdentified(),F(this.config.property_denylist)?is(this.config.property_denylist,function(e){delete h[e]}):th.error(ry+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var b=this.config.sanitize_properties;b&&(th.error(rm),h=b(h,e));var w=this.tn();return h.$process_person_profile=w,w&&!a&&this.en("_calculate_event_properties"),h}Kr(e,t,i){if(void 0===t&&(t=!0),void 0===i&&(i=!1),!this.persistence||!this.tn()||this.Er&&!i)return e;var s,r=ir({},this.persistence.get_initial_props(),(null==(s=this.sessionPropsManager)?void 0:s.getSetOnceProps())||{},e||{}),n=this.config.sanitize_properties;return n&&(th.error(rm),r=n(r,"$set_once")),t&&(this.Er=!0),I(r)?void 0:r}register(e,t){var i;null==(i=this.persistence)||i.register(e,t)}register_once(e,t,i){var s;null==(s=this.persistence)||s.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)}rn(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 s;null==(s=this.featureFlags)||s.updateFlags(e,t,i)}updateEarlyAccessFeatureEnrollment(e,t,i){var s;null==(s=this.featureFlags)||s.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t,i){var s;return void 0===t&&(t=!1),null==(s=this.featureFlags)?void 0:s.getEarlyAccessFeatures(e,t,i)}on(e,t){return this.Rr.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:rf}),()=>{})}onSessionId(e){var t,i;return null!=(t=null==(i=this.sessionManager)?void 0:i.onSessionId(e))?t:()=>{}}getSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:rf})}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:rf})}renderSurvey(e,t){var i;null==(i=this.surveys)||i.renderSurvey(e,t)}displaySurvey(e,t){var i;void 0===t&&(t=ra),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))?t:{visible:!1,disabledReason:rf}}canRenderSurveyAsync(e,t){var i,s;return void 0===t&&(t=!1),null!=(i=null==(s=this.surveys)?void 0:s.canRenderSurveyAsync(e,t))?i:Promise.resolve({visible:!1,disabledReason:rf})}nn(e){return!e||M(e)?(th.critical("Unique user id has not been set in posthog.identify"),!1):e===tX?(th.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())||(th.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and n
2ot a hardcoded string.'),!1)}identify(e,t,i){if(!this.__loaded||!this.persistence)return th.uninitializedWarning("posthog.identify");if(D(e)&&(e=e.toString(),th.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.nn(e)&&this.en("posthog.identify")){var s=this.get_distinct_id();this.register({$user_id:e}),this.get_property(t_)||this.register_once({$had_persisted_distinct_id:!0,$device_id:s},""),e!==s&&e!==this.get_property(tf)&&(this.unregister(tf),this.register({distinct_id:e}));var r,n=(this.persistence.get_property(tW)||t3)===t3;e!==s&&n?(this.persistence.set_property(tW,t5),this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!1),this.capture(ie,{distinct_id:e,$anon_distinct_id:s},{$set:t||{},$set_once:i||{}}),this.Or=s8(e,t,i),null==(r=this.featureFlags)||r.setAnonymousDistinctId(s)):(t||i)&&this.setPersonProperties(t,i),e!==s&&(this.reloadFeatureFlags(),this.unregister(tq))}}setPersonProperties(e,t){if((e||t)&&this.en("posthog.setPersonProperties")){var i=s8(this.get_distinct_id(),e,t);this.Or!==i?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Or=i):th.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,i){if(e&&t){var s=this.getGroups(),r=s[e]!==t;if(r&&this.resetGroupPropertiesForFlags(e),this.register({$groups:_({},s,{[e]:t})}),r||i){var n={$group_type:e,$group_key:t};i&&(n.$group_set=i),this.capture(it,n)}i&&this.setGroupPropertiesForFlags({[e]:i}),r&&!i&&this.reloadFeatureFlags()}else th.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.en("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;null==(t=this.featureFlags)||t.resetGroupPropertiesForFlags(e)}reset(e){if(th.info("reset"),!this.__loaded)return th.uninitializedWarning("posthog.reset");var t,i,s,r,n,o,a,l,u=this.get_property(t_);if(this.consent.reset(),null==(t=this.persistence)||t.clear(),null==(i=this.sessionPersistence)||i.clear(),null==(s=this.surveys)||s.reset(),null==(r=this.Gr)||r.stop(),null==(n=this.featureFlags)||n.reset(),null==(o=this.conversations)||o.reset(),null==(a=this.persistence)||a.set_property(tW,t3),null==(l=this.sessionManager)||l.resetSessionId(),this.Or=null,this.config.cookieless_mode===t2)this.register_once({distinct_id:tX,$device_id:null},"");else{var c=this.config.get_device_id(iy());this.register_once({distinct_id:c,$device_id:e?c:u},"")}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.sn()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(e=this.conversations)||e.an()}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)?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),s=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(null!=e&&e.withTimestamp&&i){var r,n=null!=(r=e.timestampLookBack)?r:10;if(!i)return s;s+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return s}
2alias(e,t){return e===this.get_property(tv)?(th.critical("Attempting to create alias for existing People user - aborting."),-2):this.en("posthog.alias")?(C(t)&&(t=this.get_distinct_id()),e!==t?(this.rn(tf,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(th.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=_({},this.config);if(T(e)){ir(this.config,rk(e));var i,s,r,n,o,a,l,u,c,h,d=this.Br();null==(i=this.persistence)||i.update_config(this.config,t,d),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new i6(_({},this.config,{persistence:"sessionStorage"}),d);var g=this.Pr(this.config.debug);j(g)&&(this.config.debug=g),j(this.config.debug)&&(this.config.debug?(p.DEBUG=!0,iS.Gt()&&iS.Qt("ph_debug",!0),th.info("set_config",{config:e,oldConfig:t,newConfig:_({},this.config)})):(p.DEBUG=!1,iS.Gt()&&iS.ti("ph_debug"))),null==(s=this.exceptionObserver)||s.onConfigChange(),null==(r=this.exceptions)||r.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.ln(),null==(h=this.externalIntegrations)||h.startIfEnabledOrStop()}}_overrideSDKInfo(e,t){p.LIB_NAME=e,p.LIB_VERSION=t}startSessionRecording(e){var t,i,s,r,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==(s=this.sessionRecording)||s.overrideLinkedFlag()),a.url_trigger&&(null==(r=this.sessionRecording)||r.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=Error("PostHog syntheticException"),s=this.exceptions.buildProperties(e,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(_({},s,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 e,t;return null!=(e=null==(t=this.logs)?void 0:t.logger)?e:rR.un}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))&&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)?e:rb;return t!==rb&&(t=rb+"."+t),t}_isIdentified(){var e,t;return(null==(e=this.persistence)?void 0:e.get_property(tW))===t5||(null==(t=this.sessionPersistence)?void 0:t.get_property(tW))===t5}tn(){var e,t;return!("never"===this.config.person_profiles||this.config.person_profiles===t8&&!this._isIdentified()&&I(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[tf])&&(null==(t=this.persistence)||null==(t=t.props)||!t[tY]))}Xr(){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.tn()||this.en("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.en("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}en(e){return"never"===this.config.person_profiles?(th.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.rn(tY,!0),!0)}Br(){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!==t1)}ln(){var e,t,i,s,r=this.Br();return(null==(e=this.persistence)?void 0:e.mi)!==r&&(null==(i=this.persistence)||i.set_disabled(r)),(null==(t=this.sessionPersistence)?void 0:t.mi)!==r&&(null==(s=this.sessionPersistence)||s.set_disabled(r)),r}opt_in_capturing(e){var t;if(this.config.cookieless_mode!==t2){if(this.Ar()){this.reset(!0),null==(r=this.sessionManager)||r.destroy(),null==(n=this.pageViewM
2anager)||n.destroy(),this.sessionManager=new s2(this),this.pageViewManager=new iq(this),this.persistence&&(this.sessionPropsManager=new sZ(this,this.sessionManager,this.persistence));var i,s,r,n,o,a,l,u,c=null!=(o=null==(a=this.config.__extensionClasses)?void 0:a.sessionRecording)?o:null==(l=rR.__defaultExtensionClasses)?void 0:l.sessionRecording;c&&(this.sessionRecording=this.kr(this.sessionRecording,new c(this)),this.Ur&&(null==(u=this.sessionRecording)||null==u.onRemoteConfig||u.onRemoteConfig(this.Ur)))}this.consent.optInOut(!0),this.ln(),this.Yr(),null==(t=this.sessionRecording)||t.startIfEnabledOrStop(),this.config.cookieless_mode==t1&&(null==(i=this.surveys)||i.loadIfEnabled()),(C(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!=(s=null==e?void 0:e.captureEventName)?s:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Wr()}else th.warn(r_)}opt_out_capturing(){var e,t,i;this.config.cookieless_mode!==t2?(this.config.cookieless_mode===t1&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.ln(),this.config.cookieless_mode===t1&&(this.register({distinct_id:tX,$device_id:null}),null==(e=this.sessionManager)||e.destroy(),null==(t=this.pageViewManager)||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,null==(i=this.sessionRecording)||i.stopRecording(),this.sessionRecording=void 0,this.Wr())):th.warn(r_)}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===t2||(this.config.cookieless_mode===t1?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.ln()}_is_bot(){return s?s3(s,this.config.custom_blocked_useragents):void 0}Wr(){r&&("visible"===r.visibilityState?this.Nr||(this.Nr=!0,this.capture(t7,{title:r.title},{send_instantly:!0}),this.Mr&&(r.removeEventListener(t6,this.Mr),this.Mr=null)):this.Mr||(this.Mr=this.Wr.bind(this),ih(r,t6,this.Mr)))}debug(e){!1===e?(null==t||t.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==t||t.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}))}Ai(){var e,t,i,s,r=this.Lr||{};return"advanced_disable_flags"in r?!!r.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(th.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):(t="advanced_disable_decide",i=(e="advanced_disable_flags")in r&&!A(r[e]),s=t in r&&!A(r[t]),i?r[e]:!!s&&(th&&th.warn("Config field '"+t+"' is deprecated. Please use '"+e+"' instead. The old field will be removed in a future major version."),r[t]))}Qr(e){if(A(this.config.before_send))return e;var t=F(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var s of t){if(A(i=s(i))){var r="Event '"+e.event+"' was rejected in beforeSend function";return q(e.event)?th.warn(r+". This can cause unexpected behavior."):th.info(r),null}i.properties&&!I(i.properties)||th.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.hi)?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)})}Pr(e){var t=j(e)&&!e,i=iS.Gt()&&"true"===iS.Jt("ph_debug");return!t&&(!!i||e)}}function rP(e){return e instanceof Element&&(e.id===tK||!(null==e.closest||!e.closest(".toolbar-global-fade-container")))}function rF(e){return!!e&&1===e.nodeType}function r$(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}
2function rT(e){return!!e&&3===e.nodeType}function rI(e){return!!e&&11===e.nodeType}function rC(e){return e?E(e).split(/\s+/):[]}function rO(e){var i=null==t?void 0:t.location.href;return!!(i&&e&&e.some(e=>i.match(e)))}function rM(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 rC(t)}function rL(e){return A(e)?null:E(e).split(/(\s+)/).filter(e=>rZ(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function rA(e){var t="";return rB(e)&&!rG(e)&&e.childNodes&&e.childNodes.length&&is(e.childNodes,function(e){var i;rT(e)&&e.textContent&&(t+=null!=(i=rL(e.textContent))?i:"")}),E(t)}function rD(e){var t;return C(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}rR.__defaultExtensionClasses={},rR.un={trace:rd=()=>{},debug:rd,info:rd,warn:rd,error:rd,fatal:rd},function(e,t){for(var i=0;t.length>i;i++)e.prototype[t[i]]=il(e.prototype[t[i]])}(rR,["identify"]);var rN=["a","button","form","input","select","textarea","label"];function rj(e,t){if(C(t))return!0;var i,s=function(e){if(t.some(t=>e.matches(t)))return{v:!0}};for(var r of e)if(i=s(r))return i.v;return!1}function rq(e){var t=e.parentNode;return!(!t||!rF(t))&&t}var rH=["next","previous","prev",">","<"],rU=[".ph-no-rageclick",".ph-no-capture"],rz=e=>!e||r$(e,"html")||!rF(e),rW=(e,i)=>{if(!t||rz(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var s=!1,r=[e],n=e;n.parentNode&&!r$(n,"body");)if(rI(n.parentNode))r.push(n.parentNode.host),n=n.parentNode.host;else{var o=rq(n);if(!o)break;if(i||rN.indexOf(o.tagName.toLowerCase())>-1)s=!0;else{var a=t.getComputedStyle(o);a&&"pointer"===a.getPropertyValue("cursor")&&(s=!0)}r.push(o),n=o}return{parentIsUsefulElement:s,targetElementList:r}};function rB(e){for(var t=e;t.parentNode&&!r$(t,"body");t=t.parentNode){var i=rM(t);if(x(i,"ph-sensitive")||x(i,"ph-no-capture"))return!1}if(x(rM(e),"ph-include"))return!0;var s=e.type||"";if(O(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}var r=e.name||e.id||"";return!O(r)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(r.replace(/[^a-zA-Z0-9]/g,""))}function rG(e){return!!(r$(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||r$(e,"select")||r$(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var rV="(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})",rQ=RegExp("^(?:"+rV+")$"),rJ=new RegExp(rV),rY="\\d{3}-?\\d{2}-?\\d{4}",rK=RegExp("^("+rY+")$"),rX=RegExp("("+rY+")");function rZ(e,t){return void 0===t&&(t=!0),!(A(e)||O(e)&&(e=E(e),(t?rQ:rJ).test((e||"").replace(/[- ]/g,""))||(t?rK:rX).test(e)))&&!0}function r0(e){var t=rA(e);return rZ(t=(t+" "+function e(t){var i="";return t&&t.childNodes&&t.childNodes.length&&is(t.childNodes,function(t){var s;if(t&&"span"===(null==(s=t.tagName)?void 0:s.toLowerCase()))try{var r=rA(t);i=(i+" "+r).trim(),t.childNodes&&t.childNodes.length&&(i=(i+" "+e(t)).trim())}catch(e){th.error("[AutoCapture]",e)}}),i}(e)).trim())?t:""}function r1(e){return e.replace(/"|\\"/g,'\\"')}class r2{constructor(e){this.disabled=!1===e;var t=T(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 s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(t-s.y)<this.thresholdPx&&this.timeoutMs>i-s.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}}var r3="$copy_autocapture",r5=td("[AutoCapture]");function r8(e,t){return t.length>e?t.slice(0,e)+"...":t}var r6=td("[ExceptionAutocapture]");function r4(e,t,i){try{if(!(t in e))return()=>{};var s=e[t],r=i(s);return $(r)&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=r,()=>{e[t]=s}}catch(e){return()=>{}}}var r7=td("[TracingHeaders]"),r9=td("[Web Vitals]"),ne="disabled",nt="lazy_loading",ni="awaiting_config",ns="missing_config";td("[SessionRecording]"),td("[SessionRecording]");var nr="[SessionRecording]",nn=td(nr),no=td("[Heatmaps]");function na(e){return T(e)&&"clientX"in e&&"clientY"in e&&D(e.clientX)&&D(e.clientY)}var nl=td("[Product Tours]"),nu=["$set_once","$set"],nc=td("[SiteApps]"),nh="Error while initializing PostHog app with config id ";
vendor: 1,245 bytes, line 2
2function nd(e,t,i){if(A(e))return!1;switch(i){case"exact":return e===t;case"contains":return RegExp(t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*"),"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch(e){return!1}default:return!1}}class np{constructor(e){this.hn=new s0,this.cn=(e,t)=>this.dn(e,t)&&this.vn(e,t)&&this.fn(e,t)&&this.pn(e,t),this.dn=(e,t)=>null==t||!t.event||(null==e?void 0:e.event)===(null==t?void 0:t.event),this._instance=e,this.gn=new Set,this.mn=new Set}init(){var e,t;C(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(!C(null==(t=this._instance)?void 0:t._addCaptureHook)&&(e.forEach(e=>{var t,i;null==(t=this.mn)||t.add(e),null==(i=e.steps)||i.forEach(e=>{var t;null==(t=this.gn)||t.add((null==e?void 0:e.event)||"")})}),null!=(i=this._instance)&&i.autocapture)){var s,r=new Set;e.forEach(e=>{var t;null==(t=e.steps)||t.forEach(e=>{null!=e&&e.selector&&r.add(null==e?void 0:e.selector)})}),null==(s=this._instance)||s.autocapture.setElementSelectors(r)}}on(e,t){var i;null!=t&&0!=e.length&&(this.gn.has(e)||this.gn.has(null==t?void 0:t.event))&&this.mn&&(null==(i=this.mn)?void 0:i.size)>
20&&this.mn.forEach(e=>{this.yn(t,e)&&this.hn.emit("actionCaptured",e.name)})}bn(e){this.onAction("actionCaptured",t=>e(t))}yn(e,t){if(null==(null==t?void 0:t.steps))return!1;for(var i of t.steps)if(this.cn(e,i))return!0;return!1}onAction(e,t){return this.hn.on(e,t)}vn(e,t){if(null!=t&&t.url){var i,s=null==e||null==(i=e.properties)?void 0:i.$current_url;if(!s||"string"!=typeof s||!nd(s,t.url,t.url_matching||"contains"))return!1}return!0}fn(e,t){return!!this.wn(e,t)&&!!this._n(e,t)&&!!this.In(e,t)}wn(e,t){if(null==t||!t.href)return!0;var i=this.Cn(e);if(i.length>0)return i.some(e=>nd(e.href,t.href,t.href_matching||"exact"));var s,r,n=(null==e||null==(s=e.properties)?void 0:s.$elements_chain)||"";return!!n&&nd((r=n.match(/(?::|")href="(.*?)"/))?r[1]:"",t.href,t.href_matching||"exact")}_n(e,t){if(null==t||!t.text)return!0;var i=this.Cn(e);if(i.length>0)return i.some(e=>nd(e.text,t.text,t.text_matching||"exact")||nd(e.$el_text,t.text,t.text_matching||"exact"));var s,r,n,o,a=(null==e||null==(s=e.properties)?void 0:s.$elements_chain)||"";return!!a&&(r=function(e){for(var t,i=[],s=/(?::|")text="(.*?)"/g;!A(t=s.exec(e));)i.includes(t[1])||i.push(t[1]);return i}(a),n=t.text,o=t.text_matching||"exact",r.some(e=>nd(e,n,o)))}In(e,t){if(null==t||!t.selector)return!0;var i,s,r=null==e||null==(i=e.properties)?void 0:i.$element_selectors;if(null!=r&&r.includes(t.selector))return!0;var n=(null==e||null==(s=e.properties)?void 0:s.$elements_chain)||"";if(t.selector_regex&&n)try{return new RegExp(t.selector_regex).test(n)}catch(e){}return!1}Cn(e){var t;return null==(null==e||null==(t=e.properties)?void 0:t.$elements)?[]:null==e?void 0:e.properties.$elements}pn(e,t){return null==t||!t.properties||0===t.properties.length||s7(t.properties.reduce((e,t)=>{var i=F(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)}}class ng{constructor(e){this._instance=e,this.Sn=new Map,this.xn=new Map,this.kn=new Map}Tn(e,t){return!!e&&s7(e.propertyFilters,null==t?void 0:t.properties)}An(e,t){var i=new Map;return e.forEach(e=>{var s;null==(s=e.conditions)||null==(s=s[t])||null==(s=s.values)||s.forEach(t=>{if(null!=t&&t.name){var s=i.get(t.name)||[];s.push(e.id),i.set(t.name,s)}})}),i}En(e,t,i){var s=(i===i4?this.Sn:this.xn).get(e),r=[];return this.Rn(e=>{r=e.filter(e=>null==s?void 0:s.includes(e.id))}),r.filter(s=>{var r,n=null==(r=s.conditions)||null==(r=r[i])||null==(r=r.values)?void 0:r.find(t=>t.name===e);return this.Tn(n,t)})}register(e){var t;C(null==(t=this._instance)?void 0:t._addCaptureHook)||(this.Nn(e),this.Mn(e))}Mn(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.Fn&&(this.Fn=new np(this._instance),this.Fn.init(),this.Fn.bn(e=>{this.onAction(e)})),t.forEach(e=>{var t,i,s,r,n;e.conditions&&null!=(t=e.conditions)&&t.actions&&null!=(i=e.conditions)&&null!=(i=i.actions)&&i.values&&(null==(s=e.conditions)||null==(s=s.actions)||null==(s=s.values)?void 0:s.length)>0&&(null==(r=this.Fn)||r.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.kn.get(t.name);i&&i.push(e.id),this.kn.set(t.name,i||[e.id])}}))}))}Nn(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}),s=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===s.length||(null==(t=this._instance)||t._addCaptureHook((e,t)=>{this.onEvent(e,t)}),this.Sn=this.An(e,i4),this.xn=this.An(e,i7))}onEvent(e,t){var i,s=this.re(),r=this.On(),n=this.Pn(),o=(null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[r])||[];if(n===e&&t&&o.length>0){s.info("event matched, removing item from activated items",{event:e,eventPayload:t,existingActivatedItems:o});var a,l,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.Ln(o))}}else{if(this.xn.has(e)){var h=this.En(e,t,i7);h.length>0&&(s.info("cancel event matched, cancelling items",{event:e,itemsToCancel:h.map(e=>e.id)}
2),h.forEach(e=>{var t=o.indexOf(e.id);0>t||o.splice(t,1),this.Dn(e.id)}),this.Ln(o))}if(this.Sn.has(e)){s.info("event name matched",{event:e,eventPayload:t,items:this.Sn.get(e)});var d=this.En(e,t,i4);this.Ln(o.concat(d.map(e=>e.id)||[]))}}}onAction(e){var t,i=this.On(),s=(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i])||[];this.kn.has(e)&&this.Ln(s.concat(this.kn.get(e)||[]))}Ln(e){var t,i=this.re(),s=this.On(),r=[...new Set(e)].filter(e=>!this.Bn(e));i.info("updating activated items",{activatedItems:r}),null==(t=this._instance)||null==(t=t.persistence)||t.register({[s]:r})}getActivatedIds(){var e,t=this.On();return(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t])||[]}getEventToItemsMap(){return this.Sn}jn(){return this.Fn}}class nv extends ng{constructor(e){super(e)}On(){return"$surveys_activated"}Pn(){return i9}Rn(e){var t;null==(t=this._instance)||t.getSurveys(e)}Dn(e){var t;null==(t=this._instance)||t.cancelPendingSurvey(e)}re(){return rs}Bn(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var n_="SDK is not enabled or survey functionality is not yet loaded",nf="Disabled. Not loading surveys.",nm=null!=t&&t.location?iW(t.location.hash,"__posthog")||iW(location.hash,"state"):null,ny="_postHogToolbarParams",nb=td("[Toolbar]"),nw=td("[FeatureFlags]"),nx=td("[FeatureFlags]",{debugEnabled:!0}),nE="\" failed. Feature flags didn't load in time.",nk="$active_feature_flags",nS="$override_feature_flags",nR="$feature_flag_request_id",nP=e=>{for(var t={},i=0;e.length>i;i++)t[e[i]]=!0;return t},nF=e=>{var t={};for(var[i,s]of io(e||{}))s&&(t[i]=s);return t},n$=td("[Error tracking]"),nT="Refusing to render web experiment since the viewer is a likely bot",nI={icontains:(e,i)=>!!t&&i.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,i)=>!!t&&-1===i.href.toLowerCase().indexOf(e.toLowerCase()),regex:(e,i)=>!!t&&s5(i.href,e),not_regex:(e,i)=>!!t&&!s5(i.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class nC{get Rt(){return this._instance.config}constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(e){void 0===e&&(e=!1),t.getWebExperiments(e=>{nC.qn("retrieved web experiments from the server"),t.Zn=new Map,e.forEach(e=>{if(e.feature_flag_key){t.Zn&&(nC.qn("setting flag key ",e.feature_flag_key," to web experiment ",e),null==(i=t.Zn)||i.set(e.feature_flag_key,e));var i,s=t._instance.getFeatureFlag(e.feature_flag_key);O(s)&&e.variants[s]&&t.$n(e.name,s,e.variants[s].transforms)}else if(e.variants)for(var r in e.variants){var n=e.variants[r];nC.Hn(n)&&t.$n(e.name,r,n.transforms)}})},e)},this._instance=e,this._instance.onFeatureFlags(e=>{this.onFeatureFlags(e)})}initialize(){}onFeatureFlags(e){if(this._is_bot())nC.qn(nT);else if(!this.Rt.disable_web_experiments){if(A(this.Zn))return this.Zn=new Map,this.loadIfEnabled(),void this.previewWebExperiment();nC.qn("applying feature flags",e),e.forEach(e=>{var t;if(this.Zn&&null!=(t=this.Zn)&&t.has(e)){var i,s=this._instance.getFeatureFlag(e),r=null==(i=this.Zn)?void 0:i.get(e);s&&null!=r&&r.variants[s]&&this.$n(r.name,s,r.variants[s].transforms)}})}}previewWebExperiment(){var e=nC.getWindowLocation();if(null!=e&&e.search){var t=iU(null==e?void 0:e.search,"__experiment_id"),i=iU(null==e?void 0:e.search,"__experiment_variant");t&&i&&(nC.qn("previewing web experiments "+t+" && "+i),this.getWebExperiments(e=>{this.Vn(parseInt(t),i,e)},!1,!0))}}loadIfEnabled(){this.Rt.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this.Rt.disable_web_experiments&&!i)return e([]);var s=this._instance.get_property("$web_experiments");if(s&&!t)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Rt.token),method:"GET",callback:t=>e(200===t.statusCode&&t.json&&t.json.experiments||[])})}Vn(e,t,i){var s=i.filter(t=>t.id===e);s&&s.length>0&&(nC.qn("Previewing web experiment ["+s[0].name+"] with variant ["+t+"]"),this.$n(s[0].name,t,s[0].variants[t].transforms))}static Hn(e){return!A(e.conditions)&&nC.zn(e)&&nC.Un(e)}static zn(e){if(A(e.conditions)||A(null==(t=e.conditions)?void 0:t.url))return!0;var t,i,s,r,n=nC.getWindowLocation();return!!n&&(null==(i=e.conditions)||!i.url||nI[null!=(s=null==(r=e.conditions)?void 0:r.urlMatchType)?s:"icontains"](e.conditions.url,n))}
2static getWindowLocation(){return null==t?void 0:t.location}static Un(e){if(A(e.conditions)||A(null==(i=e.conditions)?void 0:i.utm))return!0;var t=iY();if(t.utm_source){var i,s,r,n,o,a,l,u,c,h=null==(s=e.conditions)||null==(s=s.utm)||!s.utm_campaign||(null==(r=e.conditions)||null==(r=r.utm)?void 0:r.utm_campaign)==t.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)==t.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)==t.utm_medium,g=null==(u=e.conditions)||null==(u=u.utm)||!u.utm_term||(null==(c=e.conditions)||null==(c=c.utm)?void 0:c.utm_term)==t.utm_term;return h&&p&&g&&d}return!1}static qn(e){for(var t=arguments.length,i=Array(t>1?t-1:0),s=1;t>s;s++)i[s-1]=arguments[s];th.info("[WebExperiments] "+e,i)}$n(e,t,i){this._is_bot()?nC.qn(nT):"control"!==t?i.forEach(i=>{if(i.selector){nC.qn("applying transform of variant "+t+" for experiment "+e+" ",i);var s,r=null==(s=document)?void 0:s.querySelectorAll(i.selector);null==r||r.forEach(e=>{i.html&&(e.innerHTML=i.html),i.css&&e.setAttribute("style",i.css)})}}):nC.qn("Control variants leave the page unmodified.")}_is_bot(){return s&&this._instance?s3(s,this.Rt.custom_blocked_useragents):void 0}}var nO=td("[Conversations]"),nM="Conversations not available yet.",nL={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}},nA=nL.info;function nD(e){var t=[];for(var i in e){var s=e[i];L(s)||C(s)||t.push({key:i,value:function e(t){if(j(t))return{boolValue:t};if(D(t))return Number.isInteger(t)?{intValue:t}:{doubleValue:t};if("string"==typeof t)return{stringValue:t};if(F(t))return{arrayValue:{values:t.map(t=>e(t))}};try{return{stringValue:JSON.stringify(t)}}catch(e){return{stringValue:String(t)}}}(s)})}return t}var nN={featureFlags:class{constructor(e){this.Yn=!1,this.Wn=!1,this.Gn=!1,this.Xn=!1,this.Jn=!1,this.Kn=!1,this.Qn=!1,this.ts=!1,this._instance=e,this.featureFlagEventHandlers=[]}get Rt(){return this._instance.config}get Qi(){return this._instance.persistence}es(e){return this._instance.get_property(e)}rs(){var e,t;return null!=(e=null==(t=this.Qi)?void 0:t.yi(this.Rt.feature_flag_cache_ttl_ms))&&e}ns(){return!!this.rs()&&(this.ts||this.Gn||(this.ts=!0,nw.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}ss(){var e,t=null!=(e=this.Rt.evaluation_contexts)?e:this.Rt.evaluation_environments;return!this.Rt.evaluation_environments||this.Rt.evaluation_contexts||this.Qn||(nw.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Qn=!0),null!=t&&t.length?t.filter(e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||nw.error("Invalid evaluation context found:",e,"Expected non-empty string"),t}):[]}os(){return this.ss().length>0}initialize(){var e,t,{config:i}=this._instance,s=null!=(e=null==(t=i.bootstrap)?void 0:t.featureFlags)?e:{};if(Object.keys(s).length){var r,n,o=null!=(r=null==(n=i.bootstrap)?void 0:n.featureFlagPayloads)?r:{},a=Object.keys(s).filter(e=>!!s[e]).reduce((e,t)=>(e[t]=s[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 s=null!=i&&i.merge?this.getFlagVariants():{},r=null!=i&&i.merge?this.getFlagPayloads():{},n=_({},s,e),o=_({},r,t),a={};for(var[l,u]of Object.entries(n)){var c="string"==typeof u;a[l]={key:l,enabled:!!c||!!u,variant:c?u:void 0,reason:void 0,metadata:C(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.Wn}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this.es(tO),t=this.es(nS),i=this.es(tL);if(!i&&!t)return e||{};var s=ir({},e||{});for(var r of[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])]){var n,o,a=s[r],l=null==t?void 0:t[r],u=C(l)?null!=(n=null==a?void 0:a.enabled)&&n:!!l,c=C(l)?a.variant:"string"==typeof l?l:void 0,h=null==i?void 0:i[r],d=_({},a,{enabled:u,variant:u?null!=c?c:null==a?void 0:a.variant:void 0});u!==(null==a?void 0:a.enabled)&&(d.original_enabled=null==a?void 0:a.enabled),c!==(null==a?void 0:a.variant)&&(
2d.original_variant=null==a?void 0:a.variant),h&&(d.metadata=_({},null==a?void 0:a.metadata,{payload:h,original_payload:null==a||null==(o=a.metadata)?void 0:o.payload})),s[r]=d}return this.Yn||(nw.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:s}),this.Yn=!0),s}getFlagVariants(){var e=this.es(tI),t=this.es(nS);if(!t)return e||{};for(var i=ir({},e),s=Object.keys(t),r=0;s.length>r;r++)i[s[r]]=t[s[r]];return this.Yn||(nw.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this.Yn=!0),i}getFlagPayloads(){var e=this.es(tM),t=this.es(tL);if(!t)return e||{};for(var i=ir({},e||{}),s=Object.keys(t),r=0;s.length>r;r++)i[s[r]]=t[s[r]];return this.Yn||(nw.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this.Yn=!0),i}reloadFeatureFlags(){this.Xn||this.Rt.advanced_disable_feature_flags||this.ls||(this._instance.Rr.emit("featureFlagsReloading",!0),this.ls=setTimeout(()=>{this.us()},5))}hs(){clearTimeout(this.ls),this.ls=void 0}ensureFlagsLoaded(){this.Wn||this.Gn||this.ls||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.Xn=e}us(e){var t;if(this.hs(),!this._instance.Ai())if(this.Gn)this.Jn=!0;else{var i=this.Rt.token,s=this.es(t_),r={token:i,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:_({},(null==(t=this.Qi)?void 0:t.get_initial_props())||{},this.es(tA)||{}),group_properties:this.es(tD),timezone:i5()};L(s)||C(s)||(r.$device_id=s),(null!=e&&e.disableFlags||this.Rt.advanced_disable_feature_flags)&&(r.disable_flags=!0),this.os()&&(r.evaluation_contexts=this.ss());var n=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Rt.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.Gn=!0,this._instance._send_request({method:"POST",url:n,data:r,compression:this.Rt.disable_compression?void 0:sa,timeout:this.Rt.feature_flag_request_timeout_ms,callback:e=>{var t,i,s,n=!0;if(200===e.statusCode&&(this.Jn||(this.$anon_distinct_id=void 0),n=!1),this.Gn=!1,!r.disable_flags||this.Jn){this.Kn=!n;var o=[];e.error?e.error instanceof Error?o.push("AbortError"===e.error.name?"timeout":"connection_error"):o.push("unknown_error"):200!==e.statusCode&&o.push("api_error_"+e.statusCode),null!=(t=e.json)&&t.errorsWhileComputingFlags&&o.push("errors_while_computing_flags");var a,l=!(null==(i=e.json)||null==(i=i.quotaLimited)||!i.includes("feature_flags"));(l&&o.push("quota_limited"),null==(s=this.Qi)||s.register({[tU]:o}),l)?nw.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."):(r.disable_flags||this.receivedFeatureFlags(null!=(a=e.json)?a:{},n,{partialResponse:!!this.Rt.advanced_only_evaluate_survey_feature_flags}),this.Jn&&(this.Jn=!1,this.us()))}}})}}getFeatureFlag(e,t){var i;if(void 0===t&&(t={}),!t.fresh||this.Kn)if(this.Wn||this.getFlags()&&this.getFlags().length>0){if(!this.ns()){var s=this.getFeatureFlagResult(e,t);return null!=(i=null==s?void 0:s.variant)?i:null==s?void 0:s.enabled}}else nw.warn('getFeatureFlag for key "'+e+nE)}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.Kn)if(this.Wn||this.getFlags()&&this.getFlags().length>0){if(!this.ns()){var i=this.getFlagVariants(),s=e in i,r=i[e],n=this.getFlagPayloads()[e],o=String(r),a=this.es(nR)||void 0,l=this.es(tz)||void 0,u=this.es(tq)||{};if(this.Rt.advanced_feature_flags_dedup_per_session){var c,h=this._instance.get_session_id(),d=this.es(tH);h&&h!==d&&(u={},null==(c=this.Qi)||c.register({[tq]:u,[tH]:h}))}if((t.send_event||!("send_event"in t))&&(!(e in u)||!u[e].includes(o))){F(u[e])?u[e].push(o):u[e]=[o],null==(_=this.Qi)||_.register({[tq]:u});var p=this.getFeatureFlagDetails(e),g=[...null!=(f=this.es(tU))?f:[]];C(r)&&g.push("flag_missing");var v={$feature_flag:e,$feature_flag_response:r,$feature_flag_payload:n||null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(null==(m=this.Rt.bootstrap)||null==(m
2=m.featureFlags)?void 0:m[e])||null,$feature_flag_bootstrapped_payload:(null==(y=this.Rt.bootstrap)||null==(y=y.featureFlagPayloads)?void 0:y[e])||null,$used_bootstrap_value:!this.Kn};C(null==p||null==(b=p.metadata)?void 0:b.version)||(v.$feature_flag_version=p.metadata.version);var _,f,m,y,b,w,x,E,k,S,R,P=null!=(w=null==p||null==(x=p.reason)?void 0:x.description)?w:null==p||null==(E=p.reason)?void 0:E.code;P&&(v.$feature_flag_reason=P),null!=p&&null!=(k=p.metadata)&&k.id&&(v.$feature_flag_id=p.metadata.id),C(null==p?void 0:p.original_variant)&&C(null==p?void 0:p.original_enabled)||(v.$feature_flag_original_response=C(p.original_variant)?p.original_enabled:p.original_variant),null!=p&&null!=(S=p.metadata)&&S.original_payload&&(v.$feature_flag_original_payload=null==p||null==(R=p.metadata)?void 0:R.original_payload),g.length&&(v.$feature_flag_error=g.join(",")),this._instance.capture("$feature_flag_called",v)}if(s){var $=n;if(!C(n))try{$=JSON.parse(n)}catch(e){}return{key:e,enabled:!!r,variant:"string"==typeof r?r:void 0,payload:$}}}}else nw.warn('getFeatureFlagResult for key "'+e+nE)}getRemoteConfigPayload(e,t){var i=this.Rt.token,s={distinct_id:this._instance.get_distinct_id(),token:i};this.os()&&(s.evaluation_contexts=this.ss()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:s,compression:this.Rt.disable_compression?void 0:sa,timeout:this.Rt.feature_flag_request_timeout_ms,callback(i){var s,r=null==(s=i.json)?void 0:s.featureFlagPayloads;t((null==r?void 0:r[e])||void 0)}})}isFeatureEnabled(e,t){if(void 0===t&&(t={}),!t.fresh||this.Kn){if(this.Wn||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlag(e,t);return C(i)?void 0:!!i}nw.warn('isFeatureEnabled for key "'+e+nE)}}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t,i){if(this.Qi){this.Wn=!0;var s=this.getFlagVariants(),r=this.getFlagPayloads(),n=this.getFlagsWithDetails();!function(e,t,i,s,r,n){void 0===i&&(i={}),void 0===s&&(s={}),void 0===r&&(r={});var o,a=((o=e.flags)?(e.featureFlags=Object.fromEntries(Object.keys(o).map(e=>{var t;return[e,null!=(t=o[e].variant)?t:o[e].enabled]})),e.featureFlagPayloads=Object.fromEntries(Object.keys(o).filter(e=>o[e].enabled).filter(e=>{var t;return null==(t=o[e].metadata)?void 0:t.payload}).map(e=>{var t;return[e,null==(t=o[e].metadata)?void 0:t.payload]}))):nw.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e),l=a.flags,u=a.featureFlags,c=a.featureFlagPayloads;if(u){var h=e.requestId,d=e.evaluatedAt;if(F(u)){nw.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var p={};if(u)for(var g=0;u.length>g;g++)p[u[g]]=!0;t&&t.register({[nk]:u,[tI]:p})}else{var v=u,f=c,m=l;if(null!=n&&n.partialResponse)v=_({},i,v),f=_({},s,f),m=_({},r,m);else if(e.errorsWhileComputingFlags)if(l){var y=new Set(Object.keys(l).filter(e=>{var t;return!(null!=(t=l[e])&&t.failed)}));v=_({},i,Object.fromEntries(Object.entries(v).filter(e=>{var[t]=e;return y.has(t)}))),f=_({},s,Object.fromEntries(Object.entries(f||{}).filter(e=>{var[t]=e;return y.has(t)}))),m=_({},r,Object.fromEntries(Object.entries(m||{}).filter(e=>{var[t]=e;return y.has(t)})))}else v=_({},i,v),f=_({},s,f),m=_({},r,m);t&&t.register(_({[nk]:Object.keys(nF(v)),[tI]:v||{},[tM]:f||{},[tO]:m||{}},h?{[nR]:h}:{},d?{[tz]:d}:{}))}}}(e,this.Qi,s,r,n,i),t||(this.ts=!1),this.cs(t)}}override(e,t){void 0===t&&(t=!1),nw.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this.Qi)return nw.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===e)return this.Qi.unregister(nS),this.Qi.unregister(tL),this.cs(),nx.info("All overrides cleared");if(F(e)){var t,i=nP(e);return this.Qi.register({[nS]:i}),this.cs(),nx.info("Flag overrides set",{flags:e})}if(e&&"object"==typeof e&&("flags"in e||"payloads"in e)){if(this.Yn=!!(null!=(t=e.suppressWarning)&&t),"flags"in e){if(!1===e.flags)this.Qi.unregister(nS),nx.info("Flag overrides cleared");else if(e.flags){if(F(e.flags)){var s=nP(e.flags);this.Qi.register({[nS]:s})}else this.Qi.register({[nS]:e.flags});nx.info("Flag overrides set",{flags:e.flags})}}return"payloads"in e&&(!1===e.payloads?(this.Qi.unregister(tL),nx.info("Payload overrides cleared")):e.payloads&&(this.Qi.register({[tL]:e.payloads}),nx.info("Payload overrides set",{payloads:e.payloads}))),void this.cs()}if(e&&"object"==typeof e)return this.Qi.register({[nS]:e}),this.cs(),nx.info("Flag overrides set",{flags:e});nw.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.Wn){var{flags:t,flagVariants:i}=this.ds();e(t,i)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var s,r=(this.es(tC)||[]).find(t=>t.flagKey===e),n={["$feature_enrollment/"+e]:t},o={$feature_flag:e,$feature_enrollment:t,$set:n};r&&(o.$early_access_feature_name=r.name),i&&(o.$feature_enrollment_stage=i),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(n,!1);var a=_({},this.getFlagVariants(),{[e]:t});null==(s=this.Qi)||s.register({[nk]:Object.keys(nF(a)),[tI]:a}),this.cs()}getEarlyAccessFeatures(e,t,i){void 0===t&&(t=!1);var s=this.es(tC),r=i?"&"+i.map(e=>"stage="+e).join("&"):"";if(s&&!t)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Rt.token+r),method:"GET",callback:t=>{var i,s;if(t.json){var r=t.json.earlyAccessFeatures;return null==(i=this.Qi)||i.unregister(tC),null==(s=this.Qi)||s.register({[tC]:r}),e(r)}}})}ds(){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),{})}}cs(e){var{flags:t,flagVariants:i}=this.ds();
2this.featureFlagEventHandlers.forEach(s=>s(t,i,{errorsLoading:e}))}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=this.es(tA)||{},s=(null==e?void 0:e.$set)||(null!=e&&e.$set_once?{}:e),r=null==e?void 0:e.$set_once,n={};if(r)for(var o in r)({}).hasOwnProperty.call(r,o)&&(o in i||(n[o]=r[o]));this._instance.register({[tA]:_({},i,n,s)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(tA)}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=this.es(tD)||{};0!==Object.keys(i).length&&Object.keys(i).forEach(t=>{i[t]=_({},i[t],e[t]),delete e[t]}),this._instance.register({[tD]:_({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.es(tD)||{};this._instance.register({[tD]:_({},t,{[e]:{}})})}else this._instance.unregister(tD)}reset(){this.Wn=!1,this.Gn=!1,this.Xn=!1,this.Jn=!1,this.Kn=!1,this.$anon_distinct_id=void 0,this.hs(),this.Yn=!1}}},nj=_({productTours:class{get Qi(){return this._instance.persistence}constructor(e){this.So=null,this.xo=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){"productTours"in e&&(this.Qi&&this.Qi.register({[tR]:!!e.productTours}),this.loadIfEnabled())}loadIfEnabled(){var e,t;this.So||(e=this._instance).config.disable_product_tours||null==(t=e.persistence)||!t.get_property(tR)||this.ai(()=>this.ko())}ai(e){var t,i;null!=(t=h.__PosthogExtensions__)&&t.generateProductTours?e():null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"product-tours",t=>{t?nl.error("Could not load product tours script",t):e()})}ko(){var e;!this.So&&null!=(e=h.__PosthogExtensions__)&&e.generateProductTours&&(this.So=h.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(void 0===t&&(t=!1),!F(this.xo)||t){var i=this.Qi;if(i){var s=i.props[tj];if(F(s)&&!t)return this.xo=s,void e(s,{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 s=t.statusCode;if(200!==s||!t.json){var r="Product Tours API could not be loaded, status: "+s;return nl.error(r),void e([],{isLoaded:!1,error:r})}var n=F(t.json.product_tours)?t.json.product_tours:[];this.xo=n,i&&i.register({[tj]:n}),e(n,{isLoaded:!0})}})}else e(this.xo,{isLoaded:!0})}getActiveProductTours(e){A(this.So)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.So.getActiveProductTours(e)}showProductTour(e){var t;null==(t=this.So)||t.showTourById(e)}previewTour(e){this.So?this.So.previewTour(e):this.ai(()=>{var t;this.ko(),null==(t=this.So)||t.previewTour(e)})}dismissProductTour(){var e;null==(e=this.So)||e.dismissTour("user_clicked_skip")}nextStep(){var e;null==(e=this.So)||e.nextStep()}previousStep(){var e;null==(e=this.So)||e.previousStep()}clearCache(){var e;this.xo=null,null==(e=this.Qi)||e.unregister(tj)}resetTour(e){var t;null==(t=this.So)||t.resetTour(e)}resetAllTours(){var e;null==(e=this.So)||e.resetAllTours()}cancelPendingTour(e){var t;null==(t=this.So)||t.cancelPendingTour(e)}}},nN),nq=_({surveys:class{get Rt(){return this._instance.config}constructor(e){this.Oo=void 0,this._surveyManager=null,this.Po=!1,this.Lo=[],this.Do=null,this._instance=e,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this.Rt.disable_surveys){var t=e.surveys;if(A(t))return rs.warn("Flags not loaded yet. Not loading surveys.");var i=F(t);this.Oo=i?t.length>0:t,rs.info("flags response received, isSurveysEnabled: "+this.Oo),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var i=localStorage.key(t);(null!=i&&i.startsWith(rr)||null!=i&&i.startsWith("inProgressSurvey_"))&&e.push(i)}e.forEach(e=>localStorage.removeItem(e))}loadIfEnabled(){if(!this._surveyManager)if(this.Po)rs.info("Already initializing surveys, skipping...");else if(this.Rt.disable_surveys)rs.info(nf);else if(this.Rt.cookieless_mode&&this._instance.consent.isOptedOut())rs.info("Not loading surveys in cookieless mode without consent.");else{var e=null==h?void 0:h.__PosthogExtensions__;if(e){if(!C(this.Oo)||this.Rt.advanced_enable_surveys){var t=this.Oo||this.Rt.advanced_enable_surveys;this.Po=!0;try{var i=e.generateSurveys;if(i)return void this.Bo(i,t);var s=e.loadExternalDependency;if(!s)return void this.jo(t0);s(this._instance,"surveys",i=>{i||!e.generateSurveys?this.jo("Could not load surveys script",i):this.Bo(e.generateSurveys,t)})}catch(e){throw this.jo("Error initializing surveys",e),e}finally{this.Po=!1}}}else rs.error("PostHog Extensions not found.")}}Bo(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new nv(this._instance),rs.info("Surveys loaded successfully"),this.qo({isLoaded:!0})}jo(e,t){rs.error(e,t),this.qo({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Lo.push(e),this._surveyManager&&this.qo({isLoaded:!0}),()=>{this.Lo=this.Lo.filter(t=>t!==e)}}getSurveys(e,t){if(void 0===t&&(t=!1),this.Rt.disable_surveys)return rs.info(nf),e([]);var i,s=this._instance.get_property(tN);if(s&&!t)return e(s,{isLoaded:!0});"u">typeof Promise&&this.Do?this.Do.then(t=>{var{surveys:i,context:s}=t;return e(i,s)}):("u">typeof Promise&&(this.Do=new Promise(e=>{i=e})),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Rt.token),method:"GET",timeout:this.Rt.surveys_request_timeout_ms,callback:t=>{this.Do=null;var s=t.statusCode;if(200!==s||!t.json){var r="Surveys API could not be loaded, status: "+s;rs.error(r);var n={isLoaded:!1,error:r};return e([],n),void(null==i||i({surveys:[],context:n}))}var o,a,l=t.json.surveys||[],u=l.filter(e=>{var t,i;return!(!e.start_date||e.end_date)&&(!(null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)||!t.length)||!(null==(i=e.conditions)||null==(i=i.actions)||null==(i=i.values)||!i.length))});u.length>0&&(null==(a=this._surveyEventReceiver)||a.register(u)),null==(o=this._instance.persistence)||o.register({[tN]:l});var c={isLoaded:!0};e(l,c),null==i||i({surveys:l,context:c})}}))}
2qo(e){for(var t of this.Lo)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){rs.error("Error in survey callback",e)}}getActiveMatchingSurveys(e,t){if(void 0===t&&(t=!1),!A(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);rs.warn("init was not called")}Zo(e){var t=null;return this.getSurveys(i=>{var s;t=null!=(s=i.find(t=>t.id===e))?s:null}),t}$o(e){if(A(this._surveyManager))return{eligible:!1,reason:n_};var t="string"==typeof e?this.Zo(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(A(this._surveyManager))return rs.warn("init was not called"),{visible:!1,disabledReason:n_};var t=this.$o(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return A(this._surveyManager)?(rs.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:n_})):new Promise(i=>{this.getSurveys(t=>{var s,r=null!=(s=t.find(t=>t.id===e))?s:null;if(r){var n=this.$o(r);i({visible:n.eligible,disabledReason:n.reason})}else i({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,i){var s;if(A(this._surveyManager))rs.warn("init was not called");else{var n="string"==typeof e?this.Zo(e):e;if(null!=n&&n.id)if(ro.includes(n.type)){var o=null==r?void 0:r.querySelector(t);if(o)return null!=(s=n.appearance)&&s.surveyPopupDelaySeconds?(rs.info("Rendering survey "+n.id+" with delay of "+n.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout(()=>{var e,t;rs.info("Rendering survey "+n.id+" with delay of "+(null==(e=n.appearance)?void 0:e.surveyPopupDelaySeconds)+" seconds"),null==(t=this._surveyManager)||t.renderSurvey(n,o,i),rs.info("Survey "+n.id+" rendered")},1e3*n.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(n,o,i);rs.warn("Survey element not found")}else rs.warn("Surveys of type "+n.type+" cannot be rendered in the app");else rs.warn("Survey not found")}}displaySurvey(e,t){var i;if(A(this._surveyManager))rs.warn("init was not called");else{var s=this.Zo(e);if(s){var r=s;if(null!=(i=s.appearance)&&i.surveyPopupDelaySeconds&&t.ignoreDelay&&(r=_({},s,{appearance:_({},s.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==st&&t.initialResponses&&rs.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===t.ignoreConditions){var n=this.canRenderSurvey(s);if(!n.visible)return void rs.warn("Survey is not eligible to be displayed: ",n.disabledReason)}"inline"!==t.displayType?this._surveyManager.handlePopoverSurvey(r,t):this.renderSurvey(r,t.selector,t.properties)}else rs.warn("Survey not found")}}cancelPendingSurvey(e){A(this._surveyManager)?rs.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;null==(e=this._surveyManager)||e.handlePageUnload()}}},nN),nH=_({experiments:nC},nN),nU=_({},nN,{sessionRecording:class{get Rt(){return this._instance.config}get Qi(){return this._instance.persistence}get started(){var e;return!(null==(e=this.vs)||!e.isStarted)}get status(){var e,t;return this.fs===ni||this.fs===ns?this.fs:null!=(e=null==(t=this.vs)?void 0:t.status)?e:this.fs}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.fs=ne,this.ps=void 0,this._instance=e,!this._instance.sessionManager)throw nn.error("started without valid sessionManager"),Error(nr+" started without valid sessionManager. This is a bug.");if(this.Rt.cookieless_mode===t2)throw Error(nr+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get gs(){var e,i=!(null==(e=this._instance.get_property(tF))||!e.enabled),s=!this.Rt.disable_session_recording,r=this.Rt.disable_session_recording||this._instance.consent.isOptedOut();return t&&i&&s&&!r}startIfEnabledOrStop(e){var t;if(!this.gs||null==(t=this.vs)||!t.isStarted){var i=!C(Object.assign)&&!C(Array.from);this.gs&&i?(this.ys(e),nn.info("starting")):(this.fs=ne,this.stopRecording())}}ys(e){var t,i,s;this.gs&&(this.fs!==ni&&this.fs!==ns&&(this.fs=nt),null!=h&&null!=(t=h.__PosthogExtensions__)&&null!=(t=t.rrweb)&&t.record&&null!=(i=h.__PosthogExtensions__)&&i.initSessionRecording?this.bs(e):null==(s=h.__PosthogExtensions__)||null==s.loadExternalDependency||s.loadExternalDependency(this._instance,this.ws,t=>{if(t)return nn.error("could not load recorder",t);this.bs(e)}))}stopRecording(){var e,t;null==(e=this.ps)||e.call(this),this.ps=void 0,null==(t=this.vs)||t.stop()}_s(){var e,t;null==(e=this.ps)||e.call(this),this.ps=void 0,null==(t=this.vs)||t.discard()}Is(){var e;null==(e=this.Qi)||e.unregister(tT)}Cs(e,t){if(A(e))return null;var i=D(e)?e:parseFloat(e);return"number"!=typeof i||!Number.isFinite(i)||0>i||i>1?(nn.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):i}Ss(e){if(this.Qi){var t,i,s=this.Qi,r=()=>{var t,i=!1===e.sessionRecording?void 0:e.sessionRecording,r=this.Cs(null==(t=this.Rt.session_recording)?void 0:t.sampleRate,"session_recording.sampleRate"),n=this.Cs(null==i?void 0:i.sampleRate,"remote config sampleRate"),o=null!=r?r:n;A(o)&&this.Is();var a=null==i?void 0:i.minimumDurationMilliseconds;s.register({[tF]:_({cache_timestamp:Date.now(),enabled:!!i},i,{networkPayloadCapture:_({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:C(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})})};r(),null==(t=this.ps)||t.call(this),this.ps=null==(i=this._instance.sessionManager)?void 0:i.onSessionId(r)}}onRemoteConfig(e){return"sessionRecording"in e?!1===e.sessionRecording?(this.Ss(e),void this._s()):(this.Ss(e),void this.startIfEnabledOrStop()):(this.fs===ni&&(this.fs=ns,nn.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.vs)&&i.log?this.vs.log(e,t):nn.warn("log called before recorder was ready")}get ws(){var e,t,i=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.get_property(tF);return(null==i||null==(t=i.scriptConfig)?void 0:t.script)||"lazy-recorder"}xs(){var e,t=this._instance.get_property(tF);if(!t)return!1;var i=null!=(e=("object"==typeof t?t:JSON.parse(t)).cache_timestamp)?e:Date.now();return 36e5>=Date.now()-i}bs(e){var t,i;if(null==(t=h.__PosthogExtensions__)||!t.initSessionRecording)return nn.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0});if(this.vs||(this.vs=null==(i=h.__PosthogExtensions__)?void 0:i.initSessionRecording(this._instance),this.vs._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.xs()){if(this.fs===ns||this.fs===ni)return;return this.fs=ni,nn.info("persisted remote config is stale, requesting fresh config before starting"),void new sn(this._instance).load()}this.fs=nt,this.vs.start(e)}onRRwebEmit(e){var t;null==(t=this.vs)||null==t.onRRwebEmit||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.vs||null==(t=this.Qi)||t.register({$replay_override_linked_flag:!0}),null==(e=this.vs)||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.vs||null==(t=this.Qi)||t.register({$replay_override_sampling:!0}),null==(e=this.vs)||e.overrideSampling()}overrideTrigger(e){var t,i;this.vs||null==(i=this.Qi)||i.register({["url"===e?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}
2),null==(t=this.vs)||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return(null==(e=this.vs)?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var i;return!(null==(i=this.vs)||!i.tryAddCustomEvent(e,t))}}},{autocapture:class{constructor(e){this.ks=!1,this.Ts=null,this.As=!1,this.instance=e,this.rageclicks=new r2(e.config.rageclick),this.Es=null}initialize(){this.startIfEnabled()}get Rt(){var e,t,i=T(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}Rs(){if(this.isBrowserSupported()){if(t&&r){var e=e=>{e=e||(null==t?void 0:t.event);try{this.Ns(e)}catch(e){r5.error("Failed to capture event",e)}};if(ih(r,"submit",e,{capture:!0}),ih(r,"change",e,{capture:!0}),ih(r,"click",e,{capture:!0}),this.Rt.capture_copied_text){var i=e=>{this.Ns(e=e||(null==t?void 0:t.event),r3)};ih(r,"copy",i,{capture:!0}),ih(r,"cut",i,{capture:!0})}}}else r5.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.ks&&(this.Rs(),this.ks=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.As=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[ty]:!!e.autocapture_opt_out}),this.Ts=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.Es=e}getElementSelectors(e){var t,i=[];return null==(t=this.Es)||t.forEach(t=>{var s=null==r?void 0:r.querySelectorAll(t);null==s||s.forEach(s=>{e===s&&i.push(t)})}),i}get isEnabled(){var e,t,i=null==(e=this.instance.persistence)?void 0:e.props[ty];if(L(this.Ts)&&!j(i)&&!this.instance.Ai())return!1;var s=null!=(t=this.Ts)?t:!!i;return!!this.instance.config.autocapture&&!s}Ns(e,i){if(void 0===i&&(i="$autocapture"),this.isEnabled){var s,r=rD(e);rT(r)&&(r=r.parentNode||null),"$autocapture"===i&&"click"===e.type&&e instanceof MouseEvent&&this.instance.config.rageclick&&null!=(s=this.rageclicks)&&s.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime())&&function(e,i){if(!t||rz(e)||(j(i)?(s=!!i&&rU,r=void 0):(s=null!=(n=null==i?void 0:i.css_selector_ignorelist)?n:rU,r=null==i?void 0:i.content_ignorelist),!1===s))return!1;var s,r,n,{targetElementList:o}=rW(e,!1);return!function(e,t){var i;if(!1===e||C(e))return!1;if(!0===e)i=rH;else{if(!F(e))return!1;if(e.length>10)return th.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:s}=e;return i.some(e=>t.includes(e)||s.includes(e))})}(r,o.map(e=>{var t;return{safeText:rA(e).toLowerCase(),ariaLabel:(null==(t=e.getAttribute("aria-label"))?void 0:t.toLowerCase().trim())||""}}))&&!rj(o,s)}(r,this.instance.config.rageclick)&&this.Ns(e,"$rageclick");var n=i===r3;if(r&&function(e,i,s,r,n){if(void 0===s&&(s=void 0),!t||rz(e)||null!=(o=s)&&o.url_allowlist&&!rO(s.url_allowlist)||null!=(a=s)&&a.url_ignorelist&&rO(s.url_ignorelist))return!1;if(null!=(l=s)&&l.dom_event_allowlist){var o,a,l,u,c=s.dom_event_allowlist;if(c&&!c.some(e=>i.type===e))return!1}var{parentIsUsefulElement:h,targetElementList:d}=rW(e,r);if(!function(e,t){var i=null==t?void 0:t.element_allowlist;if(C(i))return!0;var s,r=function(e){if(i.some(t=>e.tagName.toLowerCase()===t))return{v:!0}};for(var n of e)if(s=r(n))return s.v;return!1}(d,s)||!rj(d,null==(u=s)?void 0:u.css_selector_allowlist))return!1;var p=t.getComputedStyle(e);if(p&&"pointer"===p.getPropertyValue("cursor")&&"click"===i.type)return!0;var g=e.tagName.toLowerCase();switch(g){case"html":return!1;case"form":return(n||["submit"]).indexOf(i.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(i.type)>=0;default:return h?(n||["click"]).indexOf(i.type)>=0:(n||["click"]).indexOf(i.type)>=0&&(rN.indexOf(g)>-1||"true"===e.getAttribute("contenteditable"))}}(r,e,this.Rt,n,n?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=function(e,i){for(var s,r,{e:n,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsC
2hainAsString:u}=i,c=[e],h=e;h.parentNode&&!r$(h,"body");)rI(h.parentNode)?(c.push(h.parentNode.host),h=h.parentNode.host):(c.push(h.parentNode),h=h.parentNode);var d,p=[],g={},v=!1,f=!1;if(is(c,e=>{var t=rB(e);"a"===e.tagName.toLowerCase()&&(v=e.getAttribute("href"),v=t&&v&&rZ(v)&&v),x(rM(e),"ph-no-capture")&&(f=!0),p.push(function(e,t,i,s){var r=e.tagName.toLowerCase(),n={tag_name:r};rN.indexOf(r)>-1&&!i&&(n.$el_text="a"===r.toLowerCase()||"button"===r.toLowerCase()?r8(1024,r0(e)):r8(1024,rA(e)));var o=rM(e);o.length>0&&(n.classes=o.filter(function(e){return""!==e})),is(e.attributes,function(i){var r;if((!rG(e)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==s||!s.includes(i.name))&&!t&&rZ(i.value)&&(!O(r=i.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){var o=i.value;"class"===i.name&&(o=rC(o).join(" ")),n["attr__"+i.name]=r8(1024,o)}});for(var a=1,l=1,u=e;u=function(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!rF(t))return t}(u);)a++,u.tagName===e.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}(e,o,a,l)),ir(g,function(e){if(!rB(e))return{};var t={};return is(e.attributes,function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){var i=e.name.replace("data-ph-capture-attribute-",""),s=e.value;i&&s&&rZ(s)&&(t[i]=s)}}),t}(e))}),f)return{props:{},explicitNoCapture:f};if(a||(p[0].$el_text="a"===e.tagName.toLowerCase()||"button"===e.tagName.toLowerCase()?r0(e):rA(e)),v){p[0].attr__href=v;var m,y,b=null==(m=iH(v))?void 0:m.host,w=null==t||null==(y=t.location)?void 0:y.host;b&&w&&b!==w&&(d=v)}return{props:ir({$event_type:n.type,$ce_version:1},u?{}:{$elements:p},{$elements_chain:p.map(e=>{var t,i,s,r={text:null==(i=e.$el_text)?void 0:i.slice(0,400),tag_name:e.tag_name,href:null==(s=e.attr__href)?void 0:s.slice(0,2048),attr_class:(t=e.attr__class)?F(t)?t:rC(t):void 0,attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return io(e).filter(e=>{var[t]=e;return 0===t.indexOf("attr__")}).forEach(e=>{var[t,i]=e;return r.attributes[t]=i}),r}).map(e=>{var t,i,s="";if(e.tag_name&&(s+=e.tag_name),e.attr_class)for(var r of(e.attr_class.sort(),e.attr_class))s+="."+r.replace(/"/g,"");var n=_({},e.text?{text:e.text}:{},{"nth-child":null!=(t=e.nth_child)?t:0,"nth-of-type":null!=(i=e.nth_of_type)?i:0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),o={};return io(n).sort((e,t)=>{var[i]=e,[s]=t;return i.localeCompare(s)}).forEach(e=>{var[t,i]=e;return o[r1(t.toString())]=r1(i.toString())}),(s+=":")+io(o).map(e=>{var[t,i]=e;return t+'="'+i+'"'}).join("")}).join(";")},null!=(s=p[0])&&s.$el_text?{$el_text:null==(r=p[0])?void 0:r.$el_text}:{},d&&"click"===n.type?{$external_click_url:d}:{},g)}}(r,{e:e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Rt.element_attribute_ignorelist,elementsChainAsString:this.As});if(a)return!1;var l=this.getElementSelectors(r);if(l&&l.length>0&&(o.$element_selectors=l),i===r3){var u,c=rL(null==t||null==(u=t.getSelection())?void 0:u.toString()),h=e.type||"clipboard";if(!c)return!1;o.$selected_content=c,o.$copy_type=h}return this.instance.capture(i,o),!0}}}isBrowserSupported(){return $(null==r?void 0:r.querySelectorAll)}},historyAutocapture:class{constructor(e){var i;this._instance=e,this.Ms=(null==t||null==(i=t.location)?void 0:i.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(th.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.Fs&&this.Fs(),this.Fs=void 0,th.info("History API monitoring stopped")}monitorHistoryChanges(){var e,i;if(t&&t.history){var s=this;null!=(e=t.history.pushState)&&e.__posthog_wrapped__||r4(t.history,"pushState",e=>function(t,i,r){e.call(this,t,i,r),s.Os("pushState")}),null!=(i=t.history.replaceState)&&i.__posthog_wrapped__||r4(t.history,"replaceState",e=>function(t,i,r){e.call(this,t,i,r),s.Os("replaceState")}),this.Ps()}}Os(e){try{var i,s=null==t||null==(i=t.location)?void 0:i.pathname;if(!s)return;s!==this.Ms&&this.isEnabled&&this._instance.capture(t7,{navigation_type:e}),this.Ms=s}catch(t){th.error("Error capturing "+e+" pageview",t)}}Ps(){if(!this.Fs){var e=()=>{this.Os("popstate")};ih(t,"popstate",e),this.Fs=()=>{t&&t.removeEventListener("popstate",e)}}}},heatmaps:class{get Rt(){return this.instance.config}constructor(e){var t;this.Ls=!1,this.ks=!1,this.Ds=null,this.instance=e,this.Ls=!(null==(t=this.instance.persistence)||!t.props[tb]),this.rageclicks=new r2(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return T(this.Rt.capture_heatmaps)&&this.Rt.capture_heatmaps.flush_interval_milliseconds&&(e=this.Rt.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return A(this.Rt.capture_heatmaps)?A(this.Rt.enable_heatmaps)?this.Ls:this.Rt.enable_heatmaps:!1!==this.Rt.capture_heatmaps}startIfEnabled(){if(this.isEnabled)this.ks||(no.info("starting..."),this.Bs(),this.Tt());else{var e;clearInterval(null!=(e=this.Ds)?e:void 0),this.js(),this.getAndClearBuffer()}}onRemoteConfig(e){if("heatmaps"in e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[tb]:t}),this.Ls=t,this.startIfEnabled()}}getAndClearBuffer(){var e=this.T;return this.T=void 0,e}qs(e){this.wt(e.originalEvent,"deadclick")}Tt(){this.Ds&&clearInterval(this.Ds),this.Ds="visible"===(null==r?void 0:r.visibilityState)?setInterval(this.$i.bind(this),this.flushIntervalMilliseconds):null}Bs(){t&&r&&(this.Zs=this.$i.bind(this),ih(t,t4,this.Zs),this.$s=e=>this.wt(e||(null==t?void 0:t.event)),ih(r,"click",this.$s,{capture:!0}),this.Hs=e=>this.Vs(e||(null==t?void 0:t.event)),ih(r,"mousemove",this.Hs,{capture:!0}),this.zs=new iL(this.instance,iO,this.qs.bind(this)),this.zs.startIfEnabledOrStop(),this.Us=this.Tt.bind(this),ih(r,t6,this.Us),this.ks=!0)}js(){var e;t&&r&&(this.Zs&&t.removeEventListener(t4,this.Zs),this.$s&&r.removeEventListener("click",this.$s,{capture:!0}),this.Hs&&r.removeEventListener("mousemove",this.Hs,{capture:!0}),this.Us&&r.removeEventListener(t6,this.Us),clearTimeout(this.Ys),null==(e=this.zs)||e.stop(),this.ks=!1)}Ws(e,i){var s=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),o=function(e,i,s){for(var r=e;r&&rF(r)&&!r$(r,"body")&&r!==s;){if(x(i,null==t?void 0:t.getComputedStyle(r).position))return!0;r=rq(r)}return!1}(rD(e),["fixed","sticky"],n);return{x:e.clientX+(o?0:r),y:e.clientY+(o?0:s),target_fixed:o,type:i}}wt(e,t){var i;if(void 0===t&&(t="click"),!rP(e.target)&&na(e)){var s=this.Ws(e,t);null!=(i=this.rageclicks)&&i.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&this.Gs(_({}
2,s,{type:"rageclick"})),this.Gs(s)}}Vs(e){!rP(e.target)&&na(e)&&(clearTimeout(this.Ys),this.Ys=setTimeout(()=>{this.Gs(this.Ws(e,"mousemove"))},500))}Gs(e){if(t){var i=t.location.href,s=this.Rt.custom_personal_data_properties,r=iz(i,this.Rt.mask_personal_data_properties?[...iG,...s||[]]:[],iQ);this.T=this.T||{},this.T[r]||(this.T[r]=[]),this.T[r].push(e)}}$i(){this.T&&!I(this.T)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:iL,webVitalsAutocapture:class{constructor(e){var t;this.Ls=!1,this.ks=!1,this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Xs=()=>{clearTimeout(this.Js),0!==this.T.metrics.length&&(this._instance.capture("$web_vitals",this.T.metrics.reduce((e,t)=>_({},e,{["$web_vitals_"+t.name+"_event"]:_({},t),["$web_vitals_"+t.name+"_value"]:t.value}),{})),this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.nt=e=>{var t,i=null==(t=this._instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0);if(C(i))r9.error("Could not read session ID. Dropping metrics!");else{this.T=this.T||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var s=this.Ks();C(s)||(A(null==e?void 0:e.name)||A(null==e?void 0:e.value)?r9.error("Invalid metric received",e):!this.Qs||this.Qs>e.value?(this.T.url!==s&&(this.Xs(),this.Js=setTimeout(this.Xs,this.flushToCaptureTimeoutMs)),C(this.T.url)&&(this.T.url=s),this.T.firstMetricTimestamp=C(this.T.firstMetricTimestamp)?Date.now():this.T.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0),this.T.metrics.push(_({},e,{$current_url:s,$session_id:i.sessionId,$window_id:i.windowId,timestamp:Date.now()})),this.T.metrics.length===this.allowedMetrics.length&&this.Xs()):r9.error("Ignoring metric with value >= "+this.Qs,e))}},this.eo=()=>{if(!this.ks){var e,t,i,s,r=h.__PosthogExtensions__;C(r)||C(r.postHogWebVitalsCallbacks)||({onLCP:e,onCLS:t,onFCP:i,onINP:s}=r.postHogWebVitalsCallbacks),e&&t&&i&&s?(this.allowedMetrics.indexOf("LCP")>-1&&e(this.nt.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&t(this.nt.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this.nt.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&s(this.nt.bind(this)),this.ks=!0):r9.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.Ls=!(null==(t=this._instance.persistence)||!t.props[tk]),this.startIfEnabled()}get io(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,i=T(this.io)?null==(e=this.io)?void 0:e.web_vitals_allowed_metrics:void 0;return A(i)?(null==(t=this._instance.persistence)?void 0:t.props[tP])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(T(this.io)?this.io.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=T(this.io)?this.io.web_vitals_attribution:void 0;return null!=e&&e}get Qs(){var e=T(this.io)&&D(this.io.__web_vitals_max_value)?this.io.__web_vitals_max_value:9e5;return e>0&&6e4>=e?9e5:e}get isEnabled(){var e=null==n?void 0:n.protocol;if("http:"!==e&&"https:"!==e)return r9.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=T(this.io)?this.io.web_vitals:j(this.io)?this.io:void 0;return j(t)?t:this.Ls}startIfEnabled(){this.isEnabled&&!this.ks&&(r9.info("enabled, starting..."),this.ai(this.eo))}onRemoteConfig(e){if("capturePerformance"in e){var t=T(e.capturePerformance)&&!!e.capturePerformance.web_vitals,i=T(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[tk]:t}),this._instance.persistence.register({[tP]:i})),this.Ls=t,this.startIfEnabled()}}ai(e){var t,i;null!=(t=h.__PosthogExtensions__)&&t.postHogWebVitalsCallbacks?e():null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",t=>{t?r9.error("failed to load script",t):e()})}Ks(){var e=t?t.location.href:void 0;if(e){var i=this._instance.config.custom_personal_data_properties;return iz(e,this._instance.config.mask_personal_data_properties?[...iG,...i||[]]:[],iQ)}r9.error("Could not determine current URL")}}},{exceptionObserver:class{constructor(e){var i,s,r;this.eo=()=>{var e;if(t&&this.isEnabled&&null!=(e=h.__PosthogExtensions__)&&e.errorWrappingFunctions){var i=h.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,s=h.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=h.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.ro&&this.Rt.capture_unhandled_errors&&(this.ro=i(this.captureException.bind(this))),!this.no&&this.Rt.capture_unhandled_rejections&&(this.no=s(this.captureException.bind(this))),!this.so&&this.Rt.capture_console_errors&&(this.so=r(this.captureException.bind(this)))}catch(e){r6.error("failed to start",e),this.oo()}}},this._instance=e,this.ao=!(null==(i=this._instance.persistence)||!i.props[tw]),this.lo=new V({refillRate:null!=(s=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)?s:1,bucketSize:null!=(r=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)?r:10,refillInterval:1e4,qt:r6}),this.Rt=this.uo(),this.startIfEnabledOrStop()}uo(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return T(e)?t=_({},t,e):(C(e)?this.ao:e)&&(t=_({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.Rt.capture_console_errors||this.Rt.capture_unhandled_errors||this.Rt.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(r6.info("enabled"),this.oo(),this.ai(this.eo)):this.oo()}ai(e){var t,i;
2null!=(t=h.__PosthogExtensions__)&&t.errorWrappingFunctions&&e(),null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",t=>{if(t)return r6.error("failed to load script",t);e()})}oo(){var e,t,i;null==(e=this.ro)||e.call(this),this.ro=void 0,null==(t=this.no)||t.call(this),this.no=void 0,null==(i=this.so)||i.call(this),this.so=void 0}onRemoteConfig(e){"autocaptureExceptions"in e&&(this.ao=!!e.autocaptureExceptions,this._instance.persistence&&this._instance.persistence.register({[tw]:this.ao}),this.Rt=this.uo(),this.startIfEnabledOrStop())}onConfigChange(){this.Rt=this.uo()}captureException(e){var t,i,s,r=null!=(t=null==e||null==(i=e.$exception_list)||null==(i=i[0])?void 0:i.type)?t:"Exception";this.lo.consumeRateLimit(r)?r6.info("Skipping exception capture because of client rate limiting.",{exception:r}):null==(s=this._instance.exceptions)||s.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,i;this.ho=[],this.co=new eG([new e3,new ts,new e8,new e5,new tt,new te,new e4,new ti],function(e){for(var t=arguments.length,i=Array(t>1?t-1:0),s=1;t>s;s++)i[s-1]=arguments[s];return function(t,s){void 0===s&&(s=0);for(var r=[],n=t.split("\n"),o=s;n.length>o;o++){var a=n[o];if(1024>=a.length){var l=e2.test(a)?a.replace(e2,"$1"):a;if(!l.match(/\S*Error: /)){for(var u of i){var c=u(l,e);if(c){r.push(c);break}}if(r.length>=50)break}}}if(!r.length)return[];var h=Array.from(r);return h.reverse(),h.slice(0,50).map(e=>_({},e,{filename:e.filename||(h[h.length-1]||{}).filename,function:e.function||"?"}))}}("web:javascript",eX,e1)),this._instance=e,this.ho=null!=(t=null==(i=this._instance.persistence)?void 0:i.get_property(tx))?t:[],this.do=tl(this.vo()),this.fo=new tu(this.do)}onConfigChange(){this.do=tl(this.vo()),this.fo.setConfig(this.do)}onRemoteConfig(e){var t,i,s;if("errorTracking"in e){var r=null!=(t=null==(i=e.errorTracking)?void 0:i.suppressionRules)?t:[],n=null==(s=e.errorTracking)?void 0:s.captureExtensionExceptions;this.ho=r,this._instance.persistence&&this._instance.persistence.register({[tx]:this.ho,[tE]:n})}}get po(){var e,t=!!this._instance.get_property(tE),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!=(e=null!=i?i:t)&&e}buildProperties(e,t){return this.co.buildFromUnknown(e,{syntheticException:null==t?void 0:t.syntheticException,mechanism:{handled:null==t?void 0:t.handled}})}addExceptionStep(e,t){if(this.do.enabled)try{if(!O(e)||0===e.trim().length)return void n$.warn("Ignoring exception step because message must be a non-empty string");var i=this.mo(t),{sanitizedProperties:s,droppedKeys:r}=function(e){if(!e)return{sanitizedProperties:{},droppedKeys:[]};var t=[];return{sanitizedProperties:Object.keys(e).reduce((i,s)=>(to.has(s)?t.push(s):i[s]=e[s],i),{}),droppedKeys:t}}(i);r.length>0&&n$.warn("Ignoring reserved exception step fields",{droppedKeys:r}),this.fo.add(_({[tr]:e,[tn]:(new Date).toISOString()},s))}catch(e){n$.error("Failed to add exception step. Ignoring breadcrumb.",e)}}sendExceptionEvent(e){try{var t=e.$exception_list;if(this.yo(t)){if(this.bo(t))return this.wo("Exception dropped: matched a suppression rule"),void n$.info("Skipping exception capture because a suppression rule matched");if(!this.po&&this._o(t))return this.wo("Exception dropped: thrown by a browser extension"),void n$.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Io(t))return this.wo("Exception dropped: thrown by the PostHog SDK"),void n$.info("Skipping exception capture because it was thrown by the PostHog SDK")}var i=this.do.enabled&&A(e.$exception_steps)?this.Co(e):e;try{var s=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",Jr:!0});return s&&this.fo.clear(),s}catch(e){return n$.error("Failed to capture exception event. Dropping this exception.",e),void this.fo.clear()}}catch(e){return void n$.error("Failed to process exception event. Ignoring this exception.",e)}}Co(e){try{var t=this.fo.getAttachable();return 0===t.length?e:_({},e,{$exception_steps:t})}catch(t){return n$.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}wo(e){this.do.enabled&&this.fo.add({[tr]:e,[tn]:(new Date).toISOString()})}mo(e){return T(e)?_({},e):{}}vo(){var e,t;return null!=(e=null==(t=this._instance.config.error_tracking)?void 0:t.exception_steps)?e:{}}bo(e){if(0===e.length)return!1;var t=e.reduce((e,t)=>
2{var{type:i,value:s}=t;return O(i)&&i.length>0&&e.$exception_types.push(i),O(s)&&s.length>0&&e.$exception_values.push(s),e},{$exception_types:[],$exception_values:[]});return this.ho.some(e=>{var i=e.values.map(e=>{var i,s=s6[e.operator],r=F(e.value)?e.value:[e.value],n=null!=(i=t[e.key])?i:[];return r.length>0&&s(r,n)});return"OR"===e.type?i.some(Boolean):i.every(Boolean)})}_o(e){return e.flatMap(e=>{var t,i;return null!=(t=null==(i=e.stacktrace)?void 0:i.frames)?t:[]}).some(e=>e.filename&&e.filename.startsWith("chrome-extension://"))}Io(e){if(e.length>0){var t,i,s,r,n=null!=(t=null==(i=e[0].stacktrace)?void 0:i.frames)?t:[],o=n[n.length-1];return null!=(s=null==o||null==(r=o.filename)?void 0:r.includes("posthog.com/static"))&&s}return!1}yo(e){return!A(e)&&F(e)}}},nj,{siteApps:class{constructor(e){this._instance=e,this.To=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Ao(e,t){if(t){var i=this.globalsForEvent(t);this.To.push(i),this.To.length>1e3&&(this.To=this.To.slice(10))}}get siteAppLoaders(){var e;return null==(e=h._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.siteApps}initialize(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.Ao.bind(this));this.Eo=()=>{e(),this.To=[],this.Eo=void 0}}}globalsForEvent(e){if(!e)throw Error("Event payload is required");var t,i,s,r,n,o,a,l={},u=this._instance.get_property("$groups")||[];for(var[c,h]of Object.entries(this._instance.get_property("$stored_group_properties")||{}))l[c]={id:u[c],type:c,properties:h};var{$set_once:d,$set:p}=e;return{event:_({},f(e,nu),{properties:_({},e.properties,p?{$set:_({},null!=(t=null==(i=e.properties)?void 0:i.$set)?t:{},p)}:{},d?{$set_once:_({},null!=(s=null==(r=e.properties)?void 0:r.$set_once)?s:{},d)}:{}),elements_chain:null!=(n=null==(o=e.properties)?void 0:o.$elements_chain)?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.To.length&&(nc.info("Processing "+this.To.length+" events for site app with id "+e.id),this.To.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.Eo)||i.call(this))},s=!1,r=r=>{t.errored=!r,t.loaded=!0,nc.info("Site app with id "+e.id+" "+(r?"loaded":"errored")),s&&i()};try{var{processEvent:n}=e.init({posthog:this._instance,callback(e){r(e)}});n&&(t.processEvent=n),s=!0}catch(t){nc.error(nh+e.id,t),r(!1)}if(s&&t.loaded)try{i()}catch(i){nc.error("Error while processing buffered events PostHog app with config id "+e.id,i),t.errored=!0}}Ro(){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){nc.error("Error while processing event "+e.event+" for site app "+i.id,t)}}}onRemoteConfig(e){var t,i,s,r=this;if(null!=(t=this.siteAppLoaders)&&t.length)return this.isEnabled?(this.Ro(),void this._instance.on("eventCaptured",e=>this.No(e))):void nc.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this.Eo)||i.call(this),null!=(s=e.siteApps)&&s.length)if(this.isEnabled){var n=function(e){var t;h["__$$ph_site_app_"+e]=r._instance,null==(t=h.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(r._instance,a,t=>{if(t)return nc.error(nh+e,t)})};for(var{id:o,url:a}of e.siteApps)n(o)}else nc.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},nq,{tracingHeaders:class{constructor(e){this.Mo=void 0,this.Fo=void 0,this.eo=()=>{var e,t;C(this.Mo)&&(null==(e=h.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)||e._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),C(this.Fo)&&(null==(t=h.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)||t._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}initialize(){this.startIfEnabledOrStop()}ai(e){var t,i;null!=(t=h.__PosthogExtensions__)&&t.tracingHeadersPatchFns&&e(),null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",t=>{if(t)return r7.error("failed to load script",t);e()})}startIfEnabledOrStop(){var e,t;this._instance.config.__add_tracing_headers?this.ai(this.eo):(null==(e=this.Mo)||e.call(this),null==(t=this.Fo)||t.call(this),this.Mo=void 0,this.Fo=void 0)}}},{toolbar:class{constructor(e){this.instance=e}Ho(e){h.ph_toolbar_state=e}Vo(){var e;return null!=(e=h.ph_toolbar_state)?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,i,s){if(void 0===e&&(e=void 0),void 0===i&&(i=void 0),void 0===s&&(s=void 0),id(this.instance.config)||!t||!r)return!1;e=null!=e?e:t.location,s=null!=s?s:t.history;try{if(!i){try{t.localStorage.setItem("test","test"),t.localStorage.removeItem("test")}catch(e){return!1}i=null==t?void 0:t.localStorage}var n,o=nm||iW(e.hash,"__posthog")||iW(e.hash,"state"),a=o?ia(()=>JSON.parse(atob(decodeURIComponent(o))))||ia(()=>JSON.parse(decodeURIComponent(o))):null;return a&&"ph_authorize"===a.action?((n=a).source="url",n&&Object.keys(n).length>0&&(a.desiredHash?e.hash=a.desiredHash:s?s.replaceState(s.state,"",e.pathname+e.search):e.hash="")):((n=JSON.parse(i.getItem(ny)||"{}")).source="localstorage",delete n.userIntent),!(!n.token||this.instance.config.token!==n.token||(this.loadToolbar(n),0))}catch(e){return!1}}zo(e){var t=h.ph_load_toolbar||h.ph_load_editor;!A(t)&&$(t)?t(e,this.instance):nb.warn("No toolbar load function found")}loadToolbar(e){var i,s=!(null==r||!r.getElementById(tK));if(!t||s)return!1;var n="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,o=_({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});return(t.localStorage.setItem(ny,JSON.stringify(_({},o,{source:void 0}))),2===this.Vo())?this.zo(o):0===this.Vo()&&(this.Ho(1),null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"toolbar",e=>{e?(nb.error("[Toolbar] Failed to load",e),this.Ho(0)):(this.Ho(2),this.zo(o))}),ih(t,"turbolinks:load",()=>{this.Ho(0),this.loadToolbar(o)})),!0}Uo(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)}}},nH,{conversations:class{constructor(e){this.Yo=void 0,this._conversationsManager=null,this.Wo=!1,this.Go=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var t=e.conversations;A(t)||(j(t)?this.Yo=t:(this.Yo=t.enabled,this.Go=t),this.loadIfEnabled())}}reset(){var e;null==(e=this._conversationsManager)||e.reset(),this._conversationsManager=null,this.Yo=void 0,this.Go=null}loadIfEnabled(){if(!(this._conversationsManager||this.Wo||this._instance.config.disable_conversations||id(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=null==h?void 0:h.__PosthogExtensions__;if(e&&!C(this.Yo)&&this.Yo)if(this.Go&&this.Go.token){this.Wo=!0;try{var t=e.initConversations;if(t)return this.Xo(t),void(this.Wo=!1);var i=e.loadExternalDependency;if(!i)return void this.Jo(t0);i(this._instance,"conversations",t=>{t||!e.initConversations?this.Jo("Could not load conversations script",t):this.Xo(e.initConversations),this.Wo=!1})}catch(e){this.Jo("Error initializing conversations",e),this.Wo=!1}}else nO.error("Conversations enabled but missing token in remote config.")}}Xo(e){if(this.Go)try{this._conversationsManager=e(this.Go,this._instance),nO.info("Conversations loaded successfully")}catch(e){this.Jo("Error completing conversations initialization",e)}else nO.error("Cannot complete initialization: remote config is null")}Jo(e,t){nO.error(e,t),this._conversationsManager=null,this.Wo=!1}show(){this._conversationsManager?this._conversationsManager.show():nO.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Yo&&!L(this._conversationsManager)}isVisible(){var e,t;return null!=(e=null==(t=this._conversationsManager)?void 0:t.isVisible())&&e}sendMessage(e,t,i){var s=this;return v(function*(){return s._conversationsManager?s._conversationsManager.sendMessage(e,t,i):(nO.warn(nM),null)})()}getMessages(e,t){var i=this;return v(function*(){return i._conversationsManager?i._conversationsManager.getMessages(e,t):(nO.warn(nM),null)})()}markAsRead(e){var t=this;return v(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(nO.warn(nM),null)})()}getTickets(e){var t=this;return v(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(nO.warn(nM),null)})()}requestRestoreLink(e){var t=this;return v(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(nO.warn(nM),null)})()}restoreFromToken(e){var t=this;return v(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(nO.warn(nM),null)})()}restoreFromUrlToken(){var e=this;return v(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(nO.warn(nM),null)})()}getCurrentTicketId(){var e,t;return null!=(e=null==(t=this._conversationsManager)?void 0:t.getCurrentTicketId())?e:null}getWidgetSessionId(){var e,t;return null!=(e=null==(t=this._conversationsManager)?void 0:t.getWidgetSessionId())?e:null}sn(){var e;null==(e=this._conversationsManager)||e.setIdentity()}an(){var e;null==(e=this._conversationsManager)||e.clearIdentity()}}},{logs:class{constructor(e){var t;this.Ko=!1,this.Qo=!1,this.qt=td("[logs]"),this.ta=[],this.ea=0,this.ia=0,this.ra=!1,this._instance=e,this._instance&&null!=(t=this._instance.config.logs)&&t.captureConsoleLogs&&(this.Ko=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t,i=null==(t=e.logs)?void 0:t.captureConsoleLogs;!A(i)&&i&&(this.Ko=!0,this.loadIfEnabled())}reset(){this.ta=[],this.Oi&&(clearTimeout(this.Oi),this.Oi=void 0),this.ea=0,this.ia=0,this.ra=!1}loadIfEnabled(){if(this.Ko&&!this.Qo){var e=null==h?void 0:h.__PosthogExtensions__;if(e){var t=e.loadExternalDependency;t?t(this._instance,"logs",t=>{var i;t||null==(i=e.logs)||!i.initializeLogs?this.qt.error("Could not load logs script",t):(e.logs.initializeLogs(this._instance),this.Qo=!0)}):this.qt.error(t0)}else this.qt.error("PostHog Extensions not found.")}}captureLog(e){var t,i,s,r,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)?t:3e3,l=null!=(s=null==(r=this._instance.config.logs)?void 0:r.maxLogsPerInterval)?s:1e3,u=Date.now();if(a>u-this.ia||(this.ia=u,this.ea=0,this.ra=!1),l>this.ea){this.ea++;var c=function(e,t){var{text:i,number:s}=nL[e.level||"info"]||nA,r=String(Date.now())+"000000",n={};t.distinctId&&(n.posthogDistinctId=t.distinctId),t.sessionId&&(n.sessionId=t.sessionId),t.currentUrl&&(n["url.full"]=t.currentUrl),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(n.feature_flags=t.activeFeatureFlags);var o=_({},n,e.attributes||{}),a={timeUnixNano:r,observedTimeUnixNano:r,severityNumber:s,severityText:i,body:{stringValue:e.body},attributes:nD(o)};return e.trace_id&&(a.traceId=e.trace_id),e.span_id&&(a.spanId=e.span_id),C(e.trace_flags)||(a.flags=e.trace_flags),a}(e,this.na());this.ta.push({record:c}),(null!=(n=null==(o=this._instance.config.logs)?void 0:o.maxBufferSize)?n:100)>this.ta.length?this.sa():this.flushLogs()}else this.ra||(this.qt.warn("captureLog dropping logs: exceeded "+l+" logs per "+a+"ms"),this.ra=!0)}else this.qt.warn("captureLog requires a body")}get logger(){return this.oa||(this.oa={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)=>
2this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this.oa}flushLogs(e){if(this.Oi&&(clearTimeout(this.Oi),this.Oi=void 0),0!==this.ta.length){var t,i=this.ta;this.ta=[];var s=this._instance.config.logs,r=_({"service.name":(null==s?void 0:s.serviceName)||"unknown_service"},(null==s?void 0:s.environment)&&{"deployment.environment":s.environment},(null==s?void 0:s.serviceVersion)&&{"service.version":s.serviceVersion},null==s?void 0:s.resourceAttributes),n=(t=i.map(e=>e.record),{resourceLogs:[{resource:{attributes:nD(r)},scopeLogs:[{scope:{name:p.LIB_NAME},logRecords:t}]}]}),o=this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token);this._instance.qr({method:"POST",url:o,data:n,compression:"best-available",batchKey:"logs",transport:e})}}sa(){var e,t;this.Oi||(this.Oi=setTimeout(()=>{this.Oi=void 0,this.flushLogs()},null!=(e=null==(t=this._instance.config.logs)?void 0:t.flushIntervalMs)?e:3e3))}na(){var e,t={lib:p.LIB_NAME};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var{sessionId:i}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=i}if(null!=h&&null!=(e=h.location)&&e.href&&(t.currentUrl=h.location.href),this._instance.featureFlags){var s=this._instance.featureFlags.getFlags();s&&s.length>0&&(t.activeFeatureFlags=s)}return t}}});rR.__defaultExtensionClasses=_({},nU);var nz,nW=(nz=rp[rb]=new rR,function(){function e(){e.done||(e.done=!0,rw=!1,is(rp,function(e){e._dom_loaded()}))}null!=r&&r.addEventListener?"complete"===r.readyState?e():ih(r,"DOMContentLoaded",e,{capture:!1}):t&&th.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),nz);e.s(["default",0,nW])}]);
3
4//# debugId=4e283454-ce03-0a41-e0bd-5138ff249f39

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.