1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8229],{26614:(e,t,i)=>{i.d(t,{Ay:()=>oL});var s="undefined"!=typeof window?window:void 0,r="undefined"!=typeof globalThis?globalThis:s,n=null==r?void 0:r.navigator,a=null==r?void 0:r.document,o=null==r?void 0:r.location,l=null==r?void 0:r.fetch,u=null!=r&&r.XMLHttpRequest&&"withCredentials"in new r.XMLHttpRequest?r.XMLHttpRequest:void 0,h=null==r?void 0:r.AbortController,c=null==r?void 0:r.CompressionStream,d=null==n?void 0:n.userAgent;function p(){return!(!s||!1===s.navigator.onLine)}var v="undefined"!=typeof globalThis?globalThis:s;v&&"undefined"==typeof self&&(v.self=v),v&&"undefined"==typeof File&&(v.File=function(){});var g=null!=s?s:{},f={DEBUG:!1,LIB_VERSION:"0.5.1",LIB_NAME:"browser-common"};function _(e,t,i,s,r,n,a){try{var o=e[n](a),l=o.value}catch(e){return void i(e)}o.done?t(l):Promise.resolve(l).then(s,r)}function m(e){return function(){var t=this,i=arguments;return new Promise(function(s,r){var n=e.apply(t,i);function a(e){_(n,s,r,a,o,"next",e)}function o(e){_(n,s,r,a,o,"throw",e)}a(void 0)})}}function y(){return(y=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var i=arguments[t];for(var s in i)({}).hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e}).apply(null,arguments)}function b(e,t){if(null==e)return{};var i={};for(var s in e)if(({}).hasOwnProperty.call(e,s)){if(-1!==t.indexOf(s))continue;i[s]=e[s]}return i}var w=e=>{if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){return e}};function x(e){return"string"==typeof e||e}function k(e){return"string"==typeof e?e:void 0}var E,S=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],P=function(e){return e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.EnablePersonProcessing="enable_person_processing",e.PersonMode="person_mode",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.AiQueue="ai_queue",e.AiCaptureQueue="ai_capture_queue",e.LogsQueue="logs_queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.PushRegistered="push_registered",e.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e.DeviceId="device_id",e}({}),I=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({}),F=["$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"],T=["token"],O="NativeGzipValidationError",$=e=>e.length>=2&&31===e[0]&&139===e[1],C=(e,t)=>e===I.GZipJS||t===I.GZipJS||"gzip"===t,R=e=>!(!e||"object"!=typeof e)&&"NotReadableError"===("name"in e?String(e.name):""),M=e=>
1{var t=Error("Native gzip produced invalid output: "+e);throw t.name=O,t},q=function(){var e=m(function*(e,t){18>e.size&&M("too-short");var i=new Uint8Array((yield e.slice(0,10).arrayBuffer()));$(i)&&8===i[2]||M("invalid-header");var s=new DataView((yield e.slice(e.size-8).arrayBuffer()));s.getUint32(0,!0)!==(e=>{for(var t=(()=>{if(E)return E;E=[];for(var e=0;256>e;e++){for(var t=e,i=0;8>i;i++)t=1&t?0xedb88320^t>>>1:t>>>1;E[e]=t>>>0}return E})(),i=0xffffffff,s=0;e.length>s;s++)i=t[255&(i^e[s])]^i>>>8;return(0xffffffff^i)>>>0})(t)&&M("invalid-crc");var r=t.length>>>0;s.getUint32(4,!0)!==r&&M("invalid-size")});return function(t,i){return e.apply(this,arguments)}}();function A(){return(A=m(function*(e,t,i){void 0===t&&(t=!0);try{var s,r=(new TextEncoder).encode(e),n=new globalThis.CompressionStream("gzip"),a=n.writable.getWriter(),o=a.write(r).then(()=>a.close()).catch((s=m(function*(e){try{yield a.abort(e)}catch(e){}throw e}),function(e){return s.apply(this,arguments)})),l=new Response(n.readable).blob(),u=(yield Promise.all([l,o]))[0];return yield q(u,r),u}catch(e){if(null!=i&&i.rethrow)throw e;return t&&console.error("Failed to gzip compress data",e),null}})).apply(this,arguments)}var L="[Truncated]",D="[Unserializable]";function N(e){for(var t="",i=0;e.length>i;i++){var s=e.charCodeAt(i);if(55296>s||s>56319)t+=56320>s||s>57343?e[i]:"�";else{var r=e.charCodeAt(i+1);56320>r||r>57343?t+="�":(t+=e[i]+e[i+1],i++)}}return t}var j=["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"],B=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var i=e.toLowerCase();return j.concat(t).some(e=>{var t=e.toLowerCase();return -1!==i.indexOf(t)})};function z(e,t){return -1!==e.indexOf(t)}var H=function(e){return e.trim()},U=function(e){return e.replace(/^\$/,"")};function V(e){var t,i=[];return null!=(t=JSON.stringify(e,function(e,t){if("bigint"==typeof t)return t.toString();if("function"!=typeof t&&"symbol"!=typeof t){if(t instanceof Error)return{name:t.name,message:t.message,stack:t.stack};if(t&&"object"==typeof t){for(;i.length>0&&i[i.length-1]!==this;)i.pop();if(i.includes(t))return"[Circular]";i.push(t)}return t}}))?t:"null"}var G=Object.prototype,W=G.hasOwnProperty,J=G.toString,Y=Array.isArray||function(e){return"[object Array]"===J.call(e)},X=e=>"function"==typeof e,K=e=>e===Object(e)&&!Y(e),Q=e=>{if(K(e)){for(var t in e)if(W.call(e,t))return!1;return!0}return!1},Z=e=>void 0===e,ee=e=>"[object String]"==J.call(e),et=e=>ee(e)&&0===e.trim().length,ei=e=>null===e,es=e=>Z(e)||ei(e),er=e=>"[object Number]"==J.call(e)&&e==e,en=e=>er(e)&&e>0,ea=e=>"[object Boolean]"===J.call(e),eo=e=>z(F,e),el=e=>z(T,e);function eu(e){return null===e||"object"!=typeof e}function eh(e,t){return({}).toString.call(e)==="[object "+t+"]"}function ec(e){switch(({}).toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return ep(e,Error)}}function ed(e){return"undefined"!=typeof Event&&ep(e,Event)}function ep(e,t){try{return e instanceof t}catch(e){return!1}}var ev=[!0,"true",1,"1","yes"],eg=e=>z(ev,e),ef=[!1,"false",0,"0","no"];function e_(e,t,i,s,r){return t>i&&(s.warn("min cannot be greater than max."),t=i),er(e)?e>i?(s.warn(" cannot be greater than max: "+i+". Using max value instead."),i):t>e?(s.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(s.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+r),e_(r||i,t,i,s))}class em{constructor(e){this.k={},this.S=e.S,this.C=e_(e.bucketSize,0,100,e.I),this.R=e_(e.refillRate,0,this.C,e.I),this.A=e_(e.refillInterval,0,864e5,e.I)}O(e,t){var i=Math.floor((t-e.lastAccess)/this.A);i>0&&(e.tokens=Math.min(e.tokens+i*this.R,this.C),e.lastAccess=e.lastAccess+i*this.A)}consumeRateLimit(e){var t,i=Date.now(),s=String(e),r=this.k[s];return r?this.O(r,i):this.k[s]=r={tokens:this.C,lastAccess:i},0===r.tokens||(r.tokens--,0===r.tokens&&(null==(t=this.S)||t.call(this,e)),0===r.tokens)}stop(){this.k={}}}var ey="Mobile",eb="Android",ew="Tablet",ex=eb+" "+ew,ek="iPad",eE="Apple",eS=eE+" Watch",eP="Safari",eI="BlackBerry",eF="Samsung",eT=eF+"Browser",eO=eF+" Internet",e$="Chrome",eC=e$+" OS",eR=e$+" iOS",eM="Internet Explorer",eq=eM+" "+ey,eA="Opera",eL=eA+" Mini",eD="Edge",eN="Microsoft "+eD,ej="Firefox",eB=ej+" iOS",ez="Nintendo",eH="PlayStation",eU="Xbox",eV=eb+" "+ey,eG=ey+" "+eP,eW="Windows",eJ=eW+" Phone",eY="Nokia",eX="Ouya",eK="Generic",eQ=eK+" "+ey.toLowerCase(),eZ=eK+" "+ew.toLowerCase(),e0="Konqueror",e1="Oculus Browser",e2="Vivaldi",e3="Yandex",e5="Whale",e6="DuckDuckGo",e4="Pale Moon",e8="Waterfox",e9="Brave",e7="Google Search App",te="(\\d+(\\.\\d+)?)",tt=RegExp("Version/"+te),ti=RegExp(eU,"i"),ts=RegExp(eH+" \\w+","i"),tr=RegExp(ez+" \\w+","i"),tn=RegExp(eI+"|PlayBook|BB10","i"),ta={"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"},to=function(e,t,i,s){var r;return t=t||"",(null!=i&&i.brave?e9:null)||(null!=s&&s.detectGoogleSearchApp&&z(e,"GSA/")?e7:z(e," OPR/")&&z(e,"Mini")?eL:z(e," OPR/")?eA:tn.test(e)?eI:z(e,"IE"+ey)||z(e,"WPDesktop")?eq:z(e,"OculusBrowser")?e1:z(e,eT)?eO:z(e,eD)||z(e,"Edg/")?eN:z(e,e2+"/")?e2:z(e,"YaBrowser/")?e3:z(e,e5+"/")?e5:z(e,e6+"/")||z(e,"Ddg/")?e6:z(e,"FBIOS")?"Facebook "+ey:z(e,"UCWEB")||z(e,"UCBrowser")?"UC Browser":z(e,"CriOS")?eR:z(e,"CrMo")||z(e,e$)?e$:z(e,eb)&&z(e,eP)?eV:z(e,"FxiOS")?eB:z(e.toLowerCase(),e0.toLowerCase())?e0:z(e,e9+"/")?e9:(r=t)&&z(r,eE)||z(e,eP)&&!z(e,e$)&&!z(e,eb)?z(e,ey)?eG:eP:z(e,"PaleMoon/")?e4:z(e,e8+"/")?e8:z(e,ej)?ej:z(e,"MSIE")||z(e,"Trident/")?eM:z(e,"Gecko")?ej:"")},tl={[eq]:[RegExp("rv:"+te)],[eN]:[RegExp(eD+"?\\/"+te)],[e$]:[RegExp("("+e$+"|CrMo)\\/"+te)],[eR]:[RegExp("CriOS\\/"+te)],"UC Browser":[RegExp("(UCBrowser|UCWEB)\\/"+te)],[eP]:[tt],[eG]:[tt],[eA]:[RegExp("(Opera|OPR)\\/"+te)],[ej]:[RegExp(ej+"\\/"+te)],[eB]:[RegExp("FxiOS\\/"+te)],[e0]:[RegExp("Konqueror[:/]?"+te,"i")],[eI]:[RegExp(eI+" "+te),tt],[eV]:[RegExp("android\\s"+te,"i")],[eO]:[RegExp(eT+"\\/"+te)],[e
11]:[RegExp("OculusBrowser\\/"+te)],[e2]:[RegExp(e2+"\\/"+te)],[e3]:[RegExp("YaBrowser\\/"+te)],[e5]:[RegExp(e5+"\\/"+te)],[e9]:[RegExp(e9+"\\/"+te)],[e6]:[RegExp("(DuckDuckGo|Ddg)\\/"+te)],[e4]:[RegExp("PaleMoon\\/"+te)],[e8]:[RegExp(e8+"\\/"+te)],[e7]:[RegExp("GSA\\/"+te)],[eM]:[RegExp("(rv:|MSIE )"+te)],Mozilla:[RegExp("rv:"+te)]},tu=function(e,t,i,s){var r=tl[to(e,t,i,s)];if(Z(r))return null;for(var n=0;r.length>n;n++){var a=e.match(r[n]);if(a)return parseFloat(a[a.length-2])}return null},th=[[RegExp(eU+"; "+eU+" (.*?)[);]","i"),e=>[eU,e&&e[1]||""]],[RegExp(ez,"i"),[ez,""]],[RegExp(eH,"i"),[eH,""]],[tn,[eI,""]],[RegExp(eW,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[eJ,""];if(new RegExp(ey).test(t)&&!/IEMobile\b/.test(t))return[eW+" "+ey,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var s=ta[i[1]]||"";return/arm/i.test(t)&&(s="RT"),[eW,s]}return[eW,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?["iOS",[e[3],e[4],e[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=Z(e[2])?e[3]:e[2]),["watchOS",t]}],[RegExp("("+eb+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+eb+")","i"),e=>e&&e[2]?[eb,[e[2],e[3],e[4]||"0"].join(".")]:[eb,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[eC,""]],[/Linux|debian/i,["Linux",""]]],tc=function(e){return tr.test(e)?ez:ts.test(e)?eH:ti.test(e)?eU:RegExp(eX,"i").test(e)?eX:RegExp("("+eJ+"|WPDesktop)","i").test(e)?eJ:/iPad/.test(e)?ek:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?eS:tn.test(e)?eI:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":RegExp(eY,"i").test(e)?eY:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(ey).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?eb:ex:RegExp("(pda|"+ey+")","i").test(e)?eQ:RegExp(ew,"i").test(e)&&!RegExp(ew+" pc","i").test(e)?eZ:""},td=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function tp(e,t){return"string"==typeof e&&td.test(e)?e:t()}function tv(e){return e?e.split("#")[0]:e}function tg(e,t){var i=setTimeout(e,t);return(null==i?void 0:i.unref)&&(null==i||i.unref()),i}function tf(e,t,i){return t_.apply(this,arguments)}function t_(){return(t_=m(function*(e,t,i){var s;try{return yield Promise.race([e,new Promise((e,r)=>{s=tg(()=>{try{null==i||i(),e()}catch(e){r(e)}},t)})])}finally{clearTimeout(s)}})).apply(this,arguments)}var tm={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}},ty=tm.info,tb={}.propertyIsEnumerable;function tw(e,t){try{return tx(e,t,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch(e){return[]}}function tx(e,t,i,s){var r=[];for(var n in e)if(tb.call(e,n)){if(r.length>=1e3||0>=i.remainingNodes){null==t||t.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{var a=e[n];if(ei(a)||Z(a))continue;r.push({key:N(n),value:function e(t,i,s,r){if(0>=s.remainingNodes)return{stringValue:L};if(s.remainingNodes--,ea(t))return{boolValue:t};if("number"==typeof t){if(!Number.isFinite(t))return{stringValue:String(t)};if(Number.isInteger(t)){if(Number.isSafeInteger(t))return{intValue:String(t)};if("undefined"==typeof BigInt)return{stringValue:String(t)};var n=BigInt(t).toString();return t>=0x8000000000000000||-0x8000000000000000>t?(null==i||i.debug("Attribute "+n+" is outside the int64 range; encoding it as a string"),{stringValue:n}):{intValue:n}}return{doubleValue:t}}if("string"==typeof t)return{stringValue:N(t)};if("function"==typeof t)return{stringValue:"[Function]"};if("symbol"==typeof t)return{stringValue:String(t)};if("object"==typeof t&&null!==t){if(s.ancestors.has(t))return{stringValue:"[Circular]"};if(r>=20)return{stringValue:L};if(t instanceof Date){var a=Number.isFinite(t.getTime())?t.toISOString():String(t);return{stringValue:"string"==typeof a?N(a):String(a)}}s.ancestors.add(t);try{try{var o=t.toJSON;if("function"==typeof o)return e(o.call(t),i,s,r+1)}catch(e){}return Y(t)?{arrayValue:{values:function(t,i,s,r){for(var n=[],a=Math.min(t.length,1e3),o=0;a>o&&s.remainingNodes>0;o++)try{var l=o in t?t[o]:void 0;if(es(l))continue;n.push(e(l,i,s,r))}catch(e){n.push({stringValue:D})}return t.length>
1o&&n.push({stringValue:L}),n}(t,i,s,r+1)}}:{kvlistValue:{values:tx(t,i,s,r+1)}}}finally{s.ancestors.delete(t)}}return{stringValue:N(String(t))}}(a,t,i,s)})}catch(e){r.push({key:N(n),value:{stringValue:D}})}}return r}function tk(e,t,i){return y({},e.resourceAttributes,{"service.name":e.serviceName||"unknown_service"},e.environment&&{"deployment.environment":e.environment},e.serviceVersion&&{"service.version":e.serviceVersion},{"telemetry.sdk.name":t,"telemetry.sdk.version":i})}function tE(e,t,i,s){return{resourceLogs:[{resource:{attributes:tw(t)},scopeLogs:[{scope:{name:i,version:s},logRecords:e}]}]}}let tS=class{constructor(e,t,i,s,r,n,a){var o;void 0===n&&(n=()=>Promise.resolve()),this._instance=e,this.qi=t,this.I=i,this.rn=s,this.nn=r,this.sn=n,this.an=a,this.ln=null,this.un=0,this.hn=0,this.dn=0,this.vn=0,this.cn=!1,this.fn=t.maxBufferSize,this.pn=Math.max(null!=(o=t.maxQueueSize)?o:t.maxBufferSize,t.maxBufferSize),this.gn=t.flushIntervalMs,this.mn=t.maxBatchRecordsPerPost,this.yn=t.rateCapWindowMs,this.bn=t.maxLogsPerInterval}reset(){this._n(),this.ln=null,this.dn=0,this.vn=0,this.cn=!1,this.un=0,this.hn=0,this.mn=this.qi.maxBatchRecordsPerPost}onReconnect(){this.hn=0,this.wn()}captureLog(e){if(!this._instance.isDisabled&&!this._instance.optedOut&&null!=e&&e.body){var t=this.kn(e);if(null!==t)if(t.body){if(this.Sn()){var i={record:function(e,t,i){var s=tm[e.level||"info"]||ty,r=s.text,n=s.number,a=String(Date.now())+"000000",o={};t.distinctId&&(o.posthogDistinctId=t.distinctId),t.sessionId&&(o.sessionId=t.sessionId),t.windowId&&(o["window.id"]=t.windowId),es(t.sessionStartTimestamp)||(o.sessionStartTimestamp=String(t.sessionStartTimestamp)),es(t.lastActivityTimestamp)||(o.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(o["url.full"]=t.currentUrl),t.screenName&&(o["screen.name"]=t.screenName),t.appState&&(o["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(o.feature_flags=t.activeFeatureFlags);var l=y({},o),u=e.attributes;if(u){var h=[];try{h=Object.keys(u)}catch(e){h=[]}for(var c of h){var d=void 0;try{d=u[c]}catch(e){d=D}Object.defineProperty(l,c,{value:d,enumerable:!0,writable:!0,configurable:!0})}}var p={timeUnixNano:a,observedTimeUnixNano:a,severityNumber:n,severityText:r,body:{stringValue:function(e){try{return N(String(e))}catch(e){return D}}(e.body)},attributes:tw(l,i)};return e.trace_id&&(p.traceId=e.trace_id),e.span_id&&(p.spanId=e.span_id),Z(e.trace_flags)||(p.flags=e.trace_flags),p}(t,this.rn(),this.I)};this.nn(()=>this.xn(i))}}else this.I.info("Log was rejected in beforeSend function")}}kn(e){var t=this.qi.beforeSend;if(!t)return e;var i=Y(t)?t:[t],s=e;for(var r of i)try{var n=r(s);if(!n)return this.I.info("Log was rejected in beforeSend function"),null;s=n}catch(e){return this.I.error("Error in beforeSend function for log:",e),null}return s}Sn(){if(void 0===this.bn)return!0;var e=Date.now(),t=e-this.dn;return this.yn>t&&t>=0||(this.dn=e,this.vn=0,this.cn=!1),this.bn>this.vn?(this.vn++,!0):(this.cn||(this.I.warn("captureLog dropping logs: exceeded "+this.bn+" logs per "+this.yn+"ms"),this.cn=!0),!1)}flush(){var e=this;return m(function*(){if(!e._instance.isDisabled)return e.ln||(e.ln=e.Cn().finally(()=>{e.ln=null})),e.ln})()}Cn(){var e=this;return m(function*(){e._n();var t=null!=(r=e._instance.getPersistedProperty(P.LogsQueue))?r:[];if(0!==t.length)for(var i=t.length,s=0;t.length>0&&i>s;){e.un=0;var r,n,a,o=Math.min(t.length,e.mn),l=t.slice(0,o),u=tE(l.map(e=>e.record),e.Tn(),null!=(n=e.an)?n:e._instance.getLibraryId(),e._instance.getLibraryVersion()),h=yield e._instance.Mn(u);if("too-large"===h.kind&&l.length>1)e.mn=Math.max(1,Math.floor(l.length/2)),e.I.warn("Received 413 when sending logs batch of size "+l.length+", reducing batch size to "+e.mn);else if("retry-later"===h.kind||("too-large"===h.kind?e.I.warn("Dropping a single log record after 413 with batch size 1 â the record is larger than the server cap and cannot be split further."):"ok"===h.kind&&e.qi.maxBatchRecordsPerPost>e.mn&&(e.mn=Math.min(e.qi.maxBatchRecordsPerPost,e.mn+1)),yield e.En(l.length),t=null!=(a=e._instance.getPersistedProperty(P.LogsQueue))?a:[],s+=l.length,"fatal"===h.kind))throw h.error}})()}En(e){var t=this;
1return m(function*(){var i,s=Math.max(0,e-t.un),r=null!=(i=t._instance.getPersistedProperty(P.LogsQueue))?i:[];t._instance.setPersistedProperty(P.LogsQueue,r.slice(s)),yield t.sn()})()}Tn(){return tk(this.qi,this._instance.getLibraryId(),this._instance.getLibraryVersion())}xn(e){var t;if(!this._instance.optedOut){var i=null!=(t=this._instance.getPersistedProperty(P.LogsQueue))?t:[];this.pn>i.length||(i.shift(),this.un++,this.I.info("Logs queue is full, dropping oldest record.")),i.push(e),this._instance.setPersistedProperty(P.LogsQueue,i),this.fn>i.length?this.In():this.wn()}}In(e){void 0===e&&(e=this.gn),this.Rn||(this.Rn=tg(()=>{this.Rn=void 0,this.wn()},e))}Pn(){var e=Math.min(Math.max(0,this.hn-1),6);return this.gn*Math.pow(2,e)}An(){var e=this._instance.getPersistedProperty(P.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return m(function*(){t._n();var i=t.flush().catch(()=>{});void 0!==e?yield tf(i,e):yield i})()}flushWithTimeout(e){var t=this;return m(function*(){var i=t.flush();yield tf(i,e,()=>{i.catch(()=>{})})})()}wn(){this.flush().then(()=>{this.hn=0},e=>{this.hn++,this.I.error("PostHog logs flush failed:",e)}).finally(()=>{!this._instance.isDisabled&&this.An()&&this.In(this.Pn())})}_n(){this.Rn&&(clearTimeout(this.Rn),this.Rn=void 0)}};var tP=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function tI(e){return String(e)+"000000"}function tF(e,t,i,s){var r="";return s&&(r=Object.keys(s).sort().map(e=>JSON.stringify(e)+":"+JSON.stringify(s[e])).join(",")),e+"\0"+t+"\0"+(null!=i?i:"")+"\0"+r}let tT=class{constructor(e,t,i){this._instance=e,this.qi=t,this.I=i,this.Fn=new Map,this.ln=null,this.On=!1,this.Ln=new Map,this.$n=new Set,this.Dn=0}count(e,t,i){void 0===t&&(t=1),this.Nn({name:e,type:"count",value:t,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}gauge(e,t,i){this.Nn({name:e,type:"gauge",value:t,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}histogram(e,t,i){this.Nn({name:e,type:"histogram",value:t,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}flush(){var e,t=this,i=this.ln,s=(e=m(function*(){i&&(yield i.catch(()=>{})),yield t.qn()}),function(){return e.apply(this,arguments)})().finally(()=>{this.ln===s&&(this.ln=null)});return this.ln=s,s}drainWindow(){if(0===this.Fn.size)return null;var e=this.Fn;return this.Fn=new Map,this.On=!1,this.Ln=new Map,this.$n=new Set,this.jn(e)}reset(){this.Dn++,this._n(),this.Fn=new Map,this.ln=null,this.On=!1,this.Ln=new Map,this.$n=new Set}Nn(e){if(!this._instance.isDisabled&&!this._instance.optedOut){var t=this.kn(e);if(null!==t)if(t.name&&"string"==typeof t.name)if("number"==typeof t.value&&Number.isFinite(t.value))if("count"===t.type&&0>t.value)this.I.warn("Dropping count '"+t.name+"': counters are monotonic, value must be >= 0");else{try{i=t.attributes?y({},t.attributes):void 0,s=tF(t.type,t.name,t.unit,i)}catch(e){return void this.I.warn("Dropping metric '"+t.name+"': attributes could not be serialized",e)}var i,s,r=this.Fn.get(s);if(!r){if(!this.Bn())return;r={name:t.name,type:t.type,unit:t.unit,attributes:i,windowStartMs:Date.now()},this.Fn.set(s,r)}var n=this.Ln.get(t.name);void 0===n?this.Ln.set(t.name,t.type):n===t.type||this.$n.has(t.name)||(this.$n.add(t.name),this.I.warn("Metric name '"+t.name+"' is already used as a "+n+"; recording it as a "+t.type+" too will blend both series in charts. Use a distinct name.")),this.Hn(r,t.value),this.In()}else this.I.warn("Dropping metric '"+t.name+"': value must be a finite number");else this.I.warn("Dropping metric with empty name")}}Bn(){return this.qi.maxSeriesPerFlush>this.Fn.size||(this.On||(this.On=!0,this.I.warn("Metric series cap reached ("+this.qi.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}Hn(e,t){var i;switch(e.type){case"count":e.total=(null!=(i=e.total)?i:0)+t;break;case"gauge":e.last=t;break;case"histogram":e.hist||(e.hist={count:0,sum:0,min:t,max:t,bucketCounts:Array(tP.length+1).fill(0)});var s=e.hist;s.count+=1,s.sum+=t,s.min=Math.min(s.min,t),s.max=Math.max(s.max,t),s.bucketCounts[function(e,t){for(var i=0;t.length>i;i++)if(t[i]>=e)return i;return t.length}(t,tP)]+=1}}kn(e){var t=this.qi.beforeSend;if(!t)return e;var i=Y(t)?t:[t],s=e;for(var r of i)try{var n=r(s);if(!n)return this.I.info("Metric was rejected in beforeSend function"),null;s=n}catch(e){return this.I.error("Error in beforeSend function for metric:",e),null}return s}In(){this.Rn||(this.Rn=tg(()=>{this.Rn=void 0,this.flush().catch(e=>{this.I.error("Metrics flush failed:",e)})},this.qi.flushIntervalMs))}_n(){this.Rn&&(clearTimeout(this.Rn),this.Rn=void 0)}qn(){var e=this;return m(function*(){if(0!==e.Fn.size){var t=e.Fn;e.Fn=new Map,e.On=!1,e.Ln=new Map,e.$n=new Set;var i=e.Dn,s=yield e._instance.Un(e.jn(t));if(i===e.Dn)switch(s.kind){case"ok":return;case"retry-later":return e.zn(t),void e.In();case"too-large":return void e.I.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e.I.error("Failed to send metrics batch:",s.error)}}})()}jn(e){var t,i,s,r,n,a,o;return t=this.Wn(e),n=this.qi,a=this._instance.getLibraryId(),o=this._instance.getLibraryVersion(),i=y({},n.resourceAttributes,{"service.name":n.serviceName||"unknown_service"},n.environment&&{"deployment.environment":n.environment},n.serviceVersion&&{"service.version":n.serviceVersion},{"telemetry.sdk.name":a,"telemetry.sdk.version":o}),s=this._instance.getLibraryId(),r=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:tw(i)},scopeMetrics:[{scope:{name:s,version:r},metrics:t}]}]}}Wn(e){var t=tI(Date.now()),i=new Map;for(var s of e.values()){var r,n=tF(s.type,s.name,s.unit,void 0),a=i.get(n);a||(a=y({name:s.name},s.unit&&{unit:s.unit}),"count"===s.type?a.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===s.type?a.gauge={dataPoints:[]}:a.histogram={aggregationTemporality:1,dataPoints:[]},i.set(n,a));var o=tw(null!=(r=s.attributes)?r:{},this.I),l=tI(s.windowStartMs);if("count"===s.type){var u,h={attributes:o,startTimeUnixNano:l,timeUnixNano:t,asDouble:null!=(u=s.total)?u:0};a.sum.dataPoints.push(h)}else if("gauge"===s.type){var c,d={attributes:o,timeUnixNano:t,asDouble:null!=(c=s.last)?c:0};a.gauge.dataPoints.push(d)}else s.hist&&a.histogram.dataPoints.push({attributes:o,startTimeUnixNano:l,timeUnixNano:t,count:s.hist.count,sum:s.hist.sum,min:s.hist.min,max:s.hist.max,bucketCounts:s.hist.bucketCounts,explicitBounds:tP})}return Array.from(i.values())}zn(e){var t,i;for(var s of e){var r=s[0],n=s[1],a=this.Fn.get(r);if(a)switch(a.windowStartMs=Math.min(a.windowStartMs,n.windowStartMs),a.type){case"count":a.total=(null!=(t=a.total)?t:0)+(null!=(i=n.total)?i:0);break;case"gauge":break;case"histogram":if(n.hist)if(a.hist){a.hist.count+=n.hist.count,a.hist.sum+=n.hist.sum,a.hist.min=Math.min(a.hist.min,n.hist.min),a.hist.max=Math.max(a.hist.max,n.hist.max);for(var o=0;a.hist.bucketCounts.length>o;o++)a.hist.bucketCounts[o]+=n.hist.bucketCounts[o]}else a.hist=n.hist}else this.Bn()&&this.Fn.set(r,n)}}};class tO{constructor(e,t,i){void 0===i&&(i=[]),this.coercers=e,this.stackParser=t,this.modifiers=i}buildFromUnknown(e,t){void 0===t&&(t={});var i=t&&t.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(i,t,0).apply(e),r=this.buildParsingContext(t),n=this.parseStacktrace(s,r);return{$exception_list:this.convertToExceptionList(n,i),$exception_level:"error"}}modifyFrames(e){var t=this;return m(function*(){for(var i of e)i.stacktrace&&i.stacktrace.frames&&Y(i.stacktrace.frames)&&(i.stacktrace.frames=yield t.applyModifiers(i.stacktrace.frames));return e})()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:null==(t=e.syntheticException)?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var i,s;return null!=e.cause&&(i=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack&&(s=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.ski
1pFirstLines:0),t.chunkIdMap)),y({},e,{cause:i,stack:s})}applyChunkIds(e,t){return e.map(e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e))}applyCoercers(e,t){for(var i of this.coercers)if(i.match(e))return i.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return m(function*(){var i=e;for(var s of t.modifiers)i=yield s(i);return i})()}convertToExceptionList(e,t){var i,s,r,n={type:e.type,value:e.value,mechanism:{type:null!=(i=t.type)?i:"generic",handled:null==(s=t.handled)||s,synthetic:null!=(r=e.synthetic)&&r}};e.stack&&(n.stacktrace={type:"raw",frames:e.stack});var a=[n];return null!=e.cause&&a.push(...this.convertToExceptionList(e.cause,y({},t,{handled:!0}))),a}buildParsingContext(e){var t;return{chunkIdMap:function(e){var t=globalThis._posthogChunkIds;if(t){var i=Object.keys(t);return sE&&i.length===sk||(sk=i.length,sE=i.reduce((i,s)=>{sx||(sx={});var r=sx[s];if(r)i[r[0]]=r[1];else for(var n=e(s),a=n.length-1;a>=0;a--){var o=n[a],l=null==o?void 0:o.filename,u=t[s];if(l&&u){i[l]=u,sx[s]=[l,u];break}}return i},{})),sE}}(this.stackParser),skipFirstLines:null!=(t=e.skipFirstLines)?t:1}}buildCoercingContext(e,t,i){void 0===i&&(i=0);var s=(i,s)=>{if(4>=s){var r=this.buildCoercingContext(e,t,s);return this.applyCoercers(i,r)}};return y({},t,{syntheticException:0==i?t.syntheticException:void 0,mechanism:e,apply:e=>s(e,i),next:e=>s(e,i+1)})}}function t$(e,t,i,s,r){var n={platform:e,filename:t,function:"<anonymous>"===i?"?":i,in_app:!(null!=t&&t.startsWith("webkit-masked-url://"))&&"<anonymous>"!==t};return Z(s)||(n.lineno=s),Z(r)||(n.colno=r),n}var tC=(e,t)=>{var i=-1!==e.indexOf("safari-extension"),s=-1!==e.indexOf("safari-web-extension");return i||s?[-1!==e.indexOf("@")?e.split("@")[0]:"?",i?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},tR=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,tM=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,tq=/\((\S*)(?::(\d+))(?::(\d+))\)/,tA=(e,t)=>{var i=tR.exec(e);if(i)return t$(t,i[1],"?",+i[2],+i[3]);var s=tM.exec(e);if(s){if(s[2]&&0===s[2].indexOf("eval")){var r=tq.exec(s[2]);r&&(s[2]=r[1],s[3]=r[2],s[4]=r[3])}var n=tC(s[1]||"?",s[2]);return t$(t,n[1],n[0],s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}},tL=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,tD=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,tN=(e,t)=>{var i=tL.exec(e);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var s=tD.exec(i[3]);s&&(i[1]=i[1]||"eval",i[3]=s[1],i[4]=s[2],i[5]="")}var r=i[3],n=i[1]||"?",a=tC(n,r);return t$(t,r=a[1],n=a[0],i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},tj=/\(error: (.*)\)/;class tB{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var i=ee(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:i?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}isDOMException(e){return eh(e,"DOMException")}isDOMError(e){return eh(e,"DOMError")}}class tz{match(e){return ec(e)}coerce(e,t){var i,s=this.getStack(e);return{type:this.getType(e),value:this.getMessage(e,t),stack:null!=s?s:null==(i=t.syntheticException)?void 0:i.stack,cause:e.cause?t.next(e.cause):void 0,synthetic:void 0===s}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var i=e.message;return String(i.error&&"string"==typeof i.error.message?i.error.message:i)}getStack(e){return e.stacktrace||e.stack||void 0}}class tH{constructor(){}match(e){return!!eh(e,"ErrorEvent")&&(null!=e.error||this.fi(e))}coerce(e,t){if(null!=e.error)return t.apply(e.error);var i,s=t.apply(e.message);return y({},s,{stack:null!=(i=this.pi(e))?i:s.stack,synthetic:!0})}fi(e){return ee(e.message)&&e.message.length>0}pi(e){var t,i,s=null!=(t=e.lineno)?t:0,r=null!=(i=e.colno)?i:0;if(ee(e.filename)&&0!==e.filename.length&&0!==s)return"Error\n at "+e.filename+":"+s+":"+r}}var tU=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class tV{match(e){return"string"==typeof e}coerce(e,t){var i,s=this.getInfos(e),r=s[0],n=s[1];return{type:null!=r?r:"Error",value:null!=n?n:e,stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}getInfos(e){var t="Error",i=e,s=e.match(tU);return s&&(t=s[1],i=s[2]),[t,i]}}var tG=["fatal","error","warning","log","info","debug"];function tW(e,t){void 0===t&&(t=40);var i=Object.keys(e);if(i.sort(),!i.length)return"[object has no keys]";for(var s=i.length;s>0;s--){var r=i.slice(0,s).join(", ");
1if(t>=r.length)return s===i.length?r:r.length>t?r.slice(0,t)+"...":r}return""}class tJ{match(e){return"object"==typeof e&&null!==e}coerce(e,t){var i,s,r=this.getErrorPropertyFromObject(e);return r?t.apply(r):{type:this.getType(e),value:this.getValue(e),stack:null!=(i=this.getStack(e))?i:null==(s=t.syntheticException)?void 0:s.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){if(ed(e))return e.constructor.name;var t="name"in e?e.name:void 0;return ee(t)&&!et(t)?t:"Error"}getValue(e){if("name"in e&&"string"==typeof e.name){var t="'"+e.name+"' captured as exception";return"message"in e&&"string"==typeof e.message&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&"string"==typeof e.message)return e.message;var i=this.getObjectClassName(e);return(i&&"Object"!==i?"'"+i+"'":"Object")+" captured as exception with keys: "+tW(e)}isSeverityLevel(e){return ee(e)&&!et(e)&&tG.indexOf(e)>=0}getStack(e){try{return ee(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:ee(e.stack)&&e.stack.length>0?e.stack:void 0}catch(e){return}}getErrorPropertyFromObject(e){for(var t in e)if(({}).hasOwnProperty.call(e,t)){var i=e[t];if(ec(i))return i}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}}class tY{match(e){return ed(e)}coerce(e,t){var i,s=e.constructor.name;return{type:s,value:s+" captured as exception with keys: "+tW(e),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}class tX{match(e){return eu(e)}coerce(e,t){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}class tK{match(e){return eh(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!ed(e))return!1;try{var t=e.detail;return null!=t&&"object"==typeof t&&"reason"in t}catch(e){return!1}}coerce(e,t){var i,s=this.getUnhandledRejectionReason(e);return eu(s)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(s),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}:t.apply(s)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&null!=e.detail&&"object"==typeof e.detail&&"reason"in e.detail)return e.detail.reason}catch(e){}return e}}var tQ="$message",tZ="$timestamp",t0=new Set([tQ,tZ]),t1={enabled:!0,max_bytes:32768};function t2(e){var t;return e?{enabled:null!=(t=e.enabled)?t:t1.enabled,max_bytes:function(e,t){if(!er(e)||e===1/0||e===-1/0)return t;var i=Math.floor(e);return 0>i?t:i}(e.max_bytes,t1.max_bytes)}:y({},t1)}class t3{constructor(e){this.Vn=[],this.Gn=0,this.qi=t2(e)}setConfig(e){this.qi=t2(e),this.Zn()}add(e){var t=function(e){var t;try{t=V(e)}catch(e){return}try{var i=JSON.parse(t);if(!K(i))return;var s=i[tQ],r=i[tZ];if(!ee(s)||0===s.trim().length||!ee(r)&&!er(r))return;return{step:i,json:t}}catch(e){return}}(e);if(t){var i=function(e){if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e).length;for(var t=encodeURIComponent(e),i=0,s=0;t.length>s;s++)"%"===t[s]?(i+=1,s+=2):i+=1;return i}(t.json);i>this.qi.max_bytes||(this.Vn.push({step:t.step,bytes:i}),this.Gn+=i,this.Zn())}}getAttachable(){return this.Vn.map(e=>e.step)}clear(){this.Vn=[],this.Gn=0}size(){return this.Vn.length}Zn(){for(;this.Gn>this.qi.max_bytes&&this.Vn.length>0;){var e=this.Vn.shift();e&&(this.Gn-=e.bytes)}}}var t5=function(e,t){var i=(void 0===t?{}:t).debugEnabled,r={F(t){if(s&&(f.DEBUG||s.POSTHOG_DEBUG||i)&&!Z(s.console)&&s.console){for(var r=("__rrweb_original__"in s.console[t])?s.console[t].__rrweb_original__:s.console[t],n=arguments.length,a=Array(n>1?n-1:0),o=1;n>o;o++)a[o-1]=arguments[o];r(e,...a)}},debug(){for(var e=arguments.length,t=Array(e),i=0;e>i;i++)t[i]=arguments[i];r.F("debug",...t)},info(){for(var e=arguments.length,t=Array(e),i=0;e>i;i++)t[i]=arguments[i];r.F("log",...t)},warn(){for(var e=arguments.length,t=Array(e),i=0;e>i;i++)t[i]=arguments[i];r.F("warn",...t)},error(){for(var e=arguments.length,t=Array(e),i=0;e>i;i++)t[i]=arguments[i];r.F("error",...t)},critical(){for(var t=arguments.length,i=Array(t),s=0;t>s;s++)i[s]=arguments[s];console.error(e,...i)},uninitializedWarning(e){r.error("You must initialize PostHog before calling "+e)},createLogger:(t,i)=>t5(e+" "+t,i)};return r},t6=t5("[PostHog.js]"),t4=t6.createLogger,t8=t4("[ExternalScriptsLoader]"),t9=e=>{var t=null==a?void 0:a.querySelectorAll("script");
1if(t){for(var i=0;t.length>i;i++)if(t[i].src===e||t[i].getAttribute("src")===e)return t[i]}},t7=(e,t,i)=>{if(e.config.disable_external_dependency_loading)return t8.warn(t+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var s=t9(t);if(s){if(s.__posthog_loading_callback_fired)return i();var r=s.__posthog_loading_error;return r?i(r):(s.addEventListener("load",e=>{s.__posthog_loading_callback_fired=!0,i(void 0,e)}),void s.addEventListener("error",e=>{s.__posthog_loading_error=e,i(e)}))}var n=()=>{if(!a)return i("document not found");if(t9(t))return t7(e,t,i);var s=a.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=t,s.onload=e=>{s.__posthog_loading_callback_fired=!0,i(void 0,e)},s.onerror=e=>{s.__posthog_loading_error=e,i(e)},e.config.prepare_external_dependency_script&&(s=e.config.prepare_external_dependency_script(s)),!s)return i("prepare_external_dependency_script returned null");if("head"===e.config.external_scripts_inject_target)a.head.appendChild(s);else{var r,n=a.querySelectorAll("body > script");n.length>0?null==(r=n[0].parentNode)||r.insertBefore(s,n[0]):a.body.appendChild(s)}};null!=a&&a.body?n():null==a||a.addEventListener("DOMContentLoaded",n)},ie={},it=(e,t)=>{var i="/static/"+t+".js?v="+e.version;return"toolbar"===t&&(i=i+"&t="+3e5*Math.floor(Date.now()/3e5)),e.requestRouter.endpointFor("assets",i)};g.__PosthogExtensions__=g.__PosthogExtensions__||{},g.__PosthogExtensions__.loadExternalDependency=(e,t,i)=>{if("remote-config"!==t){var s=e.config.strict_script_versioning;if(s){var r=e.requestRouter.endpointFor("assets","/static/"+e.version+"/"+t+".js"),n=ie[r];if("fallback"===s&&n){if(t9(n))return void t7(e,n,i);delete ie[r]}t7(e,r,"fallback"===s?(s,n)=>{if(s)if("string"==typeof s)i(s);else{var a,o=it(e,t);ie[r]=o;var l=t9(r);null==l||null==(a=l.parentNode)||a.removeChild(l),t7(e,o,i)}else i(void 0,n)}:i)}else t7(e,it(e,t),i)}else{var a=e.requestRouter.endpointFor("assets","/array/"+e.config.token+"/config.js");t7(e,a,i)}},g.__PosthogExtensions__.loadSiteApp=(e,t,i)=>{var s=e.requestRouter.endpointFor("api",t);t7(e,s,i)},f.DEBUG=!1,f.LIB_VERSION="1.418.16",f.LIB_NAME="web";var ii="$people_distinct_id",is="distinct_id",ir="$device_id",ia="$device_model",io="__alias",il="__timers",iu="$autocapture_disabled_server_side",ih="$heatmaps_enabled_server_side",ic="$exception_capture_enabled_server_side",id="$error_tracking_suppression_rules",ip="$error_tracking_capture_extension_exceptions",iv="$web_vitals_enabled_server_side",ig="$dead_clicks_enabled_server_side",i_="$product_tours_enabled_server_side",im="$web_vitals_allowed_metrics",iy="$session_recording_remote_config",ib="$replay_sample_rate",iw="$replay_override_sampling",ix="$replay_override_linked_flag",ik="$replay_override_url_trigger",iE="$replay_override_event_trigger",iS="$sesid",iP="$session_is_sampled",iI="$enabled_feature_flags",iF="$active_feature_flags",iT="$early_access_features",iO="$feature_flag_details",i$="$feature_flag_payloads",iC="$feature_flag_request_id",iR="$minimal_flag_called_events",iM="$override_feature_flags",iq="$override_feature_flag_payloads",iA="$stored_person_properties",iL="$stored_group_properties",iD="$groups",iN="$surveys",ij="$surveys_loaded_at",iB="$surveys_activated",iz="$surveys_activated_session",iH="$surveys_activated_timestamps",iU="ph_product_tours",iV="$flag_call_reported",iG="$flag_call_reported_session_id",iW="$feature_flag_errors",iJ="$feature_flag_evaluated_at",iY="$user_state",iX="$client_session_props",iK="$capture_rate_limit",iQ="$initial_campaign_params",iZ="$initial_referrer_info",i0="$initial_person_info",i1="$epp",i2="$posthog_cookieless",i3="$cookieless_mode",i5="$sdk_debug_extensions_init_method",i6="$sdk_debug_extensions_init_time_ms",i4="$sdk_debug_recording_script_not_loaded",i8="PostHog loadExternalDependency extension not found.",i9="on_reject",i7="always",se="anonymous",st="identified",si="identified_only",ss="visibilitychange",sr="beforeunload",sn="$pageview",sa="$pageleave",so="$identify",sl="$groupidentify";function su(e,t){Y(e)&&e.forEach(t)}function sh(e,t){if(!es(e))if(Y(e))e.forEach(t);else if(e instanceof FormData)e.forEach((e,i)=>t(e,i));else for(var i in e)W.call(e,i)&&t(e[i],i)}var sc=function(e){for(var t=arguments.length,i=Array(t>1?t-1:0),s=1;t>s;s++)i[s-1]=arguments[s];for(var r of i)for(var n in r)void 0!==r[n]&&(e[n]=r[n]);return e};function sd(e){for(var t=Object.keys(e),i=t.length,s=Array(i);i--;)s[i]=[t[i],e[t[i]]];return s}var sp=function(e){try{return e()}catch(e){return}},sv=function(e){return function(){try{for(var t=arguments.length,i=Array(t),s=0;t>s;s++)i[s]=arguments[s];return e.apply(this,i)}catch(e){t6.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),t6.critical(e)}}},sg=function(e){var t={};return sh(e,function(e,i){(ee(e)&&e.length>0||er(e))&&(t[i]=e)}),t},sf=["herokuapp.com","vercel.app","netlify.app"];function s_(e,t,i,s){var r=null!=s?s:{},n=r.capture,a=r.passive;null==e||e.addEventListener(t,i,{capture:void 0!==n&&n,passive:void 0===a||a})}function sm(e){return"ph_toolbar_internal"===e.name}var sy=e=>{if(a){try{for(var t=e+"=",i=a.cookie.split(";").filter(e=>e.length),s=0;i.length>s;s++){for(var r=i[s];" "==r.charAt(0);)r=r.substring(1,r.length);if(0===r.indexOf(t))return decodeURIComponent(r.substring(t.length,r.length))}}catch(e){}return null}};Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return er(e)&&isFinite(e)&&Math.floor(e)===e});class sb{constructor(e){if(this.bytes=e,16!==e.length)throw TypeError("not 128-bit length")}static fromFieldsV7(e,t,i,s){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||0>e||0>t||0>i||0>s||e>0xffffffffffff||t>4095||i>0x3fffffff||s>0xffffffff)throw RangeError("invalid field value");
1var r=new Uint8Array(16);return r[0]=e/0x10000000000,r[1]=e/0x100000000,r[2]=e/0x1000000,r[3]=e/65536,r[4]=e/256,r[5]=e,r[6]=112|t>>>8,r[7]=t,r[8]=128|i>>>24,r[9]=i>>>16,r[10]=i>>>8,r[11]=i,r[12]=s>>>24,r[13]=s>>>16,r[14]=s>>>8,r[15]=s,new sb(r)}toString(){for(var e="",t=0;this.bytes.length>t;t++)e=e+(this.bytes[t]>>>4).toString(16)+(15&this.bytes[t]).toString(16),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw Error("Invalid UUIDv7 was generated");return e}clone(){return new sb(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var t=0;16>t;t++){var i=this.bytes[t]-e.bytes[t];if(0!==i)return Math.sign(i)}return 0}}class sw{generate(){var e=this.generateOrAbort();if(!Z(e))return e;this.Rr=0;var t=this.generateOrAbort();if(Z(t))throw Error("Could not generate UUID after timestamp reset");return t}generateOrAbort(){var e=Date.now();if(e>this.Rr)this.Rr=e,this.Ar();else{if(this.Rr>=e+1e4)return;this.Lr++,this.Lr>0x3ffffffffff&&(this.Rr++,this.Ar())}return sb.fromFieldsV7(this.Rr,Math.trunc(this.Lr/0x40000000),0x3fffffff&this.Lr,this.Or.nextUint32())}Ar(){this.Lr=1024*this.Or.nextUint32()+(1023&this.Or.nextUint32())}constructor(){this.Rr=0,this.Lr=0,this.Or=new sI}}var sx,sk,sE,sS,sP=e=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw Error("no cryptographically strong RNG available");for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};s&&!Z(s.crypto)&&crypto.getRandomValues&&(sP=e=>crypto.getRandomValues(e));class sI{nextUint32(){return this.ft.length>this.Fr||(sP(this.ft),this.Fr=0),this.ft[this.Fr++]}constructor(){this.ft=new Uint32Array(8),this.Fr=1/0}}var sF=()=>sT().toString(),sT=()=>(sS||(sS=new sw)).generate(),sO="",s$=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,sC={Dr:()=>!!a,jr(e){t6.error("cookieStore error: "+e)},Pr:sy,Br(e){var t;try{t=JSON.parse(sC.Pr(e))||{}}catch(e){}return t},Nr(e,t,i,s,r){if(!a)return!1;try{var n="",o="",l=function(e,t){if(t){var i=function(e,t){if(void 0===t&&(t=a),sO)return sO;if(!t||["localhost","127.0.0.1"].includes(e))return"";for(var i=e.split("."),s=Math.min(i.length,8),r="dmn_chk_"+sF();!sO&&s--;){var n=i.slice(s).join("."),o=r+"=1;domain=."+n+";path=/";t.cookie=o+";max-age=3",t.cookie.includes(r)&&(t.cookie=o+";max-age=0",sO=n)}return sO}(e);if(!i){var s,r=(s=e.match(s$))?s[0]:"";r!==i&&t6.info("Warning: cookie subdomain discovery mismatch",r,i),i=r}return i?"; domain=."+i:""}return""}(a.location.hostname,s);if(i){var u=new Date;u.setTime(u.getTime()+864e5*i),n="; expires="+u.toUTCString()}r&&(o="; secure");var h=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+l+o;return h.length>3686.4&&t6.warn("cookieStore warning: large cookie, len="+h.length),a.cookie=h,!0}catch(e){return!1}},qr(e,t){if(null!=a&&a.cookie)try{sC.Nr(e,"",-1,t)}catch(e){return}}}
1,sR=null,sM={Dr(){if(!ei(sR))return sR;var e=!0;if(Z(s))e=!1;else try{var t="__mplssupport__";sM.Nr(t,"xyz"),'"xyz"'!==sM.Pr(t)&&(e=!1),sM.qr(t)}catch(t){e=!1}return e||t6.error("localStorage unsupported; falling back to cookie store"),sR=e,e},jr(e){t6.error("localStorage error: "+e)},Pr(e){try{return null==s?void 0:s.localStorage.getItem(e)}catch(e){sM.jr(e)}return null},Br(e){try{return JSON.parse(sM.Pr(e))||{}}catch(e){}return null},Nr(e,t){try{return null==s||s.localStorage.setItem(e,JSON.stringify(t)),!0}catch(e){sM.jr(e)}return!1},qr(e){try{null==s||s.localStorage.removeItem(e)}catch(e){sM.jr(e)}}},sq=[iA,iF,iI,iO,i$,iC,iJ,iW,iV],sA=[ir,is,iS,iP,i1,i0,iY],sL=["__proto__","constructor","prototype"],sD=e=>{if(!K(e))return{};var t={};return Object.keys(e).forEach(i=>{-1===sL.indexOf(i)&&(t[i]=e[i])}),t},sN=function(e,t){void 0===t&&(t=[]);var i={};return[...sA,...t].forEach(t=>{var s=e[t];Z(s)||ei(s)||""===s||(i[t]=s)}),i},sj=e=>{for(var t=5381,i=0x811c9dc5,s=0;e.length>s;s++){var r=e.charCodeAt(s);t=33*t^r,i=Math.imul(i^r,0x1000193)}return e.length.toString(36)+"."+(t>>>0).toString(36)+"."+(i>>>0).toString(36)},sB=(e,t)=>({p:t,f:sj(JSON.stringify(e))}),sz=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{var i=sC.Br(e+"_cpm"),s=(null==i?void 0:i.f)===sj(t)&&Y(i.p);return{properties:s?i.p:[],isValid:s}}catch(e){return{properties:[],isValid:!1}}},sH=(e,t)=>t+"|"+(sC.Pr(e+"_cpm")||""),sU={},sV={Dr:()=>!0,jr(e){t6.error("memoryStorage error: "+e)},Pr:e=>sU[e]||null,Br:e=>sU[e]||null,Nr:(e,t)=>(sU[e]=t,!0),qr(e){delete sU[e]}},sG=null,sW={Dr(){if(!ei(sG))return sG;if(sG=!0,Z(s))sG=!1;else try{var e="__support__";sW.Nr(e,"xyz"),'"xyz"'!==sW.Pr(e)&&(sG=!1),sW.qr(e)}catch(e){sG=!1}return sG},jr(e){t6.error("sessionStorage error: ",e)},Pr(e){try{return null==s?void 0:s.sessionStorage.getItem(e)}catch(e){sW.jr(e)}return null},Br(e){try{return JSON.parse(sW.Pr(e))||null}catch(e){}return null},Nr(e,t){try{return null==s||s.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(e){sW.jr(e)}return!1},qr(e){try{null==s||s.sessionStorage.removeItem(e)}catch(e){sW.jr(e)}}};class sJ{constructor(e){this._instance=e}get qi(){return this._instance.config}get consent(){return this.cs()?0:this.fs}isOptedOut(){return this.qi.cookieless_mode===i7||this.isRejected()||-1===this.consent&&this.qi.cookieless_mode===i9}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.qi.opt_out_capturing_by_default}optInOut(e){this.ps.Nr(this.gs,+!!e,this.qi.cookie_expiration,this.qi.cross_subdomain_cookie,this.qi.secure_cookie)}reset(){this.ps.qr(this.gs,this.qi.cross_subdomain_cookie)}get gs(){var e=this._instance.config,t=e.token,i=e.opt_out_capturing_cookie_prefix;return e.consent_persistence_name||(i?i+t:"__ph_opt_in_out_"+t)}get fs(){var e=this.ps.Pr(this.gs);return eg(e)?1:z(ef,e)?0:-1}get ps(){var e=this.qi.opt_out_capturing_persistence_type,t="localStorage"===e?sM:sC;if(!this.ys||this.ys!==t){this.ys=t;var i="localStorage"===e?sC:sM;i.Pr(this.gs)&&(this.ys.Pr(this.gs)||this.optInOut(eg(i.Pr(this.gs))),i.qr(this.gs,this.qi.cross_subdomain_cookie))}return this.ys}cs(){return!!this.qi.respect_dnt&&[null==n?void 0:n.doNotTrack,null==n?void 0:n.msDoNotTrack,g.doNotTrack].some(e=>eg(e))}}function sY(e,t){var i,s=null==e||null==(i=e.config)?void 0:i.get_current_url;if(!X(s))return t;try{var r=s(t);return ee(r)&&r?r:t}catch(e){return t6.error("Error in get_current_url, falling back to window.location.href",e),t}}var sX="__POSTHOG_TOOLBAR__";function sK(e){return e instanceof Element&&(e.id===sX||!(null==e.closest||!e.closest(".toolbar-global-fade-container")))}function sQ(e){return!!e&&1===e.nodeType}function sZ(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function s0(e){return!!e&&3===e.nodeType}function s1(e){return!!e&&11===e.nodeType&&sQ(e.host)}function s2(e){return e?H(e).split(/\s+/):[]}function s3(e,t){var i,r,n=Z(r=null==s||null==(i=s.location)?void 0:i.href)?void 0:sY(t,r);return!!(n&&e&&e.some(e=>n.match(e)))}function s5(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return s2(t)}function s6(e){return es(e)?null:H(e).split(/(\s+)/).filter(e=>rm(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function s4(e){var t="";return rh(e)&&!rc(e)&&e.childNodes&&e.childNodes.length&&sh(e.childNodes,function(e){var i;s0(e)&&e.textContent&&(t+=null!=(i=s6(e.textContent))?i:"")}),H(t)}function s8(e){var t;return Z(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}var s9=["a","button","form","input","select","textarea","label"];function s7(e,t){if(Z(t))return!0;var i,s=function(e){if(t.some(t=>(function(e,t){var i=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;try{return!!i&&i.call(e,t)}catch(e){return!1}})(e,t)))return{v:!0}};for(var r of e)if(i=s(r))return i.v;return!1}function re(e){var t=e.parentNode;return!(!t||!sQ(t))&&t}var rt=[".ph-no-autocapture","[data-ph-no-autocapture]"],ri=["next","previous","prev",">","<"],rs=[...ri,"+","-","â","â"],rr=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,rn=[".ph-no-rageclick",".ph-no-capture"],ra=["","text","search","email","password","url","tel","number"];function ro(e,t){if(!s||rl(e)||(ea(t)?(r=!!t&&rn,n=void 0,a=!1):(r=null!=(o=null==t?void 0:t.css_selector_ignorelist)?o:rn,n=null==t?void 0:t.content_ignorelist,a=null!=(l=null==t?void 0:t.ignore_text_selection)&&l),!1===r)||a&&!(!(i=e)||!sQ(i))&&(sZ(i,"textarea")||(sZ(i,"input")?z(ra,(i.getAttribute("type")||"").toLowerCase()):function(e){if(e.isContentEditable)return!0;var t=null==e.getAttribute?void 0:e.getAttribute("contenteditable");return"true"===t||""===t}(i))))return!1;var i,r,n,a,o,l,u=ru(e,!1).targetElementList;return!function(e,t){var i;if(!1===e||Z(e))return!1;if(!0===e)i=ri;else{if(!Y(e))return!1;if(e.length>10)return t6.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;i=e.map(e=>e.toLowerCase())}return t.some(e=>{var t=e.safeText,s=e.ariaLabel;return i.some(e=>rr(t,e)||rr(s,e))})}(n,u.map(e=>{var t;return{safeText:s4(e).toLowerCase(),ariaLabel:(null==(t=e.getAttribute("aria-label"))?void 0:t.toLowerCase().trim())||""}}))&&!s7(u,r)}var rl=e=>!e||sZ(e,"html")||!sQ(e),ru=(e,t)=>
1{if(!s||rl(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,r=[e],n=e;n.parentNode&&!sZ(n,"body");)if(s1(n.parentNode))r.push(n.parentNode.host),n=n.parentNode.host;else{var a=re(n);if(!a)break;if(t||s9.indexOf(a.tagName.toLowerCase())>-1)i=!0;else try{var o=s.getComputedStyle(a);o&&"pointer"===o.getPropertyValue("cursor")&&(i=!0)}catch(e){}r.push(a),n=a}return{parentIsUsefulElement:i,targetElementList:r}};function rh(e){for(var t=new Set,i=0,s=e;s.parentNode&&!sZ(s,"body");s=s.parentNode){if(i++>=1e3||t.has(s))return!1;t.add(s);var r=s5(s);if(z(r,"ph-sensitive")||z(r,"ph-no-capture"))return!1}if(z(s5(e),"ph-include"))return!0;var n=e.type||"";if(ee(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var a=e.name||e.id||"";return!ee(a)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(a.replace(/[^a-zA-Z0-9]/g,""))}function rc(e){return!!(sZ(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||sZ(e,"select")||sZ(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var rd=RegExp("^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$"),rp=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,rv=[16,15,14,13],rg=RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),rf=RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),r_=/[0-9A-Za-z_]/;function rm(e,t){return void 0===t&&(t=!0),!(es(e)||ee(e)&&(e=H(e),(t?rd.test((e||"").replace(/[- ]/g,"")):function(e){var t;for(rp.lastIndex=0;t=rp.exec(e);){var i=t[2];if(i)for(var s=i.replace(/[- ]/g,""),r=0;s.length>r;r++)for(var n of rv){var a=r+n;if(s.length>=a){var o=s.slice(r,a);if(rd.test(o)&&function(e){for(var t=0,i=!1,s=e.length-1;s>=0;s--){var r=e.charCodeAt(s)-48;i&&(r*=2)>9&&(r-=9),t+=r,i=!i}return t%10==0}(o))return!0}}}return!1}(e))||(t?rg.test(e):function(e){var t;for(rf.lastIndex=0;t=rf.exec(e);){var i=t[1],s=t[3];if(!(i&&s&&r_.test(i)&&r_.test(s)))return!0}return!1}(e))))&&!0}function ry(e){var t=s4(e);return rm(t=(t+" "+function e(t){var i="";return t&&t.childNodes&&t.childNodes.length&&sh(t.childNodes,function(t){var s;if(t&&"span"===(null==(s=t.tagName)?void 0:s.toLowerCase()))try{var r=s4(t);i=(i+" "+r).trim(),t.childNodes&&t.childNodes.length&&(i=(i+" "+e(t)).trim())}catch(e){t6.error("[AutoCapture]",e)}}),i}(e)).trim())?t:""}function rb(e){return e.replace(/"|\\"/g,'\\"')}var rw=t4("[Dead Clicks]"),rx=()=>!0,rk=e=>{var t,i=!(null==(t=e.instance.persistence)||!t.get_property(ig)),s=e.instance.config.capture_dead_clicks;return ea(s)?s:!!K(s)||i};class rE{get lazyLoadedDeadClicksAutocapture(){return this.bs}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(e){if(e.ok){var t=e.config;"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[ig]:t.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this._s(()=>{this.ws()}):this.stop()}_s(e){var t,i;null!=(t=g.__PosthogExtensions__)&&t.initDeadClicksAutocapture?e():null==(i=g.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",t=>{t?rw.error("failed to load script",t):e()})}ws(){var e;if(a){if(!this.bs&&null!=(e=g.__PosthogExtensions__)&&e.initDeadClicksAutocapture){var t=K(this.instance.config.capture_dead_clicks)?y({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this.bs=g.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.bs.start(a),rw.info("starting...")}}else rw.error("`document` not found. Cannot start.")}stop(){this.bs&&(this.bs.stop(),this.bs=void 0,rw.info("stopping..."))}}var rS=t4("[SegmentIntegration]"),rP="posthog-js";function rI(e,t){var i=void 0===t?{}:t,s=i.organization,r=i.projectId,n=i.prefix,a=i.severityAllowList,o=void 0===a?["error"]:a,l=i.sendExceptionsToPostHog,u=void 0===l||l;return t=>{if("*"!==o&&!o.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var i=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/pers
1on/"+e.get_distinct_id());t.tags["PostHog Person URL"]=i,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var a,l,h,c,d,p,v=(null==(a=t.exception)?void 0:a.values)||[],g=v.map(e=>y({},e,{stacktrace:e.stacktrace?y({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map(e=>y({},e,{platform:"web:javascript"}))}):void 0})),f={$exception_message:(null==(l=v[0])?void 0:l.value)||t.message,$exception_type:null==(h=v[0])?void 0:h.type,$exception_level:t.level,$exception_list:g,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(c=v[0])?void 0:c.value)||t.message,$sentry_exception_type:null==(d=v[0])?void 0:d.type,$sentry_tags:t.tags};return s&&r&&(f.$sentry_url=(n||"https://sentry.io/organizations/")+s+"/issues/?project="+r+"&query="+t.event_id),u&&(null==(p=e.exceptions)||p.sendExceptionEvent(f)),t}}class rF{constructor(e,t,i,s,r,n){this.name=rP,this.setupOnce=function(a){a(rI(e,{organization:t,projectId:i,prefix:s,severityAllowList:r,sendExceptionsToPostHog:null==n||n}))}}}class rT{constructor(e){this.ks=(e,t,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(t6.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:i}),this.Ss=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.xs()}xs(){var e;this.Cs=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(this.ks)}destroy(){var e;null==(e=this.Cs)||e.call(this),this.Cs=void 0}doPageView(e,t){var i,r=this.Ts(e,t);return this.Ss={pathname:null!=(i=null==s?void 0:s.location.pathname)?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),r}doPageLeave(e){var t;return this.Ts(e,null==(t=this.Ss)?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null==(e=this.Ss)?void 0:e.pageViewId}}Ts(e,t){var i=this.Ss;if(!i)return{$pageview_id:t};var s={$pageview_id:t,$prev_pageview_id:i.pageViewId},r=this._instance.scrollManager.getContext();if(r&&!this._instance.config.disable_scroll_properties){var n=r.maxScrollHeight,a=r.lastScrollY,o=r.maxScrollY,l=r.maxContentHeight,u=r.lastContentY,h=r.maxContentY;if(!(Z(n)||Z(a)||Z(o)||Z(l)||Z(u)||Z(h))){n=Math.ceil(n),a=Math.ceil(a),o=Math.ceil(o),l=Math.ceil(l),u=Math.ceil(u),h=Math.ceil(h);var c=n>1?e_(a/n,0,1,t6):1,d=n>1?e_(o/n,0,1,t6):1,p=l>1?e_(u/l,0,1,t6):1,v=l>1?e_(h/l,0,1,t6):1;s=sc(s,{$prev_pageview_last_scroll:a,$prev_pageview_last_scroll_percentage:c,$prev_pageview_max_scroll:o,$prev_pageview_max_scroll_percentage:d,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:v})}}return i.pathname&&(s.$prev_pageview_pathname=i.pathname),i.timestamp&&(s.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),s}}var rO=["flags","surveys"],r$={[ii]:{exposure:"hidden"},[io]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[il]:{exposure:"hidden"},[iu]:{exposure:"event"},[ih]:{exposure:"hidden"},[ic]:{exposure:"event"},[id]:{exposure:"hidden"},[ip]:{exposure:"event"},[iv]:{exposure:"event"},[ig]:{exposure:"event"},[i_]:{exposure:"hidden"},[im]:{exposure:"event"},[iy]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[iS]:{exposure:"hidden"},[iP]:{exposure:"event"},[ib]:{exposure:"event",shouldSkipFromEventProperties:e=>ei(e)},$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"},$sess_rec_flush_size:{exposure:"hidden"},[iI]:{exposure:"hidden",storageGroup:"flags"}
1,[iF]:{exposure:"hidden",storageGroup:"flags"},[iT]:{exposure:"hidden"},[iO]:{exposure:"hidden",storageGroup:"flags"},[i$]:{exposure:"hidden",storageGroup:"flags"},[iC]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[iR]:{exposure:"hidden",storageGroup:"flags"},[iM]:{exposure:"hidden"},[iq]:{exposure:"hidden"},[iA]:{exposure:"hidden"},[iL]:{exposure:"hidden"},[iN]:{exposure:"hidden",storageGroup:"surveys"},[ij]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[iB]:{exposure:"event"},[iz]:{exposure:"hidden"},[iH]:{exposure:"hidden"},[iU]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$product_tours_activated_session:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[iV]:{exposure:"hidden"},[iG]:{exposure:"hidden"},[iD]:{exposure:"event"},[iW]:{exposure:"hidden"},[iJ]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[iY]:{exposure:"hidden"},[iX]:{exposure:"hidden"},[iK]:{exposure:"hidden"},[iQ]:{exposure:"hidden"},[iZ]:{exposure:"hidden"},[i0]:{exposure:"hidden"},[i1]:{exposure:"hidden"},[iw]:{exposure:"event"},[ix]:{exposure:"event"},[ik]:{exposure:"event"},[iE]:{exposure:"event"},[i5]:{exposure:"event"},[i6]:{exposure:"event"},[i4]:{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"}
1,$sdk_debug_replay_pending_trigger_conditions:{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"}},rC=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],rR=e=>{var t=r$[e];if(t)return t;for(var i of rC){var s=i[1];if(0===e.indexOf(i[0]))return s}},rM=(e,t)=>{try{return JSON.stringify(e,(e,t)=>"bigint"==typeof t?t.toString():t,t)}catch(t){return V(e)}},rq=e=>{var t=null==a?void 0:a.createElement("a");return Z(t)?null:(t.href=e,t)},rA=function(e,t){for(var i,s=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;s.length>r;r++){var n=s[r].split("=");if(n[0]===t){i=n;break}}if(!Y(i)||2>i.length)return"";var a=i[1];try{a=decodeURIComponent(a)}catch(e){t6.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},rL=function(e,t,i){if(!e||!t||!t.length)return e;for(var s=e.split("#"),r=s[1],n=(s[0]||"").split("?"),a=n[1],o=n[0],l=(a||"").split("&"),u=[],h=0;l.length>h;h++){var c=l[h].split("=");Y(c)&&(t.includes(c[0])?u.push(c[0]+"="+i):u.push(l[h]))}var d=o;return null!=a&&(d+="?"+u.join("&")),null!=r&&(d+="#"+r),d},rD=function(e,t){var i=e.match(RegExp(t+"=([^&]*)"));return i?i[1]:null},rN=(e,t)=>e>=t&&p(),rj=(e,t,i,s)=>{if(0===e){if(p()){var r=t+1;return r===i&&s(),r}return t}return 0},rB="https?://(.*)",rz=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],rH=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...rz],rU="<masked>",rV=["li_fat_id"];function rG(e,t,i){if(!a)return{};var s,r=t?[...rz,...i||[]]:[],n=rW(rL(a.URL,r,rU),e);return sc((s={},sh(rV,function(e){var t=sy(e);s[e]=t||null}),s),n)}function rW(e,t){var i=rH.concat(t||[]),s={};return sh(i,function(t){var i=rA(e,t);s[t]=i||null}),s}function rJ(e){var t=e?0===e.search(rB+"google.([^/?]*)")?"google":0===e.search(rB+"bing.com")?"bing":0===e.search(rB+"yahoo.com")?"yahoo":0===e.search(rB+"duckduckgo.com")?"duckduckgo":null:null,i={};if(!ei(t)){i.$search_engine=t;var s=a?rA(a.referrer,"yahoo"!=t?"q":"p"):"";s.length&&(i.ph_keyword=s)}return i}function rY(){return navigator.language||navigator.userLanguage}var rX="$direct";function rK(){return(null==a?void 0:a.referrer)||rX}function rQ(e,t,i){void 0===i&&(i=!1);var s=e?[...rz,...t||[]]:[],r=i?tv(null==o?void 0:o.href):null==o?void 0:o.href,n=null==r?void 0:r.substring(0,1e3);return{r:rK().substring(0,1e3),u:n?rL(n,s,rU):void 0}}function rZ(e,t){void 0===t&&(t=!1);var i,s=e.r,r=e.u,n=t?tv(r):r,a={$referrer:s,$referring_domain:null==s?void 0:s==rX?rX:null==(i=rq(s))?void 0:i.host};
1if(n){a.$current_url=n;var o=rq(n);a.$host=null==o?void 0:o.host,a.$pathname=null==o?void 0:o.pathname,sc(a,rW(n))}return s&&sc(a,rJ(s)),a}function r0(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}var r1={flags:iJ,surveys:ij},r2=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],r3="main",r5=(e,t)=>{sh(e,(i,s)=>{var r=rR(s);r&&"event"!==r.exposure||({}).hasOwnProperty.call(t,s)||delete e[s]})};class r6{constructor(e,t,i){if(void 0===i&&(i=!0),this.Ms={},this.Es=!1,this.Is=!1,this.Rs=!1,this.Ps=!1,this.qi=e,this.As=i,this.props={},this.Fs=void 0,this.Os=(e=>{var t="";return e.token&&(t=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+t+"_posthog"})(e),this.ps=this.Ls(e),this.Is=this.$s(e),this.load(),e.debug&&t6.info("Persistence loaded",e.persistence,y({},this.props)),this.update_config(e,e,t),this.save(),s){var r=()=>this.flush();s_(s,"beforeunload",r,{capture:!1}),s_(s,"pagehide",r,{capture:!1})}}Ds(){var e,t=null==(e=this.qi)?void 0:e.persistence_save_debounce_ms;return er(t)&&t>0?t:0}Ns(e){if(this.qi.cookieWinsOnConflict&&"localstorage+cookie"===this.qi.persistence.toLowerCase())if(e)try{var t=sN(e,this.qi.cookie_persisted_properties||[]),i=sB(t,this.qi.cookie_persisted_properties||[]),s=JSON.stringify(t)+"|"+JSON.stringify(i),r=sC.Pr(this.Os)||void 0;r&&sH(this.Os,r)===s&&(this.qs=s,this.js=r)}catch(e){}else try{var n=sC.Pr(this.Os)||void 0;this.qs=n?sH(this.Os,n):void 0,this.js=n}catch(e){}}syncCookieProperties(){return this.Bs(this.qi)}Bs(e,t){if(void 0===t&&(t=!1),this.Hs&&!t||this.Ps||!e.cookieWinsOnConflict||"localstorage+cookie"!==e.persistence.toLowerCase())return!1;try{i=sC.Pr(this.Os)||void 0}catch(e){}if(!i||i===this.js)return!1;var i,s,r=sH(this.Os,i);try{s=sD(JSON.parse(i))}catch(e){return!1}if((sC.Pr(this.Os)||void 0)!==i)return!1;this.qs=r,this.js=i;var n=sz(this.Os,i),a=[...sA,...n.properties],o={};if(Object.keys(s).forEach(e=>{var t=s[e];(Z(t)||ei(t)||""===t||e===iY&&t!==se&&t!==st)&&(o[e]=!0,delete s[e])}),Q(s))return!1;var l=is in s||s[iY]===se||s[iY]===st,u=this.props[is],h=this.props[iY],c=sc({},this.props);[...sA,...e.cookie_persisted_properties||[]].forEach(e=>{if(-1!==a.indexOf(e)&&!(e in s)&&!o[e]&&(l||e!==is&&e!==iY)){var t=c[e];(n.isValid||-1===sA.indexOf(e)||!1!==t&&0!==t)&&delete c[e]}}),this.props=sc(c,s),!l||iY in s||iY in this.props||this.Us(iY,se);var d=this.props[is],p=this.props[iY];return l&&(d!==u||p!==h)&&(this.Rs=!0,sW.Nr(this.Os+"_cookie_identity_change_pending",!0),this.zs(iA),this.zs(iF),this.zs(iI),this.zs(iO),this.zs(i$),this.zs(iC),this.zs(iJ),this.zs(iW),this.zs(iV),p!==se||h!==st&&s[iY]!==se&&(Z(u)||d===u)||(r5(this.props,s),this.zs(iL)),p===st?this.props.$user_id=d:delete this.props.$user_id,this.zs(io)),!0}
1consumeCookieIdentityChange(){var e=this.Os+"_cookie_identity_change_pending",t=this.Rs||!!sW.Pr(e);return this.Rs=!1,t&&sW.qr(e),t}Ws(e){return void 0===e&&(e=!1),!(this.Ps||this.Hs&&!e||!this.qi.cookieWinsOnConflict||"localstorage+cookie"!==this.qi.persistence.toLowerCase()||(this.Ps=!0,0))}Vs(){this.Ps&&(Z(this.Gs)||(clearTimeout(this.Gs),this.Gs=void 0),delete this.Ms[r3],this.Zs(!0))}Qs(e){if(void 0===e&&(e=!0),this.Ps)try{e?this.Vs():Z(this.Gs)||(clearTimeout(this.Gs),this.Gs=void 0)}finally{this.Ps=!1}}isDisabled(){return!!this.Hs}Ls(e){-1===r2.indexOf(e.persistence.toLowerCase())&&(t6.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t,i,r,n,a=(t=e.cookie_persisted_properties||[],i=e.cookieWinsOnConflict,void 0===t&&(t=[]),void 0===i&&(i=!1),r=[...sA,...t],y({},sM,{Br(e){try{var t,s={};try{s=(t=sC.Pr(e)||void 0)?sD(JSON.parse(t)):{}}catch(e){}var n,a=JSON.parse(sM.Pr(e)||"{}");if(i){var o=sz(e,t),l=[...sA,...o.properties],u={};Object.keys(s).forEach(e=>{var t=s[e];ei(t)||""===t||e===iY&&t!==se&&t!==st||(u[e]=t)});var h=is in u||u[iY]===se||u[iY]===st;if(Object.keys(u).length>0){var c,d=a[is],p=null!=(c=a[iY])?c:se;r.forEach(e=>{if(-1!==l.indexOf(e)&&!(e in s)&&(h||e!==is&&e!==iY)){var t=a[e];(o.isValid||-1===sA.indexOf(e)||!1!==t&&0!==t)&&delete a[e]}}),!h||iY in s||iY in a||(a[iY]=se),h&&((is in u?u[is]:a[is])!==d||(iY in u?u[iY]:a[iY])!==p)&&(sq.forEach(e=>delete a[e]),u[iY]===st&&is in u?a.$user_id=u[is]:delete a.$user_id,u[iY]!==st&&(delete a[iD],delete a[iL]),delete a.__alias)}n=sc(a,u)}else n=sc(s,a);return sM.Nr(e,n),n}catch(e){}return null},Nr(e,s,r,n,a,o){var l=sM.Nr(e,s,void 0,void 0,o);try{var u=sN(s,t);if(Object.keys(u).length){if(i){var h=e+"_cpm",c=sB(u,t);if(sC.Nr(h,c,r,n,a,o),sC.Pr(h)!==JSON.stringify(c)){sC.qr(h,n);var d=sN(s);return sC.Nr(e,d,r,n,a,o),l}}sC.Nr(e,u,r,n,a,o)}}catch(e){sM.jr(e)}return l},qr(e,t){try{null==s||s.localStorage.removeItem(e),sC.qr(e,t),sC.qr(e+"_cpm",t)}catch(e){sM.jr(e)}}})),o=!1,l=e.persistence.toLowerCase();return"localstorage"===l&&sM.Dr()?(n=sM,o=!0):"localstorage+cookie"===l&&a.Dr()?(n=a,o=!0):"sessionstorage"===l&&sW.Dr()?n=sW:"memory"===l?n=sV:"cookie"===l?n=sC:a.Dr()?(n=a,o=!0):n=sC,this.Es=o,n}Js(e){return this.Os+"__"+e}$s(e){return this.Es&&!!e.split_storage}properties(){var e={};return sh(this.props,(t,i)=>{var s=rR(i);if(!s||"event"===s.exposure){if(null!=s&&null!=s.shouldSkipFromEventProperties&&s.shouldSkipFromEventProperties(t))return;e[i]=t}}),e}load(e){if(void 0===e&&(e=!1),!this.Hs||e){var t=this.qi.cookieWinsOnConflict&&"localstorage+cookie"===this.qi.persistence.toLowerCase(),i=t?sM.Br(this.Os):null,s={};if(t)try{sh(s=sD(sC.Br(this.Os)),(e,t)=>{(Z(e)||ei(e)||""===e)&&delete s[t]})}catch(e){}var r=this.ps.Br(this.Os);if(r&&(this.props=sc({},r)),this.Is&&this.Ks(),t&&r){var n,a,o=null==i?void 0:i[is],l=null!=(n=null==i?void 0:i[iY])?n:se,u=r[is],h=null!=(a=r[iY])?a:se;if(u!==o||h!==l){this.Rs=!0,sW.Nr(this.Os+"_cookie_identity_change_pending",!0);var c=sc({},this.props);sq.forEach(e=>delete c[e]),h!==se||l!==st&&s[iY]!==se&&(Z(o)||u===o)||(r5(c,s),delete c[iL]),this.props=c;var d=new Set;sq.forEach(e=>{var t,i=null==(t=rR(e))?void 0:t.storageGroup;i&&d.add(i)}),d.forEach(e=>{var t={};sh(this.props,(i,s)=>{var r;(null==(r=rR(s))?void 0:r.storageGroup)===e&&(t[s]=i)}),Q(t)?(sM.qr(this.Js(e)),this.Ms[e]={}):sM.Nr(this.Js(e),t)&&(this.Ms[e]={persisted:!0,fingerprint:this.Ys(t,e)})})}}sW.Pr(this.Os+"_cookie_identity_change_pending")&&(this.Rs=!0)}}Ks(){for(var e of rO){var t=sM.Br(this.Js(e));if(t&&!Q(t)){var i=this.Xs(e);i.persisted=!0,this.ta(e)||(i.fingerprint=this.Ys(t,e)),this.ea(e,t)||sc(this.props,t)}}}ta(e){return Object.keys(this.props).some(t=>{var i;return(null==(i=rR(t))?void 0:i.storageGroup)===e})}ea(e,t){var i=r1[e];if(!i)return!1;var s=t[i],r=this.props[i];return er(s)&&er(r)&&r>s}refreshKey(e){var t;if(!this.Hs){var i=this.Is?null==(t=rR(e))?void 0:t.storageGroup:void 0,s=i?sM.Br(this.Js(i)):this.ps.Br(this.Os);if(s&&e in s)this.Us(e,s[e]);else{if(i){var r=this.ps.Br(this.Os);if(r&&e in r)return void this.Us(e,r[e])}this.zs(e)}}}save(){if(!this.Hs){var e=this.Ds();e>0?Z(this.Gs)&&(this.Gs=setTimeout(()=>{this.Gs=void 0,this.Zs()},e)):this.Zs()}}flush(){Z(this.Gs)||(clearTimeout(this.Gs),this.Gs=void 0,this.Zs())}Zs(e){void 0===e&&(e=!1),this.Hs||this.Ps&&!e||(e||this.syncCookieProperties(),this.Is?this.ia():this.ra(this.ps,this.Os,this.props,r3)&&this.Ns(this.props))}ia(){var e=this.na(),t=e.main,i=e.groups;for(var s of(this.ra(this.ps,this.Os,t,r3)&&this.Ns(t),rO)){var r,n=i[s];(!Q(n)||null!=(r=this.Ms[s])&&r.persisted)&&this.ra(sM,this.Js(s),n,s)}}na(){var e={},t={flags:{},surveys:{}};return sh(this.props,(i,s)=>{var r,n=null==(r=rR(s))?void 0:r.storageGroup;n?t[n][s]=i:e[s]=i}),{main:e,groups:t}}Ys(e,t){if(t===r3)return JSON.stringify(e)+"|"+this.sa+"|"+this.aa+"|"+this.oa;var i={};return sh(e,(e,t)=>{var s;i[t]=null!=(s=rR(t))&&s.volatile?"__volatile__":e}),JSON.stringify(i)}ra(e,t,i,s){var r,n=this.Xs(s);if(s!==r3&&!n.dirty&&!Z(n.fingerprint))return!1;try{if((r=this.Ys(i,s))===n.fingerprint)return n.dirty=!1,!1}catch(e){r=void 0}return e.Nr(t,i,this.sa,this.aa,this.oa,this.qi.debug)?(n.dirty=!1,s!==r3&&(n.persisted=!0),Z(r)||(n.fingerprint=r),!0):(this.qi.debug&&t6.warn('failed to persist storage entry "'+t+'"; will retry on next save'),!1)}remove(e){var t=(void 0===e?{}:e).keepGroupEntries,i=void 0!==t&&t;if(Z(this.Gs)||(clearTimeout(this.Gs),this.Gs=void 0),this.ps.qr(this.Os,!1),this.ps.qr(this.Os,!0),!i&&this.As)for(var s of rO)sM.qr(this.Js(s));i?delete this.Ms[r3]:this.Ms={},this.qs=void 0,this.js=void 0}clear(){this.remove(),this.props={}}register_once(e,t,i){if(K(e)){this.syncCookieProperties(),Z(t)&&(t="None"),this.sa=Z(i)?this.la:i;var s=!1;if(sh(e,(e,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==t||(this.Us(i,e),s=!0)}),s)return this.save(),!0}return!1}register(e,t){if(K(e)){this.syncCookieProperties(),this.sa=Z(t)?this.la:t;var i=!1;if(sh(e,(t,s)=>{e.hasOwnProperty(s)&&(this.props[s]!==t||K(t)||Y(t))&&(this.Us(s,t),i=!0)}),i)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();var t=!1;for(var i of"string"==typeof e?[e]:e)i in this.props&&(this.zs(i),t=!0);t&&this.save()}update_campaign_params(){var e=null==a?void 0:a.URL;if(e!==this.Fs){var t=rG(this.qi.custom_campaign_params,this.qi.mask_personal_data_properties,this.qi.custom_personal_data_properties);Q(sg(t))||this.register(t),this.Fs=e}}update_search_keyword(){var e;this.register((e=null==a?void 0:a.referrer)?rJ(e):{})}update_referrer_info(){var e;this.register_once({$referrer:rK(),$referring_domain:null!=a&&a.referrer&&(null==(e=rq(a.referrer))?void 0:e.host)||rX},void 0)}set_initial_person_info(){this.props[iQ]||this.props[iZ]||this.register_once({[i0]:rQ(this.qi.mask_personal_data_properties,this.qi.custom_personal_data_properties,this.qi.disable_capture_url_hashes
1)},void 0)}get_initial_props(){var e,t,i,s={};sh([iZ,iQ],e=>{var t=this.props[e];t&&sh(t,function(e,t){s["$initial_"+U(t)]=e})});var r=this.props[i0];return r&&sc(s,(void 0===(e=this.qi.disable_capture_url_hashes)&&(e=!1),t=rZ(r,e),i={},sh(t,function(e,t){i["$initial_"+U(t)]=e}),i)),s}safe_merge(e){return sh(this.props,function(t,i){i in e||(e[i]=t)}),e}update_config(e,t,i){var s=e.persistence!==t.persistence,r=!((e,t)=>{if(e.length!==t.length)return!1;var i=[...e].sort(),s=[...t].sort();return i.every((e,t)=>e===s[t])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),n=s||r,a=e.cookieWinsOnConflict!==t.cookieWinsOnConflict,o=e.disable_persistence||!!i,l=!!this.Hs&&!o;o||this.Bs(t,l),this.qi=e,!o&&(s||r||a)&&(this.qs=void 0,this.js=void 0,this.Bs(y({},e,{cookie_persisted_properties:t.cookie_persisted_properties}),l));var u=n||a?this.Ls(e):this.ps,h=this.$s(e),c=n||h!==this.Is,d=!o&&(c||e.cross_subdomain_cookie!==this.aa||e.secure_cookie!==this.oa)&&this.Ws(l);try{if(this.la=this.sa=e.cookie_expiration,this.set_disabled(o),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),c){var p=this.props;this.clear(),this.ps=u,this.Is=h,this.props=p,this.save()}else a&&(this.ps=u,o||(delete this.Ms[r3],this.Zs()))}finally{d&&this.Qs()}}set_disabled(e){this.Hs=e,this.Hs?this.remove():this.save()}set_cross_subdomain(e){e!==this.aa&&(this.aa=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.oa&&(this.oa=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){var i=this.props[il]||{};i[e]=t,this.Us(il,i),this.save()}remove_event_timer(e){var t=this.props[il]||{},i=t[e];return Z(i)||(delete t[e],this.Us(il,t),this.save()),i}get_property(e){return this.props[e]}set_property(e,t){this.Us(e,t),this.save()}Us(e,t){var i;this.props[e]=t,null!=(i=rR(e))&&i.volatile||this.ua(e)}zs(e){delete this.props[e],this.ua(e)}ua(e){var t,i=null==(t=rR(e))?void 0:t.storageGroup;i&&(this.Xs(i).dirty=!0)}Xs(e){return this.Ms[e]||(this.Ms[e]={})}}function r4(e){var t=!0;return{dispose(){if(t){t=!1;var i=e();i&&X(i.then)&&i.then(void 0,()=>{})}}}}var r8={GZipJS:"gzip-js",Base64:"base64"},r9={Activation:"events",Cancellation:"cancelEvents"},r7={Popover:"popover",API:"api",Widget:"widget"},ne={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},nt={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},ni={Popover:"popover",Inline:"inline"},ns={SHOWN:"product tour shown"},nr={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},nn=t4("[RateLimiter]");class na{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach(e=>{nn.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4})}catch(e){return void nn.warn('could not rate limit - continuing. Error: "'+(null==e?void 0:e.message)+'"',{text:t})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return(null==(e=this.instance.config.rate_limiting)?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max((null==(e=this.instance.config.rate_limiting)?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){void 0===e&&(e=!1);var t,i,s,r=this.captureEventsBurstLimit,n=this.captureEventsPerSecond,a=(new Date).getTime(),o=null!=(t=null==(i=this.instance.persistence)?void 0:i.get_property(iK))?t:{tokens:r,last:a};o.tokens+=(a-o.last)/1e3*n,o.last=a,o.tokens>r&&(o.tokens=r);var l=1>o.tokens;if(l||e||(o.tokens=Math.max(0,o.tokens-1)),l&&!e){var u=(er(o.dropped)?o.dropped:0)+1;o.dropped=u,!this.lastEventRateLimited&&this.ha(u)&&(o.dropped=0)}return this.lastEventRateLimited=l,null==(s=this.instance.persistence)||s.set_property(iK,o),{isRateLimited:l,remainingTokens:o.tokens}}da(e){var t=this.instance.config.property_denylist;return!Y(t)||!t.includes(e)}va(){var e;if(this.da("$current_url")&&this.da("$pathname")&&null!=o&&o.pathname)return""+(null!=(e=o.origin)?e:"")+o.pathname}ha(e){var t,i,s=this.captureEventsBurstLimit,r=this.captureEventsPerSecond,n=this.va(),a=this.da("$session_id")?null==(t=(i=this.instance).get_session_id)?void 0:t.call(i):void 0,o=[e+" event(s) dropped since the last warning",n?"triggered on "+n:void 0,a?"session "+a:void 0].filter(
vendor: 9,831 bytes, line 1
1Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited: "+o+". Config is set to "+r+" events per second and "+s+" events burst limit."},{skip_client_rate_limiting:!0})}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}var no=t4("[RemoteConfig]");class nl{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=g._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}ca(e){var t,i;null!=(t=g.__PosthogExtensions__)&&t.loadExternalDependency?null==(i=g.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):e()}fa(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:e})}load(){try{if(this.remoteConfig)return no.info("Using preloaded remote config",this.remoteConfig),this.pa(this.remoteConfig),void this.ga();if(this._instance.ma())return void no.warn("Remote config is disabled. Falling back to local config.");this.ca(e=>{if(!e)return no.info("No config found after loading remote JS config. Falling back to JSON."),void this.fa(e=>{this.pa(e.json,e),this.ga()});this.pa(e),this.ga()})}catch(e){no.error("Error loading remote config",e),this.pa()}}stop(){this.ya&&(clearInterval(this.ya),this.ya=void 0)}refresh(){!this._instance.ma()&&a&&"hidden"!==a.visibilityState&&this._instance.reloadFeatureFlags()}ga(){var e;if(!this.ya){var t=null!=(e=this._instance.config.remote_config_refresh_interval_ms)?e:3e5;0!==t&&(this.ya=setInterval(()=>{this.refresh()},t))}}pa(e,t){!e&&t&&(0===t.statusCode?t.error||no.warn("Failed to fetch remote config from PostHog."):no.error("Failed to fetch remote config from PostHog."));try{this._instance.pa(e?{ok:!0,config:e}:{ok:!1})}catch(e){no.error("Error applying remote config",e)}if(!1!==(null==e?void 0:e.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var i;null==(i=this._instance.featureFlags)||i.ensureFlagsLoaded()}catch(e){no.error("Error loading feature flags",e)}}}var nu=Uint8Array,nh=Uint16Array,nc=Uint32Array,nd=new nu([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]),np=new nu([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]),nv=new nu([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ng=function(e,t){for(var i=new nh(31),s=0;31>s;++s)i[s]=t+=1<<e[s-1];var r=new nc(i[30]);for(s=1;30>s;++s)for(var n=i[s];i[s+1]>n;++n)r[n]=n-i[s]<<5|s;return[i,r]},nf=ng(nd,2),n_=nf[1];nf[0][28]=258,n_[258]=28;for(var nm=ng(np,0)[1],ny=new nh(32768),nb=0;32768>nb;++nb){var nw=(43690&nb)>>>1|(21845&nb)<<1;ny[nb]=((65280&(nw=(61680&(nw=(52428&nw)>>>2|(13107&nw)<<2))>>>4|(3855&nw)<<4))>>>8|(255&nw)<<8)>>>1}var nx=function(e,t,i){for(var s=e.length,r=0,n=new nh(t);s>r;++r)++n[e[r]-1];var a,o=new nh(t);for(r=0;t>r;++r)o[r]=o[r-1]+n[r-1]<<1;if(i){a=new nh(1<<t);var l=15-t;for(r=0;s>r;++r)if(e[r])for(var u=r<<4|e[r],h=t-e[r],c=o[e[r]-1]++<<h,d=c|(1<<h)-1;d>=c;++c)a[ny[c]>>>l]=u}else for(a=new nh(s),r=0;s>r;++r)a[r]=ny[o[e[r]-1]++]>>>15-e[r];return a},nk=new nu(288);for(nb=0;144>nb;++nb)nk[nb]=8;for(nb=144;256>nb;++nb)nk[nb]=9;for(nb=256;280>nb;++nb)nk[nb]=7;for(nb=280;288>nb;++nb)nk[nb]=8;var nE=new nu(32);for(nb=0;32>nb;++nb)nE[nb]=5;var nS=nx(nk,9,0),nP=nx(nE,5,0),nI=function(e){return(e/8|0)+(7&e&&1)},nF=function(e,t,i){(null==i||i>e.length)&&(i=e.length);var s=new(e instanceof nh?nh:e instanceof nc?nc:nu)(i-t);return s.set(e.subarray(t,i)),s},nT=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8},nO=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8,e[s+2]|=i>>>16},n$=function(e,t){for(var i=[],s=0;e.length>s;++s)e[s]&&i.push({s:s,f:e[s]});var r=i.length,n=i.slice();if(!r)return[new nu(0),0];if(1==r){var a=new nu(i[0].s+1);return a[i[0].s]=1,[a,1]}i.sort(function(e,t){return e.f-t.f}),i.push({s:-1,f:25001});var o=i[0],l=i[1],u=0,h=1,c=2;for(i[0]={s:-1,f:o.f+l.f,l:o,r:l};h!=r-1;)o=i[i[c].f>i[u].f?u++:c++],l=i[u!=h&&i[c].f>i[u].f?u++:c++],i[h++]={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 nh(d+1),v=nC(i[h-1],p,0);if(v>t){s=0;var g=0,f=v-t,_=1<<f;for(n.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});r>s;++s){var m=n[s].s;if(t>=p[m])break;g+=_-(1<<v-p[m]),p[m]=t}for(g>>>=f;g>0;){var y=n[s].s;t>p[y]?g-=1<<t-p[y]++-1:++s}for(;s>=0&&g;--s){var b=n[s].s;p[b]==t&&(--p[b],++g)}v=t}return[new nu(p),v]},nC=function(e,t,i){return -1==e.s?Math.max(nC(e.l,t,i+1),nC(e.r,t,i+1)):t[e.s]=i},nR=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new nh(++t),s=0,r=e[0],n=1,a=function(e){i[s++]=e},o=1;t>=o;++o)if(e[o]==r&&o!=t)++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=e[o]}return[i.subarray(0,s),t]},nM=function(e,t){for(var i=0,s=0;t.length>s;++s)i+=e[s]*t[s];return i},nq=function(e,t,i){var s=i.length,r=nI(t+2);e[r]=255&s,e[r+1]=s>>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var n=0;s>n;++n)e[r+n+4]=i[n];return 8*(r+4+s)},nA=function(e,t,i,s,r,n,a,o,l,u,h){nT(t,h++,i),++r[256];for(var c=n$(r,15),d=c[0],p=c[1],v=n$(n,15),g=v[0],f=v[1],_=nR(d),m=_[0],y=_[1],b=nR(g),w=b[0],x=b[1],k=new nh(19),E=0;m.length>E;++E)k[31&m[E]]++;for(E=0;w.length>E;++E)k[31&w[E]]++;for(var S=n$(k,7),P=S[0],I=S[1],F=19;F>4&&!P[nv[F-1]];--F);var T,O,$,C,R=u+5<<3,M=nM(r,nk)+nM(n,nE)+a,q=nM(r,d)+nM(n,g)+a+14+3*F+nM(k,P)+(2*k[16]+3*k[17]+7*k[18]);if(M>=R&&q>=R)return nq(t,h,e.subarray(l,l+u));if(nT(t,h,1+(M>q)),h+=2,M>q){T=nx(d,p,0),O=d,$=nx(g,f,0),C=g;var A=nx(P,I,0);for(nT(t,h,y-257),nT(t,h+5,x-1),nT(t,h+10,F-4),h+=14,E=0;F>E;++E)nT(t,h+3*E,P[nv[E]]);h+=3*F;for(var L=[m,w],D=0;2>D;++D){var N=L[D];for(E=0;N.length>E;++E)nT(t,h,A[j=31&N[E]]),h+=P[j],j>15&&(nT(t,h,N[E]>>>5&127),h+=N[E]>>>12)}}else T=nS,O=nk,$=nP,C=nE;for(E=0;o>E;++E)if(s[E]>255){nO(t,h,T[257+(j=s[E]>>>18&31)]),h+=O[j+257],j>7&&(nT(t,h,s[E]>>>23&31),h+=nd[j]);var j,B=31&s[E];nO(t,h,$[B]),h+=C[B],B>3&&(nO(t,h,s[E]>>>5&8191),h+=np[B])}else nO(t,h,T[s[E]]),h+=O[s[E]];return nO(t,h,T[256]),h+O[256]},nL=new nc([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),nD=function(){for(var e=new nc(256),t=0;256>t;++t){for(var i=t,s=9;--s;)i=(1&i&&0xedb88320)^i>>>1;e[t]=i}return e}(),nN=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8},nj=!!u||!!l,nB="text/plain",nz=!1,nH=(e,t)=>{var i=e.split("#"),s=i[1],r=i[0].split("?"),n=r[0],a=r[1];if(!a)return e;var o=a.split("&").filter(e=>e.split("=")[0]!==t).join("&");return n+(o?"?"+o:"")+(s?"#"+s:"")},nU=function(e,t,i){void 0===i&&(i=!0);var s,r,n,a,o,l=e.split("?"),u=l[0],h=l[1],c=y({},t),d=null!=(o=null==h?void 0:h.split("&").map(e=>{var t,s=e.split("="),r=s[0],n=i&&null!=(t=c[r])?t:s[1];return delete c[r],r+"="+n}))?o:[],p=(void 0===s&&(s="&"),a=[],sh(c,function(e,t){Z(e)||Z(t)||"undefined"===t||(r=encodeURIComponent(e instanceof File?e.name:e.toString()),n=encodeURIComponent(t),a[a.length]=n+"="+r)}),a.join(s));return p&&d.push(p),d.length>0?u+"?"+d.join("&"):u},nV=e=>{if(e.ba)return e.ba;var t=e.data,i=e.compression;if(t){if(i===r8.GZipJS){var s=function(e,t){void 0===t&&(t={});var i=(r=0xffffffff,{p(e){for(var t=r,i=0;e.length>i;++i)t=nD[255&t^e[i]]^t>>>8;r=t},d:()=>0xffffffff^r}),s=e.length;i.p(e);var r,n,a,o,l=(o=10+((n=t).filename&&n.filename.length+1||0),function(e,t,i,s,r,n){var a=e.length,o=new nu(s+a+5*(1+Math.floor(a/7e3))+8),l=o.subarray(s,o.length-8),u=0;if(!t||8>a)for(var h=0;a>=h;h+=65535){var c=h+65535;a>c?u=nq(l,u,e.subarray(h,c)):(l[h]=!0,u=nq(l,u,e.subarray(h,a)))}else{for(var d=nL[t-1],p=d>>>13,v=8191&d,g=(1<<i)-1,f=new nh(32768),_=new nh(g+1),m=Math.ceil(i/3),y=2*m,b=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<y)&g},w=new nc(25e3),x=new nh(288),k=new nh(32),E=0,S=0,P=(h=0,0),I=0,F=0;a>h;++h){var T=b(h),O=32767&h,$=_[T];if(f[O]=$,_[T]=O,h>=I){var C=a-h;if((E>7e3||P>24576)&&C>423){u=nA(e,l,0,w,x,k,S,P,F,h-F,u),P=E=S=0,F=h;for(var R=0;286>R;++R)x[R]=0;for(R=0;30>R;++R)k[R]=0}var M=2,q=0,A=v,L=O-$&32767;if(C>2&&T==b(h-L))for(var D=Math.min(p,C)-1,N=Math.min(32767,h),j=Math.min(258,C);N>=L&&--A&&O!=$;){if(e[h+M]==e[h+M-L]){for(var B=0;j>B&&e[h+B]==e[h+B-L];++B);if(B>M){if(M=B,q=L,B>D)break;var z=Math.min(L,B-2),H=0;for(R=0;z>R;++R){var U=h-L+R+32768&32767,V=U-f[U]+32768&32767;V>H&&(H=V,$=U)}}}L+=(O=$)-($=f[O])+32768&32767}if(q){w[P++]=0x10000000|n_[M]<<18|nm[q];var G=31&n_[M],W=31&nm[q];S+=nd[G]+np[W],++x[257+G],++k[W],I=h+M,++E}else w[P++]=e[h],++x[e[h]]}}u=nA(e,l,!0,w,x,k,S,P,F,h-F,u)}return nF(o,0,s+nI(u)+r)}(e,null==(a=t).level?6:a.level,null==a.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+a.mem,o,8)),u=l.length;return function(e,t){var i=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=2>t.level?4:2*(9==t.level),e[9]=3,0!=t.mtime&&nN(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var s=0;i.length>=s;++s)e[s+10]=i.charCodeAt(s)}}(l,t),nN(l,u-8,i.d()),nN(l,u-4,s),l}(function(e,t){var i=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var s=new nu(e.length+(e.length>>>1)),r=0,n=function(e){s[r++]=e},a=0;i>a;++a){if(r+5>s.length){var o=new nu(r+8+(i-a<<1));o.set(s),s=o}var l=e.charCodeAt(a);128>l?n(l):(2048>l?n(192|l>>>6):(l>55295&&57344>l?(n(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++a))>>>18),n(128|l>>>12&63)):n(224|l>>>12),n(128|l>>>6&63)),n(128|63&l))}return nF(s,0,r)}(rM(t)),{mtime:0});return{contentType:nB,body:s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength),estimatedSize:s.byteLength}}if(i===r8.Base64){var r=(e=>"data="+encodeURIComponent("string"==typeof e?e:rM(e)))(function(e){return e?btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(e,t)=>
1String.fromCharCode(parseInt(t,16)))):e}(rM(t)));return{contentType:"application/x-www-form-urlencoded",body:r,estimatedSize:new Blob([r]).size}}var n=rM(t);return{contentType:"application/json",body:n,estimatedSize:new Blob([n]).size}}},nG=e=>{var t,i,s=()=>"sendBeacon"===e.transport?{url:nU(e.url,{compression:r8.Base64}),encodedBody:nV(y({},e,{compression:r8.Base64,ba:void 0}))}:{url:nH(e.url,"compression"),encodedBody:nV(y({},e,{compression:void 0,ba:void 0}))};try{t=nV(e)}catch(t){if(C(e.compression,rA(e.url,"compression")))return t6.error("Failed to gzip request body, sending uncompressed payload",t),s();throw t}return!(t&&C(e.compression,rA(e.url,"compression")))||((i=t.body)instanceof ArrayBuffer?$(new Uint8Array(i)):ArrayBuffer.isView(i)&&$(new Uint8Array(i.buffer,i.byteOffset,i.byteLength)))?{url:e.url,encodedBody:t}:(nz=!0,s())},nW=e=>{try{return nG(e)}catch(t){return t6.error(t),void(null==e.callback||e.callback({statusCode:0,error:t}))}},nJ=function(){var e=m(function*(e){var t=rM(e.data),i=yield function(e,t,i){return A.apply(this,arguments)}(t,f.DEBUG,{rethrow:!0});if(!i)return e;var s=yield i.arrayBuffer();return y({},e,{ba:{contentType:nB,body:s,estimatedSize:s.byteLength}})});return function(t){return e.apply(this,arguments)}}(),nY=/Failed to fetch|NetworkError|Load failed/i,nX=e=>"TypeError"===(null==e?void 0:e.name)&&nY.test((null==e?void 0:e.message)||""),nK=e=>{var t=nW(e);if(t){var i,s=t.url,r=t.encodedBody,n=null!=r?r:{},a=n.contentType,o=n.body,u=n.estimatedSize,c=new Headers;sh(e.headers,function(e,t){c.append(t,e)}),a&&c.append("Content-Type",a);var d=null,p=!1;if(h){var v=new h;d={signal:v.signal,timeout:setTimeout(()=>{var t,i;p=!0,v.abort(((i=Error("PostHog request timed out"+((t=e.timeout)?" after "+t+"ms":""))).name="AbortError",i))},e.timeout)}}var g=t=>{p&&"AbortError"===(null==t?void 0:t.name)||nX(t)?t6.warn(t):t6.error(t),null==e.callback||e.callback({statusCode:0,error:t})};try{l(s,y({method:(null==e?void 0:e.method)||"GET",headers:c,keepalive:"POST"===e.method&&!e._a&&52428.8>(u||0),body:o,signal:null==(i=d)?void 0:i.signal},e.fetchOptions)).then(t=>t.text().then(i=>{var s={statusCode:t.status,text:i};if(200===t.status)try{s.json=JSON.parse(i)}catch(e){t6.error(e)}null==e.callback||e.callback(s)})).catch(g).finally(()=>d?clearTimeout(d.timeout):null)}catch(e){d&&clearTimeout(d.timeout),g(e)}}},nQ=e=>{try{var t,i=nG(e),s=i.url,r=i.encodedBody,a=null!=r?r:{},o=a.body,l=a.estimatedSize;if(!o)return;var u=o instanceof Blob?o:new Blob([o],{type:a.contentType});if(n.sendBeacon(s,u))return;var h=Y(e.data)?e.data:null==(t=e.data)?void 0:t.batch;if(Y(h)&&h.length>1&&(null!=l?l:0)>16384){var c=Math.ceil(h.length/2),d=t=>Y(e.data)?t:y({},e.data,{batch:t});return nQ(y({},e,{data:d(h.slice(0,c))})),void nQ(y({},e,{data:d(h.slice(c))}))}t6.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to fetch"),nK(y({},e,{_a:!0}))}catch(e){t6.warn("Beacon send failed",e)}},nZ=(e,t,i,s)=>{var r="query"===s?"POST"===t?"sent_at":"_":void 0;return nU(i===r8.GZipJS?nH(e,"compression"):e,y({},r?{[r]:Date.now().toString()}:{},i===r8.GZipJS?{}:{compression:i}))},n0=[];l&&n0.push({transport:"fetch",method:nK}),u&&n0.push({transport:"XHR",method(e){var t=nW(e);if(t){var i=new u,s=t.encodedBody;i.open(e.method||"GET",t.url,!0);var r=null!=s?s:{},n=r.contentType,a=r.body;sh(e.headers,function(e,t){i.setRequestHeader(t,e)}),n&&i.setRequestHeader("Content-Type",n),e.timeout&&(i.timeout=e.timeout),i.onreadystatechange=()=>{if(4===i.readyState){var t={statusCode:i.status,text:i.responseText};if(200===i.status)try{t.json=JSON.parse(i.responseText)}catch(e){}null==e.callback||e.callback(t)}},i.send(a)}}}),null!=n&&n.sendBeacon&&n0.push({transport:"sendBeacon",method:nQ});class n1{constructor(e,t){this.wa=!0,this.ka=[],this.Sa=e_((null==t?void 0:t.flush_interval_ms)||3e3,250,5e3,t6.createLogger("flush interval"),3e3),this.xa=e}enqueue(e){this.ka.push(e),this.Ca||this.Ta()}unload(){this.Ma();var e=Object.values(this.ka.length>0?this.Ea():{});[...e.filter(e=>0===e.url.indexOf("/e")),...e.filter(e=>0!==e.url.indexOf("/e"))].map(e=>{this.Ia(y({},e,{transport:"sendBeacon"}))})}enable(){this.wa=!1,this.Ta()}Ta(){var e=this;this.wa||(this.Ca=setTimeout(()=>{if(this.Ma(),this.ka.length>0){var t=this.Ea();for(var i in t)!function(){var s=t[i],r=(new Date).getTime();s.data&&Y(s.data)&&sh(s.data,e=>{e.offset=Math.abs(e.timestamp-r),delete e.timestamp}),e.Ia(s)}()}},this.Sa))}Ia(e){try{this.xa(e)}catch(e){t6.error(e)}}Ma(){clearTimeout(this.Ca),this.Ca=void 0}Ea(){var e={};return sh(this.ka,t=>{var i,s=(t?t.batchKey:null)||t.url;Z(e[s])&&(e[s]=y({},t,{data:[]})),null==(i=e[s].data)||i.push(t.data)}),this.ka=[],e}}var n2=["retriesPerformedSoFar"];class n3{constructor(e){this.Ra=!1,this.Pa=3e3,this.ka=[],this._instance=e,this.ka=[],this.Aa=!0,!Z(s)&&"onLine"in s.navigator&&(this.Aa=s.navigator.onLine,this.Fa=()=>{this.Aa=!0,this.Oa()},this.La=()=>{this.Aa=!1},s_(s,"online",this.Fa),s_(s,"offline",this.La))}get length(){return this.ka.length}retriableRequest(e){var t=e.retriesPerformedSoFar,i=b(e,n2);en(t)&&(i.url=nU(i.url,{retry_count:t})),this._instance._send_request(y({},i,{callback:e=>{if(200!==e.statusCode&&(400>e.statusCode||e.statusCode>=500)){if((0===e.statusCode?3:10)>(null!=t?t:0))return void this.xn(y({retriesPerformedSoFar:t},i));0===e.statusCode&&t6.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(null!=t?t:0)+" retries.")}null==i.callback||i.callback(e)}}))}xn(e){var t,i,s=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=s+1;var r=Math.ceil((i=Math.min(18e5,t=3e3*Math.pow(2,s)))+(Math.random()-.5)*(i-t/2)),n=Date.now()+r;this.ka.push({retryAt:n,requestOptions:e});var a="Enqueued failed request for retry in "+r;navigator.onLine||(a+=" (Browser is offline)"),t6.warn(a),this.Ra||(this.Ra=!0,this.$a())}$a(){if(this.Da&&clearTimeout(this.Da),0===this.ka.length)return this.Ra=!1,void(this.Da=void 0);this.Da=setTimeout(()=>{this.Aa&&this.ka.length>0&&this.Oa(),this.$a()},this.Pa)}Oa(){var e=Date.now(),t=[],i=this.ka.filter(i=>e>i.retryAt||(t.push(i),!1));if(this.ka=t,i.length>0)for(var s of i)this.retriableRequest(s.requestOptions)}unload(){for(var e of(this.Da&&(clearTimeout(this.Da),this.Da=void 0),this.Ra=!1,Z(s)||(this.Fa&&(s.removeEventListener("online",this.Fa),this.Fa=void 0),this.La&&(s.removeEventListener("offline",this.La),this.La=void 0)),this.ka)){var t=e.requestOptions;try{this._instance._send_request(y({},t,{transport:"sendBeacon"}))}catch(e){t6.error(e)}}this.ka=[]}}class n5{constructor(e){this.Na=()=>{this.qa||(this.qa={});var e,t,i,s,r=this.scrollElement(),n=this.scrollY(),a=r?Math.max(0,r.scrollHeight-r.clientHeight):0,o=n+((null==r?void 0:r.clientHeight)||0),l=(null==r?void 0:r.scrollHeight)||0;this.qa.lastScrollY=Math.ceil(n),this.qa.maxScrollY=Math.max(n,null!=(e=this.qa.maxScrollY)?e:0),this.qa.maxScrollHeight=Math.max(a,null!=(t=this.qa.maxScrollHeight)?t:0),this.qa.lastContentY=o,this.qa.maxContentY=Math.max(o,null!=(i=this.qa.maxContentY)?i:0),this.qa.maxContentHeight=Math.max(l,null!=(s=this.qa.maxContentHeight)?s:0)},this._instance=e}get ja(){return this._instance.config.scroll_root_selector}getContext(){return this.qa}resetContext(){var e=this.qa;return setTimeout(this.Na,0),e}startMeasuringScrollPosition(){s_(s,"scroll",this.Na,{capture:!0}),s_(s,"scrollend",this.Na,{capture:!0}),s_(s,"resize",this.Na)}scrollElement(){if(!this.ja)return null==s?void 0:s.document.documentElement;for(var e of Y(this.ja)?this.ja:[this.ja]){var t=null==s?void 0:s.document.querySelector(e);
1if(t)return t}}Ba(e){if(this.ja){var t=this.scrollElement();return t&&t["y"===e?"scrollTop":"scrollLeft"]||0}return s?"y"===e?s.scrollY||s.pageYOffset||s.document.documentElement.scrollTop||0:s.scrollX||s.pageXOffset||s.document.documentElement.scrollLeft||0:0}scrollY(){return this.Ba("y")}scrollX(){return this.Ba("x")}}var n6=e=>rQ(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties,null==e?void 0:e.config.disable_capture_url_hashes);class n4{constructor(e,t,i,s){this.ot=e=>{var t=this.Ha();if(!t||t.sessionId!==e){var i={sessionId:e,props:this.Ua(this._instance)};this.za.register({[iX]:i})}},this._instance=e,this.Wa=t,this.za=i,this.Ua=s||n6,this.Wa.onSessionId(this.ot)}Ha(){return this.za.props[iX]}getSetOnceProps(){var e,t=null==(e=this.Ha())?void 0:e.props;return t?"r"in t?rZ(t,this._instance.config.disable_capture_url_hashes):{$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 sh(sg(this.getSetOnceProps()),(t,i)=>{"$current_url"===i&&(i="url"),e["$session_entry_"+U(i)]=t}),e}}class n8{on(e,t){return this.Va[e]||(this.Va[e]=[]),this.Va[e].push(t),()=>{this.Va[e]=this.Va[e].filter(e=>e!==t)}}emit(e,t){for(var i of this.Va[e]||[])i(t);for(var s of this.Va["*"]||[])s(e,t)}constructor(){this.Va={}}}var n9=t4("[SessionId]");class n7{on(e,t){return this.Ga.on(e,t)}constructor(e,t,i){if(this.Za=null,this.Qa=null,this.Ja=[],this.Ka=void 0,this.Ya=!1,this.Ga=new n8,this.Xa=(e,t)=>!(!en(e)||!en(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===i7)throw Error('SessionIdManager cannot be used with cookieless_mode="always"');this.qi=e.config,this.za=e.persistence,this.st=void 0,this._e=void 0,this._sessionStartTimestamp=null,this.eo=void 0,this._sessionActivityTimestamp=null,this.io=t||sF,this.ro=i||sF;var s,r=this.qi.persistence_name||this.qi.token;if(this._sessionTimeoutMs=1e3*e_(this.qi.session_idle_timeout_seconds||1800,60,36e3,n9.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.no(),this.so="ph_"+r+"_window_id",this.ao="ph_"+r+"_primary_window_exists",this.oo()){var n=sW.Br(this.so),a=sW.Br(this.ao);n&&!a?this.st=n:sW.qr(this.so),sW.Nr(this.ao,!0)}null!=(s=this.qi.bootstrap)&&s.sessionID&&this.setBootstrapSessionId(this.qi.bootstrap.sessionID),this.lo()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return Z(this.Ja)&&(this.Ja=[]),this.Ja.push(e),this._e&&e(this._e,this.st),()=>{this.Ja=this.Ja.filter(t=>t!==e)}}oo(){return"memory"!==this.qi.persistence&&!this.za.Hs&&sW.Dr()}uo(e){e!==this.st&&(this.st=e,this.oo()&&sW.Nr(this.so,e))}ho(){return this.st?this.st:this.oo()?sW.Br(this.so):null}do(e){var t=this.Za;return!ei(t)&&!ei(e)&&5e3>Math.abs(e-t)}vo(e,t,i){var s=t!==this._sessionActivityTimestamp,r=e===this._e&&i===this._sessionStartTimestamp;this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this._e=e,r&&!s||r&&this.do(t)||(this.Za=t,this.za.register({[iS]:[t,e,i]}))}co(){var e,t=null==(e=this.qi)?void 0:e.persistence_save_debounce_ms;return en(t)&&t>0}fo(){this.co()?this.za.refreshKey(iS):(this.za.flush(),this.za.load())}po(){var e;if(!ei(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Za){this.fo();var t=this.mo();t[1]===this._e&&t[2]===this._sessionStartTimestamp&&(this.Za=this._sessionActivityTimestamp,this.za.register({[iS]:[this._sessionActivityTimestamp,null!=(e=this._e)?e:null,this._sessionStartTimestamp]}),this.za.flush())}}yo(){var e=this.mo()[0];return Math.max(en(e)?e:0,en(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0)}bo(e){return this.fo(),this.Xa(e,this.yo())}mo(){var e=this.za.props[iS];return Y(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Za=null,this.eo=void 0,clearTimeout(this._o),this._o=void 0,this.vo(null,null,null)}setBootstrapSessionId(e,t){void 0===t&&(t=!1);var i=function(e,t){void 0===t&&(t=(new Date).getTime());try{var i=(e=>{var t=e.replace(/-/g,"");if(32!==t.length)throw Error("Not a valid UUID");if("7"!==t[12])throw Error("Not a UUIDv7");return parseInt(t.substring(0,12),16)})(e);return i>t+6e4?void n9.error("Bootstrap sessionID cannot be in the future"):i}catch(e){return void n9.error("Invalid sessionID in bootstrap",e)}}(e);return!Z(i)&&(t?this.eo={sessionId:e,sessionStartTimestamp:i}:this.vo(e,(new Date).getTime(),i),!0)}destroy(){this.Ya=!0,this.po(),clearTimeout(this._o),this._o=void 0,this.Ka&&s&&(s.removeEventListener(sr,this.Ka,{capture:!1}),this.Ka=void 0),this.Ja=[]}lo(){this.Ka=()=>{this.po(),this.oo()&&sW.qr(this.ao)},s_(s,sr,this.Ka,{capture:!1})}
1checkAndGetSessionAndWindowId(e,t,i){if(void 0===e&&(e=!1),void 0===t&&(t=null),void 0===i&&(i=!1),this.qi.cookieless_mode===i7)throw Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var s,r,n=t||(new Date).getTime(),a=this._e;i?this.Qa=n:(ei(this.Qa)||this.Qa>n||n-this.Qa>=1e3)&&(null==(s=(r=this.za).syncCookieProperties)||s.call(r),this.Qa=n);var o=this.mo(),l=o[1],u=o[2],h=!Z(a)&&l!==a,c=this.yo(),d=this.ho(),p=this.eo,v=!!p&&(p.sessionStartTimestamp>n+6e4||n-p.sessionStartTimestamp>864e5),g=p?v:en(u)&&Math.abs(n-u)>864e5,f=!1,_=h,m=!l||!!p,y=l,b=!m&&!e&&this.Xa(n,c);if(b){(b=this.bo(n))||n9.info("cross-tab refresh kept the session alive",{sessionId:l});var w=this.mo();l=w[1],u=w[2]}if(m||b||g){_=!1;var x=p&&!v;l=x?p.sessionId:this.io(),d=this.ro(),n9.info("new session ID assigned",{sessionId:l,windowId:d,bootstrapped:!!x,changeReason:{noSessionId:m,activityTimeout:b,sessionPastMaximumLength:g}}),u=x?p.sessionStartTimestamp:n,this.eo=void 0,f=!0}else d||(d=this.ro(),f=!0),(_=_||l!==y)&&(n9.info("adopted cross-tab session id",{sessionId:l,windowId:d}),f=!0);var k=en(c)&&e&&!g?c:n,E=en(u)?u:(new Date).getTime();this.uo(d),this.vo(l,k,E),e||this.no();var S={noSessionId:m,activityTimeout:b,sessionPastMaximumLength:g,crossTabAdoption:_};return f&&this.Ja.forEach(e=>e(l,d,S)),{sessionId:l,windowId:d,sessionStartTimestamp:E,changeReason:f?S:void 0,lastActivityTimestamp:c}}no(){this.Ya||(clearTimeout(this._o),this._o=setTimeout(()=>{if(!this.Ya)if(this.bo((new Date).getTime())){var e=this._e;this.resetSessionId(),this.Ga.emit("forcedIdleReset",{idleSessionId:e})}else this.no()},1.1*this.sessionTimeoutMs))}}var ae=function(e,t){if(!e)return!1;var i=e.userAgent;if(i&&B(i,t))return!0;try{var s=null==e?void 0:e.userAgentData;if(null!=s&&s.brands&&s.brands.some(e=>B(null==e?void 0:e.brand,t)))return!0}catch(e){}return!!e.webdriver};function at(){return(at=m(function*(){var e=null==n?void 0:n.userAgentData;if(null!=e&&e.getHighEntropyValues)try{var t=yield e.getHighEntropyValues(["model"]),i=null==t?void 0:t.model;return ee(i)&&i.length>0?i:void 0}catch(e){return void t6.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",e)}})).apply(this,arguments)}var ai=function(e,t){if(!function(e){try{new RegExp(e)}catch(e){return!1}return!0}(t))return!1;try{return new RegExp(t).test(e)}catch(e){return!1}};function as(e,t,i){return rM({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var ar={exact:(e,t)=>t.some(t=>e.some(e=>t===e)),is_not:(e,t)=>t.every(t=>e.every(e=>t!==e)),regex:(e,t)=>t.some(t=>e.some(e=>ai(t,e))),not_regex:(e,t)=>t.every(t=>e.every(e=>!ai(t,e))),icontains:(e,t)=>t.map(an).some(t=>e.map(an).some(e=>t.includes(e))),not_icontains:(e,t)=>t.map(an).every(t=>e.map(an).every(e=>!t.includes(e))),gt:(e,t)=>t.some(t=>{var i=parseFloat(t);return!isNaN(i)&&e.some(e=>i>parseFloat(e))}),lt:(e,t)=>t.some(t=>{var i=parseFloat(t);return!isNaN(i)&&e.some(e=>i<parseFloat(e))})},an=e=>e.toLowerCase();function aa(e,t){return!e||Object.entries(e).every(e=>{var i=e[1],s=null==t?void 0:t[e[0]];if(Z(s)||ei(s))return!1;var r=[String(s)],n=ar[i.operator];return!!n&&n(i.values,r)})}var ao="custom",al="i.posthog.com",au=/^\/static\//,ah=["/s/","/e/","/i/"];class ac{constructor(e){this.wo={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,t=null==(e=this.instance.config.ui_host)?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+al,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this.wo[this.apiHost]||(this.wo[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":ao),this.wo[this.apiHost]}ko(e){if(au.test(e)){var t=this.instance.config.asset_host;if("string"==typeof t)return t.trim().replace(/\/$/,"")||void 0}}So(e){var t=rq(e);return t?t.protocol+"//"+t.host+t.pathname:void 0}xo(e,t,i){if("ui"===e)return i;var s=i,r=this.instance.config.rewriteRequestPath;
1if(r&&(s=r(new URL((null==(a=rq(i))?void 0:a.href)||i)).toString()),r&&"api"===e&&ah.some(e=>0===t.indexOf(e))){var n=this.So(s);if(n){var a,o,l=this.apiHost,u=this.Co;(null==(o=u)?void 0:o.apiHost)===l&&u.rewriteRequestPath===r||(u={apiHost:l,rewriteRequestPath:r,urls:new Set},this.Co=u),u.urls.add(n)}}return s}isIngestionEndpoint(e){var t=this.Co,i=this.So(e);return(null==t?void 0:t.apiHost)===this.apiHost&&t.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!i&&t.urls.has(i)}endpointFor(e,t){if(void 0===t&&(t=""),t&&(t="/"===t[0]?t:"/"+t),"ui"===e)return this.xo(e,t,this.uiHost+t);if("flags"===e)return this.xo(e,t,this.flagsApiHost+t);if("assets"===e){var i=this.ko(t);if(i)return this.xo(e,t,""+i+t)}if(this.region===ao)return this.xo(e,t,this.apiHost+t);var s=al+t;switch(e){case"assets":return this.xo(e,t,"https://"+this.region+"-assets."+s);case"api":return this.xo(e,t,"https://"+this.region+"."+s)}}}function ad(e){var t;return!(null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)||!t.length)}var ap=t4("[Surveys]"),av="seenSurvey_",ag=e=>{try{var t=(e=>""+av+function(e){return e.current_iteration&&e.current_iteration>0?e.id+"_"+e.current_iteration:e.id}(e))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(e){ap.error("Failed to persist survey seen state",e)}},af=[r7.Popover,r7.Widget,r7.API],a_={ignoreConditions:!1,ignoreDelay:!1,displayType:ni.Popover},am=t4("[PostHog ExternalIntegrations]"),ay={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class ab{constructor(e){this._instance=e}_s(e,t){var i;null==(i=g.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,e=>{if(e)return am.error("failed to load script",e);t()})}startIfEnabledOrStop(){var e,t=this;for(var i of Object.entries(null!=(e=this._instance.config.integrations)?e:{}))!function(){var e,s,r,n=i[0],a=i[1];!a||null!=(e=g.__PosthogExtensions__)&&null!=(e=e.integrations)&&e[n]||t._s(ay[n],()=>{var e;null==(e=g.__PosthogExtensions__)||null==(e=e.integrations)||null==(e=e[n])||e.start(t._instance)}),!a&&null!=(s=g.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[n]&&(null==(r=g.__PosthogExtensions__)||null==(r=r.integrations)||null==(r=r[n])||r.stop())}()}}class aw{constructor(e,t){this.I=e,this.ns=t,this.To=new Map,this.Xn=!1}add(e){var t=this;return m(function*(){if(t.Xn)throw Error("Cannot add an extension to a disposed ExtensionRuntime");if(t.To.has(e.name))throw Error('Browser extension "'+e.name+'" is already registered');t.To.set(e.name,e);try{var i=e.setup(t.ns);i&&(yield i)}catch(i){var s=t.To.get(e.name)===e;s&&t.To.delete(e.name),t.I.error('Failed to set up browser extension "'+e.name+'"',i),s&&t.Mo(e)}})()}dispose(){if(!this.Xn){this.Xn=!0;var e=Array.from(this.To.values()).reverse();for(var t of(this.To.clear(),e))this.Mo(t)}}Mo(e){try{var t=null==e.dispose?void 0:e.dispose();t&&X(t.then)&&t.then(void 0,t=>{this.I.error('Failed to dispose browser extension "'+e.name+'"',t)})}catch(t){this.I.error('Failed to dispose browser extension "'+e.name+'"',t)}}}class ax{constructor(e){this._instance=e}initialize(){}get(e){var t=this._instance.persistence;if("string"==typeof e)return null==t?void 0:t.get_property(e);var i={};for(var s of e){var r=null==t?void 0:t.get_property(s);Z(r)||(i[s]=r)}return i}set(e,t){var i;null==(i=this._instance.persistence)||i.register("string"==typeof e?{[e]:t}:e)}remove(e){var t;null==(t=this._instance.persistence)||t.unregister(e)}}var ak="extensionsRemoteConfig";class aE{constructor(e){this.Xn=!1,this.instance=e,this.I=t6,this.Eo=e.Io,this.kv=new ax(e),this.onEvent=e=>r4(this.instance.on("eventCaptured",t=>{try{e({event:t.event,properties:t.properties})}catch(e){this.I.error("Browser extension event listener failed",e)}})),this.onRemoteConfig=e=>{if(this.Xn)return r4(()=>{});var t=t=>{try{e(t)}catch(e){this.I.error("Browser extension remote config listener failed",e)}},i=this.instance.Ro.on(ak,t);return this.Eo&&t(this.Eo),r4(i)},this.Po=new aw(t6.createLogger("[BrowserExtensions]"),this)}get logger(){return this.I}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return null!=(e=this.instance.get_property(ir))?e:this.distinctId}get deviceId(){var e=this.instance.get_property(ir);return"string"==typeof e?e:void 0}get library(){return{name:f.LIB_NAME,version:f.LIB_VERSION}}get initialPersonProperties(){var e,t;return null!=(e=null==(t=this.instance.persistence)?void 0:t.get_initial_props())?e:{}}get groups(){return this.instance.getGroups()}get session(){try{var e,t,i,s,r=null==(e=this.instance.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:null!=(t=null==r?void 0:r.sessionId)?t:"",windowId:null!=(i=null==r?void 0:r.windowId)?i:"",sessionStartTimestamp:null!=(s=null==r?void 0:r.sessionStartTimestamp)?s:0}}catch(e){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get projectToken(){return this.instance.config.token}add(e){return this.Po.add(e)}capture(e,t,i){var s=this;return m(function*(){i?s.instance.capture(e,t,{timestamp:i.timestamp,uuid:i.uuid,$set:i.set,$set_once:i.setOnce}):s.instance.capture(e,t)})()}registerDynamicEventProperties(e){return r4(this.instance.Ao(e))}handleRemoteConfig(e){this.Xn||(this.Eo=e,this.instance.Ro.emit(ak,e))}sendRequest(e,t){var i=this;return m(function*(){void 0===t&&(t={});var s,r=i.instance.requestRouter.endpointFor(null!=(s=t.target)?s:"api",e),n={method:t.method,url:t.query?nU(r,t.query):r,data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,timestampMode:t.sentAt};return"sendBeacon"===t.transport?(i.instance._send_request(n),{statusCode:202}):new Promise(e=>{n.callback=e,i.instance._send_request(n)})})()}dispose(){this.Xn||(this.Xn=!0,this.Po.dispose())}}var aS={},aP=0,aI=()=>{}
1,aF='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',aT="Surveys module not available",aO="sanitize_properties is deprecated. Use before_send instead",a$="Invalid value for property_denylist config: ",aC=["token","distinct_id",i3],aR="posthog",aM=!nj&&-1===(null==d?void 0:d.indexOf("MSIE"))&&-1===(null==d?void 0:d.indexOf("Mozilla")),aq=e=>{var t;return y({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:function(e){var t=null==e?void 0:e.hostname;if(!ee(t))return!1;var i=t.split(".").slice(-2).join(".");for(var s of sf)if(i===s)return!1;return!0}(null==a?void 0:a.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:aI,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:o&&ee(null==o?void 0:o.search)&&-1!==o.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:"https:"===(null==s||null==(t=s.location)?void 0:t.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(e){t6.error("Bad HTTP status: "+e.statusCode+" "+e.text)},get_device_id:e=>e,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:si,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:aI},(e=>({rageclick:e&&e>="2026-05-30"?{content_ignorelist:rs,ignore_text_selection:!0}
1:!e||"2025-11-30">e||{content_ignorelist:!0},capture_pageview:!e||"2025-05-24">e||"history_change",session_recording:e&&e>="2026-06-25"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6},streamNetworkBody:!0}:e&&e>="2026-05-30"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:e&&e>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:e&&e>="2026-01-30"?"head":"body",internal_or_test_user_hostname:e&&e>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:e&&e>="2026-05-30"?250:0,split_storage:!(!e||"2026-05-30">e),detect_google_search_app:!(!e||"2026-05-30">e),disable_capture_url_hashes:!(!e||"2026-06-25">e),cookieWinsOnConflict:!(!e||"unset"===e||"2026-08-29">e)}))(e))},aA=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"],["__preview_cookie_wins_on_conflict","cookieWinsOnConflict"]],aL=e=>{var t={};for(var i of aA){var s=i[0],r=i[1];Z(e[s])||(t[r]=e[s])}var n=sc({},t,e),a=e.__preview_external_dependency_versioned_paths;return Z(a)||(Z(e.strict_script_versioning)&&(n.strict_script_versioning=!!a),ee(a)&&Z(e.asset_host)&&(n.asset_host=a)),Y(e.property_blacklist)&&(Z(e.property_denylist)?n.property_denylist=e.property_blacklist:Y(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:t6.error(a$+e.property_denylist)),n};class aD{constructor(){this.__forceAllowLocalhost=!1}get Fo(){return this.__forceAllowLocalhost}set Fo(e){t6.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class aN{Oo(e,t){if(e){var i=this.To.indexOf(e);-1!==i&&this.To.splice(i,1)}return this.To.push(t),null==t.initialize||t.initialize(),t}Lo(){return this.config.cookieless_mode===i7||this.config.cookieless_mode===i9&&this.consent.isRejected()}$o(){if(!this.Lo()&&this.get_distinct_id()===i2){var e=this.persistence;if(e){this.Do()||e.load(!0);var t=this.get_distinct_id();if(!t||t===i2){var i=this.config.get_device_id(sF());this.register({distinct_id:i,$device_id:i}),e.set_property(iY,se)}this.No()}}}get decideEndpointWasHit(){var e,t;return null!=(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&e}get flagsEndpointWasHit(){var e,t;return null!=(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&e}constructor(){this.webPerformance=new aD,this.qo=!1,this.version=f.LIB_VERSION,this.jo=new Set,this.Bo="",this.Ro=new n8,this.To=[],this.Ho=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=aq(),this.SentryIntegration=rF,this.sentryIntegration=e=>(function(e,t){var i=rI(e,t);return{name:rP,processEvent:e=>i(e)}})(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Uo=!1,this.zo=null,this.Wo=null,this.Vo=null,this.scrollManager=new n5(this),this.pageViewManager=new rT(this),this.rateLimiter=new na(this),this.requestRouter=new ac(this),this.consent=new sJ(this),this.externalIntegrations=new ab(this);var e,t=null!=(e=aN.__defaultExtensionClasses)?e:{};this.featureFlags=t.featureFlags&&new t.featureFlags(this),this.toolbar=t.toolbar&&new t.toolbar(this),this.surveys=t.surveys&&new t.surveys(this),this.conversations=t.conversations&&new t.conversations(this),this.logs=t.logs&&new t.logs(this),this.metrics=t.metrics&&new t.metrics(this),this.experiments=t.experiments&&new t.experiments(this),this.exceptions=t.exceptions&&new t.exceptions(this),this.people={set:(e,t,i)=>{var s=ee(e)?{[e]:t}:e;this.setPersonProperties(s),null==i||i({})},set_once:(e,t,i)=>{var s=ee(e)?{[e]:t}:e;this.setPersonProperties(void 0,s),null==i||i({})}},this.on("eventCaptured",e=>t6.info('send "'+(null==e?void 0:e.event)+'"',e))}init(e,t,i){if(i&&i!==aR){var s,r=null!=(s=aS[i])?s:new aN;return r._init(e,t,i),aS[i]=r,aS[aR][i]=r,r}return this._init(e,t,i)}_init(e,t,i){void 0===t&&(t={});var r,n,a,o=ee(e)?e.trim():"";if(!o)return t6.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 o!==(null==(a=this.config)?void 0:a.token)?console.warn("[PostHog.js]","You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('"+o+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=aq(t.defaults),t.debug=this.Go(t.debug),this.Zo=t,this.Qo=[],t.person_profiles?this.Wo=t.person_profiles:t.process_person&&(this.Wo=t.process_person);var l=aq(t.defaults),u=aL(t),h=sc({},l,u,{name:i,token:o});K(l.rageclick)&&K(u.rageclick)&&(h.rageclick=sc({},l.rageclick,u.rageclick)),K(l.session_recording)&&K(u.session_recording)&&(h.session_recording=sc({},l.session_recording,u.session_recording)),this.set_config(h),this.config.on_xhr_error&&t6.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:r8.GZipJS;var c=this.Do();if(this.persistence=new r6(this.config,c),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new r6(y({},this.config,{persistence:"sessionStorage"}),c,!1),this.Bo="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!c&&sW.Dr()){var d=sW.Br(this.Bo);
1Y(d)&&d.forEach(e=>{ee(e)&&this.jo.add(e)})}else sW.qr(this.Bo);var p=y({},this.persistence.props),v=y({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Jo=new n1(e=>this.Ko(e),this.config.request_queue_config),this.Yo=new n3(this),this.__request_queue=[];var g=this.Lo();if(g||(this.sessionManager=new n7(this),this.sessionPropsManager=new n4(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((e,t,i)=>{(null!=i&&i.activityTimeout||null!=i&&i.sessionPastMaximumLength||null!=i&&i.crossTabAdoption)&&this.Xo()})),this.tl(),this.config.__preview_deferred_init_extensions?(t6.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.el(g)},0)):(t6.info("Initializing extensions synchronously"),this.el(g)),f.DEBUG=f.DEBUG||this.config.debug,f.DEBUG&&t6.info("Starting in debug mode",{this:this,config:t,thisC:y({},this.config),p:p,s:v}),!this.config.identity_distinct_id||null!=(r=t.bootstrap)&&r.distinctID||(t.bootstrap=y({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(n=t.bootstrap)?void 0:n.distinctID)){var _=t.bootstrap.distinctID,m=this.get_distinct_id(),b=this.persistence.get_property(iY);if(t.bootstrap.isIdentifiedID&&null!=m&&m!==_&&b===se)this.identify(_);else if(t.bootstrap.isIdentifiedID&&null!=m&&m!==_&&b===st)t6.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 w=this.config.get_device_id(sF()),x=t.bootstrap.isIdentifiedID?w:_;this.persistence.set_property(iY,t.bootstrap.isIdentifiedID?st:se),this.register({distinct_id:_,$device_id:x})}}if(g)this.register_once({distinct_id:i2,$device_id:null},"");else if(!this.get_distinct_id()){var k=this.config.get_device_id(sF());this.register_once({distinct_id:k,$device_id:k},""),this.persistence.set_property(iY,se)}return s_(s,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),t.segment?function(e,t){var i=e.config.segment;if(!i)return t();!function(e,t){var i=e.config.segment;if(!i)return t();var s=i=>{var s=()=>i.anonymousId()||sF();e.config.get_device_id=s,i.id()&&(e.register({distinct_id:i.id(),$device_id:s()}),e.persistence.set_property(iY,st)),t()},r=i.user();"then"in r&&X(r.then)?r.then(s):s(r)}(e,()=>{var s;i.register(("undefined"!=typeof Promise&&Promise.resolve||rS.warn("This browser does not have Promise support, and can not use the segment integration"),s=(t,i)=>{if(!i)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(rS.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(rS.info("UserId set, identifying with PostHog"),e.identify(t.event.userId));var s=e.calculateEventProperties(i,t.event.properties);return t.event.properties=Object.assign({},s,t.event.properties),t},{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>s(e,e.event.event),page:e=>s(e,sn),identify:e=>s(e,so),screen:e=>s(e,"$screen")})).then(()=>{t()})})}(this,()=>this.il()):this.il(),X(this.config._onCapture)&&this.config._onCapture!==aI&&(t6.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",e=>this.config._onCapture(e.event,e))),this.config.ip&&t6.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.config.disableDeviceModel||(function(){return at.a
1pply(this,arguments)})().then(e=>{e&&this.register({[ia]:e})}).catch(aI),this}rl(e){return ee(e.name)&&X(e.setup)}nl(e,t){this.rl(e)?t.push(()=>{this.sl().add(e).catch(aI)}):this.To.push(e)}tl(){var e,t,i,s,r,n,a=null!=(e=null==(t=this.config.__extensionClasses)?void 0:t.featureFlags)?e:null==(i=aN.__defaultExtensionClasses)?void 0:i.featureFlags;a&&(this.featureFlags&&this.featureFlags instanceof a||(null==(s=this.al)||s.call(this),this.al=void 0,this.featureFlags=new a(this)),X(this.featureFlags.onReloading)&&X(this.featureFlags.setup)?this.al||(this.al=this.featureFlags.onReloading(()=>{this.Ro.emit("featureFlagsReloading",!0)}),this.sl().add(this.featureFlags)):null==(r=(n=this.featureFlags).initialize)||r.call(n))}el(e){var t,i,s,r,n,a,o,l=performance.now(),u=y({},aN.__defaultExtensionClasses,this.config.__extensionClasses),h=[];u.exceptions&&this.To.push(this.exceptions=null!=(t=this.exceptions)?t:new u.exceptions(this)),u.historyAutocapture&&this.To.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this.To.push(this.tracingHeaders=new u.tracingHeaders(this)),u.siteApps&&this.To.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!e&&this.To.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||h.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),u.autocapture&&this.nl(this.autocapture=new u.autocapture(this),h),u.surveys&&this.nl(this.surveys=null!=(i=this.surveys)?i:new u.surveys(this),h),u.logs&&this.To.push(this.logs=null!=(s=this.logs)?s:new u.logs(this)),u.metrics&&this.To.push(this.metrics=null!=(r=this.metrics)?r:new u.metrics(this)),u.conversations&&this.To.push(this.conversations=null!=(n=this.conversations)?n:new u.conversations(this)),u.productTours&&this.To.push(this.productTours=new u.productTours(this)),u.heatmaps&&this.To.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this.To.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this.To.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this.To.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,rk)),u.toolbar&&this.To.push(this.toolbar=null!=(a=this.toolbar)?a:new u.toolbar(this)),u.experiments&&this.To.push(this.experiments=null!=(o=this.experiments)?o:new u.experiments(this)),this.To.forEach(e=>{e.initialize&&h.push(()=>{null==e.initialize||e.initialize()})}),h.push(()=>{if(this.ol){var e=this.ol;this.ol=void 0,this.To.forEach(t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e))}}),this.ll(h,l)}ll(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout(()=>{this.ll(e,t)},0);var i=e.shift();if(i)try{i()}catch(e){t6.error("Error initializing extension:",e)}}var s=Math.round(performance.now()-t);this.register_for_session({[i5]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[i6]:s}),this.config.__preview_deferred_init_extensions&&t6.info("PostHog extensions initialized ("+s+"ms)")}pa(e){var t;if(!a||!a.body)return t6.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.pa(e)},500);if(this.config.__preview_deferred_init_extensions&&(this.ol=e),this.Io=e,this.compression=void 0,e.ok){var i,s=e.config;s.supportedCompression&&!this.config.disable_compression&&(this.compression=z(s.supportedCompression,r8.GZipJS)?r8.GZipJS:z(s.supportedCompression,r8.Base64)?r8.Base64:void 0),null!=(i=s.analytics)&&i.endpoint&&(this.analyticsDefaultEndpoint=s.analytics.endpoint)}this.set_config({person_profiles:this.Wo?this.Wo:si}),null==(t=this.ul)||t.handleRemoteConfig(e),this.To.forEach(t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e))}il(){try{this.config.loaded(this)}catch(e){t6.critical("`loaded` function failed",e)}if(this.hl(),this.config.internal_or_test_user_hostname&&null!=o&&o.hostname){var e=o.hostname,t=this.config.internal_or_test_user_hostname;("string"==typeof t?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.Lo())&&this.dl()},1),this.vl=new nl(this),this.vl.load()}hl(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this.Jo)||e.enable())}_dom_loaded(){this.is_capturing()&&su(this.__request_queue,e=>this.Ko(e)),this.__request_queue=[],this.hl()}_handle_unload(){var e,t,i,s,r;null==(e=this.surveys)||null==e.handlePageUnload||e.handlePageUnload(),null==(t=this.metrics)||t.flush("sendBeacon"),this.config.request_batching?(this.cl()&&this.capture(sa),null==(i=this.logs)||i.flushLogs("sendBeacon"),null==(s=this.Jo)||s.unload(),null==(r=this.Yo)||r.unload()):this.cl()&&this.capture(sa,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded?aM?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(null==e.callback||e.callback({statusCode:429})):(e.transport=e.transport||this.config.api_transport,e.headers=y({},this.config.request_headers,e.headers),e.compression="best-available"===e.compression?this.compression:e.compression,(Z(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,
1(e=>{var t,i,s,r,n,a=y({},e);a.timeout=a.timeout||6e4;var o,l,u,h,d,p=null!=(s=a.transport)?s:"fetch";"sendBeacon"===p&&Z(a.compression)&&a.data&&(a.compression=r8.Base64),"POST"===a.method&&a.data&&("capture-body"===a.timestampMode?a.data={api_key:null!=(l=null==(d=(h=(Y(o=a.data)?o:[o]).map(e=>y({},e,e.timestamp instanceof Date&&!isNaN(e.timestamp.getTime())?{timestamp:e.timestamp.toISOString()}:{})))[0])||null==(u=d.properties)?void 0:u.token)?l:null==d?void 0:d.token,batch:h,sent_at:(new Date).toISOString()}:"body"===a.timestampMode&&(t=a.data,void 0===i&&(i=(new Date).toISOString()),a.data=Y(t)?t.map(e=>y({},e,{sent_at:i})):y({},t,{sent_at:i}))),a.url=nZ(a.url,a.method,a.compression,a.timestampMode);var v=n0.filter(e=>!a.disableTransport||!e.transport||!a.disableTransport.includes(e.transport)),g=null!=(r=null==(n=function(e,t){for(var i=0;e.length>i;i++)if(e[i].transport===p)return e[i]}(v))?void 0:n.method)?r:v[0].method;if(!g)throw Error("No available transport method");var f=e=>{try{g(e)}catch(e){nX(e)?t6.warn(e):t6.error(e),null==a.callback||a.callback({statusCode:0,error:e})}};"sendBeacon"!==p&&a.data&&a.compression===r8.GZipJS&&c&&"undefined"!=typeof Promise&&!nz?nJ(a).then(e=>{f(e)}).catch(t=>{if(R(t))return nz=!0,void f(y({},a,{compression:void 0,url:nZ(e.url,e.method,void 0,e.timestampMode)}));(e=>{if(!e||"object"!=typeof e)return!1;var t="name"in e?String(e.name):"";return R(e)||t===O})(t)&&(nz=!0),f(a)}):g(a)})(y({},e,{callback:t=>{var i,s;this.rateLimiter.checkForLimiting(t),400>t.statusCode||null==(i=(s=this.config).on_request_error)||i.call(s,t),null==e.callback||e.callback(t)}}))):e.fireCallbackOnDrop&&(null==e.callback||e.callback({statusCode:0}))}Ko(e){this.Yo?this.Yo.retriableRequest(e):this._send_request(e)}_execute_array(e){aP++;try{var t,i=[],s=[],r=[];su(e,e=>{if(e)if(Y(t=e[0]))r.push(e);else if(X(e))try{e.call(this)}catch(t){t6.error("Error executing queued PostHog call",e,t)}else Y(e)&&"alias"===t?i.push(e):Y(e)&&-1!==t.indexOf("capture")&&X(this[t])?r.push(e):s.push(e)});var n=function(e,t){su(e,function(e){try{if(Y(e[0])){var i=t;sh(e,function(e){i=i[e[0]].apply(i,e.slice(1))})}else t[e[0]].apply(t,e.slice(1))}catch(t){t6.error("Error executing queued PostHog call",e,t)}})};n(i,this),n(s,this),n(r,this)}finally{aP--}}push(e){if(aP>0&&Y(e)&&ee(e[0])){var t=aN.prototype[e[0]];X(t)&&t.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,t,i){var s,r,n,a,o;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Jo){if(this.is_capturing())if(!Z(e)&&ee(e)){this.$o();var l=!this.config.opt_out_useragent_filter&&this._is_bot();if(!l||this.config.__preview_capture_bot_pageviews){var u=null!=i&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==u||!u.isRateLimited){null!=t&&t.$current_url&&!ee(null==t?void 0:t.$current_url)&&(t6.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==t||delete t.$current_url),"$exception"!==e||null!=i&&i.fl||t6.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,c,d,p,v=new Date,g=(null==i?void 0:i.timestamp)||v,f=tp(null==i?void 0:i.uuid,sF),_={uuid:f,event:e,properties:this.calculateEventProperties(e,t||{},g,f)};e===sn&&this.config.__preview_capture_bot_pageviews&&l&&(_.event="$bot_pageview",_.properties.$browser_type="bot"),u&&(_.properties.$lib_rate_limit_remaining_tokens=u.remainingTokens);var m="$feature_flag_called"===e&&!1===_.properties.$feature_flag_has_experiment&&!0===this.get_property(iR);(null==i?void 0:i.$set)&&!m&&(_.$set=null==i?void 0:i.$set);var b=null==i?void 0:i.$unset;b&&(_.$unset=b);var w,x,k,E=m?void 0:this.pl(null==i?void 0:i.$set_once,e!==sl,e===so);if(E&&(_.$set_once=E),null!=i&&i._noTruncate||(r=this.config.properties_string_max_length,n=_,a=e=>ee(e)?e.slice(0,r):e,o=new Set,_=function e(t,i){if(t!==Object(t))return a?a(t):t;if(!o.has(t)){var s;if(o.add(t),Y(t))s=[],su(t,t=>{s.push(e(t))});else{var r={};sh(t,(t,i)=>{o.has(t)||(r[i]=e(t,i))}),s=r}return s}}(n)),_.timestamp=g,Z(null==i?void 0:i.timestamp)||(_.properties.$event_time_override_provided=!0,_.properties.$event_time_override_system_time=v),m&&(_.properties=(h=_.properties,void 0===(c=aC)&&(c=[]),d={},p=e=>{void 0!==h[e]&&(d[e]=h[e])}
1,S.forEach(p),c.forEach(p),d)),e===ne.DISMISSED||e===ne.SENT){var P=null==t?void 0:t[nt.SURVEY_ID],I=null==t?void 0:t[nt.SURVEY_ITERATION];ag({id:P,current_iteration:I}),_.$set=y({},_.$set,{[(w={id:P,current_iteration:I},k="$survey_"+(x=e===ne.SENT?"responded":"dismissed")+"/"+w.id,w.current_iteration&&w.current_iteration>0&&(k="$survey_"+x+"/"+w.id+"/"+w.current_iteration),k)]:!0})}else e===ne.SHOWN&&(_.$set=y({},_.$set,{[nt.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(e===ns.SHOWN){var F=null==t?void 0:t[nr.TOUR_TYPE];F&&(_.$set=y({},_.$set,{[nr.TOUR_LAST_SEEN_DATE+"/"+F]:(new Date).toISOString()}))}var T=y({},_.properties.$set,_.$set);if(Q(T)||this.setPersonPropertiesForFlags(T),!es(this.config.before_send)){var O=this.kn(_);if(!O)return;(_=O).uuid=tp(_.uuid,sF)}this.Ro.emit("eventCaptured",_);var $=null!=(s=null==i?void 0:i._url)?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),C={method:"POST",url:$,data:_,compression:"best-available",timestampMode:"recordings"===(null==i?void 0:i._batchKey)||/\/s\/(?:\?|$)/.test($)?"body":"capture-body",batchKey:null==i?void 0:i._batchKey,transport:null==i?void 0:i.transport};return!this.config.request_batching||i&&(null==i||!i._batchKey)||null!=i&&i.send_instantly?this.Ko(C):this.Jo.enqueue(C),_}t6.critical("This capture call is ignored due to client rate limiting.")}}else t6.error("No event name provided to posthog.capture")}else t6.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",t=>e(t.event,t))}sl(){var e;return null!=(e=this.ul)?e:this.ul=new aE(this)}Ao(e){this.Ho.push(e);var t=!0;return()=>{if(t){t=!1;var i=this.Ho.indexOf(e);-1!==i&&this.Ho.splice(i,1)}}}gl(e){var t,i,s;return void 0===e&&(e=!0),!(null==(t=this.persistence)||!t.consumeCookieIdentityChange())&&(this.Vo=null,this.persistence.get_property(iY)===se&&(null==(s=this.sessionPersistence)||s.clear(),this.jo.clear(),this.ml()),null==(i=this.featureFlags)||i.reset(),e&&this.reloadFeatureFlags(),!0)}calculateEventProperties(e,t,i,r,n){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return t;this.persistence.syncCookieProperties(),this.gl();var l,u=n?void 0:this.persistence.remove_event_timer(e),h=y({},t);if(h.token=this.config.token,h.$config_defaults=this.config.defaults,this.Lo()&&(h[i3]=!0),"$snapshot"===e){var c=y({},this.persistence.properties(),this.sessionPersistence.properties());return h.distinct_id=c.distinct_id,(!ee(h.distinct_id)&&!er(h.distinct_id)||et(h.distinct_id))&&t6.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),h}var p,v=function(e,t,i,r){if(void 0===r&&(r=!1),!d)return{};var n,a,l,u,h,c=e?[...rz,...t||[]]:[],p=function(e){for(var t=0;th.length>t;t++){var i=th[t],s=i[1],r=i[0].exec(e),n=r&&(X(s)?s(r,e):s);if(n)return n}return["",""]}(d),v=p[0],g=p[1],_=null!=(h="undefined"!=typeof navigator?navigator:void 0)&&h.brave?{brave:!0}:{},m={};Z(i)||(m.detectGoogleSearchApp=i);var y={},b=null==(n=navigator)||null==(n=n.userAgentData)?void 0:n.platform,w=null==(a=navigator)?void 0:a.maxTouchPoints,x=null==s||null==(l=s.screen)?void 0:l.width,k=null==s||null==(u=s.screen)?void 0:u.height,E=null==s?void 0:s.devicePixelRatio;Z(b)||(y.userAgentDataPlatform=b),Z(w)||(y.maxTouchPoints=w),Z(x)||(y.screenWidth=x),Z(k)||(y.screenHeight=k),Z(E)||(y.devicePixelRatio=E);var S,P,I,F,T,O,$=sc(sg({$os:v,$os_version:g,$browser:to(d,navigator.vendor,_,m),$device:tc(d),$device_type:(O=tc(d))===ek||O===ex||"Kobo"===O||"Kindle Fire"===O||O===eZ?ew:O===ez||O===eU||O===eH||O===eX?"Console":O===eS?"Wearable":O?ey:"Android"===(null==y?void 0:y.userAgentDataPlatform)&&(null!=(P=null==y?void 0:y.maxTouchPoints)?P:0)>0?600>Math.min(null!=(I=null==y?void 0:y.screenWidth)?I:0,null!=(F=null==y?void 0:y.screenHeight)?F:0)/(null!=(T=null==y?void 0:y.devicePixelRatio)?T:1)?ey:ew:"Desktop",$timezone:r0(),$timezone_offset:function(){try{return(new Date).getTimezoneOffset()}catch(e){return}}()}),{$current_url:rL(r?tv(null==o?void 0:o.href):null==o?void 0:o.href,c,rU),$host:null==o?void 0:o.host,$pathname:null==o?void 0:o.pathname,$raw_user_agent:d.length>1e3?d.substring(0,997)+"...":d,$browser_version:tu(d,navigator.vendor,_,m),$browser_language:rY(),$browser_language_prefix:"string"==typeof(S=rY())?S.split("-")[0]:void 0,$screen_height:null==s?void 0:s.screen.height,$screen_width:null==s?void 0:s.screen.width,$viewport_height:null==s?void 0:s.innerHeight,$viewport_width:null==s?void 0:s.innerWidth,$lib:f.LIB_NAME,$lib_version:f.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});
1return f.SDK_DIST_CHANNEL&&($.$sdk_dist_channel=f.SDK_DIST_CHANNEL),$}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var g=this.sessionManager.checkAndGetSessionAndWindowId(n,i.getTime(),!0),_=g.windowId;h.$session_id=g.sessionId,h.$window_id=_}this.sessionPropsManager&&sc(h,this.sessionPropsManager.getSessionProps());try{this.sessionRecording&&sc(h,this.sessionRecording.sdkDebugProperties),h.$sdk_debug_retry_queue_size=null==(l=this.Yo)?void 0:l.length}catch(e){h.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===ao&&(h.$lib_custom_api_host=this.config.api_host),p=e!==sn||n?e!==sa||n?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,r),h=sc(h,p),e===sn&&a&&(h.title=a.title),!Z(u)){var m=i.getTime()-u;h.$duration=parseFloat((m/1e3).toFixed(3))}d&&this.config.opt_out_useragent_filter&&(h.$browser_type=this._is_bot()?"bot":"browser");var b=this.persistence.properties(),w=this.sessionPersistence.properties();sh(["$referrer","$referring_domain"],e=>{e in b&&delete w[e]});var x={};if(this.Ho.length>0)for(var k of this.Ho.slice())try{sc(x,k())}catch(e){t6.error("Failed to produce browser extension event properties",e)}(h=sc({},v,b,w,y({},x,h))).$is_identified=this._isIdentified(),Y(this.config.property_denylist)?sh(this.config.property_denylist,function(e){delete h[e]}):t6.error(a$+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var E=this.config.sanitize_properties;E&&(t6.error(aO),h=E(h,e));var S=this.yl();return h.$process_person_profile=S,S&&!n&&this.bl("_calculate_event_properties"),h}pl(e,t,i){if(void 0===t&&(t=!0),void 0===i&&(i=!1),!this.persistence||!this.yl()||this.qo&&!i)return e;var s,r=sc({},this.persistence.get_initial_props(),(null==(s=this.sessionPropsManager)?void 0:s.getSetOnceProps())||{},e||{}),n=this.config.sanitize_properties;return n&&(t6.error(aO),r=n(r,"$set_once")),t&&(this.qo=!0),Q(r)?void 0:r}register(e,t){var i;null==(i=this.persistence)||i.register(e,t)}register_once(e,t,i){var s;null==(s=this.persistence)||s.register_once(e,t,i)}register_for_session(e){var t,i;null==(t=this.persistence)||t.syncCookieProperties(),this.gl(),null==(i=this.sessionPersistence)||i.register(e),Object.keys(e).forEach(e=>this.jo.add(e)),this.ml()}unregister(e){var t;null==(t=this.persistence)||t.unregister(e)}unregister_for_session(e){var t;null==(t=this.sessionPersistence)||t.unregister(e),this.jo.delete(e),this.ml()}_l(e,t){this.register({[e]:t})}Xo(){this.jo.forEach(e=>{var t;null==(t=this.sessionPersistence)||t.unregister(e)}),this.jo.clear(),this.ml()}ml(){var e;if(this.Bo)if("memory"===this.config.persistence||null!=(e=this.sessionPersistence)&&e.Hs||!sW.Dr())sW.qr(this.Bo);else{var t=[];this.jo.forEach(e=>t.push(e)),t.length>0?sW.Nr(this.Bo,t):sW.qr(this.Bo)}}getFeatureFlag(e,t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return null==(t=this.featureFlags)?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagResult(e,t)}getAllFeatureFlags(){var e,t;return null!=(e=null==(t=this.featureFlags)?void 0:t.getAllFeatureFlags())?e:[]}isFeatureEnabled(e,t){var i,s;return null!=(i=null==(s=this.featureFlags)?void 0:s.isFeatureEnabled(e,t))?i:null==t?void 0:t.defaultValue}reloadFeatureFlags(){var e;null==(e=this.featureFlags)||e.reloadFeatureFlags()}updateFlags(e,t,i){var s;null==(s=this.featureFlags)||s.updateFlags(e,t,i)}updateEarlyAccessFeatureEnrollment(e,t,i){var s;null==(s=this.featureFlags)||s.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t,i){var s;return void 0===t&&(t=!1),null==(s=this.featureFlags)?void 0:s.getEarlyAccessFeatures(e,t,i)}on(e,t){return this.Ro.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:aT}),()=>{})}onSessionId(e){var t,i;return null!=(t=null==(i=this.sessionManager)?void 0:i.onSessionId(e))?t:()=>{}}getSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:aT})}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:aT})}renderSurvey(e,t){var i;null==(i=this.surveys)||i.renderSurvey(e,t)}displaySurvey(e,t){var i;void 0===t&&(t=a_),null==(i=this.surveys)||i.displaySurvey(e,t)}cancelPendingSurvey(e){var t;null==(t=this.surveys)||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,i;return null!=(t=null==(i=this.surveys)?void 0:i.canRenderSurvey(e))?t:{visible:!1,disabledReason:aT}}canRenderSurveyAsync(e,t){var i,s;return void 0===t&&(t=!1),null!=(i=null==(s=this.surveys)?void 0:s.canRenderSurveyAsync(e,t))?i:Promise.resolve({visible:!1,disabledReason:aT})}wl(e){return!e||et(e)?(t6.critical("Unique user id has not been set in posthog.identify"),!1):e===i2?(t6.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())||(t6.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,i){if(!this.__loaded||!this.persistence)return t6.uninitializedWarning("posthog.identify");if(er(e)&&(e=e.toString(),t6.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.wl(e)&&this.bl("posthog.identify")){this.$o();var s=this.get_distinct_id(),r=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==s,n=this.gl(!1),a=this.persistence.Ws(),o=!1;try{var l=this.get_distinct_id();this.register({$user_id:e}),this.get_property(ir)||this.register_once({$had_persisted_distinct_id:!0,$device_id:l},""),e!==l&&e!==this.get_property(io)&&(this.unregister(io),this.register({distinct_id:e}));var u,h=(this.persistence.get_property(iY)||se)===se,c=e!==l,d=!c&&h;if(c&&h)this.persistence.set_property(iY,st),this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Vs(),this.capture(so,{distinct_id:e,$anon_distinct_id:l},{$set:t||{},$set_once:i||{}}),this.Vo=as(e,t,i),null==(u=this.featureFlags)||u.setAnonymousDistinctId(l);else if(d){this.persistence.set_property(iY,st);var p=t||{},v=i||{};this.setPersonPropertiesForFlags({$set:p,$set_once:v},!1),this.config.cookieWinsOnConflict&&this.persistence.Vs(),this.capture("$set",{$set:p,$set_once:v}),this.Vo=as(e,t,i)}else(t||i)&&this.setPersonProperties(t,i);c||r||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(iV)):d&&(t||i)&&this.reloadFeatureFlags(),o=!0}finally{a&&this.persistence.Qs(o)}}}setPersonProperties(e,t){if((e||t)&&this.bl("posthog.setPersonProperties")){var i=as(this.get_distinct_id(),e,t);this.Vo!==i?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Vo=i):t6.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(e){var t,i=(Y(e)?e:[e]).filter(e=>ee(e)&&e.length>0);0!==i.length&&this.bl("posthog.unsetPersonProperties")&&(null==(t=this.featureFlags)||t.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.Vo=null)}group(e,t,i){var s;if(e&&t){null==(s=this.persistence)||s.syncCookieProperties(),this.gl();var r=this.getGroups(),n=r[e]!==t;if(n&&this.resetGroupPropertiesForFlags(e),this.register({$groups:y({},r,{[e]:t})}),n||i){var a={$group_type:e,$group_key:t};i&&(a.$group_set=i),this.capture(sl,a)}i&&this.setGroupPropertiesForFlags({[e]:i}),n&&!i&&this.reloadFeatureFlags()}else t6.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){var i;void 0===t&&(t=!0),null==(i=this.featureFlags)||i.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(e){var t;void 0===e&&(e=!0),null==(t=this.featureFlags)||t.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,t){var i;void 0===t&&(t=!0),this.bl("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;null==(t=this.featureFlags)||t.resetGroupPropertiesForFlags(e)}reset(e){var t=ea(e)?e:null==e?void 0:e.resetDeviceID,i=ea(e)||null==e?void 0:e.bootstrap;this.kl(t,!1,i)}kl(e,t,i){if(void 0===t&&(t=!1),t6.info("reset"),!this.__loaded)return t6.uninitializedWarning("posthog.reset");var s,r,n,a,o,l,u,h,c,d,p,v,g,f,_,m,b,w,x=null==i?void 0:i.sessionID;this.config.bootstrap=i||(null==(s=this.Zo)?void 0:s.bootstrap)||{},null==(r=this.featureFlags)||null==r.updateConfig||r.updateConfig(this.config,this.ma());var k=this.get_property(ir),E=this.get_property(ia),S=this.get_property(iy),P=this.is_capturing();this.consent.reset(),t||!P||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");var I=null==(n=this.persistence)||null==n.Ws?void 0:n.Ws(),F=!1;try{if(null==(a=this.persistence)||a.clear(),null==(o=this.sessionPersistence)||o.clear(),this.jo.clear(),this.ml(),Z(S)||null==(f=this.persistence)||f.register({[iy]:S}),null==(l=this.surveys)||l.reset(),null==(u=this.vl)||u.stop(),null==(h=this.featureFlags)||h.reset(),null==(c=this.conversations)||c.reset(),null==(d=this.logs)||d.reset(),null==(p=this.metrics)||p.reset(),null==(v=this.persistence)||v.set_property(iY,se),null==(g=this.sessionManager)||g.resetSessionId(),this.Vo=null,this.config.cookieless_mode===i7)this.register_once({distinct_id:i2,$device_id:null},"");else{var T=this.config.get_device_id(sF());this.register_once({distinct_id:T,$device_id:e?T:k},""),e||Z(E)||this.register({[ia]:E})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),i&&(void 0===i.distinctID||this.Lo()||(null==(b=this.persistence)||b.set_property(iY,i.isIdentifiedID?st:se),this.register({distinct_id:i.distinctID})),null==(_=this.featureFlags)||_.initialize(),!(Z(x)||null!=(m=this.sessionManager)&&m.setBootstrapSessionId(x,!0)))){var O=y({},i);delete O.sessionID,this.config.bootstrap=O}delete this.config.identity_distinct_id,delete this.config.identity_hash,F=!0}finally{I&&(null==(w=this.persistence)||null==w.Qs||w.Qs(F))}this.reloadFeatureFlags()}shutdown(e){var t=this;return m(function*(){var e,i,s,r,n,a,o;if(t.__loaded){null==(e=t.vl)||e.stop(),t.sl().dispose(),null==(i=t.sessionRecording)||i.dispose(),null==(s=t.logs)||s.flushLogs("sendBeacon"),null==(r=t.metrics)||r.flush("sendBeacon"),null==(n=t.Jo)||n.unload(),null==(a=t.Yo)||a.unload();try{null==(o=t.featureFlags)||o.destroy()}catch(e){t6.error("Error while destroying feature flags",e)}}else t6.uninitializedWarning("posthog.shutdown")})()}setIdentity(e,t){var i;this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),null==(i=this.conversations)||i.Sl()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(e=this.conversations)||e.xl()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return null!=(e=null==(t=this.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var t=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=t.sessionStartTimestamp,s=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t.sessionId);if(null!=e&&e.withTimestamp&&i){var r,n=null!=(r=e.timestampLookBack)?r:10;if(!i)return s;s+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return s}alias(e,t){return e===this.get_property(ii)?(t6.critical("Attempting to create alias for existing People user - aborting."),-2):this.bl("posthog.alias")?(Z(t)&&(t=this.get_distinct_id()),e!==t?(this._l(io,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(t6.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=y({},this.config);if(K(e)){sc(this.config,aL(e));var i=this.Do();null==(s=this.persistence)||s.update_config(this.config,t,i),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new r6(y({},this.config,{persistence:"sessionStorage"}),i,!1);var s,r,n,a,o,l,u,h,c,d,p,v,g,_=this.Go(this.config.debug);ea(_)&&(this.config.debug=_),ea(this.config.debug)&&(this.config.debug?(f.DEBUG=!0,sM.Dr()&&sM.Nr("ph_debug",!0),t6.info("set_config",{config:e,oldConfig:t,newConfig:y({},this.config)})):(f.DEBUG=!1,sM.Dr()&&sM.qr("ph_debug"))),null==(r=this.featureFlags)||null==r.updateConfig||r.updateConfig(this.config,this.ma()),null==(n=this.exceptionObserver)||n.onConfigChange(),null==(a=this.exceptions)||a.onConfigChange(),null==(o=this.sessionRecording)||o.startIfEnabledOrStop(),null==(l=this.tracingHeaders)||l.startIfEnabledOrStop(),null==(u=this.autocapture)||u.startIfEnabled(),null==(h=this.heatmaps)||h.startIfEnabled(),("capture_pageview"in e||"disable_capture_url_hashes"in e)&&(null==(g=this.historyAutocapture)||g.startIfEnabledOrStop()),null==(c=this.exceptionObserver)||c.startIfEnabledOrStop(),null==(d=this.deadClicksAutocapture)||d.startIfEnabledOrStop(),null==(p=this.surveys)||p.loadIfEnabled(),this.No(),null==(v=this.externalIntegrations)||v.startIfEnabledOrStop()}}_overrideSDKInfo(e,t){f.LIB_NAME=e,f.LIB_VERSION=t}startSessionRecording(e){var t,i,s,r,n,a=!0===e,o={sampling:a||!(null==e||!e.sampling),linked_flag:a||!(null==e||!e.linked_flag),url_trigger:a||!(null==e||!e.url_trigger),event_trigger:a||!(null==e||!e.event_trigger)};Object.values(o).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),o.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),o.linked_flag&&(null==(s=this.sessionRecording)||s.overrideLinkedFlag()),o.url_trigger&&(null==(r=this.sessionRecording)||r.overrideTrigger("url")),o.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!(null==(e=this.sessionRecording)||!e.started)}captureException(e,t){if(this.exceptions){var i=Error("PostHog syntheticException"),s=this.exceptions.buildProperties(e,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(y({},s,t))}}addExceptionStep(e,t){var i;null==(i=this.exceptions)||i.addExceptionStep(e,t)}captureLog(e){var t;null==(t=this.logs)||t.captureLog(e)}get logger(){var e,t;return null!=(e=null==(t=this.logs)?void 0:t.logger)?e:aN.Cl}startExceptionAutocapture(e){this.set_config({capture_exceptions:null==e||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,i;return null!=(t=null==(i=this.toolbar)?void 0:i.loadToolbar(e))&&t}get_property(e){var t;return null==(t=this.persistence)?void 0:t.props[e]}getSessionProperty(e){var t;return null==(t=this.sessionPersistence)?void 0:t.props[e]}toString(){var e,t=null!=(e=this.config.name)?e:aR;return t!==aR&&(t=aR+"."+t),t}_isIdentified(){var e,t;return(null==(e=this.persistence)?void 0:e.get_property(iY))===st||(null==(t=this.sessionPersistence)?void 0:t.get_property(iY))===st}yl(){var e,t;return!("never"===this.config.person_profiles||this.config.person_profiles===si&&!this._isIdentified()&&Q(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[io])&&(null==(t=this.persistence)||null==(t=t.props)||!t[i1]))}cl(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.yl()||this.bl("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.bl("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}bl(e){return"never"===this.config.person_profiles?(t6.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._l(i1,!0),!0)}Do(){if("always"===this.config.cookieless_mode)return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==i9)}No(){var e,t,i,s,r=this.Do();return(null==(e=this.persistence)?void 0:e.Hs)!==r&&(null==(i=this.persistence)||i.set_disabled(r)),(null==(t=this.sessionPersistence)?void 0:t.Hs)!==r&&(null==(s=this.sessionPersistence)||s.set_disabled(r)),r&&(this.jo.clear(),this.ml()),r}opt_in_capturing(e){var t;if(this.config.cookieless_mode!==i7){if(this.Lo()){this.kl(!0,!0),null==(r=this.sessionManager)||r.destroy(),null==(n=this.pageViewM
1anager)||n.destroy(),this.sessionManager=new n7(this),this.pageViewManager=new rT(this),this.persistence&&(this.sessionPropsManager=new n4(this,this.sessionManager,this.persistence));var i,s,r,n,a,o,l,u,h=null!=(a=null==(o=this.config.__extensionClasses)?void 0:o.sessionRecording)?a:null==(l=aN.__defaultExtensionClasses)?void 0:l.sessionRecording;h&&(this.sessionRecording=this.Oo(this.sessionRecording,new h(this)),this.Io&&(null==(u=this.sessionRecording)||null==u.onRemoteConfig||u.onRemoteConfig(this.Io)))}this.consent.optInOut(!0),this.No(),this.hl(),null==(t=this.sessionRecording)||t.startIfEnabledOrStop(),this.config.cookieless_mode==i9&&(null==(i=this.surveys)||i.loadIfEnabled()),(Z(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!=(s=null==e?void 0:e.captureEventName)?s:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.dl()}else t6.warn(aF)}opt_out_capturing(){var e,t,i;this.config.cookieless_mode!==i7?(this.config.cookieless_mode===i9&&this.consent.isOptedIn()&&this.kl(!0,!0),this.consent.optInOut(!1),this.No(),this.config.cookieless_mode===i9&&(this.register({distinct_id:i2,$device_id:null}),null==(e=this.sessionRecording)||e.stopRecording(),this.sessionRecording=void 0,null==(t=this.sessionManager)||t.destroy(),null==(i=this.pageViewManager)||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.dl(),this.hl())):t6.warn(aF)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return 1===e?"granted":0===e?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===i7||(this.config.cookieless_mode===i9?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.No()}_is_bot(){return n?ae(n,this.config.custom_blocked_useragents):void 0}dl(){a&&("visible"===a.visibilityState?this.Uo||(this.Uo=!0,this.capture(sn,{title:a.title},{send_instantly:!0}),this.zo&&(a.removeEventListener(ss,this.zo),this.zo=null)):this.zo||(this.zo=this.dl.bind(this),s_(a,ss,this.zo)))}debug(e){!1===e?(null==s||s.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==s||s.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}))}ma(){var e,t,i,s,r=this.Zo||{};return"advanced_disable_flags"in r?!!r.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(t6.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(t="advanced_disable_decide",i=(e="advanced_disable_flags")in r&&!es(r[e]),s=t in r&&!es(r[t]),i?r[e]:!!s&&(t6&&t6.warn("Config field '"+t+"' is deprecated. Please use '"+e+"' instead. The old field will be removed in a future major version."),r[t]))}kn(e){if(es(this.config.before_send))return e;var t,i=Object.keys(null!=(t=e.properties)?t:{}).filter(el),s=Y(this.config.before_send)?this.config.before_send:[this.config.before_send],r=e;for(var n of s)try{if(r=n(r),es(r)){var a="Event '"+e.event+"' was rejected in beforeSend function";return eo(e.event)?t6.warn(a+". This can cause unexpected behavior."):t6.info(a),null}r.properties&&!Q(r.properties)||t6.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}catch(t){return t6.error("Error in beforeSend function for event '"+e.event+"':",t),null}for(var o of i)if(r.properties&&es(r.properties[o]))return t6.warn("Event '"+e.event+"' had its '"+o+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return r}getPageViewId(){var e;return null==(e=this.pageViewManager.Ss)?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}Go(e){var t=ea(e)&&!e,i=sM.Dr()&&"true"===sM.Pr("ph_debug");return!t&&(!!i||e)}}aN.__defaultExtensionClasses={},aN.Cl=(()=>{var e=()=>{};return{trace:e,debug:e,info:e,warn:e,error:e,fatal:e}})(),function(e,t){for(var i=0;t.length>i;i++)e.prototype[t[i]]=sv(e.prototype[t[i]])}(aN,["identify"]);class aj{constructor(e){this.disabled=!1===e;var t=K(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,i){if(this.disabled)return!1;var s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(t-s.y)<this.thresholdPx&&this.timeoutMs>i-s.timestamp){if(this.clicks.push({x:e,y:t,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:i}];return!1}}var aB="$copy_autocapture",az=t4("[AutoCapture]");function aH(e,t){return t.length>e?t.slice(0,e)+"...":t}class aU{constructor(e){this.name="autocapture",this.Qn=!1,this.Jn=null,this.Kn=!1,this.Yn=!1,this.qi={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.Xn=!1,this.ts=e,this.ts.refresh(this.qi),this.rageclicks=new aj(this.qi.rageclick),this.es=null}setup(e){this.rs(),this.ns=e;var t=e.onRemoteConfig(this.onRemoteConfig.bind(this));this.Xn?t.dispose():(this.ss=t,this.startIfEnabled())}dispose(){var e;this.Xn||(this.Xn=!0,this.ns=void 0,null==(e=this.ss)||e.dispose(),this.ss=void 0,this.os())}ls(){return this.ts.refresh(this.qi),this.qi}rs(){var e,t;return this.ls(),this.qi.url_allowlist=null==(e=this.qi.url_allowlist)?void 0:e.map(e=>new RegExp(e)),this.qi.url_ignorelist=null==(t=this.qi.url_ignorelist)?void 0:t.map(e=>new RegExp(e)),this.qi}
1us(){if(this.isBrowserSupported()){if(s&&a){var e=this.hs=e=>{e=e||(null==s?void 0:s.event);try{this.ds(e)}catch(e){az.error("Failed to capture event",e)}};if(s_(a,"submit",e,{capture:!0}),s_(a,"change",e,{capture:!0}),s_(a,"click",e,{capture:!0}),this.ls().capture_copied_text){var t=this.vs=e=>{e=e||(null==s?void 0:s.event);try{this.ds(e,aB)}catch(e){az.error("Failed to capture copy/cut event",e)}};s_(a,"copy",t,{capture:!0}),s_(a,"cut",t,{capture:!0})}}}else az.info("Disabling Automatic Event Collection because this browser is not supported")}os(){this.hs&&(null==a||a.removeEventListener("submit",this.hs,!0),null==a||a.removeEventListener("change",this.hs,!0),null==a||a.removeEventListener("click",this.hs,!0),this.hs=void 0),this.vs&&(null==a||a.removeEventListener("copy",this.vs,!0),null==a||a.removeEventListener("cut",this.vs,!0),this.vs=void 0),this.Qn=!1}startIfEnabled(){!this.Xn&&this.ns&&this.isEnabled&&!this.Qn&&(this.us(),this.Qn=!0)}onRemoteConfig(e){if(!this.Xn)if(this.Kn=!0,e.ok){var t=e.config;t.elementsChainAsString&&(this.Yn=t.elementsChainAsString);var i,s=t.autocapture_opt_out;ea(s)&&(null==(i=this.ns)||i.kv.set(iu,s),this.Jn=s),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(e){this.es=e}getElementSelectors(e){var t,i=[];return null==(t=this.es)||t.forEach(t=>{var s=null==a?void 0:a.querySelectorAll(t);null==s||s.forEach(s=>{e===s&&i.push(t)})}),i}get isEnabled(){if(this.Xn)return!1;var e,t,i=null==(e=this.ns)?void 0:e.kv.get(iu),s=this.Jn,r=this.ls(),n=r.remoteRequestsDisabled&&!this.Kn;if(ei(s)&&!ea(i)&&!n)return!1;var a=null!=(t=this.Jn)?t:!!i;return!!r.enabled&&!a}ds(e,t){if(void 0===t&&(t="$autocapture"),this.isEnabled){var i=s8(e);s0(i)&&(i=i.parentNode||null);var r,n=this.rs();"$autocapture"===t&&"click"===e.type&&e instanceof MouseEvent&&n.rageclick&&null!=(r=this.rageclicks)&&r.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime())&&ro(i,n.rageclick)&&this.ds(e,"$rageclick");var a=t===aB;if(i&&function(e,t,i,r,n,a){if(!s||rl(e)||null!=i&&i.url_allowlist&&!s3(i.url_allowlist,a)||null!=i&&i.url_ignorelist&&s3(i.url_ignorelist,a))return!1;if(null!=i&&i.dom_event_allowlist){var o,l=i.dom_event_allowlist;if(l&&!l.some(e=>t.type===e))return!1}var u=ru(e,r),h=u.parentIsUsefulElement,c=u.targetElementList;if(!function(e,t){var i=null==t?void 0:t.element_allowlist;if(Z(i))return!0;var s,r=function(e){if(i.some(t=>e.tagName.toLowerCase()===t))return{v:!0}};for(var n of e)if(s=r(n))return s.v;return!1}(c,i)||!s7(c,null==i?void 0:i.css_selector_allowlist)||s7(c,null!=(o=null==i?void 0:i.css_selector_ignorelist)?o:rt))return!1;try{var d=s.getComputedStyle(e);if(d&&"pointer"===d.getPropertyValue("cursor")&&"click"===t.type)return!0}catch(e){}var p=e.tagName.toLowerCase();switch(p){case"html":return!1;case"form":return(n||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(t.type)>=0;default:return h?(n||["click"]).indexOf(t.type)>=0:(n||["click"]).indexOf(t.type)>=0&&(s9.indexOf(p)>-1||"true"===e.getAttribute("contenteditable"))}}(i,e,n,a,a?["copy","cut"]:void 0,{config:{get_current_url:n.getCurrentUrl}})){var o,l=function(e,t){var i,r,n=t.e,a=t.maskAllElementAttributes,o=t.maskAllText,l=t.elementAttributeIgnoreList,u=t.elementsChainAsString,h=t.disableCaptureUrlHashes;if(!sQ(e))return{props:{}};for(var c=[e],d=new Set([e]),p=e;p.parentNode&&!sZ(p,"body")&&1e3>c.length;)if(s1(p.parentNode)){var v=p.parentNode.host;if(d.has(v))break;d.add(v),c.push(v),p=v}else{if(!sQ(p.parentNode)||d.has(p.parentNode))break;d.add(p.parentNode),c.push(p.parentNode),p=p.parentNode}var g,f=[],_={},m=!1,b=!1;if(sh(c,e=>{var t=rh(e);if(sZ(e,"a")){var i=e.getAttribute("href");m=!!(t&&i&&rm(i))&&(h?tv(i):i)}z(s5(e),"ph-no-capture")&&(b=!0),f.push(function(e,t,i,s,r){void 0===r&&(r=!1);var n=e.tagName.toLowerCase(),a={tag_name:n};s9.indexOf(n)>-1&&!i&&(a.$el_text="a"===n.toLowerCase()||"button"===n.toLowerCase()?aH(1024,ry(e)):aH(1024,s4(e)));var o=s5(e);o.length>0&&(a.classes=o.filter(function(e){return""!==e})),sh(e.attributes,function(i){var n;if((!rc(e)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==s||!s.includes(i.name))&&
1!t&&rm(i.value)&&(!ee(n=i.name)||"_ngcontent"!==n.substring(0,10)&&"_nghost"!==n.substring(0,7))){var o=i.value;"class"===i.name&&(o=s2(o).join(" ")),a["attr__"+i.name]=aH(1024,"href"===i.name&&r?tv(o):o)}});for(var l=1,u=1,h=e;h=function(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!sQ(t));return t}(h);)l++,h.tagName===e.tagName&&u++;return a.nth_child=l,a.nth_of_type=u,a}(e,a,o,l,h)),sc(_,function(e){if(!rh(e))return{};var t={};return sh(e.attributes,function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){var i=e.name.replace("data-ph-capture-attribute-",""),s=e.value;i&&s&&rm(s)&&(t[i]=s)}}),t}(e))}),b)return{props:{},explicitNoCapture:b};if(o||(f[0].$el_text=sZ(e,"a")||sZ(e,"button")?ry(e):s4(e)),m){f[0].attr__href=m;var w,x,k=null==(w=rq(m))?void 0:w.host,E=null==s||null==(x=s.location)?void 0:x.host;k&&E&&k!==E&&(g=m)}return{props:sc({$event_type:n.type,$ce_version:1},u?{}:{$elements:f},{$elements_chain:f.map(e=>{var t,i,s={text:null==(t=e.$el_text)?void 0:t.slice(0,400),tag_name:e.tag_name,href:null==(i=e.attr__href)?void 0:i.slice(0,2048),attr_class:function(e){var t=e.attr__class;if(t)return Y(t)?t:s2(t)}(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return sd(e).filter(e=>0===e[0].indexOf("attr__")).forEach(e=>s.attributes[e[0]]=e[1]),s}).map(e=>{var t,i,s="";if(e.tag_name&&(s+=e.tag_name),e.attr_class)for(var r of(e.attr_class.sort(),e.attr_class))s+="."+r.replace(/"/g,"");var n=y({},e.text?{text:e.text}:{},{"nth-child":null!=(t=e.nth_child)?t:0,"nth-of-type":null!=(i=e.nth_of_type)?i:0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),a={};return sd(n).sort((e,t)=>e[0].localeCompare(t[0])).forEach(e=>{var t=e[1];return a[rb(e[0].toString())]=rb(t.toString())}),(s+=":")+sd(a).map(e=>e[0]+'="'+e[1]+'"').join("")}).join(";")},null!=(i=f[0])&&i.$el_text?{$el_text:null==(r=f[0])?void 0:r.$el_text}:{},g&&"click"===n.type?{$external_click_url:g}:{},_)}}(i,{e:e,maskAllElementAttributes:n.maskAllElementAttributes,maskAllText:n.maskAllText,elementAttributeIgnoreList:n.element_attribute_ignorelist,elementsChainAsString:this.Yn,disableCaptureUrlHashes:n.disableCaptureUrlHashes}),u=l.props;if(l.explicitNoCapture)return!1;var h=this.getElementSelectors(i);if(h&&h.length>0&&(u.$element_selectors=h),t===aB){var c,d=s6(null==s||null==(c=s.get
1Selection())?void 0:c.toString()),p=e.type||"clipboard";if(!d)return!1;u.$selected_content=d,u.$copy_type=p}return null==(o=this.ns)||o.capture(t,u).catch(e=>az.error("Failed to capture event",e)),!0}}}isBrowserSupported(){return X(null==a?void 0:a.querySelectorAll)}}class aV{constructor(e){this._instance=e}refresh(e){var t=this._instance.config,i=K(t.autocapture)?t.autocapture:void 0;e.enabled=!!t.autocapture,e.rageclick=t.rageclick,e.maskAllElementAttributes=t.mask_all_element_attributes,e.maskAllText=t.mask_all_text,e.disableCaptureUrlHashes=t.disable_capture_url_hashes,e.getCurrentUrl=t.get_current_url,e.remoteRequestsDisabled=this._instance.ma(),e.url_allowlist=null==i?void 0:i.url_allowlist,e.url_ignorelist=null==i?void 0:i.url_ignorelist,e.dom_event_allowlist=null==i?void 0:i.dom_event_allowlist,e.element_allowlist=null==i?void 0:i.element_allowlist,e.css_selector_allowlist=null==i?void 0:i.css_selector_allowlist,e.css_selector_ignorelist=null==i?void 0:i.css_selector_ignorelist,e.element_attribute_ignorelist=null==i?void 0:i.element_attribute_ignorelist,e.capture_copied_text=null==i?void 0:i.capture_copied_text}}var aG=t4("[ExceptionAutocapture]"),aW=()=>{},aJ=t4("[TracingHeaders]"),aY=t4("[Web Vitals]"),aX="disabled",aK="lazy_loading",aQ="awaiting_config",aZ="missing_config";t4("[SessionRecording]"),t4("[SessionRecording]");var a0="[SessionRecording]",a1=t4(a0),a2=t4("[Heatmaps]");function a3(e){return K(e)&&"clientX"in e&&"clientY"in e&&er(e.clientX)&&er(e.clientY)}var a5=t4("[Product Tours]"),a6=e=>{var t;return!e.config.disable_product_tours&&!(null==(t=e.persistence)||!t.get_property(i_))},a4=["$set_once","$set"],a8=t4("[SiteApps]"),a9="Error while initializing PostHog app with config id ",a7=(e,t)=>null!=e&&e.then?e.then(t):t(e),oe="SDK is not enabled or survey functionality is not yet loaded",ot="Disabled. Not loading surveys.";class oi{constructor(e,t){this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Tl=!1,this.Ml=[],this.El=null,this.Il=null,this.Xn=!1,this.Rl=new Set,this.onRemoteConfig=e=>{if(!this.Xn&&!this.qi.disableSurveys){if(!e.ok)return ap.warn("Remote config unavailable. Not loading surveys.");var t=e.config.surveys;if(es(t))return ap.warn("Flags not loaded yet. Not loading surveys.");this.Pl=ea(t)?t:t.length>0,ap.info("flags response received, isSurveysEnabled: "+this.Pl),this.loadIfEnabled()}},this.ts=e,this.Al=t}setup(e){if(!this.Xn)return this.Fl=e,a7(e.kv.initialize(),()=>{if(this.Fl===e&&!this.Xn){this.Fl=void 0,this.ns=e;var t=e.onRemoteConfig(this.onRemoteConfig);this.Xn?t.dispose():(this.ss=t,this.loadIfEnabled())}})}dispose(){var e,t,i;this.Xn||(this.Xn=!0,this.Fl=void 0,this.ns=void 0,null==(e=this.ss)||e.dispose(),this.ss=void 0,null==(t=this._surveyEventReceiver)||t.dispose(),this._surveyEventReceiver=null,null==(i=this._surveyManager)||null==i.dispose||i.dispose(),this._surveyManager=null,this.Ml=[],this.El=null,this.Rl.forEach(e=>clearTimeout(e)),this.Rl.clear())}get qi(){return this.ts.get()}initialize(){this.loadIfEnabled()}reset(){try{var e;null==(e=this._surveyEventReceiver)||e.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var t=[],i=0;i<localStorage.length;i++){var s=localStorage.key(i);(null!=s&&s.startsWith(av)||null!=s&&s.startsWith("inProgressSurvey_"))&&t.push(s)}t.forEach(e=>localStorage.removeItem(e))}catch(e){}}loadIfEnabled(){if(!this.Xn&&this.ns){var e=this.qi;if(!this._surveyManager)if(this.Tl)ap.info("Already initializing surveys, skipping...");else if(e.disableSurveys)ap.info(ot);else if(e.cookielessMode&&this.ts.isOptedOut())ap.info("Not loading surveys in cookieless mode without consent.");else{var t=this.ts.getExtensions();if(t){if(!Z(this.Pl)||e.advancedEnableSurveys){var i=this.Pl||e.advancedEnableSurveys;this.Tl=!0;try{var s=t.generateSurveys;if(s)return this.Ol(s,i),void(this.Tl=!1);var r=t.loadExternalDependency;if(!r)return this.Ll(i8),void(this.Tl=!1);r(e=>{try{if(this.Xn)return;var t=this.ts.getExtensions();e||null==t||!t.generateSurveys?this.Ll("Could not load surveys script",e):this.Ol(t.generateSurveys,i)}finally{this.Tl=!1}})}catch(e){throw this.Tl=!1,this.Ll("Error initializing surveys",e),e}}}else ap.error("PostHog Extensions not found.")}}}Ol(e,t){this.Xn||(this._surveyManager=e(t),this._surveyEventReceiver=this.ts.createEventReceiver(),ap.info("Surveys loaded successfully"),this.$l({isLoaded:!0}))}Ll(e,t){ap.error(e,t),this.$l({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Ml.push(e),this._surveyManager&&this.$l({isLoaded:!0}),()=>{this.Ml=this.Ml.filter(t=>t!==e)}}getSurveys(e,t){void 0===t&&(t=!1);var i,s=null!=(i=this.ns)?i:this.Al;if(s&&!this.Xn){if(this.qi.disableSurveys)return ap.info(ot),e([]);var r=s.kv.get(iN);if(r&&!t)return e(r,{isLoaded:!0}
1),void(this.Dl()&&this.getSurveys(()=>{},!0));if(this.El)this.El.then(t=>{this.Xn||e(t.surveys,t.context)}).catch(e=>ap.error("Error in survey callback",e));else{var n=this.Nl("/api/surveys/",{method:"GET",query:{token:s.projectToken},sentAt:"query",timeoutMs:this.qi.requestTimeoutMs}).then(e=>{try{return this.ql(s,e)}catch(e){return ap.error("Error processing surveys response",e),this.ql(s,{statusCode:0,error:e})}},e=>this.ql(s,{statusCode:0,error:e}));this.El=n;var a=()=>{this.El===n&&(this.El=null)};n.then(t=>{a(),this.Xn||e(t.surveys,t.context)},a).catch(e=>ap.error("Error in survey callback",e))}}}Nl(e,t){var i=this.ns;return i?i.sendRequest(e,t):new Promise(e=>e({statusCode:0,error:Error(oe)}))}ql(e,t){if(this.Xn)return{surveys:[],context:{isLoaded:!1,error:oe}};var i=t.statusCode;if(200!==i||!t.json){var s="Surveys API could not be loaded, status: "+i;return 0!==i?ap.error(s):t.error||ap.warn(s),this.Il=Date.now(),{surveys:[],context:{isLoaded:!1,error:s}}}this.Il=null;var r,n=t.json.surveys||[],a=n.filter(e=>{var t;return!(!e.start_date||e.end_date)&&(ad(e)||!(null==(t=e.conditions)||null==(t=t.actions)||null==(t=t.values)||!t.length))});return a.length>0&&(null==(r=this._surveyEventReceiver)||r.register(a)),e.kv.set({[iN]:n,[ij]:Date.now()}),{surveys:n,context:{isLoaded:!0}}}Dl(){return this.jl()&&!this.El&&!this.Bl()}jl(){var e,t,i=null==(e=null!=(t=this.ns)?t:this.Al)?void 0:e.kv.get(ij);return er(i)&&Date.now()-i>3e5}Bl(){return er(this.Il)&&3e5>Date.now()-this.Il}markSurveyAsSeen(e,t){var i;ag({id:e,current_iteration:null!=(i=null==t?void 0:t.iteration)?i:null});try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(e){}}$l(e){for(var t of this.Ml)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){ap.error("Error in survey callback",e)}}getActiveMatchingSurveys(e,t){if(void 0===t&&(t=!1),!es(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);ap.warn("init was not called")}Hl(e){var t=null;return this.getSurveys(i=>{var s;t=null!=(s=i.find(t=>t.id===e))?s:null}),t}Ul(e){if(es(this._surveyManager))return{eligible:!1,reason:oe};var t="string"==typeof e?this.Hl(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}zl(e){if(es(this._surveyManager))return{eligible:!1,reason:oe};var t="string"==typeof e?this.Hl(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(es(this._surveyManager))return ap.warn("init was not called"),{visible:!1,disabledReason:oe};var t=this.zl(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return es(this._surveyManager)?(ap.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:oe})):new Promise(i=>{this.getSurveys(t=>{var s,r=null!=(s=t.find(t=>t.id===e))?s:null;if(r){var n=this.zl(r);i({visible:n.eligible,disabledReason:n.reason})}else i({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,i){var s;if(es(this._surveyManager))ap.warn("init was not called");else{var r="string"==typeof e?this.Hl(e):e;if(null!=r&&r.id)if(af.includes(r.type)){var n=null==a?void 0:a.querySelector(t);if(n)if(null!=(s=r.appearance)&&s.surveyPopupDelaySeconds){ap.info("Rendering survey "+r.id+" with delay of "+r.appearance.surveyPopupDelaySeconds+" seconds");var o=setTimeout(()=>{var e,t;this.Rl.delete(o),this.Xn||(ap.info("Rendering survey "+r.id+" with delay of "+(null==(e=r.appearance)?void 0:e.surveyPopupDelaySeconds)+" seconds"),null==(t=this._surveyManager)||t.renderSurvey(r,n,i),ap.info("Survey "+r.id+" rendered"))},1e3*r.appearance.surveyPopupDelaySeconds);this.Rl.add(o)}else this._surveyManager.renderSurvey(r,n,i);else ap.warn("Survey element not found")}else ap.warn("Surveys of type "+r.type+" cannot be rendered in the app");else ap.warn("Survey not found")}}displaySurvey(e,t){var i;if(es(this._surveyManager))ap.warn("init was not called");else{var s=this.Hl(e);if(s){var r=s;if(null!=(i=s.appearance)&&i.surveyPopupDelaySeconds&&t.ignoreDelay&&(r=y({},s,{appearance:y({},s.appearance,{surveyPopupDelaySeconds:0})}
1)),t.displayType!==ni.Popover&&t.initialResponses&&ap.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===t.ignoreConditions){var n=this.Ul(s);if(!n.eligible)return void ap.warn("Survey is not eligible to be displayed: ",n.reason)}t.displayType!==ni.Inline?this._surveyManager.handlePopoverSurvey(r,t):this.renderSurvey(r,t.selector,t.properties)}else ap.warn("Survey not found")}}cancelPendingSurvey(e){es(this._surveyManager)?ap.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;null==(e=this._surveyManager)||null==e.handlePageUnload||e.handlePageUnload()}}function os(e,t,i){if(es(e))return!1;switch(i){case"exact":return e===t;case"contains":return RegExp(t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*"),"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch(e){return!1}default:return!1}}class or{constructor(e){this.Wl=new Set,this.Vl=new Set,this.Gl=new n8,this.Zl=(e,t)=>this.Ql(e,t)&&this.Jl(e,t)&&this.Kl(e,t)&&this.Yl(e,t),this.Ql=(e,t)=>null==t||!t.event||(null==e?void 0:e.event)===(null==t?void 0:t.event),this._instance=e}init(){var e,t;Z(null==(e=this._instance)?void 0:e._addCaptureHook)||(this.Xl=null==(t=this._instance)?void 0:t._addCaptureHook((e,t)=>{this.on(e,t)}))}dispose(){var e;null==(e=this.Xl)||e.call(this),this.Xl=void 0,this.Gl=new n8}register(e){var t,i;if(!Z(null==(t=this._instance)?void 0:t._addCaptureHook)&&(e.forEach(e=>{var t;this.Wl.add(e),null==(t=e.steps)||t.forEach(e=>{this.Vl.add((null==e?void 0:e.event)||"")})}),null!=(i=this._instance)&&i.autocapture)){var s=new Set;this.Wl.forEach(e=>{var t;null==(t=e.steps)||t.forEach(e=>{null!=e&&e.selector&&s.add(e.selector)})}),this._instance.autocapture.setElementSelectors(s)}}replace(e){this.Wl.clear(),this.Vl.clear(),this.register(e)}on(e,t){null!=t&&0!=e.length&&(this.Vl.has(e)||this.Vl.has(t.event))&&this.Wl.forEach(e=>{this.tu(t,e)&&this.Gl.emit("actionCaptured",e.name)})}eu(e){this.onAction("actionCaptured",t=>e(t))}tu(e,t){if(null==(null==t?void 0:t.steps))return!1;for(var i of t.steps)if(this.Zl(e,i))return!0;return!1}onAction(e,t){return this.Gl.on(e,t)}Jl(e,t){if(null!=t&&t.url){var i,s=null==e||null==(i=e.properties)?void 0:i.$current_url;if(!s||"string"!=typeof s||!os(s,t.url,t.url_matching||"contains"))return!1}return!0}Kl(e,t){return!!this.iu(e,t)&&!!this.ru(e,t)&&!!this.nu(e,t)}iu(e,t){if(null==t||!t.href)return!0;var i=this.su(e);if(i.length>0)return i.some(e=>os(e.href,t.href,t.href_matching||"exact"));var s,r,n=(null==e||null==(s=e.properties)?void 0:s.$elements_chain)||"";return!!n&&os((r=n.match(/(?::|")href="(.*?)"/))?r[1]:"",t.href,t.href_matching||"exact")}ru(e,t){if(null==t||!t.text)return!0;var i=this.su(e);if(i.length>0)return i.some(e=>os(e.text,t.text,t.text_matching||"exact")||os(e.$el_text,t.text,t.text_matching||"exact"));var s,r,n,a,o=(null==e||null==(s=e.properties)?void 0:s.$elements_chain)||"";return!!o&&(r=function(e){for(var t,i=[],s=/(?::|")text="(.*?)"/g;!es(t=s.exec(e));)i.includes(t[1])||i.push(t[1]);return i}(o),n=t.text,a=t.text_matching||"exact",r.some(e=>os(e,n,a)))}nu(e,t){if(null==t||!t.selector)return!0;var i,s,r=null==e||null==(i=e.properties)?void 0:i.$element_selectors;if(null!=r&&r.includes(t.selector))return!0;var n=(null==e||null==(s=e.properties)?void 0:s.$elements_chain)||"";if(t.selector_regex&&n)try{return new RegExp(t.selector_regex).test(n)}catch(e){}return!1}su(e){var t;return null==(null==e||null==(t=e.properties)?void 0:t.$elements)?[]:null==e?void 0:e.properties.$elements}Yl(e,t){return null==t||!t.properties||0===t.properties.length||aa(t.properties.reduce((e,t)=>{var i=Y(t.value)?t.value.map(String):null!=t.value?[String(t.value)]:[];return e[t.key]={values:i,operator:t.operator||"exact"},e},{}),null==e?void 0:e.properties)}}class on{constructor(e){var t;this.au=[],this._instance=e,this.ou=new Map,this.lu=new Map,this.uu=new Map,this.hu=null==(t=this._instance)||null==t.onSessionId?void 0:t.onSessionId(e=>this.du(e))}vu(e){return!1}cu(){return null}fu(e){}pu(){}gu(e,t){return!!e&&aa(e.propertyFilters,null==t?void 0:t.properties)}mu(e,t){var i=new Map;
vendor: 4,415 bytes, line 1
1return e.forEach(e=>{var s;null==(s=e.conditions)||null==(s=s[t])||null==(s=s.values)||s.forEach(t=>{if(null!=t&&t.name){var s=i.get(t.name)||[];s.push(e.id),i.set(t.name,s)}})}),i}yu(e,t,i){var s=(i===r9.Activation?this.ou:this.lu).get(e),r=[];return this.bu(e=>{r=e.filter(e=>null==s?void 0:s.includes(e.id))}),r.filter(s=>{var r,n=null==(r=s.conditions)||null==(r=r[i])||null==(r=r.values)?void 0:r.find(t=>t.name===e);return this.gu(n,t)})}register(e){this._u(e,!1)}replace(e){this._u(e,!0)}_u(e,t){var i;Z(null==(i=this._instance)?void 0:i._addCaptureHook)||(this.wu(e,t),this.ku(e,t))}ku(e,t){var i,s=e.filter(e=>{var t;return null==(t=e.conditions)||null==(t=t.actions)||null==(t=t.values)?void 0:t.length});if(t&&this.uu.clear(),0!==s.length){this.Su||(this.Su=new or(this._instance),this.Su.init(),this.Su.eu(e=>this.onAction(e)));var r=[];s.forEach(e=>{var t;null==(t=e.conditions)||null==(t=t.actions)||t.values.forEach(t=>{if(r.push(t),t.name){var i,s=null!=(i=this.uu.get(t.name))?i:[];s.includes(e.id)||s.push(e.id),this.uu.set(t.name,s)}})}),t?this.Su.replace(r):this.Su.register(r)}else t&&(null==(i=this.Su)||i.replace([]))}xu(e,t){t.forEach((t,i)=>{var s,r=null!=(s=e.get(i))?s:[];t.forEach(e=>{r.includes(e)||r.push(e)}),e.set(i,r)})}wu(e,t){var i,s=e.filter(e=>{var t,i;return(null==(t=e.conditions)?void 0:t.events)&&(null==(i=e.conditions)||null==(i=i.events)||null==(i=i.values)?void 0:i.length)>0}),r=e.filter(e=>{var t,i;return(null==(t=e.conditions)?void 0:t.cancelEvents)&&(null==(i=e.conditions)||null==(i=i.cancelEvents)||null==(i=i.values)?void 0:i.length)>0}),n=this.mu(e,r9.Activation),a=this.mu(e,r9.Cancellation);t?(this.ou=n,this.lu=a):(this.xu(this.ou,n),this.xu(this.lu,a)),(0!==s.length||0!==r.length)&&(null!=this.Xl||(this.Xl=null==(i=this._instance)?void 0:i._addCaptureHook((e,t)=>{this.onEvent(e,t)})))}onEvent(e,t){var i,s,r=this.Cu(),n=(null==t||null==(i=t.properties)?void 0:i.$survey_id)||(null==t||null==(s=t.properties)?void 0:s.$product_tour_id);if(n&&this.getActivatedIds().includes(n)){var a=this.Tu(e,n);if("consume"===a)return r.info("event consumed activated item, removing it",{event:e,itemId:n}),void this.Mu([n]);if("persist"===a)return r.info("shown item promoted to persisted activation",{event:e,itemId:n}),this.Eu(n),void this.Iu([n])}if(this.lu.has(e)){var o=this.yu(e,t,r9.Cancellation);o.length>0&&(r.info("cancel event matched, cancelling items",{event:e,itemsToCancel:o.map(e=>e.id)}),this.Mu(o.map(e=>e.id)),o.forEach(e=>this.Ru(e.id)))}if(this.ou.has(e)){r.info("event name matched",{event:e,eventPayload:t,items:this.ou.get(e)});var l=this.yu(e,t,r9.Activation);this.Pu(l.map(e=>e.id))}}onAction(e){this.uu.has(e)&&this.Pu(this.uu.get(e)||[])}Pu(e){var t;if(0!==e.length){var i=!(null==(t=this._instance)||null==t.get_session_id||!t.get_session_id()),s=[];for(var r of e)i&&this.vu(r)?this.Eu(r)&&this.Au(r):s.push(r);s.length>0&&(this.au=[...new Set([...this.au,...s])]),this.Cu().info("updating activated items",{activatedItems:this.getActivatedIds()})}}Eu(e){this.au=this.au.filter(t=>t!==e);var t=this.Fu();return!t.includes(e)&&(this.Ou([...t,e]),this.Lu(),!0)}Mu(e){var t=new Set(e);this.au=this.au.filter(e=>!t.has(e));var i=this.$u(),s=i.filter(e=>!t.has(e));s.length!==i.length&&(this.Ou(s),0===s.length&&this.Du()),this.Iu(e)}Nu(){var e,t=this.cu();if(!t)return{};var i=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t];return i&&"object"==typeof i?i:{}}Au(e){if(this.cu()){var t=this.Nu();this.fu(y({},t,{[e]:Date.now()}))}}Iu(e){if(this.cu()){var t=this.Nu(),i={},s=!1;for(var r of Object.entries(t)){var n=r[0],a=r[1];e.includes(n)?s=!0:i[n]=a}s&&(Q(i)?this.pu():this.fu(i))}}qu(){this.cu()&&this.pu()}getActivationTimestamp(e){if(this.Fu().includes(e)){var t=this.Nu()[e];return er(t)?t:void 0}}$u(){var e,t=this.ju();return(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t])||[]}Fu(){var e,t,i=this.$u();if(0===i.length)return[];var s=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[this.Bu()],r=null==(t=this._instance)||null==t.get_session_id?void 0:t.get_session_id();return r&&s===r?i:[]}Lu(){var e,t=null==(e=this._instance)||null==e.get_session_id?void 0:e.get_session_id();t&&this.Hu(t)}Du(){this.Uu()}du(e){var t,i=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[this.Bu()];if(i&&i!==e){var s=this.$u(),r=this.Nu();s.length>0&&(this.Ou([]),s.filter(e=>
1er(r[e])).forEach(e=>this.Ru(e))),this.Du(),this.qu()}}getActivatedIds(){return[...new Set([...this.Fu(),...this.au])].filter(e=>!this.zu(e))}dispose(){var e,t,i;null==(e=this.hu)||e.call(this),this.hu=void 0,null==(t=this.Xl)||t.call(this),this.Xl=void 0,null==(i=this.Su)||i.dispose(),this.Su=void 0}reset(){this.au=[],this.$u().length>0&&this.Ou([]),this.Du(),this.qu()}getEventToItemsMap(){return this.ou}Wu(){return this.Su}}class oa extends on{constructor(e){super(e)}ju(){return iB}Bu(){return iz}cu(){return iH}fu(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({[iH]:e})}pu(){var e;null==(e=this._instance)||null==(e=e.persistence)||e.unregister(iH)}vu(e){this.bu(t=>{i=t.find(t=>t.id===e)});var t,i,s=null==(t=i)||null==(t=t.appearance)?void 0:t.surveyPopupDelaySeconds;return er(s)&&s>0}Vu(){return ne.SHOWN}bu(e){var t;null==(t=this._instance)||t.getSurveys(e)}Ru(e){var t;null==(t=this._instance)||t.cancelPendingSurvey(e)}Cu(){return ap}Ou(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({[iB]:e})}Hu(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({[iz]:e})}Uu(){var e;null==(e=this._instance)||null==(e=e.persistence)||e.unregister(iz)}zu(){return!1}Tu(e,t){var i,s,r;return this.bu(e=>{r=e.find(e=>e.id===t)}),!r||ad(i=r)&&!(null==(s=i.conditions)||null==(s=s.events)||!s.repeatedActivation)||"always"===i.schedule?e===ne.SHOWN?"consume":"ignore":e===ne.SHOWN?"persist":e===ne.DISMISSED||e===ne.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}class oo{constructor(e){this._instance=e}initialize(){}get(e){if("string"==typeof e)return this._instance.get_property(e);var t={};for(var i of e){var s=this._instance.get_property(i);Z(s)||(t[i]=s)}return t}set(e,t){this._instance.register("string"==typeof e?{[e]:t}:e)}remove(e){"string"!=typeof e?e.forEach(e=>this._instance.unregister(e)):this._instance.unregister(e)}}class ol{constructor(e){this._instance=e}get(){var e=this._instance.config;return{disableSurveys:e.disable_surveys,cookielessMode:!!e.cookieless_mode,advancedEnableSurveys:e.advanced_enable_surveys,requestTimeoutMs:e.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}getExtensions(){var e=null==g?void 0:g.__PosthogExtensions__;if(e){var t=e.generateSurveys,i=e.loadExternalDependency;return{generateSurveys:t?e=>t(this._instance,e):void 0,loadExternalDependency:i?e=>i(this._instance,"surveys",e):void 0}}}createEventReceiver(){return new oa(this._instance)}}var ou=null!=s&&s.location?rD(s.location.hash,"__posthog")||rD(location.hash,"state"):null,oh="_postHogToolbarParams",oc=t4("[Toolbar]"),od=t4("[FeatureFlags]");class op{constructor(e,t){void 0===t&&(t=!1),this.Gu=!1,this.update(e,t)}update(e,t){var i,s,r,n;this.Zu={bootstrap:{featureFlags:null==(i=e.bootstrap)?void 0:i.featureFlags,featureFlagPayloads:null==(s=e.bootstrap)?void 0:s.featureFlagPayloads},remoteRequestsDisabled:t,featureFlagsDisabled:!!e.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!e.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!e.advanced_feature_flags_dedup_per_session,cacheTtlMs:e.feature_flag_cache_ttl_ms,requestTimeoutMs:e.feature_flag_request_timeout_ms,compression:e.disable_compression?"none":"base64",evaluationContexts:null!=(r=null!=(n=e.evaluation_contexts)?n:e.evaluation_environments)?r:[],flagKeys:Y(e.flag_keys)?e.flag_keys:void 0},!e.evaluation_environments||e.evaluation_contexts||this.Gu||(od.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Gu=!0),Z(e.flag_keys)||Y(e.flag_keys)||od.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this.Zu}}var ov=t4("[FeatureFlags]"),og=t4("[FeatureFlags]",{debugEnabled:!0}),of="\" failed. Feature flags didn't load in time.",o_="connection_error",om=e=>{for(var t={},i=0;e.length>i;i++)t[e[i]]=!0;return t},oy=e=>{var t={};for(var i of sd(e||{})){var s=i[1];s&&(t[i[0]]=s)}return t},ob=t4("[Error tracking]"),ow=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:"],ox=["__firefox__","__gCrWeb"],ok="Refusing to render web experiment since the viewer is a likely bot",oE={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>-1===t.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>ai(t,e),not_regex:(e,t)=>!ai(t,e),exact:(e,t)=>
1t===e,is_not:(e,t)=>t!==e};class oS{get qi(){return this._instance.config}constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(e){void 0===e&&(e=!1),t.getWebExperiments(e=>{oS.Qu("retrieved web experiments from the server"),t.Ju=new Map,e.forEach(e=>{if(e.feature_flag_key){t.Ju&&(oS.Qu("setting flag key ",e.feature_flag_key," to web experiment ",e),null==(i=t.Ju)||i.set(e.feature_flag_key,e));var i,s=t._instance.getFeatureFlag(e.feature_flag_key);ee(s)&&e.variants[s]&&t.Ku(e.name,s,e.variants[s].transforms)}else if(e.variants)for(var r in e.variants){var n=e.variants[r];oS.Yu(n,t._instance)&&t.Ku(e.name,r,n.transforms)}})},e)},this._instance=e,this._instance.onFeatureFlags(e=>{this.onFeatureFlags(e)})}initialize(){}onFeatureFlags(e){if(this._is_bot())oS.Qu(ok);else if(!this.qi.disable_web_experiments){if(es(this.Ju))return this.Ju=new Map,this.loadIfEnabled(),void this.previewWebExperiment();oS.Qu("applying feature flags",e),e.forEach(e=>{var t;if(this.Ju&&null!=(t=this.Ju)&&t.has(e)){var i,s=this._instance.getFeatureFlag(e),r=null==(i=this.Ju)?void 0:i.get(e);s&&null!=r&&r.variants[s]&&this.Ku(r.name,s,r.variants[s].transforms)}})}}previewWebExperiment(){var e=oS.getWindowLocation();if(null!=e&&e.search){var t=rA(null==e?void 0:e.search,"__experiment_id"),i=rA(null==e?void 0:e.search,"__experiment_variant");t&&i&&(oS.Qu("previewing web experiments "+t+" && "+i),this.getWebExperiments(e=>{this.Xu(parseInt(t),i,e)},!1,!0))}}loadIfEnabled(){this.qi.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this.qi.disable_web_experiments&&!i)return e([]);var s=this._instance.get_property("$web_experiments");if(s&&!t)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.qi.token),method:"GET",timestampMode:"query",callback:t=>e(200===t.statusCode&&t.json&&t.json.experiments||[])})}Xu(e,t,i){var s=i.filter(t=>t.id===e);s&&s.length>0&&(oS.Qu("Previewing web experiment ["+s[0].name+"] with variant ["+t+"]"),this.Ku(s[0].name,t,s[0].variants[t].transforms))}static Yu(e,t){return!es(e.conditions)&&oS.th(e,t)&&oS.eh(e)}static th(e,t){if(es(e.conditions)||es(null==(s=e.conditions)?void 0:s.url))return!0;var i=oS.getWindowLocation();if(i){var s,r,n,a,o=sY(t,i.href);return null==(r=e.conditions)||!r.url||oE[null!=(n=null==(a=e.conditions)?void 0:a.urlMatchType)?n:"icontains"](e.conditions.url,o)}return!1}
1static getWindowLocation(){return null==s?void 0:s.location}static eh(e){if(es(e.conditions)||es(null==(i=e.conditions)?void 0:i.utm))return!0;var t=rG();if(t.utm_source){var i,s,r,n,a,o,l,u,h,c=null==(s=e.conditions)||null==(s=s.utm)||!s.utm_campaign||(null==(r=e.conditions)||null==(r=r.utm)?void 0:r.utm_campaign)==t.utm_campaign,d=null==(n=e.conditions)||null==(n=n.utm)||!n.utm_source||(null==(a=e.conditions)||null==(a=a.utm)?void 0:a.utm_source)==t.utm_source,p=null==(o=e.conditions)||null==(o=o.utm)||!o.utm_medium||(null==(l=e.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==t.utm_medium,v=null==(u=e.conditions)||null==(u=u.utm)||!u.utm_term||(null==(h=e.conditions)||null==(h=h.utm)?void 0:h.utm_term)==t.utm_term;return c&&p&&v&&d}return!1}static Qu(e){for(var t=arguments.length,i=Array(t>1?t-1:0),s=1;t>s;s++)i[s-1]=arguments[s];t6.info("[WebExperiments] "+e,i)}Ku(e,t,i){this._is_bot()?oS.Qu(ok):"control"!==t?i.forEach(i=>{if(i.selector){oS.Qu("applying transform of variant "+t+" for experiment "+e+" ",i);var s,r=null==(s=document)?void 0:s.querySelectorAll(i.selector);null==r||r.forEach(e=>{i.html&&(e.innerHTML=i.html),i.css&&e.setAttribute("style",i.css)})}}):oS.Qu("Control variants leave the page unmodified.")}_is_bot(){return n&&this._instance?ae(n,this.qi.custom_blocked_useragents):void 0}}var oP=t4("[Conversations]"),oI="Conversations not available yet.",oF="console",oT="__posthogHandledLogsRequestError",oO=(e,t)=>{var i=e instanceof Error?e:Error(t);return i[oT]=!0,i},o$=e=>!!e&&"object"==typeof e&&!0===e[oT],oC={featureFlags:class{constructor(e){this.name="featureFlags",this.ih=!1,this.featureFlagEventHandlers=[],this.I=ov,this.rh={},this.nh={},this.sh=[],this.ah=!1,this.oh=!1,this.lh=0,this.uh=!1,this.hh=!1,this.dh=!1,this.fh=!1,this.ph=0,this.Tt=()=>{var e=this.gh();this.ph=0,e&&this.reloadFeatureFlags()},"get"in e?this.ts=e:(this.mh=new op(e.config,e.ma()),this.ts=this.mh)}updateConfig(e,t){var i;null==(i=this.mh)||i.update(e,t)}setup(e){return this.Fl=e,this.I=e.logger.createLogger("[FeatureFlags]"),a7(e.kv.initialize(),()=>{this.Fl===e&&(this.Fl=void 0,this.ns=e,this.yh(e))})}yh(e){if(this.ns===e)return s&&s_(s,"online",this.Tt),this.bh=e.registerDynamicEventProperties(()=>this._h()?this.rh:this.nh),this.wh(),this.initialize()}destroy(){null==s||s.removeEventListener("online",this.Tt)}dispose(){var e;this.lh++,this.hh=!1,this.Fl=void 0,this.ns&&(this.kh(),null==(e=this.bh)||e.dispose(),this.bh=void 0,this.sh=[],null==s||s.removeEventListener("online",this.Tt),this.ns=void 0)}get qi(){return this.ts.get()}Sh(e){var t;return null==(t=this.ns)?void 0:t.kv.get(e)}Nr(e){this.xh(()=>{var t;return null==(t=this.ns)?void 0:t.kv.set(e)})}qr(e){this.xh(()=>{var t;return null==(t=this.ns)?void 0:t.kv.remove(e)})}xh(e){try{e()}catch(e){this.I.error("Failed to update feature flag persistence",e)}}wh(){var e={};for(var t of[iF,i$,iC,iM]){var i=this.Sh(t);Z(i)||(e[t]=i)}this.rh=e;var s=y({},e),r=this.Sh(iI);if(r)for(var n of Object.entries(r))s["$feature/"+n[0]]=n[1];this.nh=s}_h(){var e=this.qi.cacheTtlMs;if(!e||0>=e)return!1;var t=this.Sh(iJ);return"number"!=typeof t||Date.now()-t>e}Ch(){return!!this._h()&&(this.fh||this.oh||(this.fh=!0,this.I.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Th(){var e=this.qi.evaluationContexts;return null!=e&&e.length?e.filter(e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||this.I.error("Invalid evaluation context found:",e,"Expected non-empty string"),t}):[]}Mh(){var e=this.qi.flagKeys;if(!Z(e))return e.filter(e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||this.I.error("Invalid flag key found:",e,"Expected non-empty string"),t})}initialize(){var e,t,i=this.qi,s=null!=(e=null==(t=i.bootstrap)?void 0:t.featureFlags)?e:{};if(Object.keys(s).length){var r,n,a=null!=(r=null==(n=i.bootstrap)?void 0:n.featureFlagPayloads)?r:{},o=Object.keys(s).filter(e=>!!s[e]).reduce((e,t)=>(e[t]=s[t]||!1,e),{}),l=Object.keys(a).filter(e=>o[e]).reduce((e,t)=>(e[t]=a[t],e),{});return this.Eh({featureFlags:o,featureFlagPayloads:l})}}updateFlags(e,t,i){var s,r,n=null!=i&&i.merge&&null!=(s=this.Sh(iI))?s:{},a=null!=i&&i.merge&&null!=(r=this.Sh(i$))?r:{},o=y({},n,e),l=y({},a,t),u={};for(var h of Object.entries(o)){var c=h[0],d=h[1];u[c]={key:c,enabled:x(d),variant:k(d),reason:void 0,metadata:Z(null==l?void 0:l[c])?void 0:{id:0,version:void 0,description:void 0,payload:l[c]}}}this.Eh({flags:u})}get hasLoadedFlags(){return this.ah}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this.Sh(iO),t=this.Sh(iM),i=this.Sh(iq);if(!i&&!t)return e||{};var s=sc({},e||{});for(var r of[...new Set([...Object.keys(i||{}),...Object.keys(t||{}
1)])]){var n,a,o=s[r],l=null==t?void 0:t[r],u=Z(l)?null!=(n=null==o?void 0:o.enabled)&&n:!!l,h=Z(l)?null==o?void 0:o.variant:"string"==typeof l?l:void 0,c=null==i?void 0:i[r],d=y({},o,{enabled:u,variant:u?null!=h?h:null==o?void 0:o.variant:void 0});u!==(null==o?void 0:o.enabled)&&(d.original_enabled=null==o?void 0:o.enabled),h!==(null==o?void 0:o.variant)&&(d.original_variant=null==o?void 0:o.variant),c&&(d.metadata=y({},null==o?void 0:o.metadata,{payload:c,original_payload:null==o||null==(a=o.metadata)?void 0:a.payload})),s[r]=d}return this.ih||(this.I.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:s}),this.ih=!0),s}getAllFeatureFlags(){var e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map(i=>{var s=e[i];return{key:i,enabled:x(s),variant:k(s),payload:w(t[i])}})}getFlagVariants(){var e=this.Sh(iI),t=this.Sh(iM);if(!t)return e||{};for(var i=sc({},e||{}),s=Object.keys(t),r=0;s.length>r;r++)i[s[r]]=t[s[r]];return this.ih||(this.I.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this.ih=!0),i}getFlagPayloads(){var e=this.Sh(i$),t=this.Sh(iq);if(!t)return e||{};for(var i=sc({},e||{}),s=Object.keys(t),r=0;s.length>r;r++)i[s[r]]=t[s[r]];return this.ih||(this.I.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this.ih=!0),i}reloadFeatureFlags(){this.uh||this.qi.featureFlagsDisabled||this.gh()||this.Ih||(this.sh.slice().forEach(e=>{try{e()}catch(e){this.I.error("Error while running feature flags reloading callback",e)}}),this.Ih=setTimeout(()=>{this.Rh()},5))}kh(){clearTimeout(this.Ih),this.Ih=void 0}onReloading(e){return this.sh.push(e),()=>{this.sh=this.sh.filter(t=>t!==e)}}ensureFlagsLoaded(){this.ah||this.oh||this.Ih||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.uh=e}resetFlagCallReported(){this.qr(iV)}Rh(e){this.kh();var t=this.ns;if(t&&!this.qi.remoteRequestsDisabled&&!this.gh())if(this.oh)this.hh=!0;else{var i={token:t.projectToken,distinct_id:t.distinctId,groups:t.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:y({},t.initialPersonProperties,this.Sh(iA)||{},{$lib:t.library.name,$lib_version:t.library.version}),group_properties:this.Sh(iL),timezone:r0()};Z(t.deviceId)||(i.$device_id=t.deviceId),(null!=e&&e.disableFlags||this.qi.featureFlagsDisabled)&&(i.disable_flags=!0);var s=this.Th();s.length&&(i.evaluation_contexts=s);var r=this.Mh();Z(r)||(i.flag_keys=r);var n=this.qi.onlyEvaluateSurveyFeatureFlags,a=this.lh;this.oh=!0;var o=()=>{this.hh&&(this.hh=!1,this.Rh())},l=e=>{this.oh=!1,a===this.lh&&(this.Nr({[iW]:[o_]}),this.I.error("Feature flag request failed",e)),o()};try{t.sendRequest("/flags/?v=2"+(n?"&only_evaluate_survey_feature_flags=true":""),{target:"flags",method:"POST",body:i,compression:"base64"===this.qi.compression?r8.Base64:void 0,sentAt:"body",timeoutMs:this.qi.requestTimeoutMs}).then(e=>{var t,s,r=null!=(t=e.json)?t:{},l=200!==e.statusCode;if(this.oh=!1,a===this.lh){if(this.Ph(e.statusCode),l||this.hh||(this.$anon_distinct_id=void 0),!i.disable_flags||this.hh){this.dh=!l;var u=[];e.error?u.push(e.error instanceof Error&&"AbortError"===e.error.name?"timeout":e.error instanceof Error?o_:"unknown_error"):200!==e.statusCode&&u.push("api_error_"+e.statusCode),r.errorsWhileComputingFlags&&u.push("errors_while_computing_flags");var h=!(null==(s=r.quotaLimited)||!s.includes("feature_flags"));h&&u.push("quota_limited"),this.Nr({[iW]:u}),h?this.I.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."):i.disable_flags||this.Eh(r,l,{partialResponse:n}),o()}}else o()}).catch(l)}catch(e){l(e)}}}gh(){return rN(this.ph,3)}Ph(e){this.ph=rj(e,this.ph,3,()=>this.I.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes."))}getFeatureFlag(e,t){var i;if(void 0===t&&(t={}
1),!t.fresh||this.dh)if(this.ah||this.getFlags()&&this.getFlags().length>0){if(!this.Ch()){var s=this.getFeatureFlagResult(e,t);return null!=(i=null==s?void 0:s.variant)?i:null==s?void 0:s.enabled}}else this.I.warn('getFeatureFlag for key "'+e+of)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return null==t?void 0:t.payload}getFeatureFlagResult(e,t){if(void 0===t&&(t={}),!t.fresh||this.dh)if(this.ah||this.getFlags()&&this.getFlags().length>0){if(!this.Ch()){var i,s=this.getFlagVariants(),r=e in s,n=s[e],a=this.getFlagPayloads()[e],o=String(n),l=this.Sh(iC)||void 0,u=this.Sh(iJ)||void 0,h=this.Sh(iV)||{};if(this.qi.deduplicateCallsPerSession){var c,d=null==(c=this.ns)?void 0:c.session.sessionId,p=this.Sh(iG);d&&d!==p&&(h={},i=d)}if(!t.send_event&&"send_event"in t)i&&this.Nr({[iV]:h,[iG]:i});else if(e in h&&h[e].includes(o))i&&this.Nr({[iV]:h,[iG]:i});else{Y(h[e])?h[e].push(o):h[e]=[o],this.Nr(y({[iV]:h},i?{[iG]:i}:{}));var v=this.getFeatureFlagDetails(e),g=[...null!=(_=this.Sh(iW))?_:[]];Z(n)&&g.push("flag_missing");var f={$feature_flag:e,$feature_flag_response:n,$feature_flag_payload:null!=a?a:null,$feature_flag_request_id:l,$feature_flag_evaluated_at:u,$feature_flag_bootstrapped_response:null!=(m=null==(b=this.qi.bootstrap)||null==(b=b.featureFlags)?void 0:b[e])?m:null,$feature_flag_bootstrapped_payload:null!=(x=null==(k=this.qi.bootstrap)||null==(k=k.featureFlagPayloads)?void 0:k[e])?x:null,$used_bootstrap_value:!this.dh};Z(null==v||null==(E=v.metadata)?void 0:E.has_experiment)||(f.$feature_flag_has_experiment=v.metadata.has_experiment),Z(null==v||null==(S=v.metadata)?void 0:S.version)||(f.$feature_flag_version=v.metadata.version);var _,m,b,x,k,E,S,P,I,F,T,O,$,C=null!=(P=null==v||null==(I=v.reason)?void 0:I.description)?P:null==v||null==(F=v.reason)?void 0:F.code;C&&(f.$feature_flag_reason=C),null!=v&&null!=(T=v.metadata)&&T.id&&(f.$feature_flag_id=v.metadata.id),Z(null==v?void 0:v.original_variant)&&Z(null==v?void 0:v.original_enabled)||(f.$feature_flag_original_response=Z(v.original_variant)?v.original_enabled:v.original_variant),null!=v&&null!=(O=v.metadata)&&O.original_payload&&(f.$feature_flag_original_payload=null==v||null==($=v.metadata)?void 0:$.original_payload),g.length&&(f.$feature_flag_error=g.join(",")),this.Ah(f)}if(r)return{key:e,enabled:!!n,variant:"string"==typeof n?n:void 0,payload:w(a)}}}else this.I.warn('getFeatureFlagResult for key "'+e+of)}Ah(e){try{var t;null==(t=this.ns)||t.capture("$feature_flag_called",e).catch(e=>{this.I.error("Failed to capture feature flag call",e)})}catch(e){this.I.error("Failed to capture feature flag call",e)}}getRemoteConfigPayload(e,t){this.Fh(e,t)}Fh(e,t){var i=this;return m(function*(){var s=i.ns;if(s){var r={distinct_id:s.distinctId,token:s.projectToken,person_properties:{$lib:s.library.name,$lib_version:s.library.version}},n=i.Th();n.length&&(r.evaluation_contexts=n);var a,o=i.Mh();Z(o)||(r.flag_keys=o);try{var l,u=null==(l=(yield s.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:r,compression:"base64"===i.qi.compression?r8.Base64:void 0,sentAt:"body",timeoutMs:i.qi.requestTimeoutMs})).json)?void 0:l.featureFlagPayloads;a=(null==u?void 0:u[e])||void 0}catch(e){return void i.I.error("Remote config feature flag request failed",e)}try{t(a)}catch(e){i.I.error("Remote config feature flag callback failed",e)}}})()}isFeatureEnabled(e,t){if(void 0===t&&(t={}),t.fresh&&!this.dh)return t.defaultValue;if(!(this.ah||this.getFlags()&&this.getFlags().length>0))return this.I.warn('isFeatureEnabled for key "'+e+of),t.defaultValue;var i=this.getFeatureFlag(e,t);return Z(i)?t.defaultValue:!!i}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t,i){this.Eh(e,t,i)}Eh(e,t,i){if(this.ns){this.ah=!0;var s=function(e,t,i,s,r,n){void 0===t&&(t={}),void 0===i&&(i={}),void 0===s&&(s={}),void 0===n&&(n=ov);var a,o,l=(a=n,(o=e.flags)?y({},e,{featureFlags:Object.fromEntries(Object.keys(o).map(e=>{var t;return[e,null!=(t=o[e].variant)?t:o[e].enabled]})),featureFlagPayloads:Object.fromEntries(Object.keys(o).filter(e=>o[e].enabled).filter(e=>{var t;return null==(t=o[e].metadata)?void 0:t.payload}).map(e=>{var t;return[e,null==(t=o[e].metadata)?void 0:t.payload]}))}):(e.featureFlags&&a.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e)),u=l.flags,h=l.featureFlags,c=l.featureFlagPayloads;if(h){var d=e.requestId,p=e.evaluatedAt;if(Y(h)){n.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var v={};if(h)for(var g=0;h.length>g;g++)v[h[g]]=!0;return{[iF]:h,[iI]:v,[iR]:!1}}var f=h,_=c,m=u;if(null!=r&&r.partialResponse)f=y({},t,f),_=y({},i,_),m=y({},s,m);else if(e.errorsWhileComputingFlags)if(u){var b=new Set(Object.keys(u).filter(e=>{var t;return!(null!=(t=u[e])&&t.failed)}));f=y({},t,Object.fromEntries(Object.entries(f).filter(e=>b.has(e[0])))),_=y({},i,Object.fromEntries(Object.entries(_||{}).filter(e=>b.has(e[0])))),m=y({},s,Object.fromEntries(Object.entries(m||{}).filter(e=>b.has(e[0]))))}else f=y({},t,f),_=y({},i,_),m=y({},s,m);return y({[iF]:Object.keys(oy(f)),[iI]:f||{},[i$]:_||{},[iO]:m||{},[iR]:!0===e.minimalFlagCalledEvents},d?{[iC]:d}:{},p?{[iJ]:p}:{})}}(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),i,this.I);s&&this.Nr(s),t||(this.fh=!1),this.Oh(t)}}override(e,t){void 0===t&&(t=!1),this.I.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){this.Lh(e)}Lh(e){if(this.ns){if(!1===e)return this.qr([iM,iq]),this.Oh(),void og.info("All overrides cleared");if(Y(e))return this.Nr({[iM]:om(e)}),this.Oh(),void og.info("Flag overrides set",{flags:e});if(e&&"object"==typeof e&&("flags"in e||"payloads"in e)){this.ih=!!(null!=(t=e.suppressWarning)&&t);var t,i={},s=e.flags,r=e.payloads;return s&&(i[iM]=Y(s)?om(s):s),r&&(i[iq]=r),Object.keys(i).length&&this.Nr(i),!1===s&&!1===r?this.qr([iM,iq]):!1===s?this.qr(iM):!1===r&&this.qr(iq),this.Oh(),!1===s?og.info("Flag overrides cleared"):s&&og.info("Flag overrides set",{flags:s}),void(!1===r?og.info("Payload overrides cleared"):r&&og.info("Payload overrides set",{payloads:r}))}if(e&&"object"==typeof e)return this.Nr({[iM]:e}),this.Oh(),void og.info("Flag overrides set",{flags:e});this.I.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}else this.I.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.ah){var t=this.$h(),i=t.flags,s=t.flagVariants;try{e(i,s)}catch(e){this.I.error("Error while running feature flags callback",e)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var s,r=(this.Sh(iT)||[]).find(t=>t.flagKey===e),n={["$feature_enrollment/"+e]:t},a={$feature_flag:e,$feature_enrollment:t,$set:n};r&&(a.$early_access_feature_name=r.name),i&&(a.$feature_enrollment_stage=i);var o=y({},this.getFlagVariants(),{[e]:t});this.Nr({[iF]:Object.keys(oy(o)),[iI]:o,[iA]:y({},this.Sh(iA)||{},n)}),this.Oh();try{null==(s=this.ns)||s.capture("$feature_enrollment_update",a).catch(e=>{this.I.error("Failed to capture early access feature enrollment",e)})}catch(e){this.I.error("Failed to capture early access feature enrollment",e)}}getEarlyAccessFeatures(e,t,i){void 0===t&&(t=!1);var s=this.Sh(iT);!s||t?this.Dh(e,i):e(s)}Dh(e,t){var i=this;return m(function*(){var s=i.ns;if(s){var r,n=t?"&"+t.map(e=>"stage="+e).join("&"):"";try{var a=yield s.sendRequest("/api/early_access_features/?token="+s.projectToken+n,{target:"api",method:"GET",sentAt:"query"});if(!a.json)return;i.Nr({[iT]:r=a.json.earlyAccessFeatures})}catch(e){return void i.I.error("Early access feature request failed",e)}try{e(r)}catch(e){i.I.error("Early access feature callback failed",e)}}})()}$h(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(e=>t[e]),flagVariants:Object.keys(t).filter(e=>t[e]).reduce((e,i)=>(e[i]=t[i],e),{})}}Oh(e){this.wh();var t=this.$h(),i=t.flags,s=t.flagVariants;
1this.featureFlagEventHandlers.forEach(t=>{try{t(i,s,{errorsLoading:e})}catch(e){this.I.error("Error while running feature flags callback",e)}})}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0),this.Nh(e,t)}Nh(e,t){void 0===t&&(t=!0);var i=this.Sh(iA)||{},s=(null==e?void 0:e.$set)||(null!=e&&e.$set_once?{}:e),r=null==e?void 0:e.$set_once,n={};if(r)for(var a in r)({}).hasOwnProperty.call(r,a)&&(a in i||(n[a]=r[a]));this.Nr({[iA]:y({},i,n,s)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=y({},this.Sh(iA)||{});e.forEach(e=>{delete i[e]}),this.Nr({[iA]:i}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e){void 0===e&&(e=!0),this.qr(iA),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=this.Sh(iL)||{},s=y({},i);for(var r of Object.keys(e))s[r]=y({},i[r],e[r]);this.Nr({[iL]:s}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.Sh(iL)||{};this.Nr({[iL]:y({},t,{[e]:{}})})}else this.qr(iL)}reset(){this.lh++,this.hh=!1,this.rh={},this.nh={},this.ah=!1,this.uh=!1,this.dh=!1,this.$anon_distinct_id=void 0,this.kh(),this.ih=!1,this.ph=0}}},oR=y({productTours:class{get za(){return this._instance.persistence}constructor(e){this.Yd=null,this.Xd=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(e.ok){var t,i,s=e.config;if("productTours"in s){if(this.za&&this.za.register({[i_]:!!s.productTours}),!a6(this._instance))return!this.Yd&&es(null==(t=this.za)?void 0:t.props[iU])||a5.info("product tours disabled; stopping and clearing cached tours"),null==(i=this.Yd)||i.stop(),this.Yd=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.Yd&&a6(this._instance)&&this._s(()=>this.tv())}_s(e){var t,i;null!=(t=g.__PosthogExtensions__)&&t.generateProductTours?e():null==(i=g.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"product-tours",t=>{t?a5.error("Could not load product tours script",t):e()})}tv(){var e;!this.Yd&&null!=(e=g.__PosthogExtensions__)&&e.generateProductTours&&(this.Yd=g.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(void 0===t&&(t=!1),!Y(this.Xd)||t){var i=this.za;if(i){var s=i.props[iU];if(Y(s)&&!t)return this.Xd=s,void e(s,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",timestampMode:"query",callback:t=>{if(a6(this._instance)){var s=t.statusCode;if(200!==s||!t.json){var r="Product Tours API could not be loaded, status: "+s;return 0===s?t.error||a5.warn(r):a5.error(r),void e([],{isLoaded:!1,error:r})}var n=Y(t.json.product_tours)?t.json.product_tours:[];this.Xd=n,i&&i.register({[iU]:n}),e(n,{isLoaded:!0})}else e([],{isLoaded:!0})}})}else e(this.Xd,{isLoaded:!0})}getActiveProductTours(e){es(this.Yd)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.Yd.getActiveProductTours(e)}showProductTour(e){var t;null==(t=this.Yd)||t.showTourById(e)}previewTour(e){this.Yd?this.Yd.previewTour(e):this._s(()=>{var t;this.tv(),null==(t=this.Yd)||t.previewTour(e)})}dismissProductTour(){var e;null==(e=this.Yd)||e.dismissTour("user_clicked_skip")}nextStep(){var e;null==(e=this.Yd)||e.nextStep()}previousStep(){var e;null==(e=this.Yd)||e.previousStep()}clearCache(){var e;this.Xd=null,null==(e=this.za)||e.unregister(iU)}resetTour(e){var t;null==(t=this.Yd)||t.resetTour(e)}resetAllTours(){var e;null==(e=this.Yd)||e.resetAllTours()}cancelPendingTour(e){var t;null==(t=this.Yd)||t.cancelPendingTour(e)}}},oC),oM=y({surveys:class extends oi{constructor(e){var t;super(new ol(e),{get projectToken(){return t.config.token},kv:new oo(t=e)}),this._instance=e}Nl(e,t){var i=t.query?nU(e,t.query):e;return new Promise(e=>{var s;this._instance._send_request({method:t.method,url:this._instance.requestRouter.endpointFor(null!=(s=t.target)?s:"api",i),data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,timestampMode:t.sentAt,callback:e})})}}},oC),oq=y({experiments:oS},oC),oA=y({},oC,{sessionRecording:class{get qi(){return this._instance.config}get za(){return this._instance.persistence}get started(){var e;return!(null==(e=this.qh)||!e.isStarted)}get status(){var e,t;return this.jh===aQ||this.jh===aZ?this.jh:null!=(e=null==(t=this.qh)?void 0:t.status)?e:this.jh}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.jh=aX,this.Bh=void 0,this.Hh=!1,this.kt=(()=>
1{if(null==a||!a.visibilityState||"visible"===a.visibilityState)return!0;var e,t=null==s||null==(e=s.performance)||null==e.getEntriesByType?void 0:e.getEntriesByType("visibility-state");return!(null!=t&&t.length)||t.some(e=>"visible"===e.name)})(),this.It=()=>{var e;"visible"===(null==a?void 0:a.visibilityState)&&(this.kt=!0,null==(e=this.qh)||null==e.setDocumentWasEverVisible||e.setDocumentWasEverVisible(!0))},this._instance=e,!this._instance.sessionManager)throw a1.error("started without valid sessionManager"),Error(a0+" started without valid sessionManager. This is a bug.");if(this.qi.cookieless_mode===i7)throw Error(a0+' cannot be used with cookieless_mode="always"');null!=a&&a.addEventListener&&s_(a,"visibilitychange",this.It)}initialize(){this.startIfEnabledOrStop()}dispose(){this.Hh=!0,null==a||null==a.removeEventListener||a.removeEventListener("visibilitychange",this.It),this.stopRecording()}get Uh(){var e,t=!(null==(e=this._instance.get_property(iy))||!e.enabled),i=!this.qi.disable_session_recording,r=this.qi.disable_session_recording||this._instance.consent.isOptedOut();return s&&t&&i&&!r}startIfEnabledOrStop(e){var t;if(!(this.Hh||this.Uh&&null!=(t=this.qh)&&t.isStarted)){var i=!Z(Object.assign)&&!Z(Array.from);this.Uh&&i?(this.zh(e),a1.info("starting")):(this.jh=aX,this.stopRecording())}}zh(e){var t,i,s;this.Uh&&(this.jh!==aQ&&this.jh!==aZ&&(this.jh=aK),null!=g&&null!=(t=g.__PosthogExtensions__)&&null!=(t=t.rrweb)&&t.record&&null!=(i=g.__PosthogExtensions__)&&i.initSessionRecording?this.Wh(e):null==(s=g.__PosthogExtensions__)||null==s.loadExternalDependency||s.loadExternalDependency(this._instance,this.Vh,t=>{if(t)return this._instance.register_for_session({[i4]:!0}),a1.error("could not load recorder",t);this.Wh(e)}))}stopRecording(){var e,t;null==(e=this.Bh)||e.call(this),this.Bh=void 0,null==(t=this.qh)||t.stop()}Gh(){var e,t;null==(e=this.Bh)||e.call(this),this.Bh=void 0,null==(t=this.qh)||t.discard()}Zh(){var e,t;null==(e=this.za)||e.unregister(iP),null==(t=this.za)||t.unregister(ib)}Qh(e,t){if(es(e))return null;var i=er(e)?e:parseFloat(e);return"number"!=typeof i||!Number.isFinite(i)||0>i||i>1?(a1.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):i}Jh(e){if(this.za){var t,i,s=this.za,r=()=>{var t,i=!1===e.sessionRecording?void 0:e.sessionRecording,r=this.Qh(null==(t=this.qi.session_recording)?void 0:t.sampleRate,"session_recording.sampleRate"),n=this.Qh(null==i?void 0:i.sampleRate,"remote config sampleRate"),a=null!=r?r:n;es(a)&&this.Zh();var o=null==i?void 0:i.minimumDurationMilliseconds;s.register({[iy]:y({cache_timestamp:Date.now(),enabled:!!i},i,{networkPayloadCapture:y({capturePerformance:e.capturePerformance},null==i?void 0:i.networkPayloadCapture),canvasRecording:{enabled:null==i?void 0:i.recordCanvas,fps:null==i?void 0:i.canvasFps,quality:null==i?void 0:i.canvasQuality},sampleRate:a,minimumDurationMilliseconds:Z(o)?null:o,endpoint:null==i?void 0:i.endpoint,triggerMatchType:null==i?void 0:i.triggerMatchType,masking:null==i?void 0:i.masking,urlTriggers:null==i?void 0:i.urlTriggers,version:null==i?void 0:i.version,triggerGroups:null==i?void 0:i.triggerGroups})})};r(),null==(t=this.Bh)||t.call(this),this.Bh=null==(i=this._instance.sessionManager)?void 0:i.onSessionId(r)}}onRemoteConfig(e){var t=e.ok?e.config:void 0;return t&&"sessionRecording"in t?!1===t.sessionRecording?(this.Jh(t),void this.Gh()):(this.Jh(t),void this.startIfEnabledOrStop()):(this.jh===aQ&&(this.jh=aZ,a1.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t){var i;void 0===t&&(t="log"),null!=(i=this.qh)&&i.log?this.qh.log(e,t):a1.warn("log called before recorder was ready")}get Vh(){var e,t,i=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.get_property(iy);return(null==i||null==(t=i.scriptConfig)?void 0:t.script)||"lazy-recorder"}Kh(){var e,t=this._instance.get_property(iy);if(!t)return!1;try{e="object"==typeof t?t:JSON.parse(t)}catch(e){return a1.warn("persisted remote config for session recording is invalid and will be ignored",e),!1}return!es(e.cache_timestamp)&&36e5>=Date.now()-e.cache_timestamp}Wh(e){var t,i,s,r;if(!this.Hh){if(null==(t=g.__PosthogExtensions__)||!t.initSessionRecording)return a1.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[i4]:!0});if(this.qh||(this.qh=null==(r=g.__PosthogExtensions__)?void 0:r.initSessionRecording(this._instance,this.kt),this.qh._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Kh()){if(this.jh===aZ||this.jh===aQ)return;return this.jh=aQ,a1.info("persisted remote config is stale, requesting fresh config before starting"),void new nl(this._instance).load()}this.jh=aK,null==(i=(s=this.qh).setDocumentWasEverVisible)||i.call(s,this.kt),this.qh.start(e)}}onRRwebEmit(e){var t;null==(t=this.qh)||null==t.onRRwebEmit||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.qh||null==(t=this.za)||t.register({[ix]:!0}),null==(e=this.qh)||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.qh||null==(t=this.za)||t.register({[iw]:!0}),null==(e=this.qh)||e.overrideSampling()}overrideTrigger(e){var t,i;this.qh||null==(i=this.za)||i.register({["url"===e?ik:iE]:!0}),null==(t=this.qh)||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return(null==(e=this.qh)?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var i;return!(null==(i=this.qh)||!i.tryAddCustomEvent(e,t))}}},{autocapture:class extends aU{constructor(e){super(new aV(e)),this.instance=e}},historyAutocapture:class{constructor(e){this._instance=e,this.Yh=this.Xh()}initialize(){this.startIfEnabled()}get isEnabled(){var e=this.td();return!!(e.path||e.search||this.ed(e))}startIfEnabled(){this.isEnabled&&(t6.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.Yh=this.Xh(),this.startIfEnabled()}stop(){this.rd&&this.rd(),this.rd=void 0,this.nd&&this.nd(),this.nd=void 0,t6.info("History API monitoring stopped")}monitorHistoryChanges(){s&&s.history&&(this.sd("pushState"),this.sd("replaceState"),this.ad(),this.ed()&&this.od())}sd(e){var t;if(s&&(null==(t=s.history[e])||!t.__posthog_wrapped__)){var i=this;!function(e,t,i){try{if(!(t in e))return aW;var s={next:e[t]},r=i(function(){for(var e=arguments.length,t=Array(e),i=0;e>i;i++)t[i]=arguments[i];return s.next.apply(this,t)});X(r)&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:s}})),e[t]=r,()=>{if(e[t]!==r)for(var i=e[t];X(i)&&i.__posthog_layer__;){var n=i.__posthog_layer__;if(n.next===r)return void(n.next=s.next);i=n.next}else e[t]=s.next}}catch(e){return aW}}(s.history,e,t=>
vendor: 4,393 bytes, line 1
1function(s,r,n){t.call(this,s,r,n),i.ld(e)})}}Xh(){var e=null==s?void 0:s.location;if(null!=e&&e.pathname)return{pathname:e.pathname,search:e.search,hash:e.hash}}td(){var e=this._instance.config.capture_pageview;return"history_change"===e?{path:!0}:K(e)?e:{}}ed(e){return void 0===e&&(e=this.td()),!!e.hash&&!this._instance.config.disable_capture_url_hashes}ud(e){var t=this.td(),i=this.Yh;return!(!i||!(t.path&&e.pathname!==i.pathname||t.search&&e.search!==i.search||this.ed(t)&&e.hash!==i.hash))}ld(e){try{var t=this.Xh();if(!t)return;this.ud(t)&&this._instance.capture(sn,{navigation_type:e}),this.Yh=t}catch(t){t6.error("Error capturing "+e+" pageview",t)}}ad(){if(!this.rd){var e=()=>{this.ld("popstate")};s_(s,"popstate",e),this.rd=()=>{s&&s.removeEventListener("popstate",e)}}}od(){if(!this.nd){var e=()=>{this.ld("hashchange")};s_(s,"hashchange",e),this.nd=()=>{s&&s.removeEventListener("hashchange",e)}}}},heatmaps:class{get qi(){return this.instance.config}constructor(e){var t;this.hd=!1,this.Qn=!1,this.dd=null,this.instance=e,this.hd=!(null==(t=this.instance.persistence)||!t.props[ih]),this.rageclicks=new aj(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return K(this.qi.capture_heatmaps)&&this.qi.capture_heatmaps.flush_interval_milliseconds&&(e=this.qi.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return es(this.qi.capture_heatmaps)?es(this.qi.enable_heatmaps)?this.hd:this.qi.enable_heatmaps:!1!==this.qi.capture_heatmaps}startIfEnabled(){if(this.isEnabled)this.Qn||(a2.info("starting..."),this.vd(),this.It());else{var e;clearInterval(null!=(e=this.dd)?e:void 0),this.fd(),this.getAndClearBuffer()}}onRemoteConfig(e){if(e.ok){var t=e.config;if("heatmaps"in t){var i=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[ih]:i}),this.hd=i,this.startIfEnabled()}}}getAndClearBuffer(){var e=this.ft;return this.ft=void 0,e}pd(e){a3(e.originalEvent)&&this.ki(e.originalEvent,"deadclick")}It(){this.dd&&clearInterval(this.dd),this.dd="visible"===(null==a?void 0:a.visibilityState)?setInterval(this.Oa.bind(this),this.flushIntervalMilliseconds):null}vd(){s&&a&&(this.gd=this.Oa.bind(this),s_(s,sr,this.gd),this.md=e=>this.ki(e||(null==s?void 0:s.event)),s_(a,"click",this.md,{capture:!0}),this.yd=e=>this.bd(e||(null==s?void 0:s.event)),s_(a,"mousemove",this.yd,{capture:!0}),this._d=new rE(this.instance,rx,this.pd.bind(this)),this._d.startIfEnabledOrStop(),this.wd=this.It.bind(this),s_(a,ss,this.wd),this.Qn=!0)}fd(){var e;s&&a&&(this.gd&&s.removeEventListener(sr,this.gd),this.md&&a.removeEventListener("click",this.md,{capture:!0}),this.yd&&a.removeEventListener("mousemove",this.yd,{capture:!0}),this.wd&&a.removeEventListener(ss,this.wd),clearTimeout(this.kd),null==(e=this._d)||e.stop(),this.Qn=!1)}Sd(e,t){var i=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),a=function(e,t,i){for(var r=e;r&&sQ(r)&&!sZ(r,"body")&&r!==i;){var n,a,o,l=void 0;try{l=null==(n=null!=(a=null==(o=r.ownerDocument)?void 0:o.defaultView)?a:s)?void 0:n.getComputedStyle(r).position}catch(e){break}if(z(t,l))return!0;r=re(r)}return!1}(s8(e),["fixed","sticky"],n);return{x:e.clientX+(a?0:r),y:e.clientY+(a?0:i),target_fixed:a,type:t}}ki(e,t){var i;if(void 0===t&&(t="click"),!sK(e.target)&&a3(e)){var s=this.Sd(e,t);null!=(i=this.rageclicks)&&i.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&ro(s8(e),this.instance.config.rageclick)&&this.Nn(y({},s,{type:"rageclick"})),this.Nn(s)}}bd(e){!sK(e.target)&&a3(e)&&(clearTimeout(this.kd),this.kd=setTimeout(()=>{this.Nn(this.Sd(e,"mousemove"))},500))}Nn(e){if(s){var t=this.qi.disable_capture_url_hashes?tv(s.location.href):s.location.href,i=this.qi.custom_personal_data_properties,r=rL(t,this.qi.mask_personal_data_properties?[...rz,...i||[]]:[],rU);this.ft=this.ft||{},this.ft[r]||(this.ft[r]=[]),this.ft[r].push(e)}}Oa(){this.ft&&!Q(this.ft)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:rE,webVitalsAutocapture:class{constructor(e){var t;this.hd=!1,this.Qn=!1,this.ft={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.xd=()=>{clearTimeout(this.Cd),this.Cd=void 0,0!==this.ft.metrics.length&&(this._instance.capture("$web_vitals",y({$current_url:this.ft.url},this.ft.metrics.reduce((e,t)=>
1y({},e,{["$web_vitals_"+t.name+"_event"]:y({},t),["$web_vitals_"+t.name+"_value"]:t.value}),{}))),this.ft={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Td=e=>{var t;if(this.ft=this.ft||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},es(null==e?void 0:e.name)||es(null==e?void 0:e.value))aY.error("Invalid metric received",e);else{var i="string"==typeof e.navigationURL?e.navigationURL:void 0,s=this.Md(i);if(!Z(s)){var r=er(e.navigationId)||"string"==typeof e.navigationId?"navigation:"+e.navigationId:"url:"+s;if(!this.Ed||this.Ed>e.value){this.ft.navigationKey!==r&&(this.xd(),this.Cd=setTimeout(this.xd,this.flushToCaptureTimeoutMs)),Z(this.ft.navigationKey)&&(this.ft.navigationKey=r,this.ft.url=s),this.ft.firstMetricTimestamp=Z(this.ft.firstMetricTimestamp)?Date.now():this.ft.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0);var n=null==(t=this._instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0),a=y({},e,i?{navigationURL:s}:{},{$current_url:s,timestamp:Date.now()});Z(n)||(a.$session_id=n.sessionId,a.$window_id=n.windowId),this.ft.metrics.push(a),this.ft.metrics.length===this.allowedMetrics.length&&this.xd()}else aY.error("Ignoring metric with value >= "+this.Ed,e)}}},this.Id=()=>{if(!this.Qn){var e,t,i,s,r=g.__PosthogExtensions__,n=null==r?void 0:r.postHogWebVitalsCallbacksByFlavor,a=(null==n?void 0:n[this.Rd])||("web-vitals"===this.Rd&&Z(n)?null==r?void 0:r.postHogWebVitalsCallbacks:void 0);if(Z(a)||(e=a.onLCP,t=a.onCLS,i=a.onFCP,s=a.onINP),e&&t&&i&&s){var o={reportSoftNavs:this.useSoftNavs};this.allowedMetrics.indexOf("LCP")>-1&&e(this.Td.bind(this),o),this.allowedMetrics.indexOf("CLS")>-1&&t(this.Td.bind(this),o),this.allowedMetrics.indexOf("FCP")>-1&&i(this.Td.bind(this),o),this.allowedMetrics.indexOf("INP")>-1&&s(this.Td.bind(this),o),this.Qn=!0}else aY.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.hd=!(null==(t=this._instance.persistence)||!t.props[iv]),this.startIfEnabled()}get Pd(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,i=K(this.Pd)?null==(e=this.Pd)?void 0:e.web_vitals_allowed_metrics:void 0;return es(i)?(null==(t=this._instance.persistence)?void 0:t.props[im])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(K(this.Pd)?this.Pd.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=K(this.Pd)?this.Pd.web_vitals_attribution:void 0;return null!=e&&e}get useSoftNavs(){var e=K(this.Pd)?this.Pd.__preview_web_vitals_soft_navs:void 0;return null!=e&&e}get Ed(){var e=K(this.Pd)&&er(this.Pd.__web_vitals_max_value)?this.Pd.__web_vitals_max_value:9e5;return e>0&&6e4>=e?9e5:e}get isEnabled(){var e=null==o?void 0:o.protocol;if("http:"!==e&&"https:"!==e)return aY.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=K(this.Pd)?this.Pd.web_vitals:ea(this.Pd)?this.Pd:void 0;return ea(t)?t:this.hd}startIfEnabled(){this.isEnabled&&!this.Qn&&(aY.info("enabled, starting..."),this._s(this.Id))}onRemoteConfig(e){if(e.ok){var t=e.config;if("capturePerformance"in t){var i=K(t.capturePerformance)&&!!t.capturePerformance.web_vitals,s=K(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[iv]:i}),this._instance.persistence.register({[im]:s})),this.hd=i,this.startIfEnabled()}}}get Rd(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}_s(e){var t=g.__PosthogExtensions__,i=this.Rd,s=null==t?void 0:t.postHogWebVitalsCallbacksByFlavor;null!=s&&s[i]||"web-vitals"===i&&Z(s)&&null!=t&&t.postHogWebVitalsCallbacks?e():null==t||null==t.loadExternalDependency||t.loadExternalDependency(this._instance,i,t=>{t?aY.error("failed to load script",t):e()})}Md(e){var t=e||(null==s?void 0:s.location.href);if(t){var i=this._instance.config.disable_capture_url_hashes?tv(t):t,r=this._instance.config.custom_personal_data_properties;return rL(i,this._instance.config.mask_personal_data_properties?[...rz,...r||[]]:[],rU)}aY.error("Could not determine current URL")}}},{exceptionObserver:class{constructor(e){var t;this.Id=()=>{var e;if(s&&this.isEnabled&&null!=(e=g.__PosthogExtensions__)&&e.errorWrappingFunctions){var t=g.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=g.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=g.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Ad&&this.qi.capture_unhandled_errors&&(this.Ad=t(this.captureException.bind(this))),!this.Fd&&this.qi.capture_unhandled_rejections&&(this.Fd=i(this.captureException.bind(this))),!this.Od&&this.qi.capture_console_errors&&(this.Od=r(this.captureException.bind(this)))}catch(e){aG.error("failed to start",e),this.Ld()}}},this._instance=e,this.$d=!(null==(t=this._instance.persistence)||!t.props[ic]),this.oe=new em(y({},function(e){var t,i,s,r;return void 0===e&&(e={}),{refillRate:null!=(t=null!=(i=e.exceptionRateLimiterRefillRate)?i:e.__exceptionRateLimiterRefillRate)?t:1,bucketSize:null!=(s=null!=(r=e.exceptionRateLimiterBucketSize)?r:e.__exceptionRateLimiterBucketSize)?s:10}}(this._instance.config.error_tracking),{refillInterval:1e4,I:aG})),this.qi=this.Dd(),this.startIfEnabledOrStop()}Dd(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return K(e)?t=y({},t,e):(Z(e)?this.$d:e)&&(t=y({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.qi.capture_console_errors||this.qi.capture_unhandled_errors||this.qi.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(aG.info("enabled"),this.Ld(),this._s(this.Id)):this.Ld()}_s(e){var t,i;null!=(t=g.__PosthogExtensions__)&&t.errorWrappingFunctions?e():null==(i=g.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",t=>{if(t)return aG.error("failed to load script",t);e()})}Ld(){var e,t,i;null==(e=this.Ad)||e.call(this),this.Ad=void 0,null==(t=this.Fd)||t.call(this),this.Fd=void 0,null==(i=this.Od)||i.call(this),this.Od=void 0}onRemoteConfig(e){if(e.ok){var t=e.config;"autocaptureExceptions"in t&&(this.$d=!!t.autocaptureExceptions,this._instance.persistence&&this._instance.persistence.register({[ic]:this.$d}),this.qi=this.Dd(),this.startIfEnabledOrStop())}}onConfigChange(){this.qi=this.Dd()}captureException(e){var t,i,s,r=null!=(t=null==e||null==(i=e.$exception_list)||null==(i=i[0])?void 0:i.type)?t:"Exception";this.oe.consumeRateLimit(r)?aG.info("Skipping exception capture because of client rate limiting.",{exception:r}):null==(s=this._instance.exceptions)||s.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,i;this.Nd=[],this.qd=new tO([new tB,new tK,new tH,new tz,new tY,new tJ,new tV,new tX],function(e){for(var t=arguments.length,i=Array(t>1?t-1:0),s=1;t>s;s++)i[s-1]=arguments[s];return function(t,s){void 0===s&&(s=0);for(var r=[],n=t.split("\n"),a=s;n.length>a;a++){var o=n[a];if(1024>=o.length){var l=tj.test(o)?o.replace(tj,"$1"):o;if(!l.match(/\S*Error: /)){for(var u of i){var h=u(l,e);if(h){r.push(h);break}}if(r.length>=50)break}}}if(!r.length)return[];var c=Array.from(r);return c.reverse(),c.slice(0,50).map(e=>y({},e,{filename:e.filename||(c[c.length-1]||{}).filename,function:e.function||"?"}))}}("web:javascript",tA,tN)),this._instance=e,this.Nd=null!=(t=null==(i=this._instance.persistence)?void 0:i.get_property(id))?t:[],this.jd=t2(this.Bd()),this.Hd=new t3(this.jd)}onConfigChange(){this.jd=t2(this.Bd()),this.Hd.setConfig(this.jd)}onRemoteConfig(e){var t,i,s;if(e.ok){var r=e.config;if("errorTracking"in r){var n=null!=(t=null==(i=r.errorTracking)?void 0:i.suppressionRules)?t:[],a=null==(s=r.errorTracking)?void 0:s.captureExtensionExceptions;this.Nd=n,this._instance.persistence&&this._instance.persistence.register({[id]:this.Nd,[ip]:a})}}}get Ud(){var e,t=!!this._instance.get_property(ip),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!=(e=null!=i?i:t)&&e}buildProperties(e,t){return this.qd.buildFromUnknown(e,{syntheticException:null==t?void 0:t.syntheticException,mechanism:{handled:null==t?void 0:t.handled}})}addExceptionStep(e,t){if(this.jd.enabled)try{if(!ee(e)||0===e.trim().length)return void ob.warn("Ignoring exception step because message must be a non-empty string");var i=function(e){if(!e)return{sanitizedProperties:{},droppedKeys:[]};var t=[];return{sanitizedProperties:Object.keys(e).reduce((i,s)=>(t0.has(s)?t.push(s):i[s]=e[s],i),{}),droppedKeys:t}}(this.zd(t)),s=i.sanitizedProperties,r=i.droppedKeys;r.length>0&&ob.warn("Ignoring reserved exception step fields",{droppedKeys:r}),this.Hd.add(y({[tQ]:e,[tZ]:(new Date).toISOString()}
1,s))}catch(e){ob.error("Failed to add exception step. Ignoring breadcrumb.",e)}}sendExceptionEvent(e){var t;try{var i=e.$exception_list;if(this.Wd(i)){if(this.Vd(i))return this.Gd("Exception dropped: matched a suppression rule"),void ob.info("Skipping exception capture because a suppression rule matched");if(!this.Ud&&this.Zd(i))return this.Gd("Exception dropped: thrown by a browser extension"),void ob.info("Skipping exception capture because it was thrown by an extension");if(!this.Ud&&this.Qd(i))return this.Gd("Exception dropped: thrown by an injected browser script"),void ob.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Jd(i))return this.Gd("Exception dropped: thrown by the PostHog SDK"),void ob.info("Skipping exception capture because it was thrown by the PostHog SDK")}var s=this.jd.enabled&&es(e.$exception_steps)?this.Kd(e):e,r="string"==typeof(t=globalThis._posthogReleaseId)&&t.length>0?t:void 0;r&&(s.$release_id=r);try{var n=this._instance.capture("$exception",s,{_noTruncate:!0,_batchKey:"exceptionEvent",fl:!0});return n&&this.Hd.clear(),n}catch(e){return ob.error("Failed to capture exception event. Dropping this exception.",e),void this.Hd.clear()}}catch(e){return void ob.error("Failed to process exception event. Ignoring this exception.",e)}}Kd(e){try{var t=this.Hd.getAttachable();return 0===t.length?e:y({},e,{$exception_steps:t})}catch(t){return ob.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}Gd(e){this.jd.enabled&&this.Hd.add({[tQ]:e,[tZ]:(new Date).toISOString()})}zd(e){return K(e)?y({},e):{}}Bd(){var e,t;return null!=(e=null==(t=this._instance.config.error_tracking)?void 0:t.exception_steps)?e:{}}Vd(e){if(0===e.length)return!1;try{var t=e.reduce((e,t)=>{var i=t.type,s=t.value;return ee(i)&&i.length>0&&e.$exception_types.push(i),ee(s)&&s.length>0&&e.$exception_values.push(s),e},{$exception_types:[],$exception_values:[]});return this.Nd.some(e=>{var i=e.values.map(e=>{var i=ar[e.operator],s=t[e.key];if(!i||!s)return!1;var r=Y(e.value)?e.value:[e.value];return r.length>0&&i(r,s)});return"OR"===e.type?i.some(Boolean):i.every(Boolean)})}catch(e){return ob.warn("Failed to evaluate suppression rules. Capturing the exception.",e),!1}}Zd(e){return e.flatMap(e=>{var t,i;return null!=(t=null==(i=e.stacktrace)?void 0:i.frames)?t:[]}).some(e=>{var t=e.filename;return!!t&&ow.some(e=>
1t.startsWith(e))})}Qd(e){return e.some(e=>{var t=e.value;return ee(t)&&ox.some(e=>t.includes(e))})}Jd(e){if(e.length>0){var t,i,s,r,n=null!=(t=null==(i=e[0].stacktrace)?void 0:i.frames)?t:[],a=n[n.length-1];return null!=(s=null==a||null==(r=a.filename)?void 0:r.includes("posthog.com/static"))&&s}return!1}Wd(e){return!es(e)&&Y(e)}}},oR,{siteApps:class{constructor(e){this.ev=0,this._instance=e,this.iv=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}rv(e,t){if(t){var i=this.globalsForEvent(t);this.iv.push(i),this.iv.length>1e3&&(this.iv=this.iv.slice(10))}}get siteAppLoaders(){var e;return null==(e=g._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.siteApps}initialize(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.rv.bind(this));this.nv=()=>{e(),this.iv=[],this.nv=void 0}}}globalsForEvent(e){if(!e)throw Error("Event payload is required");var t,i,s,r,n,a,o,l={},u=this._instance.get_property("$groups")||[];for(var h of Object.entries(this._instance.get_property("$stored_group_properties")||{})){var c=h[0];l[c]={id:u[c],type:c,properties:h[1]}}var d=e.$set_once,p=e.$set;return{event:y({},b(e,a4),{properties:y({},e.properties,p?{$set:y({},null!=(t=null==(i=e.properties)?void 0:i.$set)?t:{},p)}:{},d?{$set_once:y({},null!=(s=null==(r=e.properties)?void 0:r.$set_once)?s:{},d)}:{}),elements_chain:null!=(n=null==(a=e.properties)?void 0:a.$elements_chain)?n:"",distinct_id:null==(o=e.properties)?void 0:o.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}sv(e){var t,i=null==(t=e.tagName)?void 0:t.toLowerCase();return"style"===i&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||(a8.error("prepare_external_dependency_stylesheet returned null"),null):"script"===i&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(e)||(a8.error("prepare_external_dependency_script returned null"),null):e}av(){if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var e,t,i,s,r,n,o,l,u=null==a?void 0:a.defaultView,h=null==u||null==(e=u.Node)?void 0:e.prototype;if(!u||!h)return()=>{};if(this.ev++,this.ov)return this.lv();var c=[],d=this,p=new WeakSet,v=(e,t,i)=>{if(null!=e&&e[t]){var s=e[t];e[t]=i(s),c.push(()=>{e[t]=s})}},g=e=>{if(p.has(e))return e;var t=d.sv(e);return t&&p.add(t),t},f=e=>e.map(e=>"string"==typeof e?e:g(e)).filter(e=>!ei(e));return v(h,"appendChild",e=>function(t){var i=g(t);return i?e.call(this,i):t}),v(h,"insertBefore",e=>function(t,i){var s=g(t);return s?e.call(this,s,i):t}),v(h,"replaceChild",e=>function(t,i){var s=g(t);return s?e.call(this,s,i):i}),[null==(t=u.Element)?void 0:t.prototype,null==(i=u.Document)?void 0:i.prototype,null==(s=u.DocumentFragment)?void 0:s.prototype].forEach(e=>{v(e,"append",e=>function(){for(var t=arguments.length,i=Array(t),s=0;t>s;s++)i[s]=arguments[s];return e.apply(this,f(i))}),v(e,"prepend",e=>function(){for(var t=arguments.length,i=Array(t),s=0;t>s;s++)i[s]=arguments[s];return e.apply(this,f(i))})}),[null==(r=u.Element)?void 0:r.prototype,null==(n=u.CharacterData)?void 0:n.prototype,null==(o=u.DocumentType)?void 0:o.prototype].forEach(e=>{v(e,"before",e=>function(){for(var t=arguments.length,i=Array(t),s=0;t>s;s++)i[s]=arguments[s];return e.apply(this,f(i))}),v(e,"after",e=>function(){for(var t=arguments.length,i=Array(t),s=0;t>s;s++)i[s]=arguments[s];return e.apply(this,f(i))}),v(e,"replaceWith",e=>function(){for(var t=arguments.length,i=Array(t),s=0;t>s;s++)i[s]=arguments[s];var r=f(i);return i.length&&!r.length?void 0:e.apply(this,r)})}),v(null==(l=u.Element)?void 0:l.prototype,"insertAdjacentElement",e=>function(t,i){var s=g(i);return s?e.call(this,t,s):null}),this.ov=()=>{c.forEach(e=>e()),this.ov=void 0},this.lv()}lv(){var e=!1;return()=>{var t;e||(e=!0,this.ev--,0===this.ev&&(null==(t=this.ov)||t.call(this)))}}uv(e,t){void 0===t&&(t=!0);var i=this.av();try{var s=e(i);return t&&i(),s}catch(e){throw i(),e}}setupSiteApp(e){var t=this.apps[e.id],i=()=>{var i;!t.errored&&this.iv.length&&(a8.info("Processing "+this.iv.length+" events for site app with id "+e.id),this.iv.forEach(e
vendor: 9,134 bytes, line 1
1=>this.uv(()=>null==t.processEvent?void 0:t.processEvent(e))),t.processedBuffer=!0),Object.values(this.apps).every(e=>e.processedBuffer||e.errored)&&(null==(i=this.nv)||i.call(this))},s=!1,r=r=>{t.errored=!r,t.loaded=!0,a8.info("Site app with id "+e.id+" "+(r?"loaded":"errored")),s&&i()};try{var n=this.uv(t=>e.init({posthog:this._instance,callback(e){t(),r(e)}}),!1).processEvent;n&&(t.processEvent=n),s=!0}catch(t){a8.error(a9+e.id,t),r(!1)}if(s&&t.loaded)try{i()}catch(i){a8.error("Error while processing buffered events PostHog app with config id "+e.id,i),t.errored=!0}}hv(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var i of e)this.setupSiteApp(i)}dv(e){var t=this;if(0!==Object.keys(this.apps).length){var i=this.globalsForEvent(e),s=function(s){try{t.uv(()=>null==s.processEvent?void 0:s.processEvent(i))}catch(t){a8.error("Error while processing event "+e.event+" for site app "+s.id,t)}};for(var r of Object.values(this.apps))s(r)}}onRemoteConfig(e){var t,i,s,r=this;if(null!=(t=this.siteAppLoaders)&&t.length)return this.isEnabled?(this.hv(),void this._instance.on("eventCaptured",e=>this.dv(e))):void a8.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this.nv)||i.call(this),e.ok){var n=e.config;if(null!=(s=n.siteApps)&&s.length)if(this.isEnabled)for(var a of n.siteApps)!function(){var e,t=a.id,i=a.url;g["__$$ph_site_app_"+t]=r._instance,null==(e=g.__PosthogExtensions__)||null==e.loadSiteApp||e.loadSiteApp(r._instance,i,e=>{if(e)return a8.error(a9+t,e)})}();else a8.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},oM,{tracingHeaders:class{constructor(e){this.vv=void 0,this.fv=void 0,this.pv=void 0,this.Id=()=>{var e,t,i=this.gv();i?(Z(this.vv)&&(this.vv=null==(e=g.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)?void 0:e._patchXHR(i,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),Z(this.fv)&&(this.fv=null==(t=g.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchFetch(i,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.Ld()},this._instance=e}initialize(){this.startIfEnabledOrStop()}_s(e){var t,i;null!=(t=g.__PosthogExtensions__)&&t.tracingHeadersPatchFns?e():null==(i=g.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",t=>{if(t)return aJ.error("failed to load script",t);e()})}mv(){var e,t;return null!=(e=null!=(t=this._instance.config.tracing_headers)?t:this._instance.config.addTracingHeaders)?e:this._instance.config.__add_tracing_headers}gv(){var e=this.mv();return Y(e)?(Y(this.pv)?this.pv.splice(0,this.pv.length,...e):this.pv=[...e],e.length>0?this.pv:void 0):(Y(this.pv)&&this.pv.splice(0),this.pv=e||void 0,this.pv)}Ld(){var e,t;null==(e=this.vv)||e.call(this),null==(t=this.fv)||t.call(this),this.vv=void 0,this.fv=void 0}startIfEnabledOrStop(){this.gv()?this._s(this.Id):this.Ld()}}},{toolbar:class{constructor(e){this.instance=e}yv(e){g.ph_toolbar_state=e}bv(){var e;return null!=(e=g.ph_toolbar_state)?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,t,i){if(void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===i&&(i=void 0),sm(this.instance.config)||!s||!a)return!1;e=null!=e?e:s.location,i=null!=i?i:s.history;try{if(!t){try{s.localStorage.setItem("test","test"),s.localStorage.removeItem("test")}catch(e){return!1}t=null==s?void 0:s.localStorage}var r,n=ou||rD(e.hash,"__posthog")||rD(e.hash,"state"),o=n?sp(()=>JSON.parse(atob(decodeURIComponent(n))))||sp(()=>JSON.parse(decodeURIComponent(n))):null;return o&&"ph_authorize"===o.action?((r=o).source="url",r&&Object.keys(r).length>0&&(o.desiredHash?e.hash=o.desiredHash:i?i.replaceState(i.state,"",e.pathname+e.search):e.hash="")):((r=JSON.parse(t.getItem(oh)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(e){return!1}}_v(e){var t=g.ph_load_toolbar||g.ph_load_editor;!es(t)&&X(t)?t(e,this.instance):oc.warn("No toolbar load function found")}loadToolbar(e){var t,i=!(null==a||!a.getElementById(sX));if(!s||i)return!1;var r="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,n=y({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});return(s.localStorage.setItem(oh,JSON.stringify(y({},n,{source:void 0}))),2===this.bv())?this._v(n):0===this.bv()&&(this.yv(1),null==(t=g.__PosthogExtensions__)||null==t.loadExternalDependency||t.loadExternalDependency(this.instance,"toolbar",e=>{if(e)return oc.error("[Toolbar] Failed to load",e),void this.yv(0);this.yv(2),this._v(n)}),s_(s,"turbolinks:load",()=>{this.yv(0),this.loadToolbar(n)})),!0}wv(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,i){return void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===i&&(i=void 0),this.maybeLoadToolbar(e,t,i)}}},oq,{conversations:class{constructor(e){this.Sv=void 0,this._conversationsManager=null,this.xv=!1,this.Me=null,this.Cv=!1,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations&&(this.Tv=e.ok,e.ok)){var t=e.config.conversations;es(t)||(ea(t)?this.Sv=t:(this.Sv=t.enabled,this.Me=t),this.loadIfEnabled())}}reset(){var e;null==(e=this._conversationsManager)||e.reset(),this._conversationsManager=null,this.Sv=void 0,this.Me=null,this.Tv=void 0,this.Cv=!1}loadIfEnabled(){if(!(this._conversationsManager||this.xv||this._instance.config.disable_conversations||sm(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=null==g?void 0:g.__PosthogExtensions__;if(e&&!Z(this.Sv)&&this.Sv)if(this.Me&&this.Me.token){this.xv=!0;try{var t=e.initConversations;if(t)return this.Mv(t),void(this.xv=!1);var i=e.loadExternalDependency;if(!i)return void this.Ev(i8);i(this._instance,"conversations",t=>{t||!e.initConversations?this.Ev("Could not load conversations script",t):this.Mv(e.initConversations),this.xv=!1})}catch(e){this.Ev("Error initializing conversations",e),this.xv=!1}}else oP.error("Conversations enabled but missing token in remote config.")}}Mv(e){if(this.Me)try{this._conversationsManager=e(this.Me,this._instance),this.Cv=!1,oP.info("Conversations loaded successfully")}catch(e){this.Ev("Error completing conversations initialization",e)}else oP.error("Cannot complete initialization: remote config is null")}Ev(e,t){oP.error(e,t),this._conversationsManager=null,this.xv=!1,this.Cv=!0}show(){this._conversationsManager?this._conversationsManager.show():oP.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Sv&&!ei(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":sm(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.Tv?"remote_config_failed":Z(this.Sv)?this.Tv?"disabled_in_project":"remote_config_pending":this.Sv?es(this.Me)||!this.Me.token?"missing_token":null!=g&&g.__PosthogExtensions__?this.xv?"initializing":this.Cv?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var e,t;return null!=(e=null==(t=this._conversationsManager)?void 0:t.isVisible())&&e}sendMessage(e,t,i){var s=this;return m(function*(){return s._conversationsManager?s._conversationsManager.sendMessage(e,t,i):(oP.warn(oI),null)})()}getMessages(e,t){var i=this;return m(function*(){return i._conversationsManager?i._conversationsManager.getMessages(e,t):(oP.warn(oI),null)})()}markAsRead(e){var t=this;return m(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(oP.warn(oI),null)})()}getTickets(e){var t=this;return m(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(oP.warn(oI),null)})()}requestRestoreLink(e){var t=this;return m(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(oP.warn(oI),null)})()}restoreFromToken(e){var t=this;return m(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(oP.warn(oI),null)})()}restoreFromUrlToken(){var e=this;return m(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(oP.warn(oI),null)})()}getCurrentTicketId(){var e,t;return null!=(e=null==(t=this._conversationsManager)?void 0:t.getCurrentTicketId())?e:null}getWidgetSessionId(){var e,t;return null!=(e=null==(t=this._conversationsManager)?void 0:t.getWidgetSessionId())?e:null}Sl(){var e;null==(e=this._conversationsManager)||e.setIdentity()}xl(){var e;null==(e=this._conversationsManager)||e.clearIdentity()}}},{logs:class{constructor(e){var t,i=this;this.Iv=!1,this.Rv=!1,this.I=t4("[logs]"),this.Pv=y({},this.I,{error(){for(var e=arguments.length,t=Array(e),s=0;e>s;s++)t[s]=arguments[s];t.some(o$)||i.I.error(...t)}}
1),this.ka=[],this.Av=[],this.ph=0,this.Fv=()=>{var e,t;this.ph=0,null==(e=this.Ov)||e.onReconnect(),null==(t=this.Lv)||t.onReconnect()},this._instance=e,this._instance&&null!=(t=this._instance.config.logs)&&t.captureConsoleLogs&&(this.Iv=!0),s&&s_(s,"online",this.Fv)}$v(e,t,i,s){var r,n,a,o,l,u,h,c,d,p,v,g,f,_,m=(r=null==(_=this._instance)||null==(_=_.config)?void 0:_.logs,d=null!=(n=null==r?void 0:r.flushIntervalMs)?n:3e3,p=null!=(a=null==r?void 0:r.maxBufferSize)?a:100,g=Z(v=null!=i&&i.consoleCapture?void 0:null!=(o=null==r?void 0:r.maxLogsPerInterval)?o:1e3)?Math.max(p,2048):Math.max(p,v),{serviceName:null!=(l=null!=(u=null==(f=null==r?void 0:r.resourceAttributes)?void 0:f["service.name"])?u:null==r?void 0:r.serviceName)?l:null==i?void 0:i.serviceNameDefault,serviceVersion:null!=(h=null==f?void 0:f["service.version"])?h:null==r?void 0:r.serviceVersion,environment:null!=(c=null==f?void 0:f["deployment.environment"])?c:null==r?void 0:r.environment,resourceAttributes:f,beforeSend:null==r?void 0:r.beforeSend,flushIntervalMs:d,maxBufferSize:p,maxQueueSize:g,maxBatchRecordsPerPost:100,rateCapWindowMs:d,maxLogsPerInterval:v,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0});return[new tS(this.Dv(e,t),m,this.Pv,()=>this.Nv(),e=>e(),void 0,s),m]}qv(){var e,t=null==(e=this._instance)||null==(e=e.config)?void 0:e.logs;if(!this.Ov||this.jv!==t){null==(i=this.Ov)||i.reset(),this.jv=t;var i,s=this.$v(()=>this.ka,e=>{this.ka=e});this.Ov=s[0],this.Bv=s[1]}return this.Ov}Hv(){var e,t=null==(e=this._instance)||null==(e=e.config)?void 0:e.logs;if(!this.Lv||this.Uv!==t){null==(i=this.Lv)||i.reset(),this.Uv=t;var i,s=this.$v(()=>this.Av,e=>{this.Av=e},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},oF);this.Lv=s[0],this.zv=s[1]}return this.Lv}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t;if(e.ok){var i=null==(t=e.config.logs)?void 0:t.captureConsoleLogs;!es(i)&&i&&(this.Iv=!0,this.loadIfEnabled())}}reset(){var e,t;this.ka=[],null==(e=this.Ov)||e.reset(),this.Av=[],null==(t=this.Lv)||t.reset(),this.ph=0}captureLog(e){this.qv().captureLog(e)}vi(e){this.Hv().captureLog(e)}get logger(){return this.Wv||(this.Wv={trace:(e,t)=>this.captureLog({body:e,level:"trace",attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:"debug",attributes:t}),info:(e,t)=>this.captureLog({body:e,level:"info",attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:"warn",attributes:t}),error:(e,t)=>this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this.Wv}flushLogs(e){e?this.Vv(e):(this.Ov&&this.Ov.flush().catch(e=>this.Gv(e)),this.Lv&&this.Lv.flush().catch(e=>this.Gv(e)))}Gv(e){o$(e)||this.I.error("PostHog logs flush failed:",e)}loadIfEnabled(){if(this.Iv&&!this.Rv){var e=null==g?void 0:g.__PosthogExtensions__;if(e){var t=e.loadExternalDependency;t?t(this._instance,"logs",t=>{var i;t||null==(i=e.logs)||!i.initializeLogs?this.I.error("Could not load logs script",t):(e.logs.initializeLogs(this._instance),this.Rv=!0)}):this.I.error(i8)}else this.I.error("PostHog Extensions not found.")}}Dv(e,t){var i=this._instance;return{get isDisabled(){return!1},get optedOut(){return!i.is_capturing()},getPersistedProperty:t=>t===P.LogsQueue?e():void 0,setPersistedProperty(e,i){e===P.LogsQueue&&t(null!=i?i:[])},Mn:e=>this.Mn(e),getLibraryId:()=>f.LIB_NAME,getLibraryVersion:()=>f.LIB_VERSION}}Mn(e){return new Promise(t=>{if(rN(this.ph,3))t({kind:"fatal",error:oO(void 0,"logs endpoint is unreachable, dropping batch")});else{var i=!1,s=e=>{i||(i=!0,clearTimeout(r),t(e))},r=setTimeout(()=>{this.I.warn("Logs request timed out before receiving a response"),s({kind:"retry-later",error:oO(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.Zv(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:e=>{var t,i=e.statusCode;(this.Qv(i),i>=200&&300>i)?s({kind:"ok"}):413===i?s({kind:"too-large"}):0!==i&&408!==i&&429!==i&&500>i?s({kind:"fatal",error:Error("logs request failed with status "+i)}):0===i?(e.error||this.I.warn("Logs request failed before receiving an HTTP response"),s({kind:"retry-later",error:oO(e.error,"logs request failed before receiving an HTTP response")})):s({kind:"retry-later",error:null!=(t=e.error)?t:Error("logs request failed with status "+i)})}})}})}Qv(e){(0!==e||this._instance.__loaded)&&(this.ph=rj(e,this.ph,3,()=>this.I.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes.")))}Vv(e){this.ka.length>0&&this.Jv(e,this.ka,this.Bv,f.LIB_NAME,e=>{this.ka=e}),this.Av.length>0&&this.Jv(e,this.Av,this.zv,oF,e=>{this.Av=e})}Jv(e,t,i,s,r){if(0!==t.length){var n=t.map(e=>e.record);r([]);var a=tE(n,tk(i,f.LIB_NAME,f.LIB_VERSION),s,f.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Zv(),data:a,compression:"best-available",batchKey:"logs",transport:e})}}Zv(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}Nv(){var e,t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var i=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),s=i.windowId,r=i.sessionStartTimestamp,n=i.lastActivityTimestamp;t.sessionId=i.sessionId,t.windowId=s,es(r)||(t.sessionStartTimestamp=r),es(n)||(t.lastActivityTimestamp=n)}if(null!=g&&null!=(e=g.location)&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?tv(g.location.href):g.location.href),this._instance.featureFlags){var a=this._instance.featureFlags.getFlags();a&&a.length>0&&(t.activeFeatureFlags=a)}return t}}},{metrics:class{constructor(e){this.I=t4("[metrics]"),this._instance=e}initialize(){}qv(){var e,t,i,s,r,n,a,o,l=null==(a=this._instance)||null==(a=a.config)?void 0:a.metrics;return this.Ov&&this.jv===l||(null==(o=this.Ov)||o.reset(),this.jv=l,this.Ov=new tT(this.Dv(),{serviceName:null!=(e=null==(n=null==l?void 0:l.resourceAttributes)?void 0:n["service.name"])?e:null==l?void 0:l.serviceName,serviceVersion:null!=(t=null==n?void 0:n["service.version"])?t:null==l?void 0:l.serviceVersion,environment:null!=(i=null==n?void 0:n["deployment.environment"])?i:null==l?void 0:l.environment,resourceAttributes:n,beforeSend:null==l?void 0:l.beforeSend,flushIntervalMs:null!=(s=null==l?void 0:l.flushIntervalMs)?s:1e4,maxSeriesPerFlush:null!=(r=null==l?void 0:l.maxSeriesPerFlush)?r:1e3},this.I)),this.Ov}count(e,t,i){void 0===t&&(t=1),this.qv().count(e,t,i)}
1gauge(e,t,i){this.qv().gauge(e,t,i)}histogram(e,t,i){this.qv().histogram(e,t,i)}flush(e){if(!this.Ov)return Promise.resolve();if(e){var t=this.Ov.drainWindow();return t&&this.Un(t,e),Promise.resolve()}return this.Ov.flush().catch(e=>this.I.error("PostHog metrics flush failed:",e))}reset(){var e;null==(e=this.Ov)||e.reset()}Dv(){var e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},Un:e=>t.Un(e),getLibraryId:()=>f.LIB_NAME,getLibraryVersion:()=>f.LIB_VERSION}}Un(e,t){return new Promise(i=>{var s=!1,r=e=>{s||(s=!0,clearTimeout(n),i(e))},n=setTimeout(()=>r({kind:"retry-later",error:Error("metrics request timed out")}),9e4);this._instance._send_request(y({method:"POST",url:this.Kv(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t},{fireCallbackOnDrop:!0,callback(e){var t,i=e.statusCode;i>=200&&300>i?r({kind:"ok"}):413===i?r({kind:"too-large"}):0!==i&&408!==i&&429!==i&&500>i?r({kind:"fatal",error:Error("metrics request failed with status "+i)}):r({kind:"retry-later",error:null!=(t=e.error)?t:Error("metrics request failed with status "+i)})}}))})}Kv(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}});aN.__defaultExtensionClasses=y({},oA);var oL=function(){f.SDK_DIST_CHANNEL="npm";var e=aS[aR]=new aN;return function(){function e(){e.done||(e.done=!0,aM=!1,sh(aS,function(e){e._dom_loaded()}))}null!=a&&a.addEventListener?"complete"===a.readyState?e():s_(a,"DOMContentLoaded",e,{capture:!1}):s&&t6.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}()}}]);
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.