1var v=typeof window<"u"?window:void 0,Z=typeof globalThis<"u"?globalThis:v;typeof self>"u"&&(Z.self=Z),typeof File>"u"&&(Z.File=function(){});var ve=Z==null?void 0:Z.navigator,b=Z==null?void 0:Z.document,ie=Z==null?void 0:Z.location,rs=Z==null?void 0:Z.fetch,ns=Z!=null&&Z.XMLHttpRequest&&"withCredentials"in new Z.XMLHttpRequest?Z.XMLHttpRequest:void 0,cr=Z==null?void 0:Z.AbortController,Aa=Z==null?void 0:Z.CompressionStream,ue=ve==null?void 0:ve.userAgent,$=v??{},hr="1.382.0",Q={DEBUG:!1,LIB_VERSION:hr,LIB_NAME:"web",JS_SDK_VERSION:hr};function dr(i,e,t,s,r,n,a){try{var o=i[n](a),l=o.value}catch(c){return void t(c)}o.done?e(l):Promise.resolve(l).then(s,r)}function pe(i){return function(){var e=this,t=arguments;return new Promise(function(s,r){var n=i.apply(e,t);function a(l){dr(n,s,r,a,o,"next",l)}function o(l){dr(n,s,r,a,o,"throw",l)}a(void 0)})}}function f(){return f=Object.assign?Object.assign.bind():function(i){for(var e=1;arguments.length>e;e++){var t=arguments[e];for(var s in t)({}).hasOwnProperty.call(t,s)&&(i[s]=t[s])}return i},f.apply(null,arguments)}function dn(i,e){if(i==null)return{};var t={};for(var s in i)if({}.hasOwnProperty.call(i,s)){if(e.indexOf(s)!==-1)continue;t[s]=i[s]}return t}var yt,pr=function(i){return i.GZipJS="gzip-js",i.Base64="base64",i}({}),La=["$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"],pn="NativeGzipValidationError",as=i=>i.length>=2&&i[0]===31&&i[1]===139,vr=i=>!(!i||typeof i!="object")&&("name"in i?String(i.name):"")==="NotReadableError",Yt=i=>{var e=new Error("Native gzip produced invalid output: "+i);throw e.name=pn,e},qa=function(){var i=pe(function*(e,t){18>e.size&&Yt("too-short");var s=new Uint8Array(yield e.slice(0,10).arrayBuffer());as(s)&&s[2]===8||Yt("invalid-header");var r=new DataView(yield e.slice(e.size-8).arrayBuffer());r.getUint32(0,!0)!==(a=>{for(var o=(()=>{if(yt)return yt;yt=[];for(var u=0;256>u;u++){for(var h=u,d=0;8>d;d++)h=1&h?3988292384^h>>>1:h>>>1;yt[u]=h>>>0}return yt})(),l=4294967295,c=0;a.length>c;c++)l=o[255&(l^a[c])]^l>>>8;return(4294967295^l)>>>0})(t)&&Yt("invalid-crc");var n=t.length>>>0;r.getUint32(4,!0)!==n&&Yt("invalid-size")});return function(e,t){return i.apply(this,arguments)}}();function os(){return os=pe(function*(i,e,t){e===void 0&&(e=!0);try{var s=new TextEncoder().encode(i),r=new CompressionStream("gzip"),n=r.writable.getWriter(),a=n.write(s).then(()=>n.close()).catch(function(){var c=pe(function*(u){try{yield n.abort(u)}catch{}throw u});return function(u){return c.apply(this,arguments)}}()),o=new Response(r.readable).blob(),[l]=yield Promise.all([o,a]);return yield qa(l,s),l}catch(c){if(t!=null&&t.rethrow)throw c;return e&&console.error("Failed to gzip compress data",c),null}}),os.apply(this,arguments)}var Da=["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"],gr=function(i,e){if(e===void 0&&(e=[]),!i)return!1;var t=i.toLowerCase();return Da.concat(e).some(s=>{var r=s.toLowerCase();return t.indexOf(r)!==-1})};function O(i,e){return i.indexOf(e)!==-1}var Ri=function(i){return i.trim()},ls=function(i){return i.replace(/^\$/,"")},vn=Object.prototype,gn=vn.hasOwnProperty,Fi=vn.toString,q=Array.isArray||function(i){return Fi.call(i)==="[object Array]"},Le=i=>typeof i=="function",Y=i=>i===Object(i)&&!q(i),lt=i=>{if(Y(i)){for(var e in i)if(gn.call(i,e))return!1;return!0}return!1},w=i=>i===void 0,V=i=>Fi.call(i)=="[object String]",us=i=>V(i)&&i.trim().length===0,_e=i=>i===null,D=i=>w(i)||_e(i),me=i=>Fi.call(i)=="[object Number]"&&i==i,Ce=i=>me(i)&&i>0,Re=i=>Fi.call(i)==="[object Boolean]",Na=i=>i instanceof FormData,ja=i=>O(La,i);function _n(i){return i===null||typeof i!="object"}function li(i,e){return{}.toString.call(i)==="[object "+e+"]"}function Vs(i){return typeof Event<"u"&&function(e,t){try{return e instanceof t}catch{return!1}}(i,Event)}var Ua=[!0,"true",1,"1","yes"],Ai=i=>O(Ua,i),Ha=[!1,"false",0,"0","no"];function Te(i,e,t,s,r){return e>t&&(s.warn("min cannot be greater than max."),e=t),me(i)?i>t?(s.warn(" cannot be greater than max: "+t+". Using max value instead."),t):e>i?(s.warn(" cannot be less than min: "+e+". Using min value instead."),e):i:(s.warn(" must be a number. using max or fallback. max: "+t+", fallback: "+r),Te(r||t,e,t,s))}
1class Ba{constructor(e){this.$t={},this.zt=e.zt,this.Zt=Te(e.bucketSize,0,100,e.Gt),this.Qt=Te(e.refillRate,0,this.Zt,e.Gt),this.Jt=Te(e.refillInterval,0,864e5,e.Gt)}Kt(e,t){var s=Math.floor((t-e.lastAccess)/this.Jt);s>0&&(e.tokens=Math.min(e.tokens+s*this.Qt,this.Zt),e.lastAccess=e.lastAccess+s*this.Jt)}consumeRateLimit(e){var t,s=Date.now(),r=String(e),n=this.$t[r];return n?this.Kt(n,s):this.$t[r]=n={tokens:this.Zt,lastAccess:s},n.tokens===0||(n.tokens--,n.tokens===0&&((t=this.zt)==null||t.call(this,e)),n.tokens===0)}stop(){this.$t={}}}var Jt,_r,Li,fe="Mobile",ui="iOS",De="Android",vt="Tablet",fn=De+" "+vt,mn="iPad",yn="Apple",bn=yn+" Watch",Ct="Safari",gt="BlackBerry",wn="Samsung",xn=wn+"Browser",En=wn+" Internet",Ze="Chrome",za=Ze+" OS",Sn=Ze+" "+ui,Gs="Internet Explorer",kn=Gs+" "+fe,Ws="Opera",Va=Ws+" Mini",Ys="Edge",Pn="Microsoft "+Ys,dt="Firefox",$n=dt+" "+ui,jt="Nintendo",Ut="PlayStation",pt="Xbox",Tn=De+" "+fe,Rn=fe+" "+Ct,Tt="Windows",cs=Tt+" Phone",fr="Nokia",hs="Ouya",Fn="Generic",Ga=Fn+" "+fe.toLowerCase(),In=Fn+" "+vt.toLowerCase(),ds="Konqueror",On="Oculus Browser",ci="Vivaldi",Mn="Yandex",hi="Whale",ps="DuckDuckGo",Cn="Pale Moon",di="Waterfox",At="Brave",W="(\\d+(\\.\\d+)?)",qi=new RegExp("Version/"+W),Wa=new RegExp(pt,"i"),Ya=new RegExp(Ut+" \\w+","i"),Ja=new RegExp(jt+" \\w+","i"),Js=new RegExp(gt+"|PlayBook|BB10","i"),Ka={"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"},An=function(i,e,t){e=e||"";var s=function(r){return r!=null&&r.brave?At:null}(t);return s||(O(i," OPR/")&&O(i,"Mini")?Va:O(i," OPR/")?Ws:Js.test(i)?gt:O(i,"IE"+fe)||O(i,"WPDesktop")?kn:O(i,"OculusBrowser")?On:O(i,xn)?En:O(i,Ys)||O(i,"Edg/")?Pn:O(i,ci+"/")?ci:O(i,"YaBrowser/")?Mn:O(i,hi+"/")?hi:O(i,ps+"/")||O(i,"Ddg/")?ps:O(i,"FBIOS")?"Facebook "+fe:O(i,"UCWEB")||O(i,"UCBrowser")?"UC Browser":O(i,"CriOS")?Sn:O(i,"CrMo")||O(i,Ze)?Ze:O(i,De)&&O(i,Ct)?Tn:O(i,"FxiOS")?$n:O(i.toLowerCase(),ds.toLowerCase())?ds:O(i,At+"/")?At:((r,n)=>n&&O(n,yn)||function(a){return O(a,Ct)&&!O(a,Ze)&&!O(a,De)}(r))(i,e)?O(i,fe)?Rn:Ct:O(i,"PaleMoon/")?Cn:O(i,di+"/")?di:O(i,dt)?dt:O(i,"MSIE")||O(i,"Trident/")?Gs:O(i,"Gecko")?dt:"")},Xa={[kn]:[new RegExp("rv:"+W)],[Pn]:[new RegExp(Ys+"?\\/"+W)],[Ze]:[new RegExp("("+Ze+"|CrMo)\\/"+W)],[Sn]:[new RegExp("CriOS\\/"+W)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+W)],[Ct]:[qi],[Rn]:[qi],[Ws]:[new RegExp("(Opera|OPR)\\/"+W)],[dt]:[new RegExp(dt+"\\/"+W)],[$n]:[new RegExp("FxiOS\\/"+W)],[ds]:[new RegExp("Konqueror[:/]?"+W,"i")],[gt]:[new RegExp(gt+" "+W),qi],[Tn]:[new RegExp("android\\s"+W,"i")],[En]:[new RegExp(xn+"\\/"+W)],[On]:[new RegExp("OculusBrowser\\/"+W)],[ci]:[new RegExp(ci+"\\/"+W)],[Mn]:[new RegExp("YaBrowser\\/"+W)],[hi]:[new RegExp(hi+"\\/"+W)],[At]:[new RegExp(At+"\\/"+W)],[ps]:[new RegExp("(DuckDuckGo|Ddg)\\/"+W)],[Cn]:[new RegExp("PaleMoon\\/"+W)],[di]:[new RegExp(di+"\\/"+W)],[Gs]:[new RegExp("(rv:|MSIE )"+W)],Mozilla:[new RegExp("rv:"+W)]},Za=function(i,e,t){var s=An(i,e,t),r=Xa[s];if(w(r))return null;for(var n=0;r.length>n;n++){var a=i.match(r[n]);if(a)return parseFloat(a[a.length-2])}return null},mr=[[new RegExp(pt+"; "+pt+" (.*?)[);]","i"),i=>[pt,i&&i[1]||""]],[new RegExp(jt,"i"),[jt,""]],[new RegExp(Ut,"i"),[Ut,""]],[Js,[gt,""]],[new RegExp(Tt,"i"),(i,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[cs,""];if(new RegExp(fe).test(e)&&!/IEMobile\b/.test(e))return[Tt+" "+fe,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var s=Ka[t[1]]||"";return/arm/i.test(e)&&(s="RT"),[Tt,s]}return[Tt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,i=>i&&i[3]?[ui,[i[3],i[4],i[5]||"0"].join(".")]:[ui,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,i=>{var e="";return i&&i.length>=3&&(e=w(i[2])?i[3]:i[2]),["watchOS",e]}],[new RegExp("("+De+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+De+")","i"),i=>i&&i[2]?[De,[i[2],i[3],i[4]||"0"].join(".")]:[De,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,i=>{var e=["Mac OS X",""];return i&&i[1]&&(e[1]=[i[1],i[2],i[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[za,""]],[/Linux|debian/i,["Linux",""]]],yr=function(i){return Ja.test(i)?jt:Ya.test(i)?Ut:Wa.test(i)?pt:new RegExp(hs,"i").test(i)?hs:new RegExp("("+cs+"|WPDesktop)","i").test(i)?cs:/iPad/.test(i)?mn:/iPod/.test(i)?"iPod Touch":/iPhone/.test(i)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(i)?bn:Js.test(i)?gt:/(kobo)\s(ereader|touch)/i.test(i)?"Kobo":new RegExp(fr,"i").test(i)?fr:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(i)||/(kf[a-z]+)( bui|\)).+silk\//i.test(i)?"Kindle Fire":/(Android|ZTE)/i.test(i)?new RegExp(fe).test(i)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(i)||/pixel[\daxl ]{1,6}/i.test(i)&&!/pixel c/i.test(i)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(i)||/lmy47v/i.test(i)&&!/QTAQZ3/i.test(i)?De:fn:new RegExp("(pda|"+fe+")","i").test(i)?Ga:new RegExp(vt,"i").test(i)&&!new RegExp(vt+" pc","i").test(i)?In:""},Qa=i=>i instanceof Error,Ln={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}},eo=Ln.info;
1function qn(i){if(Re(i))return{boolValue:i};if(typeof i=="number")return Number.isFinite(i)?Number.isInteger(i)?{intValue:i}:{doubleValue:i}:{stringValue:String(i)};if(typeof i=="string")return{stringValue:i};if(q(i))return{arrayValue:{values:i.map(e=>qn(e))}};try{return{stringValue:JSON.stringify(i)}}catch{return{stringValue:String(i)}}}function br(i){var e=[];for(var t in i){var s=i[t];_e(s)||w(s)||e.push({key:t,value:qn(s)})}return e}function to(i){var e=globalThis._posthogChunkIds;if(e){var t=Object.keys(e);return Li&&t.length===_r||(_r=t.length,Li=t.reduce((s,r)=>{Jt||(Jt={});var n=Jt[r];if(n)s[n[0]]=n[1];else for(var a=i(r),o=a.length-1;o>=0;o--){var l=a[o],c=l==null?void 0:l.filename,u=e[r];if(c&&u){s[c]=u,Jt[r]=[c,u];break}}return s},{})),Li}}class io{constructor(e,t,s){s===void 0&&(s=[]),this.coercers=e,this.stackParser=t,this.modifiers=s}buildFromUnknown(e,t){t===void 0&&(t={});var s=t&&t.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(s,t,0).apply(e),n=this.buildParsingContext(t),a=this.parseStacktrace(r,n);return{$exception_list:this.convertToExceptionList(a,s),$exception_level:"error"}}modifyFrames(e){var t=this;return pe(function*(){for(var s of e)s.stacktrace&&s.stacktrace.frames&&q(s.stacktrace.frames)&&(s.stacktrace.frames=yield t.applyModifiers(s.stacktrace.frames));return e})()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:(t=e.syntheticException)==null?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var s,r;return e.cause!=null&&(s=this.parseStacktrace(e.cause,t)),e.stack!=""&&e.stack!=null&&(r=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),f({},e,{cause:s,stack:r})}applyChunkIds(e,t){return e.map(s=>(s.filename&&t&&(s.chunk_id=t[s.filename]),s))}applyCoercers(e,t){for(var s of this.coercers)if(s.match(e))return s.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return pe(function*(){var s=e;for(var r of t.modifiers)s=yield r(s);return s})()}convertToExceptionList(e,t){var s,r,n,a={type:e.type,value:e.value,mechanism:{type:(s=t.type)!==null&&s!==void 0?s:"generic",handled:(r=t.handled)===null||r===void 0||r,synthetic:(n=e.synthetic)!==null&&n!==void 0&&n}};e.stack&&(a.stacktrace={type:"raw",frames:e.stack});var o=[a];return e.cause!=null&&o.push(...this.convertToExceptionList(e.cause,f({},t,{handled:!0}))),o}buildParsingContext(e){var t;return{chunkIdMap:to(this.stackParser),skipFirstLines:(t=e.skipFirstLines)!==null&&t!==void 0?t:1}}buildCoercingContext(e,t,s){s===void 0&&(s=0);var r=(n,a)=>{if(4>=a){var o=this.buildCoercingContext(e,t,a);return this.applyCoercers(n,o)}};return f({},t,{syntheticException:s==0?t.syntheticException:void 0,mechanism:e,apply:n=>r(n,s),next:n=>r(n,s+1)})}}var _t="?";function vs(i,e,t,s,r){var n={platform:i,filename:e,function:t==="<anonymous>"?_t:t,in_app:!0};return w(s)||(n.lineno=s),w(r)||(n.colno=r),n}var Dn=(i,e)=>{var t=i.indexOf("safari-extension")!==-1,s=i.indexOf("safari-web-extension")!==-1;return t||s?[i.indexOf("@")!==-1?i.split("@")[0]:_t,t?"safari-extension:"+e:"safari-web-extension:"+e]:[i,e]},so=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,ro=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,no=/\((\S*)(?::(\d+))(?::(\d+))\)/,ao=(i,e)=>{var t=so.exec(i);if(t){var[,s,r,n]=t;return vs(e,s,_t,+r,+n)}var a=ro.exec(i);if(a){if(a[2]&&a[2].indexOf("eval")===0){var o=no.exec(a[2]);o&&(a[2]=o[1],a[3]=o[2],a[4]=o[3])}var[l,c]=Dn(a[1]||_t,a[2]);return vs(e,c,l,a[3]?+a[3]:void 0,a[4]?+a[4]:void 0)}},oo=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,lo=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,uo=(i,e)=>{var t=oo.exec(i);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var s=lo.exec(t[3]);s&&(t[1]=t[1]||"eval",t[3]=s[1],t[4]=s[2],t[5]="")}var r=t[3],n=t[1]||_t;return[n,r]=Dn(n,r),vs(e,r,n,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},wr=/\(error: (.*)\)/;class co{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var s=V(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:s?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 li(e,"DOMException")}isDOMError(e){return li(e,"DOMError")}}class ho{match(e){return(t=>t instanceof Error)(e)}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 s=e.message;return String(s.error&&typeof s.error.message=="string"?s.error.message:s)}getStack(e){return e.stacktrace||e.stack||void 0}}class po{constructor(){}match(e){return li(e,"ErrorEvent")&&e.error!=null}coerce(e,t){var s;return t.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:(s=t.syntheticException)==null?void 0:s.stack,synthetic:!0}}}var vo=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class go{match(e){return typeof e=="string"}coerce(e,t){var s,[r,n]=this.getInfos(e);return{type:r??"Error",value:n??e,stack:(s=t.syntheticException)==null?void 0:s.stack,synthetic:!0}}getInfos(e){var t="Error",s=e,r=e.match(vo);return r&&(t=r[1],s=r[2]),[t,s]}}var _o=["fatal","error","warning","log","info","debug"];function Nn(i,e){e===void 0&&(e=40);var t=Object.keys(i);if(t.sort(),!t.length)return"[object has no keys]";for(var s=t.length;s>0;s--){var r=t.slice(0,s).join(", ");
1if(e>=r.length)return s===t.length?r:r.length>e?r.slice(0,e)+"...":r}return""}class fo{match(e){return typeof e=="object"&&e!==null}coerce(e,t){var s,r=this.getErrorPropertyFromObject(e);return r?t.apply(r):{type:this.getType(e),value:this.getValue(e),stack:(s=t.syntheticException)==null?void 0:s.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return Vs(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){var t="'"+e.name+"' captured as exception";return"message"in e&&typeof e.message=="string"&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&typeof e.message=="string")return e.message;var s=this.getObjectClassName(e);return(s&&s!=="Object"?"'"+s+"'":"Object")+" captured as exception with keys: "+Nn(e)}isSeverityLevel(e){return V(e)&&!us(e)&&_o.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if({}.hasOwnProperty.call(e,t)){var s=e[t];if(Qa(s))return s}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}}class mo{match(e){return Vs(e)}coerce(e,t){var s,r=e.constructor.name;return{type:r,value:r+" captured as exception with keys: "+Nn(e),stack:(s=t.syntheticException)==null?void 0:s.stack,synthetic:!0}}}class yo{match(e){return _n(e)}coerce(e,t){var s;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(s=t.syntheticException)==null?void 0:s.stack,synthetic:!0}}}class bo{match(e){return li(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!Vs(e))return!1;try{var t=e.detail;return t!=null&&typeof t=="object"&&"reason"in t}catch{return!1}}coerce(e,t){var s,r=this.getUnhandledRejectionReason(e);return _n(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:(s=t.syntheticException)==null?void 0:s.stack,synthetic:!0}:t.apply(r)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&e.detail!=null&&typeof e.detail=="object"&&"reason"in e.detail)return e.detail.reason}catch{}return e}}var pi="$message",vi="$timestamp",wo=new Set([pi,vi]),Di={enabled:!0,max_bytes:32768};function gi(i){var e;return i?{enabled:(e=i.enabled)!==null&&e!==void 0?e:Di.enabled,max_bytes:Eo(i.max_bytes,Di.max_bytes)}:f({},Di)}class xo{constructor(e){this.Yt=[],this.Xt=0,this.qt=gi(e)}setConfig(e){this.qt=gi(e),this.er()}add(e){var t=function(r){var n=function(u){var h=new WeakSet;try{return JSON.stringify(u,(d,p)=>{if(typeof p=="bigint")return p.toString();if(typeof p!="function"&&typeof p!="symbol"){if(p instanceof Date)return p.toISOString();if(p instanceof Error)return{name:p.name,message:p.message,stack:p.stack};if(p&&typeof p=="object"){if(h.has(p))return"[Circular]";h.add(p)}return p}})}catch{return}}(r);if(n)try{var a=JSON.parse(n);if(!Y(a))return;var o=a,l=o[pi],c=o[vi];return!V(l)||l.trim().length===0||!V(c)&&!me(c)?void 0:{step:o,json:n}}catch{return}}(e);if(t){var s=function(r){if(typeof TextEncoder<"u")return new TextEncoder().encode(r).length;for(var n=encodeURIComponent(r),a=0,o=0;n.length>o;o++)n[o]==="%"?(a+=1,o+=2):a+=1;return a}(t.json);s>this.qt.max_bytes||(this.Yt.push({step:t.step,bytes:s}),this.Xt+=s,this.er())}}getAttachable(){return this.Yt.map(e=>e.step)}clear(){this.Yt=[],this.Xt=0}size(){return this.Yt.length}er(){for(;this.Xt>this.qt.max_bytes&&this.Yt.length>0;){var e=this.Yt.shift();e&&(this.Xt-=e.bytes)}}}function Eo(i,e){if(!me(i)||i===1/0||i===-1/0)return e;var t=Math.floor(i);return 0>t?e:t}var jn=function(i,e){var{debugEnabled:t}=e===void 0?{}:e,s={k(r){if(v&&(Q.DEBUG||$.POSTHOG_DEBUG||t)&&!w(v.console)&&v.console){for(var n=("__rrweb_original__"in v.console[r])?v.console[r].__rrweb_original__:v.console[r],a=arguments.length,o=new Array(a>1?a-1:0),l=1;a>l;l++)o[l-1]=arguments[l];n(i,...o)}},debug(){for(var r=arguments.length,n=new Array(r),a=0;r>a;a++)n[a]=arguments[a];s.k("debug",...n)},info(){for(var r=arguments.length,n=new Array(r),a=0;r>a;a++)n[a]=arguments[a];s.k("log",...n)},warn(){for(var r=arguments.length,n=new Array(r),a=0;r>a;a++)n[a]=arguments[a];s.k("warn",...n)},error(){for(var r=arguments.length,n=new Array(r),a=0;r>a;a++)n[a]=arguments[a];s.k("error",...n)},critical(){for(var r=arguments.length,n=new Array(r),a=0;r>a;a++)n[a]=arguments[a];console.error(i,...n)},uninitializedWarning(r){s.error("You must initialize PostHog before calling "+r)},createLogger:(r,n)=>jn(i+" "+r,n)};return s},y=jn("[PostHog.js]"),G=y.createLogger,So=G("[ExternalScriptsLoader]"),Ni=(i,e,t)=>{if(i.config.disable_external_dependency_loading)return So.warn(e+" was requested but loading of external scripts is disabled."),t("Loading of external scripts is disabled");var s=b==null?void 0:b.querySelectorAll("script");
1if(s){for(var r,n=function(){if(s[a].src===e){var l=s[a];return l.__posthog_loading_callback_fired?{v:t()}:(l.addEventListener("load",c=>{l.__posthog_loading_callback_fired=!0,t(void 0,c)}),l.onerror=c=>t(c),{v:void 0})}},a=0;s.length>a;a++)if(r=n())return r.v}var o=()=>{if(!b)return t("document not found");var l=b.createElement("script");if(l.type="text/javascript",l.crossOrigin="anonymous",l.src=e,l.onload=h=>{l.__posthog_loading_callback_fired=!0,t(void 0,h)},l.onerror=h=>t(h),i.config.prepare_external_dependency_script&&(l=i.config.prepare_external_dependency_script(l)),!l)return t("prepare_external_dependency_script returned null");if(i.config.external_scripts_inject_target==="head")b.head.appendChild(l);else{var c,u=b.querySelectorAll("body > script");u.length>0?(c=u[0].parentNode)==null||c.insertBefore(l,u[0]):b.body.appendChild(l)}};b!=null&&b.body?o():b==null||b.addEventListener("DOMContentLoaded",o)};$.__PosthogExtensions__=$.__PosthogExtensions__||{},$.__PosthogExtensions__.loadExternalDependency=(i,e,t)=>{if(e!=="remote-config"){var s;if(i.config.__preview_external_dependency_versioned_paths)s=i.requestRouter.endpointFor("assets","/static/"+i.version+"/"+e+".js");else{var r="/static/"+e+".js?v="+i.version;if(e==="toolbar"){var n=3e5;r=r+"&t="+Math.floor(Date.now()/n)*n}s=i.requestRouter.endpointFor("assets",r)}Ni(i,s,t)}else{var a=i.requestRouter.endpointFor("assets","/array/"+i.config.token+"/config.js");Ni(i,a,t)}},$.__PosthogExtensions__.loadSiteApp=(i,e,t)=>{var s=i.requestRouter.endpointFor("api",e);Ni(i,s,t)};var Un="$people_distinct_id",_i="$device_id",Rt="__alias",Ft="__timers",gs="$autocapture_disabled_server_side",_s="$heatmaps_enabled_server_side",fs="$exception_capture_enabled_server_side",ms="$error_tracking_suppression_rules",ys="$error_tracking_capture_extension_exceptions",bs="$web_vitals_enabled_server_side",Ks="$dead_clicks_enabled_server_side",ws="$product_tours_enabled_server_side",xs="$web_vitals_allowed_metrics",Xe="$session_recording_remote_config",Hn="$replay_override_sampling",Bn="$replay_override_linked_flag",zn="$replay_override_url_trigger",Vn="$replay_override_event_trigger",ut="$sesid",Xs="$session_is_sampled",ct="$enabled_feature_flags",si="$active_feature_flags",It="$early_access_features",Es="$feature_flag_details",Ss="$feature_flag_payloads",ks="$feature_flag_request_id",Ae="$override_feature_flags",nt="$override_feature_flag_payloads",Ot="$stored_person_properties",Je="$stored_group_properties",Ps="$surveys",$s="$surveys_activated",ri="ph_product_tours",Lt="$flag_call_reported",Ts="$flag_call_reported_session_id",Rs="$feature_flag_errors",fi="$feature_flag_evaluated_at",Se="$user_state",Fs="$client_session_props",Is="$capture_rate_limit",Os="$initial_campaign_params",Ms="$initial_referrer_info",mi="$initial_person_info",yi="$epp",Gn="__POSTHOG_TOOLBAR__",Kt="$posthog_cookieless",Wn="$sdk_debug_extensions_init_method",Yn="$sdk_debug_extensions_init_time_ms",Jn="$sdk_debug_recording_script_not_loaded",Zs="PostHog loadExternalDependency extension not found.",Ke="on_reject",qe="always",et="anonymous",tt="identified",Cs="identified_only",bi="visibilitychange",wi="beforeunload",at="$pageview",ji="$pageleave",Ui="$identify",xr="$groupidentify";function Xt(i,e){q(i)&&i.forEach(e)}function H(i,e){if(!D(i))if(q(i))i.forEach(e);else if(Na(i))i.forEach((s,r)=>e(s,r));else for(var t in i)gn.call(i,t)&&e(i[t],t)}var z=function(i){for(var e=arguments.length,t=new Array(e>1?e-1:0),s=1;e>s;s++)t[s-1]=arguments[s];for(var r of t)for(var n in r)r[n]!==void 0&&(i[n]=r[n]);return i};function ni(i){for(var e=Object.keys(i),t=e.length,s=new Array(t);t--;)s[t]=[e[t],i[e[t]]];return s}var Er=function(i){try{return i()}catch{return}},ko=function(i){return function(){try{for(var e=arguments.length,t=new Array(e),s=0;e>s;s++)t[s]=arguments[s];return i.apply(this,t)}catch(r){y.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),y.critical(r)}}},Qs=function(i){var e={};return H(i,function(t,s){(V(t)&&t.length>0||me(t))&&(e[s]=t)}),e},Po=["herokuapp.com","vercel.app","netlify.app"];function $o(i){var e=i==null?void 0:i.hostname;if(!V(e))return!1;var t=e.split(".").slice(-2).join(".");for(var s of Po)if(t===s)return!1;return!0}function K(i,e,t,s){var{capture:r=!1,passive:n=!0}=s??{};i==null||i.addEventListener(e,t,{capture:r,passive:n})}
1function Kn(i){return i.name==="ph_toolbar_internal"}Math.trunc||(Math.trunc=function(i){return 0>i?Math.ceil(i):Math.floor(i)}),Number.isInteger||(Number.isInteger=function(i){return me(i)&&isFinite(i)&&Math.floor(i)===i});class xi{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,s,r){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(s)||!Number.isInteger(r)||0>e||0>t||0>s||0>r||e>0xffffffffffff||t>4095||s>1073741823||r>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=e/Math.pow(2,40),n[1]=e/Math.pow(2,32),n[2]=e/Math.pow(2,24),n[3]=e/Math.pow(2,16),n[4]=e/Math.pow(2,8),n[5]=e,n[6]=112|t>>>8,n[7]=t,n[8]=128|s>>>24,n[9]=s>>>16,n[10]=s>>>8,n[11]=s,n[12]=r>>>24,n[13]=r>>>16,n[14]=r>>>8,n[15]=r,new xi(n)}toString(){for(var e="",t=0;this.bytes.length>t;t++)e=e+(this.bytes[t]>>>4).toString(16)+(15&this.bytes[t]).toString(16),t!==3&&t!==5&&t!==7&&t!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new xi(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var t=0;16>t;t++){var s=this.bytes[t]-e.bytes[t];if(s!==0)return Math.sign(s)}return 0}}class To{constructor(){this.S=0,this.C=0,this.I=new Ro}generate(){var e=this.generateOrAbort();if(w(e)){this.S=0;var t=this.generateOrAbort();if(w(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.S)this.S=e,this.T();else{if(this.S>=e+1e4)return;this.C++,this.C>4398046511103&&(this.S++,this.T())}return xi.fromFieldsV7(this.S,Math.trunc(this.C/Math.pow(2,30)),this.C&Math.pow(2,30)-1,this.I.nextUint32())}T(){this.C=1024*this.I.nextUint32()+(1023&this.I.nextUint32())}}var Sr,Xn=i=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;i.length>e;e++)i[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return i};v&&!w(v.crypto)&&crypto.getRandomValues&&(Xn=i=>crypto.getRandomValues(i));class Ro{constructor(){this.M=new Uint32Array(8),this.R=1/0}nextUint32(){return this.M.length>this.R||(Xn(this.M),this.R=0),this.M[this.R++]}}var He=()=>Fo().toString(),Fo=()=>(Sr||(Sr=new To)).generate(),bt="",Io=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,$e={O:()=>!!b,D(i){y.error("cookieStore error: "+i)},A(i){if(b){try{for(var e=i+"=",t=b.cookie.split(";").filter(n=>n.length),s=0;t.length>s;s++){for(var r=t[s];r.charAt(0)==" ";)r=r.substring(1,r.length);if(r.indexOf(e)===0)return decodeURIComponent(r.substring(e.length,r.length))}}catch{}return null}},F(i){var e;try{e=JSON.parse($e.A(i))||{}}catch{}return e},N(i,e,t,s,r){if(b)try{var n="",a="",o=function(u,h){if(h){var d=function(g,_){if(_===void 0&&(_=b),bt)return bt;if(!_||["localhost","127.0.0.1"].includes(g))return"";for(var M=g.split("."),T=Math.min(M.length,8),C="dmn_chk_"+He();!bt&&T--;){var I=M.slice(T).join("."),R=C+"=1;domain=."+I+";path=/";_.cookie=R+";max-age=3",_.cookie.includes(C)&&(_.cookie=R+";max-age=0",bt=I)}return bt}(u);if(!d){var p=(g=>{var _=g.match(Io);return _?_[0]:""})(u);p!==d&&y.info("Warning: cookie subdomain discovery mismatch",p,d),d=p}return d?"; domain=."+d:""}return""}(b.location.hostname,s);if(t){var l=new Date;l.setTime(l.getTime()+864e5*t),n="; expires="+l.toUTCString()}r&&(a="; secure");var c=i+"="+encodeURIComponent(JSON.stringify(e))+n+"; SameSite=Lax; path=/"+o+a;return c.length>3686.4&&y.warn("cookieStore warning: large cookie, len="+c.length),b.cookie=c,c}catch{return}},q(i,e){if(b!=null&&b.cookie)try{$e.N(i,"",-1,e)}catch{return}}},Hi=null,J={O(){if(!_e(Hi))return Hi;var i=!0;if(w(v))i=!1;else try{var e="__mplssupport__";J.N(e,"xyz"),J.A(e)!=='"xyz"'&&(i=!1),J.q(e)}catch{i=!1}return i||y.error("localStorage unsupported; falling back to cookie store"),Hi=i,i},D(i){y.error("localStorage error: "+i)},A(i){try{return v==null?void 0:v.localStorage.getItem(i)}catch(e){J.D(e)}return null},F(i){try{return JSON.parse(J.A(i))||{}}catch{}return null},N(i,e){try{v==null||v.localStorage.setItem(i,JSON.stringify(e))}catch(t){J.D(t)}},q(i){try{v==null||v.localStorage.removeItem(i)}catch(e){J.D(e)}}},Oo=[_i,"distinct_id",ut,Xs,yi,mi,Se],Zt={},Mo={O:()=>!0,D(i){y.error("memoryStorage error: "+i)},A:i=>Zt[i]||null,F:i=>Zt[i]||null,N(i,e){Zt[i]=e},q(i){delete Zt[i]}},Ve=null,se={O(){if(!_e(Ve))return Ve;if(Ve=!0,w(v))Ve=!1;else try{var i="__support__";se.N(i,"xyz"),se.A(i)!=='"xyz"'&&(Ve=!1),se.q(i)}catch{Ve=!1}return Ve},D(i){y.error("sessionStorage error: ",i)},A(i){try{return v==null?void 0:v.sessionStorage.getItem(i)}catch(e){se.D(e)}return null}
1,F(i){try{return JSON.parse(se.A(i))||null}catch{}return null},N(i,e){try{v==null||v.sessionStorage.setItem(i,JSON.stringify(e))}catch(t){se.D(t)}},q(i){try{v==null||v.sessionStorage.removeItem(i)}catch(e){se.D(e)}}};class Co{constructor(e){this._instance=e}get qt(){return this._instance.config}get consent(){return this.rr()?0:this.ir}isOptedOut(){return this.qt.cookieless_mode===qe||this.isRejected()||this.consent===-1&&this.qt.cookieless_mode===Ke}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.qt.opt_out_capturing_by_default}optInOut(e){this.nr.N(this.sr,e?1:0,this.qt.cookie_expiration,this.qt.cross_subdomain_cookie,this.qt.secure_cookie)}reset(){this.nr.q(this.sr,this.qt.cross_subdomain_cookie)}get sr(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:s}=this._instance.config;return s||(t?t+e:"__ph_opt_in_out_"+e)}get ir(){var e=this.nr.A(this.sr);return Ai(e)?1:O(Ha,e)?0:-1}get nr(){var e=this.qt.opt_out_capturing_persistence_type,t=e==="localStorage"?J:$e;if(!this.ar||this.ar!==t){this.ar=t;var s=e==="localStorage"?$e:J;s.A(this.sr)&&(this.ar.A(this.sr)||this.optInOut(Ai(s.A(this.sr))),s.q(this.sr,this.qt.cross_subdomain_cookie))}return this.ar}rr(){return!!this.qt.respect_dnt&&[ve==null?void 0:ve.doNotTrack,ve==null?void 0:ve.msDoNotTrack,$.doNotTrack].some(e=>Ai(e))}}var Ao=1,Lo=3,qo=11;function kr(i){return i instanceof Element&&(i.id===Gn||!(i.closest==null||!i.closest(".toolbar-global-fade-container")))}function Be(i){return!!i&&i.nodeType===Ao}function ge(i,e){return!!i&&!!i.tagName&&i.tagName.toLowerCase()===e.toLowerCase()}function Zn(i){return!!i&&i.nodeType===Lo}function Qn(i){return!!i&&i.nodeType===qo&&Be(i.host)}function er(i){return i?Ri(i).split(/\s+/):[]}function Pr(i){var e=v==null?void 0:v.location.href;return!!(e&&i&&i.some(t=>e.match(t)))}function Ei(i){var e="";switch(typeof i.className){case"string":e=i.className;break;case"object":e=(i.className&&"baseVal"in i.className?i.className.baseVal:null)||i.getAttribute("class")||"";break;default:e=""}return er(e)}function ea(i){return D(i)?null:Ri(i).split(/(\s+)/).filter(e=>qt(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Ht(i){var e="";return As(i)&&!na(i)&&i.childNodes&&i.childNodes.length&&H(i.childNodes,function(t){var s;Zn(t)&&t.textContent&&(e+=(s=ea(t.textContent))!==null&&s!==void 0?s:"")}),Ri(e)}function Bi(i){return w(i.target)?i.srcElement||null:(e=i.target)!=null&&e.shadowRoot?i.composedPath()[0]||null:i.target||null;var e}var tr=["a","button","form","input","select","textarea","label"];function ta(i,e){if(w(e))return!0;var t,s=function(n){if(e.some(a=>n.matches(a)))return{v:!0}};for(var r of i)if(t=s(r))return t.v;return!1}function ia(i){var e=i.parentNode;return!(!e||!Be(e))&&e}var sa=["next","previous","prev",">","<"],Do=[...sa,"+","-","â","â"],$r=(i,e)=>/[a-z0-9]/i.test(e)?i.includes(e):i===e,Tr=[".ph-no-rageclick",".ph-no-capture"],No=["","text","search","email","password","url","tel","number"];function Rr(i,e){if(!v||ir(i))return!1;var t,s,r,n,a;if(Re(e)?(t=!!e&&Tr,s=void 0,r=!1):(t=(n=e==null?void 0:e.css_selector_ignorelist)!==null&&n!==void 0?n:Tr,s=e==null?void 0:e.content_ignorelist,r=(a=e==null?void 0:e.ignore_text_selection)!==null&&a!==void 0&&a),t===!1||r&&function(l){return!(!l||!Be(l))&&(!!ge(l,"textarea")||(ge(l,"input")?O(No,(l.getAttribute("type")||"").toLowerCase()):function(c){if(c.isContentEditable)return!0;var u=c.getAttribute==null?void 0:c.getAttribute("contenteditable");return u==="true"||u===""}(l)))}(i))return!1;var{targetElementList:o}=ra(i,!1);return!function(l,c){if(l===!1||w(l))return!1;var u;if(l===!0)u=sa;else{if(!q(l))return!1;if(l.length>10)return y.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;u=l.map(h=>h.toLowerCase())}return c.some(h=>{var{safeText:d,ariaLabel:p}=h;return u.some(g=>$r(d,g)||$r(p,g))})}(s,o.map(l=>{var c;return{safeText:Ht(l).toLowerCase(),ariaLabel:((c=l.getAttribute("aria-label"))==null?void 0:c.toLowerCase().trim())||""}}))&&!ta(o,t)}var ir=i=>!i||ge(i,"html")||!Be(i),ra=(i,e)=>{if(!v||ir(i))return{parentIsUsefulElement:!1,targetElementList:[]};for(var t=!1,s=[i],r=i;r.parentNode&&!ge(r,"body");)if(Qn(r.parentNode))s.push(r.parentNode.host),r=r.parentNode.host;else{var n=ia(r);if(!n)break;if(e||tr.indexOf(n.tagName.toLowerCase())>-1)t=!0;else{var a=v.getComputedStyle(n);a&&a.getPropertyValue("cursor")==="pointer"&&(t=!0)}s.push(n),r=n}return{parentIsUsefulElement:t,targetElementList:s}};function As(i){for(var e=i;e.parentNode&&!ge(e,"body");e=e.parentNode){var t=Ei(e);if(O(t,"ph-sensitive")||O(t,"ph-no-capture"))return!1}if(O(Ei(i),"ph-include"))return!0;var s=i.type||"";if(V(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}var r=i.name||i.id||"";return!V(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 na(i){return!!(ge(i,"input")&&!["button","checkbox","submit","reset"].includes(i.type)||ge(i,"select")||ge(i,"textarea")||i.getAttribute("contenteditable")==="true")}var aa="(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}
1)|((?:2131|1800|35[0-9]{3})[0-9]{11})",jo=new RegExp("^(?:"+aa+")$"),Uo=new RegExp(aa),oa="\\d{3}-?\\d{2}-?\\d{4}",Ho=new RegExp("^("+oa+")$"),Bo=new RegExp("("+oa+")");function qt(i,e){return e===void 0&&(e=!0),!(D(i)||V(i)&&(i=Ri(i),(e?jo:Uo).test((i||"").replace(/[- ]/g,""))||(e?Ho:Bo).test(i)))}function Fr(i){var e=Ht(i);return qt(e=(e+" "+la(i)).trim())?e:""}function la(i){var e="";return i&&i.childNodes&&i.childNodes.length&&H(i.childNodes,function(t){var s;if(t&&((s=t.tagName)==null?void 0:s.toLowerCase())==="span")try{var r=Ht(t);e=(e+" "+r).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+la(t)).trim())}catch(n){y.error("[AutoCapture]",n)}}),e}function Ir(i){return i.replace(/"|\\"/g,'\\"')}function zo(i){var e=i.attr__class;return e?q(e)?e:er(e):void 0}var Qt=G("[Dead Clicks]"),Vo=()=>!0,Go=i=>{var e,t=!((e=i.instance.persistence)==null||!e.get_property(Ks)),s=i.instance.config.capture_dead_clicks;return Re(s)?s:!!Y(s)||t};class Or{get lazyLoadedDeadClicksAutocapture(){return this.ur}constructor(e,t,s){this.instance=e,this.isEnabled=t,this.onCapture=s,this.startIfEnabledOrStop()}onRemoteConfig(e){"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[Ks]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.lr(()=>{this.hr()}):this.stop()}lr(e){var t,s;(t=$.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture&&e(),(s=$.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this.instance,"dead-clicks-autocapture",r=>{r?Qt.error("failed to load script",r):e()})}hr(){var e;if(b){if(!this.ur&&(e=$.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var t=Y(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.ur=$.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.ur.start(b),Qt.info("starting...")}}else Qt.error("`document` not found. Cannot start.")}stop(){this.ur&&(this.ur.stop(),this.ur=void 0,Qt.info("stopping..."))}}var zi=G("[SegmentIntegration]"),ua="posthog-js";function ca(i,e){var{organization:t,projectId:s,prefix:r,severityAllowList:n=["error"],sendExceptionsToPostHog:a=!0}=e===void 0?{}:e;return o=>{var l,c,u,h,d;if(n!=="*"&&!n.includes(o.level)||!i.__loaded)return o;o.tags||(o.tags={});var p=i.requestRouter.endpointFor("ui","/project/"+i.config.token+"/person/"+i.get_distinct_id());o.tags["PostHog Person URL"]=p,i.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=i.get_session_replay_url({withTimestamp:!0}));var g,_=((l=o.exception)==null?void 0:l.values)||[],M=_.map(C=>f({},C,{stacktrace:C.stacktrace?f({},C.stacktrace,{type:"raw",frames:(C.stacktrace.frames||[]).map(I=>f({},I,{platform:"web:javascript"}))}):void 0})),T={$exception_message:((c=_[0])==null?void 0:c.value)||o.message,$exception_type:(u=_[0])==null?void 0:u.type,$exception_level:o.level,$exception_list:M,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:((h=_[0])==null?void 0:h.value)||o.message,$sentry_exception_type:(d=_[0])==null?void 0:d.type,$sentry_tags:o.tags};return t&&s&&(T.$sentry_url=(r||"https://sentry.io/organizations/")+t+"/issues/?project="+s+"&query="+o.event_id),a&&((g=i.exceptions)==null||g.sendExceptionEvent(T)),o}}class Wo{constructor(e,t,s,r,n,a){this.name=ua,this.setupOnce=function(o){o(ca(e,{organization:t,projectId:s,prefix:r,severityAllowList:n,sendExceptionsToPostHog:a==null||a}))}}}class Mr{constructor(e){this.cr=(t,s,r)=>{r&&(r.noSessionId||r.activityTimeout||r.sessionPastMaximumLength)&&(y.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:r}),this.dr=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.vr()}vr(){var e;this.pr=(e=this._instance.sessionManager)==null?void 0:e.onSessionId(this.cr)}destroy(){var e;(e=this.pr)==null||e.call(this),this.pr=void 0}doPageView(e,t){var s,r=this.gr(e,t);return this.dr={pathname:(s=v==null?void 0:v.location.pathname)!==null&&s!==void 0?s:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),r}doPageLeave(e){var t;return this.gr(e,(t=this.dr)==null?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.dr)==null?void 0:e.pageViewId}}gr(e,t){var s=this.dr;if(!s)return{$pageview_id:t};var r={$pageview_id:t,$prev_pageview_id:s.pageViewId},n=this._instance.scrollManager.getContext();if(n&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:a,lastScrollY:o,maxScrollY:l,maxContentHeight:c,lastContentY:u,maxContentY:h}=n;if(!(w(a)||w(o)||w(l)||w(c)||w(u)||w(h))){a=Math.ceil(a),o=Math.ceil(o),l=Math.ceil(l),c=Math.ceil(c),u=Math.ceil(u),h=Math.ceil(h);var d=a>1?Te(o/a,0,1,y):1,p=a>1?Te(l/a,0,1,y):1,g=c>1?Te(u/c,0,1,y):1,_=c>1?Te(h/c,0,1,y):1;r=z(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:p,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:g,$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:_})}}return s.pathname&&(r.$prev_pageview_pathname=s.pathname),s.timestamp&&(r.$prev_pageview_duration=(e.getTime()-s.timestamp.getTime())/1e3),r}}var Yo={[Un]:{exposure:"hidden"},[Rt]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[Ft]:{exposure:"hidden"},[gs]:{exposure:"event"}
1,[_s]:{exposure:"hidden"},[fs]:{exposure:"event"},[ms]:{exposure:"hidden"},[ys]:{exposure:"event"},[bs]:{exposure:"event"},[Ks]:{exposure:"event"},[ws]:{exposure:"hidden"},[xs]:{exposure:"event"},[Xe]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[ut]:{exposure:"hidden"},[Xs]:{exposure:"event"},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},[ct]:{exposure:"derived",shouldSkipFromEventProperties:(i,e)=>e(),transformToEventProperties(i){if(!Y(i))return{};for(var e={},t=Object.keys(i),s=0;t.length>s;s++)e["$feature/"+t[s]]=i[t[s]];return e}},[si]:{exposure:"event"},[It]:{exposure:"hidden"},[Es]:{exposure:"hidden"},[Ss]:{exposure:"event"},[ks]:{exposure:"event"},[Ae]:{exposure:"event"},[nt]:{exposure:"hidden"},[Ot]:{exposure:"hidden"},[Je]:{exposure:"hidden"},[Ps]:{exposure:"hidden"},[$s]:{exposure:"event"},[ri]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[Lt]:{exposure:"hidden"},[Ts]:{exposure:"hidden"},[Rs]:{exposure:"hidden"},[fi]:{exposure:"hidden"},[Se]:{exposure:"hidden"},[Fs]:{exposure:"hidden"},[Is]:{exposure:"hidden"},[Os]:{exposure:"hidden"},[Ms]:{exposure:"hidden"},[mi]:{exposure:"hidden"},[yi]:{exposure:"hidden"},[Hn]:{exposure:"event"},[Bn]:{exposure:"event"},[zn]:{exposure:"event"},[Vn]:{exposure:"event"},[Wn]:{exposure:"event"},[Yn]:{exposure:"event"},[Jn]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},Jo=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Si=i=>{var e=b==null?void 0:b.createElement("a");return w(e)?null:(e.href=i,e)},Bt=function(i,e){for(var t,s=((i.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;s.length>r;r++){var n=s[r].split("=");if(n[0]===e){t=n;break}}if(!q(t)||2>t.length)return"";var a=t[1];try{a=decodeURIComponent(a)}catch{y.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},zt=function(i,e,t){if(!i||!e||!e.length)return i;for(var s=i.split("#"),r=s[1],n=(s[0]||"").split("?"),a=n[1],o=n[0],l=(a||"").split("&"),c=[],u=0;l.length>u;u++){var h=l[u].split("=");q(h)&&(e.includes(h[0])?c.push(h[0]+"="+t):c.push(l[u]))}var d=o;return a!=null&&(d+="?"+c.join("&")),r!=null&&(d+="#"+r),d},ki=function(i,e){var t=i.match(new RegExp(e+"=([^&]*)"));return t?t[1]:null},ei="https?://(.*)",ft=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Ko=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...ft],Vt="<masked>",Xo=["li_fat_id"];function ha(i,e,t){if(!b)return{};var s,r=e?[...ft,...t||[]]:[],n=da(zt(b.URL,r,Vt),i),a=(s={},H(Xo,function(o){var l=$e.A(o);s[o]=l||null}),s);return z(a,n)}function da(i,e){var t=Ko.concat(e||[]),s={};return H(t,function(r){var n=Bt(i,r);s[r]=n||null}),s}function pa(i){var e=function(n){return n?n.search(ei+"google.([^/?]*)")===0?"google":n.search(ei+"bing.com")===0?"bing":n.search(ei+"yahoo.com")===0?"yahoo":n.search(ei+"duckduckgo.com")===0?"duckduckgo":null:null}(i),t=e!="yahoo"?"q":"p",s={};if(!_e(e)){s.$search_engine=e;var r=b?Bt(b.referrer,t):"";r.length&&(s.ph_keyword=r)}return s}function Cr(){return navigator.language||navigator.userLanguage}var Pi="$direct";function va(){return(b==null?void 0:b.referrer)||Pi}function ga(i,e){var t=i?[...ft,...e||[]]:[],s=ie==null?void 0:ie.href.substring(0,1e3);return{r:va().substring(0,1e3),u:s?zt(s,t,Vt):void 0}}function _a(i){var e,{r:t,u:s}=i,r={$referrer:t,$referring_domain:t==null?void 0:t==Pi?Pi:(e=Si(t))==null?void 0:e.host};
1if(s){r.$current_url=s;var n=Si(s);r.$host=n==null?void 0:n.host,r.$pathname=n==null?void 0:n.pathname;var a=da(s);z(r,a)}if(t){var o=pa(t);z(r,o)}return r}function fa(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function Zo(){try{return new Date().getTimezoneOffset()}catch{return}}var Qo=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class Vi{constructor(e,t){if(this.qt=e,this.props={},this.mr=!1,this.yr=(r=>{var n="";return r.token&&(n=r.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),r.persistence_name?"ph_"+r.persistence_name:"ph_"+n+"_posthog"})(e),this.nr=this.br(e),this.load(),e.debug&&y.info("Persistence loaded",e.persistence,f({},this.props)),this.update_config(e,e,t),this.save(),v){var s=()=>this.flush();K(v,"beforeunload",s,{capture:!1}),K(v,"pagehide",s,{capture:!1})}}_r(){var e,t=(e=this.qt)==null?void 0:e.persistence_save_debounce_ms;return me(t)&&t>0?t:0}isDisabled(){return!!this.wr}br(e){Qo.indexOf(e.persistence.toLowerCase())===-1&&(y.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=function(r,n){r===void 0&&(r=[]),n===void 0&&(n=!1);var a=[...Oo,...r];return f({},J,{F(o){try{var l={};try{l=$e.F(o)||{}}catch{}var c,u=JSON.parse(J.A(o)||"{}");if(n){var h={};for(var d in l){var p=l[d];_e(p)||p===""||(h[d]=p)}c=z(u,h)}else c=z(l,u);return J.N(o,c),c}catch{}return null},N(o,l,c,u,h,d){try{J.N(o,l,void 0,void 0,d);var p={};a.forEach(g=>{l[g]&&(p[g]=l[g])}),Object.keys(p).length&&$e.N(o,p,c,u,h,d)}catch(g){J.D(g)}},q(o,l){try{v==null||v.localStorage.removeItem(o),$e.q(o,l)}catch(c){J.D(c)}}})}(e.cookie_persisted_properties||[],e.__preview_cookie_wins_on_conflict||!1),s=e.persistence.toLowerCase();return s==="localstorage"&&J.O()?J:s==="localstorage+cookie"&&t.O()?t:s==="sessionstorage"&&se.O()?se:s==="memory"?Mo:s==="cookie"?$e:t.O()?t:$e}Sr(e){var t=e??this.qt.feature_flag_cache_ttl_ms;if(!t||0>=t)return!1;var s=this.props[fi];return!s||typeof s!="number"||Date.now()-s>t}properties(){var e={};return H(this.props,(t,s)=>{var r=(n=>{var a=Yo[n];if(a)return a;for(var[o,l]of Jo)if(n.indexOf(o)===0)return l})(s);if((r==null?void 0:r.exposure)==="derived"){if(r.shouldSkipFromEventProperties!=null&&r.shouldSkipFromEventProperties(t,s===ct?()=>this.Sr():()=>!1))return;r.transformToEventProperties&&z(e,r.transformToEventProperties(t))}else r&&r.exposure!=="event"||(e[s]=t)}),e}load(){if(!this.wr){var e=this.nr.F(this.yr);e&&(this.props=z({},e))}}refreshKey(e){if(!this.wr){var t=this.nr.F(this.yr);t&&e in t?this.kr(e,t[e]):this.Cr(e)}}save(){if(!this.wr){var e=this._r();e>0?w(this.Ir)&&(this.Ir=setTimeout(()=>{this.Ir=void 0,this.Tr()},e)):this.Tr()}}flush(){w(this.Ir)||(clearTimeout(this.Ir),this.Ir=void 0,this.Tr())}Tr(){if(!this.wr){try{var e=JSON.stringify(this.props)+"|"+this.Er+"|"+this.Mr+"|"+this.Rr;if(e===this.Pr)return;this.Pr=e}catch{}this.nr.N(this.yr,this.props,this.Er,this.Mr,this.Rr,this.qt.debug)}}remove(){w(this.Ir)||(clearTimeout(this.Ir),this.Ir=void 0),this.nr.q(this.yr,!1),this.nr.q(this.yr,!0),this.Pr=void 0}clear(){this.remove(),this.props={}}register_once(e,t,s){if(Y(e)){w(t)&&(t="None"),this.Er=w(s)?this.Or:s;var r=!1;if(H(e,(n,a)=>{this.props.hasOwnProperty(a)&&this.props[a]!==t||(this.kr(a,n),r=!0)}),r)return this.save(),!0}return!1}register(e,t){if(Y(e)){this.Er=w(t)?this.Or:t;var s=!1;if(H(e,(r,n)=>{e.hasOwnProperty(n)&&this.props[n]!==r&&(this.kr(n,r),s=!0)}),s)return this.save(),!0}return!1}unregister(e){e in this.props&&(this.Cr(e),this.save())}update_campaign_params(){if(!this.mr){var e=ha(this.qt.custom_campaign_params,this.qt.mask_personal_data_properties,this.qt.custom_personal_data_properties);lt(Qs(e))||this.register(e),this.mr=!0}}update_search_keyword(){var e;this.register((e=b==null?void 0:b.referrer)?pa(e):{})}update_referrer_info(){var e;this.register_once({$referrer:va(),$referring_domain:b!=null&&b.referrer&&((e=Si(b.referrer))==null?void 0:e.host)||Pi},void 0)}set_initial_person_info(){this.props[Os]||this.props[Ms]||this.register_once({[mi]:ga(this.qt.mask_personal_data_properties,this.qt.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};H([Ms,Os],a=>{var o=this.props[a];o&&H(o,function(l,c){e["$initial_"+ls(c)]=l})});var t,s,r=this.props[mi];if(r){var n=(t=_a(r),s={},H(t,function(a,o){s["$initial_"+ls(o)]=a}),s);z(e,n)}return e}safe_merge(e){return H(this.props,function(t,s){s in e||(e[s]=t)}),e}
1update_config(e,t,s){if(this.Or=this.Er=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!s),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence||!((a,o)=>{if(a.length!==o.length)return!1;var l=[...a].sort(),c=[...o].sort();return l.every((u,h)=>u===c[h])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[])){var r=this.br(e),n=this.props;this.clear(),this.nr=r,this.props=n,this.save()}}set_disabled(e){this.wr=e,this.wr?this.remove():this.save()}set_cross_subdomain(e){e!==this.Mr&&(this.Mr=e,this.remove(),this.save())}set_secure(e){e!==this.Rr&&(this.Rr=e,this.remove(),this.save())}set_event_timer(e,t){var s=this.props[Ft]||{};s[e]=t,this.kr(Ft,s),this.save()}remove_event_timer(e){var t=this.props[Ft]||{},s=t[e];return w(s)||(delete t[e],this.kr(Ft,t),this.save()),s}get_property(e){return this.props[e]}set_property(e,t){this.kr(e,t),this.save()}kr(e,t){this.props[e]=t}Cr(e){delete this.props[e]}}var wt={Activation:"events",Cancellation:"cancelEvents"},Gl={Button:"button",Tab:"tab",Selector:"selector"},Wl={TopLeft:"top_left",TopRight:"top_right",TopCenter:"top_center",MiddleLeft:"middle_left",MiddleRight:"middle_right",MiddleCenter:"middle_center",Left:"left",Center:"center",Right:"right",NextToTrigger:"next_to_trigger"},Yl={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},Gi={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},Jl={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},Kl={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},Xl={Once:"once",Recurring:"recurring",Always:"always"},Mt={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Wi={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date",SURVEY_LANGUAGE:"$survey_language"},Ls={Popover:"popover",Inline:"inline"},Zl={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1,dismissOnClickOutside:!0,zIndex:2147483646},el={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},Ar={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},Lr=G("[RateLimiter]");class tl{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var s=t.text;
1if(s&&s.length)try{(JSON.parse(s).quota_limited||[]).forEach(r=>{Lr.info((r||"events")+" is quota limited."),this.serverLimits[r]=new Date().getTime()+6e4})}catch(r){return void Lr.warn('could not rate limit - continuing. Error: "'+(r==null?void 0:r.message)+'"',{text:s})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)==null?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)==null?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var t,s,r;e===void 0&&(e=!1);var{captureEventsBurstLimit:n,captureEventsPerSecond:a}=this,o=new Date().getTime(),l=(t=(s=this.instance.persistence)==null?void 0:s.get_property(Is))!==null&&t!==void 0?t:{tokens:n,last:o};l.tokens+=(o-l.last)/1e3*a,l.last=o,l.tokens>n&&(l.tokens=n);var c=1>l.tokens;return c||e||(l.tokens=Math.max(0,l.tokens-1)),!c||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+a+" events per second and "+n+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=c,(r=this.instance.persistence)==null||r.set_property(Is,l),{isRateLimited:c,remainingTokens:l.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}}var xt=G("[RemoteConfig]");class ma{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=$._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}Lr(e){var t,s;(t=$.__PosthogExtensions__)!=null&&t.loadExternalDependency?(s=$.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):e()}Fr(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 xt.info("Using preloaded remote config",this.remoteConfig),this.Ar(this.remoteConfig),void this.Nr();if(this._instance.Dr())return void xt.warn("Remote config is disabled. Falling back to local config.");this.Lr(e=>{if(!e)return xt.info("No config found after loading remote JS config. Falling back to JSON."),void this.Fr(t=>{this.Ar(t),this.Nr()});this.Ar(e),this.Nr()})}catch(e){xt.error("Error loading remote config",e)}}stop(){this.$r&&(clearInterval(this.$r),this.$r=void 0)}refresh(){!this._instance.Dr()&&b&&b.visibilityState!=="hidden"&&this._instance.reloadFeatureFlags()}Nr(){var e;if(!this.$r){var t=(e=this._instance.config.remote_config_refresh_interval_ms)!==null&&e!==void 0?e:3e5;t!==0&&(this.$r=setInterval(()=>{this.refresh()},t))}}Ar(e){var t;e||xt.error("Failed to fetch remote config from PostHog."),this._instance.Ar(e??{}),(e==null?void 0:e.hasFeatureFlags)!==!1&&(this._instance.config.advanced_disable_feature_flags_on_first_load||(t=this._instance.featureFlags)==null||t.ensureFlagsLoaded())}}var Ql=["fatal","error","warning","log","info","debug"],Pe={GZipJS:"gzip-js",Base64:"base64"},xe=Uint8Array,ce=Uint16Array,mt=Uint32Array,sr=new xe([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]),rr=new xe([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]),qr=new xe([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ya=function(i,e){for(var t=new ce(31),s=0;31>s;++s)t[s]=e+=1<<i[s-1];var r=new mt(t[30]);for(s=1;30>s;++s)for(var n=t[s];t[s+1]>n;++n)r[n]=n-t[s]<<5|s;return[t,r]},ba=ya(sr,2),qs=ba[1];ba[0][28]=258,qs[258]=28;for(var Dr=ya(rr,0)[1],wa=new ce(32768),B=0;32768>B;++B){var it=(43690&B)>>>1|(21845&B)<<1;wa[B]=((65280&(it=(61680&(it=(52428&it)>>>2|(13107&it)<<2))>>>4|(3855&it)<<4))>>>8|(255&it)<<8)>>>1}var Dt=function(i,e,t){for(var s=i.length,r=0,n=new ce(e);s>r;++r)++n[i[r]-1];var a,o=new ce(e);for(r=0;e>r;++r)o[r]=o[r-1]+n[r-1]<<1;for(a=new ce(s),r=0;s>r;++r)a[r]=wa[o[i[r]-1]++]>>>15-i[r];return a},Qe=new xe(288);for(B=0;144>B;++B)Qe[B]=8;for(B=144;256>B;++B)Qe[B]=9;for(B=256;280>B;++B)Qe[B]=7;for(B=280;288>B;++B)Qe[B]=8;var $i=new xe(32);for(B=0;32>B;++B)$i[B]=5;var il=Dt(Qe,9),sl=Dt($i,5),xa=function(i){return(i/8>>0)+(7&i&&1)},Ea=function(i,e,t){(t==null||t>i.length)&&(t=i.length);var s=new(i instanceof ce?ce:i instanceof mt?mt:xe)(t-e);return s.set(i.subarray(e,t)),s},Ie=function(i,e,t){var s=e/8>>0;i[s]|=t<<=7&e,i[s+1]|=t>>>8},Et=function(i,e,t){var s=e/8>>0;i[s]|=t<<=7&e,i[s+1]|=t>>>8,i[s+2]|=t>>>16},Yi=function(i,e){for(var t=[],s=0;i.length>s;++s)i[s]&&t.push({s,f:i[s]});var r=t.length,n=t.slice();if(!r)return[new xe(0),0];if(r==1){var a=new xe(t[0].s+1);return a[t[0].s]=1,[a,1]}t.sort(function(E,P){return E.f-P.f}),t.push({s:-1,f:25001});var o=t[0],l=t[1],c=0,u=1,h=2;for(t[0]={s:-1,f:o.f+l.f,l:o,r:l};u!=r-1;)o=t[t[h].f>t[c].f?c++:h++],l=t[c!=u&&t[h].f>t[c].f?c++:h++],t[u++]={s:-1,f:o.f+l.f,l:o,r:l};var d=n[0].s;for(s=1;r>s;++s)n[s].s>d&&(d=n[s].s);var p=new ce(d+1),g=Ds(t[u-1],p,0);if(g>e){s=0;var _=0,M=g-e,T=1<<M;for(n.sort(function(E,P){return p[P.s]-p[E.s]||E.f-P.f});r>s;++s){var C=n[s].s;if(e>=p[C])break;_+=T-(1<<g-p[C]),p[C]=e}for(_>>>=M;_>0;){var I=n[s].s;e>p[I]?_-=1<<e-p[I]++-1:++s}for(;s>=0&&_;--s){var R=n[s].s;p[R]==e&&(--p[R],++_)}g=e}return[new xe(p),g]},Ds=function(i,e,t){return i.s==-1?Math.max(Ds(i.l,e,t+1),Ds(i.r,e,t+1)):e[i.s]=t},Nr=function(i){for(var e=i.length;e&&!i[--e];);for(var t=new ce(++e),s=0,r=i[0],n=1,a=function(l){t[s++]=l},o=1;e>=o;++o)if(i[o]==r&&o!=e)++n;else{if(!r&&n>2){for(;n>138;n-=138)a(32754);n>2&&(a(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(a(r),--n;n>6;n-=6)a(8304);n>2&&(a(n-3<<5|8208),n=0)}for(;n--;)a(r);n=1,r=i[o]}return[t.subarray(0,s),e]},St=function(i,e){for(var t=0,s=0;e.length>s;++s)t+=i[s]*e[s];return t},Ns=function(i,e,t){var s=t.length,r=xa(e+2);i[r]=255&s,i[r+1]=s>>>8,i[r+2]=255^i[r],i[r+3]=255^i[r+1];for(var n=0;s>n;++n)i[r+n+4]=t[n];return 8*(r+4+s)},jr=function(i,e,t,s,r,n,a,o,l,c,u){Ie(e,u++,t),++r[256];for(var h=Yi(r,15),d=h[0],p=h[1],g=Yi(n,15),_=g[0],M=g[1],T=Nr(d),C=T[0],I=T[1],R=Nr(_),E=R[0],P=R[1],S=new ce(19),x=0;C.length>x;++x)S[31&C[x]]++;for(x=0;E.length>x;++x)S[31&E[x]]++;for(var m=Yi(S,7),k=m[0],F=m[1],L=19;L>4&&!k[qr[L-1]];--L);var A,N,j,ee,he=c+5<<3,oe=St(r,Qe)+St(n,$i)+a,X=St(r,d)+St(n,_)+a+14+3*L+St(S,k)+(2*S[16]+3*S[17]+7*S[18]);if(oe>=he&&X>=he)return Ns(e,u,i.subarray(l,l+c));if(Ie(e,u,1+(oe>X)),u+=2,oe>X){A=Dt(d,p),N=d,j=Dt(_,M),ee=_;var de=Dt(k,F);for(Ie(e,u,I-257),Ie(e,u+5,P-1),Ie(e,u+10,L-4),u+=14,x=0;L>x;++x)Ie(e,u+3*x,k[qr[x]]);u+=3*L;for(var ne=[C,E],ke=0;2>ke;++ke){var ye=ne[ke];for(x=0;ye.length>x;++x)Ie(e,u,de[ae=31&ye[x]]),u+=k[ae],ae>
vendor: 1,514 bytes, line 1
115&&(Ie(e,u,ye[x]>>>5&127),u+=ye[x]>>>12)}}else A=il,N=Qe,j=sl,ee=$i;for(x=0;o>x;++x)if(s[x]>255){var ae;Et(e,u,A[257+(ae=s[x]>>>18&31)]),u+=N[ae+257],ae>7&&(Ie(e,u,s[x]>>>23&31),u+=sr[ae]);var le=31&s[x];Et(e,u,j[le]),u+=ee[le],le>3&&(Et(e,u,s[x]>>>5&8191),u+=rr[le])}else Et(e,u,A[s[x]]),u+=N[s[x]];return Et(e,u,A[256]),u+N[256]},rl=new mt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),nl=function(){for(var i=new mt(256),e=0;256>e;++e){for(var t=e,s=9;--s;)t=(1&t&&3988292384)^t>>>1;i[e]=t}return i}(),Ji=function(i,e,t){for(;t;++e)i[e]=t,t>>>=8};function al(i,e){e===void 0&&(e={});var t=function(){var h=4294967295;return{p(d){for(var p=h,g=0;d.length>g;++g)p=nl[255&p^d[g]]^p>>>8;h=p},d(){return 4294967295^h}}}(),s=i.length;t.p(i);var r,n,a,o,l,c=(o=10+((r=e).filename&&r.filename.length+1||0),l=8,function(h,d,p,g,_,M){var T=h.length,C=new xe(g+T+5*(1+Math.floor(T/7e3))+_),I=C.subarray(g,C.length-_),R=0;if(!d||8>T)for(var E=0;T>=E;E+=65535){var P=E+65535;T>P?R=Ns(I,R,h.subarray(E,P)):(I[E]=!0,R=Ns(I,R,h.subarray(E,T)))}else{for(var S=rl[d-1],x=S>>>13,m=8191&S,k=(1<<p)-1,F=new ce(32768),L=new ce(k+1),A=Math.ceil(p/3),N=2*A,j=function(Ci){return(h[Ci]^h[Ci+1]<<A^h[Ci+2]<<N)&k},ee=new mt(25e3),he=new ce(288),oe=new ce(32),X=0,de=0,ne=(E=0,0),ke=0,ye=0;T>E;++E){var ae=j(E),le=32767&E,Fe=L[ae];if(F[le]=Fe,L[ae]=le,E>=ke){var Gt=T-E;if((X>7e3||ne>24576)&&Gt>423){R=jr(h,I,0,ee,he,oe,de,ne,ye,E-ye,R),ne=X=de=0,ye=E;for(var Ee=0;286>Ee;++Ee)he[Ee]=0;for(Ee=0;30>Ee;++Ee)oe[Ee]=0}
1var ze=2,Wt=0,Fa=m,Ne=le-Fe&32767;if(Gt>2&&ae==j(E-Ne))for(var Ia=Math.min(x,Gt)-1,Oa=Math.min(32767,E),Ma=Math.min(258,Gt);Oa>=Ne&&--Fa&&le!=Fe;){if(h[E+ze]==h[E+ze-Ne]){for(var je=0;Ma>je&&h[E+je]==h[E+je-Ne];++je);if(je>ze){if(ze=je,Wt=Ne,je>Ia)break;var Ca=Math.min(Ne,je-2),ar=0;for(Ee=0;Ca>Ee;++Ee){var Mi=E-Ne+Ee+32768&32767,or=Mi-F[Mi]+32768&32767;or>ar&&(ar=or,Fe=Mi)}}}Ne+=(le=Fe)-(Fe=F[le])+32768&32767}if(Wt){ee[ne++]=268435456|qs[ze]<<18|Dr[Wt];var lr=31&qs[ze],ur=31&Dr[Wt];de+=sr[lr]+rr[ur],++he[257+lr],++oe[ur],ke=E+ze,++X}else ee[ne++]=h[E],++he[h[E]]}}R=jr(h,I,!0,ee,he,oe,de,ne,ye,E-ye,R)}return Ea(C,0,g+xa(R)+_)}(n=i,(a=e).level==null?6:a.level,a.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+a.mem,o,l)),u=c.length;return function(h,d){var p=d.filename;if(h[0]=31,h[1]=139,h[2]=8,h[8]=2>d.level?4:d.level==9?2:0,h[9]=3,d.mtime!=0&&Ji(h,4,Math.floor(new Date(d.mtime||Date.now())/1e3)),p){h[3]=8;for(var g=0;p.length>=g;++g)h[g+10]=p.charCodeAt(g)}}(c,e),Ji(c,u-8,t.d()),Ji(c,u-4,s),c}var ol=!!ns||!!rs,Sa="text/plain",ai=!1,ll=(i,e)=>{var[t,s]=i.split("#"),[r,n]=t.split("?");if(!n)return i;var a=n.split("&").filter(o=>o.split("=")[0]!==e).join("&");return r+(a?"?"+a:"")+(s?"#"+s:"")},Ii=function(i,e,t){var s;t===void 0&&(t=!0);var[r,n]=i.split("?"),a=f({},e),o=(s=n==null?void 0:n.split("&").map(c=>{var u,[h,d]=c.split("="),p=t&&(u=a[h])!==null&&u!==void 0?u:d;return delete a[h],h+"="+p}))!==null&&s!==void 0?s:[],l=function(c,u){var h,d;u===void 0&&(u="&");var p=[];return H(c,function(g,_){w(g)||w(_)||_==="undefined"||(h=encodeURIComponent((M=>M instanceof File)(g)?g.name:g.toString()),d=encodeURIComponent(_),p[p.length]=d+"="+h)}),p.join(u)}(a);return l&&o.push(l),r+"?"+o.join("&")},ht=(i,e)=>JSON.stringify(i,(t,s)=>typeof s=="bigint"?s.toString():s,e),Ur=i=>{if(i.tr)return i.tr;var{data:e,compression:t}=i;if(e){if(t===Pe.GZipJS){var s=al(function(o,l){var c=o.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(o);for(var u=new xe(o.length+(o.length>>>1)),h=0,d=function(M){u[h++]=M},p=0;c>p;++p){if(h+5>u.length){var g=new xe(h+8+(c-p<<1));g.set(u),u=g}var _=o.charCodeAt(p);128>_?d(_):2048>_?(d(192|_>>>6),d(128|63&_)):_>55295&&57344>_?(d(240|(_=65536+(1047552&_)|1023&o.charCodeAt(++p))>>>18),d(128|_>>>12&63),d(128|_>>>6&63),d(128|63&_)):(d(224|_>>>12),d(128|_>>>6&63),d(128|63&_))}return Ea(u,0,h)}(ht(e)),{mtime:0});return{contentType:Sa,body:s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength),estimatedSize:s.byteLength}}if(t===Pe.Base64){var r=function(o){return o&&btoa(encodeURIComponent(o).replace(/%([0-9A-F]{2})/g,(l,c)=>String.fromCharCode(parseInt(c,16))))}(ht(e)),n=(o=>"data="+encodeURIComponent(typeof o=="string"?o:ht(o)))(r);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var a=ht(e);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},Ki=i=>{var e,t,s,r=Ur(i);return!r||(t=i.compression,s=Bt(i.url,"compression"),t!==pr.GZipJS&&s!==pr.GZipJS&&s!=="gzip")||((e=r.body)instanceof ArrayBuffer?as(new Uint8Array(e)):ArrayBuffer.isView(e)&&as(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)))?{url:i.url,encodedBody:r}:(ai=!0,{url:ll(i.url,"compression"),encodedBody:Ur(f({},i,{compression:void 0,tr:void 0}))})},ul=function(){var i=pe(function*(e){var t=ht(e.data),s=yield function(n,a,o){return os.apply(this,arguments)}(t,Q.DEBUG,{rethrow:!0});if(!s)return e;var r=yield s.arrayBuffer();return f({},e,{tr:{contentType:Sa,body:r,estimatedSize:r.byteLength}})});return function(e){return i.apply(this,arguments)}}(),Hr=(i,e)=>Ii(i,{_:new Date().getTime().toString(),ver:Q.JS_SDK_VERSION,compression:e}),oi=[];rs&&oi.push({transport:"fetch",method(i){var e,{url:t,encodedBody:s}=Ki(i),{contentType:r,body:n,estimatedSize:a}=s??{},o=new Headers;H(i.headers,function(u,h){o.append(h,u)}),r&&o.append("Content-Type",r);var l=null;if(cr){var c=new cr;l={signal:c.signal,timeout:setTimeout(()=>c.abort(),i.timeout)}}rs(t,f({method:(i==null?void 0:i.method)||"GET",headers:o,keepalive:i.method==="POST"&&52428.8>(a||0),body:n,signal:(e=l)==null?void 0:e.signal},i.fetchOptions)).then(u=>u.text().then(h=>{var d={statusCode:u.status,text:h};if(u.status===200)try{d.json=JSON.parse(h)}catch(p){y.error(p)}i.callback==null||i.callback(d)})).catch(u=>{y.error(u),i.callback==null||i.callback({statusCode:0,error:u})}).finally(()=>l?clearTimeout(l.timeout):null)}}),ns&&oi.push({transport:"XHR",method(i){var e=new ns,{url:t,encodedBody:s}=Ki(i);e.open(i.method||"GET",t,!0);var{contentType:r,body:n}=s??{};H(i.headers,function(a,o){e.setRequestHeader(o,a)}),r&&e.setRequestHeader("Content-Type",r),i.timeout&&(e.timeout=i.timeout),i.disableXHRCredentials||(e.withCredentials=!0),e.onreadystatechange=()=>{if(e.readyState===4){var a={statusCode:e.status,text:e.responseText};if(e.status===200)try{a.json=JSON.parse(e.responseText)}catch{}i.callback==null||i.callback(a)}},e.send(n)}}),ve!=null&&ve.sendBeacon&&oi.push({transport:"sendBeacon",method(i){try{var{url:e,encodedBody:t}=Ki(i),s=Ii(e,{beacon:"1"}),{contentType:r,body:n}=t??{};if(!n)return;var a=n instanceof Blob?n:new Blob([n],{type:r});ve.sendBeacon(s,a)}catch{}}});var js=3e3;class cl{constructor(e,t){this.qr=!0,this.jr=[],this.Hr=Te((t==null?void 0:t.flush_interval_ms)||js,250,5e3,y.createLogger("flush interval"),js),this.Ur=e}enqueue(e){this.jr.push(e),this.Br||this.zr()}unload(){this.Vr();var e=this.jr.length>0?this.Wr():{},t=Object.values(e);[...t.filter(s=>s.url.indexOf("/e")===0),...t.filter(s=>s.url.indexOf("/e")!==0)].map(s=>{this.Ur(f({},s,{transport:"sendBeacon"}))})}enable(){this.qr=!1,this.zr()}zr(){var e=this;this.qr||(this.Br=setTimeout(()=>{if(this.Vr(),this.jr.length>0){var t=this.Wr(),s=function(){var n=t[r],a=new Date().getTime();n.data&&q(n.data)&&H(n.data,o=>{o.offset=Math.abs(o.timestamp-a),delete o.timestamp}),e.Ur(n)};for(var r in t)s()}},this.Hr))}Vr(){clearTimeout(this.Br),this.Br=void 0}Wr(){var e={};return H(this.jr,t=>{var s,r=t,n=(r?r.batchKey:null)||r.url;w(e[n])&&(e[n]=f({},r,{data:[]})),(s=e[n].data)==null||s.push(r.data)}),this.jr=[],e}}var hl=["retriesPerformedSoFar"];class dl{constructor(e){this.Zr=!1,this.Gr=3e3,this.jr=[],this._instance=e,this.jr=[],this.Qr=!0,!w(v)&&"onLine"in v.navigator&&(this.Qr=v.navigator.onLine,this.Jr=()=>{this.Qr=!0,this.Kr()},this.Yr=()=>{this.Qr=!1},K(v,"online",this.Jr),K(v,"offline",this.Yr))}get length(){return this.jr.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,s=dn(e,hl);Ce(t)&&(s.url=Ii(s.url,{retry_count:t})),this._instance._send_request(f({},s,{callback:r=>{r.statusCode===200||r.statusCode>=400&&500>r.statusCode||(t??0)>=10?s.callback==null||s.callback(r):this.Xr(f({retriesPerformedSoFar:t},s))}}))}Xr(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var s=function(a){var o=3e3*Math.pow(2,a),l=o/2,c=Math.min(18e5,o),u=Math.random()-.5;return Math.ceil(c+u*(c-l))}(t),r=Date.now()+s;this.jr.push({retryAt:r,requestOptions:e});var n="Enqueued failed request for retry in "+s;navigator.onLine||(n+=" (Browser is offline)"),y.warn(n),this.Zr||(this.Zr=!0,this.ei())}ei(){if(this.ti&&clearTimeout(this.ti),this.jr.length===0)return this.Zr=!1,void(this.ti=void 0);this.ti=setTimeout(()=>{this.Qr&&this.jr.length>0&&this.Kr(),this.ei()},this.Gr)}Kr(){var e=Date.now(),t=[],s=this.jr.filter(n=>e>n.retryAt||(t.push(n),!1));if(this.jr=t,s.length>0)for(var{requestOptions:r}of s)this.retriableRequest(r)}unload(){for(var{requestOptions:e}of(this.ti&&(clearTimeout(this.ti),this.ti=void 0),this.Zr=!1,w(v)||(this.Jr&&(v.removeEventListener("online",this.Jr),this.Jr=void 0),this.Yr&&(v.removeEventListener("offline",this.Yr),this.Yr=void 0)),this.jr))try{this._instance._send_request(f({},e,{transport:"sendBeacon"}))}catch(t){y.error(t)}this.jr=[]}}class pl{constructor(e){this.ri=()=>{var t,s,r,n;this.ii||(this.ii={});var a=this.scrollElement(),o=this.scrollY(),l=a?Math.max(0,a.scrollHeight-a.clientHeight):0,c=o+((a==null?void 0:a.clientHeight)||0),u=(a==null?void 0:a.scrollHeight)||0;this.ii.lastScrollY=Math.ceil(o),this.ii.maxScrollY=Math.max(o,(t=this.ii.maxScrollY)!==null&&t!==void 0?t:0),this.ii.maxScrollHeight=Math.max(l,(s=this.ii.maxScrollHeight)!==null&&s!==void 0?s:0),this.ii.lastContentY=c,this.ii.maxContentY=Math.max(c,(r=this.ii.maxContentY)!==null&&r!==void 0?r:0),this.ii.maxContentHeight=Math.max(u,(n=this.ii.maxContentHeight)!==null&&n!==void 0?n:0)},this._instance=e}get ni(){return this._instance.config.scroll_root_selector}getContext(){return this.ii}resetContext(){var e=this.ii;return setTimeout(this.ri,0),e}startMeasuringScrollPosition(){K(v,"scroll",this.ri,{capture:!0}),K(v,"scrollend",this.ri,{capture:!0}),K(v,"resize",this.ri)}scrollElement(){if(!this.ni)return v==null?void 0:v.document.documentElement;var e=q(this.ni)?this.ni:[this.ni];for(var t of e){var s=v==null?void 0:v.document.querySelector(t);if(s)return s}}scrollY(){if(this.ni){var e=this.scrollElement();return e&&e.scrollTop||0}return v&&(v.scrollY||v.pageYOffset||v.document.documentElement.scrollTop)||0}scrollX(){if(this.ni){var e=this.scrollElement();return e&&e.scrollLeft||0}return v&&(v.scrollX||v.pageXOffset||v.document.documentElement.scrollLeft)||0}}var vl=i=>ga(i==null?void 0:i.config.mask_personal_data_properties,i==null?void 0:i.config.custom_personal_data_properties);class Br{constructor(e,t,s,r){this.si=n=>{var a=this.oi();if(!a||a.sessionId!==n){var o={sessionId:n,props:this.ai(this._instance)};this.ui.register({[Fs]:o})}},this._instance=e,this.li=t,this.ui=s,this.ai=r||vl,this.li.onSessionId(this.si)}oi(){return this.ui.props[Fs]}getSetOnceProps(){var e,t=(e=this.oi())==null?void 0:e.props;return t?"r"in t?_a(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 H(Qs(this.getSetOnceProps()),(t,s)=>{s==="$current_url"&&(s="url"),e["$session_entry_"+ls(s)]=t}),e}}class nr{constructor(){this.hi={}}on(e,t){return this.hi[e]||(this.hi[e]=[]),this.hi[e].push(t),()=>{this.hi[e]=this.hi[e].filter(s=>s!==t)}}emit(e,t){for(var s of this.hi[e]||[])s(t);for(var r of this.hi["*"]||[])r(e,t)}}var Xi=G("[SessionId]");class zr{on(e,t){return this.ci.on(e,t)}constructor(e,t,s){var r;if(this.di=null,this.vi=[],this.fi=void 0,this.ci=new nr,this.pi=(c,u)=>!(!Ce(c)||!Ce(u))&&Math.abs(c-u)>
1this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===qe)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.qt=e.config,this.ui=e.persistence,this.gi=void 0,this.mi=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.yi=t||He,this.bi=s||He;var n=this.qt.persistence_name||this.qt.token;if(this._sessionTimeoutMs=1e3*Te(this.qt.session_idle_timeout_seconds||1800,60,36e3,Xi.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.wi(),this.xi="ph_"+n+"_window_id",this.Si="ph_"+n+"_primary_window_exists",this.ki()){var a=se.F(this.xi),o=se.F(this.Si);a&&!o?this.gi=a:se.q(this.xi),se.N(this.Si,!0)}if((r=this.qt.bootstrap)!=null&&r.sessionID)try{var l=(c=>{var u=this.qt.bootstrap.sessionID.replace(/-/g,"");if(u.length!==32)throw new Error("Not a valid UUID");if(u[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(u.substring(0,12),16)})();this.Ci(this.qt.bootstrap.sessionID,new Date().getTime(),l)}catch(c){Xi.error("Invalid sessionID in bootstrap",c)}this.Ii()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return w(this.vi)&&(this.vi=[]),this.vi.push(e),this.mi&&e(this.mi,this.gi),()=>{this.vi=this.vi.filter(t=>t!==e)}}ki(){return this.qt.persistence!=="memory"&&!this.ui.wr&&se.O()}Ti(e){e!==this.gi&&(this.gi=e,this.ki()&&se.N(this.xi,e))}Ei(){return this.gi?this.gi:this.ki()?se.F(this.xi):null}Mi(e){var t=this.di;return!_e(t)&&!_e(e)&&5e3>Math.abs(e-t)}Ci(e,t,s){var r=t!==this._sessionActivityTimestamp,n=!(e!==this.mi||s!==this._sessionStartTimestamp);this._sessionStartTimestamp=s,this._sessionActivityTimestamp=t,this.mi=e,n&&!r||n&&this.Mi(t)||(this.di=t,this.ui.register({[ut]:[t,e,s]}))}Ri(){var e,t=(e=this.qt)==null?void 0:e.persistence_save_debounce_ms;return Ce(t)&&t>0}Pi(){var e;if(!_e(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.di){this.Ri()?this.ui.refreshKey(ut):(this.ui.flush(),this.ui.load());var[,t,s]=this.Oi();t===this.mi&&s===this._sessionStartTimestamp&&(this.di=this._sessionActivityTimestamp,this.ui.register({[ut]:[this._sessionActivityTimestamp,(e=this.mi)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.ui.flush())}}Li(){var[e]=this.Oi(),t=Ce(e)?e:0,s=Ce(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,s)}Oi(){var e=this.ui.props[ut];return q(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.di=null,clearTimeout(this.Fi),this.Fi=void 0,this.Ci(null,null,null)}destroy(){this.Pi(),clearTimeout(this.Fi),this.Fi=void 0,this.fi&&v&&(v.removeEventListener(wi,this.fi,{capture:!1}),this.fi=void 0),this.vi=[]}Ii(){this.fi=()=>{this.Pi(),this.ki()&&se.q(this.Si)},K(v,wi,this.fi,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(e===void 0&&(e=!1),t===void 0&&(t=null),this.qt.cookieless_mode===qe)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var s=t||new Date().getTime(),[,r,n]=this.Oi(),a=this.Li(),o=this.Ei(),l=Ce(n)&&Math.abs(s-n)>864e5,c=!1,u=!r,h=!u&&!e&&this.pi(s,a);u||h||l?(r=this.yi(),o=this.bi(),Xi.info("new session ID generated",{sessionId:r,windowId:o,changeReason:{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:l}}),n=s,c=!0):o||(o=this.bi(),c=!0);var d=Ce(a)&&e&&!l?a:s,p=Ce(n)?n:new Date().getTime();return this.Ti(o),this.Ci(r,d,p),e||this.wi(),c&&this.vi.forEach(g=>g(r,o,c?{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:l}:void 0)),{sessionId:r,windowId:o,sessionStartTimestamp:p,changeReason:c?{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:l}:void 0,lastActivityTimestamp:a}}wi(){clearTimeout(this.Fi),this.Fi=setTimeout(()=>{var e=this.Li();if(this.pi(new Date().getTime(),e)){var t=this.mi;this.resetSessionId(),this.ci.emit("forcedIdleReset",{idleSessionId:t})}},1.1*this.sessionTimeoutMs)}}var ka=function(i,e){if(!i)return!1;var t=i.userAgent;if(t&&gr(t,e))return!0;try{var s=i==null?void 0:i.userAgentData;if(s!=null&&s.brands&&s.brands.some(r=>gr(r==null?void 0:r.brand,e)))return!0}catch{}return!!i.webdriver},Ti=function(i,e){if(!function(t){try{new RegExp(t)}catch{return!1}return!0}(e))return!1;try{return new RegExp(e).test(i)}catch{return!1}};function Vr(i,e,t){return ht({distinct_id:i,userPropertiesToSet:e,userPropertiesToSetOnce:t})}var Pa={exact:(i,e)=>e.some(t=>i.some(s=>t===s)),is_not:(i,e)=>e.every(t=>i.every(s=>t!==s)),regex:(i,e)=>e.some(t=>i.some(s=>Ti(t,s))),not_regex:(i,e)=>e.every(t=>i.every(s=>!Ti(t,s))),icontains:(i,e)=>e.map(ti).some(t=>i.map(ti).some(s=>t.includes(s))),not_icontains:(i,e)=>e.map(ti).every(t=>i.map(ti).every(s=>!t.includes(s))),gt:(i,e)=>e.some(t=>{var s=parseFloat(t);return!isNaN(s)&&i.some(r=>s>parseFloat(r))}),lt:(i,e)=>e.some(t=>{var s=parseFloat(t);return!isNaN(s)&&i.some(r=>s<parseFloat(r))})},ti=i=>i.toLowerCase();function $a(i,e){return!i||Object.entries(i).every(t=>{var[s,r]=t,n=e==null?void 0:e[s];if(w(n)||_e(n))return!1;var a=[String(n)],o=Pa[r.operator];return!!o&&o(r.values,a)})}var Us="custom",Gr="i.posthog.com",gl=/^\/static\//;class _l{constructor(e){this.Ai={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"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=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+Gr,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.Ai[this.apiHost]||(this.Ai[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":Us),this.Ai[this.apiHost]}Ni(e){var t=this.instance.config.__preview_external_dependency_versioned_paths;if(typeof t=="string"&&gl.test(e))return t.trim().replace(/\/$/,"")||void 0}endpointFor(e,t){if(t===void 0&&(t=""),t&&(t=t[0]==="/"?t:"/"+t),e==="ui")return this.uiHost+t;if(e==="flags")return this.flagsApiHost+t;if(e==="assets"){var s=this.Ni(t);if(s)return""+s+t}if(this.region===Us)return this.apiHost+t;var r=Gr+t;switch(e){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}}var U=G("[Surveys]"),Hs="seenSurvey_",fl=[Gi.Popover,Gi.Widget,Gi.API],ml={ignoreConditions:!1,ignoreDelay:!1,displayType:Ls.Popover}
1,yl=G("[PostHog ExternalIntegrations]"),bl={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class wl{constructor(e){this._instance=e}lr(e,t){var s;(s=$.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,e,r=>{if(r)return yl.error("failed to load script",r);t()})}startIfEnabledOrStop(){var e=this,t=function(a){var o,l,c;!r||(o=$.__PosthogExtensions__)!=null&&(o=o.integrations)!=null&&o[a]||e.lr(bl[a],()=>{var u;(u=$.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[a])==null||u.start(e._instance)}),!r&&(l=$.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[a]&&((c=$.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[a])==null||c.stop())};for(var[s,r]of Object.entries((n=this._instance.config.integrations)!==null&&n!==void 0?n:{})){var n;t(s)}}}var st,Nt={},Zi=0,Bs=()=>{},Wr='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',kt="Surveys module not available",Yr="sanitize_properties is deprecated. Use before_send instead",Ta="Invalid value for property_denylist config: ",ot="posthog",Ra=!ol&&(ue==null?void 0:ue.indexOf("MSIE"))===-1&&(ue==null?void 0:ue.indexOf("Mozilla"))===-1,Jr=i=>{var e;return f({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:$o(b==null?void 0:b.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Bs,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:i??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:ie&&V(ie==null?void 0:ie.search)&&ie.search.indexOf("__posthog_debug=true")!==-1||!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:(v==null||(e=v.location)==null?void 0:e.protocol)==="https:",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(t){y.error("Bad HTTP status: "+t.statusCode+" "+t.text)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:Cs,before_send:void 0,request_queue_config:{flush_interval_ms:js},error_tracking:{},_onCapture:Bs,__preview_eager_load_replay:!1},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:Do,ignore_text_selection:!0}
1:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:t&&t>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:t&&t>="2026-05-30"?250:0}))(i))},xl=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["store_google","save_campaign_params"],["verbose","debug"]],Kr=i=>{var e={};for(var[t,s]of xl)w(i[t])||(e[s]=i[t]);var r=z({},e,i);return q(i.property_blacklist)&&(w(i.property_denylist)?r.property_denylist=i.property_blacklist:q(i.property_denylist)?r.property_denylist=[...i.property_blacklist,...i.property_denylist]:y.error(Ta+i.property_denylist)),r};class El{constructor(){this.__forceAllowLocalhost=!1}get Di(){return this.__forceAllowLocalhost}set Di(e){y.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class we{$i(e,t){if(e){var s=this.qi.indexOf(e);s!==-1&&this.qi.splice(s,1)}return this.qi.push(t),t.initialize==null||t.initialize(),t}ji(){return this.config.cookieless_mode===qe||this.config.cookieless_mode===Ke&&this.consent.isRejected()}get decideEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){var e;this.webPerformance=new El,this.Hi=!1,this.version=Q.LIB_VERSION,this.Ui=new nr,this.qi=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Jr(),this.SentryIntegration=Wo,this.sentryIntegration=s=>function(r,n){var a=ca(r,n);return{name:ua,processEvent:o=>a(o)}}(this,s),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Bi=!1,this.zi=null,this.Vi=null,this.Wi=null,this.scrollManager=new pl(this),this.pageViewManager=new Mr(this),this.rateLimiter=new tl(this),this.requestRouter=new _l(this),this.consent=new Co(this),this.externalIntegrations=new wl(this);var t=(e=we.__defaultExtensionClasses)!==null&&e!==void 0?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:(s,r,n)=>{var a=V(s)?{[s]:r}:s;this.setPersonProperties(a),n==null||n({})},set_once:(s,r,n)=>{var a=V(s)?{[s]:r}:s;this.setPersonProperties(void 0,a),n==null||n({})}},this.on("eventCaptured",s=>y.info('send "'+(s==null?void 0:s.event)+'"',s))}init(e,t,s){if(s&&s!==ot){var r,n=(r=Nt[s])!==null&&r!==void 0?r:new we;return n._init(e,t,s),Nt[s]=n,Nt[ot][s]=n,n}return this._init(e,t,s)}_init(e,t,s){var r,n;t===void 0&&(t={});var a=V(e)?e.trim():"";if(!a)return y.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},t.debug=this.Zi(t.debug),this.Gi=t,this.Qi=[],t.person_profiles?this.Vi=t.person_profiles:t.process_person&&(this.Vi=t.process_person);var o=Jr(t.defaults),l=Kr(t),c=z({},o,l,{name:s,token:a});Y(o.rageclick)&&Y(l.rageclick)&&(c.rageclick=z({},o.rageclick,l.rageclick)),this.set_config(c),this.config.on_xhr_error&&y.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:Pe.GZipJS;var u=this.Ji();this.persistence=new Vi(this.config,u),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Vi(f({},this.config,{persistence:"sessionStorage"}),u);var h=f({},this.persistence.props),d=f({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Ki=new cl(R=>this.Yi(R),this.config.request_queue_config),this.Xi=new dl(this),this.__request_queue=[];var p=this.ji();if(p||(this.sessionManager=new zr(this),this.sessionPropsManager=new Br(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(y.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.en(p)},0)):(y.info("Initializing extensions synchronously"),this.en(p)),Q.DEBUG=Q.DEBUG||this.config.debug,Q.DEBUG&&y.info("Starting in debug mode",{this:this,config:t,thisC:f({},this.config),p:h,s:d}),!this.config.identity_distinct_id||(r=t.bootstrap)!=null&&r.distinctID||(t.bootstrap=f({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((n=t.bootstrap)==null?void 0:n.distinctID)!==void 0){var g=t.bootstrap.distinctID,_=this.get_distinct_id(),M=this.persistence.get_property(Se);if(t.bootstrap.isIdentifiedID&&_!=null&&_!==g&&M===et)this.identify(g);else if(t.bootstrap.isIdentifiedID&&_!=null&&_!==g&&M===tt)y.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 T=this.config.get_device_id(He()),C=t.bootstrap.isIdentifiedID?T:g;this.persistence.set_property(Se,t.bootstrap.isIdentifiedID?tt:et),this.register({distinct_id:g,$device_id:C})}}if(p)this.register_once({distinct_id:Kt,$device_id:null},"");else if(!this.get_distinct_id()){var I=this.config.get_device_id(He());this.register_once({distinct_id:I,$device_id:I},""),this.persistence.set_property(Se,et)}return K(v,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),t.segment?function(R,E){var P=R.config.segment;if(!P)return E();(function(S,x){var m=S.config.segment;if(!m)return x();var k=L=>{var A=()=>L.anonymousId()||He();S.config.get_device_id=A,L.id()&&(S.register({distinct_id:L.id(),$device_id:A()}),S.persistence.set_property(Se,tt)),x()},F=m.user();"then"in F&&Le(F.then)?F.then(k):k(F)})(R,()=>{P.register((S=>{Promise&&Promise.resolve||zi.warn("This browser does not have Promise support, and can not use the segment integration");var x=(m,k)=>{if(!k)return m;m.event.userId||m.event.anonymousId===S.get_distinct_id()||(zi.info("No userId set, resetting PostHog"),S.reset()),m.event.userId&&m.event.userId!==S.get_distinct_id()&&(zi.info("UserId set, identifying with PostHog"),S.identify(m.event.userId)
1);var F=S.calculateEventProperties(k,m.event.properties);return m.event.properties=Object.assign({},F,m.event.properties),m};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:m=>x(m,m.event.event),page:m=>x(m,at),identify:m=>x(m,Ui),screen:m=>x(m,"$screen")}})(R)).then(()=>{E()})})}(this,()=>this.tn()):this.tn(),Le(this.config._onCapture)&&this.config._onCapture!==Bs&&(y.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",R=>this.config._onCapture(R.event,R))),this.config.ip&&y.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}en(e){var t,s,r,n,a,o,l,c=performance.now(),u=f({},we.__defaultExtensionClasses,this.config.__extensionClasses),h=[];u.featureFlags&&this.qi.push(this.featureFlags=(t=this.featureFlags)!==null&&t!==void 0?t:new u.featureFlags(this)),u.exceptions&&this.qi.push(this.exceptions=(s=this.exceptions)!==null&&s!==void 0?s:new u.exceptions(this)),u.historyAutocapture&&this.qi.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this.qi.push(this.tracingHeaders=new u.tracingHeaders(this)),u.siteApps&&this.qi.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!e&&this.qi.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||h.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),u.autocapture&&this.qi.push(this.autocapture=new u.autocapture(this)),u.surveys&&this.qi.push(this.surveys=(r=this.surveys)!==null&&r!==void 0?r:new u.surveys(this)),u.logs&&this.qi.push(this.logs=(n=this.logs)!==null&&n!==void 0?n:new u.logs(this)),u.conversations&&this.qi.push(this.conversations=(a=this.conversations)!==null&&a!==void 0?a:new u.conversations(this)),u.productTours&&this.qi.push(this.productTours=new u.productTours(this)),u.heatmaps&&this.qi.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this.qi.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this.qi.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this.qi.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,Go)),u.toolbar&&this.qi.push(this.toolbar=(o=this.toolbar)!==null&&o!==void 0?o:new u.toolbar(this)),u.experiments&&this.qi.push(this.experiments=(l=this.experiments)!==null&&l!==void 0?l:new u.experiments(this)),this.qi.forEach(d=>{d.initialize&&h.push(()=>{d.initialize==null||d.initialize()})}),h.push(()=>{if(this.rn){var d=this.rn;this.rn=void 0,this.Ar(d)}}),this.nn(h,c)}nn(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout(()=>{this.nn(e,t)},0);var s=e.shift();if(s)try{s()}catch(n){y.error("Error initializing extension:",n)}}var r=Math.round(performance.now()-t);this.register_for_session({[Wn]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Yn]:r}),this.config.__preview_deferred_init_extensions&&y.info("PostHog extensions initialized ("+r+"ms)")}Ar(e){var t;if(!b||!b.body)return y.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Ar(e)},500);this.config.__preview_deferred_init_extensions&&(this.rn=e),this.sn=e,this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=O(e.supportedCompression,Pe.GZipJS)?Pe.GZipJS:O(e.supportedCompression,Pe.Base64)?Pe.Base64:void 0),(t=e.analytics)!=null&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Vi?this.Vi:Cs}),this.qi.forEach(s=>s.onRemoteConfig==null?void 0:s.onRemoteConfig(e))}tn(){try{this.config.loaded(this)}catch(s){y.critical("`loaded` function failed",s)}if(this.an(),this.config.internal_or_test_user_hostname&&ie!=null&&ie.hostname){var e=ie.hostname,t=this.config.internal_or_test_user_hostname;(typeof t=="string"?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.ji())&&this.un()},1),this.ln=new ma(this),this.ln.load()}an(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.Ki)==null||e.enable())}_dom_loaded(){this.is_capturing()&&Xt(this.__request_queue,e=>this.Yi(e)),this.__request_queue=[],this.an()}_handle_unload(){var e,t,s,r;(e=this.surveys)==null||e.handlePageUnload(),this.config.request_batching?(this.hn()&&this.capture(ji),(t=this.logs)==null||t.flushLogs("sendBeacon"),(s=this.Ki)==null||s.unload(),(r=this.Xi)==null||r.unload()):this.hn()&&this.capture(ji,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(Ra?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=Ii(e.url,{ip:this.config.ip?1:0}),e.headers=f({},this.config.request_headers,e.headers),e.compression=e.compression==="best-available"?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,
1(t=>{var s,r,n,a=f({},t);a.timeout=a.timeout||6e4,a.url=Hr(a.url,a.compression);var o=(s=a.transport)!==null&&s!==void 0?s:"fetch",l=oi.filter(u=>!a.disableTransport||!u.transport||!a.disableTransport.includes(u.transport)),c=(r=(n=function(u,h){for(var d=0;u.length>d;d++)if(u[d].transport===o)return u[d]}(l))==null?void 0:n.method)!==null&&r!==void 0?r:l[0].method;if(!c)throw new Error("No available transport method");o!=="sendBeacon"&&a.data&&a.compression===Pe.GZipJS&&Aa&&!ai?ul(a).then(u=>{c(u)}).catch(u=>{if(vr(u))return ai=!0,void c(f({},a,{compression:void 0,url:Hr(t.url,void 0)}));(h=>{if(!h||typeof h!="object")return!1;var d="name"in h?String(h.name):"";return vr(h)||d===pn})(u)&&(ai=!0),c(a)}):c(a)})(f({},e,{callback:t=>{var s,r;this.rateLimiter.checkForLimiting(t),400>t.statusCode||(s=(r=this.config).on_request_error)==null||s.call(r,t),e.callback==null||e.callback(t)}}))))}Yi(e){this.Xi?this.Xi.retriableRequest(e):this._send_request(e)}_execute_array(e){Zi++;try{var t,s=[],r=[],n=[];Xt(e,o=>{if(o)if(q(t=o[0]))n.push(o);else if(Le(o))try{o.call(this)}catch(l){y.error("Error executing queued PostHog call",o,l)}else q(o)&&t==="alias"?s.push(o):q(o)&&t.indexOf("capture")!==-1&&Le(this[t])?n.push(o):r.push(o)});var a=function(o,l){Xt(o,function(c){try{if(q(c[0])){var u=l;H(c,function(h){u=u[h[0]].apply(u,h.slice(1))})}else l[c[0]].apply(l,c.slice(1))}catch(h){y.error("Error executing queued PostHog call",c,h)}})};a(s,this),a(r,this),a(n,this)}finally{Zi--}}push(e){if(Zi>0&&q(e)&&V(e[0])){var t=we.prototype[e[0]];Le(t)&&t.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,t,s){var r,n,a,o,l;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Ki){if(this.is_capturing())if(!w(e)&&V(e)){var c=!this.config.opt_out_useragent_filter&&this._is_bot();if(!c||this.config.__preview_capture_bot_pageviews){var u=s!=null&&s.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(u==null||!u.isRateLimited){t!=null&&t.$current_url&&!V(t==null?void 0:t.$current_url)&&(y.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),t==null||delete t.$current_url),e!=="$exception"||s!=null&&s.cn||y.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 h=new Date,d=(s==null?void 0:s.timestamp)||h,p=(s==null?void 0:s.uuid)||He(),g={uuid:p,event:e,properties:this.calculateEventProperties(e,t||{},d,p)};e===at&&this.config.__preview_capture_bot_pageviews&&c&&(g.event="$bot_pageview",g.properties.$browser_type="bot"),u&&(g.properties.$lib_rate_limit_remaining_tokens=u.remainingTokens),s!=null&&s.$set&&(g.$set=s==null?void 0:s.$set);var _,M,T,C=this.dn(s==null?void 0:s.$set_once,e!==xr,e===Ui);if(C&&(g.$set_once=C),s!=null&&s._noTruncate||(n=this.config.properties_string_max_length,a=g,o=m=>V(m)?m.slice(0,n):m,l=new Set,g=function m(k,F){return k!==Object(k)?o?o(k):k:l.has(k)?void 0:(l.add(k),q(k)?(L=[],Xt(k,A=>{L.push(m(A))})):(L={},H(k,(A,N)=>{l.has(A)||(L[N]=m(A))})),L);var L}(a)),g.timestamp=d,w(s==null?void 0:s.timestamp)||(g.properties.$event_time_override_provided=!0,g.properties.$event_time_override_system_time=h),e===Mt.DISMISSED||e===Mt.SENT){var I=t==null?void 0:t[Wi.SURVEY_ID],R=t==null?void 0:t[Wi.SURVEY_ITERATION];(m=>{try{var k=(F=>((L,A)=>{var N=""+Hs+A.id;return A.current_iteration&&A.current_iteration>0&&(N=""+Hs+A.id+"_"+A.current_iteration),N})(0,F))(m);if(localStorage.getItem(k))return;localStorage.setItem(k,"true")}catch(F){U.error("Failed to persist survey seen state",F)}})({id:I,current_iteration:R}),g.$set=f({},g.$set,{[(_={id:I,current_iteration:R},M=e===Mt.SENT?"responded":"dismissed",T="$survey_"+M+"/"+_.id,_.current_iteration&&_.current_iteration>0&&(T="$survey_"+M+"/"+_.id+"/"+_.current_iteration),T)]:!0})}else e===Mt.SHOWN&&(g.$set=f({},g.$set,{[Wi.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(e===el.SHOWN){var E=t==null?void 0:t[Ar.TOUR_TYPE];E&&(g.$set=f({},g.$set,{[Ar.TOUR_LAST_SEEN_DATE+"/"+E]:new Date().toISOString()}))}var P=f({},g.properties.$set,g.$set);if(lt(P)||this.setPersonPropertiesForFlags(P),!D(this.config.before_send)){var S=this.vn(g);if(!S)return;g=S}this.Ui.emit("eventCaptured",g);var x={method:"POST",url:(r=s==null?void 0:s._url)!==null&&r!==void 0?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:g,compression:"best-available",batchKey:s==null?void 0:s._batchKey,transport:s==null?void 0:s.transport};return!this.config.request_batching||s&&(s==null||!s._batchKey)||s!=null&&s.send_instantly?this.Yi(x):this.Ki.enqueue(x),g}y.critical("This capture call is ignored due to client rate limiting.")}}else y.error("No event name provided to posthog.capture")}else y.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",t=>e(t.event,t))}calculateEventProperties(e,t,s,r,n){if(s=s||new Date,!this.persistence||!this.sessionPersistence)return t;var a=n?void 0:this.persistence.remove_event_timer(e),o=f({},t);if(o.token=this.config.token,o.$config_defaults=this.config.defaults,this.ji()&&(o.$cookieless_mode=!0),e==="$snapshot"){var l=f({},this.persistence.properties(),this.sessionPersistence.properties());return o.distinct_id=l.distinct_id,(!V(o.distinct_id)&&!me(o.distinct_id)||us(o.distinct_id))&&y.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),o}var c,u=function(T,C){var I,R,E,P;if(!ue)return{};var S,x,m,k,F,L,A,N,j,ee=T?[...ft,...C||[]]:[],[he,oe]=function(ne){for(var ke=0;mr.length>ke;ke++){var[ye,ae]=mr[ke],le=ye.exec(ne),Fe=le&&(Le(ae)?ae(le,ne):ae);if(Fe)return Fe}return["",""]}(ue),X=(S=typeof navigator<"u"?navigator:void 0)!=null&&S.brave?{brave:!0}:{},de=z(Qs({$os:he,$os_version:oe,$browser:An(ue,navigator.vendor,X),$device:yr(ue),$device_type:(m=ue,k={userAgentDataPlatform:(I=navigator)==null||(I=I.userAgentData)==null?void 0:I.platform,maxTouchPoints:(R=navigator)==null?void 0:R.maxTouchPoints,screenWidth:v==null||(E=v.screen)==null?void 0:E.width,screenHeight:v==null||(P=v.screen)==null?void 0:P.height,devicePixelRatio:v==null?void 0:v.devicePixelRatio},j=yr(m),j===mn||j===fn||j==="Kobo"||j==="Kindle Fire"||j===In?vt:j===jt||j===pt||j===Ut||j===hs?"Console":j===bn?"Wearable":j?fe:(k==null?void 0:k.userAgentDataPlatform)==="Android"&&((F=k==null?void 0:k.maxTouchPoints)!==null&&F!==void 0?F:0)>0?600>Math.min((L=k==null?void 0:k.screenWidth)!==null&&L!==void 0?L:0,(A=k==null?void 0:k.screenHeight)!==null&&A!==void 0?A:0)/((N=k==null?void 0:k.devicePixelRatio)!==null&&N!==void 0?N:1)?fe:vt:"Desktop"),$timezone:fa(),$timezone_offset:Zo()}),{$current_url:zt(ie==null?void 0:ie.href,ee,Vt),$host:ie==null?void 0:ie.host,$pathname:ie==null?void 0:ie.pathname,$raw_user_agent:ue.length>1e3?ue.substring(0,997)+"...":ue,$browser_version:Za(ue,navigator.vendor,X),$browser_language:Cr(),$browser_language_prefix:(x=Cr(),typeof x=="str
1ing"?x.split("-")[0]:void 0),$screen_height:v==null?void 0:v.screen.height,$screen_width:v==null?void 0:v.screen.width,$viewport_height:v==null?void 0:v.innerHeight,$viewport_width:v==null?void 0:v.innerWidth,$lib:Q.LIB_NAME,$lib_version:Q.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Q.SDK_DIST_CHANNEL&&(de.$sdk_dist_channel=Q.SDK_DIST_CHANNEL),de}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:h,windowId:d}=this.sessionManager.checkAndGetSessionAndWindowId(n,s.getTime());o.$session_id=h,o.$window_id=d}this.sessionPropsManager&&z(o,this.sessionPropsManager.getSessionProps());try{var p;this.sessionRecording&&z(o,this.sessionRecording.sdkDebugProperties),o.$sdk_debug_retry_queue_size=(p=this.Xi)==null?void 0:p.length}catch(T){o.$sdk_debug_error_capturing_properties=String(T)}if(this.requestRouter.region===Us&&(o.$lib_custom_api_host=this.config.api_host),c=e!==at||n?e!==ji||n?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(s):this.pageViewManager.doPageView(s,r),o=z(o,c),e===at&&b&&(o.title=b.title),!w(a)){var g=s.getTime()-a;o.$duration=parseFloat((g/1e3).toFixed(3))}ue&&this.config.opt_out_useragent_filter&&(o.$browser_type=this._is_bot()?"bot":"browser"),(o=z({},u,this.persistence.properties(),this.sessionPersistence.properties(),o)).$is_identified=this._isIdentified(),q(this.config.property_denylist)?H(this.config.property_denylist,function(T){delete o[T]}):y.error(Ta+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var _=this.config.sanitize_properties;_&&(y.error(Yr),o=_(o,e));var M=this.fn();return o.$process_person_profile=M,M&&!n&&this.pn("_calculate_event_properties"),o}dn(e,t,s){var r;if(t===void 0&&(t=!0),s===void 0&&(s=!1),!this.persistence||!this.fn()||this.Hi&&!s)return e;var n=this.persistence.get_initial_props(),a=(r=this.sessionPropsManager)==null?void 0:r.getSetOnceProps(),o=z({},n,a||{},e||{}),l=this.config.sanitize_properties;return l&&(y.error(Yr),o=l(o,"$set_once")),t&&(this.Hi=!0),lt(o)?void 0:o}register(e,t){var s;(s=this.persistence)==null||s.register(e,t)}register_once(e,t,s){var r;(r=this.persistence)==null||r.register_once(e,t,s)}register_for_session(e){var t;(t=this.sessionPersistence)==null||t.register(e)}unregister(e){var t;(t=this.persistence)==null||t.unregister(e)}unregister_for_session(e){var t;(t=this.sessionPersistence)==null||t.unregister(e)}gn(e,t){this.register({[e]:t})}getFeatureFlag(e,t){var s;return(s=this.featureFlags)==null?void 0:s.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return(t=this.featureFlags)==null?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var s;return(s=this.featureFlags)==null?void 0:s.getFeatureFlagResult(e,t)}isFeatureEnabled(e,t){var s;return(s=this.featureFlags)==null?void 0:s.isFeatureEnabled(e,t)}reloadFeatureFlags(){var e;(e=this.featureFlags)==null||e.reloadFeatureFlags()}updateFlags(e,t,s){var r;(r=this.featureFlags)==null||r.updateFlags(e,t,s)}updateEarlyAccessFeatureEnrollment(e,t,s){var r;(r=this.featureFlags)==null||r.updateEarlyAccessFeatureEnrollment(e,t,s)}getEarlyAccessFeatures(e,t,s){var r;return t===void 0&&(t=!1),(r=this.featureFlags)==null?void 0:r.getEarlyAccessFeatures(e,t,s)}on(e,t){return this.Ui.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:kt}),()=>{})}onSessionId(e){var t,s;return(t=(s=this.sessionManager)==null?void 0:s.onSessionId(e))!==null&&t!==void 0?t:()=>{}}getSurveys(e,t){t===void 0&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:kt})}getActiveMatchingSurveys(e,t){t===void 0&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:kt})}renderSurvey(e,t){var s;(s=this.surveys)==null||s.renderSurvey(e,t)}displaySurvey(e,t){var s;t===void 0&&(t=ml),(s=this.surveys)==null||s.displaySurvey(e,t)}cancelPendingSurvey(e){var t;(t=this.surveys)==null||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,s;return(t=(s=this.surveys)==null?void 0:s.canRenderSurvey(e))!==null&&t!==void 0?t:{visible:!1,disabledReason:kt}}canRenderSurveyAsync(e,t){var s,r;return t===void 0&&(t=!1),(s=(r=this.surveys)==null?void 0:r.canRenderSurveyAsync(e,t))!==null&&s!==void 0?s:Promise.resolve({visible:!1,disabledReason:kt})}mn(e){return!e||us(e)?(y.critical("Unique user id has not been set in posthog.identify"),!1):e===Kt?(y.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())||(y.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and n
1ot a hardcoded string.'),!1)}identify(e,t,s){if(!this.__loaded||!this.persistence)return y.uninitializedWarning("posthog.identify");if(me(e)&&(e=e.toString(),y.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.mn(e)&&this.pn("posthog.identify")){var r=this.get_distinct_id();this.register({$user_id:e}),this.get_property(_i)||this.register_once({$had_persisted_distinct_id:!0,$device_id:r},""),e!==r&&e!==this.get_property(Rt)&&(this.unregister(Rt),this.register({distinct_id:e}));var n,a=(this.persistence.get_property(Se)||et)===et;e!==r&&a?(this.persistence.set_property(Se,tt),this.setPersonPropertiesForFlags({$set:t||{},$set_once:s||{}},!1),this.capture(Ui,{distinct_id:e,$anon_distinct_id:r},{$set:t||{},$set_once:s||{}}),this.Wi=Vr(e,t,s),(n=this.featureFlags)==null||n.setAnonymousDistinctId(r)):(t||s)&&this.setPersonProperties(t,s),e!==r&&(this.reloadFeatureFlags(),this.unregister(Lt))}}setPersonProperties(e,t){if((e||t)&&this.pn("posthog.setPersonProperties")){var s=Vr(this.get_distinct_id(),e,t);this.Wi!==s?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Wi=s):y.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,s){if(e&&t){var r=this.getGroups(),n=r[e]!==t;if(n&&this.resetGroupPropertiesForFlags(e),this.register({$groups:f({},r,{[e]:t})}),n||s){var a={$group_type:e,$group_key:t};s&&(a.$group_set=s),this.capture(xr,a)}s&&this.setGroupPropertiesForFlags({[e]:s}),n&&!s&&this.reloadFeatureFlags()}else y.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){var s;t===void 0&&(t=!0),(s=this.featureFlags)==null||s.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){var e;(e=this.featureFlags)==null||e.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,t){var s;t===void 0&&(t=!0),this.pn("posthog.setGroupPropertiesForFlags")&&((s=this.featureFlags)==null||s.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;(t=this.featureFlags)==null||t.resetGroupPropertiesForFlags(e)}reset(e){var t,s,r,n,a,o,l,c;if(y.info("reset"),!this.__loaded)return y.uninitializedWarning("posthog.reset");var u,h=this.get_property(_i),d=this.get_property(Xe);if(this.consent.reset(),(t=this.persistence)==null||t.clear(),(s=this.sessionPersistence)==null||s.clear(),w(d)||(u=this.persistence)==null||u.register({[Xe]:d}),(r=this.surveys)==null||r.reset(),(n=this.ln)==null||n.stop(),(a=this.featureFlags)==null||a.reset(),(o=this.conversations)==null||o.reset(),(l=this.persistence)==null||l.set_property(Se,et),(c=this.sessionManager)==null||c.resetSessionId(),this.Wi=null,this.config.cookieless_mode===qe)this.register_once({distinct_id:Kt,$device_id:null},"");else{var p=this.config.get_device_id(He());this.register_once({distinct_id:p,$device_id:e?p:h},"")}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 s;this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),(s=this.conversations)==null||s.yn()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,(e=this.conversations)==null||e.bn()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return(e=(t=this.sessionManager)==null?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:s}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(e!=null&&e.withTimestamp&&s){var n,a=(n=e.timestampLookBack)!==null&&n!==void 0?n:10;if(!s)return r;
1r+="?t="+Math.max(Math.floor((new Date().getTime()-s)/1e3)-a,0)}return r}alias(e,t){return e===this.get_property(Un)?(y.critical("Attempting to create alias for existing People user - aborting."),-2):this.pn("posthog.alias")?(w(t)&&(t=this.get_distinct_id()),e!==t?(this.gn(Rt,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(y.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=f({},this.config);if(Y(e)){var s,r,n,a,o,l,c,u,h,d,p;z(this.config,Kr(e));var g=this.Ji();(s=this.persistence)==null||s.update_config(this.config,t,g),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Vi(f({},this.config,{persistence:"sessionStorage"}),g);var _=this.Zi(this.config.debug);Re(_)&&(this.config.debug=_),Re(this.config.debug)&&(this.config.debug?(Q.DEBUG=!0,J.O()&&J.N("ph_debug",!0),y.info("set_config",{config:e,oldConfig:t,newConfig:f({},this.config)})):(Q.DEBUG=!1,J.O()&&J.q("ph_debug"))),(r=this.exceptionObserver)==null||r.onConfigChange(),(n=this.exceptions)==null||n.onConfigChange(),(a=this.sessionRecording)==null||a.startIfEnabledOrStop(),(o=this.tracingHeaders)==null||o.startIfEnabledOrStop(),(l=this.autocapture)==null||l.startIfEnabled(),(c=this.heatmaps)==null||c.startIfEnabled(),(u=this.exceptionObserver)==null||u.startIfEnabledOrStop(),(h=this.deadClicksAutocapture)==null||h.startIfEnabledOrStop(),(d=this.surveys)==null||d.loadIfEnabled(),this._n(),(p=this.externalIntegrations)==null||p.startIfEnabledOrStop()}}_overrideSDKInfo(e,t){Q.LIB_NAME=e,Q.LIB_VERSION=t}startSessionRecording(e){var t,s,r,n,a,o=e===!0,l={sampling:o||!(e==null||!e.sampling),linked_flag:o||!(e==null||!e.linked_flag),url_trigger:o||!(e==null||!e.url_trigger),event_trigger:o||!(e==null||!e.event_trigger)};Object.values(l).some(Boolean)&&((t=this.sessionManager)==null||t.checkAndGetSessionAndWindowId(),l.sampling&&((s=this.sessionRecording)==null||s.overrideSampling()),l.linked_flag&&((r=this.sessionRecording)==null||r.overrideLinkedFlag()),l.url_trigger&&((n=this.sessionRecording)==null||n.overrideTrigger("url")),l.event_trigger&&((a=this.sessionRecording)==null||a.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)==null||!e.started)}captureException(e,t){if(this.exceptions){var s=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(e,{handled:!0,syntheticException:s});return this.exceptions.sendExceptionEvent(f({},r,t))}}addExceptionStep(e,t){var s;(s=this.exceptions)==null||s.addExceptionStep(e,t)}captureLog(e){var t;(t=this.logs)==null||t.captureLog(e)}get logger(){var e,t;return(e=(t=this.logs)==null?void 0:t.logger)!==null&&e!==void 0?e:we.wn}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,s;return(t=(s=this.toolbar)==null?void 0:s.loadToolbar(e))!==null&&t!==void 0&&t}get_property(e){var t;return(t=this.persistence)==null?void 0:t.props[e]}getSessionProperty(e){var t;return(t=this.sessionPersistence)==null?void 0:t.props[e]}toString(){var e,t=(e=this.config.name)!==null&&e!==void 0?e:ot;return t!==ot&&(t=ot+"."+t),t}_isIdentified(){var e,t;return((e=this.persistence)==null?void 0:e.get_property(Se))===tt||((t=this.sessionPersistence)==null?void 0:t.get_property(Se))===tt}fn(){var e,t;return!(this.config.person_profiles==="never"||this.config.person_profiles===Cs&&!this._isIdentified()&<(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[Rt])&&((t=this.persistence)==null||(t=t.props)==null||!t[yi]))}hn(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.fn()||this.pn("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.pn("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}pn(e){return this.config.person_profiles==="never"?(y.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.gn(yi,!0),!0)}Ji(){if(this.config.cookieless_mode==="always")return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==Ke)}_n(){var e,t,s,r,n=this.Ji();return((e=this.persistence)==null?void 0:e.wr)!==n&&((s=this.persistence)==null||s.set_disabled(n)),((t=this.sessionPersistence)==null?void 0:t.wr)!==n&&((r=this.sessionPersistence)==null||r.set_disabled(n)),n}opt_in_capturing(e){var t;if(this.config.cookieless_mode!==qe){if(this.ji()){var s,r,n,a,o;this.reset(!0),(s=this.sessionManager)==null||s.destroy(),(r=this.pageViewM
1anager)==null||r.destroy(),this.sessionManager=new zr(this),this.pageViewManager=new Mr(this),this.persistence&&(this.sessionPropsManager=new Br(this,this.sessionManager,this.persistence));var l,c=(n=(a=this.config.__extensionClasses)==null?void 0:a.sessionRecording)!==null&&n!==void 0?n:(o=we.__defaultExtensionClasses)==null?void 0:o.sessionRecording;c&&(this.sessionRecording=this.$i(this.sessionRecording,new c(this)),this.sn&&((l=this.sessionRecording)==null||l.onRemoteConfig==null||l.onRemoteConfig(this.sn)))}var u,h;this.consent.optInOut(!0),this._n(),this.an(),(t=this.sessionRecording)==null||t.startIfEnabledOrStop(),this.config.cookieless_mode==Ke&&((u=this.surveys)==null||u.loadIfEnabled()),(w(e==null?void 0:e.captureEventName)||e!=null&&e.captureEventName)&&this.capture((h=e==null?void 0:e.captureEventName)!==null&&h!==void 0?h:"$opt_in",e==null?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.un()}else y.warn(Wr)}opt_out_capturing(){var e,t,s;this.config.cookieless_mode!==qe?(this.config.cookieless_mode===Ke&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this._n(),this.config.cookieless_mode===Ke&&(this.register({distinct_id:Kt,$device_id:null}),(e=this.sessionRecording)==null||e.stopRecording(),this.sessionRecording=void 0,(t=this.sessionManager)==null||t.destroy(),(s=this.pageViewManager)==null||s.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.un(),this.an())):y.warn(Wr)}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 e===1?"granted":e===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===qe||(this.config.cookieless_mode===Ke?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this._n()}_is_bot(){return ve?ka(ve,this.config.custom_blocked_useragents):void 0}un(){b&&(b.visibilityState==="visible"?this.Bi||(this.Bi=!0,this.capture(at,{title:b.title},{send_instantly:!0}),this.zi&&(b.removeEventListener(bi,this.zi),this.zi=null)):this.zi||(this.zi=this.un.bind(this),K(b,bi,this.zi)))}debug(e){e===!1?(v==null||v.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(v==null||v.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}))}Dr(){var e,t,s,r,n,a,o=this.Gi||{};return"advanced_disable_flags"in o?!!o.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(y.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):(s="advanced_disable_decide",r=y,n=(t="advanced_disable_flags")in(e=o)&&!D(e[t]),a=s in e&&!D(e[s]),n?e[t]:!!a&&(r&&r.warn("Config field '"+s+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[s]))}vn(e){if(D(this.config.before_send))return e;var t=q(this.config.before_send)?this.config.before_send:[this.config.before_send],s=e;for(var r of t){if(s=r(s),D(s)){var n="Event '"+e.event+"' was rejected in beforeSend function";return ja(e.event)?y.warn(n+". This can cause unexpected behavior."):y.info(n),null}s.properties&&!lt(s.properties)||y.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return s}getPageViewId(){var e;return(e=this.pageViewManager.dr)==null?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,s){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(s)})}Zi(e){var t=Re(e)&&!e,s=J.O()&&J.A("ph_debug")==="true";return!t&&(!!s||e)}}we.__defaultExtensionClasses={},we.wn={trace:st=()=>{},debug:st,info:st,warn:st,error:st,fatal:st},function(i,e){for(var t=0;e.length>t;t++)i.prototype[e[t]]=ko(i.prototype[e[t]])}(we,["identify"]);class Xr{constructor(e){this.disabled=e===!1;var t=Y(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,s){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(e-r.x)+Math.abs(t-r.y)<this.thresholdPx&&this.timeoutMs>s-r.timestamp){if(this.clicks.push({x:e,y:t,timestamp:s}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:s}];return!1}}var Qi="$copy_autocapture",es=G("[AutoCapture]");function ts(i,e){return e.length>i?e.slice(0,i)+"...":e}function Sl(i){if(i.previousElementSibling)return i.previousElementSibling;var e=i;do e=e.previousSibling;while(e&&!Be(e));return e}function kl(i,e){var t,s,{e:r,maskAllElementAttributes:n,maskAllText:a,elementAttributeIgnoreList:o,elementsC
1hainAsString:l}=e;if(!Be(i))return{props:{}};for(var c=[i],u=i;u.parentNode&&!ge(u,"body");)if(Qn(u.parentNode))c.push(u.parentNode.host),u=u.parentNode.host;else{if(!Be(u.parentNode))break;c.push(u.parentNode),u=u.parentNode}var h,d,p=[],g={},_=!1,M=!1;if(H(c,E=>{var P=As(E);if(ge(E,"a")){var S=E.getAttribute("href");_=P&&!!S&&qt(S)&&S}O(Ei(E),"ph-no-capture")&&(M=!0),p.push(function(m,k,F,L){var A=m.tagName.toLowerCase(),N={tag_name:A};tr.indexOf(A)>-1&&!F&&(N.$el_text=A.toLowerCase()==="a"||A.toLowerCase()==="button"?ts(1024,Fr(m)):ts(1024,Ht(m)));var j=Ei(m);j.length>0&&(N.classes=j.filter(function(X){return X!==""})),H(m.attributes,function(X){var de;if((!na(m)||["name","id","class","aria-label"].indexOf(X.name)!==-1)&&(L==null||!L.includes(X.name))&&!k&&qt(X.value)&&(!V(de=X.name)||de.substring(0,10)!=="_ngcontent"&&de.substring(0,7)!=="_nghost")){var ne=X.value;X.name==="class"&&(ne=er(ne).join(" ")),N["attr__"+X.name]=ts(1024,ne)}});for(var ee=1,he=1,oe=m;oe=Sl(oe);)ee++,oe.tagName===m.tagName&&he++;return N.nth_child=ee,N.nth_of_type=he,N}(E,n,a,o));var x=function(m){if(!As(m))return{};var k={};return H(m.attributes,function(F){if(F.name&&F.name.indexOf("data-ph-capture-attribute")===0){var L=F.name.replace("data-ph-capture-attribute-",""),A=F.value;L&&A&&qt(A)&&(k[L]=A)}}),k}(E);z(g,x)}),M)return{props:{},explicitNoCapture:M};if(a||(p[0].$el_text=ge(i,"a")||ge(i,"button")?Fr(i):Ht(i)),_){var T,C;p[0].attr__href=_;var I=(T=Si(_))==null?void 0:T.host,R=v==null||(C=v.location)==null?void 0:C.host;I&&R&&I!==R&&(h=_)}return{props:z({$event_type:r.type,$ce_version:1},l?{}:{$elements:p},{$elements_chain:(d=p,function(E){return E.map(P=>{var S,x,m="";if(P.tag_name&&(m+=P.tag_name),P.attr_class)for(var k of(P.attr_class.sort(),P.attr_class))m+="."+k.replace(/"/g,"");var F=f({},P.text?{text:P.text}:{},{"nth-child":(S=P.nth_child)!==null&&S!==void 0?S:0,"nth-of-type":(x=P.nth_of_type)!==null&&x!==void 0?x:0},P.href?{href:P.href}:{},P.attr_id?{attr_id:P.attr_id}:{},P.attributes),L={};return ni(F).sort((A,N)=>{var[j]=A,[ee]=N;return j.localeCompare(ee)}).forEach(A=>{var[N,j]=A;return L[Ir(N.toString())]=Ir(j.toString())}),(m+=":")+ni(L).map(A=>{var[N,j]=A;return N+'="'+j+'"'}).join("")}).join(";")}(function(E){return E.map(P=>{var S,x,m={text:(S=P.$el_text)==null?void 0:S.slice(0,400),tag_name:P.tag_name,href:(x=P.attr__href)==null?void 0:x.slice(0,2048),attr_class:zo(P),attr_id:P.attr__id,nth_child:P.nth_child,nth_of_type:P.nth_of_type,attributes:{}};return ni(P).filter(k=>{var[F]=k;return F.indexOf("attr__")===0}).forEach(k=>{var[F,L]=k;return m.attributes[F]=L}),m})}(d)))},(t=p[0])!=null&&t.$el_text?{$el_text:(s=p[0])==null?void 0:s.$el_text}:{},h&&r.type==="click"?{$external_click_url:h}:{},g)}}var Pt=G("[ExceptionAutocapture]");function Zr(i,e,t){try{if(!(e in i))return()=>{};var s=i[e],r=t(s);return Le(r)&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__posthog_wrapped__:{enumerable:!1,value:!0}})),i[e]=r,()=>{i[e]===r&&(i[e]=s)}}catch{return()=>{}}}var Pl=G("[TracingHeaders]"),Ge=G("[Web Vitals]"),Qr=9e5,en="disabled",tn="lazy_loading",$t="awaiting_config",ii="missing_config";G("[SessionRecording]"),G("[SessionRecording]");var zs="[SessionRecording]",Oe=G(zs),$l=G("[Heatmaps]");function sn(i){return Y(i)&&"clientX"in i&&"clientY"in i&&me(i.clientX)&&me(i.clientY)}var rn=G("[Product Tours]"),Tl=["$set_once","$set"],Ue=G("[SiteApps]"),nn="Error while initializing PostHog app with config id ";function rt(i,e,t){if(D(i))return!1;switch(t){case"exact":return i===e;case"contains":var s=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(s,"i").test(i);case"regex":try{return new RegExp(e).test(i)}catch{return!1}default:return!1}}class Rl{constructor(e){this.xn=new nr,this.Sn=(t,s)=>this.kn(t,s)&&this.Cn(t,s)&&this.In(t,s)&&this.Tn(t,s),this.kn=(t,s)=>s==null||!s.event||(t==null?void 0:t.event)===(s==null?void 0:s.event),this._instance=e,this.En=new Set,this.Mn=new Set}init(){var e,t;w((e=this._instance)==null?void 0:e._addCaptureHook)||(t=this._instance)==null||t._addCaptureHook((s,r)=>{this.on(s,r)})}register(e){var t,s;if(!w((t=this._instance)==null?void 0:t._addCaptureHook)&&(e.forEach(a=>{var o,l;(o=this.Mn)==null||o.add(a),(l=a.steps)==null||l.forEach(c=>{var u;(u=this.En)==null||u.add((c==null?void 0:c.event)||"")})}),(s=this._instance)!=null&&s.autocapture)){var r,n=new Set;e.forEach(a=>{var o;(o=a.steps)==null||o.forEach(l=>{l!=null&&l.selector&&n.add(l==null?void 0:l.selector)})}),(r=this._instance)==null||r.autocapture.setElementSelectors(n)}}on(e,t){var s;t!=null&&e.length!=0&&(this.En.has(e)||this.En.has(t==null?void 0:t.event))&&this.Mn&&((s=this.Mn)==null?void 0:s.size)>0&&this.Mn.forEach(r=>{this.Rn(t,r)&&this.xn.emit("actionCaptured",r.name)}
vendor: 5,088 bytes, line 1
1)}Pn(e){this.onAction("actionCaptured",t=>e(t))}Rn(e,t){if((t==null?void 0:t.steps)==null)return!1;for(var s of t.steps)if(this.Sn(e,s))return!0;return!1}onAction(e,t){return this.xn.on(e,t)}Cn(e,t){if(t!=null&&t.url){var s,r=e==null||(s=e.properties)==null?void 0:s.$current_url;if(!r||typeof r!="string"||!rt(r,t.url,t.url_matching||"contains"))return!1}return!0}In(e,t){return!!this.On(e,t)&&!!this.Ln(e,t)&&!!this.Fn(e,t)}On(e,t){var s;if(t==null||!t.href)return!0;var r=this.An(e);if(r.length>0)return r.some(o=>rt(o.href,t.href,t.href_matching||"exact"));var n,a=(e==null||(s=e.properties)==null?void 0:s.$elements_chain)||"";return!!a&&rt((n=a.match(/(?::|")href="(.*?)"/))?n[1]:"",t.href,t.href_matching||"exact")}Ln(e,t){var s;if(t==null||!t.text)return!0;var r=this.An(e);if(r.length>0)return r.some(c=>rt(c.text,t.text,t.text_matching||"exact")||rt(c.$el_text,t.text,t.text_matching||"exact"));var n,a,o,l=(e==null||(s=e.properties)==null?void 0:s.$elements_chain)||"";return!!l&&(n=function(c){for(var u,h=[],d=/(?::|")text="(.*?)"/g;!D(u=d.exec(c));)h.includes(u[1])||h.push(u[1]);return h}(l),a=t.text,o=t.text_matching||"exact",n.some(c=>rt(c,a,o)))}Fn(e,t){var s,r;if(t==null||!t.selector)return!0;var n=e==null||(s=e.properties)==null?void 0:s.$element_selectors;if(n!=null&&n.includes(t.selector))return!0;var a=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||"";if(t.selector_regex&&a)try{return new RegExp(t.selector_regex).test(a)}catch{return!1}return!1}An(e){var t;return(e==null||(t=e.properties)==null?void 0:t.$elements)==null?[]:e==null?void 0:e.properties.$elements}Tn(e,t){return t==null||!t.properties||t.properties.length===0||$a(t.properties.reduce((s,r)=>{var n=q(r.value)?r.value.map(String):r.value!=null?[String(r.value)]:[];return s[r.key]={values:n,operator:r.operator||"exact"},s},{}),e==null?void 0:e.properties)}}class Fl{constructor(e){this._instance=e,this.Nn=new Map,this.Dn=new Map,this.$n=new Map}qn(e,t){return!!e&&$a(e.propertyFilters,t==null?void 0:t.properties)}jn(e,t){var s=new Map;return e.forEach(r=>{var n;(n=r.conditions)==null||(n=n[t])==null||(n=n.values)==null||n.forEach(a=>{if(a!=null&&a.name){var o=s.get(a.name)||[];o.push(r.id),s.set(a.name,o)}})}),s}Hn(e,t,s){var r=(s===wt.Activation?this.Nn:this.Dn).get(e),n=[];return this.Un(a=>{n=a.filter(o=>r==null?void 0:r.includes(o.id))}),n.filter(a=>{var o,l=(o=a.conditions)==null||(o=o[s])==null||(o=o.values)==null?void 0:o.find(c=>c.name===e);return this.qn(l,t)})}register(e){var t;w((t=this._instance)==null?void 0:t._addCaptureHook)||(this.Bn(e),this.zn(e))}zn(e){var t=e.filter(s=>{var r,n;return((r=s.conditions)==null?void 0:r.actions)&&((n=s.conditions)==null||(n=n.actions)==null||(n=n.values)==null?void 0:n.length)>0});t.length!==0&&(this.Vn==null&&(this.Vn=new Rl(this._instance),this.Vn.init(),this.Vn.Pn(s=>{this.onAction(s)})),t.forEach(s=>{var r,n,a,o,l;s.conditions&&(r=s.conditions)!=null&&r.actions&&(n=s.conditions)!=null&&(n=n.actions)!=null&&n.values&&((a=s.conditions)==null||(a=a.actions)==null||(a=a.values)==null?void 0:a.length)>0&&((o=this.Vn)==null||o.register(s.conditions.actions.values),(l=s.conditions)==null||(l=l.actions)==null||(l=l.values)==null||l.forEach(c=>{if(c&&c.name){var u=this.$n.get(c.name);u&&u.push(s.id),this.$n.set(c.name,u||[s.id])}}))}))}Bn(e){var t,s=e.filter(n=>{var a,o;return((a=n.conditions)==null?void 0:a.events)&&((o=n.conditions)==null||(o=o.events)==null||(o=o.values)==null?void 0:o.length)>0}),r=e.filter(n=>{var a,o;return((a=n.conditions)==null?void 0:a.cancelEvents)&&((o=n.conditions)==null||(o=o.cancelEvents)==null||(o=o.values)==null?void 0:o.length)>0});s.length===0&&r.length===0||((t=this._instance)==null||t._addCaptureHook((n,a)=>{this.onEvent(n,a)}),this.Nn=this.jn(e,wt.Activation),this.Dn=this.jn(e,wt.Cancellation))}onEvent(e,t){var s,r=this.le(),n=this.Wn(),a=this.Zn(),o=((s=this._instance)==null||(s=s.persistence)==null?void 0:s.props[n])||[];if(a===e&&t&&o.length>0){var l,c;r.info("event matched, removing item from activated items",{event:e,eventPayload:t,existingActivatedItems:o});var u=(t==null||(l=t.properties)==null?void 0:l.$survey_id)||(t==null||(c=t.properties)==null?void 0:c.$product_tour_id);if(u){var h=o.indexOf(u);0>h||(o.splice(h,1),this.Gn(o))}}else{if(this.Dn.has(e)){var d=this.Hn(e,t,wt.Cancellation);d.length>0&&(r.info("cancel event matched, cancelling items",{event:e,itemsToCancel:d.map(g=>g.id)}),d.forEach(g=>{var _=o.indexOf(g.id);0>_||o.splice(_,1),this.Qn(g.id)}),this.Gn(o))}if(this.Nn.has(e)){r.info("event name matched",{event:e,eventPayload:t,items:this.Nn.get(e)});var p=this.Hn(e,t,wt.Activation);this.Gn(o.concat(p.map(g=>g.id)||[]))}}}onAction(e){var t,s=this.Wn(),r=((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[s])||[];this.$n.has(e)&&this.Gn(r.concat(this.$n.get(e)||[]))}Gn(e){var t=this.le(),s=[...new Set(e)].filter(r=>!this.Jn(r));t.info("updating activated items",{activatedItems:s}),this.Kn(s)}getActivatedIds(){var e,t=this.Wn();return((e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[t])||[]}
1getEventToItemsMap(){return this.Nn}Yn(){return this.Vn}}class Il extends Fl{constructor(e){super(e)}Wn(){return $s}Zn(){return Mt.SHOWN}Un(e){var t;(t=this._instance)==null||t.getSurveys(e)}Qn(e){var t;(t=this._instance)==null||t.cancelPendingSurvey(e)}le(){return U}Kn(e){var t;(t=this._instance)==null||(t=t.persistence)==null||t.register({[$s]:e})}Jn(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var is="SDK is not enabled or survey functionality is not yet loaded",an="Disabled. Not loading surveys.",Ol=v!=null&&v.location?ki(v.location.hash,"__posthog")||ki(location.hash,"state"):null,on="_postHogToolbarParams",ln=G("[Toolbar]"),te=G("[FeatureFlags]"),We=G("[FeatureFlags]",{debugEnabled:!0}),ss=`" failed. Feature flags didn't load in time.`,un=i=>{for(var e={},t=0;i.length>t;t++)e[i[t]]=!0;return e},cn=i=>{var e={};for(var[t,s]of ni(i||{}))s&&(e[t]=s);return e},Me=G("[Error tracking]"),hn="Refusing to render web experiment since the viewer is a likely bot",Ml={icontains:(i,e)=>!!v&&e.href.toLowerCase().indexOf(i.toLowerCase())>-1,not_icontains:(i,e)=>!!v&&e.href.toLowerCase().indexOf(i.toLowerCase())===-1,regex:(i,e)=>!!v&&Ti(e.href,i),not_regex:(i,e)=>!!v&&!Ti(e.href,i),exact:(i,e)=>e.href===i,is_not:(i,e)=>e.href!==i};class re{get qt(){return this._instance.config}constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(s){s===void 0&&(s=!1),t.getWebExperiments(r=>{re.Xn("retrieved web experiments from the server"),t.es=new Map,r.forEach(n=>{if(n.feature_flag_key){var a;t.es&&(re.Xn("setting flag key ",n.feature_flag_key," to web experiment ",n),(a=t.es)==null||a.set(n.feature_flag_key,n));var o=t._instance.getFeatureFlag(n.feature_flag_key);V(o)&&n.variants[o]&&t.ts(n.name,o,n.variants[o].transforms)}else if(n.variants)for(var l in n.variants){var c=n.variants[l];re.rs(c)&&t.ts(n.name,l,c.transforms)}})},s)},this._instance=e,this._instance.onFeatureFlags(s=>{this.onFeatureFlags(s)})}initialize(){}onFeatureFlags(e){if(this._is_bot())re.Xn(hn);else if(!this.qt.disable_web_experiments){if(D(this.es))return this.es=new Map,this.loadIfEnabled(),void this.previewWebExperiment();re.Xn("applying feature flags",e),e.forEach(t=>{var s;if(this.es&&(s=this.es)!=null&&s.has(t)){var r,n=this._instance.getFeatureFlag(t),a=(r=this.es)==null?void 0:r.get(t);n&&a!=null&&a.variants[n]&&this.ts(a.name,n,a.variants[n].transforms)}})}}previewWebExperiment(){var e=re.getWindowLocation();if(e!=null&&e.search){var t=Bt(e==null?void 0:e.search,"__experiment_id"),s=Bt(e==null?void 0:e.search,"__experiment_variant");t&&s&&(re.Xn("previewing web experiments "+t+" && "+s),this.getWebExperiments(r=>{this.ns(parseInt(t),s,r)},!1,!0))}}loadIfEnabled(){this.qt.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,s){if(this.qt.disable_web_experiments&&!s)return e([]);var r=this._instance.get_property("$web_experiments");if(r&&!t)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.qt.token),method:"GET",callback:n=>e(n.statusCode===200&&n.json&&n.json.experiments||[])})}ns(e,t,s){var r=s.filter(n=>n.id===e);r&&r.length>0&&(re.Xn("Previewing web experiment ["+r[0].name+"] with variant ["+t+"]"),this.ts(r[0].name,t,r[0].variants[t].transforms))}static rs(e){return!D(e.conditions)&&re.ss(e)&&re.os(e)}static ss(e){var t;if(D(e.conditions)||D((t=e.conditions)==null?void 0:t.url))return!0;var s,r,n,a=re.getWindowLocation();return!!a&&((s=e.conditions)==null||!s.url||Ml[(r=(n=e.conditions)==null?void 0:n.urlMatchType)!==null&&r!==void 0?r:"icontains"](e.conditions.url,a))}
1static getWindowLocation(){return v==null?void 0:v.location}static os(e){var t;if(D(e.conditions)||D((t=e.conditions)==null?void 0:t.utm))return!0;var s=ha();if(s.utm_source){var r,n,a,o,l,c,u,h,d=(r=e.conditions)==null||(r=r.utm)==null||!r.utm_campaign||((n=e.conditions)==null||(n=n.utm)==null?void 0:n.utm_campaign)==s.utm_campaign,p=(a=e.conditions)==null||(a=a.utm)==null||!a.utm_source||((o=e.conditions)==null||(o=o.utm)==null?void 0:o.utm_source)==s.utm_source,g=(l=e.conditions)==null||(l=l.utm)==null||!l.utm_medium||((c=e.conditions)==null||(c=c.utm)==null?void 0:c.utm_medium)==s.utm_medium,_=(u=e.conditions)==null||(u=u.utm)==null||!u.utm_term||((h=e.conditions)==null||(h=h.utm)==null?void 0:h.utm_term)==s.utm_term;return d&&g&&_&&p}return!1}static Xn(e){for(var t=arguments.length,s=new Array(t>1?t-1:0),r=1;t>r;r++)s[r-1]=arguments[r];y.info("[WebExperiments] "+e,s)}ts(e,t,s){this._is_bot()?re.Xn(hn):t!=="control"?s.forEach(r=>{if(r.selector){var n;re.Xn("applying transform of variant "+t+" for experiment "+e+" ",r);var a=(n=document)==null?void 0:n.querySelectorAll(r.selector);a==null||a.forEach(o=>{var l=o;r.html&&(l.innerHTML=r.html),r.css&&l.setAttribute("style",r.css)})}}):re.Xn("Control variants leave the page unmodified.")}_is_bot(){return ve&&this._instance?ka(ve,this.qt.custom_blocked_useragents):void 0}}var be=G("[Conversations]"),Ye="Conversations not available yet.",Oi={featureFlags:class{constructor(i){this.us=!1,this.ls=!1,this.hs=!1,this.cs=!1,this.ds=!1,this.vs=!1,this.fs=!1,this.ps=!1,this._instance=i,this.featureFlagEventHandlers=[]}get qt(){return this._instance.config}get ui(){return this._instance.persistence}gs(i){return this._instance.get_property(i)}ys(){var i,e;return(i=(e=this.ui)==null?void 0:e.Sr(this.qt.feature_flag_cache_ttl_ms))!==null&&i!==void 0&&i}bs(){return!!this.ys()&&(this.ps||this.hs||(this.ps=!0,te.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}_s(){var i,e=(i=this.qt.evaluation_contexts)!==null&&i!==void 0?i:this.qt.evaluation_environments;return!this.qt.evaluation_environments||this.qt.evaluation_contexts||this.fs||(te.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.fs=!0),e!=null&&e.length?e.filter(t=>{var s=t&&typeof t=="string"&&t.trim().length>0;return s||te.error("Invalid evaluation context found:",t,"Expected non-empty string"),s}):[]}ws(){return this._s().length>0}xs(){var i=this.qt.flag_keys;if(!w(i)){if(q(i))return i.filter(e=>{var t=e&&typeof e=="string"&&e.trim().length>0;return t||te.error("Invalid flag key found:",e,"Expected non-empty string"),t});te.error("Invalid flag_keys found:",i,"Expected array of non-empty strings")}}initialize(){var i,e,{config:t}=this._instance,s=(i=(e=t.bootstrap)==null?void 0:e.featureFlags)!==null&&i!==void 0?i:{};if(Object.keys(s).length){var r,n,a=(r=(n=t.bootstrap)==null?void 0:n.featureFlagPayloads)!==null&&r!==void 0?r:{},o=Object.keys(s).filter(c=>!!s[c]).reduce((c,u)=>(c[u]=s[u]||!1,c),{}),l=Object.keys(a).filter(c=>o[c]).reduce((c,u)=>(a[u]&&(c[u]=a[u]),c),{});this.receivedFeatureFlags({featureFlags:o,featureFlagPayloads:l})}}updateFlags(i,e,t){var s=t!=null&&t.merge?this.getFlagVariants():{},r=t!=null&&t.merge?this.getFlagPayloads():{},n=f({},s,i),a=f({},r,e),o={};for(var[l,c]of Object.entries(n)){var u=typeof c=="string";o[l]={key:l,enabled:!!u||!!c,variant:u?c:void 0,reason:void 0,metadata:w(a==null?void 0:a[l])?void 0:{id:0,version:void 0,description:void 0,payload:a[l]}}}this.receivedFeatureFlags({flags:o})}get hasLoadedFlags(){return this.ls}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var i=this.gs(Es),e=this.gs(Ae),t=this.gs(nt);if(!t&&!e)return i||{};var s=z({},i||{}),r=[...new Set([...Object.keys(t||{}),...Object.keys(e||{})])];for(var n of r){var a,o,l=s[n],c=e==null?void 0:e[n],u=w(c)?(a=l==null?void 0:l.enabled)!==null&&a!==void 0&&a:!!c,h=w(c)?l.variant:typeof c=="string"?c:void 0,d=t==null?void 0:t[n],p=f({},l,{enabled:u,variant:u?h??(l==null?void 0:l.variant):void 0});u!==(l==null?void 0:l.enabled)&&(p.original_enabled=l==null?void 0:l.enabled),h!==(l==null?void 0:l.variant)&&(p.original_variant=l==null?void 0:l.variant),d&&(p.metadata=f({},l==null?void 0:l.metadata,{payload:d,original_payload:l==null||(o=l.metadata)==null?void 0:o.payload})),s[n]=p}return this.us||(te.warn(" Overriding feature flag details!",{flagDetails:i,overriddenPayloads:t,finalDetails:s}),this.us=!0),s}getFlagVariants(){var i=this.gs(ct),e=this.gs(Ae);if(!e)return i||{};for(var t=z({},i),s=Object.keys(e),r=0;s.length>r;r++)t[s[r]]=e[s[r]];return this.us||(te.warn(" Overriding feature flags!",{enabledFlags:i,overriddenFlags:e,finalFlags:t}),this.us=!0),t}getFlagPayloads(){var i=this.gs(Ss),e=this.gs(nt);if(!e)return i||{};for(var t=z({},i||{}),s=Object.keys(e),r=0;s.length>r;r++)t[s[r]]=e[s[r]];return this.us||(te.warn(" Overriding feature flag payloads!",{flagPayloads:i,overriddenPayloads:e,finalPayloads:t}),this.us=!0),t}reloadFeatureFlags(){this.cs||this.qt.advanced_disable_feature_flags||this.Ss||(this._instance.Ui.emit("featureFlagsReloading",!0),this.Ss=setTimeout(()=>{this.ks()},5))}Cs(){clearTimeout(this.Ss),this.Ss=void 0}ensureFlagsLoaded(){this.ls||this.hs||this.Ss||this.reloadFeatureFlags()}setAnonymousDistinctId(i){this.$anon_distinct_id=i}setReloadingPaused(i){this.cs=i}ks(i){var e;if(this.Cs(),!this._instance.Dr())if(this.hs)this.ds=!0;else{var t=this.qt.token,s=this.gs(_i),r={token:t,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:f({},((e=this.ui)==null?void 0:e.get_initial_props())||{},this.gs(Ot)||{}),group_properties:this.gs(Je),timezone:fa()};_e(s)||w(s)||(r.$device_id=s),(i!=null&&i.disableFlags||this.qt.advanced_disable_feature_flags)&&(r.disable_flags=!0),this.ws()&&(r.evaluation_contexts=this._s());var n=this.xs();w(n)||(r.flag_keys=n);var a=!!this.qt.advanced_only_evaluate_survey_feature_flags,o=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.qt.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.hs=!0,this._instance._send_request({method:"POST",url:o,data:r,compression:this.qt.disable_compression?void 0:Pe.Base64,timeout:this.qt.feature_flag_request_timeout_ms,callback:l=>{var c,u,h,d=!0;if(l.statusCode===200&&(this.ds||(this.$anon_distinct_id=void 0),d=!1),this.hs=!1,!r.disable_flags||this.ds){this.vs=!d;var p=[];l.error?l.error instanceof Error?p.push(l.error.name==="AbortError"?"timeout":"connection_error"):p.push("unknown_error"):l.statusCode!==200&&p.push("api_error_"+l.statusCode),(c=l.json)!=null&&c.errorsWhileComputingFlags&&p.push("errors_while_computing_flags");var g,_=!((u=l.json)==null||(u=u.quotaLimited)==null||!u.includes("feature_flags"));_&&p.push("quota_limited"),(h=this.ui)==null||h.register({[Rs]:p}),_?te.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((g=l.json)!==null&&g!==void 0?g:{},d,{partialResponse:a}),this.ds&&(this.ds=!1,this.ks()))}}})}}getFeatureFlag(i,e){var t;if(e===void 0&&(e={}),!e.fresh||this.vs)if(this.ls||this.getFlags()&&this.getFlags().length>0){if(!this.bs()){var s=this.getFeatureFlagResult(i,e);return(t=s==null?void 0:s.variant)!==null&&t!==void 0?t:s==null?void 0:s.enabled}}else te.warn('getFeatureFlag for key "'+i+ss)}getFeatureFlagDetails(i){return this.getFlagsWithDetails()[i]}getFeatureFlagPayload(i){var e=this.getFeatureFlagResult(i,{send_event:!1});return e==null?void 0:e.payload}getFeatureFlagResult(i,e){if(e===void 0&&(e={}),!e.fresh||this.vs)if(this.ls||this.getFlags()&&this.getFlags().length>0){if(!this.bs()){var t=this.getFlagVariants(),s=i in t,r=t[i],n=this.getFlagPayloads()[i],a=String(r),o=this.gs(ks)||void 0,l=this.gs(fi)||void 0,c=this.gs(Lt)||{};if(this.qt.advanced_feature_flags_dedup_per_session){var u,h=this._instance.get_session_id(),d=this.gs(Ts);h&&h!==d&&(c={},(u=this.ui)==null||u.register({[Lt]:c,[Ts]:h}))}if((e.send_event||!("send_event"in e))&&(!(i in c)||!c[i].includes(a))){var p,g,_,M,T,C,I,R,E,P;q(c[i])?c[i].push(a):c[i]=[a],(p=this.ui)==null||p.register({[Lt]:c});var S=this.getFeatureFlagDetails(i),x=[...(g=this.gs(Rs))!==null&&g!==void 0?g:[]];w(r)&&x.push("flag_missing");var m={$feature_flag:i,$feature_flag_response:r,$feature_flag_payload:n||null,$feature_flag_request_id:o,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:((_=this.qt.bootstrap)==null||(_=_.featureFlags)==null?void 0:_[i])||null,$feature_flag_bootstrapped_payload:((M=this.qt.bootstrap)==null||(M=M.featureFlagPayloads)==null?void 0:M[i])||null,$used_bootstrap_value:!this.vs};w(S==null||(T=S.metadata)==null?void 0:T.version)||(m.$feature_flag_version=S.metadata.version);var k,F=(C=S==null||(I=S.reason)==null?void 0:I.description)!==null&&C!==void 0?C:S==null||(R=S.reason)==null?void 0:R.code;F&&(m.$feature_flag_reason=F),S!=null&&(E=S.metadata)!=null&&E.id&&(m.$feature_flag_id=S.metadata.id),w(S==null?void 0:S.original_variant)&&w(S==null?void 0:S.original_enabled)||(m.$feature_flag_original_response=w(S.original_variant)?S.original_enabled:S.original_variant),S!=null&&(P=S.metadata)!=null&&P.original_payload&&(m.$feature_flag_original_payload=S==null||(k=S.metadata)==null?void 0:k.original_payload),x.length&&(m.$feature_flag_error=x.join(",")),this._instance.capture("$feature_flag_called",m)}if(s){var L=n;
1if(!w(n))try{L=JSON.parse(n)}catch{}return{key:i,enabled:!!r,variant:typeof r=="string"?r:void 0,payload:L}}}}else te.warn('getFeatureFlagResult for key "'+i+ss)}getRemoteConfigPayload(i,e){var t=this.qt.token,s={distinct_id:this._instance.get_distinct_id(),token:t};this.ws()&&(s.evaluation_contexts=this._s());var r=this.xs();w(r)||(s.flag_keys=r),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:s,compression:this.qt.disable_compression?void 0:Pe.Base64,timeout:this.qt.feature_flag_request_timeout_ms,callback(n){var a,o=(a=n.json)==null?void 0:a.featureFlagPayloads;e((o==null?void 0:o[i])||void 0)}})}isFeatureEnabled(i,e){if(e===void 0&&(e={}),!e.fresh||this.vs){if(this.ls||this.getFlags()&&this.getFlags().length>0){var t=this.getFeatureFlag(i,e);return w(t)?void 0:!!t}te.warn('isFeatureEnabled for key "'+i+ss)}}addFeatureFlagsHandler(i){this.featureFlagEventHandlers.push(i)}removeFeatureFlagsHandler(i){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(e=>e!==i)}receivedFeatureFlags(i,e,t){if(this.ui){this.ls=!0;var s=this.getFlagVariants(),r=this.getFlagPayloads(),n=this.getFlagsWithDetails();(function(a,o,l,c,u,h){l===void 0&&(l={}),c===void 0&&(c={}),u===void 0&&(u={});var d=(x=>{var m=x.flags;return m?(x.featureFlags=Object.fromEntries(Object.keys(m).map(k=>{var F;return[k,(F=m[k].variant)!==null&&F!==void 0?F:m[k].enabled]})),x.featureFlagPayloads=Object.fromEntries(Object.keys(m).filter(k=>m[k].enabled).filter(k=>{var F;return(F=m[k].metadata)==null?void 0:F.payload}).map(k=>{var F;return[k,(F=m[k].metadata)==null?void 0:F.payload]}))):te.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),x})(a),p=d.flags,g=d.featureFlags,_=d.featureFlagPayloads;if(g){var M=a.requestId,T=a.evaluatedAt;if(q(g)){te.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var C={};if(g)for(var I=0;g.length>I;I++)C[g[I]]=!0;o&&o.register({[si]:g,[ct]:C})}else{var R=g,E=_,P=p;if(h!=null&&h.partialResponse)R=f({},l,R),E=f({},c,E),P=f({},u,P);else if(a.errorsWhileComputingFlags)if(p){var S=new Set(Object.keys(p).filter(x=>{var m;return!((m=p[x])!=null&&m.failed)}));R=f({},l,Object.fromEntries(Object.entries(R).filter(x=>{var[m]=x;return S.has(m)}))),E=f({},c,Object.fromEntries(Object.entries(E||{}).filter(x=>{var[m]=x;return S.has(m)}))),P=f({},u,Object.fromEntries(Object.entries(P||{}).filter(x=>{var[m]=x;return S.has(m)})))}else R=f({},l,R),E=f({},c,E),P=f({},u,P);o&&o.register(f({[si]:Object.keys(cn(R)),[ct]:R||{},[Ss]:E||{},[Es]:P||{}},M?{[ks]:M}:{},T?{[fi]:T}:{}))}}})(i,this.ui,s,r,n,t),e||(this.ps=!1),this.Is(e)}}override(i,e){e===void 0&&(e=!1),te.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:i,suppressWarning:e})}
1overrideFeatureFlags(i){if(!this._instance.__loaded||!this.ui)return te.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(i===!1)return this.ui.unregister(Ae),this.ui.unregister(nt),this.Is(),We.info("All overrides cleared");if(q(i)){var e=un(i);return this.ui.register({[Ae]:e}),this.Is(),We.info("Flag overrides set",{flags:i})}if(i&&typeof i=="object"&&("flags"in i||"payloads"in i)){var t,s=i;if(this.us=!!((t=s.suppressWarning)!==null&&t!==void 0&&t),"flags"in s){if(s.flags===!1)this.ui.unregister(Ae),We.info("Flag overrides cleared");else if(s.flags){if(q(s.flags)){var r=un(s.flags);this.ui.register({[Ae]:r})}else this.ui.register({[Ae]:s.flags});We.info("Flag overrides set",{flags:s.flags})}}return"payloads"in s&&(s.payloads===!1?(this.ui.unregister(nt),We.info("Payload overrides cleared")):s.payloads&&(this.ui.register({[nt]:s.payloads}),We.info("Payload overrides set",{payloads:s.payloads}))),void this.Is()}if(i&&typeof i=="object")return this.ui.register({[Ae]:i}),this.Is(),We.info("Flag overrides set",{flags:i});te.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:i})}
1onFeatureFlags(i){if(this.addFeatureFlagsHandler(i),this.ls){var{flags:e,flagVariants:t}=this.Ts();i(e,t)}return()=>this.removeFeatureFlagsHandler(i)}updateEarlyAccessFeatureEnrollment(i,e,t){var s,r=(this.gs(It)||[]).find(l=>l.flagKey===i),n={["$feature_enrollment/"+i]:e},a={$feature_flag:i,$feature_enrollment:e,$set:n};r&&(a.$early_access_feature_name=r.name),t&&(a.$feature_enrollment_stage=t),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(n,!1);var o=f({},this.getFlagVariants(),{[i]:e});(s=this.ui)==null||s.register({[si]:Object.keys(cn(o)),[ct]:o}),this.Is()}getEarlyAccessFeatures(i,e,t){e===void 0&&(e=!1);var s=this.gs(It),r=t?"&"+t.map(n=>"stage="+n).join("&"):"";if(s&&!e)return i(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.qt.token+r),method:"GET",callback:n=>{var a,o;if(n.json){var l=n.json.earlyAccessFeatures;return(a=this.ui)==null||a.unregister(It),(o=this.ui)==null||o.register({[It]:l}),i(l)}}})}Ts(){var i=this.getFlags(),e=this.getFlagVariants();return{flags:i.filter(t=>e[t]),flagVariants:Object.keys(e).filter(t=>e[t]).reduce((t,s)=>(t[s]=e[s],t),{})}}Is(i){var{flags:e,flagVariants:t}=this.Ts();this.featureFlagEventHandlers.forEach(s=>s(e,t,{errorsLoading:i}))}setPersonPropertiesForFlags(i,e){e===void 0&&(e=!0);var t=this.gs(Ot)||{},s=(i==null?void 0:i.$set)||(i!=null&&i.$set_once?{}:i),r=i==null?void 0:i.$set_once,n={};if(r)for(var a in r)({}).hasOwnProperty.call(r,a)&&(a in t||(n[a]=r[a]));this._instance.register({[Ot]:f({},t,n,s)}),e&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(Ot)}setGroupPropertiesForFlags(i,e){e===void 0&&(e=!0);var t=this.gs(Je)||{};Object.keys(t).length!==0&&Object.keys(t).forEach(s=>{t[s]=f({},t[s],i[s]),delete i[s]}),this._instance.register({[Je]:f({},t,i)}),e&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(i){if(i){var e=this.gs(Je)||{};this._instance.register({[Je]:f({},e,{[i]:{}})})}else this._instance.unregister(Je)}reset(){this.ls=!1,this.hs=!1,this.cs=!1,this.ds=!1,this.vs=!1,this.$anon_distinct_id=void 0,this.Cs(),this.us=!1}}},Cl={sessionRecording:class{get qt(){return this._instance.config}get ui(){return this._instance.persistence}get started(){var i;return!((i=this.Es)==null||!i.isStarted)}get status(){var i,e;return this.Ms===$t||this.Ms===ii?this.Ms:(i=(e=this.Es)==null?void 0:e.status)!==null&&i!==void 0?i:this.Ms}constructor(i){if(this._forceAllowLocalhostNetworkCapture=!1,this.Ms=en,this.Rs=void 0,this._instance=i,!this._instance.sessionManager)throw Oe.error("started without valid sessionManager"),new Error(zs+" started without valid sessionManager. This is a bug.");if(this.qt.cookieless_mode===qe)throw new Error(zs+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get Ps(){var i,e=!((i=this._instance.get_property(Xe))==null||!i.enabled),t=!this.qt.disable_session_recording,s=this.qt.disable_session_recording||this._instance.consent.isOptedOut();return v&&e&&t&&!s}startIfEnabledOrStop(i){var e;if(!this.Ps||(e=this.Es)==null||!e.isStarted){var t=!w(Object.assign)&&!w(Array.from);this.Ps&&t?(this.Os(i),Oe.info("starting")):(this.Ms=en,this.stopRecording())}}Os(i){var e,t,s;this.Ps&&(this.Ms!==$t&&this.Ms!==ii&&(this.Ms=tn),$!=null&&(e=$.__PosthogExtensions__)!=null&&(e=e.rrweb)!=null&&e.record&&(t=$.__PosthogExtensions__)!=null&&t.initSessionRecording?this.Ls(i):(s=$.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,this.Fs,r=>{if(r)return Oe.error("could not load recorder",r);this.Ls(i)}))}stopRecording(){var i,e;(i=this.Rs)==null||i.call(this),this.Rs=void 0,(e=this.Es)==null||e.stop()}As(){var i,e;(i=this.Rs)==null||i.call(this),this.Rs=void 0,(e=this.Es)==null||e.discard()}Ns(){var i;(i=this.ui)==null||i.unregister(Xs)}Ds(i,e){if(D(i))return null;var t,s=me(i)?i:parseFloat(i);return typeof(t=s)!="number"||!Number.isFinite(t)||0>t||t>1?(Oe.warn(e+" must be between 0 and 1. Ignoring invalid value:",i),null):s}$s(i){if(this.ui){var e,t,s=this.ui,r=()=>{var n,a=i.sessionRecording===!1?void 0:i.sessionRecording,o=this.Ds((n=this.qt.session_recording)==null?void 0:n.sampleRate,"session_recording.sampleRate"),l=this.Ds(a==null?void 0:a.sampleRate,"remote config sampleRate"),c=o??l;D(c)&&this.Ns();var u=a==null?void 0:a.minimumDurationMilliseconds;s.register({[Xe]:f({cache_timestamp:Date.now(),enabled:!!a},a,{networkPayloadCapture:f({capturePerformance:i.capturePerformance},a==null?void 0:a.networkPayloadCapture),canvasRecording:{enabled:a==null?void 0:a.recordCanvas,fps:a==null?void 0:a.canvasFps,quality:a==null?void 0:a.canvasQuality},sampleRate:c,minimumDurationMilliseconds:w(u)?null:u,endpoint:a==null?void 0:a.endpoint,triggerMatchType:a==null?void 0:a.triggerMatchType,masking:a==null?void 0:a.masking,urlTriggers:a==null?void 0:a.urlTriggers,version:a==null?void 0:a.version,triggerGroups:a==null?void 0:a.triggerGroups})})};r(),(e=this.Rs)==null||e.call(this),this.Rs=(t=this._instance.sessionManager)==null?void 0:t.onSessionId(r)}}onRemoteConfig(i){return"sessionRecording"in i?i.sessionRecording===!1?(this.$s(i),void this.As()):(this.$s(i),void this.startIfEnabledOrStop()):(this.Ms===$t&&(this.Ms=ii,Oe.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(i,e){var t;e===void 0&&(e="log"),(t=this.Es)!=null&&t.log?this.Es.log(i,e):Oe.warn("log called before recorder was ready")}get Fs(){var i,e,t=(i=this._instance)==null||(i=i.persistence)==null?void 0:i.get_property(Xe);return(t==null||(e=t.scriptConfig)==null?void 0:e.script)||"lazy-recorder"}qs(){var i,e,t=this._instance.get_property(Xe);if(!t)return!1;try{e=typeof t=="object"?t:JSON.parse(t)}catch(r){return Oe.warn("persisted remote config for session recording is invali
1d and will be ignored",r),!1}var s=(i=e.cache_timestamp)!==null&&i!==void 0?i:Date.now();return 36e5>=Date.now()-s}Ls(i){var e,t;if((e=$.__PosthogExtensions__)==null||!e.initSessionRecording)return Oe.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Jn]:!0});if(this.Es||(this.Es=(t=$.__PosthogExtensions__)==null?void 0:t.initSessionRecording(this._instance),this.Es._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.qs())return this.Ms===ii||this.Ms===$t?void 0:(this.Ms=$t,Oe.info("persisted remote config is stale, requesting fresh config before starting"),void new ma(this._instance).load());this.Ms=tn,this.Es.start(i)}onRRwebEmit(i){var e;(e=this.Es)==null||e.onRRwebEmit==null||e.onRRwebEmit(i)}overrideLinkedFlag(){var i,e;this.Es||(e=this.ui)==null||e.register({[Bn]:!0}),(i=this.Es)==null||i.overrideLinkedFlag()}overrideSampling(){var i,e;this.Es||(e=this.ui)==null||e.register({[Hn]:!0}),(i=this.Es)==null||i.overrideSampling()}overrideTrigger(i){var e,t;this.Es||(t=this.ui)==null||t.register({[i==="url"?zn:Vn]:!0}),(e=this.Es)==null||e.overrideTrigger(i)}get sdkDebugProperties(){var i;return((i=this.Es)==null?void 0:i.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(i,e){var t;return!((t=this.Es)==null||!t.tryAddCustomEvent(i,e))}}},Al={autocapture:class{constructor(i){this.js=!1,this.Hs=null,this.Us=!1,this.instance=i,this.rageclicks=new Xr(i.config.rageclick),this.Bs=null}initialize(){this.startIfEnabled()}get qt(){var i,e,t=Y(this.instance.config.autocapture)?this.instance.config.autocapture:{};return t.url_allowlist=(i=t.url_allowlist)==null?void 0:i.map(s=>new RegExp(s)),t.url_ignorelist=(e=t.url_ignorelist)==null?void 0:e.map(s=>new RegExp(s)),t}zs(){if(this.isBrowserSupported()){if(v&&b){var i=t=>{t=t||(v==null?void 0:v.event);try{this.Vs(t)}catch(s){es.error("Failed to capture event",s)}};if(K(b,"submit",i,{capture:!0}),K(b,"change",i,{capture:!0}),K(b,"click",i,{capture:!0}),this.qt.capture_copied_text){var e=t=>{t=t||(v==null?void 0:v.event);try{this.Vs(t,Qi)}catch(s){es.error("Failed to capture copy/cut event",s)}};K(b,"copy",e,{capture:!0}),K(b,"cut",e,{capture:!0})}}}else es.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.js&&(this.zs(),this.js=!0)}onRemoteConfig(i){i.elementsChainAsString&&(this.Us=i.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[gs]:!!i.autocapture_opt_out}),this.Hs=!!i.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(i){this.Bs=i}getElementSelectors(i){var e,t=[];return(e=this.Bs)==null||e.forEach(s=>{var r=b==null?void 0:b.querySelectorAll(s);r==null||r.forEach(n=>{i===n&&t.push(s)})}),t}get isEnabled(){var i,e,t=(i=this.instance.persistence)==null?void 0:i.props[gs];if(_e(this.Hs)&&!Re(t)&&!this.instance.Dr())return!1;var s=(e=this.Hs)!==null&&e!==void 0?e:!!t;return!!this.instance.config.autocapture&&!s}Vs(i,e){if(e===void 0&&(e="$autocapture"),this.isEnabled){var t,s=Bi(i);Zn(s)&&(s=s.parentNode||null),e==="$autocapture"&&i.type==="click"&&i instanceof MouseEvent&&this.instance.config.rageclick&&(t=this.rageclicks)!=null&&t.isRageClick(i.clientX,i.clientY,i.timeStamp||new Date().getTime())&&Rr(s,this.instance.config.rageclick)&&this.Vs(i,"$rageclick");var r=e===Qi;if(s&&function(h,d,p,g,_){var M,T,C,I;if(p===void 0&&(p=void 0),!v||ir(h)||(M=p)!=null&&M.url_allowlist&&!Pr(p.url_allowlist)||(T=p)!=null&&T.url_ignorelist&&Pr(p.url_ignorelist))return!1;if((C=p)!=null&&C.dom_event_allowlist){var R=p.dom_event_allowlist;if(R&&!R.some(m=>d.type===m))return!1}var{parentIsUsefulElement:E,targetElementList:P}=ra(h,g);if(!function(m,k){var F=k==null?void 0:k.element_allowlist;if(w(F))return!0;var L,A=function(j){if(F.some(ee=>j.tagName.toLowerCase()===ee))return{v:!0}};for(var N of m)if(L=A(N))return L.v;return!1}(P,p)||!ta(P,(I=p)==null?void 0:I.css_selector_allowlist))return!1;var S=v.getComputedStyle(h);if(S&&S.getPropertyValue("cursor")==="pointer"&&d.type==="click")return!0;var x=h.tagName.toLowerCase();switch(x){case"html":return!1;case"form":return(_||["submit"]).indexOf(d.type)>=0;case"input":case"select":case"textarea":return(_||["change","click"]).indexOf(d.type)>=0;default:return E?(_||["click"]).indexOf(d.type)>=0:(_||["click"]).indexOf(d.type)>=0&&(tr.indexOf(x)>-1||h.getAttribute("contenteditable")==="true")}}(s,i,this.qt,r,r?["copy","cut"]:void 0)){var{props:n,explicitNoCapture:a}=kl(s,{e:i,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.qt.element_attribute_ignorelist,elementsC
1hainAsString:this.Us});if(a)return!1;var o=this.getElementSelectors(s);if(o&&o.length>0&&(n.$element_selectors=o),e===Qi){var l,c=ea(v==null||(l=v.getSelection())==null?void 0:l.toString()),u=i.type||"clipboard";if(!c)return!1;n.$selected_content=c,n.$copy_type=u}return this.instance.capture(e,n),!0}}}isBrowserSupported(){return Le(b==null?void 0:b.querySelectorAll)}},historyAutocapture:class{constructor(i){var e;this._instance=i,this.Ws=(v==null||(e=v.location)==null?void 0:e.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(y.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.Zs&&this.Zs(),this.Zs=void 0,y.info("History API monitoring stopped")}monitorHistoryChanges(){var i,e;if(v&&v.history){var t=this;(i=v.history.pushState)!=null&&i.__posthog_wrapped__||Zr(v.history,"pushState",s=>function(r,n,a){s.call(this,r,n,a),t.Gs("pushState")}),(e=v.history.replaceState)!=null&&e.__posthog_wrapped__||Zr(v.history,"replaceState",s=>function(r,n,a){s.call(this,r,n,a),t.Gs("replaceState")}),this.Qs()}}Gs(i){try{var e,t=v==null||(e=v.location)==null?void 0:e.pathname;if(!t)return;t!==this.Ws&&this.isEnabled&&this._instance.capture(at,{navigation_type:i}),this.Ws=t}catch(s){y.error("Error capturing "+i+" pageview",s)}}Qs(){if(!this.Zs){var i=()=>{this.Gs("popstate")};K(v,"popstate",i),this.Zs=()=>{v&&v.removeEventListener("popstate",i)}}}},heatmaps:class{get qt(){return this.instance.config}constructor(i){var e;this.Js=!1,this.js=!1,this.Ks=null,this.instance=i,this.Js=!((e=this.instance.persistence)==null||!e.props[_s]),this.rageclicks=new Xr(i.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var i=5e3;return Y(this.qt.capture_heatmaps)&&this.qt.capture_heatmaps.flush_interval_milliseconds&&(i=this.qt.capture_heatmaps.flush_interval_milliseconds),i}get isEnabled(){return D(this.qt.capture_heatmaps)?D(this.qt.enable_heatmaps)?this.Js:this.qt.enable_heatmaps:this.qt.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.js)return;$l.info("starting..."),this.Ys(),this.At()}else{var i;clearInterval((i=this.Ks)!==null&&i!==void 0?i:void 0),this.Xs(),this.getAndClearBuffer()}}onRemoteConfig(i){if("heatmaps"in i){var e=!!i.heatmaps;this.instance.persistence&&this.instance.persistence.register({[_s]:e}),this.Js=e,this.startIfEnabled()}}getAndClearBuffer(){var i=this.M;return this.M=void 0,i}eo(i){this.Mt(i.originalEvent,"deadclick")}At(){this.Ks&&clearInterval(this.Ks),this.Ks=(b==null?void 0:b.visibilityState)==="visible"?setInterval(this.Kr.bind(this),this.flushIntervalMilliseconds):null}Ys(){v&&b&&(this.ro=this.Kr.bind(this),K(v,wi,this.ro),this.io=i=>this.Mt(i||(v==null?void 0:v.event)),K(b,"click",this.io,{capture:!0}),this.no=i=>this.so(i||(v==null?void 0:v.event)),K(b,"mousemove",this.no,{capture:!0}),this.oo=new Or(this.instance,Vo,this.eo.bind(this)),this.oo.startIfEnabledOrStop(),this.ao=this.At.bind(this),K(b,bi,this.ao),this.js=!0)}Xs(){var i;v&&b&&(this.ro&&v.removeEventListener(wi,this.ro),this.io&&b.removeEventListener("click",this.io,{capture:!0}),this.no&&b.removeEventListener("mousemove",this.no,{capture:!0}),this.ao&&b.removeEventListener(bi,this.ao),clearTimeout(this.uo),(i=this.oo)==null||i.stop(),this.js=!1)}lo(i,e){var t=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),n=function(a,o,l){for(var c=a;c&&Be(c)&&!ge(c,"body");){if(c===l)return!1;if(O(o,v==null?void 0:v.getComputedStyle(c).position))return!0;c=ia(c)}return!1}(Bi(i),["fixed","sticky"],r);return{x:i.clientX+(n?0:s),y:i.clientY+(n?0:t),target_fixed:n,type:e}}Mt(i,e){var t;if(e===void 0&&(e="click"),!kr(i.target)&&sn(i)){var s=this.lo(i,e);(t=this.rageclicks)!=null&&t.isRageClick(i.clientX,i.clientY,new Date().getTime())&&Rr(Bi(i),this.instance.config.rageclick)&&this.ho(f({},s,{type:"rageclick"})),this.ho(s)}}so(i){!kr(i.target)&&sn(i)&&(clearTimeout(this.uo),this.uo=setTimeout(()=>{this.ho(this.lo(i,"mousemove"))},500))}ho(i){if(v){var e=v.location.href,t=this.qt.custom_personal_data_properties,s=this.qt.mask_personal_data_properties?[...ft,...t||[]]:[],r=zt(e,s,Vt);this.M=this.M||{},this.M[r]||(this.M[r]=[]),this.M[r].push(i)}}Kr(){this.M&&!lt(this.M)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Or,webVitalsAutocapture:class{constructor(i){var e;this.Js=!1,this.js=!1,this.M={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.co=()=>{clearTimeout(this.do),this.M.metrics.length!==0&&(this._instance.capture("$web_vitals",this.M.metrics.reduce((t,s)=>f({},t,{["$web_vitals_"+s.name+"_event"]:f({},s),["$web_vitals_"+s.name+"_value"]:s.value}),{})),this.M={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.dt=t=>{var s;this.M=this.M||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var r=this.vo();if(!w(r))if(D(t==null?void 0:t.name)||D(t==null?void 0:t.value))Ge.error("Invalid metric received",t);else if(!this.fo||this.fo>t.value){this.M.url!==r&&(this.co(),this.do=setTimeout(this.co,this.flushToCaptureTimeoutMs)),w(this.M.url)&&(this.M.url=r),this.M.firstMetricTimestamp=w(this.M.firstMetricTimestamp)?Date.now():this.M.firstMetricTimestamp,t.attribution&&t.attribution.interactionTargetElement&&(t.attribution.interactionTargetElement=void 0);var n=(s=this._instance.sessionManager)==null?void 0:s.checkAndGetSessionAndWindowId(!0),a=f({},t,{$current_url:r,timestamp:Date.now()});w(n)||(a.$session_id=n.sessionId,a.$window_id=n.windowId),this.M.metrics.push(a),this.M.metrics.length===this.allowedMetrics.length&&this.co()}else Ge.error("Ignoring metric with value >= "+this.fo,t)},this.po=()=>
1{if(!this.js){var t,s,r,n,a=$.__PosthogExtensions__;w(a)||w(a.postHogWebVitalsCallbacks)||({onLCP:t,onCLS:s,onFCP:r,onINP:n}=a.postHogWebVitalsCallbacks),t&&s&&r&&n?(this.allowedMetrics.indexOf("LCP")>-1&&t(this.dt.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&s(this.dt.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&r(this.dt.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&n(this.dt.bind(this)),this.js=!0):Ge.error("web vitals callbacks not loaded - not starting")}},this._instance=i,this.Js=!((e=this._instance.persistence)==null||!e.props[bs]),this.startIfEnabled()}get mo(){return this._instance.config.capture_performance}get allowedMetrics(){var i,e,t=Y(this.mo)?(i=this.mo)==null?void 0:i.web_vitals_allowed_metrics:void 0;return D(t)?((e=this._instance.persistence)==null?void 0:e.props[xs])||["CLS","FCP","INP","LCP"]:t}get flushToCaptureTimeoutMs(){return(Y(this.mo)?this.mo.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var i=Y(this.mo)?this.mo.web_vitals_attribution:void 0;return i!=null&&i}get fo(){var i=Y(this.mo)&&me(this.mo.__web_vitals_max_value)?this.mo.__web_vitals_max_value:Qr;return i>0&&6e4>=i?Qr:i}get isEnabled(){var i=ie==null?void 0:ie.protocol;if(i!=="http:"&&i!=="https:")return Ge.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=Y(this.mo)?this.mo.web_vitals:Re(this.mo)?this.mo:void 0;return Re(e)?e:this.Js}startIfEnabled(){this.isEnabled&&!this.js&&(Ge.info("enabled, starting..."),this.lr(this.po))}onRemoteConfig(i){if("capturePerformance"in i){var e=Y(i.capturePerformance)&&!!i.capturePerformance.web_vitals,t=Y(i.capturePerformance)?i.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[bs]:e}),this._instance.persistence.register({[xs]:t})),this.Js=e,this.startIfEnabled()}}lr(i){var e,t;(e=$.__PosthogExtensions__)!=null&&e.postHogWebVitalsCallbacks?i():(t=$.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",s=>{s?Ge.error("failed to load script",s):i()})}vo(){var i=v?v.location.href:void 0;if(i){var e=this._instance.config.custom_personal_data_properties,t=this._instance.config.mask_personal_data_properties?[...ft,...e||[]]:[];return zt(i,t,Vt)}Ge.error("Could not determine current URL")}}},Ll={exceptionObserver:class{constructor(i){var e,t,s;this.po=()=>{var r;if(v&&this.isEnabled&&(r=$.__PosthogExtensions__)!=null&&r.errorWrappingFunctions){var n=$.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,a=$.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,o=$.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.yo&&this.qt.capture_unhandled_errors&&(this.yo=n(this.captureException.bind(this))),!this.bo&&this.qt.capture_unhandled_rejections&&(this.bo=a(this.captureException.bind(this))),!this._o&&this.qt.capture_console_errors&&(this._o=o(this.captureException.bind(this)))}catch(l){Pt.error("failed to start",l),this.wo()}}},this._instance=i,this.xo=!((e=this._instance.persistence)==null||!e.props[fs]),this.So=new Ba({refillRate:(t=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&t!==void 0?t:1,bucketSize:(s=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&s!==void 0?s:10,refillInterval:1e4,Gt:Pt}),this.qt=this.ko(),this.startIfEnabledOrStop()}ko(){var i=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Y(i)?e=f({},e,i):(w(i)?this.xo:i)&&(e=f({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.qt.capture_console_errors||this.qt.capture_unhandled_errors||this.qt.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Pt.info("enabled"),this.wo(),this.lr(this.po)):this.wo()}lr(i){var e,t;(e=$.__PosthogExtensions__)!=null&&e.errorWrappingFunctions&&i(),(t=$.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,"exception-autocapture",s=>{if(s)return Pt.error("failed to load script",s);i()})}wo(){var i,e,t;(i=this.yo)==null||i.call(this),this.yo=void 0,(e=this.bo)==null||e.call(this),this.bo=void 0,(t=this._o)==null||t.call(this),this._o=void 0}onRemoteConfig(i){"autocaptureExceptions"in i&&(this.xo=!!i.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[fs]:this.xo}),this.qt=this.ko(),this.startIfEnabledOrStop())}onConfigChange(){this.qt=this.ko()}
1captureException(i){var e,t,s,r=(e=i==null||(t=i.$exception_list)==null||(t=t[0])==null?void 0:t.type)!==null&&e!==void 0?e:"Exception";this.So.consumeRateLimit(r)?Pt.info("Skipping exception capture because of client rate limiting.",{exception:r}):(s=this._instance.exceptions)==null||s.sendExceptionEvent(i)}},exceptions:class{constructor(i){var e,t;this.Co=[],this.Io=new io([new co,new bo,new po,new ho,new mo,new fo,new go,new yo],function(s){for(var r=arguments.length,n=new Array(r>1?r-1:0),a=1;r>a;a++)n[a-1]=arguments[a];return function(o,l){l===void 0&&(l=0);for(var c=[],u=o.split(` 2`),h=l;u.length>h;h++){var d=u[h];if(1024>=d.length){var p=wr.test(d)?d.replace(wr,"$1"):d;if(!p.match(/\S*Error: /)){for(var g of n){var _=g(p,s);if(_){c.push(_);break}}if(c.length>=50)break}}}return function(M){if(!M.length)return[];var T=Array.from(M);return T.reverse(),T.slice(0,50).map(C=>{return f({},C,{filename:C.filename||(I=T,I[I.length-1]||{}).filename,function:C.function||_t});var I})}(c)}}("web:javascript",ao,uo)),this._instance=i,this.Co=(e=(t=this._instance.persistence)==null?void 0:t.get_property(ms))!==null&&e!==void 0?e:[],this.To=gi(this.Eo()),this.Mo=new xo(this.To)}onConfigChange(){this.To=gi(this.Eo()),this.Mo.setConfig(this.To)}onRemoteConfig(i){var e,t,s;if("errorTracking"in i){var r=(e=(t=i.errorTracking)==null?void 0:t.suppressionRules)!==null&&e!==void 0?e:[],n=(s=i.errorTracking)==null?void 0:s.captureExtensionExceptions;this.Co=r,this._instance.persistence&&this._instance.persistence.register({[ms]:this.Co,[ys]:n})}}get Ro(){var i,e=!!this._instance.get_property(ys),t=this._instance.config.error_tracking.captureExtensionExceptions;return(i=t??e)!==null&&i!==void 0&&i}buildProperties(i,e){return this.Io.buildFromUnknown(i,{syntheticException:e==null?void 0:e.syntheticException,mechanism:{handled:e==null?void 0:e.handled}})}addExceptionStep(i,e){if(this.To.enabled)try{if(!V(i)||i.trim().length===0)return void Me.warn("Ignoring exception step because message must be a non-empty string");var t=this.Po(e),{sanitizedProperties:s,droppedKeys:r}=function(n){if(!n)return{sanitizedProperties:{},droppedKeys:[]};var a=[];return{sanitizedProperties:Object.keys(n).reduce((o,l)=>wo.has(l)?(a.push(l),o):(o[l]=n[l],o),{}),droppedKeys:a}}(t);r.length>0&&Me.warn("Ignoring reserved exception step fields",{droppedKeys:r}),this.Mo.add(f({[pi]:i,[vi]:new Date().toISOString()},s))}catch(n){Me.error("Failed to add exception step. Ignoring breadcrumb.",n)}}sendExceptionEvent(i){try{var e=i.$exception_list;if(this.Oo(e)){if(this.Lo(e))return this.Fo("Exception dropped: matched a suppression rule"),void Me.info("Skipping exception capture because a suppression rule matched");if(!this.Ro&&this.Ao(e))return this.Fo("Exception dropped: thrown by a browser extension"),void Me.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.No(e))return this.Fo("Exception dropped: thrown by the PostHog SDK"),void Me.info("Skipping exception capture because it was thrown by the PostHog SDK")}var t=this.To.enabled&&D(i.$exception_steps)?this.Do(i):i;try{var s=this._instance.capture("$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent",cn:!0});return s&&this.Mo.clear(),s}catch(r){return Me.error("Failed to capture exception event. Dropping this exception.",r),void this.Mo.clear()}}catch(r){return void Me.error("Failed to process exception event. Ignoring this exception.",r)}}Do(i){try{var e=this.Mo.getAttachable();return e.length===0?i:f({},i,{$exception_steps:e})}catch(t){return Me.error("Failed to read buffered exception steps. Capturing exception without steps.",t),i}}Fo(i){this.To.enabled&&this.Mo.add({[pi]:i,[vi]:new Date().toISOString()})}Po(i){return Y(i)?f({},i):{}}Eo(){var i,e;return(i=(e=this._instance.config.error_tracking)==null?void 0:e.exception_steps)!==null&&i!==void 0?i:{}}Lo(i){if(i.length===0)return!1;var e=i.reduce((t,s)=>{var{type:r,value:n}=s;return V(r)&&r.length>0&&t.$exception_types.push(r),V(n)&&n.length>0&&t.$exception_values.push(n),t},{$exception_types:[],$exception_values:[]});return this.Co.some(t=>{var s=t.values.map(r=>{var n,a=Pa[r.operator],o=q(r.value)?r.value:[r.value],l=(n=e[r.key])!==null&&n!==void 0?n:[];return o.length>0&&a(o,l)});return t.type==="OR"?s.some(Boolean):s.every(Boolean)})}Ao(i){return i.flatMap(e=>{var t,s;return(t=(s=e.stacktrace)==null?void 0:s.frames)!==null&&t!==void 0?t:[]}).some(e=>e.filename&&e.filename.startsWith("chrome-extension://"))}No(i){if(i.length>0){var e,t,s,r,n=(e=(t=i[0].stacktrace)==null?void 0:t.frames)!==null&&e!==void 0?e:[],a=n[n.length-1];return(s=a==null||(r=a.filename)==null?void 0:r.includes("posthog.com/static"))!==null&&s!==void 0&&s}return!1}Oo(i){return!D(i)&&q(i)}}},ql=f({productTours:class{get ui(){return this._instance.persistence}constructor(i){this.$o=null,this.qo=null,this._instance=i}initialize(){this.loadIfEnabled()}onRemoteConfig(i){"productTours"in i&&(this.ui&&this.ui.register({[ws]:!!i.productTours}),this.loadIfEnabled())}loadIfEnabled(){var i,e;this.$o||(i=this._instance).config.disable_product_tours||(e=i.persistence)==null||!e.get_property(ws)||this.lr(()=>this.jo())}lr(i){var e,t;(e=$.__PosthogExtensions__)!=null&&e.generateProductTours?i():(t=$.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,"product-tours",s=>{s?rn.error("Could not load product tours script",s):i()})}jo(){var i;!this.$o&&(i=$.__PosthogExtensions__)!=null&&i.generateProductTours&&(this.$o=$.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(i,e){if(e===void 0&&(e=!1),!q(this.qo)||e){var t=this.ui;if(t){var s=t.props[ri];if(q(s)&&!e)return this.qo=s,void i(s,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:r=>{var n=r.statusCode;if(n!==200||!r.json){var a="Product Tours API could not be loaded, status: "+n;return rn.error(a),void i([],{isLoaded:!1,error:a})}var o=q(r.json.product_tours)?r.json.product_tours:[];this.qo=o,t&&t.register({[ri]:o}),i(o,{isLoaded:!0})}})}else i(this.qo,{isLoaded:!0})}getActiveProductTours(i){D(this.$o)?i([],{isLoaded:!1,error:"Product tours not loaded"}):this.$o.getActiveProductTours(i)}showProductTour(i){var e;(e=this.$o)==null||e.showTourById(i)}previewTour(i){this.$o?this.$o.previewTour(i):this.lr(()=>{var e;this.jo(),(e=this.$o)==null||e.previewTour(i)})}dismissProductTour(){var i;(i=this.$o)==null||i.dismissTour("user_clicked_skip")}nextStep(){var i;(i=this.$o)==null||i.nextStep()}previousStep(){var i;(i=this.$o)==null||i.previousStep()}clearCache(){var i;this.qo=null,(i=this.ui)==null||i.unregister(ri)}resetTour(i){var e;(e=this.$o)==null||e.resetTour(i)}resetAllTours(){var i;(i=this.$o)==null||i.resetAllTours()}cancelPendingTour(i){var e;(e=this.$o)==null||e.cancelPendingTour(i)}}}
vendor: 1,455 bytes, line 2
2,Oi),Dl={siteApps:class{constructor(i){this._instance=i,this.Ho=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Uo(i,e){if(e){var t=this.globalsForEvent(e);this.Ho.push(t),this.Ho.length>1e3&&(this.Ho=this.Ho.slice(10))}}get siteAppLoaders(){var i;return(i=$._POSTHOG_REMOTE_CONFIG)==null||(i=i[this._instance.config.token])==null?void 0:i.siteApps}initialize(){if(this.isEnabled){var i=this._instance._addCaptureHook(this.Uo.bind(this));this.Bo=()=>{i(),this.Ho=[],this.Bo=void 0}}}globalsForEvent(i){var e,t,s,r,n,a,o;if(!i)throw new Error("Event payload is required");var l={},c=this._instance.get_property("$groups")||[],u=this._instance.get_property("$stored_group_properties")||{};for(var[h,d]of Object.entries(u))l[h]={id:c[h],type:h,properties:d};var{$set_once:p,$set:g}=i;return{event:f({},dn(i,Tl),{properties:f({},i.properties,g?{$set:f({},(e=(t=i.properties)==null?void 0:t.$set)!==null&&e!==void 0?e:{},g)}:{},p?{$set_once:f({},(s=(r=i.properties)==null?void 0:r.$set_once)!==null&&s!==void 0?s:{},p)}:{}),elements_chain:(n=(a=i.properties)==null?void 0:a.$elements_chain)!==null&&n!==void 0?n:"",distinct_id:(o=i.properties)==null?void 0:o.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}setupSiteApp(i){var e=this.apps[i.id],t=()=>{var a;!e.errored&&this.Ho.length&&(Ue.info("Processing "+this.Ho.length+" events for site app with id "+i.id),this.Ho.forEac
2h(o=>e.processEvent==null?void 0:e.processEvent(o)),e.processedBuffer=!0),Object.values(this.apps).every(o=>o.processedBuffer||o.errored)&&((a=this.Bo)==null||a.call(this))},s=!1,r=a=>{e.errored=!a,e.loaded=!0,Ue.info("Site app with id "+i.id+" "+(a?"loaded":"errored")),s&&t()};try{var{processEvent:n}=i.init({posthog:this._instance,callback(a){r(a)}});n&&(e.processEvent=n),s=!0}catch(a){Ue.error(nn+i.id,a),r(!1)}if(s&&e.loaded)try{t()}catch(a){Ue.error("Error while processing buffered events PostHog app with config id "+i.id,a),e.errored=!0}}zo(){var i=this.siteAppLoaders||[];for(var e of i)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(var t of i)this.setupSiteApp(t)}Vo(i){if(Object.keys(this.apps).length!==0){var e=this.globalsForEvent(i);for(var t of Object.values(this.apps))try{t.processEvent==null||t.processEvent(e)}catch(s){Ue.error("Error while processing event "+i.event+" for site app "+t.id,s)}}}onRemoteConfig(i){var e,t,s,r=this;if((e=this.siteAppLoaders)!=null&&e.length)return this.isEnabled?(this.zo(),void this._instance.on("eventCaptured",l=>this.Vo(l))):void Ue.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((t=this.Bo)==null||t.call(this),(s=i.siteApps)!=null&&s.length)if(this.isEnabled){var n=function(l){var c;$["__$$ph_site_app_"+l]=r._instance,(c=$.__PosthogExtensions__)==null||c.loadSiteApp==null||c.loadSiteApp(r._instance,o,u=>{if(u)return Ue.error(nn+l,u)})};for(var{id:a,url:o}of i.siteApps)n(a)}else Ue.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},Nl={tracingHeaders:class{constructor(i){this.Wo=void 0,this.Zo=void 0,this.Go=void 0,this.po=()=>{var e,t,s=this.Qo();s?(w(this.Wo)&&(this.Wo=(e=$.__PosthogExtensions__)==null||(e=e.tracingHeadersPatchFns)==null?void 0:e._patchXHR(s,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),w(this.Zo)&&(this.Zo=(t=$.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null?void 0:t._patchFetch(s,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.wo()},this._instance=i}initialize(){this.startIfEnabledOrStop()}lr(i){var e,t;(e=$.__PosthogExtensions__)!=null&&e.tracingHeadersPatchFns?i():(t=$.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,"tracing-headers",s=>{if(s)return Pl.error("failed to load script",s);i()})}Jo(){var i,e;return(i=(e=this._instance.config.tracing_headers)!==null&&e!==void 0?e:this._instance.config.addTracingHeaders)!==null&&i!==void 0?i:this._instance.config.__add_tracing_headers}Qo(){var i=this.Jo();return q(i)?(q(this.Go)?this.Go.splice(0,this.Go.length,...i):this.Go=[...i],i.length>0?this.Go:void 0):(q(this.Go)&&this.Go.splice(0),this.Go=i||void 0,this.Go)}wo(){var i,e;(i=this.Wo)==null||i.call(this),(e=this.Zo)==null||e.call(this),this.Wo=void 0,this.Zo=void 0}startIfEnabledOrStop(){this.Qo()?this.lr(this.po):this.wo()}}},jl=f({surveys:class{get qt(){return this._instance.config}constructor(i){this.Ko=void 0,this._surveyManager=null,this.Yo=!1,this.Xo=[],this.ea=null,this._instance=i,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(i){if(!this.qt.disable_surveys){var e=i.surveys;if(D(e))return U.warn("Flags not loaded yet. Not loading surveys.");var t=q(e);this.Ko=t?e.length>0:e,U.info("flags response received, isSurveysEnabled: "+this.Ko),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var i=[],e=0;e<localStorage.length;e++){var t=localStorage.key(e);(t!=null&&t.startsWith(Hs)||t!=null&&t.startsWith("inProgressSurvey_"))&&i.push(t)}i.forEach(s=>localStorage.removeItem(s))}loadIfEnabled(){if(!this._surveyManager)if(this.Yo)U.info("Already initializing surveys, skipping...");else if(this.qt.disable_surveys)U.info(an);else if(this.qt.cookieless_mode&&this._instance.consent.isOptedOut())U.info("Not loading surveys in cookieless mode without consent.");else{var i=$==null?void 0:$.__PosthogExtensions__;if(i){if(!w(this.Ko)||this.qt.advanced_enable_surveys){var e=this.Ko||this.qt.advanced_enable_surveys;this.Yo=!0;try{var t=i.generateSurveys;if(t)return void this.ta(t,e);var s=i.loadExternalDependency;if(!s)return void this.ra(Zs);s(this._instance,"surveys",r=>{r||!i.generateSurveys?this.ra("Could not load surveys script",r):this.ta(i.generateSurveys,e)})}catch(r){throw this.ra("Error initializing surveys",r),r}finally{this.Yo=!1}}}else U.error("PostHog Extensions not found.")}}ta(i,e){this._surveyManager=i(this._instance,e),this._surveyEventReceiver=new Il(this._instance),U.info("Surveys loaded successfully"),this.ia({isLoaded:!0})}ra(i,e){U.error(i,e),this.ia({isLoaded:!1,error:i})}onSurveysLoaded(i){return this.Xo.push(i),this._surveyManager&&this.ia({isLoaded:!0}),()=>{this.Xo=this.Xo.filter(e=>e!==i)}}getSurveys(i,e){if(e===void 0&&(e=!1),this.qt.disable_surveys)return U.info(an),i([]);var t,s=this._instance.get_property(Ps);if(s&&!e)return i(s,{isLoaded:!0});typeof Promise<"u"&&this.ea?this.ea.then(r=>{var{surveys:n,context:a}=r;return i(n,a)}):(typeof Promise<"u"&&(this.ea=new Promise(r=>{t=r})),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.qt.token),method:"GET",timeout:this.qt.surveys_request_timeout_ms,callback:r=>{var n;this.ea=null;var a=r.statusCode;if(a!==200||!r.json){var o="Surveys API could not be loaded, status: "+a;U.error(o);var l={isLoaded:!1,error:o};return i([],l),void(t==null||t({surveys:[],context:l}))}var c,u=r.json.surveys||[],h=u.filter(p=>function(g){return!(!g.start_date||g.end_date)}
2(p)&&(function(g){var _;return!((_=g.conditions)==null||(_=_.events)==null||(_=_.values)==null||!_.length)}(p)||function(g){var _;return!((_=g.conditions)==null||(_=_.actions)==null||(_=_.values)==null||!_.length)}(p)));h.length>0&&((c=this._surveyEventReceiver)==null||c.register(h)),(n=this._instance.persistence)==null||n.register({[Ps]:u});var d={isLoaded:!0};i(u,d),t==null||t({surveys:u,context:d})}}))}ia(i){for(var e of this.Xo)try{if(!i.isLoaded)return e([],i);this.getSurveys(e)}catch(t){U.error("Error in survey callback",t)}}getActiveMatchingSurveys(i,e){if(e===void 0&&(e=!1),!D(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(i,e);U.warn("init was not called")}na(i){var e=null;return this.getSurveys(t=>{var s;e=(s=t.find(r=>r.id===i))!==null&&s!==void 0?s:null}),e}sa(i){if(D(this._surveyManager))return{eligible:!1,reason:is};var e=typeof i=="string"?this.na(i):i;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(i){if(D(this._surveyManager))return U.warn("init was not called"),{visible:!1,disabledReason:is};var e=this.sa(i);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(i,e){return D(this._surveyManager)?(U.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:is})):new Promise(t=>{this.getSurveys(s=>{var r,n=(r=s.find(o=>o.id===i))!==null&&r!==void 0?r:null;if(n){var a=this.sa(n);t({visible:a.eligible,disabledReason:a.reason})}else t({visible:!1,disabledReason:"Survey not found"})},e)})}renderSurvey(i,e,t){var s;if(D(this._surveyManager))U.warn("init was not called");else{var r=typeof i=="string"?this.na(i):i;if(r!=null&&r.id)if(fl.includes(r.type)){var n=b==null?void 0:b.querySelector(e);if(n)return(s=r.appearance)!=null&&s.surveyPopupDelaySeconds?(U.info("Rendering survey "+r.id+" with delay of "+r.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout(()=>{var a,o;U.info("Rendering survey "+r.id+" with delay of "+((a=r.appearance)==null?void 0:a.surveyPopupDelaySeconds)+" seconds"),(o=this._surveyManager)==null||o.renderSurvey(r,n,t),U.info("Survey "+r.id+" rendered")},1e3*r.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(r,n,t);U.warn("Survey element not found")}else U.warn("Surveys of type "+r.type+" cannot be rendered in the app");else U.warn("Survey not found")}}displaySurvey(i,e){var t;if(D(this._surveyManager))U.warn("init was not called");else{var s=this.na(i);if(s){var r=s;if((t=s.appearance)!=null&&t.surveyPopupDelaySeconds&&e.ignoreDelay&&(r=f({},s,{appearance:f({},s.appearance,{surveyPopupDelaySeconds:0})})),e.displayType!==Ls.Popover&&e.initialResponses&&U.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),e.ignoreConditions===!1){var n=this.canRenderSurvey(s);if(!n.visible)return void U.warn("Survey is not eligible to be displayed: ",n.disabledReason)}e.displayType!==Ls.Inline?this._surveyManager.handlePopoverSurvey(r,e):this.renderSurvey(r,e.selector,e.properties)}else U.warn("Survey not found")}}cancelPendingSurvey(i){D(this._surveyManager)?U.warn("init was not called"):this._surveyManager.cancelSurvey(i)}handlePageUnload(){var i;(i=this._surveyManager)==null||i.handlePageUnload()}}},Oi),Ul={toolbar:class{constructor(i){this.instance=i}oa(i){$.ph_toolbar_state=i}aa(){var i;return(i=$.ph_toolbar_state)!==null&&i!==void 0?i:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(i,e,t){if(i===void 0&&(i=void 0),e===void 0&&(e=void 0),t===void 0&&(t=void 0),Kn(this.instance.config)||!v||!b)return!1;i=i??v.location,t=t??v.history;try{if(!e){try{v.localStorage.setItem("test","test"),v.localStorage.removeItem("test")}catch{return!1}e=v==null?void 0:v.localStorage}var s,r=Ol||ki(i.hash,"__posthog")||ki(i.hash,"state"),n=r?Er(()=>JSON.parse(atob(decodeURIComponent(r))))||Er(()=>JSON.parse(decodeURIComponent(r))):null;return n&&n.action==="ph_authorize"?((s=n).source="url",s&&Object.keys(s).length>0&&(n.desiredHash?i.hash=n.desiredHash:t?t.replaceState(t.state,"",i.pathname+i.search):i.hash="")):((s=JSON.parse(e.getItem(on)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token||(this.loadToolbar(s),0))}catch{return!1}}ua(i){var e=$.ph_load_toolbar||$.ph_load_editor;!D(e)&&Le(e)?e(i,this.instance):ln.warn("No toolbar load function found")}loadToolbar(i){var e=!(b==null||!b.getElementById(Gn));if(!v||e)return!1;var t=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,s=f({token:this.instance.config.token},i,{apiURL:this.instance.requestRouter.endpointFor("ui")},t?{instrument:!1}:{});if(v.localStorage.setItem(on,JSON.stringify(f({},s,{source:void 0}))),this.aa()===2)this.ua(s);else if(this.aa()===0){var r;this.oa(1),(r=$.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"toolbar",n=>{if(n)return ln.error("[Toolbar] Failed to load",n),void this.oa(0);this.oa(2),this.ua(s)}),K(v,"turbolinks:load",()=>{this.oa(0),this.loadToolbar(s)})}return!0}la(i){return this.loadToolbar(i)}maybeLoadEditor(i,e,t){return i===void 0&&(i=void 0),e===void 0&&(e=void 0),t===void 0&&(t=void 0),this.maybeLoadToolbar(i,e,t)}}}
2,Hl=f({experiments:re},Oi),Bl={conversations:class{constructor(i){this.ha=void 0,this._conversationsManager=null,this.ca=!1,this.da=null,this._instance=i}initialize(){this.loadIfEnabled()}onRemoteConfig(i){if(!this._instance.config.disable_conversations){var e=i.conversations;D(e)||(Re(e)?this.ha=e:(this.ha=e.enabled,this.da=e),this.loadIfEnabled())}}reset(){var i;(i=this._conversationsManager)==null||i.reset(),this._conversationsManager=null,this.ha=void 0,this.da=null}loadIfEnabled(){if(!(this._conversationsManager||this.ca||this._instance.config.disable_conversations||Kn(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var i=$==null?void 0:$.__PosthogExtensions__;if(i&&!w(this.ha)&&this.ha)if(this.da&&this.da.token){this.ca=!0;try{var e=i.initConversations;if(e)return this.va(e),void(this.ca=!1);var t=i.loadExternalDependency;if(!t)return void this.fa(Zs);t(this._instance,"conversations",s=>{s||!i.initConversations?this.fa("Could not load conversations script",s):this.va(i.initConversations),this.ca=!1})}catch(s){this.fa("Error initializing conversations",s),this.ca=!1}}else be.error("Conversations enabled but missing token in remote config.")}}va(i){if(this.da)try{this._conversationsManager=i(this.da,this._instance),be.info("Conversations loaded successfully")}catch(e){this.fa("Error completing conversations initialization",e)}else be.error("Cannot complete initialization: remote config is null")}fa(i,e){be.error(i,e),this._conversationsManager=null,this.ca=!1}show(){this._conversationsManager?this._conversationsManager.show():be.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.ha===!0&&!_e(this._conversationsManager)}isVisible(){var i,e;return(i=(e=this._conversationsManager)==null?void 0:e.isVisible())!==null&&i!==void 0&&i}sendMessage(i,e,t){var s=this;return pe(function*(){return s._conversationsManager?s._conversationsManager.sendMessage(i,e,t):(be.warn(Ye),null)})()}getMessages(i,e){var t=this;return pe(function*(){return t._conversationsManager?t._conversationsManager.getMessages(i,e):(be.warn(Ye),null)})()}markAsRead(i){var e=this;return pe(function*(){return e._conversationsManager?e._conversationsManager.markAsRead(i):(be.warn(Ye),null)})()}getTickets(i){var e=this;return pe(function*(){return e._conversationsManager?e._conversationsManager.getTickets(i):(be.warn(Ye),null)})()}requestRestoreLink(i){var e=this;return pe(function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(i):(be.warn(Ye),null)})()}restoreFromToken(i){var e=this;return pe(function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(i):(be.warn(Ye),null)})()}restoreFromUrlToken(){var i=this;return pe(function*(){return i._conversationsManager?i._conversationsManager.restoreFromUrlToken():(be.warn(Ye),null)})()}getCurrentTicketId(){var i,e;return(i=(e=this._conversationsManager)==null?void 0:e.getCurrentTicketId())!==null&&i!==void 0?i:null}getWidgetSessionId(){var i,e;return(i=(e=this._conversationsManager)==null?void 0:e.getWidgetSessionId())!==null&&i!==void 0?i:null}yn(){var i;(i=this._conversationsManager)==null||i.setIdentity()}bn(){var i;(i=this._conversationsManager)==null||i.clearIdentity()}}},zl={logs:class{constructor(i){var e;this.pa=!1,this.ga=!1,this.Gt=G("[logs]"),this.ma=[],this.ya=0,this.ba=0,this._a=!1,this._instance=i,this._instance&&(e=this._instance.config.logs)!=null&&e.captureConsoleLogs&&(this.pa=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(i){var e,t=(e=i.logs)==null?void 0:e.captureConsoleLogs;!D(t)&&t&&(this.pa=!0,this.loadIfEnabled())}reset(){this.ma=[],this.Br&&(clearTimeout(this.Br),this.Br=void 0),this.ya=0,this.ba=0,this._a=!1}loadIfEnabled(){if(this.pa&&!this.ga){var i=$==null?void 0:$.__PosthogExtensions__;if(i){var e=i.loadExternalDependency;e?e(this._instance,"logs",t=>{var s;t||(s=i.logs)==null||!s.initializeLogs?this.Gt.error("Could not load logs script",t):(i.logs.initializeLogs(this._instance),this.ga=!0)}):this.Gt.error(Zs)}else this.Gt.error("PostHog Extensions not found.")}}captureLog(i){var e,t,s,r,n,a;if(this._instance.is_capturing())if(i&&i.body){var o=(e=(t=this._instance.config.logs)==null?void 0:t.flushIntervalMs)!==null&&e!==void 0?e:3e3,l=(s=(r=this._instance.config.logs)==null?void 0:r.maxLogsPerInterval)!==null&&s!==void 0?s:1e3,c=Date.now();if(o>c-this.ba||(this.ba=c,this.ya=0,this._a=!1),l>this.ya){this.ya++;var u=function(h,d){var p=h.level||"info",{text:g,number:_}=Ln[p]||eo,M=String(Date.now())+"000000",T={};d.distinctId&&(T.posthogDistinctId=d.distinctId),d.sessionId&&(T.sessionId=d.sessionId),d.currentUrl&&(T["url.full"]=d.currentUrl),d.screenName&&(T["screen.name"]=d.screenName),d.appState&&(T["app.state"]=d.appState),d.activeFeatureFlags&&d.activeFeatureFlags.length>0&&(T.feature_flags=d.activeFeatureFlags);var C=f({},T,h.attributes||{}),I={timeUnixNano:M,observedTimeUnixNano:M,severityNumber:_,severityText:g,body:{stringValue:h.body},attributes:br(C)};return h.trace_id&&(I.traceId=h.trace_id),h.span_id&&(I.spanId=h.span_id),w(h.trace_flags)||(I.flags=h.trace_flags),I}(i,this.wa());this.ma.push({record:u}),((n=(a=this._instance.config.logs)==null?void 0:a.maxBufferSize)!==null&&n!==void 0?n:100)>this.ma.length?this.xa():this.flushLogs()}else this._a||(this.Gt.warn("captureLog dropping logs: exceeded "+l+" logs per "+o+"ms"),this._a=!0)}else this.Gt.warn("captureLog requires a body")}get logger(){return this.Sa||(this.Sa={trace:(i,e)=>this.captureLog({body:i,level:"trace",attributes:e}),debug:(i,e)=>this.captureLog({body:i,level:"debug",attributes:e}),info:(i,e)=>this.captureLog({body:i,level:"info",attributes:e}),warn:(i,e)=>this.captureLog({body:i,level:"warn",attributes:e}),error:(i,e)=>this.captureLog({body:i,level:"error",attributes:e}),fatal:(i,e)=>this.captureLog({body:i,level:"fatal",attributes:e})}),this.Sa}flushLogs(i){if(this.Br&&(clearTimeout(this.Br),this.Br=void 0),this.ma.length!==0){var e=this.ma;this.ma=[];var t=this._instance.config.logs,s=f({"service.name":(t==null?void 0:t.serviceName)||"unknown_service"},(t==null?void 0:t.environment)&&{"deployment.environment":t.environment},(t==null?void 0:t.serviceVersion)&&{"service.version":t.serviceVersion}
2,t==null?void 0:t.resourceAttributes),r=function(a,o,l,c){return{resourceLogs:[{resource:{attributes:br(o)},scopeLogs:[{scope:{name:l,version:c},logRecords:a}]}]}}(e.map(a=>a.record),s,Q.LIB_NAME,Q.LIB_VERSION),n=this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token);this._instance.Yi({method:"POST",url:n,data:r,compression:"best-available",batchKey:"logs",transport:i})}}xa(){var i,e;this.Br||(this.Br=setTimeout(()=>{this.Br=void 0,this.flushLogs()},(i=(e=this._instance.config.logs)==null?void 0:e.flushIntervalMs)!==null&&i!==void 0?i:3e3))}wa(){var i,e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var{sessionId:t}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);e.sessionId=t}if($!=null&&(i=$.location)!=null&&i.href&&(e.currentUrl=$.location.href),this._instance.featureFlags){var s=this._instance.featureFlags.getFlags();s&&s.length>0&&(e.activeFeatureFlags=s)}return e}}},Vl=f({},Oi,Cl,Al,Ll,ql,Dl,jl,Nl,Ul,Hl,Bl,zl);we.__defaultExtensionClasses=f({},Vl);var eu=function(){Q.SDK_DIST_CHANNEL="npm";var i=Nt[ot]=new we;return function(){function e(){e.done||(e.done=!0,Ra=!1,H(Nt,function(t){t._dom_loaded()}))}b!=null&&b.addEventListener?b.readyState==="complete"?e():K(b,"DOMContentLoaded",e,{capture:!1}):v&&y.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),i}();export{Pe as Compression,Zl as DEFAULT_PRODUCT_TOUR_APPEARANCE,Ls as DisplaySurveyType,we as PostHog,el as ProductTourEventName,Ar as ProductTourEventProperties,Mt as SurveyEventName,Wi as SurveyEventProperties,wt as SurveyEventType,Wl as SurveyPosition,Kl as SurveyQuestionBranchingType,Jl as SurveyQuestionType,Xl as SurveySchedule,Yl as SurveyTabPosition,Gi as SurveyType,Gl as SurveyWidgetType,eu as default,eu as posthog,Ql as severityLevels};
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.