@debales/ai 1.1.8-canary.1 → 1.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -75,7 +75,7 @@ Error generating stack: `+f.message+`
75
75
  `,...o.current()});return/^[\t ]/.test(d)&&(d=Dc(d.charCodeAt(0))+d.slice(1)),d=d?a+" "+d:a,n.options.closeAtx&&(d+=" "+a),c(),u(),d}sk.peek=mF;function sk(e){return e.value||""}function mF(){return"<"}lk.peek=vF;function lk(e,t,n,r){const i=$y(n),o=i==='"'?"Quote":"Apostrophe",a=n.enter("image");let u=n.enter("label");const c=n.createTracker(r);let d=c.move("![");return d+=c.move(n.safe(e.alt,{before:d,after:"]",...c.current()})),d+=c.move("]("),u(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),d+=c.move("<"),d+=c.move(n.safe(e.url,{before:d,after:">",...c.current()})),d+=c.move(">")):(u=n.enter("destinationRaw"),d+=c.move(n.safe(e.url,{before:d,after:e.title?" ":")",...c.current()}))),u(),e.title&&(u=n.enter(`title${o}`),d+=c.move(" "+i),d+=c.move(n.safe(e.title,{before:d,after:i,...c.current()})),d+=c.move(i),u()),d+=c.move(")"),a(),d}function vF(){return"!"}uk.peek=yF;function uk(e,t,n,r){const i=e.referenceType,o=n.enter("imageReference");let a=n.enter("label");const u=n.createTracker(r);let c=u.move("![");const d=n.safe(e.alt,{before:c,after:"]",...u.current()});c+=u.move(d+"]["),a();const p=n.stack;n.stack=[],a=n.enter("reference");const h=n.safe(n.associationId(e),{before:c,after:"]",...u.current()});return a(),n.stack=p,o(),i==="full"||!d||d!==h?c+=u.move(h+"]"):i==="shortcut"?c=c.slice(0,-1):c+=u.move("]"),c}function yF(){return"!"}ck.peek=_F;function ck(e,t,n){let r=e.value||"",i="`",o=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++o<n.unsafe.length;){const a=n.unsafe[o],u=n.compilePattern(a);let c;if(a.atBreak)for(;c=u.exec(r);){let d=c.index;r.charCodeAt(d)===10&&r.charCodeAt(d-1)===13&&d--,r=r.slice(0,d)+" "+r.slice(c.index+1)}}return i+r+i}function _F(){return"`"}function fk(e,t){const n=sy(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}dk.peek=bF;function dk(e,t,n,r){const i=$y(n),o=i==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let u,c;if(fk(e,n)){const p=n.stack;n.stack=[],u=n.enter("autolink");let h=a.move("<");return h+=a.move(n.containerPhrasing(e,{before:h,after:">",...a.current()})),h+=a.move(">"),u(),n.stack=p,h}u=n.enter("link"),c=n.enter("label");let d=a.move("[");return d+=a.move(n.containerPhrasing(e,{before:d,after:"](",...a.current()})),d+=a.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),d+=a.move("<"),d+=a.move(n.safe(e.url,{before:d,after:">",...a.current()})),d+=a.move(">")):(c=n.enter("destinationRaw"),d+=a.move(n.safe(e.url,{before:d,after:e.title?" ":")",...a.current()}))),c(),e.title&&(c=n.enter(`title${o}`),d+=a.move(" "+i),d+=a.move(n.safe(e.title,{before:d,after:i,...a.current()})),d+=a.move(i),c()),d+=a.move(")"),u(),d}function bF(e,t,n){return fk(e,n)?"<":"["}hk.peek=SF;function hk(e,t,n,r){const i=e.referenceType,o=n.enter("linkReference");let a=n.enter("label");const u=n.createTracker(r);let c=u.move("[");const d=n.containerPhrasing(e,{before:c,after:"]",...u.current()});c+=u.move(d+"]["),a();const p=n.stack;n.stack=[],a=n.enter("reference");const h=n.safe(n.associationId(e),{before:c,after:"]",...u.current()});return a(),n.stack=p,o(),i==="full"||!d||d!==h?c+=u.move(h+"]"):i==="shortcut"?c=c.slice(0,-1):c+=u.move("]"),c}function SF(){return"["}function Ny(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function wF(e){const t=Ny(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function xF(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function pk(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function CF(e,t,n,r){const i=n.enter("list"),o=n.bulletCurrent;let a=e.ordered?xF(n):Ny(n);const u=e.ordered?a==="."?")":".":wF(n);let c=t&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!e.ordered){const p=e.children?e.children[0]:void 0;if((a==="*"||a==="-")&&p&&(!p.children||!p.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),pk(n)===a&&p){let h=-1;for(;++h<e.children.length;){const m=e.children[h];if(m&&m.type==="listItem"&&m.children&&m.children[0]&&m.children[0].type==="thematicBreak"){c=!0;break}}}}c&&(a=u),n.bulletCurrent=a;const d=n.containerFlow(e,r);return n.bulletLastUsed=a,n.bulletCurrent=o,i(),d}function EF(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function kF(e,t,n,r){const i=EF(n);let o=n.bulletCurrent||Ny(n);t&&t.type==="list"&&t.ordered&&(o=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let a=o.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(a=Math.ceil(a/4)*4);const u=n.createTracker(r);u.move(o+" ".repeat(a-o.length)),u.shift(a);const c=n.enter("listItem"),d=n.indentLines(n.containerFlow(e,u.current()),p);return c(),d;function p(h,m,v){return m?(v?"":" ".repeat(a))+h:(v?o:o+" ".repeat(a-o.length))+h}}function AF(e,t,n,r){const i=n.enter("paragraph"),o=n.enter("phrasing"),a=n.containerPhrasing(e,r);return o(),i(),a}const IF=lh(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function RF(e,t,n,r){return(e.children.some(function(a){return IF(a)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function OF(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}gk.peek=TF;function gk(e,t,n,r){const i=OF(n),o=n.enter("strong"),a=n.createTracker(r),u=a.move(i+i);let c=a.move(n.containerPhrasing(e,{after:i,before:u,...a.current()}));const d=c.charCodeAt(0),p=fh(r.before.charCodeAt(r.before.length-1),d,i);p.inside&&(c=Dc(d)+c.slice(1));const h=c.charCodeAt(c.length-1),m=fh(r.after.charCodeAt(0),h,i);m.inside&&(c=c.slice(0,-1)+Dc(h));const v=a.move(i+i);return o(),n.attentionEncodeSurroundingInfo={after:m.outside,before:p.outside},u+c+v}function TF(e,t,n){return n.options.strong||"*"}function MF(e,t,n,r){return n.safe(e.value,r)}function DF(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function LF(e,t,n){const r=(pk(n)+(n.options.ruleSpaces?" ":"")).repeat(DF(n));return n.options.ruleSpaces?r.slice(0,-1):r}const mk={blockquote:rF,break:ok,code:uF,definition:fF,emphasis:ak,hardBreak:ok,heading:gF,html:sk,image:lk,imageReference:uk,inlineCode:ck,link:dk,linkReference:hk,list:CF,listItem:kF,paragraph:AF,root:RF,strong:gk,text:MF,thematicBreak:LF};function $F(){return{enter:{table:NF,tableData:vk,tableHeader:vk,tableRow:BF},exit:{codeText:FF,table:PF,tableData:Py,tableHeader:Py,tableRow:Py}}}function NF(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function PF(e){this.exit(e),this.data.inTable=void 0}function BF(e){this.enter({type:"tableRow",children:[]},e)}function Py(e){this.exit(e)}function vk(e){this.enter({type:"tableCell",children:[]},e)}function FF(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,UF));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function UF(e,t){return t==="|"?t:e}function zF(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
76
76
  `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:m,table:a,tableCell:c,tableRow:u}};function a(v,_,x,S){return d(p(v,x,S),v.align)}function u(v,_,x,S){const b=h(v,x,S),C=d([b]);return C.slice(0,C.indexOf(`
77
77
  `))}function c(v,_,x,S){const b=x.enter("tableCell"),C=x.enter("phrasing"),E=x.containerPhrasing(v,{...S,before:o,after:o});return C(),b(),E}function d(v,_){return tF(v,{align:_,alignDelimiters:r,padding:n,stringLength:i})}function p(v,_,x){const S=v.children;let b=-1;const C=[],E=_.enter("table");for(;++b<S.length;)C[b]=h(S[b],_,x);return E(),C}function h(v,_,x){const S=v.children;let b=-1;const C=[],E=_.enter("tableRow");for(;++b<S.length;)C[b]=c(S[b],v,_,x);return E(),C}function m(v,_,x){let S=mk.inlineCode(v,_,x);return x.stack.includes("tableCell")&&(S=S.replace(/\|/g,"\\$&")),S}}function qF(){return{exit:{taskListCheckValueChecked:yk,taskListCheckValueUnchecked:yk,paragraph:HF}}}function jF(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:GF}}}function yk(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function HF(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=t.children;let o=-1,a;for(;++o<i.length;){const u=i[o];if(u.type==="paragraph"){a=u;break}}a===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function GF(e,t,n,r){const i=e.children[0],o=typeof e.checked=="boolean"&&i&&i.type==="paragraph",a="["+(e.checked?"x":" ")+"] ",u=n.createTracker(r);o&&u.move(a);let c=mk.listItem(e,t,n,{...r,...u.current()});return o&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),c;function d(p){return p+a}}function VF(){return[C8(),G8(),W8(),$F(),qF()]}function ZF(e){return{extensions:[E8(),V8(e),K8(),zF(e),jF()]}}const YF={tokenize:eU,partial:!0},_k={tokenize:tU,partial:!0},bk={tokenize:nU,partial:!0},Sk={tokenize:rU,partial:!0},WF={tokenize:iU,partial:!0},wk={name:"wwwAutolink",tokenize:XF,previous:Ck},xk={name:"protocolAutolink",tokenize:JF,previous:Ek},Ro={name:"emailAutolink",tokenize:QF,previous:kk},Ji={};function KF(){return{text:Ji}}let Es=48;for(;Es<123;)Ji[Es]=Ro,Es++,Es===58?Es=65:Es===91&&(Es=97);Ji[43]=Ro,Ji[45]=Ro,Ji[46]=Ro,Ji[95]=Ro,Ji[72]=[Ro,xk],Ji[104]=[Ro,xk],Ji[87]=[Ro,wk],Ji[119]=[Ro,wk];function QF(e,t,n){const r=this;let i,o;return a;function a(h){return!By(h)||!kk.call(r,r.previous)||Fy(r.events)?n(h):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),u(h))}function u(h){return By(h)?(e.consume(h),u):h===64?(e.consume(h),c):n(h)}function c(h){return h===46?e.check(WF,p,d)(h):h===45||h===95||Sr(h)?(o=!0,e.consume(h),c):p(h)}function d(h){return e.consume(h),i=!0,c}function p(h){return o&&i&&Mr(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(h)):n(h)}}function XF(e,t,n){const r=this;return i;function i(a){return a!==87&&a!==119||!Ck.call(r,r.previous)||Fy(r.events)?n(a):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(YF,e.attempt(_k,e.attempt(bk,o),n),n)(a))}function o(a){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(a)}}function JF(e,t,n){const r=this;let i="",o=!1;return a;function a(h){return(h===72||h===104)&&Ek.call(r,r.previous)&&!Fy(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(h),e.consume(h),u):n(h)}function u(h){if(Mr(h)&&i.length<5)return i+=String.fromCodePoint(h),e.consume(h),u;if(h===58){const m=i.toLowerCase();if(m==="http"||m==="https")return e.consume(h),c}return n(h)}function c(h){return h===47?(e.consume(h),o?d:(o=!0,c)):n(h)}function d(h){return h===null||Jd(h)||rn(h)||Cs(h)||eh(h)?n(h):e.attempt(_k,e.attempt(bk,p),n)(h)}function p(h){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(h)}}function eU(e,t,n){let r=0;return i;function i(a){return(a===87||a===119)&&r<3?(r++,e.consume(a),i):a===46&&r===3?(e.consume(a),o):n(a)}function o(a){return a===null?n(a):t(a)}}function tU(e,t,n){let r,i,o;return a;function a(d){return d===46||d===95?e.check(Sk,c,u)(d):d===null||rn(d)||Cs(d)||d!==45&&eh(d)?c(d):(o=!0,e.consume(d),a)}function u(d){return d===95?r=!0:(i=r,r=void 0),e.consume(d),a}function c(d){return i||r||!o?n(d):t(d)}}function nU(e,t){let n=0,r=0;return i;function i(a){return a===40?(n++,e.consume(a),i):a===41&&r<n?o(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?e.check(Sk,t,o)(a):a===null||rn(a)||Cs(a)?t(a):(e.consume(a),i)}function o(a){return a===41&&r++,e.consume(a),i}}function rU(e,t,n){return r;function r(u){return u===33||u===34||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===63||u===95||u===126?(e.consume(u),r):u===38?(e.consume(u),o):u===93?(e.consume(u),i):u===60||u===null||rn(u)||Cs(u)?t(u):n(u)}function i(u){return u===null||u===40||u===91||rn(u)||Cs(u)?t(u):r(u)}function o(u){return Mr(u)?a(u):n(u)}function a(u){return u===59?(e.consume(u),r):Mr(u)?(e.consume(u),a):n(u)}}function iU(e,t,n){return r;function r(o){return e.consume(o),i}function i(o){return Sr(o)?n(o):t(o)}}function Ck(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||rn(e)}function Ek(e){return!Mr(e)}function kk(e){return!(e===47||By(e))}function By(e){return e===43||e===45||e===46||e===95||Sr(e)}function Fy(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const oU={tokenize:hU,partial:!0};function aU(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:cU,continuation:{tokenize:fU},exit:dU}},text:{91:{name:"gfmFootnoteCall",tokenize:uU},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:sU,resolveTo:lU}}}}function sU(e,t,n){const r=this;let i=r.events.length;const o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;i--;){const c=r.events[i][1];if(c.type==="labelImage"){a=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return u;function u(c){if(!a||!a._balanced)return n(c);const d=Bi(r.sliceSerialize({start:a.end,end:r.now()}));return d.codePointAt(0)!==94||!o.includes(d.slice(1))?n(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function lU(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},u=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",o,t],["enter",a,t],["exit",a,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...u),e}function uU(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o=0,a;return u;function u(h){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),c}function c(h){return h!==94?n(h):(e.enter("gfmFootnoteCallMarker"),e.consume(h),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",d)}function d(h){if(o>999||h===93&&!a||h===null||h===91||rn(h))return n(h);if(h===93){e.exit("chunkString");const m=e.exit("gfmFootnoteCallString");return i.includes(Bi(r.sliceSerialize(m)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(h)}return rn(h)||(a=!0),o++,e.consume(h),h===92?p:d}function p(h){return h===91||h===92||h===93?(e.consume(h),o++,d):d(h)}}function cU(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,a=0,u;return c;function c(_){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(_),e.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(_){return _===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(_),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",p):n(_)}function p(_){if(a>999||_===93&&!u||_===null||_===91||rn(_))return n(_);if(_===93){e.exit("chunkString");const x=e.exit("gfmFootnoteDefinitionLabelString");return o=Bi(r.sliceSerialize(x)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(_),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),m}return rn(_)||(u=!0),a++,e.consume(_),_===92?h:p}function h(_){return _===91||_===92||_===93?(e.consume(_),a++,p):p(_)}function m(_){return _===58?(e.enter("definitionMarker"),e.consume(_),e.exit("definitionMarker"),i.includes(o)||i.push(o),Pt(e,v,"gfmFootnoteDefinitionWhitespace")):n(_)}function v(_){return t(_)}}function fU(e,t,n){return e.check(Ac,t,e.attempt(oU,t,n))}function dU(e){e.exit("gfmFootnoteDefinition")}function hU(e,t,n){const r=this;return Pt(e,i,"gfmFootnoteDefinitionIndent",5);function i(o){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?t(o):n(o)}}function pU(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:o,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(a,u){let c=-1;for(;++c<a.length;)if(a[c][0]==="enter"&&a[c][1].type==="strikethroughSequenceTemporary"&&a[c][1]._close){let d=c;for(;d--;)if(a[d][0]==="exit"&&a[d][1].type==="strikethroughSequenceTemporary"&&a[d][1]._open&&a[c][1].end.offset-a[c][1].start.offset===a[d][1].end.offset-a[d][1].start.offset){a[c][1].type="strikethroughSequence",a[d][1].type="strikethroughSequence";const p={type:"strikethrough",start:Object.assign({},a[d][1].start),end:Object.assign({},a[c][1].end)},h={type:"strikethroughText",start:Object.assign({},a[d][1].end),end:Object.assign({},a[c][1].start)},m=[["enter",p,u],["enter",a[d][1],u],["exit",a[d][1],u],["enter",h,u]],v=u.parser.constructs.insideSpan.null;v&&ti(m,m.length,0,th(v,a.slice(d+1,c),u)),ti(m,m.length,0,[["exit",h,u],["enter",a[c][1],u],["exit",a[c][1],u],["exit",p,u]]),ti(a,d-1,c-d+3,m),c=d+m.length-2;break}}for(c=-1;++c<a.length;)a[c][1].type==="strikethroughSequenceTemporary"&&(a[c][1].type="data");return a}function o(a,u,c){const d=this.previous,p=this.events;let h=0;return m;function m(_){return d===126&&p[p.length-1][1].type!=="characterEscape"?c(_):(a.enter("strikethroughSequenceTemporary"),v(_))}function v(_){const x=Sl(d);if(_===126)return h>1?c(_):(a.consume(_),h++,v);if(h<2&&!n)return c(_);const S=a.exit("strikethroughSequenceTemporary"),b=Sl(_);return S._open=!b||b===2&&!!x,S._close=!x||x===2&&!!b,u(_)}}}class gU{constructor(){this.map=[]}add(t,n,r){mU(this,t,n,r)}consume(t){if(this.map.sort(function(o,a){return o[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const o of i)t.push(o);i=r.pop()}this.map.length=0}}function mU(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function vU(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const o=r.length-1;r[o]=r[o]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function yU(){return{flow:{null:{name:"table",tokenize:_U,resolveAll:bU}}}}function _U(e,t,n){const r=this;let i=0,o=0,a;return u;function u(P){let G=r.events.length-1;for(;G>-1;){const V=r.events[G][1].type;if(V==="lineEnding"||V==="linePrefix")G--;else break}const X=G>-1?r.events[G][1].type:null,se=X==="tableHead"||X==="tableRow"?T:c;return se===T&&r.parser.lazy[r.now().line]?n(P):se(P)}function c(P){return e.enter("tableHead"),e.enter("tableRow"),d(P)}function d(P){return P===124||(a=!0,o+=1),p(P)}function p(P){return P===null?n(P):at(P)?o>1?(o=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),v):n(P):It(P)?Pt(e,p,"whitespace")(P):(o+=1,a&&(a=!1,i+=1),P===124?(e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),a=!0,p):(e.enter("data"),h(P)))}function h(P){return P===null||P===124||rn(P)?(e.exit("data"),p(P)):(e.consume(P),P===92?m:h)}function m(P){return P===92||P===124?(e.consume(P),h):h(P)}function v(P){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(P):(e.enter("tableDelimiterRow"),a=!1,It(P)?Pt(e,_,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):_(P))}function _(P){return P===45||P===58?S(P):P===124?(a=!0,e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),x):O(P)}function x(P){return It(P)?Pt(e,S,"whitespace")(P):S(P)}function S(P){return P===58?(o+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(P),e.exit("tableDelimiterMarker"),b):P===45?(o+=1,b(P)):P===null||at(P)?I(P):O(P)}function b(P){return P===45?(e.enter("tableDelimiterFiller"),C(P)):O(P)}function C(P){return P===45?(e.consume(P),C):P===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(P),e.exit("tableDelimiterMarker"),E):(e.exit("tableDelimiterFiller"),E(P))}function E(P){return It(P)?Pt(e,I,"whitespace")(P):I(P)}function I(P){return P===124?_(P):P===null||at(P)?!a||i!==o?O(P):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(P)):O(P)}function O(P){return n(P)}function T(P){return e.enter("tableRow"),$(P)}function $(P){return P===124?(e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),$):P===null||at(P)?(e.exit("tableRow"),t(P)):It(P)?Pt(e,$,"whitespace")(P):(e.enter("data"),F(P))}function F(P){return P===null||P===124||rn(P)?(e.exit("data"),$(P)):(e.consume(P),P===92?q:F)}function q(P){return P===92||P===124?(e.consume(P),F):F(P)}}function bU(e,t){let n=-1,r=!0,i=0,o=[0,0,0,0],a=[0,0,0,0],u=!1,c=0,d,p,h;const m=new gU;for(;++n<e.length;){const v=e[n],_=v[1];v[0]==="enter"?_.type==="tableHead"?(u=!1,c!==0&&(Ak(m,t,c,d,p),p=void 0,c=0),d={type:"table",start:Object.assign({},_.start),end:Object.assign({},_.end)},m.add(n,0,[["enter",d,t]])):_.type==="tableRow"||_.type==="tableDelimiterRow"?(r=!0,h=void 0,o=[0,0,0,0],a=[0,n+1,0,0],u&&(u=!1,p={type:"tableBody",start:Object.assign({},_.start),end:Object.assign({},_.end)},m.add(n,0,[["enter",p,t]])),i=_.type==="tableDelimiterRow"?2:p?3:1):i&&(_.type==="data"||_.type==="tableDelimiterMarker"||_.type==="tableDelimiterFiller")?(r=!1,a[2]===0&&(o[1]!==0&&(a[0]=a[1],h=dh(m,t,o,i,void 0,h),o=[0,0,0,0]),a[2]=n)):_.type==="tableCellDivider"&&(r?r=!1:(o[1]!==0&&(a[0]=a[1],h=dh(m,t,o,i,void 0,h)),o=a,a=[o[1],n,0,0])):_.type==="tableHead"?(u=!0,c=n):_.type==="tableRow"||_.type==="tableDelimiterRow"?(c=n,o[1]!==0?(a[0]=a[1],h=dh(m,t,o,i,n,h)):a[1]!==0&&(h=dh(m,t,a,i,n,h)),i=0):i&&(_.type==="data"||_.type==="tableDelimiterMarker"||_.type==="tableDelimiterFiller")&&(a[3]=n)}for(c!==0&&Ak(m,t,c,d,p),m.consume(t.events),n=-1;++n<t.events.length;){const v=t.events[n];v[0]==="enter"&&v[1].type==="table"&&(v[1]._align=vU(t.events,n))}return e}function dh(e,t,n,r,i,o){const a=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",u="tableContent";n[0]!==0&&(o.end=Object.assign({},xl(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const c=xl(t.events,n[1]);if(o={type:a,start:Object.assign({},c),end:Object.assign({},c)},e.add(n[1],0,[["enter",o,t]]),n[2]!==0){const d=xl(t.events,n[2]),p=xl(t.events,n[3]),h={type:u,start:Object.assign({},d),end:Object.assign({},p)};if(e.add(n[2],0,[["enter",h,t]]),r!==2){const m=t.events[n[2]],v=t.events[n[3]];if(m[1].end=Object.assign({},v[1].end),m[1].type="chunkText",m[1].contentType="text",n[3]>n[2]+1){const _=n[2]+1,x=n[3]-n[2]-1;e.add(_,x,[])}}e.add(n[3]+1,0,[["exit",h,t]])}return i!==void 0&&(o.end=Object.assign({},xl(t.events,i)),e.add(i,0,[["exit",o,t]]),o=void 0),o}function Ak(e,t,n,r,i){const o=[],a=xl(t.events,n);i&&(i.end=Object.assign({},a),o.push(["exit",i,t])),r.end=Object.assign({},a),o.push(["exit",r,t]),e.add(n+1,0,o)}function xl(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const SU={name:"tasklistCheck",tokenize:xU};function wU(){return{text:{91:SU}}}function xU(e,t,n){const r=this;return i;function i(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),o)}function o(c){return rn(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),a):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),a):n(c)}function a(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),u):n(c)}function u(c){return at(c)?t(c):It(c)?e.check({tokenize:CU},t,n)(c):n(c)}}function CU(e,t,n){return Pt(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function EU(e){return aE([KF(),aU(),pU(e),yU(),wU()])}const kU={};function AU(e){const t=this,n=e||kU,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),o=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(EU(n)),o.push(VF()),a.push(ZF(n))}var nr=function(){return nr=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},nr.apply(this,arguments)};function Lc(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}typeof SuppressedError=="function"&&SuppressedError;var Uy,Ik;function IU(){return Ik||(Ik=1,Uy=function(t,n,r,i){var o=r?r.call(i,t,n):void 0;if(o!==void 0)return!!o;if(t===n)return!0;if(typeof t!="object"||!t||typeof n!="object"||!n)return!1;var a=Object.keys(t),u=Object.keys(n);if(a.length!==u.length)return!1;for(var c=Object.prototype.hasOwnProperty.bind(n),d=0;d<a.length;d++){var p=a[d];if(!c(p))return!1;var h=t[p],m=n[p];if(o=r?r.call(i,h,m,p):void 0,o===!1||o===void 0&&h!==m)return!1}return!0}),Uy}var RU=IU();const OU=hi(RU);var dn="-ms-",$c="-moz-",Vt="-webkit-",Rk="comm",hh="rule",zy="decl",TU="@import",Ok="@keyframes",MU="@layer",Tk=Math.abs,qy=String.fromCharCode,jy=Object.assign;function DU(e,t){return rr(e,0)^45?(((t<<2^rr(e,0))<<2^rr(e,1))<<2^rr(e,2))<<2^rr(e,3):0}function Mk(e){return e.trim()}function Oo(e,t){return(e=t.exec(e))?e[0]:e}function bt(e,t,n){return e.replace(t,n)}function ph(e,t,n){return e.indexOf(t,n)}function rr(e,t){return e.charCodeAt(t)|0}function Cl(e,t,n){return e.slice(t,n)}function eo(e){return e.length}function Dk(e){return e.length}function Nc(e,t){return t.push(e),e}function LU(e,t){return e.map(t).join("")}function Lk(e,t){return e.filter(function(n){return!Oo(n,t)})}var gh=1,El=1,$k=0,gi=0,zn=0,kl="";function mh(e,t,n,r,i,o,a,u){return{value:e,root:t,parent:n,type:r,props:i,children:o,line:gh,column:El,length:a,return:"",siblings:u}}function ba(e,t){return jy(mh("",null,null,"",null,null,0,e.siblings),e,{length:-e.length},t)}function Al(e){for(;e.root;)e=ba(e.root,{children:[e]});Nc(e,e.siblings)}function $U(){return zn}function NU(){return zn=gi>0?rr(kl,--gi):0,El--,zn===10&&(El=1,gh--),zn}function Fi(){return zn=gi<$k?rr(kl,gi++):0,El++,zn===10&&(El=1,gh++),zn}function ks(){return rr(kl,gi)}function vh(){return gi}function yh(e,t){return Cl(kl,e,t)}function Hy(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function PU(e){return gh=El=1,$k=eo(kl=e),gi=0,[]}function BU(e){return kl="",e}function Gy(e){return Mk(yh(gi-1,Vy(e===91?e+2:e===40?e+1:e)))}function FU(e){for(;(zn=ks())&&zn<33;)Fi();return Hy(e)>2||Hy(zn)>3?"":" "}function UU(e,t){for(;--t&&Fi()&&!(zn<48||zn>102||zn>57&&zn<65||zn>70&&zn<97););return yh(e,vh()+(t<6&&ks()==32&&Fi()==32))}function Vy(e){for(;Fi();)switch(zn){case e:return gi;case 34:case 39:e!==34&&e!==39&&Vy(zn);break;case 40:e===41&&Vy(e);break;case 92:Fi();break}return gi}function zU(e,t){for(;Fi()&&e+zn!==57;)if(e+zn===84&&ks()===47)break;return"/*"+yh(t,gi-1)+"*"+qy(e===47?e:Fi())}function qU(e){for(;!Hy(ks());)Fi();return yh(e,gi)}function jU(e){return BU(_h("",null,null,null,[""],e=PU(e),0,[0],e))}function _h(e,t,n,r,i,o,a,u,c){for(var d=0,p=0,h=a,m=0,v=0,_=0,x=1,S=1,b=1,C=0,E="",I=i,O=o,T=r,$=E;S;)switch(_=C,C=Fi()){case 40:if(_!=108&&rr($,h-1)==58){ph($+=bt(Gy(C),"&","&\f"),"&\f",Tk(d?u[d-1]:0))!=-1&&(b=-1);break}case 34:case 39:case 91:$+=Gy(C);break;case 9:case 10:case 13:case 32:$+=FU(_);break;case 92:$+=UU(vh()-1,7);continue;case 47:switch(ks()){case 42:case 47:Nc(HU(zU(Fi(),vh()),t,n,c),c);break;default:$+="/"}break;case 123*x:u[d++]=eo($)*b;case 125*x:case 59:case 0:switch(C){case 0:case 125:S=0;case 59+p:b==-1&&($=bt($,/\f/g,"")),v>0&&eo($)-h&&Nc(v>32?Pk($+";",r,n,h-1,c):Pk(bt($," ","")+";",r,n,h-2,c),c);break;case 59:$+=";";default:if(Nc(T=Nk($,t,n,d,p,i,u,E,I=[],O=[],h,o),o),C===123)if(p===0)_h($,t,T,T,I,o,h,u,O);else switch(m===99&&rr($,3)===110?100:m){case 100:case 108:case 109:case 115:_h(e,T,T,r&&Nc(Nk(e,T,T,0,0,i,u,E,i,I=[],h,O),O),i,O,h,u,r?I:O);break;default:_h($,T,T,T,[""],O,0,u,O)}}d=p=v=0,x=b=1,E=$="",h=a;break;case 58:h=1+eo($),v=_;default:if(x<1){if(C==123)--x;else if(C==125&&x++==0&&NU()==125)continue}switch($+=qy(C),C*x){case 38:b=p>0?1:($+="\f",-1);break;case 44:u[d++]=(eo($)-1)*b,b=1;break;case 64:ks()===45&&($+=Gy(Fi())),m=ks(),p=h=eo(E=$+=qU(vh())),C++;break;case 45:_===45&&eo($)==2&&(x=0)}}return o}function Nk(e,t,n,r,i,o,a,u,c,d,p,h){for(var m=i-1,v=i===0?o:[""],_=Dk(v),x=0,S=0,b=0;x<r;++x)for(var C=0,E=Cl(e,m+1,m=Tk(S=a[x])),I=e;C<_;++C)(I=Mk(S>0?v[C]+" "+E:bt(E,/&\f/g,v[C])))&&(c[b++]=I);return mh(e,t,n,i===0?hh:u,c,d,p,h)}function HU(e,t,n,r){return mh(e,t,n,Rk,qy($U()),Cl(e,2,-2),0,r)}function Pk(e,t,n,r,i){return mh(e,t,n,zy,Cl(e,0,r),Cl(e,r+1,-1),r,i)}function Bk(e,t,n){switch(DU(e,t)){case 5103:return Vt+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return Vt+e+e;case 4789:return $c+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return Vt+e+$c+e+dn+e+e;case 5936:switch(rr(e,t+11)){case 114:return Vt+e+dn+bt(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return Vt+e+dn+bt(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return Vt+e+dn+bt(e,/[svh]\w+-[tblr]{2}/,"lr")+e}case 6828:case 4268:case 2903:return Vt+e+dn+e+e;case 6165:return Vt+e+dn+"flex-"+e+e;case 5187:return Vt+e+bt(e,/(\w+).+(:[^]+)/,Vt+"box-$1$2"+dn+"flex-$1$2")+e;case 5443:return Vt+e+dn+"flex-item-"+bt(e,/flex-|-self/g,"")+(Oo(e,/flex-|baseline/)?"":dn+"grid-row-"+bt(e,/flex-|-self/g,""))+e;case 4675:return Vt+e+dn+"flex-line-pack"+bt(e,/align-content|flex-|-self/g,"")+e;case 5548:return Vt+e+dn+bt(e,"shrink","negative")+e;case 5292:return Vt+e+dn+bt(e,"basis","preferred-size")+e;case 6060:return Vt+"box-"+bt(e,"-grow","")+Vt+e+dn+bt(e,"grow","positive")+e;case 4554:return Vt+bt(e,/([^-])(transform)/g,"$1"+Vt+"$2")+e;case 6187:return bt(bt(bt(e,/(zoom-|grab)/,Vt+"$1"),/(image-set)/,Vt+"$1"),e,"")+e;case 5495:case 3959:return bt(e,/(image-set\([^]*)/,Vt+"$1$`$1");case 4968:return bt(bt(e,/(.+:)(flex-)?(.*)/,Vt+"box-pack:$3"+dn+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Vt+e+e;case 4200:if(!Oo(e,/flex-|baseline/))return dn+"grid-column-align"+Cl(e,t)+e;break;case 2592:case 3360:return dn+bt(e,"template-","")+e;case 4384:case 3616:return n&&n.some(function(r,i){return t=i,Oo(r.props,/grid-\w+-end/)})?~ph(e+(n=n[t].value),"span",0)?e:dn+bt(e,"-start","")+e+dn+"grid-row-span:"+(~ph(n,"span",0)?Oo(n,/\d+/):+Oo(n,/\d+/)-+Oo(e,/\d+/))+";":dn+bt(e,"-start","")+e;case 4896:case 4128:return n&&n.some(function(r){return Oo(r.props,/grid-\w+-start/)})?e:dn+bt(bt(e,"-end","-span"),"span ","")+e;case 4095:case 3583:case 4068:case 2532:return bt(e,/(.+)-inline(.+)/,Vt+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(eo(e)-1-t>6)switch(rr(e,t+1)){case 109:if(rr(e,t+4)!==45)break;case 102:return bt(e,/(.+:)(.+)-([^]+)/,"$1"+Vt+"$2-$3$1"+$c+(rr(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~ph(e,"stretch",0)?Bk(bt(e,"stretch","fill-available"),t,n)+e:e}break;case 5152:case 5920:return bt(e,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,function(r,i,o,a,u,c,d){return dn+i+":"+o+d+(a?dn+i+"-span:"+(u?c:+c-+o)+d:"")+e});case 4949:if(rr(e,t+6)===121)return bt(e,":",":"+Vt)+e;break;case 6444:switch(rr(e,rr(e,14)===45?18:11)){case 120:return bt(e,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+Vt+(rr(e,14)===45?"inline-":"")+"box$3$1"+Vt+"$2$3$1"+dn+"$2box$3")+e;case 100:return bt(e,":",":"+dn)+e}break;case 5719:case 2647:case 2135:case 3927:case 2391:return bt(e,"scroll-","scroll-snap-")+e}return e}function bh(e,t){for(var n="",r=0;r<e.length;r++)n+=t(e[r],r,e,t)||"";return n}function GU(e,t,n,r){switch(e.type){case MU:if(e.children.length)break;case TU:case zy:return e.return=e.return||e.value;case Rk:return"";case Ok:return e.return=e.value+"{"+bh(e.children,r)+"}";case hh:if(!eo(e.value=e.props.join(",")))return""}return eo(n=bh(e.children,r))?e.return=e.value+"{"+n+"}":""}function VU(e){var t=Dk(e);return function(n,r,i,o){for(var a="",u=0;u<t;u++)a+=e[u](n,r,i,o)||"";return a}}function ZU(e){return function(t){t.root||(t=t.return)&&e(t)}}function YU(e,t,n,r){if(e.length>-1&&!e.return)switch(e.type){case zy:e.return=Bk(e.value,e.length,n);return;case Ok:return bh([ba(e,{value:bt(e.value,"@","@"+Vt)})],r);case hh:if(e.length)return LU(n=e.props,function(i){switch(Oo(i,r=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":Al(ba(e,{props:[bt(i,/:(read-\w+)/,":"+$c+"$1")]})),Al(ba(e,{props:[i]})),jy(e,{props:Lk(n,r)});break;case"::placeholder":Al(ba(e,{props:[bt(i,/:(plac\w+)/,":"+Vt+"input-$1")]})),Al(ba(e,{props:[bt(i,/:(plac\w+)/,":"+$c+"$1")]})),Al(ba(e,{props:[bt(i,/:(plac\w+)/,dn+"input-$1")]})),Al(ba(e,{props:[i]})),jy(e,{props:Lk(n,r)});break}return""})}}var WU={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},wr={NODE_ENV:"production"},Il=typeof process<"u"&&wr!==void 0&&(wr.REACT_APP_SC_ATTR||wr.SC_ATTR)||"data-styled",Fk="active",Uk="data-styled-version",Sh="6.1.17",Zy=`/*!sc*/
78
- `,wh=typeof window<"u"&&"HTMLElement"in window,KU=!!(typeof SC_DISABLE_SPEEDY=="boolean"?SC_DISABLE_SPEEDY:typeof process<"u"&&wr!==void 0&&wr.REACT_APP_SC_DISABLE_SPEEDY!==void 0&&wr.REACT_APP_SC_DISABLE_SPEEDY!==""?wr.REACT_APP_SC_DISABLE_SPEEDY!=="false"&&wr.REACT_APP_SC_DISABLE_SPEEDY:typeof process<"u"&&wr!==void 0&&wr.SC_DISABLE_SPEEDY!==void 0&&wr.SC_DISABLE_SPEEDY!==""?wr.SC_DISABLE_SPEEDY!=="false"&&wr.SC_DISABLE_SPEEDY:wr.NODE_ENV!=="production"),QU={},xh=Object.freeze([]),Rl=Object.freeze({});function zk(e,t,n){return n===void 0&&(n=Rl),e.theme!==n.theme&&e.theme||t||n.theme}var qk=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track","u","ul","use","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"]),XU=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,JU=/(^-|-$)/g;function jk(e){return e.replace(XU,"-").replace(JU,"")}var ez=/(a)(d)/gi,Ch=52,Hk=function(e){return String.fromCharCode(e+(e>25?39:97))};function Yy(e){var t,n="";for(t=Math.abs(e);t>Ch;t=t/Ch|0)n=Hk(t%Ch)+n;return(Hk(t%Ch)+n).replace(ez,"$1-$2")}var Wy,Gk=5381,Ol=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},Vk=function(e){return Ol(Gk,e)};function Zk(e){return Yy(Vk(e)>>>0)}function tz(e){return e.displayName||e.name||"Component"}function Ky(e){return typeof e=="string"&&wr.NODE_ENV==="production"}var Yk=typeof Symbol=="function"&&Symbol.for,Wk=Yk?Symbol.for("react.memo"):60115,nz=Yk?Symbol.for("react.forward_ref"):60112,rz={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},iz={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},Kk={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},oz=((Wy={})[nz]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},Wy[Wk]=Kk,Wy);function Qk(e){return("type"in(t=e)&&t.type.$$typeof)===Wk?Kk:"$$typeof"in e?oz[e.$$typeof]:rz;var t}var az=Object.defineProperty,sz=Object.getOwnPropertyNames,Xk=Object.getOwnPropertySymbols,lz=Object.getOwnPropertyDescriptor,uz=Object.getPrototypeOf,Jk=Object.prototype;function eA(e,t,n){if(typeof t!="string"){if(Jk){var r=uz(t);r&&r!==Jk&&eA(e,r,n)}var i=sz(t);Xk&&(i=i.concat(Xk(t)));for(var o=Qk(e),a=Qk(t),u=0;u<i.length;++u){var c=i[u];if(!(c in iz||n&&n[c]||a&&c in a||o&&c in o)){var d=lz(t,c);try{az(e,c,d)}catch{}}}}return e}function As(e){return typeof e=="function"}function Qy(e){return typeof e=="object"&&"styledComponentId"in e}function Is(e,t){return e&&t?"".concat(e," ").concat(t):e||t||""}function Xy(e,t){if(e.length===0)return"";for(var n=e[0],r=1;r<e.length;r++)n+=e[r];return n}function Pc(e){return e!==null&&typeof e=="object"&&e.constructor.name===Object.name&&!("props"in e&&e.$$typeof)}function Jy(e,t,n){if(n===void 0&&(n=!1),!n&&!Pc(e)&&!Array.isArray(e))return t;if(Array.isArray(t))for(var r=0;r<t.length;r++)e[r]=Jy(e[r],t[r]);else if(Pc(t))for(var r in t)e[r]=Jy(e[r],t[r]);return e}function e_(e,t){Object.defineProperty(e,"toString",{value:t})}function Rs(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(e," for more information.").concat(t.length>0?" Args: ".concat(t.join(", ")):""))}var cz=function(){function e(t){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=t}return e.prototype.indexOfGroup=function(t){for(var n=0,r=0;r<t;r++)n+=this.groupSizes[r];return n},e.prototype.insertRules=function(t,n){if(t>=this.groupSizes.length){for(var r=this.groupSizes,i=r.length,o=i;t>=o;)if((o<<=1)<0)throw Rs(16,"".concat(t));this.groupSizes=new Uint32Array(o),this.groupSizes.set(r),this.length=o;for(var a=i;a<o;a++)this.groupSizes[a]=0}for(var u=this.indexOfGroup(t+1),c=(a=0,n.length);a<c;a++)this.tag.insertRule(u,n[a])&&(this.groupSizes[t]++,u++)},e.prototype.clearGroup=function(t){if(t<this.length){var n=this.groupSizes[t],r=this.indexOfGroup(t),i=r+n;this.groupSizes[t]=0;for(var o=r;o<i;o++)this.tag.deleteRule(r)}},e.prototype.getGroup=function(t){var n="";if(t>=this.length||this.groupSizes[t]===0)return n;for(var r=this.groupSizes[t],i=this.indexOfGroup(t),o=i+r,a=i;a<o;a++)n+="".concat(this.tag.getRule(a)).concat(Zy);return n},e}(),Eh=new Map,kh=new Map,Ah=1,Ih=function(e){if(Eh.has(e))return Eh.get(e);for(;kh.has(Ah);)Ah++;var t=Ah++;return Eh.set(e,t),kh.set(t,e),t},fz=function(e,t){Ah=t+1,Eh.set(e,t),kh.set(t,e)},dz="style[".concat(Il,"][").concat(Uk,'="').concat(Sh,'"]'),hz=new RegExp("^".concat(Il,'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')),pz=function(e,t,n){for(var r,i=n.split(","),o=0,a=i.length;o<a;o++)(r=i[o])&&e.registerName(t,r)},gz=function(e,t){for(var n,r=((n=t.textContent)!==null&&n!==void 0?n:"").split(Zy),i=[],o=0,a=r.length;o<a;o++){var u=r[o].trim();if(u){var c=u.match(hz);if(c){var d=0|parseInt(c[1],10),p=c[2];d!==0&&(fz(p,d),pz(e,p,c[3]),e.getTag().insertRules(d,i)),i.length=0}else i.push(u)}}},tA=function(e){for(var t=document.querySelectorAll(dz),n=0,r=t.length;n<r;n++){var i=t[n];i&&i.getAttribute(Il)!==Fk&&(gz(e,i),i.parentNode&&i.parentNode.removeChild(i))}};function mz(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:null}var nA=function(e){var t=document.head,n=e||t,r=document.createElement("style"),i=function(u){var c=Array.from(u.querySelectorAll("style[".concat(Il,"]")));return c[c.length-1]}(n),o=i!==void 0?i.nextSibling:null;r.setAttribute(Il,Fk),r.setAttribute(Uk,Sh);var a=mz();return a&&r.setAttribute("nonce",a),n.insertBefore(r,o),r},vz=function(){function e(t){this.element=nA(t),this.element.appendChild(document.createTextNode("")),this.sheet=function(n){if(n.sheet)return n.sheet;for(var r=document.styleSheets,i=0,o=r.length;i<o;i++){var a=r[i];if(a.ownerNode===n)return a}throw Rs(17)}(this.element),this.length=0}return e.prototype.insertRule=function(t,n){try{return this.sheet.insertRule(n,t),this.length++,!0}catch{return!1}},e.prototype.deleteRule=function(t){this.sheet.deleteRule(t),this.length--},e.prototype.getRule=function(t){var n=this.sheet.cssRules[t];return n&&n.cssText?n.cssText:""},e}(),yz=function(){function e(t){this.element=nA(t),this.nodes=this.element.childNodes,this.length=0}return e.prototype.insertRule=function(t,n){if(t<=this.length&&t>=0){var r=document.createTextNode(n);return this.element.insertBefore(r,this.nodes[t]||null),this.length++,!0}return!1},e.prototype.deleteRule=function(t){this.element.removeChild(this.nodes[t]),this.length--},e.prototype.getRule=function(t){return t<this.length?this.nodes[t].textContent:""},e}(),_z=function(){function e(t){this.rules=[],this.length=0}return e.prototype.insertRule=function(t,n){return t<=this.length&&(this.rules.splice(t,0,n),this.length++,!0)},e.prototype.deleteRule=function(t){this.rules.splice(t,1),this.length--},e.prototype.getRule=function(t){return t<this.length?this.rules[t]:""},e}(),rA=wh,bz={isServer:!wh,useCSSOMInjection:!KU},Rh=function(){function e(t,n,r){t===void 0&&(t=Rl),n===void 0&&(n={});var i=this;this.options=nr(nr({},bz),t),this.gs=n,this.names=new Map(r),this.server=!!t.isServer,!this.server&&wh&&rA&&(rA=!1,tA(this)),e_(this,function(){return function(o){for(var a=o.getTag(),u=a.length,c="",d=function(h){var m=function(b){return kh.get(b)}(h);if(m===void 0)return"continue";var v=o.names.get(m),_=a.getGroup(h);if(v===void 0||!v.size||_.length===0)return"continue";var x="".concat(Il,".g").concat(h,'[id="').concat(m,'"]'),S="";v!==void 0&&v.forEach(function(b){b.length>0&&(S+="".concat(b,","))}),c+="".concat(_).concat(x,'{content:"').concat(S,'"}').concat(Zy)},p=0;p<u;p++)d(p);return c}(i)})}return e.registerId=function(t){return Ih(t)},e.prototype.rehydrate=function(){!this.server&&wh&&tA(this)},e.prototype.reconstructWithOptions=function(t,n){return n===void 0&&(n=!0),new e(nr(nr({},this.options),t),this.gs,n&&this.names||void 0)},e.prototype.allocateGSInstance=function(t){return this.gs[t]=(this.gs[t]||0)+1},e.prototype.getTag=function(){return this.tag||(this.tag=(t=function(n){var r=n.useCSSOMInjection,i=n.target;return n.isServer?new _z(i):r?new vz(i):new yz(i)}(this.options),new cz(t)));var t},e.prototype.hasNameForId=function(t,n){return this.names.has(t)&&this.names.get(t).has(n)},e.prototype.registerName=function(t,n){if(Ih(t),this.names.has(t))this.names.get(t).add(n);else{var r=new Set;r.add(n),this.names.set(t,r)}},e.prototype.insertRules=function(t,n,r){this.registerName(t,n),this.getTag().insertRules(Ih(t),r)},e.prototype.clearNames=function(t){this.names.has(t)&&this.names.get(t).clear()},e.prototype.clearRules=function(t){this.getTag().clearGroup(Ih(t)),this.clearNames(t)},e.prototype.clearTag=function(){this.tag=void 0},e}(),Sz=/&/g,wz=/^\s*\/\/.*$/gm;function iA(e,t){return e.map(function(n){return n.type==="rule"&&(n.value="".concat(t," ").concat(n.value),n.value=n.value.replaceAll(",",",".concat(t," ")),n.props=n.props.map(function(r){return"".concat(t," ").concat(r)})),Array.isArray(n.children)&&n.type!=="@keyframes"&&(n.children=iA(n.children,t)),n})}function oA(e){var t,n,r,i=e===void 0?Rl:e,o=i.options,a=o===void 0?Rl:o,u=i.plugins,c=u===void 0?xh:u,d=function(m,v,_){return _.startsWith(n)&&_.endsWith(n)&&_.replaceAll(n,"").length>0?".".concat(t):m},p=c.slice();p.push(function(m){m.type===hh&&m.value.includes("&")&&(m.props[0]=m.props[0].replace(Sz,n).replace(r,d))}),a.prefix&&p.push(YU),p.push(GU);var h=function(m,v,_,x){v===void 0&&(v=""),_===void 0&&(_=""),x===void 0&&(x="&"),t=x,n=v,r=new RegExp("\\".concat(n,"\\b"),"g");var S=m.replace(wz,""),b=jU(_||v?"".concat(_," ").concat(v," { ").concat(S," }"):S);a.namespace&&(b=iA(b,a.namespace));var C=[];return bh(b,VU(p.concat(ZU(function(E){return C.push(E)})))),C};return h.hash=c.length?c.reduce(function(m,v){return v.name||Rs(15),Ol(m,v.name)},Gk).toString():"",h}var xz=new Rh,t_=oA(),n_=Dn.createContext({shouldForwardProp:void 0,styleSheet:xz,stylis:t_});n_.Consumer;var Cz=Dn.createContext(void 0);function Oh(){return Y.useContext(n_)}function Ez(e){var t=Y.useState(e.stylisPlugins),n=t[0],r=t[1],i=Oh().styleSheet,o=Y.useMemo(function(){var c=i;return e.sheet?c=e.sheet:e.target&&(c=c.reconstructWithOptions({target:e.target},!1)),e.disableCSSOMInjection&&(c=c.reconstructWithOptions({useCSSOMInjection:!1})),c},[e.disableCSSOMInjection,e.sheet,e.target,i]),a=Y.useMemo(function(){return oA({options:{namespace:e.namespace,prefix:e.enableVendorPrefixes},plugins:n})},[e.enableVendorPrefixes,e.namespace,n]);Y.useEffect(function(){OU(n,e.stylisPlugins)||r(e.stylisPlugins)},[e.stylisPlugins]);var u=Y.useMemo(function(){return{shouldForwardProp:e.shouldForwardProp,styleSheet:o,stylis:a}},[e.shouldForwardProp,o,a]);return Dn.createElement(n_.Provider,{value:u},Dn.createElement(Cz.Provider,{value:a},e.children))}var kz=function(){function e(t,n){var r=this;this.inject=function(i,o){o===void 0&&(o=t_);var a=r.name+o.hash;i.hasNameForId(r.id,a)||i.insertRules(r.id,a,o(r.rules,a,"@keyframes"))},this.name=t,this.id="sc-keyframes-".concat(t),this.rules=n,e_(this,function(){throw Rs(12,String(r.name))})}return e.prototype.getName=function(t){return t===void 0&&(t=t_),this.name+t.hash},e}(),Az=function(e){return e>="A"&&e<="Z"};function aA(e){for(var t="",n=0;n<e.length;n++){var r=e[n];if(n===1&&r==="-"&&e[0]==="-")return e;Az(r)?t+="-"+r.toLowerCase():t+=r}return t.startsWith("ms-")?"-"+t:t}var sA=function(e){return e==null||e===!1||e===""},lA=function(e){var t,n,r=[];for(var i in e){var o=e[i];e.hasOwnProperty(i)&&!sA(o)&&(Array.isArray(o)&&o.isCss||As(o)?r.push("".concat(aA(i),":"),o,";"):Pc(o)?r.push.apply(r,Lc(Lc(["".concat(i," {")],lA(o),!1),["}"],!1)):r.push("".concat(aA(i),": ").concat((t=i,(n=o)==null||typeof n=="boolean"||n===""?"":typeof n!="number"||n===0||t in WU||t.startsWith("--")?String(n).trim():"".concat(n,"px")),";")))}return r};function Sa(e,t,n,r){if(sA(e))return[];if(Qy(e))return[".".concat(e.styledComponentId)];if(As(e)){if(!As(o=e)||o.prototype&&o.prototype.isReactComponent||!t)return[e];var i=e(t);return Sa(i,t,n,r)}var o;return e instanceof kz?n?(e.inject(n,r),[e.getName(r)]):[e]:Pc(e)?lA(e):Array.isArray(e)?Array.prototype.concat.apply(xh,e.map(function(a){return Sa(a,t,n,r)})):[e.toString()]}function uA(e){for(var t=0;t<e.length;t+=1){var n=e[t];if(As(n)&&!Qy(n))return!1}return!0}var Iz=Vk(Sh),Rz=function(){function e(t,n,r){this.rules=t,this.staticRulesId="",this.isStatic=(r===void 0||r.isStatic)&&uA(t),this.componentId=n,this.baseHash=Ol(Iz,n),this.baseStyle=r,Rh.registerId(n)}return e.prototype.generateAndInjectStyles=function(t,n,r){var i=this.baseStyle?this.baseStyle.generateAndInjectStyles(t,n,r):"";if(this.isStatic&&!r.hash)if(this.staticRulesId&&n.hasNameForId(this.componentId,this.staticRulesId))i=Is(i,this.staticRulesId);else{var o=Xy(Sa(this.rules,t,n,r)),a=Yy(Ol(this.baseHash,o)>>>0);if(!n.hasNameForId(this.componentId,a)){var u=r(o,".".concat(a),void 0,this.componentId);n.insertRules(this.componentId,a,u)}i=Is(i,a),this.staticRulesId=a}else{for(var c=Ol(this.baseHash,r.hash),d="",p=0;p<this.rules.length;p++){var h=this.rules[p];if(typeof h=="string")d+=h;else if(h){var m=Xy(Sa(h,t,n,r));c=Ol(c,m+p),d+=m}}if(d){var v=Yy(c>>>0);n.hasNameForId(this.componentId,v)||n.insertRules(this.componentId,v,r(d,".".concat(v),void 0,this.componentId)),i=Is(i,v)}}return i},e}(),Bc=Dn.createContext(void 0);Bc.Consumer;function Oz(e){var t=Dn.useContext(Bc),n=Y.useMemo(function(){return function(r,i){if(!r)throw Rs(14);if(As(r)){var o=r(i);return o}if(Array.isArray(r)||typeof r!="object")throw Rs(8);return i?nr(nr({},i),r):r}(e.theme,t)},[e.theme,t]);return e.children?Dn.createElement(Bc.Provider,{value:n},e.children):null}var r_={};function Tz(e,t,n){var r=Qy(e),i=e,o=!Ky(e),a=t.attrs,u=a===void 0?xh:a,c=t.componentId,d=c===void 0?function(I,O){var T=typeof I!="string"?"sc":jk(I);r_[T]=(r_[T]||0)+1;var $="".concat(T,"-").concat(Zk(Sh+T+r_[T]));return O?"".concat(O,"-").concat($):$}(t.displayName,t.parentComponentId):c,p=t.displayName,h=p===void 0?function(I){return Ky(I)?"styled.".concat(I):"Styled(".concat(tz(I),")")}(e):p,m=t.displayName&&t.componentId?"".concat(jk(t.displayName),"-").concat(t.componentId):t.componentId||d,v=r&&i.attrs?i.attrs.concat(u).filter(Boolean):u,_=t.shouldForwardProp;if(r&&i.shouldForwardProp){var x=i.shouldForwardProp;if(t.shouldForwardProp){var S=t.shouldForwardProp;_=function(I,O){return x(I,O)&&S(I,O)}}else _=x}var b=new Rz(n,m,r?i.componentStyle:void 0);function C(I,O){return function(T,$,F){var q=T.attrs,P=T.componentStyle,G=T.defaultProps,X=T.foldedComponentIds,se=T.styledComponentId,V=T.target,ne=Dn.useContext(Bc),z=Oh(),Z=T.shouldForwardProp||z.shouldForwardProp,ce=zk($,ne,G)||Rl,we=function(Te,de,Ke){for(var Pe,rt=nr(nr({},de),{className:void 0,theme:Ke}),st=0;st<Te.length;st+=1){var $e=As(Pe=Te[st])?Pe(rt):Pe;for(var ye in $e)rt[ye]=ye==="className"?Is(rt[ye],$e[ye]):ye==="style"?nr(nr({},rt[ye]),$e[ye]):$e[ye]}return de.className&&(rt.className=Is(rt.className,de.className)),rt}(q,$,ce),k=we.as||V,J={};for(var ue in we)we[ue]===void 0||ue[0]==="$"||ue==="as"||ue==="theme"&&we.theme===ce||(ue==="forwardedAs"?J.as=we.forwardedAs:Z&&!Z(ue,k)||(J[ue]=we[ue],Z||wr.NODE_ENV));var L=function(Te,de){var Ke=Oh(),Pe=Te.generateAndInjectStyles(de,Ke.styleSheet,Ke.stylis);return Pe}(P,we),_e=Is(X,se);return L&&(_e+=" "+L),we.className&&(_e+=" "+we.className),J[Ky(k)&&!qk.has(k)?"class":"className"]=_e,F&&(J.ref=F),Y.createElement(k,J)}(E,I,O)}C.displayName=h;var E=Dn.forwardRef(C);return E.attrs=v,E.componentStyle=b,E.displayName=h,E.shouldForwardProp=_,E.foldedComponentIds=r?Is(i.foldedComponentIds,i.styledComponentId):"",E.styledComponentId=m,E.target=r?i.target:e,Object.defineProperty(E,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(I){this._foldedDefaultProps=r?function(O){for(var T=[],$=1;$<arguments.length;$++)T[$-1]=arguments[$];for(var F=0,q=T;F<q.length;F++)Jy(O,q[F],!0);return O}({},i.defaultProps,I):I}}),e_(E,function(){return".".concat(E.styledComponentId)}),o&&eA(E,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0}),E}function cA(e,t){for(var n=[e[0]],r=0,i=t.length;r<i;r+=1)n.push(t[r],e[r+1]);return n}var fA=function(e){return Object.assign(e,{isCss:!0})};function To(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(As(e)||Pc(e))return fA(Sa(cA(xh,Lc([e],t,!0))));var r=e;return t.length===0&&r.length===1&&typeof r[0]=="string"?Sa(r):fA(Sa(cA(r,t)))}function i_(e,t,n){if(n===void 0&&(n=Rl),!t)throw Rs(1,t);var r=function(i){for(var o=[],a=1;a<arguments.length;a++)o[a-1]=arguments[a];return e(t,n,To.apply(void 0,Lc([i],o,!1)))};return r.attrs=function(i){return i_(e,t,nr(nr({},n),{attrs:Array.prototype.concat(n.attrs,i).filter(Boolean)}))},r.withConfig=function(i){return i_(e,t,nr(nr({},n),i))},r}var dA=function(e){return i_(Tz,e)},ae=dA;qk.forEach(function(e){ae[e]=dA(e)});var Mz=function(){function e(t,n){this.rules=t,this.componentId=n,this.isStatic=uA(t),Rh.registerId(this.componentId+1)}return e.prototype.createStyles=function(t,n,r,i){var o=i(Xy(Sa(this.rules,n,r,i)),""),a=this.componentId+t;r.insertRules(a,a,o)},e.prototype.removeStyles=function(t,n){n.clearRules(this.componentId+t)},e.prototype.renderStyles=function(t,n,r,i){t>2&&Rh.registerId(this.componentId+t),this.removeStyles(t,r),this.createStyles(t,n,r,i)},e}();function Dz(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=To.apply(void 0,Lc([e],t,!1)),i="sc-global-".concat(Zk(JSON.stringify(r))),o=new Mz(r,i),a=function(c){var d=Oh(),p=Dn.useContext(Bc),h=Dn.useRef(d.styleSheet.allocateGSInstance(i)).current;return d.styleSheet.server&&u(h,c,d.styleSheet,p,d.stylis),Dn.useLayoutEffect(function(){if(!d.styleSheet.server)return u(h,c,d.styleSheet,p,d.stylis),function(){return o.removeStyles(h,d.styleSheet)}},[h,c,d.styleSheet,p,d.stylis]),null};function u(c,d,p,h,m){if(o.isStatic)o.renderStyles(c,QU,p,m);else{var v=nr(nr({},d),{theme:zk(d,h,a.defaultProps)});o.renderStyles(c,v,p,m)}}return Dn.memo(a)}const sr={CHAT_HISTORY:"chat_history",CLICKED_QUESTIONS:"clicked_questions",PENDING_BULK_ITEMS:"pending_bulk_items",LAST_SHOWN_MESSAGE_ID:"last_shown_message_id",HIDDEN_DYNAMIC_SUGGESTED_QUESTIONS:"hidden_dynamic_suggested_questions",CHAT_RATING:"chat_rating",SHOPIFY_META_DATA:"shopify_meta_data",SESSION_ID:"session_id",USER_INFO:"user_info",IS_FORM_CLOSED_BY_USER:"is_form_closed_by_user"};var Th={USER:"anurag",npm_config_user_agent:"pnpm/10.7.1 npm/? node/v20.11.1 linux x64",npm_node_execpath:"/home/anurag/.local/share/pnpm/nodejs/22.15.0/bin/node",WT_PROFILE_ID:"{51855cb2-8cce-5362-8f54-464b92b32386}",SHLVL:"1",npm_config_noproxy:"",HOME:"/home/anurag",OLDPWD:"/home/anurag",LESS:"-R",npm_package_json:"/home/anurag/workstation/debales/debales/packages/ai/package.json",ZSH:"/home/anurag/.oh-my-zsh",LSCOLORS:"Gxfxcxdxbxegedabagacad",PAGER:"less",npm_config_userconfig:"/home/anurag/.npmrc",npm_config_local_prefix:"/home/anurag/workstation/debales/debales/packages/ai",DBUS_SESSION_BUS_ADDRESS:"unix:path=/run/user/1000/bus",P9K_TTY:"old",npm_config_engine_strict:"true",WSL_DISTRO_NAME:"Ubuntu",COLOR:"0",npm_config_otp:"133359",WAYLAND_DISPLAY:"wayland-0",LOGNAME:"anurag",PULSE_SERVER:"unix:/mnt/wslg/PulseServer",WSL_INTEROP:"/run/WSL/428_interop",NAME:"Anurag-PC",_P9K_SSH_TTY:"/dev/pts/0",_:"/home/anurag/.local/share/pnpm/pnpm",npm_config_prefix:"/home/anurag/.local/share/pnpm/nodejs/22.15.0",npm_config_npm_version:"10.9.2",npm_config_registry:"https://registry.npmjs.org/",TERM:"xterm-256color",npm_config_cache:"/home/anurag/.npm",npm_config_node_gyp:"/home/anurag/.local/share/pnpm/nodejs/22.15.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js",PATH:"/home/anurag/workstation/debales/debales/packages/ai/node_modules/.bin:/home/anurag/workstation/debales/debales/packages/node_modules/.bin:/home/anurag/workstation/debales/debales/node_modules/.bin:/home/anurag/workstation/debales/node_modules/.bin:/home/anurag/workstation/node_modules/.bin:/home/anurag/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/home/anurag/.local/share/pnpm/nodejs/22.15.0/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin:/home/anurag/workstation/debales/debales/packages/ai/node_modules/.bin:/snapshot/dist/node-gyp-bin:/home/anurag/workstation/debales/debales/node_modules/.bin:/home/anurag/workstation/debales/debales/packages/ai/node_modules/.bin:/snapshot/dist/node-gyp-bin:/home/anurag/workstation/debales/debales/node_modules/.bin:/home/anurag/workstation/debales/debales/node_modules/.bin:/snapshot/dist/node-gyp-bin:/home/anurag/workstation/debales/debales/node_modules/.bin:/home/anurag/.local/share/pnpm/.tools/@pnpm+linux-x64/10.7.1/bin:/home/anurag/.gvm/bin:/mnt/c/Users/anura/AppData/Local/Programs/cursor/resources/app/bin:/home/anurag/go/bin:/usr/local/go/bin:/home/anurag/bin:/usr/local/bin:/home/anurag/.local/share/pnpm:/usr/local/sbin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Windows/system32:/mnt/c/Windows:/mnt/c/Windows/System32/Wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0/:/mnt/c/Windows/System32/OpenSSH/:/mnt/c/Program:Files:(x86)/NVIDIA:Corporation/PhysX/Common:Files/NVIDIA:Corporation/NVIDIA:app/NvDLISR:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:Files/Docker/Docker/resources/bin:/mnt/c/Users/anura/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/anura/AppData/Local/Programs/Microsoft:VS:Code/bin:/home/linuxbrew/.linuxbrew/bin",NODE:"/home/anurag/.local/share/pnpm/nodejs/22.15.0/bin/node",npm_package_name:"@debales/ai",XDG_RUNTIME_DIR:"/run/user/1000/",WT_SESSION:"8282efe2-95da-4bd0-9557-5049be79bdfe",npm_config_frozen_lockfile:"",DISPLAY:":0",LANG:"C.UTF-8",LS_COLORS:"rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:",npm_lifecycle_script:"tsc -b && vite build --config vite.browser.config.ts",GVM_VERSION:"1.0.22",SHELL:"/usr/bin/zsh",NODE_PATH:"/home/anurag/workstation/debales/debales/node_modules/.pnpm/vite@6.2.5_@types+node@22.14.0_jiti@2.4.2_lightningcss@1.29.2_terser@5.39.0_yaml@2.7.1/node_modules/vite/bin/node_modules:/home/anurag/workstation/debales/debales/node_modules/.pnpm/vite@6.2.5_@types+node@22.14.0_jiti@2.4.2_lightningcss@1.29.2_terser@5.39.0_yaml@2.7.1/node_modules/vite/node_modules:/home/anurag/workstation/debales/debales/node_modules/.pnpm/vite@6.2.5_@types+node@22.14.0_jiti@2.4.2_lightningcss@1.29.2_terser@5.39.0_yaml@2.7.1/node_modules:/home/anurag/workstation/debales/debales/node_modules/.pnpm/node_modules:/home/anurag/workstation/debales/debales/node_modules/.pnpm/@changesets+cli@2.28.1/node_modules/@changesets/cli/node_modules:/home/anurag/workstation/debales/debales/node_modules/.pnpm/@changesets+cli@2.28.1/node_modules/@changesets/node_modules:/home/anurag/workstation/debales/debales/node_modules/.pnpm/@changesets+cli@2.28.1/node_modules:/home/anurag/workstation/debales/debales/node_modules/.pnpm/node_modules:/home/anurag/.local/share/pnpm/global/5/.pnpm/@pnpm+exe@10.6.3/node_modules/@pnpm/exe/node_modules:/home/anurag/.local/share/pnpm/global/5/.pnpm/@pnpm+exe@10.6.3/node_modules/@pnpm/node_modules:/home/anurag/.local/share/pnpm/global/5/.pnpm/@pnpm+exe@10.6.3/node_modules:/home/anurag/.local/share/pnpm/global/5/.pnpm/node_modules",npm_package_version:"1.1.8-canary.1",npm_config_verify_deps_before_run:"false",npm_config_access:"public",npm_lifecycle_event:"build:browser",npm_config_tag:"canary",P9K_SSH:"0",npm_config_globalconfig:"/home/anurag/.config/pnpm/npmrc",npm_config_init_module:"/home/anurag/.npm-init.js",PWD:"/home/anurag/workstation/debales/debales/packages/ai",npm_execpath:"/home/anurag/.local/share/pnpm/nodejs/22.15.0/lib/node_modules/npm/bin/npm-cli.js",GVM_ROOT:"/home/anurag/.gvm",_P9K_TTY:"/dev/pts/0",npm_config_global_prefix:"/home/anurag/.local/share/pnpm/nodejs/22.15.0",PNPM_SCRIPT_SRC_DIR:"/home/anurag/workstation/debales/debales/packages/ai",npm_command:"run-script",BREW_HOME:"/home/linuxbrew/.linuxbrew/bin",HOSTTYPE:"x86_64",WSL2_GUI_APPS_ENABLED:"1",PNPM_HOME:"/home/anurag/.local/share/pnpm",GVM_PATH_BACKUP:"/home/anurag/.gvm/bin:/mnt/c/Users/anura/AppData/Local/Programs/cursor/resources/app/bin:/home/anurag/go/bin:/usr/local/go/bin:/home/anurag/bin:/usr/local/bin:/home/anurag/.local/share/pnpm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Windows/system32:/mnt/c/Windows:/mnt/c/Windows/System32/Wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0/:/mnt/c/Windows/System32/OpenSSH/:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/Program Files/NVIDIA Corporation/NVIDIA app/NvDLISR:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/Docker/Docker/resources/bin:/mnt/c/Users/anura/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/anura/AppData/Local/Programs/Microsoft VS Code/bin:/mnt/c/Users/anura/AppData/Local/Programs/cursor/resources/app/bin:/home/linuxbrew/.linuxbrew/bin",WSLENV:"WT_SESSION:WT_PROFILE_ID:",INIT_CWD:"/home/anurag/workstation/debales/debales/packages/ai",npm_config_json:"true",EDITOR:"vi",NODE_ENV:"production"},Ue;if(typeof window>"u"){var hA={hostname:""};Ue={crypto:{randomUUID:function(){throw Error("unsupported")}},navigator:{userAgent:"",onLine:!0},document:{createElement:function(){return{}},location:hA,referrer:""},screen:{width:0,height:0},location:hA,addEventListener:function(){},removeEventListener:function(){}}}else Ue=window;function pA(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function gA(e,t,n,r,i,o,a){try{var u=e[o](a),c=u.value}catch(d){n(d);return}u.done?t(c):Promise.resolve(c).then(r,i)}function o_(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(c){gA(o,r,i,a,u,"next",c)}function u(c){gA(o,r,i,a,u,"throw",c)}a(void 0)})}}function Mh(e,t,n){return mA()?Mh=Reflect.construct:Mh=function(i,o,a){var u=[null];u.push.apply(u,o);var c=Function.bind.apply(i,u),d=new c;return a&&Uc(d,a.prototype),d},Mh.apply(null,arguments)}function Lz(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function lr(e,t,n){return t&&Lz(e.prototype,t),e}function Ut(){return Ut=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ut.apply(this,arguments)}function a_(e){return a_=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},a_(e)}function xr(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Uc(e,t)}function yt(e,t){return t!=null&&typeof Symbol<"u"&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function $z(e){return Function.toString.call(e).indexOf("[native code]")!==-1}function Fc(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function Uc(e,t){return Uc=Object.setPrototypeOf||function(r,i){return r.__proto__=i,r},Uc(e,t)}function Mt(e){"@swc/helpers - typeof";return e&&typeof Symbol<"u"&&e.constructor===Symbol?"symbol":typeof e}function Nz(e,t){if(e){if(typeof e=="string")return pA(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return pA(e,t)}}function Dh(e){var t=typeof Map=="function"?new Map:void 0;return Dh=function(r){if(r===null||!$z(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(typeof t<"u"){if(t.has(r))return t.get(r);t.set(r,i)}function i(){return Mh(r,arguments,a_(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Uc(i,r)},Dh(e)}function mA(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(mA=function(){return!!e})()}function Ze(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=Nz(e))||t){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function zc(e,t){var n,r,i,o,a={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(d){return function(p){return c([d,p])}}function c(d){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=d[0]&2?r.return:d[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,d[1])).done)return i;switch(r=0,i&&(d=[d[0]&2,i.value]),d[0]){case 0:case 1:i=d;break;case 4:return a.label++,{value:d[1],done:!1};case 5:a.label++,r=d[1],d=[0];continue;case 7:d=a.ops.pop(),a.trys.pop();continue;default:if(i=a.trys,!(i=i.length>0&&i[i.length-1])&&(d[0]===6||d[0]===2)){a=0;continue}if(d[0]===3&&(!i||d[1]>i[0]&&d[1]<i[3])){a.label=d[1];break}if(d[0]===6&&a.label<i[1]){a.label=i[1],i=d;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(d);break}i[2]&&a.ops.pop(),a.trys.pop();continue}d=t.call(e,a)}catch(p){d=[6,p],r=0}finally{n=i=0}if(d[0]&5)throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}}function vA(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}var Pz=Object.defineProperty,Bz=function(e,t,n){return t in e?Pz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},Ne=function(e,t,n){return Bz(e,(typeof t>"u"?"undefined":Mt(t))!=="symbol"?t+"":t,n)},yA,Fz=Object.defineProperty,Uz=function(e,t,n){return t in e?Fz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},_A=function(e,t,n){return Uz(e,(typeof t>"u"?"undefined":Mt(t))!=="symbol"?t+"":t,n)},Kn=function(e){return e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e}(Kn||{}),bA={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},SA={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Lh={},zz=function(){return!!globalThis.Zone};function s_(e){if(Lh[e])return Lh[e];var t=globalThis[e],n=t.prototype,r=e in bA?bA[e]:void 0,i=!!(r&&r.every(function(p){var h,m;return!!((m=(h=Object.getOwnPropertyDescriptor(n,p))==null?void 0:h.get)!=null&&m.toString().includes("[native code]"))})),o=e in SA?SA[e]:void 0,a=!!(o&&o.every(function(p){var h;return typeof n[p]=="function"&&((h=n[p])==null?void 0:h.toString().includes("[native code]"))}));if(i&&a&&!zz())return Lh[e]=t.prototype,t.prototype;try{var u=document.createElement("iframe");document.body.appendChild(u);var c=u.contentWindow;if(!c)return t.prototype;var d=c[e].prototype;return document.body.removeChild(u),d?Lh[e]=d:n}catch{return n}}var l_={};function wa(e,t,n){var r,i=e+"."+String(n);if(l_[i])return l_[i].call(t);var o=s_(e),a=(r=Object.getOwnPropertyDescriptor(o,n))==null?void 0:r.get;return a?(l_[i]=a,a.call(t)):t[n]}var u_={};function wA(e,t,n){var r=e+"."+String(n);if(u_[r])return u_[r].bind(t);var i=s_(e),o=i[n];return typeof o!="function"?t[n]:(u_[r]=o,o.bind(t))}function qz(e){return wa("Node",e,"childNodes")}function jz(e){return wa("Node",e,"parentNode")}function Hz(e){return wa("Node",e,"parentElement")}function Gz(e){return wa("Node",e,"textContent")}function Vz(e,t){return wA("Node",e,"contains")(t)}function Zz(e){return wA("Node",e,"getRootNode")()}function Yz(e){return!e||!("host"in e)?null:wa("ShadowRoot",e,"host")}function Wz(e){return e.styleSheets}function Kz(e){return!e||!("shadowRoot"in e)?null:wa("Element",e,"shadowRoot")}function Qz(e,t){return wa("Element",e,"querySelector")(t)}function Xz(e,t){return wa("Element",e,"querySelectorAll")(t)}function Jz(){return s_("MutationObserver").constructor}var Cr={childNodes:qz,parentNode:jz,parentElement:Hz,textContent:Gz,contains:Vz,getRootNode:Zz,host:Yz,styleSheets:Wz,shadowRoot:Kz,querySelector:Qz,querySelectorAll:Xz,mutationObserver:Jz};function xA(e){return e.nodeType===e.ELEMENT_NODE}function qc(e){var t=e&&"host"in e&&"mode"in e&&Cr.host(e)||null;return!!(t&&"shadowRoot"in t&&Cr.shadowRoot(t)===e)}function jc(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function e7(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),e}function t7(e){var t=e.cssText;if(t.split('"').length<3)return t;var n=["@import","url("+JSON.stringify(e.href)+")"];return e.layerName===""?n.push("layer"):e.layerName&&n.push("layer("+e.layerName+")"),e.supportsText&&n.push("supports("+e.supportsText+")"),e.media.length&&n.push(e.media.mediaText),n.join(" ")+";"}function c_(e){try{var t=e.rules||e.cssRules;if(!t)return null;var n=e.href;!n&&e.ownerNode&&e.ownerNode.ownerDocument&&(n=e.ownerNode.ownerDocument.location.href);var r=Array.from(t,function(i){return CA(i,n)}).join("");return e7(r)}catch{return null}}function CA(e,t){if(r7(e)){var n;try{n=c_(e.styleSheet)||t7(e)}catch{n=e.cssText}return e.styleSheet.href?$h(n,e.styleSheet.href):n}else{var r=e.cssText;return i7(e)&&e.selectorText.includes(":")&&(r=n7(r)),t?$h(r,t):r}}function n7(e){var t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function r7(e){return"styleSheet"in e}function i7(e){return"selectorText"in e}var EA=function(){function e(){_A(this,"idNodeMap",new Map),_A(this,"nodeMetaMap",new WeakMap)}var t=e.prototype;return t.getId=function(r){var i;if(!r)return-1;var o=(i=this.getMeta(r))==null?void 0:i.id;return o??-1},t.getNode=function(r){return this.idNodeMap.get(r)||null},t.getIds=function(){return Array.from(this.idNodeMap.keys())},t.getMeta=function(r){return this.nodeMetaMap.get(r)||null},t.removeNodeFromMap=function(r){var i=this,o=this.getId(r);this.idNodeMap.delete(o),r.childNodes&&r.childNodes.forEach(function(a){return i.removeNodeFromMap(a)})},t.has=function(r){return this.idNodeMap.has(r)},t.hasNode=function(r){return this.nodeMetaMap.has(r)},t.add=function(r,i){var o=i.id;this.idNodeMap.set(o,r),this.nodeMetaMap.set(r,i)},t.replace=function(r,i){var o=this.getNode(r);if(o){var a=this.nodeMetaMap.get(o);a&&this.nodeMetaMap.set(i,a)}this.idNodeMap.set(r,i)},t.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},e}();function o7(){return new EA}function f_(e){var t=e.element,n=e.maskInputOptions,r=e.tagName,i=e.type,o=e.value,a=e.maskInputFn,u=o||"",c=i&&Os(i);return(n[r.toLowerCase()]||c&&n[c])&&(a?u=a(u,t):u="*".repeat(u.length)),u}function Os(e){return e.toLowerCase()}var kA="__rrweb_original__";function a7(e){var t=e.getContext("2d");if(!t)return!0;for(var n=50,r=0;r<e.width;r+=n)for(var i=0;i<e.height;i+=n){var o=t.getImageData,a=kA in o?o[kA]:o,u=new Uint32Array(a.call(t,r,i,Math.min(n,e.width-r),Math.min(n,e.height-i)).data.buffer);if(u.some(function(c){return c!==0}))return!1}return!0}function d_(e){var t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?Os(t):null}function AA(e,t){var n;try{n=new URL(e,t??window.location.href)}catch{return null}var r=/\.([0-9a-z]+)(?:$)/i,i=n.pathname.match(r),o;return(o=i==null?void 0:i[1])!=null?o:null}function s7(e){var t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var l7=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,u7=/^(?:[a-z+]+:)?\/\//i,c7=/^www\..*/i,f7=/^(data:)([^,]*),(.*)/i;function $h(e,t){return(e||"").replace(l7,function(n,r,i,o,a,u){var c=i||a||u,d=r||o||"";if(!c)return n;if(u7.test(c)||c7.test(c)||f7.test(c))return"url("+d+c+d+")";if(c[0]==="/")return"url("+d+(s7(t)+c)+d+")";var p=t.split("/"),h=c.split("/");p.pop();for(var m=Ze(h),v;!(v=m()).done;){var _=v.value;_!=="."&&(_===".."?p.pop():p.push(_))}return"url("+d+p.join("/")+d+")"})}function h_(e){return e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"")}function d7(e,t){var n=Array.from(t.childNodes),r=[];if(n.length>1&&e&&typeof e=="string"){for(var i=h_(e),o=1;o<n.length;o++)if(n[o].textContent&&typeof n[o].textContent=="string")for(var a=h_(n[o].textContent),u=3;u<a.length;u++){var c=a.substring(0,u);if(i.split(c).length===2){for(var d=i.indexOf(c),p=d;p<e.length;p++)if(h_(e.substring(0,p)).length===d){r.push(e.substring(0,p)),e=e.substring(p);break}break}}}return r.push(e),r}function h7(e,t){return d7(e,t).join("/* rr_split */")}var p7=1,g7=new RegExp("[^a-z0-9-_:]"),Hc=-2;function IA(){return p7++}function m7(e){if(yt(e,HTMLFormElement))return"form";var t=Os(e.tagName);return g7.test(t)?"div":t}var Tl,RA,v7=/^[^ \t\n\r\u000c]+/,y7=/^[, \t\n\r\u000c]+/;function _7(e,t){if(t.trim()==="")return t;var n=0;function r(d){var p,h=d.exec(t.substring(n));return h?(p=h[0],n+=p.length,p):""}for(var i=[];r(y7),!(n>=t.length);){var o=r(v7);if(o.slice(-1)===",")o=Ml(e,o.substring(0,o.length-1)),i.push(o);else{var a="";o=Ml(e,o);for(var u=!1;;){var c=t.charAt(n);if(c===""){i.push((o+a).trim());break}else if(u)c===")"&&(u=!1);else if(c===","){n+=1,i.push((o+a).trim());break}else c==="("&&(u=!0);a+=c,n+=1}}}return i.join(", ")}var OA=new WeakMap;function Ml(e,t){return!t||t.trim()===""?t:p_(e,t)}function b7(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function p_(e,t){var n=OA.get(e);if(n||(n=e.createElement("a"),OA.set(e,n)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return n.setAttribute("href",t),n.href}function TA(e,t,n,r){return r&&(n==="src"||n==="href"&&!(t==="use"&&r[0]==="#")||n==="xlink:href"&&r[0]!=="#"||n==="background"&&(t==="table"||t==="td"||t==="th")?Ml(e,r):n==="srcset"?_7(e,r):n==="style"?$h(r,p_(e)):t==="object"&&n==="data"?Ml(e,r):r)}function MA(e,t,n){return(e==="video"||e==="audio")&&t==="autoplay"}function S7(e,t,n){try{if(typeof t=="string"){if(e.classList.contains(t))return!0}else for(var r=e.classList.length;r--;){var i=e.classList[r];if(t.test(i))return!0}if(n)return e.matches(n)}catch{}return!1}function Nh(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return n?Nh(Cr.parentNode(e),t,n):!1;for(var r=e.classList.length;r--;){var i=e.classList[r];if(t.test(i))return!0}return n?Nh(Cr.parentNode(e),t,n):!1}function DA(e,t,n,r){var i;if(xA(e)){if(i=e,!Cr.childNodes(i).length)return!1}else{if(Cr.parentElement(e)===null)return!1;i=Cr.parentElement(e)}try{if(typeof t=="string"){if(r){if(i.closest("."+t))return!0}else if(i.classList.contains(t))return!0}else if(Nh(i,t,r))return!0;if(n){if(r){if(i.closest(n))return!0}else if(i.matches(n))return!0}}catch{}return!1}function w7(e,t,n){var r=e.contentWindow;if(r){var i=!1,o;try{o=r.document.readyState}catch{return}if(o!=="complete"){var a=setTimeout(function(){i||(t(),i=!0)},n);e.addEventListener("load",function(){clearTimeout(a),i=!0,t()});return}var u="about:blank";if(r.location.href!==u||e.src===u||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}}function x7(e,t,n){var r=!1,i;try{i=e.sheet}catch{return}if(!i){var o=setTimeout(function(){r||(t(),r=!0)},n);e.addEventListener("load",function(){clearTimeout(o),r=!0,t()})}}function C7(e,t){var n=t.doc,r=t.mirror,i=t.blockClass,o=t.blockSelector,a=t.needsMask,u=t.inlineStylesheet,c=t.maskInputOptions,d=c===void 0?{}:c,p=t.maskTextFn,h=t.maskInputFn,m=t.dataURLOptions,v=m===void 0?{}:m,_=t.inlineImages,x=t.recordCanvas,S=t.keepIframeSrcFn,b=t.newlyAddedElement,C=b===void 0?!1:b,E=t.cssCaptured,I=E===void 0?!1:E,O=E7(n,r);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:Kn.Document,childNodes:[],compatMode:e.compatMode}:{type:Kn.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:Kn.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:O};case e.ELEMENT_NODE:return A7(e,{doc:n,blockClass:i,blockSelector:o,inlineStylesheet:u,maskInputOptions:d,maskInputFn:h,dataURLOptions:v,inlineImages:_,recordCanvas:x,keepIframeSrcFn:S,newlyAddedElement:C,rootId:O});case e.TEXT_NODE:return k7(e,{doc:n,needsMask:a,maskTextFn:p,rootId:O,cssCaptured:I});case e.CDATA_SECTION_NODE:return{type:Kn.CDATA,textContent:"",rootId:O};case e.COMMENT_NODE:return{type:Kn.Comment,textContent:Cr.textContent(e)||"",rootId:O};default:return!1}}function E7(e,t){if(t.hasNode(e)){var n=t.getId(e);return n===1?void 0:n}}function k7(e,t){var n=t.needsMask,r=t.maskTextFn,i=t.rootId,o=t.cssCaptured,a=Cr.parentNode(e),u=a&&a.tagName,c="",d=u==="STYLE"?!0:void 0,p=u==="SCRIPT"?!0:void 0;return p?c="SCRIPT_PLACEHOLDER":o||(c=Cr.textContent(e),d&&c&&(c=$h(c,p_(t.doc)))),!d&&!p&&c&&n&&(c=r?r(c,Cr.parentElement(e)):c.replace(/[\S]/g,"*")),{type:Kn.Text,textContent:c||"",rootId:i}}function A7(e,t){for(var n=t.doc,r=t.blockClass,i=t.blockSelector,o=t.inlineStylesheet,a=t.maskInputOptions,u=a===void 0?{}:a,c=t.maskInputFn,d=t.dataURLOptions,p=d===void 0?{}:d,h=t.inlineImages,m=t.recordCanvas,v=t.keepIframeSrcFn,_=t.newlyAddedElement,x=_===void 0?!1:_,S=t.rootId,b=S7(e,r,i),C=m7(e),E={},I=e.attributes.length,O=0;O<I;O++){var T=e.attributes[O];MA(C,T.name,T.value)||(E[T.name]=TA(n,C,Os(T.name),T.value))}if(C==="link"&&o){var $=Array.from(n.styleSheets).find(function(_e){return _e.href===e.href}),F=null;$&&(F=c_($)),F&&(delete E.rel,delete E.href,E._cssText=F)}if(C==="style"&&e.sheet){var q=c_(e.sheet);q&&(e.childNodes.length>1&&(q=h7(q,e)),E._cssText=q)}if(C==="input"||C==="textarea"||C==="select"){var P=e.value,G=e.checked;E.type!=="radio"&&E.type!=="checkbox"&&E.type!=="submit"&&E.type!=="button"&&P?E.value=f_({element:e,type:d_(e),tagName:C,value:P,maskInputOptions:u,maskInputFn:c}):G&&(E.checked=G)}if(C==="option"&&(e.selected&&!u.select?E.selected=!0:delete E.selected),C==="dialog"&&e.open&&(E.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"),C==="canvas"&&m){if(e.__context==="2d")a7(e)||(E.rr_dataURL=e.toDataURL(p.type,p.quality));else if(!("__context"in e)){var X=e.toDataURL(p.type,p.quality),se=n.createElement("canvas");se.width=e.width,se.height=e.height;var V=se.toDataURL(p.type,p.quality);X!==V&&(E.rr_dataURL=X)}}if(C==="img"&&h){Tl||(Tl=n.createElement("canvas"),RA=Tl.getContext("2d"));var ne=e,z=ne.currentSrc||ne.getAttribute("src")||"<unknown-src>",Z=ne.crossOrigin,ce=function(){ne.removeEventListener("load",ce);try{Tl.width=ne.naturalWidth,Tl.height=ne.naturalHeight,RA.drawImage(ne,0,0),E.rr_dataURL=Tl.toDataURL(p.type,p.quality)}catch(_e){if(ne.crossOrigin!=="anonymous"){ne.crossOrigin="anonymous",ne.complete&&ne.naturalWidth!==0?ce():ne.addEventListener("load",ce);return}else console.warn("Cannot inline img src="+z+"! Error: "+_e)}ne.crossOrigin==="anonymous"&&(Z?E.crossOrigin=Z:ne.removeAttribute("crossorigin"))};ne.complete&&ne.naturalWidth!==0?ce():ne.addEventListener("load",ce)}if(C==="audio"||C==="video"){var we=E;we.rr_mediaState=e.paused?"paused":"played",we.rr_mediaCurrentTime=e.currentTime,we.rr_mediaPlaybackRate=e.playbackRate,we.rr_mediaMuted=e.muted,we.rr_mediaLoop=e.loop,we.rr_mediaVolume=e.volume}if(x||(e.scrollLeft&&(E.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(E.rr_scrollTop=e.scrollTop)),b){var k=e.getBoundingClientRect(),J=k.width,ue=k.height;E={class:E.class,rr_width:""+J+"px",rr_height:""+ue+"px"}}C==="iframe"&&!v(E.src)&&(e.contentDocument||(E.rr_src=E.src),delete E.src);var L;try{customElements.get(C)&&(L=!0)}catch{}return{type:Kn.Element,tagName:C,attributes:E,childNodes:[],isSVG:b7(e)||void 0,needBlock:b,rootId:S,isCustom:L}}function un(e){return e==null?"":e.toLowerCase()}function I7(e,t){if(t.comment&&e.type===Kn.Comment)return!0;if(e.type===Kn.Element){if(t.script&&(e.tagName==="script"||e.tagName==="link"&&(e.attributes.rel==="preload"||e.attributes.rel==="modulepreload")&&e.attributes.as==="script"||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&AA(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(un(e.attributes.name).match(/^msapplication-tile(image|color)$/)||un(e.attributes.name)==="application-name"||un(e.attributes.rel)==="icon"||un(e.attributes.rel)==="apple-touch-icon"||un(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&un(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(un(e.attributes.property).match(/^(og|twitter|fb):/)||un(e.attributes.name).match(/^(og|twitter):/)||un(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(un(e.attributes.name)==="robots"||un(e.attributes.name)==="googlebot"||un(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(un(e.attributes.name)==="author"||un(e.attributes.name)==="generator"||un(e.attributes.name)==="framework"||un(e.attributes.name)==="publisher"||un(e.attributes.name)==="progid"||un(e.attributes.property).match(/^article:/)||un(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(un(e.attributes.name)==="google-site-verification"||un(e.attributes.name)==="yandex-verification"||un(e.attributes.name)==="csrf-token"||un(e.attributes.name)==="p:domain_verify"||un(e.attributes.name)==="verify-v1"||un(e.attributes.name)==="verification"||un(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function Dl(e,t){var n=t.doc,r=t.mirror,i=t.blockClass,o=t.blockSelector,a=t.maskTextClass,u=t.maskTextSelector,c=t.skipChild,d=c===void 0?!1:c,p=t.inlineStylesheet,h=p===void 0?!0:p,m=t.maskInputOptions,v=m===void 0?{}:m,_=t.maskTextFn,x=t.maskInputFn,S=t.slimDOMOptions,b=t.dataURLOptions,C=b===void 0?{}:b,E=t.inlineImages,I=E===void 0?!1:E,O=t.recordCanvas,T=O===void 0?!1:O,$=t.onSerialize,F=t.onIframeLoad,q=t.iframeLoadTimeout,P=q===void 0?5e3:q,G=t.onStylesheetLoad,X=t.stylesheetLoadTimeout,se=X===void 0?5e3:X,V=t.keepIframeSrcFn,ne=V===void 0?function(){return!1}:V,z=t.newlyAddedElement,Z=z===void 0?!1:z,ce=t.cssCaptured,we=ce===void 0?!1:ce,k=t.needsMask,J=t.preserveWhiteSpace,ue=J===void 0?!0:J;if(!k){var L=k===void 0;k=DA(e,a,u,L)}var _e=C7(e,{doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:k,inlineStylesheet:h,maskInputOptions:v,maskTextFn:_,maskInputFn:x,dataURLOptions:C,inlineImages:I,recordCanvas:T,keepIframeSrcFn:ne,newlyAddedElement:Z,cssCaptured:we});if(!_e)return console.warn(e,"not serialized"),null;var Te;r.hasNode(e)?Te=r.getId(e):I7(_e,S)||!ue&&_e.type===Kn.Text&&!_e.textContent.replace(/^\s+|\s+$/gm,"").length?Te=Hc:Te=IA();var de=Object.assign(_e,{id:Te});if(r.add(e,de),Te===Hc)return null;$&&$(e);var Ke=!d;if(de.type===Kn.Element){Ke=Ke&&!de.needBlock,delete de.needBlock;var Pe=Cr.shadowRoot(e);Pe&&jc(Pe)&&(de.isShadowHost=!0)}if((de.type===Kn.Document||de.type===Kn.Element)&&Ke){S.headWhitespace&&de.type===Kn.Element&&de.tagName==="head"&&(ue=!1);var rt={doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:k,maskTextClass:a,maskTextSelector:u,skipChild:d,inlineStylesheet:h,maskInputOptions:v,maskTextFn:_,maskInputFn:x,slimDOMOptions:S,dataURLOptions:C,inlineImages:I,recordCanvas:T,preserveWhiteSpace:ue,onSerialize:$,onIframeLoad:F,iframeLoadTimeout:P,onStylesheetLoad:G,stylesheetLoadTimeout:se,keepIframeSrcFn:ne,cssCaptured:!1};if(!(de.type===Kn.Element&&de.tagName==="textarea"&&de.attributes.value!==void 0)){de.type===Kn.Element&&de.attributes._cssText!==void 0&&typeof de.attributes._cssText=="string"&&(rt.cssCaptured=!0);for(var st=Ze(Array.from(Cr.childNodes(e))),$e;!($e=st()).done;){var ye=$e.value,ze=Dl(ye,rt);ze&&de.childNodes.push(ze)}}var Ge=null;if(xA(e)&&(Ge=Cr.shadowRoot(e)))for(var lt=Ze(Array.from(Cr.childNodes(Ge))),Xe;!(Xe=lt()).done;){var nt=Xe.value,N=Dl(nt,rt);N&&(jc(Ge)&&(N.isShadow=!0),de.childNodes.push(N))}}var B=Cr.parentNode(e);return B&&qc(B)&&jc(B)&&(de.isShadow=!0),de.type===Kn.Element&&de.tagName==="iframe"&&w7(e,function(){var H=e.contentDocument;if(H&&F){var he=Dl(H,{doc:H,mirror:r,blockClass:i,blockSelector:o,needsMask:k,maskTextClass:a,maskTextSelector:u,skipChild:!1,inlineStylesheet:h,maskInputOptions:v,maskTextFn:_,maskInputFn:x,slimDOMOptions:S,dataURLOptions:C,inlineImages:I,recordCanvas:T,preserveWhiteSpace:ue,onSerialize:$,onIframeLoad:F,iframeLoadTimeout:P,onStylesheetLoad:G,stylesheetLoadTimeout:se,keepIframeSrcFn:ne});he&&F(e,he)}},P),de.type===Kn.Element&&de.tagName==="link"&&typeof de.attributes.rel=="string"&&(de.attributes.rel==="stylesheet"||de.attributes.rel==="preload"&&typeof de.attributes.href=="string"&&AA(de.attributes.href)==="css")&&x7(e,function(){if(G){var H=Dl(e,{doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:k,maskTextClass:a,maskTextSelector:u,skipChild:!1,inlineStylesheet:h,maskInputOptions:v,maskTextFn:_,maskInputFn:x,slimDOMOptions:S,dataURLOptions:C,inlineImages:I,recordCanvas:T,preserveWhiteSpace:ue,onSerialize:$,onIframeLoad:F,iframeLoadTimeout:P,onStylesheetLoad:G,stylesheetLoadTimeout:se,keepIframeSrcFn:ne});H&&G(e,H)}},se),de}function R7(e,t){var n=t||{},r=n.mirror,i=r===void 0?new EA:r,o=n.blockClass,a=o===void 0?"rr-block":o,u=n.blockSelector,c=u===void 0?null:u,d=n.maskTextClass,p=d===void 0?"rr-mask":d,h=n.maskTextSelector,m=h===void 0?null:h,v=n.inlineStylesheet,_=v===void 0?!0:v,x=n.inlineImages,S=x===void 0?!1:x,b=n.recordCanvas,C=b===void 0?!1:b,E=n.maskAllInputs,I=E===void 0?!1:E,O=n.maskTextFn,T=n.maskInputFn,$=n.slimDOM,F=$===void 0?!1:$,q=n.dataURLOptions,P=n.preserveWhiteSpace,G=n.onSerialize,X=n.onIframeLoad,se=n.iframeLoadTimeout,V=n.onStylesheetLoad,ne=n.stylesheetLoadTimeout,z=n.keepIframeSrcFn,Z=z===void 0?function(){return!1}:z,ce=I===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:I===!1?{password:!0}:I,we=F===!0||F==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:F==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:F===!1?{}:F;return Dl(e,{doc:e,mirror:i,blockClass:a,blockSelector:c,maskTextClass:p,maskTextSelector:m,skipChild:!1,inlineStylesheet:_,maskInputOptions:ce,maskTextFn:O,maskInputFn:T,slimDOMOptions:we,dataURLOptions:q,inlineImages:S,recordCanvas:C,preserveWhiteSpace:P,onSerialize:G,onIframeLoad:X,iframeLoadTimeout:se,onStylesheetLoad:V,stylesheetLoadTimeout:ne,keepIframeSrcFn:Z,newlyAddedElement:!1})}function O7(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function T7(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return yt(this,r)?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var g_={exports:{}},hn=String,LA=function(){return{isColorSupported:!1,reset:hn,bold:hn,dim:hn,italic:hn,underline:hn,inverse:hn,hidden:hn,strikethrough:hn,black:hn,red:hn,green:hn,yellow:hn,blue:hn,magenta:hn,cyan:hn,white:hn,gray:hn,bgBlack:hn,bgRed:hn,bgGreen:hn,bgYellow:hn,bgBlue:hn,bgMagenta:hn,bgCyan:hn,bgWhite:hn}};g_.exports=LA(),g_.exports.createColors=LA;var M7=g_.exports,D7={},L7=Object.freeze(Object.defineProperty({__proto__:null,default:D7},Symbol.toStringTag,{value:"Module"})),Ln=T7(L7),$A=M7,NA=Ln,m_=function(e){xr(t,e);function t(r,i,o,a,u,c){var d;return d=e.call(this,r)||this,d.name="CssSyntaxError",d.reason=r,u&&(d.file=u),a&&(d.source=a),c&&(d.plugin=c),typeof i<"u"&&typeof o<"u"&&(typeof i=="number"?(d.line=i,d.column=o):(d.line=i.line,d.column=i.column,d.endLine=o.line,d.endColumn=o.column)),d.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(d,t),d}var n=t.prototype;return n.setMessage=function(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason},n.showSourceCode=function(i){var o=this;if(!this.source)return"";var a=this.source;i==null&&(i=$A.isColorSupported),NA&&i&&(a=NA(a));var u=a.split(/\r?\n/),c=Math.max(this.line-3,0),d=Math.min(this.line+2,u.length),p=String(d).length,h,m;if(i){var v=$A.createColors(!0),_=v.bold,x=v.gray,S=v.red;h=function(b){return _(S(b))},m=function(b){return x(b)}}else h=m=function(b){return b};return u.slice(c,d).map(function(b,C){var E=c+1+C,I=" "+(" "+E).slice(-p)+" | ";if(E===o.line){var O=m(I.replace(/\d/g," "))+b.slice(0,o.column-1).replace(/[^\t]/g," ");return h(">")+m(I)+b+`
78
+ `,wh=typeof window<"u"&&"HTMLElement"in window,KU=!!(typeof SC_DISABLE_SPEEDY=="boolean"?SC_DISABLE_SPEEDY:typeof process<"u"&&wr!==void 0&&wr.REACT_APP_SC_DISABLE_SPEEDY!==void 0&&wr.REACT_APP_SC_DISABLE_SPEEDY!==""?wr.REACT_APP_SC_DISABLE_SPEEDY!=="false"&&wr.REACT_APP_SC_DISABLE_SPEEDY:typeof process<"u"&&wr!==void 0&&wr.SC_DISABLE_SPEEDY!==void 0&&wr.SC_DISABLE_SPEEDY!==""?wr.SC_DISABLE_SPEEDY!=="false"&&wr.SC_DISABLE_SPEEDY:wr.NODE_ENV!=="production"),QU={},xh=Object.freeze([]),Rl=Object.freeze({});function zk(e,t,n){return n===void 0&&(n=Rl),e.theme!==n.theme&&e.theme||t||n.theme}var qk=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track","u","ul","use","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"]),XU=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,JU=/(^-|-$)/g;function jk(e){return e.replace(XU,"-").replace(JU,"")}var ez=/(a)(d)/gi,Ch=52,Hk=function(e){return String.fromCharCode(e+(e>25?39:97))};function Yy(e){var t,n="";for(t=Math.abs(e);t>Ch;t=t/Ch|0)n=Hk(t%Ch)+n;return(Hk(t%Ch)+n).replace(ez,"$1-$2")}var Wy,Gk=5381,Ol=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},Vk=function(e){return Ol(Gk,e)};function Zk(e){return Yy(Vk(e)>>>0)}function tz(e){return e.displayName||e.name||"Component"}function Ky(e){return typeof e=="string"&&wr.NODE_ENV==="production"}var Yk=typeof Symbol=="function"&&Symbol.for,Wk=Yk?Symbol.for("react.memo"):60115,nz=Yk?Symbol.for("react.forward_ref"):60112,rz={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},iz={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},Kk={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},oz=((Wy={})[nz]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},Wy[Wk]=Kk,Wy);function Qk(e){return("type"in(t=e)&&t.type.$$typeof)===Wk?Kk:"$$typeof"in e?oz[e.$$typeof]:rz;var t}var az=Object.defineProperty,sz=Object.getOwnPropertyNames,Xk=Object.getOwnPropertySymbols,lz=Object.getOwnPropertyDescriptor,uz=Object.getPrototypeOf,Jk=Object.prototype;function eA(e,t,n){if(typeof t!="string"){if(Jk){var r=uz(t);r&&r!==Jk&&eA(e,r,n)}var i=sz(t);Xk&&(i=i.concat(Xk(t)));for(var o=Qk(e),a=Qk(t),u=0;u<i.length;++u){var c=i[u];if(!(c in iz||n&&n[c]||a&&c in a||o&&c in o)){var d=lz(t,c);try{az(e,c,d)}catch{}}}}return e}function As(e){return typeof e=="function"}function Qy(e){return typeof e=="object"&&"styledComponentId"in e}function Is(e,t){return e&&t?"".concat(e," ").concat(t):e||t||""}function Xy(e,t){if(e.length===0)return"";for(var n=e[0],r=1;r<e.length;r++)n+=e[r];return n}function Pc(e){return e!==null&&typeof e=="object"&&e.constructor.name===Object.name&&!("props"in e&&e.$$typeof)}function Jy(e,t,n){if(n===void 0&&(n=!1),!n&&!Pc(e)&&!Array.isArray(e))return t;if(Array.isArray(t))for(var r=0;r<t.length;r++)e[r]=Jy(e[r],t[r]);else if(Pc(t))for(var r in t)e[r]=Jy(e[r],t[r]);return e}function e_(e,t){Object.defineProperty(e,"toString",{value:t})}function Rs(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(e," for more information.").concat(t.length>0?" Args: ".concat(t.join(", ")):""))}var cz=function(){function e(t){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=t}return e.prototype.indexOfGroup=function(t){for(var n=0,r=0;r<t;r++)n+=this.groupSizes[r];return n},e.prototype.insertRules=function(t,n){if(t>=this.groupSizes.length){for(var r=this.groupSizes,i=r.length,o=i;t>=o;)if((o<<=1)<0)throw Rs(16,"".concat(t));this.groupSizes=new Uint32Array(o),this.groupSizes.set(r),this.length=o;for(var a=i;a<o;a++)this.groupSizes[a]=0}for(var u=this.indexOfGroup(t+1),c=(a=0,n.length);a<c;a++)this.tag.insertRule(u,n[a])&&(this.groupSizes[t]++,u++)},e.prototype.clearGroup=function(t){if(t<this.length){var n=this.groupSizes[t],r=this.indexOfGroup(t),i=r+n;this.groupSizes[t]=0;for(var o=r;o<i;o++)this.tag.deleteRule(r)}},e.prototype.getGroup=function(t){var n="";if(t>=this.length||this.groupSizes[t]===0)return n;for(var r=this.groupSizes[t],i=this.indexOfGroup(t),o=i+r,a=i;a<o;a++)n+="".concat(this.tag.getRule(a)).concat(Zy);return n},e}(),Eh=new Map,kh=new Map,Ah=1,Ih=function(e){if(Eh.has(e))return Eh.get(e);for(;kh.has(Ah);)Ah++;var t=Ah++;return Eh.set(e,t),kh.set(t,e),t},fz=function(e,t){Ah=t+1,Eh.set(e,t),kh.set(t,e)},dz="style[".concat(Il,"][").concat(Uk,'="').concat(Sh,'"]'),hz=new RegExp("^".concat(Il,'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')),pz=function(e,t,n){for(var r,i=n.split(","),o=0,a=i.length;o<a;o++)(r=i[o])&&e.registerName(t,r)},gz=function(e,t){for(var n,r=((n=t.textContent)!==null&&n!==void 0?n:"").split(Zy),i=[],o=0,a=r.length;o<a;o++){var u=r[o].trim();if(u){var c=u.match(hz);if(c){var d=0|parseInt(c[1],10),p=c[2];d!==0&&(fz(p,d),pz(e,p,c[3]),e.getTag().insertRules(d,i)),i.length=0}else i.push(u)}}},tA=function(e){for(var t=document.querySelectorAll(dz),n=0,r=t.length;n<r;n++){var i=t[n];i&&i.getAttribute(Il)!==Fk&&(gz(e,i),i.parentNode&&i.parentNode.removeChild(i))}};function mz(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:null}var nA=function(e){var t=document.head,n=e||t,r=document.createElement("style"),i=function(u){var c=Array.from(u.querySelectorAll("style[".concat(Il,"]")));return c[c.length-1]}(n),o=i!==void 0?i.nextSibling:null;r.setAttribute(Il,Fk),r.setAttribute(Uk,Sh);var a=mz();return a&&r.setAttribute("nonce",a),n.insertBefore(r,o),r},vz=function(){function e(t){this.element=nA(t),this.element.appendChild(document.createTextNode("")),this.sheet=function(n){if(n.sheet)return n.sheet;for(var r=document.styleSheets,i=0,o=r.length;i<o;i++){var a=r[i];if(a.ownerNode===n)return a}throw Rs(17)}(this.element),this.length=0}return e.prototype.insertRule=function(t,n){try{return this.sheet.insertRule(n,t),this.length++,!0}catch{return!1}},e.prototype.deleteRule=function(t){this.sheet.deleteRule(t),this.length--},e.prototype.getRule=function(t){var n=this.sheet.cssRules[t];return n&&n.cssText?n.cssText:""},e}(),yz=function(){function e(t){this.element=nA(t),this.nodes=this.element.childNodes,this.length=0}return e.prototype.insertRule=function(t,n){if(t<=this.length&&t>=0){var r=document.createTextNode(n);return this.element.insertBefore(r,this.nodes[t]||null),this.length++,!0}return!1},e.prototype.deleteRule=function(t){this.element.removeChild(this.nodes[t]),this.length--},e.prototype.getRule=function(t){return t<this.length?this.nodes[t].textContent:""},e}(),_z=function(){function e(t){this.rules=[],this.length=0}return e.prototype.insertRule=function(t,n){return t<=this.length&&(this.rules.splice(t,0,n),this.length++,!0)},e.prototype.deleteRule=function(t){this.rules.splice(t,1),this.length--},e.prototype.getRule=function(t){return t<this.length?this.rules[t]:""},e}(),rA=wh,bz={isServer:!wh,useCSSOMInjection:!KU},Rh=function(){function e(t,n,r){t===void 0&&(t=Rl),n===void 0&&(n={});var i=this;this.options=nr(nr({},bz),t),this.gs=n,this.names=new Map(r),this.server=!!t.isServer,!this.server&&wh&&rA&&(rA=!1,tA(this)),e_(this,function(){return function(o){for(var a=o.getTag(),u=a.length,c="",d=function(h){var m=function(b){return kh.get(b)}(h);if(m===void 0)return"continue";var v=o.names.get(m),_=a.getGroup(h);if(v===void 0||!v.size||_.length===0)return"continue";var x="".concat(Il,".g").concat(h,'[id="').concat(m,'"]'),S="";v!==void 0&&v.forEach(function(b){b.length>0&&(S+="".concat(b,","))}),c+="".concat(_).concat(x,'{content:"').concat(S,'"}').concat(Zy)},p=0;p<u;p++)d(p);return c}(i)})}return e.registerId=function(t){return Ih(t)},e.prototype.rehydrate=function(){!this.server&&wh&&tA(this)},e.prototype.reconstructWithOptions=function(t,n){return n===void 0&&(n=!0),new e(nr(nr({},this.options),t),this.gs,n&&this.names||void 0)},e.prototype.allocateGSInstance=function(t){return this.gs[t]=(this.gs[t]||0)+1},e.prototype.getTag=function(){return this.tag||(this.tag=(t=function(n){var r=n.useCSSOMInjection,i=n.target;return n.isServer?new _z(i):r?new vz(i):new yz(i)}(this.options),new cz(t)));var t},e.prototype.hasNameForId=function(t,n){return this.names.has(t)&&this.names.get(t).has(n)},e.prototype.registerName=function(t,n){if(Ih(t),this.names.has(t))this.names.get(t).add(n);else{var r=new Set;r.add(n),this.names.set(t,r)}},e.prototype.insertRules=function(t,n,r){this.registerName(t,n),this.getTag().insertRules(Ih(t),r)},e.prototype.clearNames=function(t){this.names.has(t)&&this.names.get(t).clear()},e.prototype.clearRules=function(t){this.getTag().clearGroup(Ih(t)),this.clearNames(t)},e.prototype.clearTag=function(){this.tag=void 0},e}(),Sz=/&/g,wz=/^\s*\/\/.*$/gm;function iA(e,t){return e.map(function(n){return n.type==="rule"&&(n.value="".concat(t," ").concat(n.value),n.value=n.value.replaceAll(",",",".concat(t," ")),n.props=n.props.map(function(r){return"".concat(t," ").concat(r)})),Array.isArray(n.children)&&n.type!=="@keyframes"&&(n.children=iA(n.children,t)),n})}function oA(e){var t,n,r,i=e===void 0?Rl:e,o=i.options,a=o===void 0?Rl:o,u=i.plugins,c=u===void 0?xh:u,d=function(m,v,_){return _.startsWith(n)&&_.endsWith(n)&&_.replaceAll(n,"").length>0?".".concat(t):m},p=c.slice();p.push(function(m){m.type===hh&&m.value.includes("&")&&(m.props[0]=m.props[0].replace(Sz,n).replace(r,d))}),a.prefix&&p.push(YU),p.push(GU);var h=function(m,v,_,x){v===void 0&&(v=""),_===void 0&&(_=""),x===void 0&&(x="&"),t=x,n=v,r=new RegExp("\\".concat(n,"\\b"),"g");var S=m.replace(wz,""),b=jU(_||v?"".concat(_," ").concat(v," { ").concat(S," }"):S);a.namespace&&(b=iA(b,a.namespace));var C=[];return bh(b,VU(p.concat(ZU(function(E){return C.push(E)})))),C};return h.hash=c.length?c.reduce(function(m,v){return v.name||Rs(15),Ol(m,v.name)},Gk).toString():"",h}var xz=new Rh,t_=oA(),n_=Dn.createContext({shouldForwardProp:void 0,styleSheet:xz,stylis:t_});n_.Consumer;var Cz=Dn.createContext(void 0);function Oh(){return Y.useContext(n_)}function Ez(e){var t=Y.useState(e.stylisPlugins),n=t[0],r=t[1],i=Oh().styleSheet,o=Y.useMemo(function(){var c=i;return e.sheet?c=e.sheet:e.target&&(c=c.reconstructWithOptions({target:e.target},!1)),e.disableCSSOMInjection&&(c=c.reconstructWithOptions({useCSSOMInjection:!1})),c},[e.disableCSSOMInjection,e.sheet,e.target,i]),a=Y.useMemo(function(){return oA({options:{namespace:e.namespace,prefix:e.enableVendorPrefixes},plugins:n})},[e.enableVendorPrefixes,e.namespace,n]);Y.useEffect(function(){OU(n,e.stylisPlugins)||r(e.stylisPlugins)},[e.stylisPlugins]);var u=Y.useMemo(function(){return{shouldForwardProp:e.shouldForwardProp,styleSheet:o,stylis:a}},[e.shouldForwardProp,o,a]);return Dn.createElement(n_.Provider,{value:u},Dn.createElement(Cz.Provider,{value:a},e.children))}var kz=function(){function e(t,n){var r=this;this.inject=function(i,o){o===void 0&&(o=t_);var a=r.name+o.hash;i.hasNameForId(r.id,a)||i.insertRules(r.id,a,o(r.rules,a,"@keyframes"))},this.name=t,this.id="sc-keyframes-".concat(t),this.rules=n,e_(this,function(){throw Rs(12,String(r.name))})}return e.prototype.getName=function(t){return t===void 0&&(t=t_),this.name+t.hash},e}(),Az=function(e){return e>="A"&&e<="Z"};function aA(e){for(var t="",n=0;n<e.length;n++){var r=e[n];if(n===1&&r==="-"&&e[0]==="-")return e;Az(r)?t+="-"+r.toLowerCase():t+=r}return t.startsWith("ms-")?"-"+t:t}var sA=function(e){return e==null||e===!1||e===""},lA=function(e){var t,n,r=[];for(var i in e){var o=e[i];e.hasOwnProperty(i)&&!sA(o)&&(Array.isArray(o)&&o.isCss||As(o)?r.push("".concat(aA(i),":"),o,";"):Pc(o)?r.push.apply(r,Lc(Lc(["".concat(i," {")],lA(o),!1),["}"],!1)):r.push("".concat(aA(i),": ").concat((t=i,(n=o)==null||typeof n=="boolean"||n===""?"":typeof n!="number"||n===0||t in WU||t.startsWith("--")?String(n).trim():"".concat(n,"px")),";")))}return r};function Sa(e,t,n,r){if(sA(e))return[];if(Qy(e))return[".".concat(e.styledComponentId)];if(As(e)){if(!As(o=e)||o.prototype&&o.prototype.isReactComponent||!t)return[e];var i=e(t);return Sa(i,t,n,r)}var o;return e instanceof kz?n?(e.inject(n,r),[e.getName(r)]):[e]:Pc(e)?lA(e):Array.isArray(e)?Array.prototype.concat.apply(xh,e.map(function(a){return Sa(a,t,n,r)})):[e.toString()]}function uA(e){for(var t=0;t<e.length;t+=1){var n=e[t];if(As(n)&&!Qy(n))return!1}return!0}var Iz=Vk(Sh),Rz=function(){function e(t,n,r){this.rules=t,this.staticRulesId="",this.isStatic=(r===void 0||r.isStatic)&&uA(t),this.componentId=n,this.baseHash=Ol(Iz,n),this.baseStyle=r,Rh.registerId(n)}return e.prototype.generateAndInjectStyles=function(t,n,r){var i=this.baseStyle?this.baseStyle.generateAndInjectStyles(t,n,r):"";if(this.isStatic&&!r.hash)if(this.staticRulesId&&n.hasNameForId(this.componentId,this.staticRulesId))i=Is(i,this.staticRulesId);else{var o=Xy(Sa(this.rules,t,n,r)),a=Yy(Ol(this.baseHash,o)>>>0);if(!n.hasNameForId(this.componentId,a)){var u=r(o,".".concat(a),void 0,this.componentId);n.insertRules(this.componentId,a,u)}i=Is(i,a),this.staticRulesId=a}else{for(var c=Ol(this.baseHash,r.hash),d="",p=0;p<this.rules.length;p++){var h=this.rules[p];if(typeof h=="string")d+=h;else if(h){var m=Xy(Sa(h,t,n,r));c=Ol(c,m+p),d+=m}}if(d){var v=Yy(c>>>0);n.hasNameForId(this.componentId,v)||n.insertRules(this.componentId,v,r(d,".".concat(v),void 0,this.componentId)),i=Is(i,v)}}return i},e}(),Bc=Dn.createContext(void 0);Bc.Consumer;function Oz(e){var t=Dn.useContext(Bc),n=Y.useMemo(function(){return function(r,i){if(!r)throw Rs(14);if(As(r)){var o=r(i);return o}if(Array.isArray(r)||typeof r!="object")throw Rs(8);return i?nr(nr({},i),r):r}(e.theme,t)},[e.theme,t]);return e.children?Dn.createElement(Bc.Provider,{value:n},e.children):null}var r_={};function Tz(e,t,n){var r=Qy(e),i=e,o=!Ky(e),a=t.attrs,u=a===void 0?xh:a,c=t.componentId,d=c===void 0?function(I,O){var T=typeof I!="string"?"sc":jk(I);r_[T]=(r_[T]||0)+1;var $="".concat(T,"-").concat(Zk(Sh+T+r_[T]));return O?"".concat(O,"-").concat($):$}(t.displayName,t.parentComponentId):c,p=t.displayName,h=p===void 0?function(I){return Ky(I)?"styled.".concat(I):"Styled(".concat(tz(I),")")}(e):p,m=t.displayName&&t.componentId?"".concat(jk(t.displayName),"-").concat(t.componentId):t.componentId||d,v=r&&i.attrs?i.attrs.concat(u).filter(Boolean):u,_=t.shouldForwardProp;if(r&&i.shouldForwardProp){var x=i.shouldForwardProp;if(t.shouldForwardProp){var S=t.shouldForwardProp;_=function(I,O){return x(I,O)&&S(I,O)}}else _=x}var b=new Rz(n,m,r?i.componentStyle:void 0);function C(I,O){return function(T,$,F){var q=T.attrs,P=T.componentStyle,G=T.defaultProps,X=T.foldedComponentIds,se=T.styledComponentId,V=T.target,ne=Dn.useContext(Bc),z=Oh(),Z=T.shouldForwardProp||z.shouldForwardProp,ce=zk($,ne,G)||Rl,we=function(Te,de,Ke){for(var Pe,rt=nr(nr({},de),{className:void 0,theme:Ke}),st=0;st<Te.length;st+=1){var $e=As(Pe=Te[st])?Pe(rt):Pe;for(var ye in $e)rt[ye]=ye==="className"?Is(rt[ye],$e[ye]):ye==="style"?nr(nr({},rt[ye]),$e[ye]):$e[ye]}return de.className&&(rt.className=Is(rt.className,de.className)),rt}(q,$,ce),k=we.as||V,J={};for(var ue in we)we[ue]===void 0||ue[0]==="$"||ue==="as"||ue==="theme"&&we.theme===ce||(ue==="forwardedAs"?J.as=we.forwardedAs:Z&&!Z(ue,k)||(J[ue]=we[ue],Z||wr.NODE_ENV));var L=function(Te,de){var Ke=Oh(),Pe=Te.generateAndInjectStyles(de,Ke.styleSheet,Ke.stylis);return Pe}(P,we),_e=Is(X,se);return L&&(_e+=" "+L),we.className&&(_e+=" "+we.className),J[Ky(k)&&!qk.has(k)?"class":"className"]=_e,F&&(J.ref=F),Y.createElement(k,J)}(E,I,O)}C.displayName=h;var E=Dn.forwardRef(C);return E.attrs=v,E.componentStyle=b,E.displayName=h,E.shouldForwardProp=_,E.foldedComponentIds=r?Is(i.foldedComponentIds,i.styledComponentId):"",E.styledComponentId=m,E.target=r?i.target:e,Object.defineProperty(E,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(I){this._foldedDefaultProps=r?function(O){for(var T=[],$=1;$<arguments.length;$++)T[$-1]=arguments[$];for(var F=0,q=T;F<q.length;F++)Jy(O,q[F],!0);return O}({},i.defaultProps,I):I}}),e_(E,function(){return".".concat(E.styledComponentId)}),o&&eA(E,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0}),E}function cA(e,t){for(var n=[e[0]],r=0,i=t.length;r<i;r+=1)n.push(t[r],e[r+1]);return n}var fA=function(e){return Object.assign(e,{isCss:!0})};function To(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(As(e)||Pc(e))return fA(Sa(cA(xh,Lc([e],t,!0))));var r=e;return t.length===0&&r.length===1&&typeof r[0]=="string"?Sa(r):fA(Sa(cA(r,t)))}function i_(e,t,n){if(n===void 0&&(n=Rl),!t)throw Rs(1,t);var r=function(i){for(var o=[],a=1;a<arguments.length;a++)o[a-1]=arguments[a];return e(t,n,To.apply(void 0,Lc([i],o,!1)))};return r.attrs=function(i){return i_(e,t,nr(nr({},n),{attrs:Array.prototype.concat(n.attrs,i).filter(Boolean)}))},r.withConfig=function(i){return i_(e,t,nr(nr({},n),i))},r}var dA=function(e){return i_(Tz,e)},ae=dA;qk.forEach(function(e){ae[e]=dA(e)});var Mz=function(){function e(t,n){this.rules=t,this.componentId=n,this.isStatic=uA(t),Rh.registerId(this.componentId+1)}return e.prototype.createStyles=function(t,n,r,i){var o=i(Xy(Sa(this.rules,n,r,i)),""),a=this.componentId+t;r.insertRules(a,a,o)},e.prototype.removeStyles=function(t,n){n.clearRules(this.componentId+t)},e.prototype.renderStyles=function(t,n,r,i){t>2&&Rh.registerId(this.componentId+t),this.removeStyles(t,r),this.createStyles(t,n,r,i)},e}();function Dz(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=To.apply(void 0,Lc([e],t,!1)),i="sc-global-".concat(Zk(JSON.stringify(r))),o=new Mz(r,i),a=function(c){var d=Oh(),p=Dn.useContext(Bc),h=Dn.useRef(d.styleSheet.allocateGSInstance(i)).current;return d.styleSheet.server&&u(h,c,d.styleSheet,p,d.stylis),Dn.useLayoutEffect(function(){if(!d.styleSheet.server)return u(h,c,d.styleSheet,p,d.stylis),function(){return o.removeStyles(h,d.styleSheet)}},[h,c,d.styleSheet,p,d.stylis]),null};function u(c,d,p,h,m){if(o.isStatic)o.renderStyles(c,QU,p,m);else{var v=nr(nr({},d),{theme:zk(d,h,a.defaultProps)});o.renderStyles(c,v,p,m)}}return Dn.memo(a)}const sr={CHAT_HISTORY:"chat_history",CLICKED_QUESTIONS:"clicked_questions",PENDING_BULK_ITEMS:"pending_bulk_items",LAST_SHOWN_MESSAGE_ID:"last_shown_message_id",HIDDEN_DYNAMIC_SUGGESTED_QUESTIONS:"hidden_dynamic_suggested_questions",CHAT_RATING:"chat_rating",SHOPIFY_META_DATA:"shopify_meta_data",SESSION_ID:"session_id",USER_INFO:"user_info",IS_FORM_CLOSED_BY_USER:"is_form_closed_by_user"};var Th={USER:"anurag",npm_config_user_agent:"pnpm/10.7.1 npm/? node/v20.11.1 linux x64",npm_node_execpath:"/home/anurag/.local/share/pnpm/nodejs/22.15.0/bin/node",WT_PROFILE_ID:"{51855cb2-8cce-5362-8f54-464b92b32386}",SHLVL:"1",npm_config_noproxy:"",HOME:"/home/anurag",OLDPWD:"/home/anurag",LESS:"-R",npm_package_json:"/home/anurag/workstation/debales/debales/packages/ai/package.json",ZSH:"/home/anurag/.oh-my-zsh",LSCOLORS:"Gxfxcxdxbxegedabagacad",PAGER:"less",npm_config_userconfig:"/home/anurag/.npmrc",npm_config_local_prefix:"/home/anurag/workstation/debales/debales/packages/ai",DBUS_SESSION_BUS_ADDRESS:"unix:path=/run/user/1000/bus",P9K_TTY:"old",npm_config_engine_strict:"true",WSL_DISTRO_NAME:"Ubuntu",COLOR:"0",npm_config_otp:"233935",WAYLAND_DISPLAY:"wayland-0",LOGNAME:"anurag",PULSE_SERVER:"unix:/mnt/wslg/PulseServer",WSL_INTEROP:"/run/WSL/428_interop",NAME:"Anurag-PC",_P9K_SSH_TTY:"/dev/pts/0",_:"/home/anurag/.local/share/pnpm/pnpm",npm_config_prefix:"/home/anurag/.local/share/pnpm/nodejs/22.15.0",npm_config_npm_version:"10.9.2",npm_config_registry:"https://registry.npmjs.org/",TERM:"xterm-256color",npm_config_cache:"/home/anurag/.npm",npm_config_node_gyp:"/home/anurag/.local/share/pnpm/nodejs/22.15.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js",PATH:"/home/anurag/workstation/debales/debales/packages/ai/node_modules/.bin:/home/anurag/workstation/debales/debales/packages/node_modules/.bin:/home/anurag/workstation/debales/debales/node_modules/.bin:/home/anurag/workstation/debales/node_modules/.bin:/home/anurag/workstation/node_modules/.bin:/home/anurag/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/home/anurag/.local/share/pnpm/nodejs/22.15.0/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin:/home/anurag/workstation/debales/debales/packages/ai/node_modules/.bin:/snapshot/dist/node-gyp-bin:/home/anurag/workstation/debales/debales/node_modules/.bin:/home/anurag/workstation/debales/debales/packages/ai/node_modules/.bin:/snapshot/dist/node-gyp-bin:/home/anurag/workstation/debales/debales/node_modules/.bin:/home/anurag/workstation/debales/debales/node_modules/.bin:/snapshot/dist/node-gyp-bin:/home/anurag/workstation/debales/debales/node_modules/.bin:/home/anurag/.local/share/pnpm/.tools/@pnpm+linux-x64/10.7.1/bin:/home/anurag/.gvm/bin:/mnt/c/Users/anura/AppData/Local/Programs/cursor/resources/app/bin:/home/anurag/go/bin:/usr/local/go/bin:/home/anurag/bin:/usr/local/bin:/home/anurag/.local/share/pnpm:/usr/local/sbin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Windows/system32:/mnt/c/Windows:/mnt/c/Windows/System32/Wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0/:/mnt/c/Windows/System32/OpenSSH/:/mnt/c/Program:Files:(x86)/NVIDIA:Corporation/PhysX/Common:Files/NVIDIA:Corporation/NVIDIA:app/NvDLISR:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:Files/Docker/Docker/resources/bin:/mnt/c/Users/anura/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/anura/AppData/Local/Programs/Microsoft:VS:Code/bin:/home/linuxbrew/.linuxbrew/bin",NODE:"/home/anurag/.local/share/pnpm/nodejs/22.15.0/bin/node",npm_package_name:"@debales/ai",XDG_RUNTIME_DIR:"/run/user/1000/",WT_SESSION:"8282efe2-95da-4bd0-9557-5049be79bdfe",npm_config_frozen_lockfile:"",DISPLAY:":0",LANG:"C.UTF-8",LS_COLORS:"rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:",npm_lifecycle_script:"tsc -b && vite build --config vite.browser.config.ts",GVM_VERSION:"1.0.22",SHELL:"/usr/bin/zsh",NODE_PATH:"/home/anurag/workstation/debales/debales/node_modules/.pnpm/vite@6.2.5_@types+node@22.14.0_jiti@2.4.2_lightningcss@1.29.2_terser@5.39.0_yaml@2.7.1/node_modules/vite/bin/node_modules:/home/anurag/workstation/debales/debales/node_modules/.pnpm/vite@6.2.5_@types+node@22.14.0_jiti@2.4.2_lightningcss@1.29.2_terser@5.39.0_yaml@2.7.1/node_modules/vite/node_modules:/home/anurag/workstation/debales/debales/node_modules/.pnpm/vite@6.2.5_@types+node@22.14.0_jiti@2.4.2_lightningcss@1.29.2_terser@5.39.0_yaml@2.7.1/node_modules:/home/anurag/workstation/debales/debales/node_modules/.pnpm/node_modules:/home/anurag/workstation/debales/debales/node_modules/.pnpm/@changesets+cli@2.28.1/node_modules/@changesets/cli/node_modules:/home/anurag/workstation/debales/debales/node_modules/.pnpm/@changesets+cli@2.28.1/node_modules/@changesets/node_modules:/home/anurag/workstation/debales/debales/node_modules/.pnpm/@changesets+cli@2.28.1/node_modules:/home/anurag/workstation/debales/debales/node_modules/.pnpm/node_modules:/home/anurag/.local/share/pnpm/global/5/.pnpm/@pnpm+exe@10.6.3/node_modules/@pnpm/exe/node_modules:/home/anurag/.local/share/pnpm/global/5/.pnpm/@pnpm+exe@10.6.3/node_modules/@pnpm/node_modules:/home/anurag/.local/share/pnpm/global/5/.pnpm/@pnpm+exe@10.6.3/node_modules:/home/anurag/.local/share/pnpm/global/5/.pnpm/node_modules",npm_package_version:"1.1.8",npm_config_verify_deps_before_run:"false",npm_config_access:"public",npm_lifecycle_event:"build:browser",npm_config_tag:"latest",P9K_SSH:"0",npm_config_globalconfig:"/home/anurag/.config/pnpm/npmrc",npm_config_init_module:"/home/anurag/.npm-init.js",PWD:"/home/anurag/workstation/debales/debales/packages/ai",npm_execpath:"/home/anurag/.local/share/pnpm/nodejs/22.15.0/lib/node_modules/npm/bin/npm-cli.js",GVM_ROOT:"/home/anurag/.gvm",_P9K_TTY:"/dev/pts/0",npm_config_global_prefix:"/home/anurag/.local/share/pnpm/nodejs/22.15.0",PNPM_SCRIPT_SRC_DIR:"/home/anurag/workstation/debales/debales/packages/ai",npm_command:"run-script",BREW_HOME:"/home/linuxbrew/.linuxbrew/bin",HOSTTYPE:"x86_64",WSL2_GUI_APPS_ENABLED:"1",PNPM_HOME:"/home/anurag/.local/share/pnpm",GVM_PATH_BACKUP:"/home/anurag/.gvm/bin:/mnt/c/Users/anura/AppData/Local/Programs/cursor/resources/app/bin:/home/anurag/go/bin:/usr/local/go/bin:/home/anurag/bin:/usr/local/bin:/home/anurag/.local/share/pnpm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Windows/system32:/mnt/c/Windows:/mnt/c/Windows/System32/Wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0/:/mnt/c/Windows/System32/OpenSSH/:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/Program Files/NVIDIA Corporation/NVIDIA app/NvDLISR:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/Docker/Docker/resources/bin:/mnt/c/Users/anura/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/anura/AppData/Local/Programs/Microsoft VS Code/bin:/mnt/c/Users/anura/AppData/Local/Programs/cursor/resources/app/bin:/home/linuxbrew/.linuxbrew/bin",WSLENV:"WT_SESSION:WT_PROFILE_ID:",INIT_CWD:"/home/anurag/workstation/debales/debales/packages/ai",npm_config_json:"true",EDITOR:"vi",NODE_ENV:"production"},Ue;if(typeof window>"u"){var hA={hostname:""};Ue={crypto:{randomUUID:function(){throw Error("unsupported")}},navigator:{userAgent:"",onLine:!0},document:{createElement:function(){return{}},location:hA,referrer:""},screen:{width:0,height:0},location:hA,addEventListener:function(){},removeEventListener:function(){}}}else Ue=window;function pA(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function gA(e,t,n,r,i,o,a){try{var u=e[o](a),c=u.value}catch(d){n(d);return}u.done?t(c):Promise.resolve(c).then(r,i)}function o_(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(c){gA(o,r,i,a,u,"next",c)}function u(c){gA(o,r,i,a,u,"throw",c)}a(void 0)})}}function Mh(e,t,n){return mA()?Mh=Reflect.construct:Mh=function(i,o,a){var u=[null];u.push.apply(u,o);var c=Function.bind.apply(i,u),d=new c;return a&&Uc(d,a.prototype),d},Mh.apply(null,arguments)}function Lz(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function lr(e,t,n){return t&&Lz(e.prototype,t),e}function Ut(){return Ut=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ut.apply(this,arguments)}function a_(e){return a_=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},a_(e)}function xr(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Uc(e,t)}function yt(e,t){return t!=null&&typeof Symbol<"u"&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function $z(e){return Function.toString.call(e).indexOf("[native code]")!==-1}function Fc(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function Uc(e,t){return Uc=Object.setPrototypeOf||function(r,i){return r.__proto__=i,r},Uc(e,t)}function Mt(e){"@swc/helpers - typeof";return e&&typeof Symbol<"u"&&e.constructor===Symbol?"symbol":typeof e}function Nz(e,t){if(e){if(typeof e=="string")return pA(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return pA(e,t)}}function Dh(e){var t=typeof Map=="function"?new Map:void 0;return Dh=function(r){if(r===null||!$z(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(typeof t<"u"){if(t.has(r))return t.get(r);t.set(r,i)}function i(){return Mh(r,arguments,a_(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Uc(i,r)},Dh(e)}function mA(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(mA=function(){return!!e})()}function Ze(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=Nz(e))||t){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function zc(e,t){var n,r,i,o,a={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(d){return function(p){return c([d,p])}}function c(d){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=d[0]&2?r.return:d[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,d[1])).done)return i;switch(r=0,i&&(d=[d[0]&2,i.value]),d[0]){case 0:case 1:i=d;break;case 4:return a.label++,{value:d[1],done:!1};case 5:a.label++,r=d[1],d=[0];continue;case 7:d=a.ops.pop(),a.trys.pop();continue;default:if(i=a.trys,!(i=i.length>0&&i[i.length-1])&&(d[0]===6||d[0]===2)){a=0;continue}if(d[0]===3&&(!i||d[1]>i[0]&&d[1]<i[3])){a.label=d[1];break}if(d[0]===6&&a.label<i[1]){a.label=i[1],i=d;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(d);break}i[2]&&a.ops.pop(),a.trys.pop();continue}d=t.call(e,a)}catch(p){d=[6,p],r=0}finally{n=i=0}if(d[0]&5)throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}}function vA(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}var Pz=Object.defineProperty,Bz=function(e,t,n){return t in e?Pz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},Ne=function(e,t,n){return Bz(e,(typeof t>"u"?"undefined":Mt(t))!=="symbol"?t+"":t,n)},yA,Fz=Object.defineProperty,Uz=function(e,t,n){return t in e?Fz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},_A=function(e,t,n){return Uz(e,(typeof t>"u"?"undefined":Mt(t))!=="symbol"?t+"":t,n)},Kn=function(e){return e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e}(Kn||{}),bA={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},SA={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Lh={},zz=function(){return!!globalThis.Zone};function s_(e){if(Lh[e])return Lh[e];var t=globalThis[e],n=t.prototype,r=e in bA?bA[e]:void 0,i=!!(r&&r.every(function(p){var h,m;return!!((m=(h=Object.getOwnPropertyDescriptor(n,p))==null?void 0:h.get)!=null&&m.toString().includes("[native code]"))})),o=e in SA?SA[e]:void 0,a=!!(o&&o.every(function(p){var h;return typeof n[p]=="function"&&((h=n[p])==null?void 0:h.toString().includes("[native code]"))}));if(i&&a&&!zz())return Lh[e]=t.prototype,t.prototype;try{var u=document.createElement("iframe");document.body.appendChild(u);var c=u.contentWindow;if(!c)return t.prototype;var d=c[e].prototype;return document.body.removeChild(u),d?Lh[e]=d:n}catch{return n}}var l_={};function wa(e,t,n){var r,i=e+"."+String(n);if(l_[i])return l_[i].call(t);var o=s_(e),a=(r=Object.getOwnPropertyDescriptor(o,n))==null?void 0:r.get;return a?(l_[i]=a,a.call(t)):t[n]}var u_={};function wA(e,t,n){var r=e+"."+String(n);if(u_[r])return u_[r].bind(t);var i=s_(e),o=i[n];return typeof o!="function"?t[n]:(u_[r]=o,o.bind(t))}function qz(e){return wa("Node",e,"childNodes")}function jz(e){return wa("Node",e,"parentNode")}function Hz(e){return wa("Node",e,"parentElement")}function Gz(e){return wa("Node",e,"textContent")}function Vz(e,t){return wA("Node",e,"contains")(t)}function Zz(e){return wA("Node",e,"getRootNode")()}function Yz(e){return!e||!("host"in e)?null:wa("ShadowRoot",e,"host")}function Wz(e){return e.styleSheets}function Kz(e){return!e||!("shadowRoot"in e)?null:wa("Element",e,"shadowRoot")}function Qz(e,t){return wa("Element",e,"querySelector")(t)}function Xz(e,t){return wa("Element",e,"querySelectorAll")(t)}function Jz(){return s_("MutationObserver").constructor}var Cr={childNodes:qz,parentNode:jz,parentElement:Hz,textContent:Gz,contains:Vz,getRootNode:Zz,host:Yz,styleSheets:Wz,shadowRoot:Kz,querySelector:Qz,querySelectorAll:Xz,mutationObserver:Jz};function xA(e){return e.nodeType===e.ELEMENT_NODE}function qc(e){var t=e&&"host"in e&&"mode"in e&&Cr.host(e)||null;return!!(t&&"shadowRoot"in t&&Cr.shadowRoot(t)===e)}function jc(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function e7(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),e}function t7(e){var t=e.cssText;if(t.split('"').length<3)return t;var n=["@import","url("+JSON.stringify(e.href)+")"];return e.layerName===""?n.push("layer"):e.layerName&&n.push("layer("+e.layerName+")"),e.supportsText&&n.push("supports("+e.supportsText+")"),e.media.length&&n.push(e.media.mediaText),n.join(" ")+";"}function c_(e){try{var t=e.rules||e.cssRules;if(!t)return null;var n=e.href;!n&&e.ownerNode&&e.ownerNode.ownerDocument&&(n=e.ownerNode.ownerDocument.location.href);var r=Array.from(t,function(i){return CA(i,n)}).join("");return e7(r)}catch{return null}}function CA(e,t){if(r7(e)){var n;try{n=c_(e.styleSheet)||t7(e)}catch{n=e.cssText}return e.styleSheet.href?$h(n,e.styleSheet.href):n}else{var r=e.cssText;return i7(e)&&e.selectorText.includes(":")&&(r=n7(r)),t?$h(r,t):r}}function n7(e){var t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function r7(e){return"styleSheet"in e}function i7(e){return"selectorText"in e}var EA=function(){function e(){_A(this,"idNodeMap",new Map),_A(this,"nodeMetaMap",new WeakMap)}var t=e.prototype;return t.getId=function(r){var i;if(!r)return-1;var o=(i=this.getMeta(r))==null?void 0:i.id;return o??-1},t.getNode=function(r){return this.idNodeMap.get(r)||null},t.getIds=function(){return Array.from(this.idNodeMap.keys())},t.getMeta=function(r){return this.nodeMetaMap.get(r)||null},t.removeNodeFromMap=function(r){var i=this,o=this.getId(r);this.idNodeMap.delete(o),r.childNodes&&r.childNodes.forEach(function(a){return i.removeNodeFromMap(a)})},t.has=function(r){return this.idNodeMap.has(r)},t.hasNode=function(r){return this.nodeMetaMap.has(r)},t.add=function(r,i){var o=i.id;this.idNodeMap.set(o,r),this.nodeMetaMap.set(r,i)},t.replace=function(r,i){var o=this.getNode(r);if(o){var a=this.nodeMetaMap.get(o);a&&this.nodeMetaMap.set(i,a)}this.idNodeMap.set(r,i)},t.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},e}();function o7(){return new EA}function f_(e){var t=e.element,n=e.maskInputOptions,r=e.tagName,i=e.type,o=e.value,a=e.maskInputFn,u=o||"",c=i&&Os(i);return(n[r.toLowerCase()]||c&&n[c])&&(a?u=a(u,t):u="*".repeat(u.length)),u}function Os(e){return e.toLowerCase()}var kA="__rrweb_original__";function a7(e){var t=e.getContext("2d");if(!t)return!0;for(var n=50,r=0;r<e.width;r+=n)for(var i=0;i<e.height;i+=n){var o=t.getImageData,a=kA in o?o[kA]:o,u=new Uint32Array(a.call(t,r,i,Math.min(n,e.width-r),Math.min(n,e.height-i)).data.buffer);if(u.some(function(c){return c!==0}))return!1}return!0}function d_(e){var t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?Os(t):null}function AA(e,t){var n;try{n=new URL(e,t??window.location.href)}catch{return null}var r=/\.([0-9a-z]+)(?:$)/i,i=n.pathname.match(r),o;return(o=i==null?void 0:i[1])!=null?o:null}function s7(e){var t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var l7=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,u7=/^(?:[a-z+]+:)?\/\//i,c7=/^www\..*/i,f7=/^(data:)([^,]*),(.*)/i;function $h(e,t){return(e||"").replace(l7,function(n,r,i,o,a,u){var c=i||a||u,d=r||o||"";if(!c)return n;if(u7.test(c)||c7.test(c)||f7.test(c))return"url("+d+c+d+")";if(c[0]==="/")return"url("+d+(s7(t)+c)+d+")";var p=t.split("/"),h=c.split("/");p.pop();for(var m=Ze(h),v;!(v=m()).done;){var _=v.value;_!=="."&&(_===".."?p.pop():p.push(_))}return"url("+d+p.join("/")+d+")"})}function h_(e){return e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"")}function d7(e,t){var n=Array.from(t.childNodes),r=[];if(n.length>1&&e&&typeof e=="string"){for(var i=h_(e),o=1;o<n.length;o++)if(n[o].textContent&&typeof n[o].textContent=="string")for(var a=h_(n[o].textContent),u=3;u<a.length;u++){var c=a.substring(0,u);if(i.split(c).length===2){for(var d=i.indexOf(c),p=d;p<e.length;p++)if(h_(e.substring(0,p)).length===d){r.push(e.substring(0,p)),e=e.substring(p);break}break}}}return r.push(e),r}function h7(e,t){return d7(e,t).join("/* rr_split */")}var p7=1,g7=new RegExp("[^a-z0-9-_:]"),Hc=-2;function IA(){return p7++}function m7(e){if(yt(e,HTMLFormElement))return"form";var t=Os(e.tagName);return g7.test(t)?"div":t}var Tl,RA,v7=/^[^ \t\n\r\u000c]+/,y7=/^[, \t\n\r\u000c]+/;function _7(e,t){if(t.trim()==="")return t;var n=0;function r(d){var p,h=d.exec(t.substring(n));return h?(p=h[0],n+=p.length,p):""}for(var i=[];r(y7),!(n>=t.length);){var o=r(v7);if(o.slice(-1)===",")o=Ml(e,o.substring(0,o.length-1)),i.push(o);else{var a="";o=Ml(e,o);for(var u=!1;;){var c=t.charAt(n);if(c===""){i.push((o+a).trim());break}else if(u)c===")"&&(u=!1);else if(c===","){n+=1,i.push((o+a).trim());break}else c==="("&&(u=!0);a+=c,n+=1}}}return i.join(", ")}var OA=new WeakMap;function Ml(e,t){return!t||t.trim()===""?t:p_(e,t)}function b7(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function p_(e,t){var n=OA.get(e);if(n||(n=e.createElement("a"),OA.set(e,n)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return n.setAttribute("href",t),n.href}function TA(e,t,n,r){return r&&(n==="src"||n==="href"&&!(t==="use"&&r[0]==="#")||n==="xlink:href"&&r[0]!=="#"||n==="background"&&(t==="table"||t==="td"||t==="th")?Ml(e,r):n==="srcset"?_7(e,r):n==="style"?$h(r,p_(e)):t==="object"&&n==="data"?Ml(e,r):r)}function MA(e,t,n){return(e==="video"||e==="audio")&&t==="autoplay"}function S7(e,t,n){try{if(typeof t=="string"){if(e.classList.contains(t))return!0}else for(var r=e.classList.length;r--;){var i=e.classList[r];if(t.test(i))return!0}if(n)return e.matches(n)}catch{}return!1}function Nh(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return n?Nh(Cr.parentNode(e),t,n):!1;for(var r=e.classList.length;r--;){var i=e.classList[r];if(t.test(i))return!0}return n?Nh(Cr.parentNode(e),t,n):!1}function DA(e,t,n,r){var i;if(xA(e)){if(i=e,!Cr.childNodes(i).length)return!1}else{if(Cr.parentElement(e)===null)return!1;i=Cr.parentElement(e)}try{if(typeof t=="string"){if(r){if(i.closest("."+t))return!0}else if(i.classList.contains(t))return!0}else if(Nh(i,t,r))return!0;if(n){if(r){if(i.closest(n))return!0}else if(i.matches(n))return!0}}catch{}return!1}function w7(e,t,n){var r=e.contentWindow;if(r){var i=!1,o;try{o=r.document.readyState}catch{return}if(o!=="complete"){var a=setTimeout(function(){i||(t(),i=!0)},n);e.addEventListener("load",function(){clearTimeout(a),i=!0,t()});return}var u="about:blank";if(r.location.href!==u||e.src===u||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}}function x7(e,t,n){var r=!1,i;try{i=e.sheet}catch{return}if(!i){var o=setTimeout(function(){r||(t(),r=!0)},n);e.addEventListener("load",function(){clearTimeout(o),r=!0,t()})}}function C7(e,t){var n=t.doc,r=t.mirror,i=t.blockClass,o=t.blockSelector,a=t.needsMask,u=t.inlineStylesheet,c=t.maskInputOptions,d=c===void 0?{}:c,p=t.maskTextFn,h=t.maskInputFn,m=t.dataURLOptions,v=m===void 0?{}:m,_=t.inlineImages,x=t.recordCanvas,S=t.keepIframeSrcFn,b=t.newlyAddedElement,C=b===void 0?!1:b,E=t.cssCaptured,I=E===void 0?!1:E,O=E7(n,r);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:Kn.Document,childNodes:[],compatMode:e.compatMode}:{type:Kn.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:Kn.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:O};case e.ELEMENT_NODE:return A7(e,{doc:n,blockClass:i,blockSelector:o,inlineStylesheet:u,maskInputOptions:d,maskInputFn:h,dataURLOptions:v,inlineImages:_,recordCanvas:x,keepIframeSrcFn:S,newlyAddedElement:C,rootId:O});case e.TEXT_NODE:return k7(e,{doc:n,needsMask:a,maskTextFn:p,rootId:O,cssCaptured:I});case e.CDATA_SECTION_NODE:return{type:Kn.CDATA,textContent:"",rootId:O};case e.COMMENT_NODE:return{type:Kn.Comment,textContent:Cr.textContent(e)||"",rootId:O};default:return!1}}function E7(e,t){if(t.hasNode(e)){var n=t.getId(e);return n===1?void 0:n}}function k7(e,t){var n=t.needsMask,r=t.maskTextFn,i=t.rootId,o=t.cssCaptured,a=Cr.parentNode(e),u=a&&a.tagName,c="",d=u==="STYLE"?!0:void 0,p=u==="SCRIPT"?!0:void 0;return p?c="SCRIPT_PLACEHOLDER":o||(c=Cr.textContent(e),d&&c&&(c=$h(c,p_(t.doc)))),!d&&!p&&c&&n&&(c=r?r(c,Cr.parentElement(e)):c.replace(/[\S]/g,"*")),{type:Kn.Text,textContent:c||"",rootId:i}}function A7(e,t){for(var n=t.doc,r=t.blockClass,i=t.blockSelector,o=t.inlineStylesheet,a=t.maskInputOptions,u=a===void 0?{}:a,c=t.maskInputFn,d=t.dataURLOptions,p=d===void 0?{}:d,h=t.inlineImages,m=t.recordCanvas,v=t.keepIframeSrcFn,_=t.newlyAddedElement,x=_===void 0?!1:_,S=t.rootId,b=S7(e,r,i),C=m7(e),E={},I=e.attributes.length,O=0;O<I;O++){var T=e.attributes[O];MA(C,T.name,T.value)||(E[T.name]=TA(n,C,Os(T.name),T.value))}if(C==="link"&&o){var $=Array.from(n.styleSheets).find(function(_e){return _e.href===e.href}),F=null;$&&(F=c_($)),F&&(delete E.rel,delete E.href,E._cssText=F)}if(C==="style"&&e.sheet){var q=c_(e.sheet);q&&(e.childNodes.length>1&&(q=h7(q,e)),E._cssText=q)}if(C==="input"||C==="textarea"||C==="select"){var P=e.value,G=e.checked;E.type!=="radio"&&E.type!=="checkbox"&&E.type!=="submit"&&E.type!=="button"&&P?E.value=f_({element:e,type:d_(e),tagName:C,value:P,maskInputOptions:u,maskInputFn:c}):G&&(E.checked=G)}if(C==="option"&&(e.selected&&!u.select?E.selected=!0:delete E.selected),C==="dialog"&&e.open&&(E.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"),C==="canvas"&&m){if(e.__context==="2d")a7(e)||(E.rr_dataURL=e.toDataURL(p.type,p.quality));else if(!("__context"in e)){var X=e.toDataURL(p.type,p.quality),se=n.createElement("canvas");se.width=e.width,se.height=e.height;var V=se.toDataURL(p.type,p.quality);X!==V&&(E.rr_dataURL=X)}}if(C==="img"&&h){Tl||(Tl=n.createElement("canvas"),RA=Tl.getContext("2d"));var ne=e,z=ne.currentSrc||ne.getAttribute("src")||"<unknown-src>",Z=ne.crossOrigin,ce=function(){ne.removeEventListener("load",ce);try{Tl.width=ne.naturalWidth,Tl.height=ne.naturalHeight,RA.drawImage(ne,0,0),E.rr_dataURL=Tl.toDataURL(p.type,p.quality)}catch(_e){if(ne.crossOrigin!=="anonymous"){ne.crossOrigin="anonymous",ne.complete&&ne.naturalWidth!==0?ce():ne.addEventListener("load",ce);return}else console.warn("Cannot inline img src="+z+"! Error: "+_e)}ne.crossOrigin==="anonymous"&&(Z?E.crossOrigin=Z:ne.removeAttribute("crossorigin"))};ne.complete&&ne.naturalWidth!==0?ce():ne.addEventListener("load",ce)}if(C==="audio"||C==="video"){var we=E;we.rr_mediaState=e.paused?"paused":"played",we.rr_mediaCurrentTime=e.currentTime,we.rr_mediaPlaybackRate=e.playbackRate,we.rr_mediaMuted=e.muted,we.rr_mediaLoop=e.loop,we.rr_mediaVolume=e.volume}if(x||(e.scrollLeft&&(E.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(E.rr_scrollTop=e.scrollTop)),b){var k=e.getBoundingClientRect(),J=k.width,ue=k.height;E={class:E.class,rr_width:""+J+"px",rr_height:""+ue+"px"}}C==="iframe"&&!v(E.src)&&(e.contentDocument||(E.rr_src=E.src),delete E.src);var L;try{customElements.get(C)&&(L=!0)}catch{}return{type:Kn.Element,tagName:C,attributes:E,childNodes:[],isSVG:b7(e)||void 0,needBlock:b,rootId:S,isCustom:L}}function un(e){return e==null?"":e.toLowerCase()}function I7(e,t){if(t.comment&&e.type===Kn.Comment)return!0;if(e.type===Kn.Element){if(t.script&&(e.tagName==="script"||e.tagName==="link"&&(e.attributes.rel==="preload"||e.attributes.rel==="modulepreload")&&e.attributes.as==="script"||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&AA(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(un(e.attributes.name).match(/^msapplication-tile(image|color)$/)||un(e.attributes.name)==="application-name"||un(e.attributes.rel)==="icon"||un(e.attributes.rel)==="apple-touch-icon"||un(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&un(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(un(e.attributes.property).match(/^(og|twitter|fb):/)||un(e.attributes.name).match(/^(og|twitter):/)||un(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(un(e.attributes.name)==="robots"||un(e.attributes.name)==="googlebot"||un(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(un(e.attributes.name)==="author"||un(e.attributes.name)==="generator"||un(e.attributes.name)==="framework"||un(e.attributes.name)==="publisher"||un(e.attributes.name)==="progid"||un(e.attributes.property).match(/^article:/)||un(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(un(e.attributes.name)==="google-site-verification"||un(e.attributes.name)==="yandex-verification"||un(e.attributes.name)==="csrf-token"||un(e.attributes.name)==="p:domain_verify"||un(e.attributes.name)==="verify-v1"||un(e.attributes.name)==="verification"||un(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function Dl(e,t){var n=t.doc,r=t.mirror,i=t.blockClass,o=t.blockSelector,a=t.maskTextClass,u=t.maskTextSelector,c=t.skipChild,d=c===void 0?!1:c,p=t.inlineStylesheet,h=p===void 0?!0:p,m=t.maskInputOptions,v=m===void 0?{}:m,_=t.maskTextFn,x=t.maskInputFn,S=t.slimDOMOptions,b=t.dataURLOptions,C=b===void 0?{}:b,E=t.inlineImages,I=E===void 0?!1:E,O=t.recordCanvas,T=O===void 0?!1:O,$=t.onSerialize,F=t.onIframeLoad,q=t.iframeLoadTimeout,P=q===void 0?5e3:q,G=t.onStylesheetLoad,X=t.stylesheetLoadTimeout,se=X===void 0?5e3:X,V=t.keepIframeSrcFn,ne=V===void 0?function(){return!1}:V,z=t.newlyAddedElement,Z=z===void 0?!1:z,ce=t.cssCaptured,we=ce===void 0?!1:ce,k=t.needsMask,J=t.preserveWhiteSpace,ue=J===void 0?!0:J;if(!k){var L=k===void 0;k=DA(e,a,u,L)}var _e=C7(e,{doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:k,inlineStylesheet:h,maskInputOptions:v,maskTextFn:_,maskInputFn:x,dataURLOptions:C,inlineImages:I,recordCanvas:T,keepIframeSrcFn:ne,newlyAddedElement:Z,cssCaptured:we});if(!_e)return console.warn(e,"not serialized"),null;var Te;r.hasNode(e)?Te=r.getId(e):I7(_e,S)||!ue&&_e.type===Kn.Text&&!_e.textContent.replace(/^\s+|\s+$/gm,"").length?Te=Hc:Te=IA();var de=Object.assign(_e,{id:Te});if(r.add(e,de),Te===Hc)return null;$&&$(e);var Ke=!d;if(de.type===Kn.Element){Ke=Ke&&!de.needBlock,delete de.needBlock;var Pe=Cr.shadowRoot(e);Pe&&jc(Pe)&&(de.isShadowHost=!0)}if((de.type===Kn.Document||de.type===Kn.Element)&&Ke){S.headWhitespace&&de.type===Kn.Element&&de.tagName==="head"&&(ue=!1);var rt={doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:k,maskTextClass:a,maskTextSelector:u,skipChild:d,inlineStylesheet:h,maskInputOptions:v,maskTextFn:_,maskInputFn:x,slimDOMOptions:S,dataURLOptions:C,inlineImages:I,recordCanvas:T,preserveWhiteSpace:ue,onSerialize:$,onIframeLoad:F,iframeLoadTimeout:P,onStylesheetLoad:G,stylesheetLoadTimeout:se,keepIframeSrcFn:ne,cssCaptured:!1};if(!(de.type===Kn.Element&&de.tagName==="textarea"&&de.attributes.value!==void 0)){de.type===Kn.Element&&de.attributes._cssText!==void 0&&typeof de.attributes._cssText=="string"&&(rt.cssCaptured=!0);for(var st=Ze(Array.from(Cr.childNodes(e))),$e;!($e=st()).done;){var ye=$e.value,ze=Dl(ye,rt);ze&&de.childNodes.push(ze)}}var Ge=null;if(xA(e)&&(Ge=Cr.shadowRoot(e)))for(var lt=Ze(Array.from(Cr.childNodes(Ge))),Xe;!(Xe=lt()).done;){var nt=Xe.value,N=Dl(nt,rt);N&&(jc(Ge)&&(N.isShadow=!0),de.childNodes.push(N))}}var B=Cr.parentNode(e);return B&&qc(B)&&jc(B)&&(de.isShadow=!0),de.type===Kn.Element&&de.tagName==="iframe"&&w7(e,function(){var H=e.contentDocument;if(H&&F){var he=Dl(H,{doc:H,mirror:r,blockClass:i,blockSelector:o,needsMask:k,maskTextClass:a,maskTextSelector:u,skipChild:!1,inlineStylesheet:h,maskInputOptions:v,maskTextFn:_,maskInputFn:x,slimDOMOptions:S,dataURLOptions:C,inlineImages:I,recordCanvas:T,preserveWhiteSpace:ue,onSerialize:$,onIframeLoad:F,iframeLoadTimeout:P,onStylesheetLoad:G,stylesheetLoadTimeout:se,keepIframeSrcFn:ne});he&&F(e,he)}},P),de.type===Kn.Element&&de.tagName==="link"&&typeof de.attributes.rel=="string"&&(de.attributes.rel==="stylesheet"||de.attributes.rel==="preload"&&typeof de.attributes.href=="string"&&AA(de.attributes.href)==="css")&&x7(e,function(){if(G){var H=Dl(e,{doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:k,maskTextClass:a,maskTextSelector:u,skipChild:!1,inlineStylesheet:h,maskInputOptions:v,maskTextFn:_,maskInputFn:x,slimDOMOptions:S,dataURLOptions:C,inlineImages:I,recordCanvas:T,preserveWhiteSpace:ue,onSerialize:$,onIframeLoad:F,iframeLoadTimeout:P,onStylesheetLoad:G,stylesheetLoadTimeout:se,keepIframeSrcFn:ne});H&&G(e,H)}},se),de}function R7(e,t){var n=t||{},r=n.mirror,i=r===void 0?new EA:r,o=n.blockClass,a=o===void 0?"rr-block":o,u=n.blockSelector,c=u===void 0?null:u,d=n.maskTextClass,p=d===void 0?"rr-mask":d,h=n.maskTextSelector,m=h===void 0?null:h,v=n.inlineStylesheet,_=v===void 0?!0:v,x=n.inlineImages,S=x===void 0?!1:x,b=n.recordCanvas,C=b===void 0?!1:b,E=n.maskAllInputs,I=E===void 0?!1:E,O=n.maskTextFn,T=n.maskInputFn,$=n.slimDOM,F=$===void 0?!1:$,q=n.dataURLOptions,P=n.preserveWhiteSpace,G=n.onSerialize,X=n.onIframeLoad,se=n.iframeLoadTimeout,V=n.onStylesheetLoad,ne=n.stylesheetLoadTimeout,z=n.keepIframeSrcFn,Z=z===void 0?function(){return!1}:z,ce=I===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:I===!1?{password:!0}:I,we=F===!0||F==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:F==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:F===!1?{}:F;return Dl(e,{doc:e,mirror:i,blockClass:a,blockSelector:c,maskTextClass:p,maskTextSelector:m,skipChild:!1,inlineStylesheet:_,maskInputOptions:ce,maskTextFn:O,maskInputFn:T,slimDOMOptions:we,dataURLOptions:q,inlineImages:S,recordCanvas:C,preserveWhiteSpace:P,onSerialize:G,onIframeLoad:X,iframeLoadTimeout:se,onStylesheetLoad:V,stylesheetLoadTimeout:ne,keepIframeSrcFn:Z,newlyAddedElement:!1})}function O7(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function T7(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return yt(this,r)?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var g_={exports:{}},hn=String,LA=function(){return{isColorSupported:!1,reset:hn,bold:hn,dim:hn,italic:hn,underline:hn,inverse:hn,hidden:hn,strikethrough:hn,black:hn,red:hn,green:hn,yellow:hn,blue:hn,magenta:hn,cyan:hn,white:hn,gray:hn,bgBlack:hn,bgRed:hn,bgGreen:hn,bgYellow:hn,bgBlue:hn,bgMagenta:hn,bgCyan:hn,bgWhite:hn}};g_.exports=LA(),g_.exports.createColors=LA;var M7=g_.exports,D7={},L7=Object.freeze(Object.defineProperty({__proto__:null,default:D7},Symbol.toStringTag,{value:"Module"})),Ln=T7(L7),$A=M7,NA=Ln,m_=function(e){xr(t,e);function t(r,i,o,a,u,c){var d;return d=e.call(this,r)||this,d.name="CssSyntaxError",d.reason=r,u&&(d.file=u),a&&(d.source=a),c&&(d.plugin=c),typeof i<"u"&&typeof o<"u"&&(typeof i=="number"?(d.line=i,d.column=o):(d.line=i.line,d.column=i.column,d.endLine=o.line,d.endColumn=o.column)),d.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(d,t),d}var n=t.prototype;return n.setMessage=function(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason},n.showSourceCode=function(i){var o=this;if(!this.source)return"";var a=this.source;i==null&&(i=$A.isColorSupported),NA&&i&&(a=NA(a));var u=a.split(/\r?\n/),c=Math.max(this.line-3,0),d=Math.min(this.line+2,u.length),p=String(d).length,h,m;if(i){var v=$A.createColors(!0),_=v.bold,x=v.gray,S=v.red;h=function(b){return _(S(b))},m=function(b){return x(b)}}else h=m=function(b){return b};return u.slice(c,d).map(function(b,C){var E=c+1+C,I=" "+(" "+E).slice(-p)+" | ";if(E===o.line){var O=m(I.replace(/\d/g," "))+b.slice(0,o.column-1).replace(/[^\t]/g," ");return h(">")+m(I)+b+`
79
79
  `+O+h("^")}return" "+m(I)+b}).join(`
80
80
  `)},n.toString=function(){var i=this.showSourceCode();return i&&(i=`
81
81
 
@@ -133,7 +133,7 @@ or you can use record.mirror to access the mirror instance during recording.`,IR
133
133
  `+m+"]":"["+v.join(",")+"]",a=m,p}for(d in _)$p.call(_,d)&&(p=r(d,_),p&&v.push(n(d)+(a?": ":":")+p));return p=v.length===0?"{}":a?"{"+v.join(",")+m+"}":"{"+v.join(",")+"}",a=m,p}};return r("",{"":t})}}(),R.JSONDecode=function(){var e,t,n={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
134
134
  `,r:"\r",t:" "},r,i=function(v){var _=new SyntaxError(v);throw _.at=e,_.text=r,_},o=function(v){return v&&v!==t&&i("Expected '"+v+"' instead of '"+t+"'"),t=r.charAt(e),e+=1,t},a=function(){var v,_="";for(t==="-"&&(_="-",o("-"));t>="0"&&t<="9";)_+=t,o();if(t===".")for(_+=".";o()&&t>="0"&&t<="9";)_+=t;if(t==="e"||t==="E")for(_+=t,o(),(t==="-"||t==="+")&&(_+=t,o());t>="0"&&t<="9";)_+=t,o();if(v=+_,!isFinite(v))i("Bad number");else return v},u=function(){var v,_,x="",S;if(t==='"')for(;o();){if(t==='"')return o(),x;if(t==="\\")if(o(),t==="u"){for(S=0,_=0;_<4&&(v=parseInt(o(),16),!!isFinite(v));_+=1)S=S*16+v;x+=String.fromCharCode(S)}else if(typeof n[t]=="string")x+=n[t];else break;else x+=t}i("Bad string")},c=function(){for(;t&&t<=" ";)o()},d=function(){switch(t){case"t":return o("t"),o("r"),o("u"),o("e"),!0;case"f":return o("f"),o("a"),o("l"),o("s"),o("e"),!1;case"n":return o("n"),o("u"),o("l"),o("l"),null}i('Unexpected "'+t+'"')},p,h=function(){var v=[];if(t==="["){if(o("["),c(),t==="]")return o("]"),v;for(;t;){if(v.push(p()),c(),t==="]")return o("]"),v;o(","),c()}}i("Bad array")},m=function(){var v,_={};if(t==="{"){if(o("{"),c(),t==="}")return o("}"),_;for(;t;){if(v=u(),c(),o(":"),Object.hasOwnProperty.call(_,v)&&i('Duplicate key "'+v+'"'),_[v]=p(),c(),t==="}")return o("}"),_;o(","),c()}}i("Bad object")};return p=function(){switch(c(),t){case"{":return m();case"[":return h();case'"':return u();case"-":return a();default:return t>="0"&&t<="9"?a():d()}},function(v){var _;return r=v,e=0,t=" ",_=p(),c(),t&&i("Syntax error"),_}}(),R.base64Encode=function(e){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n,r,i,o,a,u,c,d,p=0,h=0,m="",v=[];if(!e)return e;e=R.utf8Encode(e);do n=e.charCodeAt(p++),r=e.charCodeAt(p++),i=e.charCodeAt(p++),d=n<<16|r<<8|i,o=d>>18&63,a=d>>12&63,u=d>>6&63,c=d&63,v[h++]=t.charAt(o)+t.charAt(a)+t.charAt(u)+t.charAt(c);while(p<e.length);switch(m=v.join(""),e.length%3){case 1:m=m.slice(0,-2)+"==";break;case 2:m=m.slice(0,-1)+"=";break}return m},R.utf8Encode=function(e){e=(e+"").replace(/\r\n/g,`
135
135
  `).replace(/\r/g,`
136
- `);var t="",n,r,i=0,o;for(n=r=0,i=e.length,o=0;o<i;o++){var a=e.charCodeAt(o),u=null;a<128?r++:a>127&&a<2048?u=String.fromCharCode(a>>6|192,a&63|128):u=String.fromCharCode(a>>12|224,a>>6&63|128,a&63|128),u!==null&&(r>n&&(t+=e.substring(n,r)),t+=u,n=r=o+1)}return r>n&&(t+=e.substring(n,e.length)),t},R.UUID=function(){try{return Ue.crypto.randomUUID()}catch{for(var e=new Array(36),t=0;t<36;t++)e[t]=Math.floor(Math.random()*16);return e[14]=4,e[19]=e[19]&=-5,e[19]=e[19]|=8,e[8]=e[13]=e[18]=e[23]="-",R.map(e,function(r){return r.toString(16)}).join("")}};var mO=["ahrefsbot","ahrefssiteaudit","amazonbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","facebookexternal","petalbot","pinterest","screaming frog","yahoo! slurp","yandex","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google"];R.isBlockedUA=function(e){var t;for(e=e.toLowerCase(),t=0;t<mO.length;t++)if(e.indexOf(mO[t])!==-1)return!0;return!1},R.HTTPBuildQuery=function(e,t){var n,r,i=[];return R.isUndefined(t)&&(t="&"),R.each(e,function(o,a){n=encodeURIComponent(o.toString()),r=encodeURIComponent(a),i[i.length]=r+"="+n}),i.join(t)},R.getQueryParam=function(e,t){t=t.replace(/[[]/g,"\\[").replace(/[\]]/g,"\\]");var n="[\\?&]"+t+"=([^&#]*)",r=new RegExp(n),i=r.exec(e);if(i===null||i&&typeof i[1]!="string"&&i[1].length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch{zt.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},R.cookie={get:function(e){for(var t=e+"=",n=Zt.cookie.split(";"),r=0;r<n.length;r++){for(var i=n[r];i.charAt(0)==" ";)i=i.substring(1,i.length);if(i.indexOf(t)===0)return decodeURIComponent(i.substring(t.length,i.length))}return null},parse:function(e){var t;try{t=R.JSONDecode(R.cookie.get(e))||{}}catch{}return t},set_seconds:function(e,t,n,r,i,o,a){var u="",c="",d="";if(a)u="; domain="+a;else if(r){var p=_O(Zt.location.hostname);u=p?"; domain=."+p:""}if(n){var h=new Date;h.setTime(h.getTime()+n*1e3),c="; expires="+h.toGMTString()}o&&(i=!0,d="; SameSite=None"),i&&(d+="; secure"),Zt.cookie=e+"="+encodeURIComponent(t)+c+"; path=/"+u+d},set:function(e,t,n,r,i,o,a){var u="",c="",d="";if(a)u="; domain="+a;else if(r){var p=_O(Zt.location.hostname);u=p?"; domain=."+p:""}if(n){var h=new Date;h.setTime(h.getTime()+n*24*60*60*1e3),c="; expires="+h.toGMTString()}o&&(i=!0,d="; SameSite=None"),i&&(d+="; secure");var m=e+"="+encodeURIComponent(t)+c+"; path=/"+u+d;return Zt.cookie=m,m},remove:function(e,t,n){R.cookie.set(e,"",-1,t,!1,!1,n)}};var vO=function(e){var t=!0;try{var n="__mplss_"+Bb(8),r="xyz";e.setItem(n,r),e.getItem(n)!==r&&(t=!1),e.removeItem(n)}catch{t=!1}return t},Nb=null,df=function(e,t){return Nb!==null&&!t?Nb:Nb=vO(e||Ue.localStorage)},Pb=null,cV=function(e,t){return Pb!==null&&!t?Pb:Pb=vO(e||Ue.sessionStorage)};function yO(e,t,n){var r=function(i){zt.error(t+" error: "+i)};return{is_supported:function(i){var o=n(e,i);return o||zt.error(t+" unsupported"),o},error:r,get:function(i){try{return e.getItem(i)}catch(o){r(o)}return null},parse:function(i){try{return R.JSONDecode(e.getItem(i))||{}}catch{}return null},set:function(i,o){try{e.setItem(i,o)}catch(a){r(a)}},remove:function(i){try{e.removeItem(i)}catch(o){r(o)}}}}R.localStorage=yO(Ue.localStorage,"localStorage",df),R.sessionStorage=yO(Ue.sessionStorage,"sessionStorage",cV),R.register_event=function(){var e=function(r,i,o,a,u){if(!r){zt.error("No valid element provided to register_event");return}if(r.addEventListener&&!a)r.addEventListener(i,o,!!u);else{var c="on"+i,d=r[c];r[c]=t(r,o,d)}};function t(r,i,o){var a=function(u){if(u=u||n(Ue.event),!!u){var c=!0,d,p;return R.isFunction(o)&&(d=o(u)),p=i.call(r,u),(d===!1||p===!1)&&(c=!1),c}};return a}function n(r){return r&&(r.preventDefault=n.preventDefault,r.stopPropagation=n.stopPropagation),r}return n.preventDefault=function(){this.returnValue=!1},n.stopPropagation=function(){this.cancelBubble=!0},e}();var fV=new RegExp('^(\\w*)\\[(\\w+)([=~\\|\\^\\$\\*]?)=?"?([^\\]"]*)"?\\]$');R.dom_query=function(){function e(i){return i.all?i.all:i.getElementsByTagName("*")}var t=/[\t\r\n]/g;function n(i,o){var a=" "+o+" ";return(" "+i.className+" ").replace(t," ").indexOf(a)>=0}function r(i){if(!Zt.getElementsByTagName)return[];var o=i.split(" "),a,u,c,d,p,h,m,v,_,x,S=[Zt];for(h=0;h<o.length;h++){if(a=o[h].replace(/^\s+/,"").replace(/\s+$/,""),a.indexOf("#")>-1){u=a.split("#"),c=u[0];var b=u[1],C=Zt.getElementById(b);if(!C||c&&C.nodeName.toLowerCase()!=c)return[];S=[C];continue}if(a.indexOf(".")>-1){u=a.split("."),c=u[0];var E=u[1];for(c||(c="*"),d=[],p=0,m=0;m<S.length;m++)for(c=="*"?_=e(S[m]):_=S[m].getElementsByTagName(c),v=0;v<_.length;v++)d[p++]=_[v];for(S=[],x=0,m=0;m<d.length;m++)d[m].className&&R.isString(d[m].className)&&n(d[m],E)&&(S[x++]=d[m]);continue}var I=a.match(fV);if(I){c=I[1];var O=I[2],T=I[3],$=I[4];for(c||(c="*"),d=[],p=0,m=0;m<S.length;m++)for(c=="*"?_=e(S[m]):_=S[m].getElementsByTagName(c),v=0;v<_.length;v++)d[p++]=_[v];S=[],x=0;var F;switch(T){case"=":F=function(q){return q.getAttribute(O)==$};break;case"~":F=function(q){return q.getAttribute(O).match(new RegExp("\\b"+$+"\\b"))};break;case"|":F=function(q){return q.getAttribute(O).match(new RegExp("^"+$+"-?"))};break;case"^":F=function(q){return q.getAttribute(O).indexOf($)===0};break;case"$":F=function(q){return q.getAttribute(O).lastIndexOf($)==q.getAttribute(O).length-$.length};break;case"*":F=function(q){return q.getAttribute(O).indexOf($)>-1};break;default:F=function(q){return q.getAttribute(O)}}for(S=[],x=0,m=0;m<d.length;m++)F(d[m])&&(S[x++]=d[m]);continue}for(c=a,d=[],p=0,m=0;m<S.length;m++)for(_=S[m].getElementsByTagName(c),v=0;v<_.length;v++)d[p++]=_[v];S=d}return S}return function(i){return R.isElement(i)?[i]:R.isObject(i)&&!R.isUndefined(i.length)?i:r.call(this,i)}}();var dV=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_source_platform","utm_campaign_id","utm_creative_format","utm_marketing_tactic"],hV=["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"];R.info={campaignParams:function(e){var t="",n={};return R.each(dV,function(r){t=R.getQueryParam(Zt.URL,r),t.length?n[r]=t:e!==void 0&&(n[r]=e)}),n},clickParams:function(){var e="",t={};return R.each(hV,function(n){e=R.getQueryParam(Zt.URL,n),e.length&&(t[n]=e)}),t},marketingParams:function(){return R.extend(R.info.campaignParams(),R.info.clickParams())},searchEngine:function(e){return e.search("https?://(.*)google.([^/?]*)")===0?"google":e.search("https?://(.*)bing.com")===0?"bing":e.search("https?://(.*)yahoo.com")===0?"yahoo":e.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null},searchInfo:function(e){var t=R.info.searchEngine(e),n=t!="yahoo"?"q":"p",r={};if(t!==null){r.$search_engine=t;var i=R.getQueryParam(e,n);i.length&&(r.mp_keyword=i)}return r},browser:function(e,t,n){return t=t||"",n||R.includes(e," OPR/")?R.includes(e,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":R.includes(e,"IEMobile")||R.includes(e,"WPDesktop")?"Internet Explorer Mobile":R.includes(e,"SamsungBrowser/")?"Samsung Internet":R.includes(e,"Edge")||R.includes(e,"Edg/")?"Microsoft Edge":R.includes(e,"FBIOS")?"Facebook Mobile":R.includes(e,"Chrome")?"Chrome":R.includes(e,"CriOS")?"Chrome iOS":R.includes(e,"UCWEB")||R.includes(e,"UCBrowser")?"UC Browser":R.includes(e,"FxiOS")?"Firefox iOS":R.includes(t,"Apple")?R.includes(e,"Mobile")?"Mobile Safari":"Safari":R.includes(e,"Android")?"Android Mobile":R.includes(e,"Konqueror")?"Konqueror":R.includes(e,"Firefox")?"Firefox":R.includes(e,"MSIE")||R.includes(e,"Trident/")?"Internet Explorer":R.includes(e,"Gecko")?"Mozilla":""},browserVersion:function(e,t,n){var r=R.info.browser(e,t,n),i={"Internet Explorer Mobile":/rv:(\d+(\.\d+)?)/,"Microsoft Edge":/Edge?\/(\d+(\.\d+)?)/,Chrome:/Chrome\/(\d+(\.\d+)?)/,"Chrome iOS":/CriOS\/(\d+(\.\d+)?)/,"UC Browser":/(UCBrowser|UCWEB)\/(\d+(\.\d+)?)/,Safari:/Version\/(\d+(\.\d+)?)/,"Mobile Safari":/Version\/(\d+(\.\d+)?)/,Opera:/(Opera|OPR)\/(\d+(\.\d+)?)/,Firefox:/Firefox\/(\d+(\.\d+)?)/,"Firefox iOS":/FxiOS\/(\d+(\.\d+)?)/,Konqueror:/Konqueror:(\d+(\.\d+)?)/,BlackBerry:/BlackBerry (\d+(\.\d+)?)/,"Android Mobile":/android\s(\d+(\.\d+)?)/,"Samsung Internet":/SamsungBrowser\/(\d+(\.\d+)?)/,"Internet Explorer":/(rv:|MSIE )(\d+(\.\d+)?)/,Mozilla:/rv:(\d+(\.\d+)?)/},o=i[r];if(o===void 0)return null;var a=e.match(o);return a?parseFloat(a[a.length-2]):null},os:function(){var e=$o;return/Windows/i.test(e)?/Phone/.test(e)||/WPDesktop/.test(e)?"Windows Phone":"Windows":/(iPhone|iPad|iPod)/.test(e)?"iOS":/Android/.test(e)?"Android":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":/Mac/i.test(e)?"Mac OS X":/Linux/.test(e)?"Linux":/CrOS/.test(e)?"Chrome OS":""},device:function(e){return/Windows Phone/i.test(e)||/WPDesktop/.test(e)?"Windows Phone":/iPad/.test(e)?"iPad":/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":/Android/.test(e)?"Android":""},referringDomain:function(e){var t=e.split("/");return t.length>=3?t[2]:""},currentUrl:function(){return Ue.location.href},properties:function(e){return typeof e!="object"&&(e={}),R.extend(R.strip_empty_properties({$os:R.info.os(),$browser:R.info.browser($o,Ta.vendor,Np),$referrer:Zt.referrer,$referring_domain:R.info.referringDomain(Zt.referrer),$device:R.info.device($o)}),{$current_url:R.info.currentUrl(),$browser_version:R.info.browserVersion($o,Ta.vendor,Np),$screen_height:dO.height,$screen_width:dO.width,mp_lib:"web",$lib_version:zi.LIB_VERSION,$insert_id:Bb(),time:R.timestamp()/1e3},R.strip_empty_properties(e))},people_properties:function(){return R.extend(R.strip_empty_properties({$os:R.info.os(),$browser:R.info.browser($o,Ta.vendor,Np)}),{$browser_version:R.info.browserVersion($o,Ta.vendor,Np)})},mpPageViewProperties:function(){return R.strip_empty_properties({current_page_title:Zt.title,current_domain:Ue.location.hostname,current_url_path:Ue.location.pathname,current_url_protocol:Ue.location.protocol,current_url_search:Ue.location.search})}};var pV=function(e,t){var n=null,r=[];return function(i){var o=this;return r.push(i),n||(n=new jt(function(a){setTimeout(function(){var u=e.apply(o,[r]);n=null,r=[],a(u)},t)})),n}},Bb=function(e){var t=Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10);return e?t.substring(0,e):t},gV=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,mV=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,_O=function(e){var t=mV,n=e.split("."),r=n[n.length-1];(r.length>4||r==="com"||r==="org")&&(t=gV);var i=e.match(t);return i?i[0]:""},vV=function(){var e=Ue.navigator.onLine;return R.isUndefined(e)||e},Ma=function(){},Vl=null,Pp=null;typeof JSON<"u"&&(Vl=JSON.stringify,Pp=JSON.parse),Vl=Vl||R.JSONEncode,Pp=Pp||R.JSONDecode,R.info=R.info,R.info.browser=R.info.browser,R.info.browserVersion=R.info.browserVersion,R.info.device=R.info.device,R.info.properties=R.info.properties,R.isBlockedUA=R.isBlockedUA,R.isEmptyObject=R.isEmptyObject,R.isObject=R.isObject,R.JSONDecode=R.JSONDecode,R.JSONEncode=R.JSONEncode,R.toArray=R.toArray,R.NPO=Ra;var yV="mixpanelBrowserDb",bO="mixpanelRecordingEvents",Fb="mixpanelRecordingRegistry",_V=1,bV=[bO,Fb],ro=function(e){this.dbPromise=null,this.storeName=e};ro.prototype._openDb=function(){return new jt(function(e,t){var n=Ue.indexedDB.open(yV,_V);n.onerror=function(){t(n.error)},n.onsuccess=function(){e(n.result)},n.onupgradeneeded=function(r){var i=r.target.result;bV.forEach(function(o){i.createObjectStore(o)})}})},ro.prototype.init=function(){return Ue.indexedDB?(this.dbPromise||(this.dbPromise=this._openDb()),this.dbPromise.then(function(e){return e instanceof Ue.IDBDatabase?jt.resolve():jt.reject(e)})):jt.reject("indexedDB is not supported in this browser")},ro.prototype.makeTransaction=function(e,t){var n=this.storeName,r=function(i){return new jt(function(o,a){var u=i.transaction(n,e);u.oncomplete=function(){o(u)},u.onabort=u.onerror=function(){a(u.error)},t(u.objectStore(n))})};return this.dbPromise.then(r).catch((function(i){return i&&i.name==="InvalidStateError"?(this.dbPromise=this._openDb(),this.dbPromise.then(r)):jt.reject(i)}).bind(this))},ro.prototype.setItem=function(e,t){return this.makeTransaction("readwrite",function(n){n.put(t,e)})},ro.prototype.getItem=function(e){var t;return this.makeTransaction("readonly",function(n){t=n.get(e)}).then(function(){return t.result})},ro.prototype.removeItem=function(e){return this.makeTransaction("readwrite",function(t){t.delete(e)})},ro.prototype.getAll=function(){var e;return this.makeTransaction("readonly",function(t){e=t.getAll()}).then(function(){return e.result})};var SV="__mp_opt_in_out_";function wV(e,t){xO(!0,e,t)}function xV(e,t){xO(!1,e,t)}function CV(e,t){return wO(e,t)==="1"}function SO(e,t){if(kV(t))return zt.warn('This browser has "Do Not Track" enabled. This will prevent the Mixpanel SDK from sending any data. To ignore the "Do Not Track" browser setting, initialize the Mixpanel instance with the config "ignore_dnt: true"'),!0;var n=wO(e,t)==="0";return n&&zt.warn("You are opted out of Mixpanel tracking. This will prevent the Mixpanel SDK from sending any data."),n}function Da(e){return qb(e,function(t){return this.get_config(t)})}function La(e){return qb(e,function(t){return this._get_config(t)})}function Zl(e){return qb(e,function(t){return this._get_config(t)})}function EV(e,t){t=t||{},Ub(t).remove(zb(e,t),!!t.crossSubdomainCookie,t.cookieDomain)}function Ub(e){return e=e||{},e.persistenceType==="localStorage"?R.localStorage:R.cookie}function zb(e,t){return t=t||{},(t.persistencePrefix||SV)+e}function wO(e,t){return Ub(t).get(zb(e,t))}function kV(e){if(e&&e.ignoreDnt)return!1;var t=e&&e.window||Ue,n=t.navigator||{},r=!1;return R.each([n.doNotTrack,n.msDoNotTrack,t.doNotTrack],function(i){R.includes([!0,1,"1","yes"],i)&&(r=!0)}),r}function xO(e,t,n){if(!R.isString(t)||!t.length){zt.error("gdpr."+(e?"optIn":"optOut")+" called with an invalid token");return}n=n||{},Ub(n).set(zb(t,n),e?1:0,R.isNumber(n.cookieExpiration)?n.cookieExpiration:null,!!n.crossSubdomainCookie,!!n.secureCookie,!!n.crossSiteCookie,n.cookieDomain),n.track&&e&&n.track(n.trackEventName||"$opt_in",n.trackProperties,{send_immediately:!0})}function qb(e,t){return function(){var n=!1;try{var r=t.call(this,"token"),i=t.call(this,"ignore_dnt"),o=t.call(this,"opt_out_tracking_persistence_type"),a=t.call(this,"opt_out_tracking_cookie_prefix"),u=t.call(this,"window");r&&(n=SO(r,{ignoreDnt:i,persistenceType:o,persistencePrefix:a,window:u}))}catch(d){zt.error("Unexpected error when checking tracking opt-out status: "+d)}if(!n)return e.apply(this,arguments);var c=arguments[arguments.length-1];typeof c=="function"&&c(0)}}var AV=Gl("lock"),CO=function(e,t){t=t||{},this.storageKey=e,this.storage=t.storage||Ue.localStorage,this.pollIntervalMS=t.pollIntervalMS||100,this.timeoutMS=t.timeoutMS||2e3,this.promiseImpl=t.promiseImpl||jt};CO.prototype.withLock=function(e,t){var n=this.promiseImpl;return new n(R.bind(function(r,i){var o=t||new Date().getTime()+"|"+Math.random(),a=new Date().getTime(),u=this.storageKey,c=this.pollIntervalMS,d=this.timeoutMS,p=this.storage,h=u+":X",m=u+":Y",v=u+":Z",_=function(E){if(new Date().getTime()-a>d){AV.error("Timeout waiting for mutex on "+u+"; clearing lock. ["+o+"]"),p.removeItem(v),p.removeItem(m),b();return}setTimeout(function(){try{E()}catch(I){i(I)}},c*(Math.random()+.1))},x=function(E,I){E()?I():_(function(){x(E,I)})},S=function(){var E=p.getItem(m);return E&&E!==o?!1:(p.setItem(m,o),p.getItem(m)===o?!0:(df(p,!0)||i(new Error("localStorage support dropped while acquiring lock")),!1))},b=function(){p.setItem(h,o),x(S,function(){if(p.getItem(h)===o){C();return}_(function(){if(p.getItem(m)!==o){b();return}x(function(){return!p.getItem(v)},C)})})},C=function(){p.setItem(v,"1");var E=function(){p.removeItem(v),p.getItem(m)===o&&p.removeItem(m),p.getItem(h)===o&&p.removeItem(h)};e().then(function(I){E(),r(I)}).catch(function(I){E(),i(I)})};try{if(df(p,!0))b();else throw new Error("localStorage support check failed")}catch(E){i(E)}},this))};var hf=function(e){this.storage=e||Ue.localStorage};hf.prototype.init=function(){return jt.resolve()},hf.prototype.setItem=function(e,t){return new jt(R.bind(function(n,r){try{this.storage.setItem(e,Vl(t))}catch(i){r(i)}n()},this))},hf.prototype.getItem=function(e){return new jt(R.bind(function(t,n){var r;try{r=Pp(this.storage.getItem(e))}catch(i){n(i)}t(r)},this))},hf.prototype.removeItem=function(e){return new jt(R.bind(function(t,n){try{this.storage.removeItem(e)}catch(r){n(r)}t()},this))};var EO=Gl("batch"),io=function(e,t){t=t||{},this.storageKey=e,this.usePersistence=t.usePersistence,this.usePersistence&&(this.queueStorage=t.queueStorage||new hf,this.lock=new CO(e,{storage:t.sharedLockStorage||Ue.localStorage,timeoutMS:t.sharedLockTimeoutMS})),this.reportError=t.errorReporter||R.bind(EO.error,EO),this.pid=t.pid||null,this.memQueue=[],this.initialized=!1,t.enqueueThrottleMs?this.enqueuePersisted=pV(R.bind(this._enqueuePersisted,this),t.enqueueThrottleMs):this.enqueuePersisted=R.bind(function(n){return this._enqueuePersisted([n])},this)};io.prototype.ensureInit=function(){return this.initialized?jt.resolve():this.queueStorage.init().then(R.bind(function(){this.initialized=!0},this)).catch(R.bind(function(e){this.reportError("Error initializing queue persistence. Disabling persistence",e),this.initialized=!0,this.usePersistence=!1},this))},io.prototype.enqueue=function(e,t){var n={id:Bb(),flushAfter:new Date().getTime()+t*2,payload:e};return this.usePersistence?this.enqueuePersisted(n):(this.memQueue.push(n),jt.resolve(!0))},io.prototype._enqueuePersisted=function(e){var t=R.bind(function(){return this.ensureInit().then(R.bind(function(){return this.readFromStorage()},this)).then(R.bind(function(n){return this.saveToStorage(n.concat(e))},this)).then(R.bind(function(n){return n&&(this.memQueue=this.memQueue.concat(e)),n},this)).catch(R.bind(function(n){return this.reportError("Error enqueueing items",n,e),!1},this))},this);return this.lock.withLock(t,this.pid).catch(R.bind(function(n){return this.reportError("Error acquiring storage lock",n),!1},this))},io.prototype.fillBatch=function(e){var t=this.memQueue.slice(0,e);return this.usePersistence&&t.length<e?this.ensureInit().then(R.bind(function(){return this.readFromStorage()},this)).then(R.bind(function(n){if(n.length){var r={};R.each(t,function(a){r[a.id]=!0});for(var i=0;i<n.length;i++){var o=n[i];if(new Date().getTime()>o.flushAfter&&!r[o.id]&&(o.orphaned=!0,t.push(o),t.length>=e))break}}return t},this)):jt.resolve(t)};var kO=function(e,t){var n=[];return R.each(e,function(r){r.id&&!t[r.id]&&n.push(r)}),n};io.prototype.removeItemsByID=function(e){var t={};if(R.each(e,function(r){t[r]=!0}),this.memQueue=kO(this.memQueue,t),this.usePersistence){var n=R.bind(function(){return this.ensureInit().then(R.bind(function(){return this.readFromStorage()},this)).then(R.bind(function(r){return r=kO(r,t),this.saveToStorage(r)},this)).then(R.bind(function(){return this.readFromStorage()},this)).then(R.bind(function(r){for(var i=0;i<r.length;i++){var o=r[i];if(o.id&&t[o.id])throw new Error("Item not removed from storage")}return!0},this)).catch(R.bind(function(r){return this.reportError("Error removing items",r,e),!1},this))},this);return this.lock.withLock(n,this.pid).catch(R.bind(function(r){return this.reportError("Error acquiring storage lock",r),df(this.lock.storage,!0)?!1:n().then(R.bind(function(i){return i||this.queueStorage.removeItem(this.storageKey).then(function(){return i})},this)).catch(R.bind(function(i){return this.reportError("Error clearing queue",i),!1},this))},this))}else return jt.resolve(!0)};var AO=function(e,t){var n=[];return R.each(e,function(r){var i=r.id;if(i in t){var o=t[i];o!==null&&(r.payload=o,n.push(r))}else n.push(r)}),n};io.prototype.updatePayloads=function(e){return this.memQueue=AO(this.memQueue,e),this.usePersistence?this.lock.withLock(R.bind(function(){return this.ensureInit().then(R.bind(function(){return this.readFromStorage()},this)).then(R.bind(function(n){return n=AO(n,e),this.saveToStorage(n)},this)).catch(R.bind(function(n){return this.reportError("Error updating items",e,n),!1},this))},this),this.pid).catch(R.bind(function(t){return this.reportError("Error acquiring storage lock",t),!1},this)):jt.resolve(!0)},io.prototype.readFromStorage=function(){return this.ensureInit().then(R.bind(function(){return this.queueStorage.getItem(this.storageKey)},this)).then(R.bind(function(e){return e&&(R.isArray(e)||(this.reportError("Invalid storage entry:",e),e=null)),e||[]},this)).catch(R.bind(function(e){return this.reportError("Error retrieving queue",e),[]},this))},io.prototype.saveToStorage=function(e){return this.ensureInit().then(R.bind(function(){return this.queueStorage.setItem(this.storageKey,e)},this)).then(function(){return!0}).catch(R.bind(function(t){return this.reportError("Error saving queue",t),!1},this))},io.prototype.clear=function(){return this.memQueue=[],this.usePersistence?this.ensureInit().then(R.bind(function(){return this.queueStorage.removeItem(this.storageKey)},this)):jt.resolve()};var IV=10*60*1e3,pf=Gl("batch"),vi=function(e,t){this.errorReporter=t.errorReporter,this.queue=new io(e,{errorReporter:R.bind(this.reportError,this),queueStorage:t.queueStorage,sharedLockStorage:t.sharedLockStorage,sharedLockTimeoutMS:t.sharedLockTimeoutMS,usePersistence:t.usePersistence,enqueueThrottleMs:t.enqueueThrottleMs}),this.libConfig=t.libConfig,this.sendRequest=t.sendRequestFunc,this.beforeSendHook=t.beforeSendHook,this.stopAllBatching=t.stopAllBatchingFunc,this.batchSize=this.libConfig.batch_size,this.flushInterval=this.libConfig.batch_flush_interval_ms,this.stopped=!this.libConfig.batch_autostart,this.consecutiveRemovalFailures=0,this.itemIdsSentSuccessfully={},this.flushOnlyOnInterval=t.flushOnlyOnInterval||!1,this._flushPromise=null};vi.prototype.enqueue=function(e){return this.queue.enqueue(e,this.flushInterval)},vi.prototype.start=function(){return this.stopped=!1,this.consecutiveRemovalFailures=0,this.flush()},vi.prototype.stop=function(){this.stopped=!0,this.timeoutID&&(clearTimeout(this.timeoutID),this.timeoutID=null)},vi.prototype.clear=function(){return this.queue.clear()},vi.prototype.resetBatchSize=function(){this.batchSize=this.libConfig.batch_size},vi.prototype.resetFlush=function(){this.scheduleFlush(this.libConfig.batch_flush_interval_ms)},vi.prototype.scheduleFlush=function(e){this.flushInterval=e,this.stopped||(this.timeoutID=setTimeout(R.bind(function(){this.stopped||(this._flushPromise=this.flush())},this),this.flushInterval))},vi.prototype.sendRequestPromise=function(e,t){return new jt(R.bind(function(n){this.sendRequest(e,t,n)},this))},vi.prototype.flush=function(e){if(this.requestInProgress)return pf.log("Flush: Request already in progress"),jt.resolve();this.requestInProgress=!0,e=e||{};var t=this.libConfig.batch_request_timeout_ms,n=new Date().getTime(),r=this.batchSize;return this.queue.fillBatch(r).then(R.bind(function(i){var o=i.length===r,a=[],u={};if(R.each(i,function(h){var m=h.payload;if(this.beforeSendHook&&!h.orphaned&&(m=this.beforeSendHook(m)),m){m.event&&m.properties&&(m.properties=R.extend({},m.properties,{mp_sent_by_lib_version:zi.LIB_VERSION}));var v=!0,_=h.id;_?(this.itemIdsSentSuccessfully[_]||0)>5&&(this.reportError("[dupe] item ID sent too many times, not sending",{item:h,batchSize:i.length,timesSent:this.itemIdsSentSuccessfully[_]}),v=!1):this.reportError("[dupe] found item with no ID",{item:h}),v&&a.push(m)}u[h.id]=m},this),a.length<1)return this.requestInProgress=!1,this.resetFlush(),jt.resolve();var c=R.bind(function(){return this.queue.removeItemsByID(R.map(i,function(h){return h.id})).then(R.bind(function(h){return R.each(i,R.bind(function(m){var v=m.id;v?(this.itemIdsSentSuccessfully[v]=this.itemIdsSentSuccessfully[v]||0,this.itemIdsSentSuccessfully[v]++,this.itemIdsSentSuccessfully[v]>5&&this.reportError("[dupe] item ID sent too many times",{item:m,batchSize:i.length,timesSent:this.itemIdsSentSuccessfully[v]})):this.reportError("[dupe] found item with no ID while removing",{item:m})},this)),h?(this.consecutiveRemovalFailures=0,this.flushOnlyOnInterval&&!o?(this.resetFlush(),jt.resolve()):this.flush()):(++this.consecutiveRemovalFailures>5?(this.reportError("Too many queue failures; disabling batching system."),this.stopAllBatching()):this.resetFlush(),jt.resolve())},this))},this),d=R.bind(function(h){this.requestInProgress=!1;try{if(e.unloading)return this.queue.updatePayloads(u);if(R.isObject(h)&&h.error==="timeout"&&new Date().getTime()-n>=t)return this.reportError("Network timeout; retrying"),this.flush();if(R.isObject(h)&&(h.httpStatusCode>=500||h.httpStatusCode===429||h.httpStatusCode<=0&&!vV()||h.error==="timeout")){var m=this.flushInterval*2;return h.retryAfter&&(m=parseInt(h.retryAfter,10)*1e3||m),m=Math.min(IV,m),this.reportError("Error; retry in "+m+" ms"),this.scheduleFlush(m),jt.resolve()}else if(R.isObject(h)&&h.httpStatusCode===413)if(i.length>1){var v=Math.max(1,Math.floor(r/2));return this.batchSize=Math.min(this.batchSize,v,i.length-1),this.reportError("413 response; reducing batch size to "+this.batchSize),this.resetFlush(),jt.resolve()}else return this.reportError("Single-event request too large; dropping",i),this.resetBatchSize(),c();else return c()}catch(_){this.reportError("Error handling API response",_),this.resetFlush()}},this),p={method:"POST",verbose:!0,ignore_json_errors:!0,timeout_ms:t};return e.unloading&&(p.transport="sendBeacon"),pf.log("MIXPANEL REQUEST:",a),this.sendRequestPromise(a,p).then(d)},this)).catch(R.bind(function(i){this.reportError("Error flushing request queue",i),this.resetFlush()},this))},vi.prototype.reportError=function(e,t){if(pf.error.apply(pf.error,arguments),this.errorReporter)try{t instanceof Error||(t=new Error(e)),this.errorReporter(e,t)}catch(n){pf.error(n)}};var jb=function(e){var t=Date.now();return!e||t>e.maxExpires||t>e.idleExpires},RV=250,Yl=Gl("recorder"),IO=Ue.CompressionStream,OV={batch_size:1e3,batch_flush_interval_ms:10*1e3,batch_request_timeout_ms:90*1e3,batch_autostart:!0},TV=new Set([dt.MouseMove,dt.MouseInteraction,dt.Scroll,dt.ViewportResize,dt.Input,dt.TouchMove,dt.MediaInteraction,dt.Drag,dt.Selection]);function MV(e){return e.type===Lt.IncrementalSnapshot&&TV.has(e.data.source)}var Er=function(e){this._mixpanel=e.mixpanelInstance,this._onIdleTimeout=e.onIdleTimeout||Ma,this._onMaxLengthReached=e.onMaxLengthReached||Ma,this._onBatchSent=e.onBatchSent||Ma,this._rrwebRecord=e.rrwebRecord||null,this._stopRecording=null,this.replayId=e.replayId,this.batchStartUrl=e.batchStartUrl||null,this.replayStartUrl=e.replayStartUrl||null,this.idleExpires=e.idleExpires||null,this.maxExpires=e.maxExpires||null,this.replayStartTime=e.replayStartTime||null,this.seqNo=e.seqNo||0,this.idleTimeoutId=null,this.maxTimeoutId=null,this.recordMaxMs=cf,this.recordMinMs=0;var t=df(e.sharedLockStorage,!0);this.batcherKey="__mprec_"+this.getConfig("name")+"_"+this.getConfig("token")+"_"+this.replayId,this.queueStorage=new ro(bO),this.batcher=new vi(this.batcherKey,{errorReporter:this.reportError.bind(this),flushOnlyOnInterval:!0,libConfig:OV,sendRequestFunc:this.flushEventsWithOptOut.bind(this),queueStorage:this.queueStorage,sharedLockStorage:e.sharedLockStorage,usePersistence:t,stopAllBatchingFunc:this.stopRecording.bind(this),enqueueThrottleMs:RV,sharedLockTimeoutMS:10*1e3})};Er.prototype.unloadPersistedData=function(){return this.batcher.stop(),this.batcher.flush().then((function(){return this.queueStorage.removeItem(this.batcherKey)}).bind(this))},Er.prototype.getConfig=function(e){return this._mixpanel.get_config(e)},Er.prototype.get_config=function(e){return this.getConfig(e)},Er.prototype.startRecording=function(e){if(this._rrwebRecord===null){this.reportError("rrweb record function not provided. ");return}if(this._stopRecording!==null){Yl.log("Recording already in progress, skipping startRecording.");return}this.recordMaxMs=this.getConfig("record_max_ms"),this.recordMaxMs>cf&&(this.recordMaxMs=cf,Yl.critical("record_max_ms cannot be greater than "+cf+"ms. Capping value.")),this.maxExpires||(this.maxExpires=new Date().getTime()+this.recordMaxMs),this.recordMinMs=this.getConfig("record_min_ms"),this.recordMinMs>Tb&&(this.recordMinMs=Tb,Yl.critical("record_min_ms cannot be greater than "+Tb+"ms. Capping value.")),this.replayStartTime||(this.replayStartTime=new Date().getTime(),this.batchStartUrl=R.info.currentUrl(),this.replayStartUrl=R.info.currentUrl()),e||this.recordMinMs>0?this.batcher.stop():this.batcher.start();var t=(function(){clearTimeout(this.idleTimeoutId);var i=this.getConfig("record_idle_timeout_ms");this.idleTimeoutId=setTimeout(this._onIdleTimeout,i),this.idleExpires=new Date().getTime()+i}).bind(this);t();var n=this.getConfig("record_block_selector");(n===""||n===null)&&(n=void 0);try{this._stopRecording=this._rrwebRecord({emit:(function(i){if(this.idleExpires&&this.idleExpires<i.timestamp){this._onIdleTimeout();return}MV(i)&&(this.batcher.stopped&&new Date().getTime()-this.replayStartTime>=this.recordMinMs&&this.batcher.start(),t()),this.__enqueuePromise=this.batcher.enqueue(i)}).bind(this),blockClass:this.getConfig("record_block_class"),blockSelector:n,collectFonts:this.getConfig("record_collect_fonts"),dataURLOptions:{type:"image/webp",quality:.6},maskAllInputs:!0,maskTextClass:this.getConfig("record_mask_text_class"),maskTextSelector:this.getConfig("record_mask_text_selector"),recordCanvas:this.getConfig("record_canvas"),sampling:{canvas:15}})}catch(i){this.reportError("Unexpected error when starting rrweb recording.",i)}if(typeof this._stopRecording!="function"){this.reportError("rrweb failed to start, skipping this recording."),this._stopRecording=null,this.stopRecording();return}var r=this.maxExpires-new Date().getTime();this.maxTimeoutId=setTimeout(this._onMaxLengthReached.bind(this),r)},Er.prototype.stopRecording=function(e){if(!this.isRrwebStopped()){try{this._stopRecording()}catch(n){this.reportError("Error with rrweb stopRecording",n)}this._stopRecording=null}var t;return this.batcher.stopped?t=this.batcher.clear():e||(t=this.batcher.flush()),this.batcher.stop(),clearTimeout(this.idleTimeoutId),clearTimeout(this.maxTimeoutId),t},Er.prototype.isRrwebStopped=function(){return this._stopRecording===null},Er.prototype.flushEventsWithOptOut=function(e,t,n){var r=(function(i){i===0&&(this.stopRecording(),n({error:"Tracking has been opted out, stopping recording."}))}).bind(this);this._flushEvents(e,t,n,r)},Er.prototype.serialize=function(){var e;try{e=this._mixpanel.get_tab_id()}catch(t){this.reportError("Error getting tab ID for serialization ",t),e=null}return{replayId:this.replayId,seqNo:this.seqNo,replayStartTime:this.replayStartTime,batchStartUrl:this.batchStartUrl,replayStartUrl:this.replayStartUrl,idleExpires:this.idleExpires,maxExpires:this.maxExpires,tabId:e}},Er.deserialize=function(e,t){var n=new Er(R.extend({},t,{replayId:e.replayId,batchStartUrl:e.batchStartUrl,replayStartUrl:e.replayStartUrl,idleExpires:e.idleExpires,maxExpires:e.maxExpires,replayStartTime:e.replayStartTime,seqNo:e.seqNo,sharedLockStorage:t.sharedLockStorage}));return n},Er.prototype._sendRequest=function(e,t,n,r){var i=(function(o,a){o.status===200&&this.replayId===e&&(this.seqNo++,this.batchStartUrl=R.info.currentUrl()),this._onBatchSent(),r({status:0,httpStatusCode:o.status,responseBody:a,retryAfter:o.headers.get("Retry-After")})}).bind(this);Ue.fetch(this.getConfig("api_host")+"/"+this.getConfig("api_routes").record+"?"+new URLSearchParams(t),{method:"POST",headers:{Authorization:"Basic "+btoa(this.getConfig("token")+":"),"Content-Type":"application/octet-stream"},body:n}).then(function(o){o.json().then(function(a){i(o,a)}).catch(function(a){r({error:a})})}).catch(function(o){r({error:o,httpStatusCode:0})})},Er.prototype._flushEvents=Da(function(e,t,n){var r=e.length;if(r>0){for(var i=this.replayId,o=1/0,a=-1/0,u=!1,c=0;c<r;c++)o=Math.min(o,e[c].timestamp),a=Math.max(a,e[c].timestamp),e[c].type===Lt.FullSnapshot&&(u=!0);if(this.seqNo===0){if(!u){n({error:"First batch does not contain a full snapshot. Aborting recording."}),this.stopRecording(!0);return}this.replayStartTime=o}else this.replayStartTime||(this.reportError("Replay start time not set but seqNo is not 0. Using current batch start time as a fallback."),this.replayStartTime=o);var d=a-this.replayStartTime,p={$current_url:this.batchStartUrl,$lib_version:zi.LIB_VERSION,batch_start_time:o/1e3,distinct_id:String(this._mixpanel.get_distinct_id()),mp_lib:"web",replay_id:i,replay_length_ms:d,replay_start_time:this.replayStartTime/1e3,replay_start_url:this.replayStartUrl,seq:this.seqNo},h=JSON.stringify(e),m=this._mixpanel.get_property("$device_id");m&&(p.$device_id=m);var v=this._mixpanel.get_property("$user_id");if(v&&(p.$user_id=v),IO){var _=new Blob([h],{type:"application/json"}).stream(),x=_.pipeThrough(new IO("gzip"));new Response(x).blob().then((function(S){p.format="gzip",this._sendRequest(i,p,S,n)}).bind(this))}else p.format="body",this._sendRequest(i,p,h,n)}}),Er.prototype.reportError=function(e,t){Yl.error.apply(Yl.error,arguments);try{!t&&!(e instanceof Error)&&(e=new Error(e)),this.getConfig("error_reporter")(e,t)}catch(n){Yl.error(n)}};var Wl=function(e){this.idb=new ro(Fb),this.errorReporter=e.errorReporter,this.mixpanelInstance=e.mixpanelInstance,this.sharedLockStorage=e.sharedLockStorage};Wl.prototype.handleError=function(e){this.errorReporter("IndexedDB error: ",e)},Wl.prototype.setActiveRecording=function(e){var t=e.tabId;return t?this.idb.init().then((function(){return this.idb.setItem(t,e)}).bind(this)).catch(this.handleError.bind(this)):(console.warn("No tab ID is set, cannot persist recording metadata."),jt.resolve())},Wl.prototype.getActiveRecording=function(){return this.idb.init().then((function(){return this.idb.getItem(this.mixpanelInstance.get_tab_id())}).bind(this)).then((function(e){return jb(e)?null:e}).bind(this)).catch(this.handleError.bind(this))},Wl.prototype.clearActiveRecording=function(){return this.getActiveRecording().then((function(e){if(e)return e.maxExpires=0,this.setActiveRecording(e)}).bind(this)).catch(this.handleError.bind(this))},Wl.prototype.flushInactiveRecordings=function(){return this.idb.init().then((function(){return this.idb.getAll()}).bind(this)).then((function(e){var t=e.filter(function(n){return jb(n)}).map((function(n){var r=Er.deserialize(n,{mixpanelInstance:this.mixpanelInstance,sharedLockStorage:this.sharedLockStorage});return r.unloadPersistedData().then((function(){return this.idb.removeItem(n.tabId)}).bind(this)).catch(this.handleError.bind(this))}).bind(this));return jt.all(t)}).bind(this)).catch(this.handleError.bind(this))};var gf=Gl("recorder"),No=function(e,t,n){this.mixpanelInstance=e,this.rrwebRecord=t||Aa,this.sharedLockStorage=n,this.recordingRegistry=new Wl({mixpanelInstance:this.mixpanelInstance,errorReporter:gf.error,sharedLockStorage:n}),this._flushInactivePromise=this.recordingRegistry.flushInactiveRecordings(),this.activeRecording=null};No.prototype.startRecording=function(e){if(e=e||{},this.activeRecording&&!this.activeRecording.isRrwebStopped()){gf.log("Recording already in progress, skipping startRecording.");return}var t=(function(){gf.log("Idle timeout reached, restarting recording."),this.resetRecording()}).bind(this),n=(function(){gf.log("Max recording length reached, stopping recording."),this.resetRecording()}).bind(this),r=(function(){this.recordingRegistry.setActiveRecording(this.activeRecording.serialize()),this.__flushPromise=this.activeRecording.batcher._flushPromise}).bind(this),i={mixpanelInstance:this.mixpanelInstance,onBatchSent:r,onIdleTimeout:t,onMaxLengthReached:n,replayId:R.UUID(),rrwebRecord:this.rrwebRecord,sharedLockStorage:this.sharedLockStorage};return e.activeSerializedRecording?this.activeRecording=Er.deserialize(e.activeSerializedRecording,i):this.activeRecording=new Er(i),this.activeRecording.startRecording(e.shouldStopBatcher),this.recordingRegistry.setActiveRecording(this.activeRecording.serialize())},No.prototype.stopRecording=function(){var e=this._stopCurrentRecording(!1);return this.recordingRegistry.clearActiveRecording(),this.activeRecording=null,e},No.prototype.pauseRecording=function(){return this._stopCurrentRecording(!1)},No.prototype._stopCurrentRecording=function(e){return this.activeRecording?this.activeRecording.stopRecording(e):jt.resolve()},No.prototype.resumeRecording=function(e){return this.activeRecording&&this.activeRecording.isRrwebStopped()?(this.activeRecording.startRecording(!1),jt.resolve(null)):this.recordingRegistry.getActiveRecording().then((function(t){return t?this.startRecording({activeSerializedRecording:t}):e?this.startRecording({shouldStopBatcher:!1}):(gf.log("No resumable recording found."),null)}).bind(this))},No.prototype.resetRecording=function(){this.stopRecording(),this.startRecording({shouldStopBatcher:!0})},No.prototype.getActiveReplayId=function(){return this.activeRecording&&!this.activeRecording.isRrwebStopped()?this.activeRecording.replayId:null},Object.defineProperty(No.prototype,"replayId",{get:function(){return this.getActiveReplayId()}}),Ue.__mp_recorder=No;var Bp="change",mf="click",RO="hashchange",Kl="mp_locationchange",OO="popstate",TO="scrollend",Hb="submit",DV=["clientX","clientY","offsetX","offsetY","pageX","pageY","screenX","screenY","x","y"],MO=["mp-include"],Gb=["mp-no-track"],DO=Gb.concat(["mp-sensitive"]),LV=["aria-label","aria-labelledby","aria-describedby","href","name","role","title","type"],qr=Gl("autocapture");function Vb(e){for(var t={},n=LO(e).split(" "),r=0;r<n.length;r++){var i=n[r];i&&(t[i]=!0)}return t}function LO(e){switch(typeof e.className){case"string":return e.className;case"object":return e.className.baseVal||e.getAttribute("class")||"";default:return""}}function $V(e){if(e.previousElementSibling)return e.previousElementSibling;do e=e.previousSibling;while(e&&!PO(e));return e}function $O(e,t,n,r,i,o){var a={$classes:LO(e).split(" "),$tag_name:e.tagName.toLowerCase()},u=e.id;u&&(a.$id=u),Wb(e,t,i,o)&&R.each(LV.concat(r),function(h){if(e.hasAttribute(h)&&!n[h]){var m=e.getAttribute(h);Fp(m)&&(a["$attr-"+h]=m)}});for(var c=1,d=1,p=e;p=$V(p);)c++,p.tagName===e.tagName&&d++;return a.$nth_child=c,a.$nth_of_type=d,a}function NV(e,t){var n=t.allowElementCallback,r=t.allowSelectors||[],i=t.blockAttrs||[],o=t.blockElementCallback,a=t.blockSelectors||[],u=t.captureTextContent||!1,c=t.captureExtraAttrs||[],d={};R.each(i,function(I){d[I]=!0});var p=null,h=typeof e.target>"u"?e.srcElement:e.target;if(BO(h)&&(h=h.parentNode),FV(h,e)&&Zb(h,e,n,r)&&!Yb(h,e,o,a)){for(var m=[h],v=h;v.parentNode&&!oo(v,"body");)m.push(v.parentNode),v=v.parentNode;var _=[],x,S=!1;if(R.each(m,function(I){var O=Wb(I,e,n,r);!d.href&&I.tagName.toLowerCase()==="a"&&(x=I.getAttribute("href"),x=O&&Fp(x)&&x),Yb(I,e,o,a)&&(S=!0),_.push($O(I,e,d,c,n,r))},this),!S){var b=Zt.documentElement;if(p={$event_type:e.type,$host:Ue.location.host,$pathname:Ue.location.pathname,$elements:_,$el_attr__href:x,$viewportHeight:Math.max(b.clientHeight,Ue.innerHeight||0),$viewportWidth:Math.max(b.clientWidth,Ue.innerWidth||0)},R.each(c,function(I){if(!d[I]&&h.hasAttribute(I)){var O=h.getAttribute(I);Fp(O)&&(p["$el_attr__"+I]=O)}}),u&&(C=NO(h,e,n,r),C&&C.length&&(p.$el_text=C)),e.type===mf&&(R.each(DV,function(I){I in e&&(p["$"+I]=e[I])}),h=PV(e)),u){var C=NO(h,e,n,r);C&&C.length&&(p.$el_text=C)}if(h){if(!Zb(h,e,n,r)||Yb(h,e,o,a))return null;var E=$O(h,e,d,c,n,r);p.$target=E,p.$el_classes=E.$classes,R.extend(p,R.strip_empty_properties({$el_id:E.$id,$el_tag_name:E.$tag_name}))}}}return p}function NO(e,t,n,r){var i="";return Wb(e,t,n,r)&&e.childNodes&&e.childNodes.length&&R.each(e.childNodes,function(o){BO(o)&&o.textContent&&(i+=R.trim(o.textContent).split(/(\s+)/).filter(Fp).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255))}),R.trim(i)}function PV(e){for(var t=e.target,n=e.composedPath(),r=0;r<n.length;r++){var i=n[r];if(oo(i,"a")||oo(i,"button")||oo(i,"input")||oo(i,"select")||i.getAttribute&&i.getAttribute("role")==="button"){t=i;break}if(i===t)break}return t}function Zb(e,t,n,r){if(n)try{if(!n(e,t))return!1}catch(a){return qr.critical("Error while checking element in allowElementCallback",a),!1}if(!r.length)return!0;for(var i=0;i<r.length;i++){var o=r[i];try{if(e.matches(o))return!0}catch(a){qr.critical("Error while checking selector: "+o,a)}}return!1}function Yb(e,t,n,r){var i;if(n)try{if(n(e,t))return!0}catch(u){return qr.critical("Error while checking element in blockElementCallback",u),!0}if(r&&r.length)for(i=0;i<r.length;i++){var o=r[i];try{if(e.matches(o))return!0}catch(u){qr.critical("Error while checking selector: "+o,u)}}var a=Vb(e);for(i=0;i<Gb.length;i++)if(a[Gb[i]])return!0;return!1}function PO(e){return e&&e.nodeType===1}function oo(e,t){return e&&e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function BO(e){return e&&e.nodeType===3}function BV(){try{var e=Zt.createElement("div");return!!e.matches}catch{return!1}}function FV(e,t){if(!e||oo(e,"html")||!PO(e))return!1;var n=e.tagName.toLowerCase();switch(n){case"form":return t.type===Hb;case"input":return["button","submit"].indexOf(e.getAttribute("type"))===-1?t.type===Bp:t.type===mf;case"select":case"textarea":return t.type===Bp;default:return t.type===mf}}function Wb(e,t,n,r){var i;if(!Zb(e,t,n,r))return!1;for(var o=e;o.parentNode&&!oo(o,"body");o=o.parentNode){var a=Vb(o);for(i=0;i<DO.length;i++)if(a[DO[i]])return!1}var u=Vb(e);for(i=0;i<MO.length;i++)if(u[MO[i]])return!0;if(oo(e,"input")||oo(e,"select")||oo(e,"textarea")||e.getAttribute("contenteditable")==="true")return!1;var c=e.type||"";if(typeof c=="string")switch(c.toLowerCase()){case"hidden":return!1;case"password":return!1}var d=e.name||e.id||"";if(typeof d=="string"){var p=/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i;if(p.test(d.replace(/[^a-zA-Z0-9]/g,"")))return!1}return!0}function Fp(e){if(e===null||R.isUndefined(e))return!1;if(typeof e=="string"){e=R.trim(e);var t=/^(?:(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}))$/;if(t.test((e||"").replace(/[- ]/g,"")))return!1;var n=/(^\d{3}-?\d{2}-?\d{4}$)/;if(n.test(e))return!1}return!0}var FO="autocapture",UV="track_pageview",UO="full-url",zV="url-with-path-and-query-string",qV="url-with-path",jV="allow_element_callback",zO="allow_selectors",qO="allow_url_regexes",jO="block_attrs",HO="block_element_callback",GO="block_selectors",VO="block_url_regexes",ZO="capture_extra_attrs",YO="capture_text_content",WO="scroll_capture_all",KO="scroll_depth_percent_checkpoints",Kb="click",Qb="input",QO="pageview",Xb="scroll",Jb="submit",ur={};ur[zO]=[],ur[qO]=[],ur[jO]=[],ur[HO]=null,ur[GO]=[],ur[VO]=[],ur[ZO]=[],ur[YO]=!1,ur[WO]=!1,ur[KO]=[25,50,75,100],ur[Kb]=!0,ur[Qb]=!0,ur[QO]=UO,ur[Xb]=!0,ur[Jb]=!0;var Up={$mp_autocapture:!0},HV="$mp_click",GV="$mp_input_change",VV="$mp_scroll",ZV="$mp_submit",ni=function(e){this.mp=e};ni.prototype.init=function(){if(!BV()){qr.critical("Autocapture unavailable: missing required DOM APIs");return}this.initPageviewTracking(),this.initClickTracking(),this.initInputTracking(),this.initScrollTracking(),this.initSubmitTracking()},ni.prototype.getFullConfig=function(){var e=this.mp.get_config(FO);return e?R.isObject(e)?R.extend({},ur,e):ur:{}},ni.prototype.getConfig=function(e){return this.getFullConfig()[e]},ni.prototype.currentUrlBlocked=function(){var e,t=R.info.currentUrl(),n=this.getConfig(qO)||[];if(n.length){var r=!1;for(e=0;e<n.length;e++){var i=n[e];try{if(t.match(i)){r=!0;break}}catch(a){return qr.critical("Error while checking block URL regex: "+i,a),!0}}if(!r)return!0}var o=this.getConfig(VO)||[];if(!o||!o.length)return!1;for(e=0;e<o.length;e++)try{if(t.match(o[e]))return!0}catch(a){return qr.critical("Error while checking block URL regex: "+o[e],a),!0}return!1},ni.prototype.pageviewTrackingConfig=function(){return this.mp.get_config(FO)?this.getConfig(QO):this.mp.get_config(UV)},ni.prototype.trackDomEvent=function(e,t){if(!this.currentUrlBlocked()){var n=NV(e,{allowElementCallback:this.getConfig(jV),allowSelectors:this.getConfig(zO),blockAttrs:this.getConfig(jO),blockElementCallback:this.getConfig(HO),blockSelectors:this.getConfig(GO),captureExtraAttrs:this.getConfig(ZO),captureTextContent:this.getConfig(YO)});n&&(R.extend(n,Up),this.mp.track(t,n))}},ni.prototype.initClickTracking=function(){Ue.removeEventListener(mf,this.listenerClick),this.getConfig(Kb)&&(qr.log("Initializing click tracking"),this.listenerClick=Ue.addEventListener(mf,(function(e){this.getConfig(Kb)&&this.trackDomEvent(e,HV)}).bind(this)))},ni.prototype.initInputTracking=function(){Ue.removeEventListener(Bp,this.listenerChange),this.getConfig(Qb)&&(qr.log("Initializing input tracking"),this.listenerChange=Ue.addEventListener(Bp,(function(e){this.getConfig(Qb)&&this.trackDomEvent(e,GV)}).bind(this)))},ni.prototype.initPageviewTracking=function(){if(Ue.removeEventListener(OO,this.listenerPopstate),Ue.removeEventListener(RO,this.listenerHashchange),Ue.removeEventListener(Kl,this.listenerLocationchange),!!this.pageviewTrackingConfig()){qr.log("Initializing pageview tracking");var e="",t=!1;this.currentUrlBlocked()||(t=this.mp.track_pageview(Up)),t&&(e=R.info.currentUrl()),this.listenerPopstate=Ue.addEventListener(OO,function(){Ue.dispatchEvent(new Event(Kl))}),this.listenerHashchange=Ue.addEventListener(RO,function(){Ue.dispatchEvent(new Event(Kl))});var n=Ue.history.pushState;typeof n=="function"&&(Ue.history.pushState=function(i,o,a){n.call(Ue.history,i,o,a),Ue.dispatchEvent(new Event(Kl))});var r=Ue.history.replaceState;typeof r=="function"&&(Ue.history.replaceState=function(i,o,a){r.call(Ue.history,i,o,a),Ue.dispatchEvent(new Event(Kl))}),this.listenerLocationchange=Ue.addEventListener(Kl,$b((function(){if(!this.currentUrlBlocked()){var i=R.info.currentUrl(),o=!1,a=i.split("#")[0].split("?")[0]!==e.split("#")[0].split("?")[0],u=this.pageviewTrackingConfig();if(u===UO?o=i!==e:u===zV?o=i.split("#")[0]!==e.split("#")[0]:u===qV&&(o=a),o){var c=this.mp.track_pageview(Up);c&&(e=i),a&&(this.lastScrollCheckpoint=0,qr.log("Path change: re-initializing scroll depth checkpoints"))}}}).bind(this)))}},ni.prototype.initScrollTracking=function(){Ue.removeEventListener(TO,this.listenerScroll),this.getConfig(Xb)&&(qr.log("Initializing scroll tracking"),this.lastScrollCheckpoint=0,this.listenerScroll=Ue.addEventListener(TO,$b((function(){if(this.getConfig(Xb)&&!this.currentUrlBlocked()){var e=this.getConfig(WO),t=(this.getConfig(KO)||[]).slice().sort(function(c,d){return c-d}),n=Ue.scrollY,r=R.extend({$scroll_top:n},Up);try{var i=Zt.body.scrollHeight,o=Math.round(n/(i-Ue.innerHeight)*100);if(r.$scroll_height=i,r.$scroll_percentage=o,o>this.lastScrollCheckpoint)for(var a=0;a<t.length;a++){var u=t[a];o>=u&&this.lastScrollCheckpoint<u&&(r.$scroll_checkpoint=u,this.lastScrollCheckpoint=u,e=!0)}}catch(c){qr.critical("Error while calculating scroll percentage",c)}e&&this.mp.track(VV,r)}}).bind(this))))},ni.prototype.initSubmitTracking=function(){Ue.removeEventListener(Hb,this.listenerSubmit),this.getConfig(Jb)&&(qr.log("Initializing submit tracking"),this.listenerSubmit=Ue.addEventListener(Hb,(function(e){this.getConfig(Jb)&&this.trackDomEvent(e,ZV)}).bind(this)))},uV(ni);var Po=function(){};Po.prototype.create_properties=function(){},Po.prototype.event_handler=function(){},Po.prototype.after_track_handler=function(){},Po.prototype.init=function(e){return this.mp=e,this},Po.prototype.track=function(e,t,n,r){var i=this,o=R.dom_query(e);if(o.length===0){zt.error("The DOM query ("+e+") returned 0 elements");return}return R.each(o,function(a){R.register_event(a,this.override_event,function(u){var c={},d=i.create_properties(n,this),p=i.mp.get_config("track_links_timeout");i.event_handler(u,this,c),window.setTimeout(i.track_callback(r,d,c,!0),p),i.mp.track(t,d,i.track_callback(r,d,c))})},this),!0},Po.prototype.track_callback=function(e,t,n,r){r=r||!1;var i=this;return function(){n.callback_fired||(n.callback_fired=!0,!(e&&e(r,t)===!1)&&i.after_track_handler(t,n,r))}},Po.prototype.create_properties=function(e,t){var n;return typeof e=="function"?n=e(t):n=R.extend({},e),n};var Ql=function(){this.override_event="click"};R.inherit(Ql,Po),Ql.prototype.create_properties=function(e,t){var n=Ql.superclass.create_properties.apply(this,arguments);return t.href&&(n.url=t.href),n},Ql.prototype.event_handler=function(e,t,n){n.new_tab=e.which===2||e.metaKey||e.ctrlKey||t.target==="_blank",n.href=t.href,n.new_tab||e.preventDefault()},Ql.prototype.after_track_handler=function(e,t){t.new_tab||setTimeout(function(){window.location=t.href},0)};var zp=function(){this.override_event="submit"};R.inherit(zp,Po),zp.prototype.event_handler=function(e,t,n){n.element=t,e.preventDefault()},zp.prototype.after_track_handler=function(e,t){setTimeout(function(){t.element.submit()},0)};var $a="$set",Xl="$set_once",qi="$unset",Ls="$add",ao="$append",$s="$union",Bo="$remove",YV="$delete",XO={set_action:function(e,t){var n={},r={};return R.isObject(e)?R.each(e,function(i,o){this._is_reserved_property(o)||(r[o]=i)},this):r[e]=t,n[$a]=r,n},unset_action:function(e){var t={},n=[];return R.isArray(e)||(e=[e]),R.each(e,function(r){this._is_reserved_property(r)||n.push(r)},this),t[qi]=n,t},set_once_action:function(e,t){var n={},r={};return R.isObject(e)?R.each(e,function(i,o){this._is_reserved_property(o)||(r[o]=i)},this):r[e]=t,n[Xl]=r,n},union_action:function(e,t){var n={},r={};return R.isObject(e)?R.each(e,function(i,o){this._is_reserved_property(o)||(r[o]=R.isArray(i)?i:[i])},this):r[e]=R.isArray(t)?t:[t],n[$s]=r,n},append_action:function(e,t){var n={},r={};return R.isObject(e)?R.each(e,function(i,o){this._is_reserved_property(o)||(r[o]=i)},this):r[e]=t,n[ao]=r,n},remove_action:function(e,t){var n={},r={};return R.isObject(e)?R.each(e,function(i,o){this._is_reserved_property(o)||(r[o]=i)},this):r[e]=t,n[Bo]=r,n},delete_action:function(){var e={};return e[YV]="",e}},gn=function(){};R.extend(gn.prototype,XO),gn.prototype._init=function(e,t,n){this._mixpanel=e,this._group_key=t,this._group_id=n},gn.prototype.set=Zl(function(e,t,n){var r=this.set_action(e,t);return R.isObject(e)&&(n=t),this._send_request(r,n)}),gn.prototype.set_once=Zl(function(e,t,n){var r=this.set_once_action(e,t);return R.isObject(e)&&(n=t),this._send_request(r,n)}),gn.prototype.unset=Zl(function(e,t){var n=this.unset_action(e);return this._send_request(n,t)}),gn.prototype.union=Zl(function(e,t,n){R.isObject(e)&&(n=t);var r=this.union_action(e,t);return this._send_request(r,n)}),gn.prototype.delete=Zl(function(e){var t=this.delete_action();return this._send_request(t,e)}),gn.prototype.remove=Zl(function(e,t,n){var r=this.remove_action(e,t);return this._send_request(r,n)}),gn.prototype._send_request=function(e,t){e.$group_key=this._group_key,e.$group_id=this._group_id,e.$token=this._get_config("token");var n=R.encodeDates(e);return this._mixpanel._track_or_batch({type:"groups",data:n,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").groups,batcher:this._mixpanel.request_batchers.groups},t)},gn.prototype._is_reserved_property=function(e){return e==="$group_key"||e==="$group_id"},gn.prototype._get_config=function(e){return this._mixpanel.get_config(e)},gn.prototype.toString=function(){return this._mixpanel.toString()+".group."+this._group_key+"."+this._group_id},gn.prototype.remove=gn.prototype.remove,gn.prototype.set=gn.prototype.set,gn.prototype.set_once=gn.prototype.set_once,gn.prototype.union=gn.prototype.union,gn.prototype.unset=gn.prototype.unset,gn.prototype.toString=gn.prototype.toString;var ht=function(){};R.extend(ht.prototype,XO),ht.prototype._init=function(e){this._mixpanel=e},ht.prototype.set=La(function(e,t,n){var r=this.set_action(e,t);return R.isObject(e)&&(n=t),this._get_config("save_referrer")&&this._mixpanel.persistence.update_referrer_info(document.referrer),r[$a]=R.extend({},R.info.people_properties(),r[$a]),this._send_request(r,n)}),ht.prototype.set_once=La(function(e,t,n){var r=this.set_once_action(e,t);return R.isObject(e)&&(n=t),this._send_request(r,n)}),ht.prototype.unset=La(function(e,t){var n=this.unset_action(e);return this._send_request(n,t)}),ht.prototype.increment=La(function(e,t,n){var r={},i={};return R.isObject(e)?(R.each(e,function(o,a){if(!this._is_reserved_property(a))if(isNaN(parseFloat(o))){zt.error("Invalid increment value passed to mixpanel.people.increment - must be a number");return}else i[a]=o},this),n=t):(R.isUndefined(t)&&(t=1),i[e]=t),r[Ls]=i,this._send_request(r,n)}),ht.prototype.append=La(function(e,t,n){R.isObject(e)&&(n=t);var r=this.append_action(e,t);return this._send_request(r,n)}),ht.prototype.remove=La(function(e,t,n){R.isObject(e)&&(n=t);var r=this.remove_action(e,t);return this._send_request(r,n)}),ht.prototype.union=La(function(e,t,n){R.isObject(e)&&(n=t);var r=this.union_action(e,t);return this._send_request(r,n)}),ht.prototype.track_charge=La(function(e,t,n){if(!R.isNumber(e)&&(e=parseFloat(e),isNaN(e))){zt.error("Invalid value passed to mixpanel.people.track_charge - must be a number");return}return this.append("$transactions",R.extend({$amount:e},t),n)}),ht.prototype.clear_charges=function(e){return this.set("$transactions",[],e)},ht.prototype.delete_user=function(){if(!this._identify_called()){zt.error("mixpanel.people.delete_user() requires you to call identify() first");return}var e={$delete:this._mixpanel.get_distinct_id()};return this._send_request(e)},ht.prototype.toString=function(){return this._mixpanel.toString()+".people"},ht.prototype._send_request=function(e,t){e.$token=this._get_config("token"),e.$distinct_id=this._mixpanel.get_distinct_id();var n=this._mixpanel.get_property("$device_id"),r=this._mixpanel.get_property("$user_id"),i=this._mixpanel.get_property("$had_persisted_distinct_id");n&&(e.$device_id=n),r&&(e.$user_id=r),i&&(e.$had_persisted_distinct_id=i);var o=R.encodeDates(e);return this._identify_called()?this._mixpanel._track_or_batch({type:"people",data:o,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").engage,batcher:this._mixpanel.request_batchers.people},t):(this._enqueue(e),R.isUndefined(t)||(this._get_config("verbose")?t({status:-1,error:null}):t(-1)),R.truncate(o,255))},ht.prototype._get_config=function(e){return this._mixpanel.get_config(e)},ht.prototype._identify_called=function(){return this._mixpanel._flags.identify_called===!0},ht.prototype._enqueue=function(e){$a in e?this._mixpanel.persistence._add_to_people_queue($a,e):Xl in e?this._mixpanel.persistence._add_to_people_queue(Xl,e):qi in e?this._mixpanel.persistence._add_to_people_queue(qi,e):Ls in e?this._mixpanel.persistence._add_to_people_queue(Ls,e):ao in e?this._mixpanel.persistence._add_to_people_queue(ao,e):Bo in e?this._mixpanel.persistence._add_to_people_queue(Bo,e):$s in e?this._mixpanel.persistence._add_to_people_queue($s,e):zt.error("Invalid call to _enqueue():",e)},ht.prototype._flush_one_queue=function(e,t,n,r){var i=this,o=R.extend({},this._mixpanel.persistence.load_queue(e)),a=o;!R.isUndefined(o)&&R.isObject(o)&&!R.isEmptyObject(o)&&(i._mixpanel.persistence._pop_from_people_queue(e,o),i._mixpanel.persistence.save(),r&&(a=r(o)),t.call(i,a,function(u,c){u===0&&i._mixpanel.persistence._add_to_people_queue(e,o),R.isUndefined(n)||n(u,c)}))},ht.prototype._flush=function(e,t,n,r,i,o,a){var u=this;this._flush_one_queue($a,this.set,e),this._flush_one_queue(Xl,this.set_once,r),this._flush_one_queue(qi,this.unset,o,function(S){return R.keys(S)}),this._flush_one_queue(Ls,this.increment,t),this._flush_one_queue($s,this.union,i);var c=this._mixpanel.persistence.load_queue(ao);if(!R.isUndefined(c)&&R.isArray(c)&&c.length)for(var d,p=function(S,b){S===0&&u._mixpanel.persistence._add_to_people_queue(ao,d),R.isUndefined(n)||n(S,b)},h=c.length-1;h>=0;h--)c=this._mixpanel.persistence.load_queue(ao),d=c.pop(),u._mixpanel.persistence.save(),R.isEmptyObject(d)||u.append(d,p);var m=this._mixpanel.persistence.load_queue(Bo);if(!R.isUndefined(m)&&R.isArray(m)&&m.length)for(var v,_=function(S,b){S===0&&u._mixpanel.persistence._add_to_people_queue(Bo,v),R.isUndefined(a)||a(S,b)},x=m.length-1;x>=0;x--)m=this._mixpanel.persistence.load_queue(Bo),v=m.pop(),u._mixpanel.persistence.save(),R.isEmptyObject(v)||u.remove(v,_)},ht.prototype._is_reserved_property=function(e){return e==="$distinct_id"||e==="$token"||e==="$device_id"||e==="$user_id"||e==="$had_persisted_distinct_id"},ht.prototype.set=ht.prototype.set,ht.prototype.set_once=ht.prototype.set_once,ht.prototype.unset=ht.prototype.unset,ht.prototype.increment=ht.prototype.increment,ht.prototype.append=ht.prototype.append,ht.prototype.remove=ht.prototype.remove,ht.prototype.union=ht.prototype.union,ht.prototype.track_charge=ht.prototype.track_charge,ht.prototype.clear_charges=ht.prototype.clear_charges,ht.prototype.delete_user=ht.prototype.delete_user,ht.prototype.toString=ht.prototype.toString;var e1="__mps",t1="__mpso",n1="__mpus",r1="__mpa",i1="__mpap",o1="__mpr",a1="__mpu",JO="$people_distinct_id",qp="__alias",vf="__timers",WV=[e1,t1,n1,r1,i1,o1,a1,JO,qp,vf],Ct=function(e){this.props={},this.campaign_params_saved=!1,e.persistence_name?this.name="mp_"+e.persistence_name:this.name="mp_"+e.token+"_mixpanel";var t=e.persistence;t!=="cookie"&&t!=="localStorage"&&(zt.critical("Unknown persistence type "+t+"; falling back to cookie"),t=e.persistence="cookie"),t==="localStorage"&&R.localStorage.is_supported()?this.storage=R.localStorage:this.storage=R.cookie,this.load(),this.update_config(e),this.upgrade(),this.save()};Ct.prototype.properties=function(){var e={};return this.load(),R.each(this.props,function(t,n){R.include(WV,n)||(e[n]=t)}),e},Ct.prototype.load=function(){if(!this.disabled){var e=this.storage.parse(this.name);e&&(this.props=R.extend({},e))}},Ct.prototype.upgrade=function(){var e,t;this.storage===R.localStorage?(e=R.cookie.parse(this.name),R.cookie.remove(this.name),R.cookie.remove(this.name,!0),e&&this.register_once(e)):this.storage===R.cookie&&(t=R.localStorage.parse(this.name),R.localStorage.remove(this.name),t&&this.register_once(t))},Ct.prototype.save=function(){this.disabled||this.storage.set(this.name,Vl(this.props),this.expire_days,this.cross_subdomain,this.secure,this.cross_site,this.cookie_domain)},Ct.prototype.load_prop=function(e){return this.load(),this.props[e]},Ct.prototype.remove=function(){this.storage.remove(this.name,!1,this.cookie_domain),this.storage.remove(this.name,!0,this.cookie_domain)},Ct.prototype.clear=function(){this.remove(),this.props={}},Ct.prototype.register_once=function(e,t,n){return R.isObject(e)?(typeof t>"u"&&(t="None"),this.expire_days=typeof n>"u"?this.default_expiry:n,this.load(),R.each(e,function(r,i){(!this.props.hasOwnProperty(i)||this.props[i]===t)&&(this.props[i]=r)},this),this.save(),!0):!1},Ct.prototype.register=function(e,t){return R.isObject(e)?(this.expire_days=typeof t>"u"?this.default_expiry:t,this.load(),R.extend(this.props,e),this.save(),!0):!1},Ct.prototype.unregister=function(e){this.load(),e in this.props&&(delete this.props[e],this.save())},Ct.prototype.update_search_keyword=function(e){this.register(R.info.searchInfo(e))},Ct.prototype.update_referrer_info=function(e){this.register_once({$initial_referrer:e||"$direct",$initial_referring_domain:R.info.referringDomain(e)||"$direct"},"")},Ct.prototype.get_referrer_info=function(){return R.strip_empty_properties({$initial_referrer:this.props.$initial_referrer,$initial_referring_domain:this.props.$initial_referring_domain})},Ct.prototype.update_config=function(e){this.default_expiry=this.expire_days=e.cookie_expiration,this.set_disabled(e.disable_persistence),this.set_cookie_domain(e.cookie_domain),this.set_cross_site(e.cross_site_cookie),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie)},Ct.prototype.set_disabled=function(e){this.disabled=e,this.disabled?this.remove():this.save()},Ct.prototype.set_cookie_domain=function(e){e!==this.cookie_domain&&(this.remove(),this.cookie_domain=e,this.save())},Ct.prototype.set_cross_site=function(e){e!==this.cross_site&&(this.cross_site=e,this.remove(),this.save())},Ct.prototype.set_cross_subdomain=function(e){e!==this.cross_subdomain&&(this.cross_subdomain=e,this.remove(),this.save())},Ct.prototype.get_cross_subdomain=function(){return this.cross_subdomain},Ct.prototype.set_secure=function(e){e!==this.secure&&(this.secure=!!e,this.remove(),this.save())},Ct.prototype._add_to_people_queue=function(e,t){var n=this._get_queue_key(e),r=t[e],i=this._get_or_create_queue($a),o=this._get_or_create_queue(Xl),a=this._get_or_create_queue(qi),u=this._get_or_create_queue(Ls),c=this._get_or_create_queue($s),d=this._get_or_create_queue(Bo,[]),p=this._get_or_create_queue(ao,[]);n===e1?(R.extend(i,r),this._pop_from_people_queue(Ls,r),this._pop_from_people_queue($s,r),this._pop_from_people_queue(qi,r)):n===t1?(R.each(r,function(h,m){m in o||(o[m]=h)}),this._pop_from_people_queue(qi,r)):n===n1?R.each(r,function(h){R.each([i,o,u,c],function(m){h in m&&delete m[h]}),R.each(p,function(m){h in m&&delete m[h]}),a[h]=!0}):n===r1?(R.each(r,function(h,m){m in i?i[m]+=h:(m in u||(u[m]=0),u[m]+=h)},this),this._pop_from_people_queue(qi,r)):n===a1?(R.each(r,function(h,m){R.isArray(h)&&(m in c||(c[m]=[]),R.each(h,function(v){R.include(c[m],v)||c[m].push(v)}))}),this._pop_from_people_queue(qi,r)):n===o1?(d.push(r),this._pop_from_people_queue(ao,r)):n===i1&&(p.push(r),this._pop_from_people_queue(qi,r)),zt.log("MIXPANEL PEOPLE REQUEST (QUEUED, PENDING IDENTIFY):"),zt.log(t),this.save()},Ct.prototype._pop_from_people_queue=function(e,t){var n=this.props[this._get_queue_key(e)];R.isUndefined(n)||R.each(t,function(r,i){e===ao||e===Bo?R.each(n,function(o){o[i]===r&&delete o[i]}):delete n[i]},this)},Ct.prototype.load_queue=function(e){return this.load_prop(this._get_queue_key(e))},Ct.prototype._get_queue_key=function(e){if(e===$a)return e1;if(e===Xl)return t1;if(e===qi)return n1;if(e===Ls)return r1;if(e===ao)return i1;if(e===Bo)return o1;if(e===$s)return a1;zt.error("Invalid queue:",e)},Ct.prototype._get_or_create_queue=function(e,t){var n=this._get_queue_key(e);return t=R.isUndefined(t)?{}:t,this.props[n]||(this.props[n]=t)},Ct.prototype.set_event_timer=function(e,t){var n=this.load_prop(vf)||{};n[e]=t,this.props[vf]=n,this.save()},Ct.prototype.remove_event_timer=function(e){var t=this.load_prop(vf)||{},n=t[e];return R.isUndefined(n)||(delete this.props[vf][e],this.save()),n};var s1,eT=function(e,t){throw new Error(e+" not available in this build.")},kr,tT=0,KV=1,QV=function(e){return e},yi="mixpanel",nT="base64",XV="json",l1="$device:",Jl=Ue.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,rT=!Jl&&$o.indexOf("MSIE")===-1&&$o.indexOf("Mozilla")===-1,jp=null;Ta.sendBeacon&&(jp=function(){return Ta.sendBeacon.apply(Ta,arguments)});var iT={track:"track/",engage:"engage/",groups:"groups/",record:"record/"},oT={api_host:"https://api-js.mixpanel.com",api_routes:iT,api_method:"POST",api_transport:"XHR",api_payload_format:nT,app_host:"https://mixpanel.com",autocapture:!1,cdn:"https://cdn.mxpnl.com",cross_site_cookie:!1,cross_subdomain_cookie:!0,error_reporter:Ma,persistence:"cookie",persistence_name:"",cookie_domain:"",cookie_name:"",loaded:Ma,mp_loader:null,track_marketing:!0,track_pageview:!1,skip_first_touch_marketing:!1,store_google:!0,stop_utm_persistence:!1,save_referrer:!0,test:!1,verbose:!1,img:!1,debug:!1,track_links_timeout:300,cookie_expiration:365,upgrade:!1,disable_persistence:!1,disable_cookie:!1,secure_cookie:!1,ip:!0,opt_out_tracking_by_default:!1,opt_out_persistence_by_default:!1,opt_out_tracking_persistence_type:"localStorage",opt_out_tracking_cookie_prefix:null,property_blacklist:[],xhr_headers:{},ignore_dnt:!1,batch_requests:!0,batch_size:50,batch_flush_interval_ms:5e3,batch_request_timeout_ms:9e4,batch_autostart:!0,hooks:{},record_block_class:new RegExp("^(mp-block|fs-exclude|amp-block|rr-block|ph-no-capture)$"),record_block_selector:"img, video",record_canvas:!1,record_collect_fonts:!1,record_idle_timeout_ms:30*60*1e3,record_mask_text_class:new RegExp("^(mp-mask|fs-mask|amp-mask|rr-mask|ph-mask)$"),record_mask_text_selector:"*",record_max_ms:cf,record_min_ms:0,record_sessions_percent:0,recorder_src:"https://cdn.mxpnl.com/libs/mixpanel-recorder.min.js"},aT=!1,oe=function(){},u1=function(e,t,n){var r,i=n===yi?kr:kr[n];if(i&&s1===tT)r=i;else{if(i&&!R.isArray(i)){zt.error("You have already initialized "+n);return}r=new oe}if(r._cached_groups={},r._init(e,t,n),r.people=new ht,r.people._init(r),!r.get_config("skip_first_touch_marketing")){var o=R.info.campaignParams(null),a={},u=!1;R.each(o,function(c,d){a["initial_"+d]=c,c&&(u=!0)}),u&&r.people.set_once(a)}return zi.DEBUG=zi.DEBUG||r.get_config("debug"),!R.isUndefined(i)&&R.isArray(i)&&(r._execute_array.call(r.people,i.people),r._execute_array(i)),r};oe.prototype.init=function(e,t,n){if(R.isUndefined(n)){this.report_error("You must name your new library: init(token, config, name)");return}if(n===yi){this.report_error("You must initialize the main mixpanel object right after you include the Mixpanel js snippet");return}var r=u1(e,t,n);return kr[n]=r,r._loaded(),r},oe.prototype._init=function(e,t,n){t=t||{},this.__loaded=!0,this.config={};var r={};if(!("api_payload_format"in t)){var i=t.api_host||oT.api_host;i.match(/\.mixpanel\.com/)&&(r.api_payload_format=XV)}if(this.set_config(R.extend({},oT,r,t,{name:n,token:e,callback_fn:(n===yi?n:yi+"."+n)+"._jsc"})),this._jsc=Ma,this.__dom_loaded_queue=[],this.__request_queue=[],this.__disabled_events=[],this._flags={disable_all_events:!1,identify_called:!1},this.request_batchers={},this._batch_requests=this.get_config("batch_requests"),this._batch_requests){if(!R.localStorage.is_supported(!0)||!Jl)this._batch_requests=!1,zt.log("Turning off Mixpanel request-queueing; needs XHR and localStorage support"),R.each(this.get_batcher_configs(),function(u){zt.log("Clearing batch queue "+u.queue_key),R.localStorage.remove(u.queue_key)});else if(this.init_batchers(),jp&&Ue.addEventListener){var o=R.bind(function(){this.request_batchers.events.stopped||this.request_batchers.events.flush({unloading:!0})},this);Ue.addEventListener("pagehide",function(u){u.persisted&&o()}),Ue.addEventListener("visibilitychange",function(){Zt.visibilityState==="hidden"&&o()})}}this.persistence=this.cookie=new Ct(this.config),this.unpersisted_superprops={},this._gdpr_init();var a=R.UUID();this.get_distinct_id()||this.register_once({distinct_id:l1+a,$device_id:a},""),this.autocapture=new ni(this),this.autocapture.init(),this._init_tab_id(),this._check_and_start_session_recording()},oe.prototype._init_tab_id=function(){if(R.sessionStorage.is_supported())try{var e=this.get_config("name")+"_"+this.get_config("token"),t="mp_tab_id_"+e,n="mp_gen_new_tab_id_"+e;(R.sessionStorage.get(n)||!R.sessionStorage.get(t))&&R.sessionStorage.set(t,"$tab-"+R.UUID()),R.sessionStorage.set(n,"1"),this.tab_id=R.sessionStorage.get(t),Ue.addEventListener("beforeunload",function(){R.sessionStorage.remove(n)})}catch(r){this.report_error("Error initializing tab id",r)}else this.report_error("Session storage is not supported, cannot keep track of unique tab ID.")},oe.prototype.get_tab_id=function(){return this.tab_id||null},oe.prototype._should_load_recorder=function(){var e=new ro(Fb),t=this.get_tab_id();return e.init().then(function(){return e.getAll()}).then(function(n){for(var r=0;r<n.length;r++)if(jb(n[r])||n[r].tabId===t)return!0;return!1}).catch(R.bind(function(n){this.report_error("Error checking recording registry",n)},this))},oe.prototype._check_and_start_session_recording=Da(function(e){if(!Ue.MutationObserver){zt.critical("Browser does not support MutationObserver; skipping session recording");return}var t=R.bind(function(r){var i=R.bind(function(){this._recorder=this._recorder||new Ue.__mp_recorder(this),this._recorder.resumeRecording(r)},this);R.isUndefined(Ue.__mp_recorder)?eT(this.get_config("recorder_src"),i):i()},this),n=this.get_config("record_sessions_percent")>0&&Math.random()*100<=this.get_config("record_sessions_percent");e||n?t(!0):this._should_load_recorder().then(function(r){r&&t(!1)})}),oe.prototype.start_session_recording=function(){this._check_and_start_session_recording(!0)},oe.prototype.stop_session_recording=function(){this._recorder&&this._recorder.stopRecording()},oe.prototype.pause_session_recording=function(){this._recorder&&this._recorder.pauseRecording()},oe.prototype.resume_session_recording=function(){this._recorder&&this._recorder.resumeRecording()},oe.prototype.get_session_recording_properties=function(){var e={},t=this._get_session_replay_id();return t&&(e.$mp_replay_id=t),e},oe.prototype.get_session_replay_url=function(){var e=null,t=this._get_session_replay_id();if(t){var n=R.HTTPBuildQuery({replay_id:t,distinct_id:this.get_distinct_id(),token:this.get_config("token")});e="https://mixpanel.com/projects/replay-redirect?"+n}return e},oe.prototype._get_session_replay_id=function(){var e=null;return this._recorder&&(e=this._recorder.replayId),e||null},oe.prototype.__get_recorder=function(){return this._recorder},oe.prototype._loaded=function(){if(this.get_config("loaded")(this),this._set_default_superprops(),this.people.set_once(this.persistence.get_referrer_info()),this.get_config("store_google")&&this.get_config("stop_utm_persistence")){var e=R.info.campaignParams(null);R.each(e,(function(t,n){this.unregister(n)}).bind(this))}},oe.prototype._set_default_superprops=function(){this.persistence.update_search_keyword(Zt.referrer),this.get_config("store_google")&&!this.get_config("stop_utm_persistence")&&this.register(R.info.campaignParams()),this.get_config("save_referrer")&&this.persistence.update_referrer_info(Zt.referrer)},oe.prototype._dom_loaded=function(){R.each(this.__dom_loaded_queue,function(e){this._track_dom.apply(this,e)},this),this.has_opted_out_tracking()||R.each(this.__request_queue,function(e){this._send_request.apply(this,e)},this),delete this.__dom_loaded_queue,delete this.__request_queue},oe.prototype._track_dom=function(e,t){if(this.get_config("img"))return this.report_error("You can't use DOM tracking functions with img = true."),!1;if(!aT)return this.__dom_loaded_queue.push([e,t]),!1;var n=new e().init(this);return n.track.apply(n,t)},oe.prototype._prepare_callback=function(e,t){if(R.isUndefined(e))return null;if(Jl){var n=function(a){e(a,t)};return n}else{var r=this._jsc,i=""+Math.floor(Math.random()*1e8),o=this.get_config("callback_fn")+"["+i+"]";return r[i]=function(a){delete r[i],e(a,t)},o}},oe.prototype._send_request=function(e,t,n,r){var i=!0;if(rT)return this.__request_queue.push(arguments),i;var o={method:this.get_config("api_method"),transport:this.get_config("api_transport"),verbose:this.get_config("verbose")},a=null;!r&&(R.isFunction(n)||typeof n=="string")&&(r=n,n=null),n=R.extend(o,n||{}),Jl||(n.method="GET");var u=n.method==="POST",c=jp&&u&&n.transport.toLowerCase()==="sendbeacon",d=n.verbose;t.verbose&&(d=!0),this.get_config("test")&&(t.test=1),d&&(t.verbose=1),this.get_config("img")&&(t.img=1),Jl||(r?t.callback=r:(d||this.get_config("test"))&&(t.callback="(function(){})")),t.ip=this.get_config("ip")?1:0,t._=new Date().getTime().toString(),u&&(a="data="+encodeURIComponent(t.data),delete t.data),e+="?"+R.HTTPBuildQuery(t);var p=this;if("img"in t){var h=Zt.createElement("img");h.src=e,Zt.body.appendChild(h)}else if(c){try{i=jp(e,a)}catch(b){p.report_error(b),i=!1}try{r&&r(i?1:0)}catch(b){p.report_error(b)}}else if(Jl)try{var m=new XMLHttpRequest;m.open(n.method,e,!0);var v=this.get_config("xhr_headers");if(u&&(v["Content-Type"]="application/x-www-form-urlencoded"),R.each(v,function(b,C){m.setRequestHeader(C,b)}),n.timeout_ms&&typeof m.timeout<"u"){m.timeout=n.timeout_ms;var _=new Date().getTime()}m.withCredentials=!0,m.onreadystatechange=function(){if(m.readyState===4)if(m.status===200){if(r)if(d){var b;try{b=R.JSONDecode(m.responseText)}catch(I){if(p.report_error(I),n.ignore_json_errors)b=m.responseText;else return}r(b)}else r(Number(m.responseText))}else{var C;if(m.timeout&&!m.status&&new Date().getTime()-_>=m.timeout?C="timeout":C="Bad HTTP status: "+m.status+" "+m.statusText,p.report_error(C),r)if(d){var E=m.responseHeaders||{};r({status:0,httpStatusCode:m.status,error:C,retryAfter:E["Retry-After"]})}else r(0)}},m.send(a)}catch(b){p.report_error(b),i=!1}else{var x=Zt.createElement("script");x.type="text/javascript",x.async=!0,x.defer=!0,x.src=e;var S=Zt.getElementsByTagName("script")[0];S.parentNode.insertBefore(x,S)}return i},oe.prototype._execute_array=function(e){var t,n=[],r=[],i=[];R.each(e,function(a){a&&(t=a[0],R.isArray(t)?i.push(a):typeof a=="function"?a.call(this):R.isArray(a)&&t==="alias"?n.push(a):R.isArray(a)&&t.indexOf("track")!==-1&&typeof this[t]=="function"?i.push(a):r.push(a))},this);var o=function(a,u){R.each(a,function(c){if(R.isArray(c[0])){var d=u;R.each(c,function(p){d=d[p[0]].apply(d,p.slice(1))})}else this[c[0]].apply(this,c.slice(1))},u)};o(n,this),o(r,this),o(i,this)},oe.prototype.are_batchers_initialized=function(){return!!this.request_batchers.events},oe.prototype.get_batcher_configs=function(){var e="__mpq_"+this.get_config("token"),t=this.get_config("api_routes");return this._batcher_configs=this._batcher_configs||{events:{type:"events",endpoint:"/"+t.track,queue_key:e+"_ev"},people:{type:"people",endpoint:"/"+t.engage,queue_key:e+"_pp"},groups:{type:"groups",endpoint:"/"+t.groups,queue_key:e+"_gr"}},this._batcher_configs},oe.prototype.init_batchers=function(){if(!this.are_batchers_initialized()){var e=R.bind(function(n){return new vi(n.queue_key,{libConfig:this.config,errorReporter:this.get_config("error_reporter"),sendRequestFunc:R.bind(function(r,i,o){this._send_request(this.get_config("api_host")+n.endpoint,this._encode_data_for_request(r),i,this._prepare_callback(o,r))},this),beforeSendHook:R.bind(function(r){return this._run_hook("before_send_"+n.type,r)},this),stopAllBatchingFunc:R.bind(this.stop_batch_senders,this),usePersistence:!0})},this),t=this.get_batcher_configs();this.request_batchers={events:e(t.events),people:e(t.people),groups:e(t.groups)}}this.get_config("batch_autostart")&&this.start_batch_senders()},oe.prototype.start_batch_senders=function(){this._batchers_were_started=!0,this.are_batchers_initialized()&&(this._batch_requests=!0,R.each(this.request_batchers,function(e){e.start()}))},oe.prototype.stop_batch_senders=function(){this._batch_requests=!1,R.each(this.request_batchers,function(e){e.stop(),e.clear()})},oe.prototype.push=function(e){this._execute_array([e])},oe.prototype.disable=function(e){typeof e>"u"?this._flags.disable_all_events=!0:this.__disabled_events=this.__disabled_events.concat(e)},oe.prototype._encode_data_for_request=function(e){var t=Vl(e);return this.get_config("api_payload_format")===nT&&(t=R.base64Encode(t)),{data:t}},oe.prototype._track_or_batch=function(e,t){var n=R.truncate(e.data,255),r=e.endpoint,i=e.batcher,o=e.should_send_immediately,a=e.send_request_options||{};t=t||Ma;var u=!0,c=R.bind(function(){return a.skip_hooks||(n=this._run_hook("before_send_"+e.type,n)),n?(zt.log("MIXPANEL REQUEST:"),zt.log(n),this._send_request(r,this._encode_data_for_request(n),a,this._prepare_callback(t,n))):null},this);return this._batch_requests&&!o?i.enqueue(n).then(function(d){d?t(1,n):c()}):u=c(),u&&n},oe.prototype.track=Da(function(e,t,n,r){!r&&typeof n=="function"&&(r=n,n=null),n=n||{};var i=n.transport;i&&(n.transport=i);var o=n.send_immediately;if(typeof r!="function"&&(r=Ma),R.isUndefined(e)){this.report_error("No event name provided to mixpanel.track");return}if(this._event_is_disabled(e)){r(0);return}t=R.extend({},t),t.token=this.get_config("token");var a=this.persistence.remove_event_timer(e);if(!R.isUndefined(a)){var u=new Date().getTime()-a;t.$duration=parseFloat((u/1e3).toFixed(3))}this._set_default_superprops();var c=this.get_config("track_marketing")?R.info.marketingParams():{};t=R.extend({},R.info.properties({mp_loader:this.get_config("mp_loader")}),c,this.persistence.properties(),this.unpersisted_superprops,this.get_session_recording_properties(),t);var d=this.get_config("property_blacklist");R.isArray(d)?R.each(d,function(m){delete t[m]}):this.report_error("Invalid value for property_blacklist config: "+d);var p={event:e,properties:t},h=this._track_or_batch({type:"events",data:p,endpoint:this.get_config("api_host")+"/"+this.get_config("api_routes").track,batcher:this.request_batchers.events,should_send_immediately:o,send_request_options:n},r);return h}),oe.prototype.set_group=Da(function(e,t,n){R.isArray(t)||(t=[t]);var r={};return r[e]=t,this.register(r),this.people.set(e,t,n)}),oe.prototype.add_group=Da(function(e,t,n){var r=this.get_property(e),i={};return r===void 0?(i[e]=[t],this.register(i)):r.indexOf(t)===-1&&(r.push(t),i[e]=r,this.register(i)),this.people.union(e,t,n)}),oe.prototype.remove_group=Da(function(e,t,n){var r=this.get_property(e);if(r!==void 0){var i=r.indexOf(t);i>-1&&(r.splice(i,1),this.register({group_key:r})),r.length===0&&this.unregister(e)}return this.people.remove(e,t,n)}),oe.prototype.track_with_groups=Da(function(e,t,n,r){var i=R.extend({},t||{});return R.each(n,function(o,a){o!=null&&(i[a]=o)}),this.track(e,i,r)}),oe.prototype._create_map_key=function(e,t){return e+"_"+JSON.stringify(t)},oe.prototype._remove_group_from_cache=function(e,t){delete this._cached_groups[this._create_map_key(e,t)]},oe.prototype.get_group=function(e,t){var n=this._create_map_key(e,t),r=this._cached_groups[n];return(r===void 0||r._group_key!==e||r._group_id!==t)&&(r=new gn,r._init(this,e,t),this._cached_groups[n]=r),r},oe.prototype.track_pageview=Da(function(e,t){typeof e!="object"&&(e={}),t=t||{};var n=t.event_name||"$mp_web_page_view",r=R.extend(R.info.mpPageViewProperties(),R.info.campaignParams(),R.info.clickParams()),i=R.extend({},r,e);return this.track(n,i)}),oe.prototype.track_links=function(){return this._track_dom.call(this,Ql,arguments)},oe.prototype.track_forms=function(){return this._track_dom.call(this,zp,arguments)},oe.prototype.time_event=function(e){if(R.isUndefined(e)){this.report_error("No event name provided to mixpanel.time_event");return}this._event_is_disabled(e)||this.persistence.set_event_timer(e,new Date().getTime())};var JV={persistent:!0},c1=function(e){var t;return R.isObject(e)?t=e:R.isUndefined(e)?t={}:t={days:e},R.extend({},JV,t)};oe.prototype.register=function(e,t){var n=c1(t);n.persistent?this.persistence.register(e,n.days):R.extend(this.unpersisted_superprops,e)},oe.prototype.register_once=function(e,t,n){var r=c1(n);r.persistent?this.persistence.register_once(e,t,r.days):(typeof t>"u"&&(t="None"),R.each(e,function(i,o){(!this.unpersisted_superprops.hasOwnProperty(o)||this.unpersisted_superprops[o]===t)&&(this.unpersisted_superprops[o]=i)},this))},oe.prototype.unregister=function(e,t){t=c1(t),t.persistent?this.persistence.unregister(e):delete this.unpersisted_superprops[e]},oe.prototype._register_single=function(e,t){var n={};n[e]=t,this.register(n)},oe.prototype.identify=function(e,t,n,r,i,o,a,u){var c=this.get_distinct_id();if(e&&c!==e){if(typeof e=="string"&&e.indexOf(l1)===0)return this.report_error("distinct_id cannot have $device: prefix"),-1;this.register({$user_id:e})}if(!this.get_property("$device_id")){var d=c;this.register_once({$had_persisted_distinct_id:!0,$device_id:d},"")}e!==c&&e!==this.get_property(qp)&&(this.unregister(qp),this.register({distinct_id:e})),this._flags.identify_called=!0,this.people._flush(t,n,r,i,o,a,u),e!==c&&this.track("$identify",{distinct_id:e,$anon_distinct_id:c},{skip_hooks:!0})},oe.prototype.reset=function(){this.persistence.clear(),this._flags.identify_called=!1;var e=R.UUID();this.register_once({distinct_id:l1+e,$device_id:e},"")},oe.prototype.get_distinct_id=function(){return this.get_property("distinct_id")},oe.prototype.alias=function(e,t){if(e===this.get_property(JO))return this.report_error("Attempting to create alias for existing People user - aborting."),-2;var n=this;return R.isUndefined(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(qp,e),this.track("$create_alias",{alias:e,distinct_id:t},{skip_hooks:!0},function(){n.identify(e)})):(this.report_error("alias matches current distinct_id - skipping api call."),this.identify(e),-1)},oe.prototype.name_tag=function(e){this._register_single("mp_name_tag",e)},oe.prototype.set_config=function(e){if(R.isObject(e)){R.extend(this.config,e);var t=e.batch_size;t&&R.each(this.request_batchers,function(n){n.resetBatchSize()}),this.get_config("persistence_name")||(this.config.persistence_name=this.config.cookie_name),this.get_config("disable_persistence")||(this.config.disable_persistence=this.config.disable_cookie),this.persistence&&this.persistence.update_config(this.config),zi.DEBUG=zi.DEBUG||this.get_config("debug"),"autocapture"in e&&this.autocapture&&this.autocapture.init()}},oe.prototype.get_config=function(e){return this.config[e]},oe.prototype._run_hook=function(e){var t=(this.config.hooks[e]||QV).apply(this,Oa.call(arguments,1));return typeof t>"u"&&(this.report_error(e+" hook did not return a value"),t=null),t},oe.prototype.get_property=function(e){return this.persistence.load_prop([e])},oe.prototype.toString=function(){var e=this.get_config("name");return e!==yi&&(e=yi+"."+e),e},oe.prototype._event_is_disabled=function(e){return R.isBlockedUA($o)||this._flags.disable_all_events||R.include(this.__disabled_events,e)},oe.prototype._gdpr_init=function(){var e=this.get_config("opt_out_tracking_persistence_type")==="localStorage";e&&R.localStorage.is_supported()&&(!this.has_opted_in_tracking()&&this.has_opted_in_tracking({persistence_type:"cookie"})&&this.opt_in_tracking({enable_persistence:!1}),!this.has_opted_out_tracking()&&this.has_opted_out_tracking({persistence_type:"cookie"})&&this.opt_out_tracking({clear_persistence:!1}),this.clear_opt_in_out_tracking({persistence_type:"cookie",enable_persistence:!1})),this.has_opted_out_tracking()?this._gdpr_update_persistence({clear_persistence:!0}):!this.has_opted_in_tracking()&&(this.get_config("opt_out_tracking_by_default")||R.cookie.get("mp_optout"))&&(R.cookie.remove("mp_optout"),this.opt_out_tracking({clear_persistence:this.get_config("opt_out_persistence_by_default")}))},oe.prototype._gdpr_update_persistence=function(e){var t;if(e&&e.clear_persistence)t=!0;else if(e&&e.enable_persistence)t=!1;else return;!this.get_config("disable_persistence")&&this.persistence.disabled!==t&&this.persistence.set_disabled(t),t?(this.stop_batch_senders(),this.stop_session_recording()):this._batchers_were_started&&this.start_batch_senders()},oe.prototype._gdpr_call_func=function(e,t){return t=R.extend({track:R.bind(this.track,this),persistence_type:this.get_config("opt_out_tracking_persistence_type"),cookie_prefix:this.get_config("opt_out_tracking_cookie_prefix"),cookie_expiration:this.get_config("cookie_expiration"),cross_site_cookie:this.get_config("cross_site_cookie"),cross_subdomain_cookie:this.get_config("cross_subdomain_cookie"),cookie_domain:this.get_config("cookie_domain"),secure_cookie:this.get_config("secure_cookie"),ignore_dnt:this.get_config("ignore_dnt")},t),R.localStorage.is_supported()||(t.persistence_type="cookie"),e(this.get_config("token"),{track:t.track,trackEventName:t.track_event_name,trackProperties:t.track_properties,persistenceType:t.persistence_type,persistencePrefix:t.cookie_prefix,cookieDomain:t.cookie_domain,cookieExpiration:t.cookie_expiration,crossSiteCookie:t.cross_site_cookie,crossSubdomainCookie:t.cross_subdomain_cookie,secureCookie:t.secure_cookie,ignoreDnt:t.ignore_dnt})},oe.prototype.opt_in_tracking=function(e){e=R.extend({enable_persistence:!0},e),this._gdpr_call_func(wV,e),this._gdpr_update_persistence(e)},oe.prototype.opt_out_tracking=function(e){e=R.extend({clear_persistence:!0,delete_user:!0},e),e.delete_user&&this.people&&this.people._identify_called()&&(this.people.delete_user(),this.people.clear_charges()),this._gdpr_call_func(xV,e),this._gdpr_update_persistence(e)},oe.prototype.has_opted_in_tracking=function(e){return this._gdpr_call_func(CV,e)},oe.prototype.has_opted_out_tracking=function(e){return this._gdpr_call_func(SO,e)},oe.prototype.clear_opt_in_out_tracking=function(e){e=R.extend({enable_persistence:!0},e),this._gdpr_call_func(EV,e),this._gdpr_update_persistence(e)},oe.prototype.report_error=function(e,t){zt.error.apply(zt.error,arguments);try{!t&&!(e instanceof Error)&&(e=new Error(e)),this.get_config("error_reporter")(e,t)}catch(n){zt.error(n)}},oe.prototype.init=oe.prototype.init,oe.prototype.reset=oe.prototype.reset,oe.prototype.disable=oe.prototype.disable,oe.prototype.time_event=oe.prototype.time_event,oe.prototype.track=oe.prototype.track,oe.prototype.track_links=oe.prototype.track_links,oe.prototype.track_forms=oe.prototype.track_forms,oe.prototype.track_pageview=oe.prototype.track_pageview,oe.prototype.register=oe.prototype.register,oe.prototype.register_once=oe.prototype.register_once,oe.prototype.unregister=oe.prototype.unregister,oe.prototype.identify=oe.prototype.identify,oe.prototype.alias=oe.prototype.alias,oe.prototype.name_tag=oe.prototype.name_tag,oe.prototype.set_config=oe.prototype.set_config,oe.prototype.get_config=oe.prototype.get_config,oe.prototype.get_property=oe.prototype.get_property,oe.prototype.get_distinct_id=oe.prototype.get_distinct_id,oe.prototype.toString=oe.prototype.toString,oe.prototype.opt_out_tracking=oe.prototype.opt_out_tracking,oe.prototype.opt_in_tracking=oe.prototype.opt_in_tracking,oe.prototype.has_opted_out_tracking=oe.prototype.has_opted_out_tracking,oe.prototype.has_opted_in_tracking=oe.prototype.has_opted_in_tracking,oe.prototype.clear_opt_in_out_tracking=oe.prototype.clear_opt_in_out_tracking,oe.prototype.get_group=oe.prototype.get_group,oe.prototype.set_group=oe.prototype.set_group,oe.prototype.add_group=oe.prototype.add_group,oe.prototype.remove_group=oe.prototype.remove_group,oe.prototype.track_with_groups=oe.prototype.track_with_groups,oe.prototype.start_batch_senders=oe.prototype.start_batch_senders,oe.prototype.stop_batch_senders=oe.prototype.stop_batch_senders,oe.prototype.start_session_recording=oe.prototype.start_session_recording,oe.prototype.stop_session_recording=oe.prototype.stop_session_recording,oe.prototype.pause_session_recording=oe.prototype.pause_session_recording,oe.prototype.resume_session_recording=oe.prototype.resume_session_recording,oe.prototype.get_session_recording_properties=oe.prototype.get_session_recording_properties,oe.prototype.get_session_replay_url=oe.prototype.get_session_replay_url,oe.prototype.get_tab_id=oe.prototype.get_tab_id,oe.prototype.DEFAULT_API_ROUTES=iT,oe.prototype.__get_recorder=oe.prototype.__get_recorder,Ct.prototype.properties=Ct.prototype.properties,Ct.prototype.update_search_keyword=Ct.prototype.update_search_keyword,Ct.prototype.update_referrer_info=Ct.prototype.update_referrer_info,Ct.prototype.get_cross_subdomain=Ct.prototype.get_cross_subdomain,Ct.prototype.clear=Ct.prototype.clear;var eu={},eZ=function(){R.each(eu,function(e,t){t!==yi&&(kr[t]=e)}),kr._=R},tZ=function(){kr.init=function(e,t,n){if(n)return kr[n]||(kr[n]=eu[n]=u1(e,t,n),kr[n]._loaded()),kr[n];var r=kr;eu[yi]?r=eu[yi]:e&&(r=u1(e,t,yi),r._loaded(),eu[yi]=r),kr=r,s1===KV&&(Ue[yi]=kr),eZ()}},nZ=function(){function e(){e.done||(e.done=!0,aT=!0,rT=!1,R.each(eu,function(r){r._dom_loaded()}))}function t(){try{Zt.documentElement.doScroll("left")}catch{setTimeout(t,1);return}e()}if(Zt.addEventListener)Zt.readyState==="complete"?e():Zt.addEventListener("DOMContentLoaded",e,!1);else if(Zt.attachEvent){Zt.attachEvent("onreadystatechange",e);var n=!1;try{n=Ue.frameElement===null}catch{}Zt.documentElement.doScroll&&n&&t()}R.register_event(Ue,"load",e,!0)};function rZ(e){return eT=e,s1=tT,kr=new oe,tZ(),kr.init(),nZ(),kr}function iZ(e,t){t()}var Na=rZ(iZ);const so="https://saas.brainlox.com",oZ="https://debales-web-app-server.azurewebsites.net",sT={"blossom-and-rhyme-6":"84e28f5a553bc260c8276723d0f365bc","doorbellmount-dea1de94-1728660454527":"f825468f4202c28be0d29c849a997208",artzfolio:"789feea8eb479f2db1144448f6465f7f",minature:"b22ef9c8fdbeb4a297947903891c5fd9","nonetz-3f0b8348-1736183595738":"a19d837ea53890c892a2b351e54afc11",bodytales:"703aa3f61539de0786fa19f82644fa8b",athflex:"b9f412aa0c6991abf8b8e3db70b2a506",www:"2637bf921fb09742d550941fbebe7160","GTK-Restaurant":"dbcb03738f942ec7c968f45833ee47bf","derkins-co-uk":"f109fd32c98dac150ba902bd69feeeed","imemyselfcare-com":"bbbe4af618eeab278a4015b4ddf8827f"},aZ="phc_nzwftWluHb06OLHwbfhb2xmhk88Ffc9OjjR8Jz5Q327",sZ=e=>({layout:{position:{isLeft:e.isLeft??!1,zIndex:e.zIndex??1e3},height:{option:e.heightOption??"Normal"},responsive:{fullScreenOnMobile:e.fullScreenOnMobile??!0,mobileDisplayMode:e.mobileDisplayMode??"normal"}},colors:{background:e.backgroundColor,font:e.fontColor,supportButtonBackgroundColor:e.supportButtonBackgroundColor??"'#ffa500'",bot:{background:e.botBackgroundColor,message:e.botMessageColor,font:e.botFontColor},user:{message:e.userMessageColor,font:e.userFontColor},header:{font:e.headerFontColor},footer:{background:e.footerBackgroundColor,inputBorder:e.fonterInputBorderColor},cta:{background:e.callToActionBackgroundColor,font:e.callToActionFontColor},suggestedQuestions:{font:e.suggestedQuestionsFontColor,background:e.suggestedQuestionsBackgroundColor,hover:e.suggestedQuestionsHoverColor,crossButton:{color:e.suggestedQuestionsCrossButtonColor,background:e.suggestedQuestionsCrossButtonBackgroundColor},highlight:e.suggestedQuestionsHighlightColor},chatButton:{animation:e.chatButtonBackgroundAnimationColor}},typography:{fontFamily:void 0,fontSize:void 0,lineHeight:void 0},borders:{radius:"4px",width:"1px"},animations:{chatButton:{type:e.chatButtonBackgroundAnimationType??"Ping",enabled:e.enableChatButtonBackgroundAnimation??!1}},branding:{visibility:{showBot:e.show_bot??!0,debalesBranding:e.debales_branding??!0},logo:{removeBackground:e.removeLogoBackground??!1}}});function cr(){const e=sessionStorage.getItem("debalesSessionID");if(e)return e;const t=crypto.randomUUID();return sessionStorage.setItem("debalesSessionID",t),t}function lZ(){return sessionStorage.getItem(dr(sr.LAST_SHOWN_MESSAGE_ID,{botId:window.DebalesChat.projectId}))}function Pa(){const e=localStorage.getItem(dr(sr.USER_INFO));return e?JSON.parse(e):null}function f1(e){localStorage.setItem(dr(sr.USER_INFO),JSON.stringify(e))}function Hp(e){if(e.current){const t=e.current.lastElementChild;if(t)if(window.matchMedia("(max-width: 768px)").matches)e.current.scrollTop=e.current.scrollHeight,setTimeout(()=>{e.current&&(e.current.scrollTop=e.current.scrollHeight)},50);else{const r=e.current.scrollTop,i=t.getBoundingClientRect().bottom+e.current.scrollTop-e.current.clientHeight,o=300,a=performance.now(),u=c=>{const d=c-a,p=Math.min(d/o,1),h=p<.5?4*p*p*p:1-Math.pow(-2*p+2,3)/2;e.current.scrollTop=r+(i-r)*h,p<1&&requestAnimationFrame(u)};requestAnimationFrame(u)}}}function uZ(){return window.location.pathname}function lT(){const e=/test|demo|example|debales/i,t=Pa()??"";return!!(t&&e.test(t.email))}function cZ(e){const t=uZ(),r=Array.from(new Set(e.map(o=>o.path))).filter(o=>new RegExp(`^${o}(/|$)`).test(t));if(r.length>0){r.sort((u,c)=>c.length-u.length);const o=r[0];return e.filter(u=>u.path===o&&u.enable!==!1).sort((u,c)=>(u.sortOrder??0)-(c.sortOrder??0))}return e.filter(o=>o.path==="/"&&o.enable!==!1).sort((o,a)=>(o.sortOrder??0)-(a.sortOrder??0))}const uT=new Set,fZ=e=>{const t=sT[e];if(!t)return console.warn("No Mixpanel token found"),null;if(uT.has(e))return Na;Na.init(t,{debug:!0,track_pageview:!0,persistence:"localStorage"}),console.log("Mixpanel initialized");const n=Pa();return n&&n.email&&Na.identify(n.email),uT.add(e),Na},dZ=async(e,t)=>{if(lT())return;const n=window.DebalesChat.projectId??t.projectId;if(!sT[n]){console.warn("No Mixpanel token found");return}Na.track(e,t)},hZ=()=>{const e=localStorage.getItem("anonymousUserId");if(e)return e;const t=crypto.randomUUID();return localStorage.setItem("anonymousUserId",t),t};function pZ(e){return e?e.split("<br>").filter(n=>n.trim().length>0).map(n=>n.trim()):[""]}const fr=e=>e.toLowerCase().includes("gaiabay")||e.toLowerCase().includes("debales-testing"),gZ=e=>{const t=e.findIndex(o=>o.type==="dynamic");if(t===-1)return e;const n=e.filter(o=>o.type==="static"),r=e.filter(o=>o.type==="dynamic");return[...n.slice(0,t),r,...n.slice(t)]};function dr(e,t){return t!=null&&t.botId?`debales_${t.botId}_${e}`:`debales_${e}`}const cT=Y.createContext(null),fT=()=>{const e=Y.useContext(cT);if(!e)throw new Error("useCart must be used within a CartProvider");return e};var mZ="2.0.0",tu="",dT="?",Gp="function",Ba="undefined",nu="object",d1="string",yf="major",Ie="model",Ee="name",Ce="type",Me="vendor",Ae="version",jr="architecture",ru="console",_t="mobile",_n="tablet",Ar="smarttv",_f="wearable",h1="xr",p1="embedded",bf="inapp",hT="user-agent",g1=500,m1="brands",Ns="formFactors",v1="fullVersionList",iu="platform",y1="platformVersion",Vp="bitness",Fa="sec-ch-ua",vZ=Fa+"-full-version-list",yZ=Fa+"-arch",_Z=Fa+"-"+Vp,bZ=Fa+"-form-factors",SZ=Fa+"-"+_t,wZ=Fa+"-"+Ie,pT=Fa+"-"+iu,xZ=pT+"-version",gT=[m1,v1,_t,Ie,iu,y1,jr,Ns,Vp],ri="browser",Fo="cpu",lo="device",Uo="engine",_i="os",ou="result",Zp="Amazon",Sf="Apple",mT="ASUS",vT="BlackBerry",Ps="Google",yT="Huawei",_T="Lenovo",CZ="Honor",_1="LG",Yp="Microsoft",bT="Motorola",wf="Samsung",ST="Sharp",Wp="Sony",b1="Xiaomi",S1="Zebra",au="Mobile ",xf=" Browser",wT="Chrome",Ua="Chromecast",EZ="Edge",Cf="Firefox",Ef="Opera",xT="Facebook",CT="Sogou",w1="Windows",kZ=typeof window!==Ba,Hr=kZ&&window.navigator?window.navigator:void 0,za=Hr&&Hr.userAgentData?Hr.userAgentData:void 0,AZ=function(e,t){var n={},r=t;if(!Qp(t)){r={};for(var i in t)for(var o in t[i])r[o]=t[i][o].concat(r[o]?r[o]:[])}for(var a in e)n[a]=r[a]&&r[a].length%2===0?r[a].concat(e[a]):e[a];return n},Kp=function(e){for(var t={},n=0;n<e.length;n++)t[e[n].toUpperCase()]=e[n];return t},x1=function(e,t){if(typeof e===nu&&e.length>0){for(var n in e)if(zo(e[n])==zo(t))return!0;return!1}return su(e)?zo(t).indexOf(zo(e))!==-1:!1},Qp=function(e,t){for(var n in e)return/^(browser|cpu|device|engine|os)$/.test(n)||(t?Qp(e[n]):!1)},su=function(e){return typeof e===d1},C1=function(e){if(e){for(var t=[],n=Bs(/\\?\"/g,e).split(","),r=0;r<n.length;r++)if(n[r].indexOf(";")>-1){var i=Af(n[r]).split(";v=");t[r]={brand:i[0],version:i[1]}}else t[r]=Af(n[r]);return t}},zo=function(e){return su(e)?e.toLowerCase():e},E1=function(e){return su(e)?Bs(/[^\d\.]/g,e).split(".")[0]:void 0},qo=function(e){for(var t in e){var n=e[t];typeof n==nu&&n.length==2?this[n[0]]=n[1]:this[n]=void 0}return this},Bs=function(e,t){return su(t)?t.replace(e,tu):t},kf=function(e){return Bs(/\\?\"/g,e)},Af=function(e,t){if(su(e))return e=Bs(/^\s\s*/,e),typeof t===Ba?e:e.substring(0,g1)},ET=function(e,t){if(!(!e||!t))for(var n=0,r,i,o,a,u,c;n<t.length&&!u;){var d=t[n],p=t[n+1];for(r=i=0;r<d.length&&!u&&d[r];)if(u=d[r++].exec(e),u)for(o=0;o<p.length;o++)c=u[++i],a=p[o],typeof a===nu&&a.length>0?a.length===2?typeof a[1]==Gp?this[a[0]]=a[1].call(this,c):this[a[0]]=a[1]:a.length===3?typeof a[1]===Gp&&!(a[1].exec&&a[1].test)?this[a[0]]=c?a[1].call(this,c,a[2]):void 0:this[a[0]]=c?c.replace(a[1],a[2]):void 0:a.length===4&&(this[a[0]]=c?a[3].call(this,c.replace(a[1],a[2])):void 0):this[a]=c||void 0;n+=2}},If=function(e,t){for(var n in t)if(typeof t[n]===nu&&t[n].length>0){for(var r=0;r<t[n].length;r++)if(x1(t[n][r],e))return n===dT?void 0:n}else if(x1(t[n],e))return n===dT?void 0:n;return t.hasOwnProperty("*")?t["*"]:e},kT={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2","8.1":"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},AT={embedded:"Automotive",mobile:"Mobile",tablet:["Tablet","EInk"],smarttv:"TV",wearable:"Watch",xr:["VR","XR"],"?":["Desktop","Unknown"],"*":void 0},IT={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[Ae,[Ee,au+"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[Ae,[Ee,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[Ee,Ae],[/opios[\/ ]+([\w\.]+)/i],[Ae,[Ee,Ef+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[Ae,[Ee,Ef+" GX"]],[/\bopr\/([\w\.]+)/i],[Ae,[Ee,Ef]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[Ae,[Ee,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[Ae,[Ee,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon)\/([-\w\.]+)/i,/(heytap|ovi|115)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[Ee,Ae],[/quark(?:pc)?\/([-\w\.]+)/i],[Ae,[Ee,"Quark"]],[/\bddg\/([\w\.]+)/i],[Ae,[Ee,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[Ae,[Ee,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[Ae,[Ee,"WeChat"]],[/konqueror\/([\w\.]+)/i],[Ae,[Ee,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[Ae,[Ee,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[Ae,[Ee,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[Ae,[Ee,"Smart "+_T+xf]],[/(avast|avg)\/([\w\.]+)/i],[[Ee,/(.+)/,"$1 Secure"+xf],Ae],[/\bfocus\/([\w\.]+)/i],[Ae,[Ee,Cf+" Focus"]],[/\bopt\/([\w\.]+)/i],[Ae,[Ee,Ef+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[Ae,[Ee,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[Ae,[Ee,"Dolphin"]],[/coast\/([\w\.]+)/i],[Ae,[Ee,Ef+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[Ae,[Ee,"MIUI"+xf]],[/fxios\/([\w\.-]+)/i],[Ae,[Ee,au+Cf]],[/\bqihoobrowser\/?([\w\.]*)/i],[Ae,[Ee,"360"]],[/\b(qq)\/([\w\.]+)/i],[[Ee,/(.+)/,"$1Browser"],Ae],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[Ee,/(.+)/,"$1"+xf],Ae],[/samsungbrowser\/([\w\.]+)/i],[Ae,[Ee,wf+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[Ae,[Ee,CT+" Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[Ee,CT+" Mobile"],Ae],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[Ee,Ae],[/(lbbrowser|rekonq)/i],[Ee],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[Ae,Ee],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[Ee,xT],Ae,[Ce,bf]],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(instagram|snapchat)[\/ ]([-\w\.]+)/i],[Ee,Ae,[Ce,bf]],[/\bgsa\/([\w\.]+) .*safari\//i],[Ae,[Ee,"GSA"],[Ce,bf]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[Ae,[Ee,"TikTok"],[Ce,bf]],[/\[(linkedin)app\]/i],[Ee,[Ce,bf]],[/(chromium)[\/ ]([-\w\.]+)/i],[Ee,Ae],[/headlesschrome(?:\/([\w\.]+)| )/i],[Ae,[Ee,wT+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[Ee,wT+" WebView"],Ae],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[Ae,[Ee,"Android"+xf]],[/chrome\/([\w\.]+) mobile/i],[Ae,[Ee,au+"Chrome"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[Ee,Ae],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[Ae,[Ee,au+"Safari"]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[Ee,au+"Safari"]],[/version\/([\w\.\,]+) .*(safari)/i],[Ae,Ee],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[Ee,[Ae,"1"]],[/(webkit|khtml)\/([\w\.]+)/i],[Ee,Ae],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[Ee,au+Cf],Ae],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[Ee,"Netscape"],Ae],[/(wolvic|librewolf)\/([\w\.]+)/i],[Ee,Ae],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[Ae,[Ee,Cf+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[Ee,[Ae,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[Ee,[Ae,/[^\d\.]+./,tu]]],cpu:[[/\b(?:(amd|x|x86[-_]?|wow|win)64)\b/i],[[jr,"amd64"]],[/(ia32(?=;))/i,/((?:i[346]|x)86)[;\)]/i],[[jr,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[jr,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[jr,"armhf"]],[/windows (ce|mobile); ppc;/i],[[jr,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[jr,/ower/,tu,zo]],[/(sun4\w)[;\)]/i],[[jr,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[jr,zo]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[Ie,[Me,wf],[Ce,_n]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[Ie,[Me,wf],[Ce,_t]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[Ie,[Me,Sf],[Ce,_t]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[Ie,[Me,Sf],[Ce,_n]],[/(macintosh);/i],[Ie,[Me,Sf]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[Ie,[Me,ST],[Ce,_t]],[/(?:honor)([-\w ]+)[;\)]/i],[Ie,[Me,CZ],[Ce,_t]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[Ie,[Me,yT],[Ce,_n]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[Ie,[Me,yT],[Ce,_t]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i],[[Ie,/_/g," "],[Me,b1],[Ce,_t]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[Ie,/_/g," "],[Me,b1],[Ce,_n]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[Ie,[Me,"OPPO"],[Ce,_t]],[/\b(opd2\d{3}a?) bui/i],[Ie,[Me,"OPPO"],[Ce,_n]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[Ie,[Me,"Vivo"],[Ce,_t]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[Ie,[Me,"Realme"],[Ce,_t]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[Ie,[Me,bT],[Ce,_t]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[Ie,[Me,bT],[Ce,_n]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[Ie,[Me,_1],[Ce,_n]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[Ie,[Me,_1],[Ce,_t]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[Ie,[Me,_T],[Ce,_n]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[Ie,/_/g," "],[Me,"Nokia"],[Ce,_t]],[/(pixel c)\b/i],[Ie,[Me,Ps],[Ce,_n]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[Ie,[Me,Ps],[Ce,_t]],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[Ie,[Me,Wp],[Ce,_t]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[Ie,"Xperia Tablet"],[Me,Wp],[Ce,_n]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[Ie,[Me,"OnePlus"],[Ce,_t]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[Ie,[Me,Zp],[Ce,_n]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[Ie,/(.+)/g,"Fire Phone $1"],[Me,Zp],[Ce,_t]],[/(playbook);[-\w\),; ]+(rim)/i],[Ie,Me,[Ce,_n]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[Ie,[Me,vT],[Ce,_t]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[Ie,[Me,mT],[Ce,_n]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[Ie,[Me,mT],[Ce,_t]],[/(nexus 9)/i],[Ie,[Me,"HTC"],[Ce,_n]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[Me,[Ie,/_/g," "],[Ce,_t]],[/tcl (xess p17aa)/i,/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])(_\w(\w|\w\w))?(\)| bui)/i],[Ie,[Me,"TCL"],[Ce,_n]],[/droid [\w\.]+; (418(?:7d|8v)|5087z|5102l|61(?:02[dh]|25[adfh]|27[ai]|56[dh]|59k|65[ah])|a509dl|t(?:43(?:0w|1[adepqu])|50(?:6d|7[adju])|6(?:09dl|10k|12b|71[efho]|76[hjk])|7(?:66[ahju]|67[hw]|7[045][bh]|71[hk]|73o|76[ho]|79w|81[hks]?|82h|90[bhsy]|99b)|810[hs]))(_\w(\w|\w\w))?(\)| bui)/i],[Ie,[Me,"TCL"],[Ce,_t]],[/(itel) ((\w+))/i],[[Me,zo],Ie,[Ce,If,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[Ie,[Me,"Acer"],[Ce,_n]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[Ie,[Me,"Meizu"],[Ce,_t]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[Ie,[Me,"Ulefone"],[Ce,_t]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[Ie,[Me,"Energizer"],[Ce,_t]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[Ie,[Me,"Cat"],[Ce,_t]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[Ie,[Me,"Smartfren"],[Ce,_t]],[/droid.+; (a(?:015|06[35]|142p?))/i],[Ie,[Me,"Nothing"],[Ce,_t]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (imo) ((?!tab)[\w ]+?)(?: bui|\))/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[Me,Ie,[Ce,_t]],[/(imo) (tab \w+)/i,/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[Me,Ie,[Ce,_n]],[/(surface duo)/i],[Ie,[Me,Yp],[Ce,_n]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[Ie,[Me,"Fairphone"],[Ce,_t]],[/(shield[\w ]+) b/i],[Ie,[Me,"Nvidia"],[Ce,_n]],[/(sprint) (\w+)/i],[Me,Ie,[Ce,_t]],[/(kin\.[onetw]{3})/i],[[Ie,/\./g," "],[Me,Yp],[Ce,_t]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[Ie,[Me,S1],[Ce,_n]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[Ie,[Me,S1],[Ce,_t]],[/smart-tv.+(samsung)/i],[Me,[Ce,Ar]],[/hbbtv.+maple;(\d+)/i],[[Ie,/^/,"SmartTV"],[Me,wf],[Ce,Ar]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[Me,_1],[Ce,Ar]],[/(apple) ?tv/i],[Me,[Ie,Sf+" TV"],[Ce,Ar]],[/crkey.*devicetype\/chromecast/i],[[Ie,Ua+" Third Generation"],[Me,Ps],[Ce,Ar]],[/crkey.*devicetype\/([^/]*)/i],[[Ie,/^/,"Chromecast "],[Me,Ps],[Ce,Ar]],[/fuchsia.*crkey/i],[[Ie,Ua+" Nest Hub"],[Me,Ps],[Ce,Ar]],[/crkey/i],[[Ie,Ua],[Me,Ps],[Ce,Ar]],[/droid.+aft(\w+)( bui|\))/i],[Ie,[Me,Zp],[Ce,Ar]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[Ie,[Me,ST],[Ce,Ar]],[/(bravia[\w ]+)( bui|\))/i],[Ie,[Me,Wp],[Ce,Ar]],[/(mitv-\w{5}) bui/i],[Ie,[Me,b1],[Ce,Ar]],[/Hbbtv.*(technisat) (.*);/i],[Me,Ie,[Ce,Ar]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[Me,Af],[Ie,Af],[Ce,Ar]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[Ce,Ar]],[/(ouya)/i,/(nintendo) (\w+)/i],[Me,Ie,[Ce,ru]],[/droid.+; (shield) bui/i],[Ie,[Me,"Nvidia"],[Ce,ru]],[/(playstation \w+)/i],[Ie,[Me,Wp],[Ce,ru]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[Ie,[Me,Yp],[Ce,ru]],[/\b(sm-[lr]\d\d[05][fnuw]?s?)\b/i],[Ie,[Me,wf],[Ce,_f]],[/((pebble))app/i],[Me,Ie,[Ce,_f]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[Ie,[Me,Sf],[Ce,_f]],[/droid.+; (wt63?0{2,3})\)/i],[Ie,[Me,S1],[Ce,_f]],[/droid.+; (glass) \d/i],[Ie,[Me,Ps],[Ce,h1]],[/(pico) (4|neo3(?: link|pro)?)/i],[Me,Ie,[Ce,h1]],[/; (quest( \d| pro)?)/i],[Ie,[Me,xT],[Ce,h1]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[Me,[Ce,p1]],[/(aeobc)\b/i],[Ie,[Me,Zp],[Ce,p1]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[Ie,[Ce,_t]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[Ie,[Ce,_n]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[Ce,_n]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[Ce,_t]],[/(android[-\w\. ]{0,9});.+buil/i],[Ie,[Me,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[Ae,[Ee,EZ+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[Ee,Ae],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[Ae,[Ee,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[Ee,Ae],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[Ae,Ee]],os:[[/microsoft (windows) (vista|xp)/i],[Ee,Ae],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[Ee,[Ae,If,kT]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[Ae,If,kT],[Ee,w1]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[Ae,/_/g,"."],[Ee,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[Ee,"macOS"],[Ae,/_/g,"."]],[/android ([\d\.]+).*crkey/i],[Ae,[Ee,Ua+" Android"]],[/fuchsia.*crkey\/([\d\.]+)/i],[Ae,[Ee,Ua+" Fuchsia"]],[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],[Ae,[Ee,Ua+" SmartSpeaker"]],[/linux.*crkey\/([\d\.]+)/i],[Ae,[Ee,Ua+" Linux"]],[/crkey\/([\d\.]+)/i],[Ae,[Ee,Ua]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[Ae,Ee],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish|openharmony)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[Ee,Ae],[/\(bb(10);/i],[Ae,[Ee,vT]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[Ae,[Ee,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[Ae,[Ee,Cf+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[Ae,[Ee,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[Ae,[Ee,"watchOS"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[Ee,"Chrome OS"],Ae],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) (\w+)/i,/(xbox); +xbox ([^\);]+)/i,/(pico) .+os([\w\.]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[Ee,Ae],[/(sunos) ?([\w\.\d]*)/i],[[Ee,"Solaris"],Ae],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[Ee,Ae]]},Xp=function(){var e={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}};return qo.call(e.init,[[ri,[Ee,Ae,yf,Ce]],[Fo,[jr]],[lo,[Ce,Ie,Me]],[Uo,[Ee,Ae]],[_i,[Ee,Ae]]]),qo.call(e.isIgnore,[[ri,[Ae,yf]],[Uo,[Ae]],[_i,[Ae]]]),qo.call(e.isIgnoreRgx,[[ri,/ ?browser$/i],[_i,/ ?os$/i]]),qo.call(e.toString,[[ri,[Ee,Ae]],[Fo,[jr]],[lo,[Me,Ie]],[Uo,[Ee,Ae]],[_i,[Ee,Ae]]]),e}(),IZ=function(e,t){var n=Xp.init[t],r=Xp.isIgnore[t]||0,i=Xp.isIgnoreRgx[t]||0,o=Xp.toString[t]||0;function a(){qo.call(this,n)}return a.prototype.getItem=function(){return e},a.prototype.withClientHints=function(){return za?za.getHighEntropyValues(gT).then(function(u){return e.setCH(new RT(u,!1)).parseCH().get()}):e.parseCH().get()},a.prototype.withFeatureCheck=function(){return e.detectFeature().get()},t!=ou&&(a.prototype.is=function(u){var c=!1;for(var d in this)if(this.hasOwnProperty(d)&&!x1(r,d)&&zo(i?Bs(i,this[d]):this[d])==zo(i?Bs(i,u):u)){if(c=!0,u!=Ba)break}else if(u==Ba&&c){c=!c;break}return c},a.prototype.toString=function(){var u=tu;for(var c in o)typeof this[o[c]]!==Ba&&(u+=(u?" ":tu)+this[o[c]]);return u||Ba}),za||(a.prototype.then=function(u){var c=this,d=function(){for(var h in c)c.hasOwnProperty(h)&&(this[h]=c[h])};d.prototype={is:a.prototype.is,toString:a.prototype.toString};var p=new d;return u(p),p}),new a};function RT(e,t){if(e=e||{},qo.call(this,gT),t)qo.call(this,[[m1,C1(e[Fa])],[v1,C1(e[vZ])],[_t,/\?1/.test(e[SZ])],[Ie,kf(e[wZ])],[iu,kf(e[pT])],[y1,kf(e[xZ])],[jr,kf(e[yZ])],[Ns,C1(e[bZ])],[Vp,kf(e[_Z])]]);else for(var n in e)this.hasOwnProperty(n)&&typeof e[n]!==Ba&&(this[n]=e[n])}function OT(e,t,n,r){return this.get=function(i){return i?this.data.hasOwnProperty(i)?this.data[i]:void 0:this.data},this.set=function(i,o){return this.data[i]=o,this},this.setCH=function(i){return this.uaCH=i,this},this.detectFeature=function(){if(Hr&&Hr.userAgent==this.ua)switch(this.itemType){case ri:Hr.brave&&typeof Hr.brave.isBrave==Gp&&this.set(Ee,"Brave");break;case lo:!this.get(Ce)&&za&&za[_t]&&this.set(Ce,_t),this.get(Ie)=="Macintosh"&&Hr&&typeof Hr.standalone!==Ba&&Hr.maxTouchPoints&&Hr.maxTouchPoints>2&&this.set(Ie,"iPad").set(Ce,_n);break;case _i:!this.get(Ee)&&za&&za[iu]&&this.set(Ee,za[iu]);break;case ou:var i=this.data,o=function(a){return i[a].getItem().detectFeature().get()};this.set(ri,o(ri)).set(Fo,o(Fo)).set(lo,o(lo)).set(Uo,o(Uo)).set(_i,o(_i))}return this},this.parseUA=function(){return this.itemType!=ou&&ET.call(this.data,this.ua,this.rgxMap),this.itemType==ri&&this.set(yf,E1(this.get(Ae))),this},this.parseCH=function(){var i=this.uaCH,o=this.rgxMap;switch(this.itemType){case ri:var a=i[v1]||i[m1],u;if(a)for(var c in a){var d=Bs(/(Google|Microsoft) /,a[c].brand||a[c]),p=a[c].version;!/not.a.brand/i.test(d)&&(!u||/chrom/i.test(u)&&!/chromi/i.test(d))&&(this.set(Ee,d).set(Ae,p).set(yf,E1(p)),u=d)}break;case Fo:var h=i[jr];h&&(h&&i[Vp]=="64"&&(h+="64"),ET.call(this.data,h+";",o));break;case lo:if(i[_t]&&this.set(Ce,_t),i[Ie]&&this.set(Ie,i[Ie]),i[Ie]=="Xbox"&&this.set(Ce,ru).set(Me,Yp),i[Ns]){var m;if(typeof i[Ns]!="string")for(var v=0;!m&&v<i[Ns].length;)m=If(i[Ns][v++],AT);else m=If(i[Ns],AT);this.set(Ce,m)}break;case _i:var _=i[iu];if(_){var x=i[y1];_==w1&&(x=parseInt(E1(x),10)>=13?"11":"10"),this.set(Ee,_).set(Ae,x)}this.get(Ee)==w1&&i[Ie]=="Xbox"&&this.set(Ee,"Xbox").set(Ae,void 0);break;case ou:var S=this.data,b=function(C){return S[C].getItem().setCH(i).parseCH().get()};this.set(ri,b(ri)).set(Fo,b(Fo)).set(lo,b(lo)).set(Uo,b(Uo)).set(_i,b(_i))}return this},qo.call(this,[["itemType",e],["ua",t],["uaCH",r],["rgxMap",n],["data",IZ(this,e)]]),this}function jo(e,t,n){if(typeof e===nu?(Qp(e,!0)?(typeof t===nu&&(n=t),t=e):(n=e,t=void 0),e=void 0):typeof e===d1&&!Qp(t,!0)&&(n=t,t=void 0),n&&typeof n.append===Gp){var r={};n.forEach(function(c,d){r[d]=c}),n=r}if(!(this instanceof jo))return new jo(e,t,n).getResult();var i=typeof e===d1?e:n&&n[hT]?n[hT]:Hr&&Hr.userAgent?Hr.userAgent:tu,o=new RT(n,!0),a=t?AZ(IT,t):IT,u=function(c){return c==ou?function(){return new OT(c,i,a,o).set("ua",i).set(ri,this.getBrowser()).set(Fo,this.getCPU()).set(lo,this.getDevice()).set(Uo,this.getEngine()).set(_i,this.getOS()).get()}:function(){return new OT(c,i,a[c],o).parseUA().get()}};return qo.call(this,[["getBrowser",u(ri)],["getCPU",u(Fo)],["getDevice",u(lo)],["getEngine",u(Uo)],["getOS",u(_i)],["getResult",u(ou)],["getUA",function(){return i}],["setUA",function(c){return su(c)&&(i=c.length>g1?Af(c,g1):c),this}]]).setUA(i),this}jo.VERSION=mZ,jo.BROWSER=Kp([Ee,Ae,yf,Ce]),jo.CPU=Kp([jr]),jo.DEVICE=Kp([Ie,Me,Ce,ru,_t,Ar,_n,_f,p1]),jo.ENGINE=jo.OS=Kp([Ee,Ae]);const ki=class ki{constructor(t){tr(this,"config");tr(this,"storedData");tr(this,"deviceInfo");tr(this,"localStorageKey","_dsjfs312313kj3debales_analytics_");this.config=t,this.deviceInfo=this.getDeviceInfo(),this.localStorageKey=t.localStorageKey||this.localStorageKey+this.config.projectName,this.config.testing=t.testing||(()=>!1);const n=localStorage.getItem(this.localStorageKey);if(n)this.storedData=JSON.parse(n),this.config.debug&&console.log("Using Existing Stored data:",this.storedData);else{const r=crypto.randomUUID();this.storedData={projectName:this.config.projectName,anonId:r,distinctId:r},this.config.debug&&console.log("Using New Stored data:",this.storedData),this.updateStorage()}this.config.debug&&console.log("Analytics initialized:",this.storedData)}static init(t){ki.instance||(ki.instance=new ki(t))}static getInstance(){if(!ki.instance)throw new Error("DebalesAnalytics is not initialized. Call init() first.");return ki.instance}static async identify(t,n){return ki.getInstance().identifyInternal(t,n)}static track(t,n){ki.getInstance().trackInternal(t,n)}static getDistinctId(){return ki.getInstance().storedData.distinctId}static getAnonId(){return ki.getInstance().storedData.anonId}async identifyInternal(t,n){try{if(this.config.testing&&this.config.testing())return;let r,i,o;if(n){const{name:c,phone:d,...p}=n;r=c,i=d,o=p}const a={distinctId:this.storedData.distinctId,anonId:[this.storedData.anonId],projectName:this.config.projectName,email:t,name:r,phone:i,properties:o},u=await this.sendRequest("/api/analytic/identify",a);u&&u.success&&u.distinctId&&(this.config.debug&&console.log("identify success new distint id"),this.storedData.distinctId=u.distinctId,this.storedData.email=t,this.updateStorage(),u.isIdentified&&this.trackInternal("identify")),this.config.debug&&console.log("Identify event sent:",a)}catch(r){console.error("Failed to identify user:",r)}}trackInternal(t,n){if(this.config.testing&&this.config.testing())return;const r={projectName:this.config.projectName,distinctId:this.storedData.distinctId,anonId:this.storedData.anonId,eventName:t,osVersion:this.deviceInfo.osVersion,browserVersion:this.deviceInfo.browserVersion,operatingSystem:this.deviceInfo.os,browser:this.deviceInfo.browser,currentUrl:window.location.href,chatId:cr()+this.config.projectName,properties:n};this.sendRequest("/api/analytic/track",r),this.config.debug&&console.log("Track event sent:",r)}updateStorage(){localStorage.setItem(this.localStorageKey,JSON.stringify(this.storedData))}async sendRequest(t,n){try{const r=await fetch(`${so}${t}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);return await r.json()}catch(r){console.error("Failed to send analytics data:",r)}}getDeviceInfo(){const n=new jo().getResult();return{browser:n.browser.name,os:n.os.name,browserVersion:n.browser.version,osVersion:n.os.version}}};tr(ki,"instance",null);let k1=ki;const Fs=k1;var ji,le=typeof window<"u"?window:void 0,Gr=typeof globalThis<"u"?globalThis:le,TT=Array.prototype,MT=TT.forEach,DT=TT.indexOf,ii=Gr==null?void 0:Gr.navigator,He=Gr==null?void 0:Gr.document,Vr=Gr==null?void 0:Gr.location,A1=Gr==null?void 0:Gr.fetch,I1=Gr!=null&&Gr.XMLHttpRequest&&"withCredentials"in new Gr.XMLHttpRequest?Gr.XMLHttpRequest:void 0,LT=Gr==null?void 0:Gr.AbortController,jn=ii==null?void 0:ii.userAgent,pt=le??{},Ho={DEBUG:!1,LIB_VERSION:"1.235.0"},R1="$copy_autocapture",RZ=["$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"];(function(e){e.GZipJS="gzip-js",e.Base64="base64"})(ji||(ji={}));var OZ=["fatal","error","warning","log","info","debug"];function Rt(e,t){return e.indexOf(t)!==-1}var Jp=function(e){return e.trim()},O1=function(e){return e.replace(/^\$/,"")},TZ=Array.isArray,$T=Object.prototype,NT=$T.hasOwnProperty,eg=$T.toString,An=TZ||function(e){return eg.call(e)==="[object Array]"},Hi=e=>typeof e=="function",In=e=>e===Object(e)&&!An(e),lu=e=>{if(In(e)){for(var t in e)if(NT.call(e,t))return!1;return!0}return!1},Fe=e=>e===void 0,Hn=e=>eg.call(e)=="[object String]",T1=e=>Hn(e)&&e.trim().length===0,qa=e=>e===null,Kt=e=>Fe(e)||qa(e),$r=e=>eg.call(e)=="[object Number]",ja=e=>eg.call(e)==="[object Boolean]",MZ=e=>e instanceof FormData,DZ=e=>Rt(RZ,e),PT=e=>{var t={_log:function(n){if(le&&(Ho.DEBUG||pt.POSTHOG_DEBUG)&&!Fe(le.console)&&le.console){for(var r=("__rrweb_original__"in le.console[n])?le.console[n].__rrweb_original__:le.console[n],i=arguments.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];r(e,...o)}},info:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];t._log("log",...r)},warn:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];t._log("warn",...r)},error:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];t._log("error",...r)},critical:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];console.error(e,...r)},uninitializedWarning:n=>{t.error("You must initialize PostHog before calling ".concat(n))},createLogger:n=>PT("".concat(e," ").concat(n))};return t},tt=PT("[PostHog.js]"),Ir=tt.createLogger,LZ=Ir("[ExternalScriptsLoader]"),BT=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return LZ.warn("".concat(t," was requested but loading of external scripts is disabled.")),n("Loading of external scripts is disabled");var r=He==null?void 0:He.querySelectorAll("script");if(r){for(var i=0;i<r.length;i++)if(r[i].src===t)return n()}var o=()=>{if(!He)return n("document not found");var a=He.createElement("script");if(a.type="text/javascript",a.crossOrigin="anonymous",a.src=t,a.onload=d=>n(void 0,d),a.onerror=d=>n(d),e.config.prepare_external_dependency_script&&(a=e.config.prepare_external_dependency_script(a)),!a)return n("prepare_external_dependency_script returned null");var u,c=He.querySelectorAll("body > script");c.length>0?(u=c[0].parentNode)===null||u===void 0||u.insertBefore(a,c[0]):He.body.appendChild(a)};He!=null&&He.body?o():He==null||He.addEventListener("DOMContentLoaded",o)};function FT(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function pe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?FT(Object(n),!0).forEach(function(r){De(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):FT(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function De(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function UT(e,t){if(e==null)return{};var n,r,i=function(a,u){if(a==null)return{};var c,d,p={},h=Object.keys(a);for(d=0;d<h.length;d++)c=h[d],u.indexOf(c)>=0||(p[c]=a[c]);return p}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}pt.__PosthogExtensions__=pt.__PosthogExtensions__||{},pt.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{var r="/static/".concat(t,".js")+"?v=".concat(e.version);if(t==="remote-config"&&(r="/array/".concat(e.config.token,"/config.js")),t==="toolbar"){var i=3e5,o=Math.floor(Date.now()/i)*i;r="".concat(r,"&t=").concat(o)}var a=e.requestRouter.endpointFor("assets",r);BT(e,a,n)},pt.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{var r=e.requestRouter.endpointFor("api",t);BT(e,r,n)};var tg={};function Ha(e,t,n){if(An(e)){if(MT&&e.forEach===MT)e.forEach(t,n);else if("length"in e&&e.length===+e.length){for(var r=0,i=e.length;r<i;r++)if(r in e&&t.call(n,e[r],r)===tg)return}}}function on(e,t,n){if(!Kt(e)){if(An(e))return Ha(e,t,n);if(MZ(e)){for(var r of e.entries())if(t.call(n,r[1],r[0])===tg)return}else for(var i in e)if(NT.call(e,i)&&t.call(n,e[i],i)===tg)return}}var Gn=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return Ha(n,function(i){for(var o in i)i[o]!==void 0&&(e[o]=i[o])}),e},ng=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return Ha(n,function(i){Ha(i,function(o){e.push(o)})}),e};function rg(e){for(var t=Object.keys(e),n=t.length,r=new Array(n);n--;)r[n]=[t[n],e[t[n]]];return r}var zT=function(e){try{return e()}catch{return}},$Z=function(e){return function(){try{for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.apply(this,n)}catch(i){tt.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),tt.critical(i)}}},Rf=function(e){var t={};return on(e,function(n,r){Hn(n)&&n.length>0&&(t[r]=n)}),t};function NZ(e,t){return n=e,r=o=>Hn(o)&&!qa(t)?o.slice(0,t):o,i=new Set,function o(a,u){return a!==Object(a)?r?r(a,u):a:i.has(a)?void 0:(i.add(a),An(a)?(c=[],Ha(a,d=>{c.push(o(d))})):(c={},on(a,(d,p)=>{i.has(d)||(c[p]=o(d,p))})),c);var c}(n);var n,r,i}var PZ=["herokuapp.com","vercel.app","netlify.app"];function BZ(e){var t=e==null?void 0:e.hostname;if(!Hn(t))return!1;var n=t.split(".").slice(-2).join(".");for(var r of PZ)if(n===r)return!1;return!0}function qT(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return e[n]}function Nn(e,t,n,r){var{capture:i=!1,passive:o=!0}=r??{};e==null||e.addEventListener(t,n,{capture:i,passive:o})}var jT="$people_distinct_id",Of="__alias",Tf="__timers",HT="$autocapture_disabled_server_side",M1="$heatmaps_enabled_server_side",GT="$exception_capture_enabled_server_side",VT="$web_vitals_enabled_server_side",ZT="$dead_clicks_enabled_server_side",YT="$web_vitals_allowed_metrics",D1="$session_recording_enabled_server_side",WT="$console_log_recording_enabled_server_side",KT="$session_recording_network_payload_capture",QT="$session_recording_masking",XT="$session_recording_canvas_recording",JT="$replay_sample_rate",eM="$replay_minimum_duration",tM="$replay_script_config",ig="$sesid",Mf="$session_is_sampled",L1="$session_recording_url_trigger_activated_session",$1="$session_recording_event_trigger_activated_session",uu="$enabled_feature_flags",og="$early_access_features",N1="$feature_flag_details",Df="$stored_person_properties",Us="$stored_group_properties",P1="$surveys",ag="$surveys_activated",sg="$flag_call_reported",Go="$user_state",B1="$client_session_props",F1="$capture_rate_limit",U1="$initial_campaign_params",z1="$initial_referrer_info",q1="$initial_person_info",lg="$epp",nM="__POSTHOG_TOOLBAR__",rM="$posthog_cookieless",FZ=[jT,Of,"__cmpns",Tf,D1,M1,ig,uu,Go,og,N1,Us,Df,P1,sg,B1,F1,U1,z1,lg];function iM(e){var t;return e instanceof Element&&(e.id===nM||!((t=e.closest)===null||t===void 0||!t.call(e,".toolbar-global-fade-container")))}function ug(e){return!!e&&e.nodeType===1}function Ga(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function oM(e){return!!e&&e.nodeType===3}function aM(e){return!!e&&e.nodeType===11}function j1(e){return e?Jp(e).split(/\s+/):[]}function sM(e){var t=le==null?void 0:le.location.href;return!!(t&&e&&e.some(n=>t.match(n)))}function cg(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 j1(t)}function lM(e){return Kt(e)?null:Jp(e).split(/(\s+)/).filter(t=>cu(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function fg(e){var t="";return G1(e)&&!fM(e)&&e.childNodes&&e.childNodes.length&&on(e.childNodes,function(n){var r;oM(n)&&n.textContent&&(t+=(r=lM(n.textContent))!==null&&r!==void 0?r:"")}),Jp(t)}function uM(e){return Fe(e.target)?e.srcElement||null:(t=e.target)!==null&&t!==void 0&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var H1=["a","button","form","input","select","textarea","label"];function cM(e){var t=e.parentNode;return!(!t||!ug(t))&&t}function UZ(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,i=arguments.length>4?arguments[4]:void 0;if(!le||!e||Ga(e,"html")||!ug(e)||n!=null&&n.url_allowlist&&!sM(n.url_allowlist)||n!=null&&n.url_ignorelist&&sM(n.url_ignorelist))return!1;if(n!=null&&n.dom_event_allowlist){var o=n.dom_event_allowlist;if(o&&!o.some(v=>t.type===v))return!1}for(var a=!1,u=[e],c=!0,d=e;d.parentNode&&!Ga(d,"body");)if(aM(d.parentNode))u.push(d.parentNode.host),d=d.parentNode.host;else{if(!(c=cM(d)))break;if(r||H1.indexOf(c.tagName.toLowerCase())>-1)a=!0;else{var p=le.getComputedStyle(c);p&&p.getPropertyValue("cursor")==="pointer"&&(a=!0)}u.push(c),d=c}if(!function(v,_){var x=_==null?void 0:_.element_allowlist;if(Fe(x))return!0;var S=function(E){if(x.some(I=>E.tagName.toLowerCase()===I))return{v:!0}};for(var b of v){var C=S(b);if(typeof C=="object")return C.v}return!1}(u,n)||!function(v,_){var x=_==null?void 0:_.css_selector_allowlist;if(Fe(x))return!0;var S=function(E){if(x.some(I=>E.matches(I)))return{v:!0}};for(var b of v){var C=S(b);if(typeof C=="object")return C.v}return!1}(u,n))return!1;var h=le.getComputedStyle(e);if(h&&h.getPropertyValue("cursor")==="pointer"&&t.type==="click")return!0;var m=e.tagName.toLowerCase();switch(m){case"html":return!1;case"form":return(i||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(i||["change","click"]).indexOf(t.type)>=0;default:return a?(i||["click"]).indexOf(t.type)>=0:(i||["click"]).indexOf(t.type)>=0&&(H1.indexOf(m)>-1||e.getAttribute("contenteditable")==="true")}}function G1(e){for(var t=e;t.parentNode&&!Ga(t,"body");t=t.parentNode){var n=cg(t);if(Rt(n,"ph-sensitive")||Rt(n,"ph-no-capture"))return!1}if(Rt(cg(e),"ph-include"))return!0;var r=e.type||"";if(Hn(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var i=e.name||e.id||"";return!(Hn(i)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(i.replace(/[^a-zA-Z0-9]/g,"")))}function fM(e){return!!(Ga(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Ga(e,"select")||Ga(e,"textarea")||e.getAttribute("contenteditable")==="true")}var dM="(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})",zZ=new RegExp("^(?:".concat(dM,")$")),qZ=new RegExp(dM),hM="\\d{3}-?\\d{2}-?\\d{4}",jZ=new RegExp("^(".concat(hM,")$")),HZ=new RegExp("(".concat(hM,")"));function cu(e){var t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];return!(Kt(e)||Hn(e)&&(e=Jp(e),(t?zZ:qZ).test((e||"").replace(/[- ]/g,""))||(t?jZ:HZ).test(e)))}function pM(e){var t=fg(e);return cu(t="".concat(t," ").concat(gM(e)).trim())?t:""}function gM(e){var t="";return e&&e.childNodes&&e.childNodes.length&&on(e.childNodes,function(n){var r;if(n&&((r=n.tagName)===null||r===void 0?void 0:r.toLowerCase())==="span")try{var i=fg(n);t="".concat(t," ").concat(i).trim(),n.childNodes&&n.childNodes.length&&(t="".concat(t," ").concat(gM(n)).trim())}catch(o){tt.error("[AutoCapture]",o)}}),t}function GZ(e){return function(t){var n=t.map(r=>{var i,o,a="";if(r.tag_name&&(a+=r.tag_name),r.attr_class)for(var u of(r.attr_class.sort(),r.attr_class))a+=".".concat(u.replace(/"/g,""));var c=pe(pe(pe(pe({},r.text?{text:r.text}:{}),{},{"nth-child":(i=r.nth_child)!==null&&i!==void 0?i:0,"nth-of-type":(o=r.nth_of_type)!==null&&o!==void 0?o:0},r.href?{href:r.href}:{}),r.attr_id?{attr_id:r.attr_id}:{}),r.attributes),d={};return rg(c).sort((p,h)=>{var[m]=p,[v]=h;return m.localeCompare(v)}).forEach(p=>{var[h,m]=p;return d[mM(h.toString())]=mM(m.toString())}),a+=":",a+=rg(c).map(p=>{var[h,m]=p;return"".concat(h,'="').concat(m,'"')}).join("")});return n.join(";")}(function(t){return t.map(n=>{var r,i,o={text:(r=n.$el_text)===null||r===void 0?void 0:r.slice(0,400),tag_name:n.tag_name,href:(i=n.attr__href)===null||i===void 0?void 0:i.slice(0,2048),attr_class:VZ(n),attr_id:n.attr__id,nth_child:n.nth_child,nth_of_type:n.nth_of_type,attributes:{}};return rg(n).filter(a=>{var[u]=a;return u.indexOf("attr__")===0}).forEach(a=>{var[u,c]=a;return o.attributes[u]=c}),o})}(e))}function mM(e){return e.replace(/"|\\"/g,'\\"')}function VZ(e){var t=e.attr__class;return t?An(t)?t:j1(t):void 0}class vM{constructor(){this.clicks=[]}isRageClick(t,n,r){var i=this.clicks[this.clicks.length-1];if(i&&Math.abs(t-i.x)+Math.abs(n-i.y)<30&&r-i.timestamp<1e3){if(this.clicks.push({x:t,y:n,timestamp:r}),this.clicks.length===3)return!0}else this.clicks=[{x:t,y:n,timestamp:r}];return!1}}var ZZ=["localhost","127.0.0.1"],fu=e=>{var t=He==null?void 0:He.createElement("a");return Fe(t)?null:(t.href=e,t)},YZ=function(e){var t,n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"&",i=[];return on(e,function(o,a){Fe(o)||Fe(a)||a==="undefined"||(t=encodeURIComponent((u=>u instanceof File)(o)?o.name:o.toString()),n=encodeURIComponent(a),i[i.length]=n+"="+t)}),i.join(r)},dg=function(e,t){for(var n,r=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),i=0;i<r.length;i++){var o=r[i].split("=");if(o[0]===t){n=o;break}}if(!An(n)||n.length<2)return"";var a=n[1];try{a=decodeURIComponent(a)}catch{tt.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},V1=function(e,t,n){if(!e||!t||!t.length)return e;for(var r=e.split("#"),i=r[0]||"",o=r[1],a=i.split("?"),u=a[1],c=a[0],d=(u||"").split("&"),p=[],h=0;h<d.length;h++){var m=d[h].split("=");An(m)&&(t.includes(m[0])?p.push(m[0]+"="+n):p.push(d[h]))}var v=c;return u!=null&&(v+="?"+p.join("&")),o!=null&&(v+="#"+o),v},hg=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},yM=Ir("[AutoCapture]");function Z1(e,t){return t.length>e?t.slice(0,e)+"...":t}function WZ(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!ug(t));return t}function KZ(e,t,n,r){var i=e.tagName.toLowerCase(),o={tag_name:i};H1.indexOf(i)>-1&&!n&&(i.toLowerCase()==="a"||i.toLowerCase()==="button"?o.$el_text=Z1(1024,pM(e)):o.$el_text=Z1(1024,fg(e)));var a=cg(e);a.length>0&&(o.classes=a.filter(function(p){return p!==""})),on(e.attributes,function(p){var h;if((!fM(e)||["name","id","class","aria-label"].indexOf(p.name)!==-1)&&(r==null||!r.includes(p.name))&&!t&&cu(p.value)&&(h=p.name,!Hn(h)||h.substring(0,10)!=="_ngcontent"&&h.substring(0,7)!=="_nghost")){var m=p.value;p.name==="class"&&(m=j1(m).join(" ")),o["attr__"+p.name]=Z1(1024,m)}});for(var u=1,c=1,d=e;d=WZ(d);)u++,d.tagName===e.tagName&&c++;return o.nth_child=u,o.nth_of_type=c,o}function QZ(e,t){for(var n,r,{e:i,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:u,elementsChainAsString:c}=t,d=[e],p=e;p.parentNode&&!Ga(p,"body");)aM(p.parentNode)?(d.push(p.parentNode.host),p=p.parentNode.host):(d.push(p.parentNode),p=p.parentNode);var h,m=[],v={},_=!1,x=!1;if(on(d,I=>{var O=G1(I);I.tagName.toLowerCase()==="a"&&(_=I.getAttribute("href"),_=O&&_&&cu(_)&&_),Rt(cg(I),"ph-no-capture")&&(x=!0),m.push(KZ(I,o,a,u));var T=function($){if(!G1($))return{};var F={};return on($.attributes,function(q){if(q.name&&q.name.indexOf("data-ph-capture-attribute")===0){var P=q.name.replace("data-ph-capture-attribute-",""),G=q.value;P&&G&&cu(G)&&(F[P]=G)}}),F}(I);Gn(v,T)}),x)return{props:{},explicitNoCapture:x};if(a||(e.tagName.toLowerCase()==="a"||e.tagName.toLowerCase()==="button"?m[0].$el_text=pM(e):m[0].$el_text=fg(e)),_){var S,b;m[0].attr__href=_;var C=(S=fu(_))===null||S===void 0?void 0:S.host,E=le==null||(b=le.location)===null||b===void 0?void 0:b.host;C&&E&&C!==E&&(h=_)}return{props:Gn({$event_type:i.type,$ce_version:1},c?{}:{$elements:m},{$elements_chain:GZ(m)},(n=m[0])!==null&&n!==void 0&&n.$el_text?{$el_text:(r=m[0])===null||r===void 0?void 0:r.$el_text}:{},h&&i.type==="click"?{$external_click_url:h}:{},v)}}class XZ{constructor(t){De(this,"_initialized",!1),De(this,"_isDisabledServerSide",null),De(this,"rageclicks",new vM),De(this,"_elementsChainAsString",!1),this.instance=t,this._elementSelectors=null}get config(){var t,n,r=In(this.instance.config.autocapture)?this.instance.config.autocapture:{};return r.url_allowlist=(t=r.url_allowlist)===null||t===void 0?void 0:t.map(i=>new RegExp(i)),r.url_ignorelist=(n=r.url_ignorelist)===null||n===void 0?void 0:n.map(i=>new RegExp(i)),r}_addDomEventHandlers(){if(this.isBrowserSupported()){if(le&&He){var t=r=>{r=r||(le==null?void 0:le.event);try{this._captureEvent(r)}catch(i){yM.error("Failed to capture event",i)}};if(Nn(He,"submit",t,{capture:!0}),Nn(He,"change",t,{capture:!0}),Nn(He,"click",t,{capture:!0}),this.config.capture_copied_text){var n=r=>{r=r||(le==null?void 0:le.event),this._captureEvent(r,R1)};Nn(He,"copy",n,{capture:!0}),Nn(He,"cut",n,{capture:!0})}}}else yM.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this._initialized&&(this._addDomEventHandlers(),this._initialized=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this._elementsChainAsString=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[HT]:!!t.autocapture_opt_out}),this._isDisabledServerSide=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this._elementSelectors=t}getElementSelectors(t){var n,r=[];return(n=this._elementSelectors)===null||n===void 0||n.forEach(i=>{var o=He==null?void 0:He.querySelectorAll(i);o==null||o.forEach(a=>{t===a&&r.push(i)})}),r}get isEnabled(){var t,n,r=(t=this.instance.persistence)===null||t===void 0?void 0:t.props[HT],i=this._isDisabledServerSide;if(qa(i)&&!ja(r)&&!this.instance.config.advanced_disable_decide)return!1;var o=(n=this._isDisabledServerSide)!==null&&n!==void 0?n:!!r;return!!this.instance.config.autocapture&&!o}_captureEvent(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"$autocapture";if(this.isEnabled){var r,i=uM(t);oM(i)&&(i=i.parentNode||null),n==="$autocapture"&&t.type==="click"&&t instanceof MouseEvent&&this.instance.config.rageclick&&(r=this.rageclicks)!==null&&r!==void 0&&r.isRageClick(t.clientX,t.clientY,new Date().getTime())&&this._captureEvent(t,"$rageclick");var o=n===R1;if(i&&UZ(i,t,this.config,o,o?["copy","cut"]:void 0)){var{props:a,explicitNoCapture:u}=QZ(i,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.config.element_attribute_ignorelist,elementsChainAsString:this._elementsChainAsString});if(u)return!1;var c=this.getElementSelectors(i);if(c&&c.length>0&&(a.$element_selectors=c),n===R1){var d,p=lM(le==null||(d=le.getSelection())===null||d===void 0?void 0:d.toString()),h=t.type||"clipboard";if(!p)return!1;a.$selected_content=p,a.$copy_type=h}return this.instance.capture(n,a),!0}}}isBrowserSupported(){return Hi(He==null?void 0:He.querySelectorAll)}}Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return $r(e)&&isFinite(e)&&Math.floor(e)===e});var _M="0123456789abcdef";class pg{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,n,r,i){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(i)||t<0||n<0||r<0||i<0||t>0xffffffffffff||n>4095||r>1073741823||i>4294967295)throw new RangeError("invalid field value");var o=new Uint8Array(16);return o[0]=t/Math.pow(2,40),o[1]=t/Math.pow(2,32),o[2]=t/Math.pow(2,24),o[3]=t/Math.pow(2,16),o[4]=t/Math.pow(2,8),o[5]=t,o[6]=112|n>>>8,o[7]=n,o[8]=128|r>>>24,o[9]=r>>>16,o[10]=r>>>8,o[11]=r,o[12]=i>>>24,o[13]=i>>>16,o[14]=i>>>8,o[15]=i,new pg(o)}toString(){for(var t="",n=0;n<this.bytes.length;n++)t=t+_M.charAt(this.bytes[n]>>>4)+_M.charAt(15&this.bytes[n]),n!==3&&n!==5&&n!==7&&n!==9||(t+="-");if(t.length!==36)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new pg(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(var n=0;n<16;n++){var r=this.bytes[n]-t.bytes[n];if(r!==0)return Math.sign(r)}return 0}}class JZ{constructor(){De(this,"timestamp",0),De(this,"counter",0),De(this,"random",new eY)}generate(){var t=this.generateOrAbort();if(Fe(t)){this.timestamp=0;var n=this.generateOrAbort();if(Fe(n))throw new Error("Could not generate UUID after timestamp reset");return n}return t}generateOrAbort(){var t=Date.now();if(t>this.timestamp)this.timestamp=t,this.resetCounter();else{if(!(t+1e4>this.timestamp))return;this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter())}return pg.fromFieldsV7(this.timestamp,Math.trunc(this.counter/Math.pow(2,30)),this.counter&Math.pow(2,30)-1,this.random.nextUint32())}resetCounter(){this.counter=1024*this.random.nextUint32()+(1023&this.random.nextUint32())}}var bM,SM=e=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;t<e.length;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};le&&!Fe(le.crypto)&&crypto.getRandomValues&&(SM=e=>crypto.getRandomValues(e));class eY{constructor(){De(this,"buffer",new Uint32Array(8)),De(this,"cursor",1/0)}nextUint32(){return this.cursor>=this.buffer.length&&(SM(this.buffer),this.cursor=0),this.buffer[this.cursor++]}}var Va=()=>tY().toString(),tY=()=>(bM||(bM=new JZ)).generate(),nY="Thu, 01 Jan 1970 00:00:00 GMT",Lf="",rY=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function iY(e,t){if(t){var n=function(i){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:He;if(Lf)return Lf;if(!o||["localhost","127.0.0.1"].includes(i))return"";for(var a=i.split("."),u=Math.min(a.length,8),c="dmn_chk_"+Va(),d=new RegExp("(^|;)\\s*"+c+"=1");!Lf&&u--;){var p=a.slice(u).join("."),h=c+"=1;domain=."+p;o.cookie=h,d.test(o.cookie)&&(o.cookie=h+";expires="+nY,Lf=p)}return Lf}(e);if(!n){var r=(i=>{var o=i.match(rY);return o?o[0]:""})(e);r!==n&&tt.info("Warning: cookie subdomain discovery mismatch",r,n),n=r}return n?"; domain=."+n:""}return""}var Za,Vo={is_supported:()=>!!He,error:function(e){tt.error("cookieStore error: "+e)},get:function(e){if(He){try{for(var t=e+"=",n=He.cookie.split(";").filter(o=>o.length),r=0;r<n.length;r++){for(var i=n[r];i.charAt(0)==" ";)i=i.substring(1,i.length);if(i.indexOf(t)===0)return decodeURIComponent(i.substring(t.length,i.length))}}catch{}return null}},parse:function(e){var t;try{t=JSON.parse(Vo.get(e))||{}}catch{}return t},set:function(e,t,n,r,i){if(He)try{var o="",a="",u=iY(He.location.hostname,r);if(n){var c=new Date;c.setTime(c.getTime()+24*n*60*60*1e3),o="; expires="+c.toUTCString()}i&&(a="; secure");var d=e+"="+encodeURIComponent(JSON.stringify(t))+o+"; SameSite=Lax; path=/"+u+a;return d.length>3686.4&&tt.warn("cookieStore warning: large cookie, len="+d.length),He.cookie=d,d}catch{return}},remove:function(e,t){try{Vo.set(e,"",-1,t)}catch{return}}},Y1=null,Qn={is_supported:function(){if(!qa(Y1))return Y1;var e=!0;if(Fe(le))e=!1;else try{var t="__mplssupport__";Qn.set(t,"xyz"),Qn.get(t)!=='"xyz"'&&(e=!1),Qn.remove(t)}catch{e=!1}return e||tt.error("localStorage unsupported; falling back to cookie store"),Y1=e,e},error:function(e){tt.error("localStorage error: "+e)},get:function(e){try{return le==null?void 0:le.localStorage.getItem(e)}catch(t){Qn.error(t)}return null},parse:function(e){try{return JSON.parse(Qn.get(e))||{}}catch{}return null},set:function(e,t){try{le==null||le.localStorage.setItem(e,JSON.stringify(t))}catch(n){Qn.error(n)}},remove:function(e){try{le==null||le.localStorage.removeItem(e)}catch(t){Qn.error(t)}}},oY=["distinct_id",ig,Mf,lg,q1],gg=pe(pe({},Qn),{},{parse:function(e){try{var t={};try{t=Vo.parse(e)||{}}catch{}var n=Gn(t,JSON.parse(Qn.get(e)||"{}"));return Qn.set(e,n),n}catch{}return null},set:function(e,t,n,r,i,o){try{Qn.set(e,t,void 0,void 0,o);var a={};oY.forEach(u=>{t[u]&&(a[u]=t[u])}),Object.keys(a).length&&Vo.set(e,a,n,r,i,o)}catch(u){Qn.error(u)}},remove:function(e,t){try{le==null||le.localStorage.removeItem(e),Vo.remove(e,t)}catch(n){Qn.error(n)}}}),mg={},aY={is_supported:function(){return!0},error:function(e){tt.error("memoryStorage error: "+e)},get:function(e){return mg[e]||null},parse:function(e){return mg[e]||null},set:function(e,t){mg[e]=t},remove:function(e){delete mg[e]}},zs=null,hr={is_supported:function(){if(!qa(zs))return zs;if(zs=!0,Fe(le))zs=!1;else try{var e="__support__";hr.set(e,"xyz"),hr.get(e)!=='"xyz"'&&(zs=!1),hr.remove(e)}catch{zs=!1}return zs},error:function(e){tt.error("sessionStorage error: ",e)},get:function(e){try{return le==null?void 0:le.sessionStorage.getItem(e)}catch(t){hr.error(t)}return null},parse:function(e){try{return JSON.parse(hr.get(e))||null}catch{}return null},set:function(e,t){try{le==null||le.sessionStorage.setItem(e,JSON.stringify(t))}catch(n){hr.error(n)}},remove:function(e){try{le==null||le.sessionStorage.removeItem(e)}catch(t){hr.error(t)}}};(function(e){e[e.PENDING=-1]="PENDING",e[e.DENIED=0]="DENIED",e[e.GRANTED=1]="GRANTED"})(Za||(Za={}));class sY{constructor(t){this.instance=t}get config(){return this.instance.config}get consent(){return this.getDnt()?Za.DENIED:this.storedConsent}isOptedOut(){return this.consent===Za.DENIED||this.consent===Za.PENDING&&this.config.opt_out_capturing_by_default}isOptedIn(){return!this.isOptedOut()}optInOut(t){this.storage.set(this.storageKey,t?1:0,this.config.cookie_expiration,this.config.cross_subdomain_cookie,this.config.secure_cookie)}reset(){this.storage.remove(this.storageKey,this.config.cross_subdomain_cookie)}get storageKey(){var{token:t,opt_out_capturing_cookie_prefix:n}=this.instance.config;return(n||"__ph_opt_in_out_")+t}get storedConsent(){var t=this.storage.get(this.storageKey);return t==="1"?Za.GRANTED:t==="0"?Za.DENIED:Za.PENDING}get storage(){if(!this._storage){var t=this.config.opt_out_capturing_persistence_type;this._storage=t==="localStorage"?Qn:Vo;var n=t==="localStorage"?Vo:Qn;n.get(this.storageKey)&&(this._storage.get(this.storageKey)||this.optInOut(n.get(this.storageKey)==="1"),n.remove(this.storageKey,this.config.cross_subdomain_cookie))}return this._storage}getDnt(){return!!this.config.respect_dnt&&!!qT([ii==null?void 0:ii.doNotTrack,ii==null?void 0:ii.msDoNotTrack,pt.doNotTrack],t=>Rt([!0,1,"1","yes"],t))}}var vg=Ir("[Dead Clicks]"),lY=()=>!0,uY=e=>{var t,n=!((t=e.instance.persistence)===null||t===void 0||!t.get_property(ZT)),r=e.instance.config.capture_dead_clicks;return ja(r)?r:n};class wM{get lazyLoadedDeadClicksAutocapture(){return this._lazyLoadedDeadClicksAutocapture}constructor(t,n,r){this.instance=t,this.isEnabled=n,this.onCapture=r,this.startIfEnabled()}onRemoteConfig(t){this.instance.persistence&&this.instance.persistence.register({[ZT]:t==null?void 0:t.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.loadScript(()=>{this.start()})}loadScript(t){var n,r,i;(n=pt.__PosthogExtensions__)!==null&&n!==void 0&&n.initDeadClicksAutocapture&&t(),(r=pt.__PosthogExtensions__)===null||r===void 0||(i=r.loadExternalDependency)===null||i===void 0||i.call(r,this.instance,"dead-clicks-autocapture",o=>{o?vg.error("failed to load script",o):t()})}start(){var t;if(He){if(!this._lazyLoadedDeadClicksAutocapture&&(t=pt.__PosthogExtensions__)!==null&&t!==void 0&&t.initDeadClicksAutocapture){var n=In(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};n.__onCapture=this.onCapture,this._lazyLoadedDeadClicksAutocapture=pt.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this._lazyLoadedDeadClicksAutocapture.start(He),vg.info("starting...")}}else vg.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,vg.info("stopping..."))}}var W1=Ir("[ExceptionAutocapture]");class cY{constructor(t){var n;De(this,"startCapturing",()=>{var r;if(le&&this.isEnabled&&(r=pt.__PosthogExtensions__)!==null&&r!==void 0&&r.errorWrappingFunctions){var i=pt.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,o=pt.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,a=pt.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.unwrapOnError&&this.config.capture_unhandled_errors&&(this.unwrapOnError=i(this.captureException.bind(this))),!this.unwrapUnhandledRejection&&this.config.capture_unhandled_rejections&&(this.unwrapUnhandledRejection=o(this.captureException.bind(this))),!this.unwrapConsoleError&&this.config.capture_console_errors&&(this.unwrapConsoleError=a(this.captureException.bind(this)))}catch(u){W1.error("failed to start",u),this.stopCapturing()}}}),this.instance=t,this.remoteEnabled=!((n=this.instance.persistence)===null||n===void 0||!n.props[GT]),this.config=this.requiredConfig(),this.startIfEnabled()}requiredConfig(){var t=this.instance.config.capture_exceptions,n={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return In(t)?n=pe(pe({},n),t):(Fe(t)?this.remoteEnabled:t)&&(n=pe(pe({},n),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),n}get isEnabled(){return this.config.capture_console_errors||this.config.capture_unhandled_errors||this.config.capture_unhandled_rejections}startIfEnabled(){this.isEnabled&&(W1.info("enabled"),this.loadScript(this.startCapturing))}loadScript(t){var n,r,i;(n=pt.__PosthogExtensions__)!==null&&n!==void 0&&n.errorWrappingFunctions&&t(),(r=pt.__PosthogExtensions__)===null||r===void 0||(i=r.loadExternalDependency)===null||i===void 0||i.call(r,this.instance,"exception-autocapture",o=>{if(o)return W1.error("failed to load script",o);t()})}stopCapturing(){var t,n,r;(t=this.unwrapOnError)===null||t===void 0||t.call(this),this.unwrapOnError=void 0,(n=this.unwrapUnhandledRejection)===null||n===void 0||n.call(this),this.unwrapUnhandledRejection=void 0,(r=this.unwrapConsoleError)===null||r===void 0||r.call(this),this.unwrapConsoleError=void 0}onRemoteConfig(t){var n=t.autocaptureExceptions;this.remoteEnabled=!!n||!1,this.config=this.requiredConfig(),this.instance.persistence&&this.instance.persistence.register({[GT]:this.remoteEnabled}),this.startIfEnabled()}captureException(t){var n=this.instance.requestRouter.endpointFor("ui");t.$exception_personURL="".concat(n,"/project/").concat(this.instance.config.token,"/person/").concat(this.instance.get_distinct_id()),this.instance.exceptions.sendExceptionEvent(t)}}function xM(e){return!Fe(Event)&&CM(e,Event)}function CM(e,t){try{return e instanceof t}catch{return!1}}function yg(e,t){return Object.prototype.toString.call(e)==="[object ".concat(t,"]")}function K1(e){return yg(e,"DOMError")}var EM=/\(error: (.*)\)/,kM=50,du="?";function Q1(e,t,n,r){var i={platform:"web:javascript",filename:e,function:t==="<anonymous>"?du:t,in_app:!0};return Fe(n)||(i.lineno=n),Fe(r)||(i.colno=r),i}var fY=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,dY=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,hY=/\((\S*)(?::(\d+))(?::(\d+))\)/,pY=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,gY=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,mY=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=t.sort((i,o)=>i[0]-o[0]).map(i=>i[1]);return function(i){for(var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=[],u=i.split(`
136
+ `);var t="",n,r,i=0,o;for(n=r=0,i=e.length,o=0;o<i;o++){var a=e.charCodeAt(o),u=null;a<128?r++:a>127&&a<2048?u=String.fromCharCode(a>>6|192,a&63|128):u=String.fromCharCode(a>>12|224,a>>6&63|128,a&63|128),u!==null&&(r>n&&(t+=e.substring(n,r)),t+=u,n=r=o+1)}return r>n&&(t+=e.substring(n,e.length)),t},R.UUID=function(){try{return Ue.crypto.randomUUID()}catch{for(var e=new Array(36),t=0;t<36;t++)e[t]=Math.floor(Math.random()*16);return e[14]=4,e[19]=e[19]&=-5,e[19]=e[19]|=8,e[8]=e[13]=e[18]=e[23]="-",R.map(e,function(r){return r.toString(16)}).join("")}};var mO=["ahrefsbot","ahrefssiteaudit","amazonbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","facebookexternal","petalbot","pinterest","screaming frog","yahoo! slurp","yandex","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google"];R.isBlockedUA=function(e){var t;for(e=e.toLowerCase(),t=0;t<mO.length;t++)if(e.indexOf(mO[t])!==-1)return!0;return!1},R.HTTPBuildQuery=function(e,t){var n,r,i=[];return R.isUndefined(t)&&(t="&"),R.each(e,function(o,a){n=encodeURIComponent(o.toString()),r=encodeURIComponent(a),i[i.length]=r+"="+n}),i.join(t)},R.getQueryParam=function(e,t){t=t.replace(/[[]/g,"\\[").replace(/[\]]/g,"\\]");var n="[\\?&]"+t+"=([^&#]*)",r=new RegExp(n),i=r.exec(e);if(i===null||i&&typeof i[1]!="string"&&i[1].length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch{zt.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},R.cookie={get:function(e){for(var t=e+"=",n=Zt.cookie.split(";"),r=0;r<n.length;r++){for(var i=n[r];i.charAt(0)==" ";)i=i.substring(1,i.length);if(i.indexOf(t)===0)return decodeURIComponent(i.substring(t.length,i.length))}return null},parse:function(e){var t;try{t=R.JSONDecode(R.cookie.get(e))||{}}catch{}return t},set_seconds:function(e,t,n,r,i,o,a){var u="",c="",d="";if(a)u="; domain="+a;else if(r){var p=_O(Zt.location.hostname);u=p?"; domain=."+p:""}if(n){var h=new Date;h.setTime(h.getTime()+n*1e3),c="; expires="+h.toGMTString()}o&&(i=!0,d="; SameSite=None"),i&&(d+="; secure"),Zt.cookie=e+"="+encodeURIComponent(t)+c+"; path=/"+u+d},set:function(e,t,n,r,i,o,a){var u="",c="",d="";if(a)u="; domain="+a;else if(r){var p=_O(Zt.location.hostname);u=p?"; domain=."+p:""}if(n){var h=new Date;h.setTime(h.getTime()+n*24*60*60*1e3),c="; expires="+h.toGMTString()}o&&(i=!0,d="; SameSite=None"),i&&(d+="; secure");var m=e+"="+encodeURIComponent(t)+c+"; path=/"+u+d;return Zt.cookie=m,m},remove:function(e,t,n){R.cookie.set(e,"",-1,t,!1,!1,n)}};var vO=function(e){var t=!0;try{var n="__mplss_"+Bb(8),r="xyz";e.setItem(n,r),e.getItem(n)!==r&&(t=!1),e.removeItem(n)}catch{t=!1}return t},Nb=null,df=function(e,t){return Nb!==null&&!t?Nb:Nb=vO(e||Ue.localStorage)},Pb=null,cV=function(e,t){return Pb!==null&&!t?Pb:Pb=vO(e||Ue.sessionStorage)};function yO(e,t,n){var r=function(i){zt.error(t+" error: "+i)};return{is_supported:function(i){var o=n(e,i);return o||zt.error(t+" unsupported"),o},error:r,get:function(i){try{return e.getItem(i)}catch(o){r(o)}return null},parse:function(i){try{return R.JSONDecode(e.getItem(i))||{}}catch{}return null},set:function(i,o){try{e.setItem(i,o)}catch(a){r(a)}},remove:function(i){try{e.removeItem(i)}catch(o){r(o)}}}}R.localStorage=yO(Ue.localStorage,"localStorage",df),R.sessionStorage=yO(Ue.sessionStorage,"sessionStorage",cV),R.register_event=function(){var e=function(r,i,o,a,u){if(!r){zt.error("No valid element provided to register_event");return}if(r.addEventListener&&!a)r.addEventListener(i,o,!!u);else{var c="on"+i,d=r[c];r[c]=t(r,o,d)}};function t(r,i,o){var a=function(u){if(u=u||n(Ue.event),!!u){var c=!0,d,p;return R.isFunction(o)&&(d=o(u)),p=i.call(r,u),(d===!1||p===!1)&&(c=!1),c}};return a}function n(r){return r&&(r.preventDefault=n.preventDefault,r.stopPropagation=n.stopPropagation),r}return n.preventDefault=function(){this.returnValue=!1},n.stopPropagation=function(){this.cancelBubble=!0},e}();var fV=new RegExp('^(\\w*)\\[(\\w+)([=~\\|\\^\\$\\*]?)=?"?([^\\]"]*)"?\\]$');R.dom_query=function(){function e(i){return i.all?i.all:i.getElementsByTagName("*")}var t=/[\t\r\n]/g;function n(i,o){var a=" "+o+" ";return(" "+i.className+" ").replace(t," ").indexOf(a)>=0}function r(i){if(!Zt.getElementsByTagName)return[];var o=i.split(" "),a,u,c,d,p,h,m,v,_,x,S=[Zt];for(h=0;h<o.length;h++){if(a=o[h].replace(/^\s+/,"").replace(/\s+$/,""),a.indexOf("#")>-1){u=a.split("#"),c=u[0];var b=u[1],C=Zt.getElementById(b);if(!C||c&&C.nodeName.toLowerCase()!=c)return[];S=[C];continue}if(a.indexOf(".")>-1){u=a.split("."),c=u[0];var E=u[1];for(c||(c="*"),d=[],p=0,m=0;m<S.length;m++)for(c=="*"?_=e(S[m]):_=S[m].getElementsByTagName(c),v=0;v<_.length;v++)d[p++]=_[v];for(S=[],x=0,m=0;m<d.length;m++)d[m].className&&R.isString(d[m].className)&&n(d[m],E)&&(S[x++]=d[m]);continue}var I=a.match(fV);if(I){c=I[1];var O=I[2],T=I[3],$=I[4];for(c||(c="*"),d=[],p=0,m=0;m<S.length;m++)for(c=="*"?_=e(S[m]):_=S[m].getElementsByTagName(c),v=0;v<_.length;v++)d[p++]=_[v];S=[],x=0;var F;switch(T){case"=":F=function(q){return q.getAttribute(O)==$};break;case"~":F=function(q){return q.getAttribute(O).match(new RegExp("\\b"+$+"\\b"))};break;case"|":F=function(q){return q.getAttribute(O).match(new RegExp("^"+$+"-?"))};break;case"^":F=function(q){return q.getAttribute(O).indexOf($)===0};break;case"$":F=function(q){return q.getAttribute(O).lastIndexOf($)==q.getAttribute(O).length-$.length};break;case"*":F=function(q){return q.getAttribute(O).indexOf($)>-1};break;default:F=function(q){return q.getAttribute(O)}}for(S=[],x=0,m=0;m<d.length;m++)F(d[m])&&(S[x++]=d[m]);continue}for(c=a,d=[],p=0,m=0;m<S.length;m++)for(_=S[m].getElementsByTagName(c),v=0;v<_.length;v++)d[p++]=_[v];S=d}return S}return function(i){return R.isElement(i)?[i]:R.isObject(i)&&!R.isUndefined(i.length)?i:r.call(this,i)}}();var dV=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_source_platform","utm_campaign_id","utm_creative_format","utm_marketing_tactic"],hV=["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"];R.info={campaignParams:function(e){var t="",n={};return R.each(dV,function(r){t=R.getQueryParam(Zt.URL,r),t.length?n[r]=t:e!==void 0&&(n[r]=e)}),n},clickParams:function(){var e="",t={};return R.each(hV,function(n){e=R.getQueryParam(Zt.URL,n),e.length&&(t[n]=e)}),t},marketingParams:function(){return R.extend(R.info.campaignParams(),R.info.clickParams())},searchEngine:function(e){return e.search("https?://(.*)google.([^/?]*)")===0?"google":e.search("https?://(.*)bing.com")===0?"bing":e.search("https?://(.*)yahoo.com")===0?"yahoo":e.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null},searchInfo:function(e){var t=R.info.searchEngine(e),n=t!="yahoo"?"q":"p",r={};if(t!==null){r.$search_engine=t;var i=R.getQueryParam(e,n);i.length&&(r.mp_keyword=i)}return r},browser:function(e,t,n){return t=t||"",n||R.includes(e," OPR/")?R.includes(e,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":R.includes(e,"IEMobile")||R.includes(e,"WPDesktop")?"Internet Explorer Mobile":R.includes(e,"SamsungBrowser/")?"Samsung Internet":R.includes(e,"Edge")||R.includes(e,"Edg/")?"Microsoft Edge":R.includes(e,"FBIOS")?"Facebook Mobile":R.includes(e,"Chrome")?"Chrome":R.includes(e,"CriOS")?"Chrome iOS":R.includes(e,"UCWEB")||R.includes(e,"UCBrowser")?"UC Browser":R.includes(e,"FxiOS")?"Firefox iOS":R.includes(t,"Apple")?R.includes(e,"Mobile")?"Mobile Safari":"Safari":R.includes(e,"Android")?"Android Mobile":R.includes(e,"Konqueror")?"Konqueror":R.includes(e,"Firefox")?"Firefox":R.includes(e,"MSIE")||R.includes(e,"Trident/")?"Internet Explorer":R.includes(e,"Gecko")?"Mozilla":""},browserVersion:function(e,t,n){var r=R.info.browser(e,t,n),i={"Internet Explorer Mobile":/rv:(\d+(\.\d+)?)/,"Microsoft Edge":/Edge?\/(\d+(\.\d+)?)/,Chrome:/Chrome\/(\d+(\.\d+)?)/,"Chrome iOS":/CriOS\/(\d+(\.\d+)?)/,"UC Browser":/(UCBrowser|UCWEB)\/(\d+(\.\d+)?)/,Safari:/Version\/(\d+(\.\d+)?)/,"Mobile Safari":/Version\/(\d+(\.\d+)?)/,Opera:/(Opera|OPR)\/(\d+(\.\d+)?)/,Firefox:/Firefox\/(\d+(\.\d+)?)/,"Firefox iOS":/FxiOS\/(\d+(\.\d+)?)/,Konqueror:/Konqueror:(\d+(\.\d+)?)/,BlackBerry:/BlackBerry (\d+(\.\d+)?)/,"Android Mobile":/android\s(\d+(\.\d+)?)/,"Samsung Internet":/SamsungBrowser\/(\d+(\.\d+)?)/,"Internet Explorer":/(rv:|MSIE )(\d+(\.\d+)?)/,Mozilla:/rv:(\d+(\.\d+)?)/},o=i[r];if(o===void 0)return null;var a=e.match(o);return a?parseFloat(a[a.length-2]):null},os:function(){var e=$o;return/Windows/i.test(e)?/Phone/.test(e)||/WPDesktop/.test(e)?"Windows Phone":"Windows":/(iPhone|iPad|iPod)/.test(e)?"iOS":/Android/.test(e)?"Android":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":/Mac/i.test(e)?"Mac OS X":/Linux/.test(e)?"Linux":/CrOS/.test(e)?"Chrome OS":""},device:function(e){return/Windows Phone/i.test(e)||/WPDesktop/.test(e)?"Windows Phone":/iPad/.test(e)?"iPad":/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":/Android/.test(e)?"Android":""},referringDomain:function(e){var t=e.split("/");return t.length>=3?t[2]:""},currentUrl:function(){return Ue.location.href},properties:function(e){return typeof e!="object"&&(e={}),R.extend(R.strip_empty_properties({$os:R.info.os(),$browser:R.info.browser($o,Ta.vendor,Np),$referrer:Zt.referrer,$referring_domain:R.info.referringDomain(Zt.referrer),$device:R.info.device($o)}),{$current_url:R.info.currentUrl(),$browser_version:R.info.browserVersion($o,Ta.vendor,Np),$screen_height:dO.height,$screen_width:dO.width,mp_lib:"web",$lib_version:zi.LIB_VERSION,$insert_id:Bb(),time:R.timestamp()/1e3},R.strip_empty_properties(e))},people_properties:function(){return R.extend(R.strip_empty_properties({$os:R.info.os(),$browser:R.info.browser($o,Ta.vendor,Np)}),{$browser_version:R.info.browserVersion($o,Ta.vendor,Np)})},mpPageViewProperties:function(){return R.strip_empty_properties({current_page_title:Zt.title,current_domain:Ue.location.hostname,current_url_path:Ue.location.pathname,current_url_protocol:Ue.location.protocol,current_url_search:Ue.location.search})}};var pV=function(e,t){var n=null,r=[];return function(i){var o=this;return r.push(i),n||(n=new jt(function(a){setTimeout(function(){var u=e.apply(o,[r]);n=null,r=[],a(u)},t)})),n}},Bb=function(e){var t=Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10);return e?t.substring(0,e):t},gV=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,mV=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,_O=function(e){var t=mV,n=e.split("."),r=n[n.length-1];(r.length>4||r==="com"||r==="org")&&(t=gV);var i=e.match(t);return i?i[0]:""},vV=function(){var e=Ue.navigator.onLine;return R.isUndefined(e)||e},Ma=function(){},Vl=null,Pp=null;typeof JSON<"u"&&(Vl=JSON.stringify,Pp=JSON.parse),Vl=Vl||R.JSONEncode,Pp=Pp||R.JSONDecode,R.info=R.info,R.info.browser=R.info.browser,R.info.browserVersion=R.info.browserVersion,R.info.device=R.info.device,R.info.properties=R.info.properties,R.isBlockedUA=R.isBlockedUA,R.isEmptyObject=R.isEmptyObject,R.isObject=R.isObject,R.JSONDecode=R.JSONDecode,R.JSONEncode=R.JSONEncode,R.toArray=R.toArray,R.NPO=Ra;var yV="mixpanelBrowserDb",bO="mixpanelRecordingEvents",Fb="mixpanelRecordingRegistry",_V=1,bV=[bO,Fb],ro=function(e){this.dbPromise=null,this.storeName=e};ro.prototype._openDb=function(){return new jt(function(e,t){var n=Ue.indexedDB.open(yV,_V);n.onerror=function(){t(n.error)},n.onsuccess=function(){e(n.result)},n.onupgradeneeded=function(r){var i=r.target.result;bV.forEach(function(o){i.createObjectStore(o)})}})},ro.prototype.init=function(){return Ue.indexedDB?(this.dbPromise||(this.dbPromise=this._openDb()),this.dbPromise.then(function(e){return e instanceof Ue.IDBDatabase?jt.resolve():jt.reject(e)})):jt.reject("indexedDB is not supported in this browser")},ro.prototype.makeTransaction=function(e,t){var n=this.storeName,r=function(i){return new jt(function(o,a){var u=i.transaction(n,e);u.oncomplete=function(){o(u)},u.onabort=u.onerror=function(){a(u.error)},t(u.objectStore(n))})};return this.dbPromise.then(r).catch((function(i){return i&&i.name==="InvalidStateError"?(this.dbPromise=this._openDb(),this.dbPromise.then(r)):jt.reject(i)}).bind(this))},ro.prototype.setItem=function(e,t){return this.makeTransaction("readwrite",function(n){n.put(t,e)})},ro.prototype.getItem=function(e){var t;return this.makeTransaction("readonly",function(n){t=n.get(e)}).then(function(){return t.result})},ro.prototype.removeItem=function(e){return this.makeTransaction("readwrite",function(t){t.delete(e)})},ro.prototype.getAll=function(){var e;return this.makeTransaction("readonly",function(t){e=t.getAll()}).then(function(){return e.result})};var SV="__mp_opt_in_out_";function wV(e,t){xO(!0,e,t)}function xV(e,t){xO(!1,e,t)}function CV(e,t){return wO(e,t)==="1"}function SO(e,t){if(kV(t))return zt.warn('This browser has "Do Not Track" enabled. This will prevent the Mixpanel SDK from sending any data. To ignore the "Do Not Track" browser setting, initialize the Mixpanel instance with the config "ignore_dnt: true"'),!0;var n=wO(e,t)==="0";return n&&zt.warn("You are opted out of Mixpanel tracking. This will prevent the Mixpanel SDK from sending any data."),n}function Da(e){return qb(e,function(t){return this.get_config(t)})}function La(e){return qb(e,function(t){return this._get_config(t)})}function Zl(e){return qb(e,function(t){return this._get_config(t)})}function EV(e,t){t=t||{},Ub(t).remove(zb(e,t),!!t.crossSubdomainCookie,t.cookieDomain)}function Ub(e){return e=e||{},e.persistenceType==="localStorage"?R.localStorage:R.cookie}function zb(e,t){return t=t||{},(t.persistencePrefix||SV)+e}function wO(e,t){return Ub(t).get(zb(e,t))}function kV(e){if(e&&e.ignoreDnt)return!1;var t=e&&e.window||Ue,n=t.navigator||{},r=!1;return R.each([n.doNotTrack,n.msDoNotTrack,t.doNotTrack],function(i){R.includes([!0,1,"1","yes"],i)&&(r=!0)}),r}function xO(e,t,n){if(!R.isString(t)||!t.length){zt.error("gdpr."+(e?"optIn":"optOut")+" called with an invalid token");return}n=n||{},Ub(n).set(zb(t,n),e?1:0,R.isNumber(n.cookieExpiration)?n.cookieExpiration:null,!!n.crossSubdomainCookie,!!n.secureCookie,!!n.crossSiteCookie,n.cookieDomain),n.track&&e&&n.track(n.trackEventName||"$opt_in",n.trackProperties,{send_immediately:!0})}function qb(e,t){return function(){var n=!1;try{var r=t.call(this,"token"),i=t.call(this,"ignore_dnt"),o=t.call(this,"opt_out_tracking_persistence_type"),a=t.call(this,"opt_out_tracking_cookie_prefix"),u=t.call(this,"window");r&&(n=SO(r,{ignoreDnt:i,persistenceType:o,persistencePrefix:a,window:u}))}catch(d){zt.error("Unexpected error when checking tracking opt-out status: "+d)}if(!n)return e.apply(this,arguments);var c=arguments[arguments.length-1];typeof c=="function"&&c(0)}}var AV=Gl("lock"),CO=function(e,t){t=t||{},this.storageKey=e,this.storage=t.storage||Ue.localStorage,this.pollIntervalMS=t.pollIntervalMS||100,this.timeoutMS=t.timeoutMS||2e3,this.promiseImpl=t.promiseImpl||jt};CO.prototype.withLock=function(e,t){var n=this.promiseImpl;return new n(R.bind(function(r,i){var o=t||new Date().getTime()+"|"+Math.random(),a=new Date().getTime(),u=this.storageKey,c=this.pollIntervalMS,d=this.timeoutMS,p=this.storage,h=u+":X",m=u+":Y",v=u+":Z",_=function(E){if(new Date().getTime()-a>d){AV.error("Timeout waiting for mutex on "+u+"; clearing lock. ["+o+"]"),p.removeItem(v),p.removeItem(m),b();return}setTimeout(function(){try{E()}catch(I){i(I)}},c*(Math.random()+.1))},x=function(E,I){E()?I():_(function(){x(E,I)})},S=function(){var E=p.getItem(m);return E&&E!==o?!1:(p.setItem(m,o),p.getItem(m)===o?!0:(df(p,!0)||i(new Error("localStorage support dropped while acquiring lock")),!1))},b=function(){p.setItem(h,o),x(S,function(){if(p.getItem(h)===o){C();return}_(function(){if(p.getItem(m)!==o){b();return}x(function(){return!p.getItem(v)},C)})})},C=function(){p.setItem(v,"1");var E=function(){p.removeItem(v),p.getItem(m)===o&&p.removeItem(m),p.getItem(h)===o&&p.removeItem(h)};e().then(function(I){E(),r(I)}).catch(function(I){E(),i(I)})};try{if(df(p,!0))b();else throw new Error("localStorage support check failed")}catch(E){i(E)}},this))};var hf=function(e){this.storage=e||Ue.localStorage};hf.prototype.init=function(){return jt.resolve()},hf.prototype.setItem=function(e,t){return new jt(R.bind(function(n,r){try{this.storage.setItem(e,Vl(t))}catch(i){r(i)}n()},this))},hf.prototype.getItem=function(e){return new jt(R.bind(function(t,n){var r;try{r=Pp(this.storage.getItem(e))}catch(i){n(i)}t(r)},this))},hf.prototype.removeItem=function(e){return new jt(R.bind(function(t,n){try{this.storage.removeItem(e)}catch(r){n(r)}t()},this))};var EO=Gl("batch"),io=function(e,t){t=t||{},this.storageKey=e,this.usePersistence=t.usePersistence,this.usePersistence&&(this.queueStorage=t.queueStorage||new hf,this.lock=new CO(e,{storage:t.sharedLockStorage||Ue.localStorage,timeoutMS:t.sharedLockTimeoutMS})),this.reportError=t.errorReporter||R.bind(EO.error,EO),this.pid=t.pid||null,this.memQueue=[],this.initialized=!1,t.enqueueThrottleMs?this.enqueuePersisted=pV(R.bind(this._enqueuePersisted,this),t.enqueueThrottleMs):this.enqueuePersisted=R.bind(function(n){return this._enqueuePersisted([n])},this)};io.prototype.ensureInit=function(){return this.initialized?jt.resolve():this.queueStorage.init().then(R.bind(function(){this.initialized=!0},this)).catch(R.bind(function(e){this.reportError("Error initializing queue persistence. Disabling persistence",e),this.initialized=!0,this.usePersistence=!1},this))},io.prototype.enqueue=function(e,t){var n={id:Bb(),flushAfter:new Date().getTime()+t*2,payload:e};return this.usePersistence?this.enqueuePersisted(n):(this.memQueue.push(n),jt.resolve(!0))},io.prototype._enqueuePersisted=function(e){var t=R.bind(function(){return this.ensureInit().then(R.bind(function(){return this.readFromStorage()},this)).then(R.bind(function(n){return this.saveToStorage(n.concat(e))},this)).then(R.bind(function(n){return n&&(this.memQueue=this.memQueue.concat(e)),n},this)).catch(R.bind(function(n){return this.reportError("Error enqueueing items",n,e),!1},this))},this);return this.lock.withLock(t,this.pid).catch(R.bind(function(n){return this.reportError("Error acquiring storage lock",n),!1},this))},io.prototype.fillBatch=function(e){var t=this.memQueue.slice(0,e);return this.usePersistence&&t.length<e?this.ensureInit().then(R.bind(function(){return this.readFromStorage()},this)).then(R.bind(function(n){if(n.length){var r={};R.each(t,function(a){r[a.id]=!0});for(var i=0;i<n.length;i++){var o=n[i];if(new Date().getTime()>o.flushAfter&&!r[o.id]&&(o.orphaned=!0,t.push(o),t.length>=e))break}}return t},this)):jt.resolve(t)};var kO=function(e,t){var n=[];return R.each(e,function(r){r.id&&!t[r.id]&&n.push(r)}),n};io.prototype.removeItemsByID=function(e){var t={};if(R.each(e,function(r){t[r]=!0}),this.memQueue=kO(this.memQueue,t),this.usePersistence){var n=R.bind(function(){return this.ensureInit().then(R.bind(function(){return this.readFromStorage()},this)).then(R.bind(function(r){return r=kO(r,t),this.saveToStorage(r)},this)).then(R.bind(function(){return this.readFromStorage()},this)).then(R.bind(function(r){for(var i=0;i<r.length;i++){var o=r[i];if(o.id&&t[o.id])throw new Error("Item not removed from storage")}return!0},this)).catch(R.bind(function(r){return this.reportError("Error removing items",r,e),!1},this))},this);return this.lock.withLock(n,this.pid).catch(R.bind(function(r){return this.reportError("Error acquiring storage lock",r),df(this.lock.storage,!0)?!1:n().then(R.bind(function(i){return i||this.queueStorage.removeItem(this.storageKey).then(function(){return i})},this)).catch(R.bind(function(i){return this.reportError("Error clearing queue",i),!1},this))},this))}else return jt.resolve(!0)};var AO=function(e,t){var n=[];return R.each(e,function(r){var i=r.id;if(i in t){var o=t[i];o!==null&&(r.payload=o,n.push(r))}else n.push(r)}),n};io.prototype.updatePayloads=function(e){return this.memQueue=AO(this.memQueue,e),this.usePersistence?this.lock.withLock(R.bind(function(){return this.ensureInit().then(R.bind(function(){return this.readFromStorage()},this)).then(R.bind(function(n){return n=AO(n,e),this.saveToStorage(n)},this)).catch(R.bind(function(n){return this.reportError("Error updating items",e,n),!1},this))},this),this.pid).catch(R.bind(function(t){return this.reportError("Error acquiring storage lock",t),!1},this)):jt.resolve(!0)},io.prototype.readFromStorage=function(){return this.ensureInit().then(R.bind(function(){return this.queueStorage.getItem(this.storageKey)},this)).then(R.bind(function(e){return e&&(R.isArray(e)||(this.reportError("Invalid storage entry:",e),e=null)),e||[]},this)).catch(R.bind(function(e){return this.reportError("Error retrieving queue",e),[]},this))},io.prototype.saveToStorage=function(e){return this.ensureInit().then(R.bind(function(){return this.queueStorage.setItem(this.storageKey,e)},this)).then(function(){return!0}).catch(R.bind(function(t){return this.reportError("Error saving queue",t),!1},this))},io.prototype.clear=function(){return this.memQueue=[],this.usePersistence?this.ensureInit().then(R.bind(function(){return this.queueStorage.removeItem(this.storageKey)},this)):jt.resolve()};var IV=10*60*1e3,pf=Gl("batch"),vi=function(e,t){this.errorReporter=t.errorReporter,this.queue=new io(e,{errorReporter:R.bind(this.reportError,this),queueStorage:t.queueStorage,sharedLockStorage:t.sharedLockStorage,sharedLockTimeoutMS:t.sharedLockTimeoutMS,usePersistence:t.usePersistence,enqueueThrottleMs:t.enqueueThrottleMs}),this.libConfig=t.libConfig,this.sendRequest=t.sendRequestFunc,this.beforeSendHook=t.beforeSendHook,this.stopAllBatching=t.stopAllBatchingFunc,this.batchSize=this.libConfig.batch_size,this.flushInterval=this.libConfig.batch_flush_interval_ms,this.stopped=!this.libConfig.batch_autostart,this.consecutiveRemovalFailures=0,this.itemIdsSentSuccessfully={},this.flushOnlyOnInterval=t.flushOnlyOnInterval||!1,this._flushPromise=null};vi.prototype.enqueue=function(e){return this.queue.enqueue(e,this.flushInterval)},vi.prototype.start=function(){return this.stopped=!1,this.consecutiveRemovalFailures=0,this.flush()},vi.prototype.stop=function(){this.stopped=!0,this.timeoutID&&(clearTimeout(this.timeoutID),this.timeoutID=null)},vi.prototype.clear=function(){return this.queue.clear()},vi.prototype.resetBatchSize=function(){this.batchSize=this.libConfig.batch_size},vi.prototype.resetFlush=function(){this.scheduleFlush(this.libConfig.batch_flush_interval_ms)},vi.prototype.scheduleFlush=function(e){this.flushInterval=e,this.stopped||(this.timeoutID=setTimeout(R.bind(function(){this.stopped||(this._flushPromise=this.flush())},this),this.flushInterval))},vi.prototype.sendRequestPromise=function(e,t){return new jt(R.bind(function(n){this.sendRequest(e,t,n)},this))},vi.prototype.flush=function(e){if(this.requestInProgress)return pf.log("Flush: Request already in progress"),jt.resolve();this.requestInProgress=!0,e=e||{};var t=this.libConfig.batch_request_timeout_ms,n=new Date().getTime(),r=this.batchSize;return this.queue.fillBatch(r).then(R.bind(function(i){var o=i.length===r,a=[],u={};if(R.each(i,function(h){var m=h.payload;if(this.beforeSendHook&&!h.orphaned&&(m=this.beforeSendHook(m)),m){m.event&&m.properties&&(m.properties=R.extend({},m.properties,{mp_sent_by_lib_version:zi.LIB_VERSION}));var v=!0,_=h.id;_?(this.itemIdsSentSuccessfully[_]||0)>5&&(this.reportError("[dupe] item ID sent too many times, not sending",{item:h,batchSize:i.length,timesSent:this.itemIdsSentSuccessfully[_]}),v=!1):this.reportError("[dupe] found item with no ID",{item:h}),v&&a.push(m)}u[h.id]=m},this),a.length<1)return this.requestInProgress=!1,this.resetFlush(),jt.resolve();var c=R.bind(function(){return this.queue.removeItemsByID(R.map(i,function(h){return h.id})).then(R.bind(function(h){return R.each(i,R.bind(function(m){var v=m.id;v?(this.itemIdsSentSuccessfully[v]=this.itemIdsSentSuccessfully[v]||0,this.itemIdsSentSuccessfully[v]++,this.itemIdsSentSuccessfully[v]>5&&this.reportError("[dupe] item ID sent too many times",{item:m,batchSize:i.length,timesSent:this.itemIdsSentSuccessfully[v]})):this.reportError("[dupe] found item with no ID while removing",{item:m})},this)),h?(this.consecutiveRemovalFailures=0,this.flushOnlyOnInterval&&!o?(this.resetFlush(),jt.resolve()):this.flush()):(++this.consecutiveRemovalFailures>5?(this.reportError("Too many queue failures; disabling batching system."),this.stopAllBatching()):this.resetFlush(),jt.resolve())},this))},this),d=R.bind(function(h){this.requestInProgress=!1;try{if(e.unloading)return this.queue.updatePayloads(u);if(R.isObject(h)&&h.error==="timeout"&&new Date().getTime()-n>=t)return this.reportError("Network timeout; retrying"),this.flush();if(R.isObject(h)&&(h.httpStatusCode>=500||h.httpStatusCode===429||h.httpStatusCode<=0&&!vV()||h.error==="timeout")){var m=this.flushInterval*2;return h.retryAfter&&(m=parseInt(h.retryAfter,10)*1e3||m),m=Math.min(IV,m),this.reportError("Error; retry in "+m+" ms"),this.scheduleFlush(m),jt.resolve()}else if(R.isObject(h)&&h.httpStatusCode===413)if(i.length>1){var v=Math.max(1,Math.floor(r/2));return this.batchSize=Math.min(this.batchSize,v,i.length-1),this.reportError("413 response; reducing batch size to "+this.batchSize),this.resetFlush(),jt.resolve()}else return this.reportError("Single-event request too large; dropping",i),this.resetBatchSize(),c();else return c()}catch(_){this.reportError("Error handling API response",_),this.resetFlush()}},this),p={method:"POST",verbose:!0,ignore_json_errors:!0,timeout_ms:t};return e.unloading&&(p.transport="sendBeacon"),pf.log("MIXPANEL REQUEST:",a),this.sendRequestPromise(a,p).then(d)},this)).catch(R.bind(function(i){this.reportError("Error flushing request queue",i),this.resetFlush()},this))},vi.prototype.reportError=function(e,t){if(pf.error.apply(pf.error,arguments),this.errorReporter)try{t instanceof Error||(t=new Error(e)),this.errorReporter(e,t)}catch(n){pf.error(n)}};var jb=function(e){var t=Date.now();return!e||t>e.maxExpires||t>e.idleExpires},RV=250,Yl=Gl("recorder"),IO=Ue.CompressionStream,OV={batch_size:1e3,batch_flush_interval_ms:10*1e3,batch_request_timeout_ms:90*1e3,batch_autostart:!0},TV=new Set([dt.MouseMove,dt.MouseInteraction,dt.Scroll,dt.ViewportResize,dt.Input,dt.TouchMove,dt.MediaInteraction,dt.Drag,dt.Selection]);function MV(e){return e.type===Lt.IncrementalSnapshot&&TV.has(e.data.source)}var Er=function(e){this._mixpanel=e.mixpanelInstance,this._onIdleTimeout=e.onIdleTimeout||Ma,this._onMaxLengthReached=e.onMaxLengthReached||Ma,this._onBatchSent=e.onBatchSent||Ma,this._rrwebRecord=e.rrwebRecord||null,this._stopRecording=null,this.replayId=e.replayId,this.batchStartUrl=e.batchStartUrl||null,this.replayStartUrl=e.replayStartUrl||null,this.idleExpires=e.idleExpires||null,this.maxExpires=e.maxExpires||null,this.replayStartTime=e.replayStartTime||null,this.seqNo=e.seqNo||0,this.idleTimeoutId=null,this.maxTimeoutId=null,this.recordMaxMs=cf,this.recordMinMs=0;var t=df(e.sharedLockStorage,!0);this.batcherKey="__mprec_"+this.getConfig("name")+"_"+this.getConfig("token")+"_"+this.replayId,this.queueStorage=new ro(bO),this.batcher=new vi(this.batcherKey,{errorReporter:this.reportError.bind(this),flushOnlyOnInterval:!0,libConfig:OV,sendRequestFunc:this.flushEventsWithOptOut.bind(this),queueStorage:this.queueStorage,sharedLockStorage:e.sharedLockStorage,usePersistence:t,stopAllBatchingFunc:this.stopRecording.bind(this),enqueueThrottleMs:RV,sharedLockTimeoutMS:10*1e3})};Er.prototype.unloadPersistedData=function(){return this.batcher.stop(),this.batcher.flush().then((function(){return this.queueStorage.removeItem(this.batcherKey)}).bind(this))},Er.prototype.getConfig=function(e){return this._mixpanel.get_config(e)},Er.prototype.get_config=function(e){return this.getConfig(e)},Er.prototype.startRecording=function(e){if(this._rrwebRecord===null){this.reportError("rrweb record function not provided. ");return}if(this._stopRecording!==null){Yl.log("Recording already in progress, skipping startRecording.");return}this.recordMaxMs=this.getConfig("record_max_ms"),this.recordMaxMs>cf&&(this.recordMaxMs=cf,Yl.critical("record_max_ms cannot be greater than "+cf+"ms. Capping value.")),this.maxExpires||(this.maxExpires=new Date().getTime()+this.recordMaxMs),this.recordMinMs=this.getConfig("record_min_ms"),this.recordMinMs>Tb&&(this.recordMinMs=Tb,Yl.critical("record_min_ms cannot be greater than "+Tb+"ms. Capping value.")),this.replayStartTime||(this.replayStartTime=new Date().getTime(),this.batchStartUrl=R.info.currentUrl(),this.replayStartUrl=R.info.currentUrl()),e||this.recordMinMs>0?this.batcher.stop():this.batcher.start();var t=(function(){clearTimeout(this.idleTimeoutId);var i=this.getConfig("record_idle_timeout_ms");this.idleTimeoutId=setTimeout(this._onIdleTimeout,i),this.idleExpires=new Date().getTime()+i}).bind(this);t();var n=this.getConfig("record_block_selector");(n===""||n===null)&&(n=void 0);try{this._stopRecording=this._rrwebRecord({emit:(function(i){if(this.idleExpires&&this.idleExpires<i.timestamp){this._onIdleTimeout();return}MV(i)&&(this.batcher.stopped&&new Date().getTime()-this.replayStartTime>=this.recordMinMs&&this.batcher.start(),t()),this.__enqueuePromise=this.batcher.enqueue(i)}).bind(this),blockClass:this.getConfig("record_block_class"),blockSelector:n,collectFonts:this.getConfig("record_collect_fonts"),dataURLOptions:{type:"image/webp",quality:.6},maskAllInputs:!0,maskTextClass:this.getConfig("record_mask_text_class"),maskTextSelector:this.getConfig("record_mask_text_selector"),recordCanvas:this.getConfig("record_canvas"),sampling:{canvas:15}})}catch(i){this.reportError("Unexpected error when starting rrweb recording.",i)}if(typeof this._stopRecording!="function"){this.reportError("rrweb failed to start, skipping this recording."),this._stopRecording=null,this.stopRecording();return}var r=this.maxExpires-new Date().getTime();this.maxTimeoutId=setTimeout(this._onMaxLengthReached.bind(this),r)},Er.prototype.stopRecording=function(e){if(!this.isRrwebStopped()){try{this._stopRecording()}catch(n){this.reportError("Error with rrweb stopRecording",n)}this._stopRecording=null}var t;return this.batcher.stopped?t=this.batcher.clear():e||(t=this.batcher.flush()),this.batcher.stop(),clearTimeout(this.idleTimeoutId),clearTimeout(this.maxTimeoutId),t},Er.prototype.isRrwebStopped=function(){return this._stopRecording===null},Er.prototype.flushEventsWithOptOut=function(e,t,n){var r=(function(i){i===0&&(this.stopRecording(),n({error:"Tracking has been opted out, stopping recording."}))}).bind(this);this._flushEvents(e,t,n,r)},Er.prototype.serialize=function(){var e;try{e=this._mixpanel.get_tab_id()}catch(t){this.reportError("Error getting tab ID for serialization ",t),e=null}return{replayId:this.replayId,seqNo:this.seqNo,replayStartTime:this.replayStartTime,batchStartUrl:this.batchStartUrl,replayStartUrl:this.replayStartUrl,idleExpires:this.idleExpires,maxExpires:this.maxExpires,tabId:e}},Er.deserialize=function(e,t){var n=new Er(R.extend({},t,{replayId:e.replayId,batchStartUrl:e.batchStartUrl,replayStartUrl:e.replayStartUrl,idleExpires:e.idleExpires,maxExpires:e.maxExpires,replayStartTime:e.replayStartTime,seqNo:e.seqNo,sharedLockStorage:t.sharedLockStorage}));return n},Er.prototype._sendRequest=function(e,t,n,r){var i=(function(o,a){o.status===200&&this.replayId===e&&(this.seqNo++,this.batchStartUrl=R.info.currentUrl()),this._onBatchSent(),r({status:0,httpStatusCode:o.status,responseBody:a,retryAfter:o.headers.get("Retry-After")})}).bind(this);Ue.fetch(this.getConfig("api_host")+"/"+this.getConfig("api_routes").record+"?"+new URLSearchParams(t),{method:"POST",headers:{Authorization:"Basic "+btoa(this.getConfig("token")+":"),"Content-Type":"application/octet-stream"},body:n}).then(function(o){o.json().then(function(a){i(o,a)}).catch(function(a){r({error:a})})}).catch(function(o){r({error:o,httpStatusCode:0})})},Er.prototype._flushEvents=Da(function(e,t,n){var r=e.length;if(r>0){for(var i=this.replayId,o=1/0,a=-1/0,u=!1,c=0;c<r;c++)o=Math.min(o,e[c].timestamp),a=Math.max(a,e[c].timestamp),e[c].type===Lt.FullSnapshot&&(u=!0);if(this.seqNo===0){if(!u){n({error:"First batch does not contain a full snapshot. Aborting recording."}),this.stopRecording(!0);return}this.replayStartTime=o}else this.replayStartTime||(this.reportError("Replay start time not set but seqNo is not 0. Using current batch start time as a fallback."),this.replayStartTime=o);var d=a-this.replayStartTime,p={$current_url:this.batchStartUrl,$lib_version:zi.LIB_VERSION,batch_start_time:o/1e3,distinct_id:String(this._mixpanel.get_distinct_id()),mp_lib:"web",replay_id:i,replay_length_ms:d,replay_start_time:this.replayStartTime/1e3,replay_start_url:this.replayStartUrl,seq:this.seqNo},h=JSON.stringify(e),m=this._mixpanel.get_property("$device_id");m&&(p.$device_id=m);var v=this._mixpanel.get_property("$user_id");if(v&&(p.$user_id=v),IO){var _=new Blob([h],{type:"application/json"}).stream(),x=_.pipeThrough(new IO("gzip"));new Response(x).blob().then((function(S){p.format="gzip",this._sendRequest(i,p,S,n)}).bind(this))}else p.format="body",this._sendRequest(i,p,h,n)}}),Er.prototype.reportError=function(e,t){Yl.error.apply(Yl.error,arguments);try{!t&&!(e instanceof Error)&&(e=new Error(e)),this.getConfig("error_reporter")(e,t)}catch(n){Yl.error(n)}};var Wl=function(e){this.idb=new ro(Fb),this.errorReporter=e.errorReporter,this.mixpanelInstance=e.mixpanelInstance,this.sharedLockStorage=e.sharedLockStorage};Wl.prototype.handleError=function(e){this.errorReporter("IndexedDB error: ",e)},Wl.prototype.setActiveRecording=function(e){var t=e.tabId;return t?this.idb.init().then((function(){return this.idb.setItem(t,e)}).bind(this)).catch(this.handleError.bind(this)):(console.warn("No tab ID is set, cannot persist recording metadata."),jt.resolve())},Wl.prototype.getActiveRecording=function(){return this.idb.init().then((function(){return this.idb.getItem(this.mixpanelInstance.get_tab_id())}).bind(this)).then((function(e){return jb(e)?null:e}).bind(this)).catch(this.handleError.bind(this))},Wl.prototype.clearActiveRecording=function(){return this.getActiveRecording().then((function(e){if(e)return e.maxExpires=0,this.setActiveRecording(e)}).bind(this)).catch(this.handleError.bind(this))},Wl.prototype.flushInactiveRecordings=function(){return this.idb.init().then((function(){return this.idb.getAll()}).bind(this)).then((function(e){var t=e.filter(function(n){return jb(n)}).map((function(n){var r=Er.deserialize(n,{mixpanelInstance:this.mixpanelInstance,sharedLockStorage:this.sharedLockStorage});return r.unloadPersistedData().then((function(){return this.idb.removeItem(n.tabId)}).bind(this)).catch(this.handleError.bind(this))}).bind(this));return jt.all(t)}).bind(this)).catch(this.handleError.bind(this))};var gf=Gl("recorder"),No=function(e,t,n){this.mixpanelInstance=e,this.rrwebRecord=t||Aa,this.sharedLockStorage=n,this.recordingRegistry=new Wl({mixpanelInstance:this.mixpanelInstance,errorReporter:gf.error,sharedLockStorage:n}),this._flushInactivePromise=this.recordingRegistry.flushInactiveRecordings(),this.activeRecording=null};No.prototype.startRecording=function(e){if(e=e||{},this.activeRecording&&!this.activeRecording.isRrwebStopped()){gf.log("Recording already in progress, skipping startRecording.");return}var t=(function(){gf.log("Idle timeout reached, restarting recording."),this.resetRecording()}).bind(this),n=(function(){gf.log("Max recording length reached, stopping recording."),this.resetRecording()}).bind(this),r=(function(){this.recordingRegistry.setActiveRecording(this.activeRecording.serialize()),this.__flushPromise=this.activeRecording.batcher._flushPromise}).bind(this),i={mixpanelInstance:this.mixpanelInstance,onBatchSent:r,onIdleTimeout:t,onMaxLengthReached:n,replayId:R.UUID(),rrwebRecord:this.rrwebRecord,sharedLockStorage:this.sharedLockStorage};return e.activeSerializedRecording?this.activeRecording=Er.deserialize(e.activeSerializedRecording,i):this.activeRecording=new Er(i),this.activeRecording.startRecording(e.shouldStopBatcher),this.recordingRegistry.setActiveRecording(this.activeRecording.serialize())},No.prototype.stopRecording=function(){var e=this._stopCurrentRecording(!1);return this.recordingRegistry.clearActiveRecording(),this.activeRecording=null,e},No.prototype.pauseRecording=function(){return this._stopCurrentRecording(!1)},No.prototype._stopCurrentRecording=function(e){return this.activeRecording?this.activeRecording.stopRecording(e):jt.resolve()},No.prototype.resumeRecording=function(e){return this.activeRecording&&this.activeRecording.isRrwebStopped()?(this.activeRecording.startRecording(!1),jt.resolve(null)):this.recordingRegistry.getActiveRecording().then((function(t){return t?this.startRecording({activeSerializedRecording:t}):e?this.startRecording({shouldStopBatcher:!1}):(gf.log("No resumable recording found."),null)}).bind(this))},No.prototype.resetRecording=function(){this.stopRecording(),this.startRecording({shouldStopBatcher:!0})},No.prototype.getActiveReplayId=function(){return this.activeRecording&&!this.activeRecording.isRrwebStopped()?this.activeRecording.replayId:null},Object.defineProperty(No.prototype,"replayId",{get:function(){return this.getActiveReplayId()}}),Ue.__mp_recorder=No;var Bp="change",mf="click",RO="hashchange",Kl="mp_locationchange",OO="popstate",TO="scrollend",Hb="submit",DV=["clientX","clientY","offsetX","offsetY","pageX","pageY","screenX","screenY","x","y"],MO=["mp-include"],Gb=["mp-no-track"],DO=Gb.concat(["mp-sensitive"]),LV=["aria-label","aria-labelledby","aria-describedby","href","name","role","title","type"],qr=Gl("autocapture");function Vb(e){for(var t={},n=LO(e).split(" "),r=0;r<n.length;r++){var i=n[r];i&&(t[i]=!0)}return t}function LO(e){switch(typeof e.className){case"string":return e.className;case"object":return e.className.baseVal||e.getAttribute("class")||"";default:return""}}function $V(e){if(e.previousElementSibling)return e.previousElementSibling;do e=e.previousSibling;while(e&&!PO(e));return e}function $O(e,t,n,r,i,o){var a={$classes:LO(e).split(" "),$tag_name:e.tagName.toLowerCase()},u=e.id;u&&(a.$id=u),Wb(e,t,i,o)&&R.each(LV.concat(r),function(h){if(e.hasAttribute(h)&&!n[h]){var m=e.getAttribute(h);Fp(m)&&(a["$attr-"+h]=m)}});for(var c=1,d=1,p=e;p=$V(p);)c++,p.tagName===e.tagName&&d++;return a.$nth_child=c,a.$nth_of_type=d,a}function NV(e,t){var n=t.allowElementCallback,r=t.allowSelectors||[],i=t.blockAttrs||[],o=t.blockElementCallback,a=t.blockSelectors||[],u=t.captureTextContent||!1,c=t.captureExtraAttrs||[],d={};R.each(i,function(I){d[I]=!0});var p=null,h=typeof e.target>"u"?e.srcElement:e.target;if(BO(h)&&(h=h.parentNode),FV(h,e)&&Zb(h,e,n,r)&&!Yb(h,e,o,a)){for(var m=[h],v=h;v.parentNode&&!oo(v,"body");)m.push(v.parentNode),v=v.parentNode;var _=[],x,S=!1;if(R.each(m,function(I){var O=Wb(I,e,n,r);!d.href&&I.tagName.toLowerCase()==="a"&&(x=I.getAttribute("href"),x=O&&Fp(x)&&x),Yb(I,e,o,a)&&(S=!0),_.push($O(I,e,d,c,n,r))},this),!S){var b=Zt.documentElement;if(p={$event_type:e.type,$host:Ue.location.host,$pathname:Ue.location.pathname,$elements:_,$el_attr__href:x,$viewportHeight:Math.max(b.clientHeight,Ue.innerHeight||0),$viewportWidth:Math.max(b.clientWidth,Ue.innerWidth||0)},R.each(c,function(I){if(!d[I]&&h.hasAttribute(I)){var O=h.getAttribute(I);Fp(O)&&(p["$el_attr__"+I]=O)}}),u&&(C=NO(h,e,n,r),C&&C.length&&(p.$el_text=C)),e.type===mf&&(R.each(DV,function(I){I in e&&(p["$"+I]=e[I])}),h=PV(e)),u){var C=NO(h,e,n,r);C&&C.length&&(p.$el_text=C)}if(h){if(!Zb(h,e,n,r)||Yb(h,e,o,a))return null;var E=$O(h,e,d,c,n,r);p.$target=E,p.$el_classes=E.$classes,R.extend(p,R.strip_empty_properties({$el_id:E.$id,$el_tag_name:E.$tag_name}))}}}return p}function NO(e,t,n,r){var i="";return Wb(e,t,n,r)&&e.childNodes&&e.childNodes.length&&R.each(e.childNodes,function(o){BO(o)&&o.textContent&&(i+=R.trim(o.textContent).split(/(\s+)/).filter(Fp).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255))}),R.trim(i)}function PV(e){for(var t=e.target,n=e.composedPath(),r=0;r<n.length;r++){var i=n[r];if(oo(i,"a")||oo(i,"button")||oo(i,"input")||oo(i,"select")||i.getAttribute&&i.getAttribute("role")==="button"){t=i;break}if(i===t)break}return t}function Zb(e,t,n,r){if(n)try{if(!n(e,t))return!1}catch(a){return qr.critical("Error while checking element in allowElementCallback",a),!1}if(!r.length)return!0;for(var i=0;i<r.length;i++){var o=r[i];try{if(e.matches(o))return!0}catch(a){qr.critical("Error while checking selector: "+o,a)}}return!1}function Yb(e,t,n,r){var i;if(n)try{if(n(e,t))return!0}catch(u){return qr.critical("Error while checking element in blockElementCallback",u),!0}if(r&&r.length)for(i=0;i<r.length;i++){var o=r[i];try{if(e.matches(o))return!0}catch(u){qr.critical("Error while checking selector: "+o,u)}}var a=Vb(e);for(i=0;i<Gb.length;i++)if(a[Gb[i]])return!0;return!1}function PO(e){return e&&e.nodeType===1}function oo(e,t){return e&&e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function BO(e){return e&&e.nodeType===3}function BV(){try{var e=Zt.createElement("div");return!!e.matches}catch{return!1}}function FV(e,t){if(!e||oo(e,"html")||!PO(e))return!1;var n=e.tagName.toLowerCase();switch(n){case"form":return t.type===Hb;case"input":return["button","submit"].indexOf(e.getAttribute("type"))===-1?t.type===Bp:t.type===mf;case"select":case"textarea":return t.type===Bp;default:return t.type===mf}}function Wb(e,t,n,r){var i;if(!Zb(e,t,n,r))return!1;for(var o=e;o.parentNode&&!oo(o,"body");o=o.parentNode){var a=Vb(o);for(i=0;i<DO.length;i++)if(a[DO[i]])return!1}var u=Vb(e);for(i=0;i<MO.length;i++)if(u[MO[i]])return!0;if(oo(e,"input")||oo(e,"select")||oo(e,"textarea")||e.getAttribute("contenteditable")==="true")return!1;var c=e.type||"";if(typeof c=="string")switch(c.toLowerCase()){case"hidden":return!1;case"password":return!1}var d=e.name||e.id||"";if(typeof d=="string"){var p=/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i;if(p.test(d.replace(/[^a-zA-Z0-9]/g,"")))return!1}return!0}function Fp(e){if(e===null||R.isUndefined(e))return!1;if(typeof e=="string"){e=R.trim(e);var t=/^(?:(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}))$/;if(t.test((e||"").replace(/[- ]/g,"")))return!1;var n=/(^\d{3}-?\d{2}-?\d{4}$)/;if(n.test(e))return!1}return!0}var FO="autocapture",UV="track_pageview",UO="full-url",zV="url-with-path-and-query-string",qV="url-with-path",jV="allow_element_callback",zO="allow_selectors",qO="allow_url_regexes",jO="block_attrs",HO="block_element_callback",GO="block_selectors",VO="block_url_regexes",ZO="capture_extra_attrs",YO="capture_text_content",WO="scroll_capture_all",KO="scroll_depth_percent_checkpoints",Kb="click",Qb="input",QO="pageview",Xb="scroll",Jb="submit",ur={};ur[zO]=[],ur[qO]=[],ur[jO]=[],ur[HO]=null,ur[GO]=[],ur[VO]=[],ur[ZO]=[],ur[YO]=!1,ur[WO]=!1,ur[KO]=[25,50,75,100],ur[Kb]=!0,ur[Qb]=!0,ur[QO]=UO,ur[Xb]=!0,ur[Jb]=!0;var Up={$mp_autocapture:!0},HV="$mp_click",GV="$mp_input_change",VV="$mp_scroll",ZV="$mp_submit",ni=function(e){this.mp=e};ni.prototype.init=function(){if(!BV()){qr.critical("Autocapture unavailable: missing required DOM APIs");return}this.initPageviewTracking(),this.initClickTracking(),this.initInputTracking(),this.initScrollTracking(),this.initSubmitTracking()},ni.prototype.getFullConfig=function(){var e=this.mp.get_config(FO);return e?R.isObject(e)?R.extend({},ur,e):ur:{}},ni.prototype.getConfig=function(e){return this.getFullConfig()[e]},ni.prototype.currentUrlBlocked=function(){var e,t=R.info.currentUrl(),n=this.getConfig(qO)||[];if(n.length){var r=!1;for(e=0;e<n.length;e++){var i=n[e];try{if(t.match(i)){r=!0;break}}catch(a){return qr.critical("Error while checking block URL regex: "+i,a),!0}}if(!r)return!0}var o=this.getConfig(VO)||[];if(!o||!o.length)return!1;for(e=0;e<o.length;e++)try{if(t.match(o[e]))return!0}catch(a){return qr.critical("Error while checking block URL regex: "+o[e],a),!0}return!1},ni.prototype.pageviewTrackingConfig=function(){return this.mp.get_config(FO)?this.getConfig(QO):this.mp.get_config(UV)},ni.prototype.trackDomEvent=function(e,t){if(!this.currentUrlBlocked()){var n=NV(e,{allowElementCallback:this.getConfig(jV),allowSelectors:this.getConfig(zO),blockAttrs:this.getConfig(jO),blockElementCallback:this.getConfig(HO),blockSelectors:this.getConfig(GO),captureExtraAttrs:this.getConfig(ZO),captureTextContent:this.getConfig(YO)});n&&(R.extend(n,Up),this.mp.track(t,n))}},ni.prototype.initClickTracking=function(){Ue.removeEventListener(mf,this.listenerClick),this.getConfig(Kb)&&(qr.log("Initializing click tracking"),this.listenerClick=Ue.addEventListener(mf,(function(e){this.getConfig(Kb)&&this.trackDomEvent(e,HV)}).bind(this)))},ni.prototype.initInputTracking=function(){Ue.removeEventListener(Bp,this.listenerChange),this.getConfig(Qb)&&(qr.log("Initializing input tracking"),this.listenerChange=Ue.addEventListener(Bp,(function(e){this.getConfig(Qb)&&this.trackDomEvent(e,GV)}).bind(this)))},ni.prototype.initPageviewTracking=function(){if(Ue.removeEventListener(OO,this.listenerPopstate),Ue.removeEventListener(RO,this.listenerHashchange),Ue.removeEventListener(Kl,this.listenerLocationchange),!!this.pageviewTrackingConfig()){qr.log("Initializing pageview tracking");var e="",t=!1;this.currentUrlBlocked()||(t=this.mp.track_pageview(Up)),t&&(e=R.info.currentUrl()),this.listenerPopstate=Ue.addEventListener(OO,function(){Ue.dispatchEvent(new Event(Kl))}),this.listenerHashchange=Ue.addEventListener(RO,function(){Ue.dispatchEvent(new Event(Kl))});var n=Ue.history.pushState;typeof n=="function"&&(Ue.history.pushState=function(i,o,a){n.call(Ue.history,i,o,a),Ue.dispatchEvent(new Event(Kl))});var r=Ue.history.replaceState;typeof r=="function"&&(Ue.history.replaceState=function(i,o,a){r.call(Ue.history,i,o,a),Ue.dispatchEvent(new Event(Kl))}),this.listenerLocationchange=Ue.addEventListener(Kl,$b((function(){if(!this.currentUrlBlocked()){var i=R.info.currentUrl(),o=!1,a=i.split("#")[0].split("?")[0]!==e.split("#")[0].split("?")[0],u=this.pageviewTrackingConfig();if(u===UO?o=i!==e:u===zV?o=i.split("#")[0]!==e.split("#")[0]:u===qV&&(o=a),o){var c=this.mp.track_pageview(Up);c&&(e=i),a&&(this.lastScrollCheckpoint=0,qr.log("Path change: re-initializing scroll depth checkpoints"))}}}).bind(this)))}},ni.prototype.initScrollTracking=function(){Ue.removeEventListener(TO,this.listenerScroll),this.getConfig(Xb)&&(qr.log("Initializing scroll tracking"),this.lastScrollCheckpoint=0,this.listenerScroll=Ue.addEventListener(TO,$b((function(){if(this.getConfig(Xb)&&!this.currentUrlBlocked()){var e=this.getConfig(WO),t=(this.getConfig(KO)||[]).slice().sort(function(c,d){return c-d}),n=Ue.scrollY,r=R.extend({$scroll_top:n},Up);try{var i=Zt.body.scrollHeight,o=Math.round(n/(i-Ue.innerHeight)*100);if(r.$scroll_height=i,r.$scroll_percentage=o,o>this.lastScrollCheckpoint)for(var a=0;a<t.length;a++){var u=t[a];o>=u&&this.lastScrollCheckpoint<u&&(r.$scroll_checkpoint=u,this.lastScrollCheckpoint=u,e=!0)}}catch(c){qr.critical("Error while calculating scroll percentage",c)}e&&this.mp.track(VV,r)}}).bind(this))))},ni.prototype.initSubmitTracking=function(){Ue.removeEventListener(Hb,this.listenerSubmit),this.getConfig(Jb)&&(qr.log("Initializing submit tracking"),this.listenerSubmit=Ue.addEventListener(Hb,(function(e){this.getConfig(Jb)&&this.trackDomEvent(e,ZV)}).bind(this)))},uV(ni);var Po=function(){};Po.prototype.create_properties=function(){},Po.prototype.event_handler=function(){},Po.prototype.after_track_handler=function(){},Po.prototype.init=function(e){return this.mp=e,this},Po.prototype.track=function(e,t,n,r){var i=this,o=R.dom_query(e);if(o.length===0){zt.error("The DOM query ("+e+") returned 0 elements");return}return R.each(o,function(a){R.register_event(a,this.override_event,function(u){var c={},d=i.create_properties(n,this),p=i.mp.get_config("track_links_timeout");i.event_handler(u,this,c),window.setTimeout(i.track_callback(r,d,c,!0),p),i.mp.track(t,d,i.track_callback(r,d,c))})},this),!0},Po.prototype.track_callback=function(e,t,n,r){r=r||!1;var i=this;return function(){n.callback_fired||(n.callback_fired=!0,!(e&&e(r,t)===!1)&&i.after_track_handler(t,n,r))}},Po.prototype.create_properties=function(e,t){var n;return typeof e=="function"?n=e(t):n=R.extend({},e),n};var Ql=function(){this.override_event="click"};R.inherit(Ql,Po),Ql.prototype.create_properties=function(e,t){var n=Ql.superclass.create_properties.apply(this,arguments);return t.href&&(n.url=t.href),n},Ql.prototype.event_handler=function(e,t,n){n.new_tab=e.which===2||e.metaKey||e.ctrlKey||t.target==="_blank",n.href=t.href,n.new_tab||e.preventDefault()},Ql.prototype.after_track_handler=function(e,t){t.new_tab||setTimeout(function(){window.location=t.href},0)};var zp=function(){this.override_event="submit"};R.inherit(zp,Po),zp.prototype.event_handler=function(e,t,n){n.element=t,e.preventDefault()},zp.prototype.after_track_handler=function(e,t){setTimeout(function(){t.element.submit()},0)};var $a="$set",Xl="$set_once",qi="$unset",Ls="$add",ao="$append",$s="$union",Bo="$remove",YV="$delete",XO={set_action:function(e,t){var n={},r={};return R.isObject(e)?R.each(e,function(i,o){this._is_reserved_property(o)||(r[o]=i)},this):r[e]=t,n[$a]=r,n},unset_action:function(e){var t={},n=[];return R.isArray(e)||(e=[e]),R.each(e,function(r){this._is_reserved_property(r)||n.push(r)},this),t[qi]=n,t},set_once_action:function(e,t){var n={},r={};return R.isObject(e)?R.each(e,function(i,o){this._is_reserved_property(o)||(r[o]=i)},this):r[e]=t,n[Xl]=r,n},union_action:function(e,t){var n={},r={};return R.isObject(e)?R.each(e,function(i,o){this._is_reserved_property(o)||(r[o]=R.isArray(i)?i:[i])},this):r[e]=R.isArray(t)?t:[t],n[$s]=r,n},append_action:function(e,t){var n={},r={};return R.isObject(e)?R.each(e,function(i,o){this._is_reserved_property(o)||(r[o]=i)},this):r[e]=t,n[ao]=r,n},remove_action:function(e,t){var n={},r={};return R.isObject(e)?R.each(e,function(i,o){this._is_reserved_property(o)||(r[o]=i)},this):r[e]=t,n[Bo]=r,n},delete_action:function(){var e={};return e[YV]="",e}},gn=function(){};R.extend(gn.prototype,XO),gn.prototype._init=function(e,t,n){this._mixpanel=e,this._group_key=t,this._group_id=n},gn.prototype.set=Zl(function(e,t,n){var r=this.set_action(e,t);return R.isObject(e)&&(n=t),this._send_request(r,n)}),gn.prototype.set_once=Zl(function(e,t,n){var r=this.set_once_action(e,t);return R.isObject(e)&&(n=t),this._send_request(r,n)}),gn.prototype.unset=Zl(function(e,t){var n=this.unset_action(e);return this._send_request(n,t)}),gn.prototype.union=Zl(function(e,t,n){R.isObject(e)&&(n=t);var r=this.union_action(e,t);return this._send_request(r,n)}),gn.prototype.delete=Zl(function(e){var t=this.delete_action();return this._send_request(t,e)}),gn.prototype.remove=Zl(function(e,t,n){var r=this.remove_action(e,t);return this._send_request(r,n)}),gn.prototype._send_request=function(e,t){e.$group_key=this._group_key,e.$group_id=this._group_id,e.$token=this._get_config("token");var n=R.encodeDates(e);return this._mixpanel._track_or_batch({type:"groups",data:n,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").groups,batcher:this._mixpanel.request_batchers.groups},t)},gn.prototype._is_reserved_property=function(e){return e==="$group_key"||e==="$group_id"},gn.prototype._get_config=function(e){return this._mixpanel.get_config(e)},gn.prototype.toString=function(){return this._mixpanel.toString()+".group."+this._group_key+"."+this._group_id},gn.prototype.remove=gn.prototype.remove,gn.prototype.set=gn.prototype.set,gn.prototype.set_once=gn.prototype.set_once,gn.prototype.union=gn.prototype.union,gn.prototype.unset=gn.prototype.unset,gn.prototype.toString=gn.prototype.toString;var ht=function(){};R.extend(ht.prototype,XO),ht.prototype._init=function(e){this._mixpanel=e},ht.prototype.set=La(function(e,t,n){var r=this.set_action(e,t);return R.isObject(e)&&(n=t),this._get_config("save_referrer")&&this._mixpanel.persistence.update_referrer_info(document.referrer),r[$a]=R.extend({},R.info.people_properties(),r[$a]),this._send_request(r,n)}),ht.prototype.set_once=La(function(e,t,n){var r=this.set_once_action(e,t);return R.isObject(e)&&(n=t),this._send_request(r,n)}),ht.prototype.unset=La(function(e,t){var n=this.unset_action(e);return this._send_request(n,t)}),ht.prototype.increment=La(function(e,t,n){var r={},i={};return R.isObject(e)?(R.each(e,function(o,a){if(!this._is_reserved_property(a))if(isNaN(parseFloat(o))){zt.error("Invalid increment value passed to mixpanel.people.increment - must be a number");return}else i[a]=o},this),n=t):(R.isUndefined(t)&&(t=1),i[e]=t),r[Ls]=i,this._send_request(r,n)}),ht.prototype.append=La(function(e,t,n){R.isObject(e)&&(n=t);var r=this.append_action(e,t);return this._send_request(r,n)}),ht.prototype.remove=La(function(e,t,n){R.isObject(e)&&(n=t);var r=this.remove_action(e,t);return this._send_request(r,n)}),ht.prototype.union=La(function(e,t,n){R.isObject(e)&&(n=t);var r=this.union_action(e,t);return this._send_request(r,n)}),ht.prototype.track_charge=La(function(e,t,n){if(!R.isNumber(e)&&(e=parseFloat(e),isNaN(e))){zt.error("Invalid value passed to mixpanel.people.track_charge - must be a number");return}return this.append("$transactions",R.extend({$amount:e},t),n)}),ht.prototype.clear_charges=function(e){return this.set("$transactions",[],e)},ht.prototype.delete_user=function(){if(!this._identify_called()){zt.error("mixpanel.people.delete_user() requires you to call identify() first");return}var e={$delete:this._mixpanel.get_distinct_id()};return this._send_request(e)},ht.prototype.toString=function(){return this._mixpanel.toString()+".people"},ht.prototype._send_request=function(e,t){e.$token=this._get_config("token"),e.$distinct_id=this._mixpanel.get_distinct_id();var n=this._mixpanel.get_property("$device_id"),r=this._mixpanel.get_property("$user_id"),i=this._mixpanel.get_property("$had_persisted_distinct_id");n&&(e.$device_id=n),r&&(e.$user_id=r),i&&(e.$had_persisted_distinct_id=i);var o=R.encodeDates(e);return this._identify_called()?this._mixpanel._track_or_batch({type:"people",data:o,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").engage,batcher:this._mixpanel.request_batchers.people},t):(this._enqueue(e),R.isUndefined(t)||(this._get_config("verbose")?t({status:-1,error:null}):t(-1)),R.truncate(o,255))},ht.prototype._get_config=function(e){return this._mixpanel.get_config(e)},ht.prototype._identify_called=function(){return this._mixpanel._flags.identify_called===!0},ht.prototype._enqueue=function(e){$a in e?this._mixpanel.persistence._add_to_people_queue($a,e):Xl in e?this._mixpanel.persistence._add_to_people_queue(Xl,e):qi in e?this._mixpanel.persistence._add_to_people_queue(qi,e):Ls in e?this._mixpanel.persistence._add_to_people_queue(Ls,e):ao in e?this._mixpanel.persistence._add_to_people_queue(ao,e):Bo in e?this._mixpanel.persistence._add_to_people_queue(Bo,e):$s in e?this._mixpanel.persistence._add_to_people_queue($s,e):zt.error("Invalid call to _enqueue():",e)},ht.prototype._flush_one_queue=function(e,t,n,r){var i=this,o=R.extend({},this._mixpanel.persistence.load_queue(e)),a=o;!R.isUndefined(o)&&R.isObject(o)&&!R.isEmptyObject(o)&&(i._mixpanel.persistence._pop_from_people_queue(e,o),i._mixpanel.persistence.save(),r&&(a=r(o)),t.call(i,a,function(u,c){u===0&&i._mixpanel.persistence._add_to_people_queue(e,o),R.isUndefined(n)||n(u,c)}))},ht.prototype._flush=function(e,t,n,r,i,o,a){var u=this;this._flush_one_queue($a,this.set,e),this._flush_one_queue(Xl,this.set_once,r),this._flush_one_queue(qi,this.unset,o,function(S){return R.keys(S)}),this._flush_one_queue(Ls,this.increment,t),this._flush_one_queue($s,this.union,i);var c=this._mixpanel.persistence.load_queue(ao);if(!R.isUndefined(c)&&R.isArray(c)&&c.length)for(var d,p=function(S,b){S===0&&u._mixpanel.persistence._add_to_people_queue(ao,d),R.isUndefined(n)||n(S,b)},h=c.length-1;h>=0;h--)c=this._mixpanel.persistence.load_queue(ao),d=c.pop(),u._mixpanel.persistence.save(),R.isEmptyObject(d)||u.append(d,p);var m=this._mixpanel.persistence.load_queue(Bo);if(!R.isUndefined(m)&&R.isArray(m)&&m.length)for(var v,_=function(S,b){S===0&&u._mixpanel.persistence._add_to_people_queue(Bo,v),R.isUndefined(a)||a(S,b)},x=m.length-1;x>=0;x--)m=this._mixpanel.persistence.load_queue(Bo),v=m.pop(),u._mixpanel.persistence.save(),R.isEmptyObject(v)||u.remove(v,_)},ht.prototype._is_reserved_property=function(e){return e==="$distinct_id"||e==="$token"||e==="$device_id"||e==="$user_id"||e==="$had_persisted_distinct_id"},ht.prototype.set=ht.prototype.set,ht.prototype.set_once=ht.prototype.set_once,ht.prototype.unset=ht.prototype.unset,ht.prototype.increment=ht.prototype.increment,ht.prototype.append=ht.prototype.append,ht.prototype.remove=ht.prototype.remove,ht.prototype.union=ht.prototype.union,ht.prototype.track_charge=ht.prototype.track_charge,ht.prototype.clear_charges=ht.prototype.clear_charges,ht.prototype.delete_user=ht.prototype.delete_user,ht.prototype.toString=ht.prototype.toString;var e1="__mps",t1="__mpso",n1="__mpus",r1="__mpa",i1="__mpap",o1="__mpr",a1="__mpu",JO="$people_distinct_id",qp="__alias",vf="__timers",WV=[e1,t1,n1,r1,i1,o1,a1,JO,qp,vf],Ct=function(e){this.props={},this.campaign_params_saved=!1,e.persistence_name?this.name="mp_"+e.persistence_name:this.name="mp_"+e.token+"_mixpanel";var t=e.persistence;t!=="cookie"&&t!=="localStorage"&&(zt.critical("Unknown persistence type "+t+"; falling back to cookie"),t=e.persistence="cookie"),t==="localStorage"&&R.localStorage.is_supported()?this.storage=R.localStorage:this.storage=R.cookie,this.load(),this.update_config(e),this.upgrade(),this.save()};Ct.prototype.properties=function(){var e={};return this.load(),R.each(this.props,function(t,n){R.include(WV,n)||(e[n]=t)}),e},Ct.prototype.load=function(){if(!this.disabled){var e=this.storage.parse(this.name);e&&(this.props=R.extend({},e))}},Ct.prototype.upgrade=function(){var e,t;this.storage===R.localStorage?(e=R.cookie.parse(this.name),R.cookie.remove(this.name),R.cookie.remove(this.name,!0),e&&this.register_once(e)):this.storage===R.cookie&&(t=R.localStorage.parse(this.name),R.localStorage.remove(this.name),t&&this.register_once(t))},Ct.prototype.save=function(){this.disabled||this.storage.set(this.name,Vl(this.props),this.expire_days,this.cross_subdomain,this.secure,this.cross_site,this.cookie_domain)},Ct.prototype.load_prop=function(e){return this.load(),this.props[e]},Ct.prototype.remove=function(){this.storage.remove(this.name,!1,this.cookie_domain),this.storage.remove(this.name,!0,this.cookie_domain)},Ct.prototype.clear=function(){this.remove(),this.props={}},Ct.prototype.register_once=function(e,t,n){return R.isObject(e)?(typeof t>"u"&&(t="None"),this.expire_days=typeof n>"u"?this.default_expiry:n,this.load(),R.each(e,function(r,i){(!this.props.hasOwnProperty(i)||this.props[i]===t)&&(this.props[i]=r)},this),this.save(),!0):!1},Ct.prototype.register=function(e,t){return R.isObject(e)?(this.expire_days=typeof t>"u"?this.default_expiry:t,this.load(),R.extend(this.props,e),this.save(),!0):!1},Ct.prototype.unregister=function(e){this.load(),e in this.props&&(delete this.props[e],this.save())},Ct.prototype.update_search_keyword=function(e){this.register(R.info.searchInfo(e))},Ct.prototype.update_referrer_info=function(e){this.register_once({$initial_referrer:e||"$direct",$initial_referring_domain:R.info.referringDomain(e)||"$direct"},"")},Ct.prototype.get_referrer_info=function(){return R.strip_empty_properties({$initial_referrer:this.props.$initial_referrer,$initial_referring_domain:this.props.$initial_referring_domain})},Ct.prototype.update_config=function(e){this.default_expiry=this.expire_days=e.cookie_expiration,this.set_disabled(e.disable_persistence),this.set_cookie_domain(e.cookie_domain),this.set_cross_site(e.cross_site_cookie),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie)},Ct.prototype.set_disabled=function(e){this.disabled=e,this.disabled?this.remove():this.save()},Ct.prototype.set_cookie_domain=function(e){e!==this.cookie_domain&&(this.remove(),this.cookie_domain=e,this.save())},Ct.prototype.set_cross_site=function(e){e!==this.cross_site&&(this.cross_site=e,this.remove(),this.save())},Ct.prototype.set_cross_subdomain=function(e){e!==this.cross_subdomain&&(this.cross_subdomain=e,this.remove(),this.save())},Ct.prototype.get_cross_subdomain=function(){return this.cross_subdomain},Ct.prototype.set_secure=function(e){e!==this.secure&&(this.secure=!!e,this.remove(),this.save())},Ct.prototype._add_to_people_queue=function(e,t){var n=this._get_queue_key(e),r=t[e],i=this._get_or_create_queue($a),o=this._get_or_create_queue(Xl),a=this._get_or_create_queue(qi),u=this._get_or_create_queue(Ls),c=this._get_or_create_queue($s),d=this._get_or_create_queue(Bo,[]),p=this._get_or_create_queue(ao,[]);n===e1?(R.extend(i,r),this._pop_from_people_queue(Ls,r),this._pop_from_people_queue($s,r),this._pop_from_people_queue(qi,r)):n===t1?(R.each(r,function(h,m){m in o||(o[m]=h)}),this._pop_from_people_queue(qi,r)):n===n1?R.each(r,function(h){R.each([i,o,u,c],function(m){h in m&&delete m[h]}),R.each(p,function(m){h in m&&delete m[h]}),a[h]=!0}):n===r1?(R.each(r,function(h,m){m in i?i[m]+=h:(m in u||(u[m]=0),u[m]+=h)},this),this._pop_from_people_queue(qi,r)):n===a1?(R.each(r,function(h,m){R.isArray(h)&&(m in c||(c[m]=[]),R.each(h,function(v){R.include(c[m],v)||c[m].push(v)}))}),this._pop_from_people_queue(qi,r)):n===o1?(d.push(r),this._pop_from_people_queue(ao,r)):n===i1&&(p.push(r),this._pop_from_people_queue(qi,r)),zt.log("MIXPANEL PEOPLE REQUEST (QUEUED, PENDING IDENTIFY):"),zt.log(t),this.save()},Ct.prototype._pop_from_people_queue=function(e,t){var n=this.props[this._get_queue_key(e)];R.isUndefined(n)||R.each(t,function(r,i){e===ao||e===Bo?R.each(n,function(o){o[i]===r&&delete o[i]}):delete n[i]},this)},Ct.prototype.load_queue=function(e){return this.load_prop(this._get_queue_key(e))},Ct.prototype._get_queue_key=function(e){if(e===$a)return e1;if(e===Xl)return t1;if(e===qi)return n1;if(e===Ls)return r1;if(e===ao)return i1;if(e===Bo)return o1;if(e===$s)return a1;zt.error("Invalid queue:",e)},Ct.prototype._get_or_create_queue=function(e,t){var n=this._get_queue_key(e);return t=R.isUndefined(t)?{}:t,this.props[n]||(this.props[n]=t)},Ct.prototype.set_event_timer=function(e,t){var n=this.load_prop(vf)||{};n[e]=t,this.props[vf]=n,this.save()},Ct.prototype.remove_event_timer=function(e){var t=this.load_prop(vf)||{},n=t[e];return R.isUndefined(n)||(delete this.props[vf][e],this.save()),n};var s1,eT=function(e,t){throw new Error(e+" not available in this build.")},kr,tT=0,KV=1,QV=function(e){return e},yi="mixpanel",nT="base64",XV="json",l1="$device:",Jl=Ue.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,rT=!Jl&&$o.indexOf("MSIE")===-1&&$o.indexOf("Mozilla")===-1,jp=null;Ta.sendBeacon&&(jp=function(){return Ta.sendBeacon.apply(Ta,arguments)});var iT={track:"track/",engage:"engage/",groups:"groups/",record:"record/"},oT={api_host:"https://api-js.mixpanel.com",api_routes:iT,api_method:"POST",api_transport:"XHR",api_payload_format:nT,app_host:"https://mixpanel.com",autocapture:!1,cdn:"https://cdn.mxpnl.com",cross_site_cookie:!1,cross_subdomain_cookie:!0,error_reporter:Ma,persistence:"cookie",persistence_name:"",cookie_domain:"",cookie_name:"",loaded:Ma,mp_loader:null,track_marketing:!0,track_pageview:!1,skip_first_touch_marketing:!1,store_google:!0,stop_utm_persistence:!1,save_referrer:!0,test:!1,verbose:!1,img:!1,debug:!1,track_links_timeout:300,cookie_expiration:365,upgrade:!1,disable_persistence:!1,disable_cookie:!1,secure_cookie:!1,ip:!0,opt_out_tracking_by_default:!1,opt_out_persistence_by_default:!1,opt_out_tracking_persistence_type:"localStorage",opt_out_tracking_cookie_prefix:null,property_blacklist:[],xhr_headers:{},ignore_dnt:!1,batch_requests:!0,batch_size:50,batch_flush_interval_ms:5e3,batch_request_timeout_ms:9e4,batch_autostart:!0,hooks:{},record_block_class:new RegExp("^(mp-block|fs-exclude|amp-block|rr-block|ph-no-capture)$"),record_block_selector:"img, video",record_canvas:!1,record_collect_fonts:!1,record_idle_timeout_ms:30*60*1e3,record_mask_text_class:new RegExp("^(mp-mask|fs-mask|amp-mask|rr-mask|ph-mask)$"),record_mask_text_selector:"*",record_max_ms:cf,record_min_ms:0,record_sessions_percent:0,recorder_src:"https://cdn.mxpnl.com/libs/mixpanel-recorder.min.js"},aT=!1,oe=function(){},u1=function(e,t,n){var r,i=n===yi?kr:kr[n];if(i&&s1===tT)r=i;else{if(i&&!R.isArray(i)){zt.error("You have already initialized "+n);return}r=new oe}if(r._cached_groups={},r._init(e,t,n),r.people=new ht,r.people._init(r),!r.get_config("skip_first_touch_marketing")){var o=R.info.campaignParams(null),a={},u=!1;R.each(o,function(c,d){a["initial_"+d]=c,c&&(u=!0)}),u&&r.people.set_once(a)}return zi.DEBUG=zi.DEBUG||r.get_config("debug"),!R.isUndefined(i)&&R.isArray(i)&&(r._execute_array.call(r.people,i.people),r._execute_array(i)),r};oe.prototype.init=function(e,t,n){if(R.isUndefined(n)){this.report_error("You must name your new library: init(token, config, name)");return}if(n===yi){this.report_error("You must initialize the main mixpanel object right after you include the Mixpanel js snippet");return}var r=u1(e,t,n);return kr[n]=r,r._loaded(),r},oe.prototype._init=function(e,t,n){t=t||{},this.__loaded=!0,this.config={};var r={};if(!("api_payload_format"in t)){var i=t.api_host||oT.api_host;i.match(/\.mixpanel\.com/)&&(r.api_payload_format=XV)}if(this.set_config(R.extend({},oT,r,t,{name:n,token:e,callback_fn:(n===yi?n:yi+"."+n)+"._jsc"})),this._jsc=Ma,this.__dom_loaded_queue=[],this.__request_queue=[],this.__disabled_events=[],this._flags={disable_all_events:!1,identify_called:!1},this.request_batchers={},this._batch_requests=this.get_config("batch_requests"),this._batch_requests){if(!R.localStorage.is_supported(!0)||!Jl)this._batch_requests=!1,zt.log("Turning off Mixpanel request-queueing; needs XHR and localStorage support"),R.each(this.get_batcher_configs(),function(u){zt.log("Clearing batch queue "+u.queue_key),R.localStorage.remove(u.queue_key)});else if(this.init_batchers(),jp&&Ue.addEventListener){var o=R.bind(function(){this.request_batchers.events.stopped||this.request_batchers.events.flush({unloading:!0})},this);Ue.addEventListener("pagehide",function(u){u.persisted&&o()}),Ue.addEventListener("visibilitychange",function(){Zt.visibilityState==="hidden"&&o()})}}this.persistence=this.cookie=new Ct(this.config),this.unpersisted_superprops={},this._gdpr_init();var a=R.UUID();this.get_distinct_id()||this.register_once({distinct_id:l1+a,$device_id:a},""),this.autocapture=new ni(this),this.autocapture.init(),this._init_tab_id(),this._check_and_start_session_recording()},oe.prototype._init_tab_id=function(){if(R.sessionStorage.is_supported())try{var e=this.get_config("name")+"_"+this.get_config("token"),t="mp_tab_id_"+e,n="mp_gen_new_tab_id_"+e;(R.sessionStorage.get(n)||!R.sessionStorage.get(t))&&R.sessionStorage.set(t,"$tab-"+R.UUID()),R.sessionStorage.set(n,"1"),this.tab_id=R.sessionStorage.get(t),Ue.addEventListener("beforeunload",function(){R.sessionStorage.remove(n)})}catch(r){this.report_error("Error initializing tab id",r)}else this.report_error("Session storage is not supported, cannot keep track of unique tab ID.")},oe.prototype.get_tab_id=function(){return this.tab_id||null},oe.prototype._should_load_recorder=function(){var e=new ro(Fb),t=this.get_tab_id();return e.init().then(function(){return e.getAll()}).then(function(n){for(var r=0;r<n.length;r++)if(jb(n[r])||n[r].tabId===t)return!0;return!1}).catch(R.bind(function(n){this.report_error("Error checking recording registry",n)},this))},oe.prototype._check_and_start_session_recording=Da(function(e){if(!Ue.MutationObserver){zt.critical("Browser does not support MutationObserver; skipping session recording");return}var t=R.bind(function(r){var i=R.bind(function(){this._recorder=this._recorder||new Ue.__mp_recorder(this),this._recorder.resumeRecording(r)},this);R.isUndefined(Ue.__mp_recorder)?eT(this.get_config("recorder_src"),i):i()},this),n=this.get_config("record_sessions_percent")>0&&Math.random()*100<=this.get_config("record_sessions_percent");e||n?t(!0):this._should_load_recorder().then(function(r){r&&t(!1)})}),oe.prototype.start_session_recording=function(){this._check_and_start_session_recording(!0)},oe.prototype.stop_session_recording=function(){this._recorder&&this._recorder.stopRecording()},oe.prototype.pause_session_recording=function(){this._recorder&&this._recorder.pauseRecording()},oe.prototype.resume_session_recording=function(){this._recorder&&this._recorder.resumeRecording()},oe.prototype.get_session_recording_properties=function(){var e={},t=this._get_session_replay_id();return t&&(e.$mp_replay_id=t),e},oe.prototype.get_session_replay_url=function(){var e=null,t=this._get_session_replay_id();if(t){var n=R.HTTPBuildQuery({replay_id:t,distinct_id:this.get_distinct_id(),token:this.get_config("token")});e="https://mixpanel.com/projects/replay-redirect?"+n}return e},oe.prototype._get_session_replay_id=function(){var e=null;return this._recorder&&(e=this._recorder.replayId),e||null},oe.prototype.__get_recorder=function(){return this._recorder},oe.prototype._loaded=function(){if(this.get_config("loaded")(this),this._set_default_superprops(),this.people.set_once(this.persistence.get_referrer_info()),this.get_config("store_google")&&this.get_config("stop_utm_persistence")){var e=R.info.campaignParams(null);R.each(e,(function(t,n){this.unregister(n)}).bind(this))}},oe.prototype._set_default_superprops=function(){this.persistence.update_search_keyword(Zt.referrer),this.get_config("store_google")&&!this.get_config("stop_utm_persistence")&&this.register(R.info.campaignParams()),this.get_config("save_referrer")&&this.persistence.update_referrer_info(Zt.referrer)},oe.prototype._dom_loaded=function(){R.each(this.__dom_loaded_queue,function(e){this._track_dom.apply(this,e)},this),this.has_opted_out_tracking()||R.each(this.__request_queue,function(e){this._send_request.apply(this,e)},this),delete this.__dom_loaded_queue,delete this.__request_queue},oe.prototype._track_dom=function(e,t){if(this.get_config("img"))return this.report_error("You can't use DOM tracking functions with img = true."),!1;if(!aT)return this.__dom_loaded_queue.push([e,t]),!1;var n=new e().init(this);return n.track.apply(n,t)},oe.prototype._prepare_callback=function(e,t){if(R.isUndefined(e))return null;if(Jl){var n=function(a){e(a,t)};return n}else{var r=this._jsc,i=""+Math.floor(Math.random()*1e8),o=this.get_config("callback_fn")+"["+i+"]";return r[i]=function(a){delete r[i],e(a,t)},o}},oe.prototype._send_request=function(e,t,n,r){var i=!0;if(rT)return this.__request_queue.push(arguments),i;var o={method:this.get_config("api_method"),transport:this.get_config("api_transport"),verbose:this.get_config("verbose")},a=null;!r&&(R.isFunction(n)||typeof n=="string")&&(r=n,n=null),n=R.extend(o,n||{}),Jl||(n.method="GET");var u=n.method==="POST",c=jp&&u&&n.transport.toLowerCase()==="sendbeacon",d=n.verbose;t.verbose&&(d=!0),this.get_config("test")&&(t.test=1),d&&(t.verbose=1),this.get_config("img")&&(t.img=1),Jl||(r?t.callback=r:(d||this.get_config("test"))&&(t.callback="(function(){})")),t.ip=this.get_config("ip")?1:0,t._=new Date().getTime().toString(),u&&(a="data="+encodeURIComponent(t.data),delete t.data),e+="?"+R.HTTPBuildQuery(t);var p=this;if("img"in t){var h=Zt.createElement("img");h.src=e,Zt.body.appendChild(h)}else if(c){try{i=jp(e,a)}catch(b){p.report_error(b),i=!1}try{r&&r(i?1:0)}catch(b){p.report_error(b)}}else if(Jl)try{var m=new XMLHttpRequest;m.open(n.method,e,!0);var v=this.get_config("xhr_headers");if(u&&(v["Content-Type"]="application/x-www-form-urlencoded"),R.each(v,function(b,C){m.setRequestHeader(C,b)}),n.timeout_ms&&typeof m.timeout<"u"){m.timeout=n.timeout_ms;var _=new Date().getTime()}m.withCredentials=!0,m.onreadystatechange=function(){if(m.readyState===4)if(m.status===200){if(r)if(d){var b;try{b=R.JSONDecode(m.responseText)}catch(I){if(p.report_error(I),n.ignore_json_errors)b=m.responseText;else return}r(b)}else r(Number(m.responseText))}else{var C;if(m.timeout&&!m.status&&new Date().getTime()-_>=m.timeout?C="timeout":C="Bad HTTP status: "+m.status+" "+m.statusText,p.report_error(C),r)if(d){var E=m.responseHeaders||{};r({status:0,httpStatusCode:m.status,error:C,retryAfter:E["Retry-After"]})}else r(0)}},m.send(a)}catch(b){p.report_error(b),i=!1}else{var x=Zt.createElement("script");x.type="text/javascript",x.async=!0,x.defer=!0,x.src=e;var S=Zt.getElementsByTagName("script")[0];S.parentNode.insertBefore(x,S)}return i},oe.prototype._execute_array=function(e){var t,n=[],r=[],i=[];R.each(e,function(a){a&&(t=a[0],R.isArray(t)?i.push(a):typeof a=="function"?a.call(this):R.isArray(a)&&t==="alias"?n.push(a):R.isArray(a)&&t.indexOf("track")!==-1&&typeof this[t]=="function"?i.push(a):r.push(a))},this);var o=function(a,u){R.each(a,function(c){if(R.isArray(c[0])){var d=u;R.each(c,function(p){d=d[p[0]].apply(d,p.slice(1))})}else this[c[0]].apply(this,c.slice(1))},u)};o(n,this),o(r,this),o(i,this)},oe.prototype.are_batchers_initialized=function(){return!!this.request_batchers.events},oe.prototype.get_batcher_configs=function(){var e="__mpq_"+this.get_config("token"),t=this.get_config("api_routes");return this._batcher_configs=this._batcher_configs||{events:{type:"events",endpoint:"/"+t.track,queue_key:e+"_ev"},people:{type:"people",endpoint:"/"+t.engage,queue_key:e+"_pp"},groups:{type:"groups",endpoint:"/"+t.groups,queue_key:e+"_gr"}},this._batcher_configs},oe.prototype.init_batchers=function(){if(!this.are_batchers_initialized()){var e=R.bind(function(n){return new vi(n.queue_key,{libConfig:this.config,errorReporter:this.get_config("error_reporter"),sendRequestFunc:R.bind(function(r,i,o){this._send_request(this.get_config("api_host")+n.endpoint,this._encode_data_for_request(r),i,this._prepare_callback(o,r))},this),beforeSendHook:R.bind(function(r){return this._run_hook("before_send_"+n.type,r)},this),stopAllBatchingFunc:R.bind(this.stop_batch_senders,this),usePersistence:!0})},this),t=this.get_batcher_configs();this.request_batchers={events:e(t.events),people:e(t.people),groups:e(t.groups)}}this.get_config("batch_autostart")&&this.start_batch_senders()},oe.prototype.start_batch_senders=function(){this._batchers_were_started=!0,this.are_batchers_initialized()&&(this._batch_requests=!0,R.each(this.request_batchers,function(e){e.start()}))},oe.prototype.stop_batch_senders=function(){this._batch_requests=!1,R.each(this.request_batchers,function(e){e.stop(),e.clear()})},oe.prototype.push=function(e){this._execute_array([e])},oe.prototype.disable=function(e){typeof e>"u"?this._flags.disable_all_events=!0:this.__disabled_events=this.__disabled_events.concat(e)},oe.prototype._encode_data_for_request=function(e){var t=Vl(e);return this.get_config("api_payload_format")===nT&&(t=R.base64Encode(t)),{data:t}},oe.prototype._track_or_batch=function(e,t){var n=R.truncate(e.data,255),r=e.endpoint,i=e.batcher,o=e.should_send_immediately,a=e.send_request_options||{};t=t||Ma;var u=!0,c=R.bind(function(){return a.skip_hooks||(n=this._run_hook("before_send_"+e.type,n)),n?(zt.log("MIXPANEL REQUEST:"),zt.log(n),this._send_request(r,this._encode_data_for_request(n),a,this._prepare_callback(t,n))):null},this);return this._batch_requests&&!o?i.enqueue(n).then(function(d){d?t(1,n):c()}):u=c(),u&&n},oe.prototype.track=Da(function(e,t,n,r){!r&&typeof n=="function"&&(r=n,n=null),n=n||{};var i=n.transport;i&&(n.transport=i);var o=n.send_immediately;if(typeof r!="function"&&(r=Ma),R.isUndefined(e)){this.report_error("No event name provided to mixpanel.track");return}if(this._event_is_disabled(e)){r(0);return}t=R.extend({},t),t.token=this.get_config("token");var a=this.persistence.remove_event_timer(e);if(!R.isUndefined(a)){var u=new Date().getTime()-a;t.$duration=parseFloat((u/1e3).toFixed(3))}this._set_default_superprops();var c=this.get_config("track_marketing")?R.info.marketingParams():{};t=R.extend({},R.info.properties({mp_loader:this.get_config("mp_loader")}),c,this.persistence.properties(),this.unpersisted_superprops,this.get_session_recording_properties(),t);var d=this.get_config("property_blacklist");R.isArray(d)?R.each(d,function(m){delete t[m]}):this.report_error("Invalid value for property_blacklist config: "+d);var p={event:e,properties:t},h=this._track_or_batch({type:"events",data:p,endpoint:this.get_config("api_host")+"/"+this.get_config("api_routes").track,batcher:this.request_batchers.events,should_send_immediately:o,send_request_options:n},r);return h}),oe.prototype.set_group=Da(function(e,t,n){R.isArray(t)||(t=[t]);var r={};return r[e]=t,this.register(r),this.people.set(e,t,n)}),oe.prototype.add_group=Da(function(e,t,n){var r=this.get_property(e),i={};return r===void 0?(i[e]=[t],this.register(i)):r.indexOf(t)===-1&&(r.push(t),i[e]=r,this.register(i)),this.people.union(e,t,n)}),oe.prototype.remove_group=Da(function(e,t,n){var r=this.get_property(e);if(r!==void 0){var i=r.indexOf(t);i>-1&&(r.splice(i,1),this.register({group_key:r})),r.length===0&&this.unregister(e)}return this.people.remove(e,t,n)}),oe.prototype.track_with_groups=Da(function(e,t,n,r){var i=R.extend({},t||{});return R.each(n,function(o,a){o!=null&&(i[a]=o)}),this.track(e,i,r)}),oe.prototype._create_map_key=function(e,t){return e+"_"+JSON.stringify(t)},oe.prototype._remove_group_from_cache=function(e,t){delete this._cached_groups[this._create_map_key(e,t)]},oe.prototype.get_group=function(e,t){var n=this._create_map_key(e,t),r=this._cached_groups[n];return(r===void 0||r._group_key!==e||r._group_id!==t)&&(r=new gn,r._init(this,e,t),this._cached_groups[n]=r),r},oe.prototype.track_pageview=Da(function(e,t){typeof e!="object"&&(e={}),t=t||{};var n=t.event_name||"$mp_web_page_view",r=R.extend(R.info.mpPageViewProperties(),R.info.campaignParams(),R.info.clickParams()),i=R.extend({},r,e);return this.track(n,i)}),oe.prototype.track_links=function(){return this._track_dom.call(this,Ql,arguments)},oe.prototype.track_forms=function(){return this._track_dom.call(this,zp,arguments)},oe.prototype.time_event=function(e){if(R.isUndefined(e)){this.report_error("No event name provided to mixpanel.time_event");return}this._event_is_disabled(e)||this.persistence.set_event_timer(e,new Date().getTime())};var JV={persistent:!0},c1=function(e){var t;return R.isObject(e)?t=e:R.isUndefined(e)?t={}:t={days:e},R.extend({},JV,t)};oe.prototype.register=function(e,t){var n=c1(t);n.persistent?this.persistence.register(e,n.days):R.extend(this.unpersisted_superprops,e)},oe.prototype.register_once=function(e,t,n){var r=c1(n);r.persistent?this.persistence.register_once(e,t,r.days):(typeof t>"u"&&(t="None"),R.each(e,function(i,o){(!this.unpersisted_superprops.hasOwnProperty(o)||this.unpersisted_superprops[o]===t)&&(this.unpersisted_superprops[o]=i)},this))},oe.prototype.unregister=function(e,t){t=c1(t),t.persistent?this.persistence.unregister(e):delete this.unpersisted_superprops[e]},oe.prototype._register_single=function(e,t){var n={};n[e]=t,this.register(n)},oe.prototype.identify=function(e,t,n,r,i,o,a,u){var c=this.get_distinct_id();if(e&&c!==e){if(typeof e=="string"&&e.indexOf(l1)===0)return this.report_error("distinct_id cannot have $device: prefix"),-1;this.register({$user_id:e})}if(!this.get_property("$device_id")){var d=c;this.register_once({$had_persisted_distinct_id:!0,$device_id:d},"")}e!==c&&e!==this.get_property(qp)&&(this.unregister(qp),this.register({distinct_id:e})),this._flags.identify_called=!0,this.people._flush(t,n,r,i,o,a,u),e!==c&&this.track("$identify",{distinct_id:e,$anon_distinct_id:c},{skip_hooks:!0})},oe.prototype.reset=function(){this.persistence.clear(),this._flags.identify_called=!1;var e=R.UUID();this.register_once({distinct_id:l1+e,$device_id:e},"")},oe.prototype.get_distinct_id=function(){return this.get_property("distinct_id")},oe.prototype.alias=function(e,t){if(e===this.get_property(JO))return this.report_error("Attempting to create alias for existing People user - aborting."),-2;var n=this;return R.isUndefined(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(qp,e),this.track("$create_alias",{alias:e,distinct_id:t},{skip_hooks:!0},function(){n.identify(e)})):(this.report_error("alias matches current distinct_id - skipping api call."),this.identify(e),-1)},oe.prototype.name_tag=function(e){this._register_single("mp_name_tag",e)},oe.prototype.set_config=function(e){if(R.isObject(e)){R.extend(this.config,e);var t=e.batch_size;t&&R.each(this.request_batchers,function(n){n.resetBatchSize()}),this.get_config("persistence_name")||(this.config.persistence_name=this.config.cookie_name),this.get_config("disable_persistence")||(this.config.disable_persistence=this.config.disable_cookie),this.persistence&&this.persistence.update_config(this.config),zi.DEBUG=zi.DEBUG||this.get_config("debug"),"autocapture"in e&&this.autocapture&&this.autocapture.init()}},oe.prototype.get_config=function(e){return this.config[e]},oe.prototype._run_hook=function(e){var t=(this.config.hooks[e]||QV).apply(this,Oa.call(arguments,1));return typeof t>"u"&&(this.report_error(e+" hook did not return a value"),t=null),t},oe.prototype.get_property=function(e){return this.persistence.load_prop([e])},oe.prototype.toString=function(){var e=this.get_config("name");return e!==yi&&(e=yi+"."+e),e},oe.prototype._event_is_disabled=function(e){return R.isBlockedUA($o)||this._flags.disable_all_events||R.include(this.__disabled_events,e)},oe.prototype._gdpr_init=function(){var e=this.get_config("opt_out_tracking_persistence_type")==="localStorage";e&&R.localStorage.is_supported()&&(!this.has_opted_in_tracking()&&this.has_opted_in_tracking({persistence_type:"cookie"})&&this.opt_in_tracking({enable_persistence:!1}),!this.has_opted_out_tracking()&&this.has_opted_out_tracking({persistence_type:"cookie"})&&this.opt_out_tracking({clear_persistence:!1}),this.clear_opt_in_out_tracking({persistence_type:"cookie",enable_persistence:!1})),this.has_opted_out_tracking()?this._gdpr_update_persistence({clear_persistence:!0}):!this.has_opted_in_tracking()&&(this.get_config("opt_out_tracking_by_default")||R.cookie.get("mp_optout"))&&(R.cookie.remove("mp_optout"),this.opt_out_tracking({clear_persistence:this.get_config("opt_out_persistence_by_default")}))},oe.prototype._gdpr_update_persistence=function(e){var t;if(e&&e.clear_persistence)t=!0;else if(e&&e.enable_persistence)t=!1;else return;!this.get_config("disable_persistence")&&this.persistence.disabled!==t&&this.persistence.set_disabled(t),t?(this.stop_batch_senders(),this.stop_session_recording()):this._batchers_were_started&&this.start_batch_senders()},oe.prototype._gdpr_call_func=function(e,t){return t=R.extend({track:R.bind(this.track,this),persistence_type:this.get_config("opt_out_tracking_persistence_type"),cookie_prefix:this.get_config("opt_out_tracking_cookie_prefix"),cookie_expiration:this.get_config("cookie_expiration"),cross_site_cookie:this.get_config("cross_site_cookie"),cross_subdomain_cookie:this.get_config("cross_subdomain_cookie"),cookie_domain:this.get_config("cookie_domain"),secure_cookie:this.get_config("secure_cookie"),ignore_dnt:this.get_config("ignore_dnt")},t),R.localStorage.is_supported()||(t.persistence_type="cookie"),e(this.get_config("token"),{track:t.track,trackEventName:t.track_event_name,trackProperties:t.track_properties,persistenceType:t.persistence_type,persistencePrefix:t.cookie_prefix,cookieDomain:t.cookie_domain,cookieExpiration:t.cookie_expiration,crossSiteCookie:t.cross_site_cookie,crossSubdomainCookie:t.cross_subdomain_cookie,secureCookie:t.secure_cookie,ignoreDnt:t.ignore_dnt})},oe.prototype.opt_in_tracking=function(e){e=R.extend({enable_persistence:!0},e),this._gdpr_call_func(wV,e),this._gdpr_update_persistence(e)},oe.prototype.opt_out_tracking=function(e){e=R.extend({clear_persistence:!0,delete_user:!0},e),e.delete_user&&this.people&&this.people._identify_called()&&(this.people.delete_user(),this.people.clear_charges()),this._gdpr_call_func(xV,e),this._gdpr_update_persistence(e)},oe.prototype.has_opted_in_tracking=function(e){return this._gdpr_call_func(CV,e)},oe.prototype.has_opted_out_tracking=function(e){return this._gdpr_call_func(SO,e)},oe.prototype.clear_opt_in_out_tracking=function(e){e=R.extend({enable_persistence:!0},e),this._gdpr_call_func(EV,e),this._gdpr_update_persistence(e)},oe.prototype.report_error=function(e,t){zt.error.apply(zt.error,arguments);try{!t&&!(e instanceof Error)&&(e=new Error(e)),this.get_config("error_reporter")(e,t)}catch(n){zt.error(n)}},oe.prototype.init=oe.prototype.init,oe.prototype.reset=oe.prototype.reset,oe.prototype.disable=oe.prototype.disable,oe.prototype.time_event=oe.prototype.time_event,oe.prototype.track=oe.prototype.track,oe.prototype.track_links=oe.prototype.track_links,oe.prototype.track_forms=oe.prototype.track_forms,oe.prototype.track_pageview=oe.prototype.track_pageview,oe.prototype.register=oe.prototype.register,oe.prototype.register_once=oe.prototype.register_once,oe.prototype.unregister=oe.prototype.unregister,oe.prototype.identify=oe.prototype.identify,oe.prototype.alias=oe.prototype.alias,oe.prototype.name_tag=oe.prototype.name_tag,oe.prototype.set_config=oe.prototype.set_config,oe.prototype.get_config=oe.prototype.get_config,oe.prototype.get_property=oe.prototype.get_property,oe.prototype.get_distinct_id=oe.prototype.get_distinct_id,oe.prototype.toString=oe.prototype.toString,oe.prototype.opt_out_tracking=oe.prototype.opt_out_tracking,oe.prototype.opt_in_tracking=oe.prototype.opt_in_tracking,oe.prototype.has_opted_out_tracking=oe.prototype.has_opted_out_tracking,oe.prototype.has_opted_in_tracking=oe.prototype.has_opted_in_tracking,oe.prototype.clear_opt_in_out_tracking=oe.prototype.clear_opt_in_out_tracking,oe.prototype.get_group=oe.prototype.get_group,oe.prototype.set_group=oe.prototype.set_group,oe.prototype.add_group=oe.prototype.add_group,oe.prototype.remove_group=oe.prototype.remove_group,oe.prototype.track_with_groups=oe.prototype.track_with_groups,oe.prototype.start_batch_senders=oe.prototype.start_batch_senders,oe.prototype.stop_batch_senders=oe.prototype.stop_batch_senders,oe.prototype.start_session_recording=oe.prototype.start_session_recording,oe.prototype.stop_session_recording=oe.prototype.stop_session_recording,oe.prototype.pause_session_recording=oe.prototype.pause_session_recording,oe.prototype.resume_session_recording=oe.prototype.resume_session_recording,oe.prototype.get_session_recording_properties=oe.prototype.get_session_recording_properties,oe.prototype.get_session_replay_url=oe.prototype.get_session_replay_url,oe.prototype.get_tab_id=oe.prototype.get_tab_id,oe.prototype.DEFAULT_API_ROUTES=iT,oe.prototype.__get_recorder=oe.prototype.__get_recorder,Ct.prototype.properties=Ct.prototype.properties,Ct.prototype.update_search_keyword=Ct.prototype.update_search_keyword,Ct.prototype.update_referrer_info=Ct.prototype.update_referrer_info,Ct.prototype.get_cross_subdomain=Ct.prototype.get_cross_subdomain,Ct.prototype.clear=Ct.prototype.clear;var eu={},eZ=function(){R.each(eu,function(e,t){t!==yi&&(kr[t]=e)}),kr._=R},tZ=function(){kr.init=function(e,t,n){if(n)return kr[n]||(kr[n]=eu[n]=u1(e,t,n),kr[n]._loaded()),kr[n];var r=kr;eu[yi]?r=eu[yi]:e&&(r=u1(e,t,yi),r._loaded(),eu[yi]=r),kr=r,s1===KV&&(Ue[yi]=kr),eZ()}},nZ=function(){function e(){e.done||(e.done=!0,aT=!0,rT=!1,R.each(eu,function(r){r._dom_loaded()}))}function t(){try{Zt.documentElement.doScroll("left")}catch{setTimeout(t,1);return}e()}if(Zt.addEventListener)Zt.readyState==="complete"?e():Zt.addEventListener("DOMContentLoaded",e,!1);else if(Zt.attachEvent){Zt.attachEvent("onreadystatechange",e);var n=!1;try{n=Ue.frameElement===null}catch{}Zt.documentElement.doScroll&&n&&t()}R.register_event(Ue,"load",e,!0)};function rZ(e){return eT=e,s1=tT,kr=new oe,tZ(),kr.init(),nZ(),kr}function iZ(e,t){t()}var Na=rZ(iZ);const so="https://debales.ai",oZ="https://debales-web-app-server-prod.azurewebsites.net",sT={"blossom-and-rhyme-6":"84e28f5a553bc260c8276723d0f365bc","doorbellmount-dea1de94-1728660454527":"f825468f4202c28be0d29c849a997208",artzfolio:"789feea8eb479f2db1144448f6465f7f",minature:"b22ef9c8fdbeb4a297947903891c5fd9","nonetz-3f0b8348-1736183595738":"a19d837ea53890c892a2b351e54afc11",bodytales:"703aa3f61539de0786fa19f82644fa8b",athflex:"b9f412aa0c6991abf8b8e3db70b2a506",www:"2637bf921fb09742d550941fbebe7160","GTK-Restaurant":"dbcb03738f942ec7c968f45833ee47bf","derkins-co-uk":"f109fd32c98dac150ba902bd69feeeed","imemyselfcare-com":"bbbe4af618eeab278a4015b4ddf8827f"},aZ="phc_OKaClHZDmbEpVscrwceWJB5lsMYbMaV586L7pai6ZKD",sZ=e=>({layout:{position:{isLeft:e.isLeft??!1,zIndex:e.zIndex??1e3},height:{option:e.heightOption??"Normal"},responsive:{fullScreenOnMobile:e.fullScreenOnMobile??!0,mobileDisplayMode:e.mobileDisplayMode??"normal"}},colors:{background:e.backgroundColor,font:e.fontColor,supportButtonBackgroundColor:e.supportButtonBackgroundColor??"'#ffa500'",bot:{background:e.botBackgroundColor,message:e.botMessageColor,font:e.botFontColor},user:{message:e.userMessageColor,font:e.userFontColor},header:{font:e.headerFontColor},footer:{background:e.footerBackgroundColor,inputBorder:e.fonterInputBorderColor},cta:{background:e.callToActionBackgroundColor,font:e.callToActionFontColor},suggestedQuestions:{font:e.suggestedQuestionsFontColor,background:e.suggestedQuestionsBackgroundColor,hover:e.suggestedQuestionsHoverColor,crossButton:{color:e.suggestedQuestionsCrossButtonColor,background:e.suggestedQuestionsCrossButtonBackgroundColor},highlight:e.suggestedQuestionsHighlightColor},chatButton:{animation:e.chatButtonBackgroundAnimationColor}},typography:{fontFamily:void 0,fontSize:void 0,lineHeight:void 0},borders:{radius:"4px",width:"1px"},animations:{chatButton:{type:e.chatButtonBackgroundAnimationType??"Ping",enabled:e.enableChatButtonBackgroundAnimation??!1}},branding:{visibility:{showBot:e.show_bot??!0,debalesBranding:e.debales_branding??!0},logo:{removeBackground:e.removeLogoBackground??!1}}});function cr(){const e=sessionStorage.getItem("debalesSessionID");if(e)return e;const t=crypto.randomUUID();return sessionStorage.setItem("debalesSessionID",t),t}function lZ(){return sessionStorage.getItem(dr(sr.LAST_SHOWN_MESSAGE_ID,{botId:window.DebalesChat.projectId}))}function Pa(){const e=localStorage.getItem(dr(sr.USER_INFO));return e?JSON.parse(e):null}function f1(e){localStorage.setItem(dr(sr.USER_INFO),JSON.stringify(e))}function Hp(e){if(e.current){const t=e.current.lastElementChild;if(t)if(window.matchMedia("(max-width: 768px)").matches)e.current.scrollTop=e.current.scrollHeight,setTimeout(()=>{e.current&&(e.current.scrollTop=e.current.scrollHeight)},50);else{const r=e.current.scrollTop,i=t.getBoundingClientRect().bottom+e.current.scrollTop-e.current.clientHeight,o=300,a=performance.now(),u=c=>{const d=c-a,p=Math.min(d/o,1),h=p<.5?4*p*p*p:1-Math.pow(-2*p+2,3)/2;e.current.scrollTop=r+(i-r)*h,p<1&&requestAnimationFrame(u)};requestAnimationFrame(u)}}}function uZ(){return window.location.pathname}function lT(){const e=/test|demo|example|debales/i,t=Pa()??"";return!!(t&&e.test(t.email))}function cZ(e){const t=uZ(),r=Array.from(new Set(e.map(o=>o.path))).filter(o=>new RegExp(`^${o}(/|$)`).test(t));if(r.length>0){r.sort((u,c)=>c.length-u.length);const o=r[0];return e.filter(u=>u.path===o&&u.enable!==!1).sort((u,c)=>(u.sortOrder??0)-(c.sortOrder??0))}return e.filter(o=>o.path==="/"&&o.enable!==!1).sort((o,a)=>(o.sortOrder??0)-(a.sortOrder??0))}const uT=new Set,fZ=e=>{const t=sT[e];if(!t)return console.warn("No Mixpanel token found"),null;if(uT.has(e))return Na;Na.init(t,{debug:!1,track_pageview:!0,persistence:"localStorage"}),console.log("Mixpanel initialized");const n=Pa();return n&&n.email&&Na.identify(n.email),uT.add(e),Na},dZ=async(e,t)=>{if(lT())return;const n=window.DebalesChat.projectId??t.projectId;if(!sT[n]){console.warn("No Mixpanel token found");return}Na.track(e,t)},hZ=()=>{const e=localStorage.getItem("anonymousUserId");if(e)return e;const t=crypto.randomUUID();return localStorage.setItem("anonymousUserId",t),t};function pZ(e){return e?e.split("<br>").filter(n=>n.trim().length>0).map(n=>n.trim()):[""]}const fr=e=>e.toLowerCase().includes("gaiabay")||e.toLowerCase().includes("debales-testing"),gZ=e=>{const t=e.findIndex(o=>o.type==="dynamic");if(t===-1)return e;const n=e.filter(o=>o.type==="static"),r=e.filter(o=>o.type==="dynamic");return[...n.slice(0,t),r,...n.slice(t)]};function dr(e,t){return t!=null&&t.botId?`debales_${t.botId}_${e}`:`debales_${e}`}const cT=Y.createContext(null),fT=()=>{const e=Y.useContext(cT);if(!e)throw new Error("useCart must be used within a CartProvider");return e};var mZ="2.0.0",tu="",dT="?",Gp="function",Ba="undefined",nu="object",d1="string",yf="major",Ie="model",Ee="name",Ce="type",Me="vendor",Ae="version",jr="architecture",ru="console",_t="mobile",_n="tablet",Ar="smarttv",_f="wearable",h1="xr",p1="embedded",bf="inapp",hT="user-agent",g1=500,m1="brands",Ns="formFactors",v1="fullVersionList",iu="platform",y1="platformVersion",Vp="bitness",Fa="sec-ch-ua",vZ=Fa+"-full-version-list",yZ=Fa+"-arch",_Z=Fa+"-"+Vp,bZ=Fa+"-form-factors",SZ=Fa+"-"+_t,wZ=Fa+"-"+Ie,pT=Fa+"-"+iu,xZ=pT+"-version",gT=[m1,v1,_t,Ie,iu,y1,jr,Ns,Vp],ri="browser",Fo="cpu",lo="device",Uo="engine",_i="os",ou="result",Zp="Amazon",Sf="Apple",mT="ASUS",vT="BlackBerry",Ps="Google",yT="Huawei",_T="Lenovo",CZ="Honor",_1="LG",Yp="Microsoft",bT="Motorola",wf="Samsung",ST="Sharp",Wp="Sony",b1="Xiaomi",S1="Zebra",au="Mobile ",xf=" Browser",wT="Chrome",Ua="Chromecast",EZ="Edge",Cf="Firefox",Ef="Opera",xT="Facebook",CT="Sogou",w1="Windows",kZ=typeof window!==Ba,Hr=kZ&&window.navigator?window.navigator:void 0,za=Hr&&Hr.userAgentData?Hr.userAgentData:void 0,AZ=function(e,t){var n={},r=t;if(!Qp(t)){r={};for(var i in t)for(var o in t[i])r[o]=t[i][o].concat(r[o]?r[o]:[])}for(var a in e)n[a]=r[a]&&r[a].length%2===0?r[a].concat(e[a]):e[a];return n},Kp=function(e){for(var t={},n=0;n<e.length;n++)t[e[n].toUpperCase()]=e[n];return t},x1=function(e,t){if(typeof e===nu&&e.length>0){for(var n in e)if(zo(e[n])==zo(t))return!0;return!1}return su(e)?zo(t).indexOf(zo(e))!==-1:!1},Qp=function(e,t){for(var n in e)return/^(browser|cpu|device|engine|os)$/.test(n)||(t?Qp(e[n]):!1)},su=function(e){return typeof e===d1},C1=function(e){if(e){for(var t=[],n=Bs(/\\?\"/g,e).split(","),r=0;r<n.length;r++)if(n[r].indexOf(";")>-1){var i=Af(n[r]).split(";v=");t[r]={brand:i[0],version:i[1]}}else t[r]=Af(n[r]);return t}},zo=function(e){return su(e)?e.toLowerCase():e},E1=function(e){return su(e)?Bs(/[^\d\.]/g,e).split(".")[0]:void 0},qo=function(e){for(var t in e){var n=e[t];typeof n==nu&&n.length==2?this[n[0]]=n[1]:this[n]=void 0}return this},Bs=function(e,t){return su(t)?t.replace(e,tu):t},kf=function(e){return Bs(/\\?\"/g,e)},Af=function(e,t){if(su(e))return e=Bs(/^\s\s*/,e),typeof t===Ba?e:e.substring(0,g1)},ET=function(e,t){if(!(!e||!t))for(var n=0,r,i,o,a,u,c;n<t.length&&!u;){var d=t[n],p=t[n+1];for(r=i=0;r<d.length&&!u&&d[r];)if(u=d[r++].exec(e),u)for(o=0;o<p.length;o++)c=u[++i],a=p[o],typeof a===nu&&a.length>0?a.length===2?typeof a[1]==Gp?this[a[0]]=a[1].call(this,c):this[a[0]]=a[1]:a.length===3?typeof a[1]===Gp&&!(a[1].exec&&a[1].test)?this[a[0]]=c?a[1].call(this,c,a[2]):void 0:this[a[0]]=c?c.replace(a[1],a[2]):void 0:a.length===4&&(this[a[0]]=c?a[3].call(this,c.replace(a[1],a[2])):void 0):this[a]=c||void 0;n+=2}},If=function(e,t){for(var n in t)if(typeof t[n]===nu&&t[n].length>0){for(var r=0;r<t[n].length;r++)if(x1(t[n][r],e))return n===dT?void 0:n}else if(x1(t[n],e))return n===dT?void 0:n;return t.hasOwnProperty("*")?t["*"]:e},kT={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2","8.1":"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},AT={embedded:"Automotive",mobile:"Mobile",tablet:["Tablet","EInk"],smarttv:"TV",wearable:"Watch",xr:["VR","XR"],"?":["Desktop","Unknown"],"*":void 0},IT={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[Ae,[Ee,au+"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[Ae,[Ee,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[Ee,Ae],[/opios[\/ ]+([\w\.]+)/i],[Ae,[Ee,Ef+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[Ae,[Ee,Ef+" GX"]],[/\bopr\/([\w\.]+)/i],[Ae,[Ee,Ef]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[Ae,[Ee,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[Ae,[Ee,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon)\/([-\w\.]+)/i,/(heytap|ovi|115)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[Ee,Ae],[/quark(?:pc)?\/([-\w\.]+)/i],[Ae,[Ee,"Quark"]],[/\bddg\/([\w\.]+)/i],[Ae,[Ee,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[Ae,[Ee,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[Ae,[Ee,"WeChat"]],[/konqueror\/([\w\.]+)/i],[Ae,[Ee,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[Ae,[Ee,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[Ae,[Ee,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[Ae,[Ee,"Smart "+_T+xf]],[/(avast|avg)\/([\w\.]+)/i],[[Ee,/(.+)/,"$1 Secure"+xf],Ae],[/\bfocus\/([\w\.]+)/i],[Ae,[Ee,Cf+" Focus"]],[/\bopt\/([\w\.]+)/i],[Ae,[Ee,Ef+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[Ae,[Ee,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[Ae,[Ee,"Dolphin"]],[/coast\/([\w\.]+)/i],[Ae,[Ee,Ef+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[Ae,[Ee,"MIUI"+xf]],[/fxios\/([\w\.-]+)/i],[Ae,[Ee,au+Cf]],[/\bqihoobrowser\/?([\w\.]*)/i],[Ae,[Ee,"360"]],[/\b(qq)\/([\w\.]+)/i],[[Ee,/(.+)/,"$1Browser"],Ae],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[Ee,/(.+)/,"$1"+xf],Ae],[/samsungbrowser\/([\w\.]+)/i],[Ae,[Ee,wf+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[Ae,[Ee,CT+" Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[Ee,CT+" Mobile"],Ae],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[Ee,Ae],[/(lbbrowser|rekonq)/i],[Ee],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[Ae,Ee],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[Ee,xT],Ae,[Ce,bf]],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(instagram|snapchat)[\/ ]([-\w\.]+)/i],[Ee,Ae,[Ce,bf]],[/\bgsa\/([\w\.]+) .*safari\//i],[Ae,[Ee,"GSA"],[Ce,bf]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[Ae,[Ee,"TikTok"],[Ce,bf]],[/\[(linkedin)app\]/i],[Ee,[Ce,bf]],[/(chromium)[\/ ]([-\w\.]+)/i],[Ee,Ae],[/headlesschrome(?:\/([\w\.]+)| )/i],[Ae,[Ee,wT+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[Ee,wT+" WebView"],Ae],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[Ae,[Ee,"Android"+xf]],[/chrome\/([\w\.]+) mobile/i],[Ae,[Ee,au+"Chrome"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[Ee,Ae],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[Ae,[Ee,au+"Safari"]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[Ee,au+"Safari"]],[/version\/([\w\.\,]+) .*(safari)/i],[Ae,Ee],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[Ee,[Ae,"1"]],[/(webkit|khtml)\/([\w\.]+)/i],[Ee,Ae],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[Ee,au+Cf],Ae],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[Ee,"Netscape"],Ae],[/(wolvic|librewolf)\/([\w\.]+)/i],[Ee,Ae],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[Ae,[Ee,Cf+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[Ee,[Ae,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[Ee,[Ae,/[^\d\.]+./,tu]]],cpu:[[/\b(?:(amd|x|x86[-_]?|wow|win)64)\b/i],[[jr,"amd64"]],[/(ia32(?=;))/i,/((?:i[346]|x)86)[;\)]/i],[[jr,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[jr,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[jr,"armhf"]],[/windows (ce|mobile); ppc;/i],[[jr,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[jr,/ower/,tu,zo]],[/(sun4\w)[;\)]/i],[[jr,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[jr,zo]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[Ie,[Me,wf],[Ce,_n]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[Ie,[Me,wf],[Ce,_t]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[Ie,[Me,Sf],[Ce,_t]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[Ie,[Me,Sf],[Ce,_n]],[/(macintosh);/i],[Ie,[Me,Sf]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[Ie,[Me,ST],[Ce,_t]],[/(?:honor)([-\w ]+)[;\)]/i],[Ie,[Me,CZ],[Ce,_t]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[Ie,[Me,yT],[Ce,_n]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[Ie,[Me,yT],[Ce,_t]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i],[[Ie,/_/g," "],[Me,b1],[Ce,_t]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[Ie,/_/g," "],[Me,b1],[Ce,_n]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[Ie,[Me,"OPPO"],[Ce,_t]],[/\b(opd2\d{3}a?) bui/i],[Ie,[Me,"OPPO"],[Ce,_n]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[Ie,[Me,"Vivo"],[Ce,_t]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[Ie,[Me,"Realme"],[Ce,_t]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[Ie,[Me,bT],[Ce,_t]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[Ie,[Me,bT],[Ce,_n]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[Ie,[Me,_1],[Ce,_n]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[Ie,[Me,_1],[Ce,_t]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[Ie,[Me,_T],[Ce,_n]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[Ie,/_/g," "],[Me,"Nokia"],[Ce,_t]],[/(pixel c)\b/i],[Ie,[Me,Ps],[Ce,_n]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[Ie,[Me,Ps],[Ce,_t]],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[Ie,[Me,Wp],[Ce,_t]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[Ie,"Xperia Tablet"],[Me,Wp],[Ce,_n]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[Ie,[Me,"OnePlus"],[Ce,_t]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[Ie,[Me,Zp],[Ce,_n]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[Ie,/(.+)/g,"Fire Phone $1"],[Me,Zp],[Ce,_t]],[/(playbook);[-\w\),; ]+(rim)/i],[Ie,Me,[Ce,_n]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[Ie,[Me,vT],[Ce,_t]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[Ie,[Me,mT],[Ce,_n]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[Ie,[Me,mT],[Ce,_t]],[/(nexus 9)/i],[Ie,[Me,"HTC"],[Ce,_n]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[Me,[Ie,/_/g," "],[Ce,_t]],[/tcl (xess p17aa)/i,/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])(_\w(\w|\w\w))?(\)| bui)/i],[Ie,[Me,"TCL"],[Ce,_n]],[/droid [\w\.]+; (418(?:7d|8v)|5087z|5102l|61(?:02[dh]|25[adfh]|27[ai]|56[dh]|59k|65[ah])|a509dl|t(?:43(?:0w|1[adepqu])|50(?:6d|7[adju])|6(?:09dl|10k|12b|71[efho]|76[hjk])|7(?:66[ahju]|67[hw]|7[045][bh]|71[hk]|73o|76[ho]|79w|81[hks]?|82h|90[bhsy]|99b)|810[hs]))(_\w(\w|\w\w))?(\)| bui)/i],[Ie,[Me,"TCL"],[Ce,_t]],[/(itel) ((\w+))/i],[[Me,zo],Ie,[Ce,If,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[Ie,[Me,"Acer"],[Ce,_n]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[Ie,[Me,"Meizu"],[Ce,_t]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[Ie,[Me,"Ulefone"],[Ce,_t]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[Ie,[Me,"Energizer"],[Ce,_t]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[Ie,[Me,"Cat"],[Ce,_t]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[Ie,[Me,"Smartfren"],[Ce,_t]],[/droid.+; (a(?:015|06[35]|142p?))/i],[Ie,[Me,"Nothing"],[Ce,_t]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (imo) ((?!tab)[\w ]+?)(?: bui|\))/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[Me,Ie,[Ce,_t]],[/(imo) (tab \w+)/i,/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[Me,Ie,[Ce,_n]],[/(surface duo)/i],[Ie,[Me,Yp],[Ce,_n]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[Ie,[Me,"Fairphone"],[Ce,_t]],[/(shield[\w ]+) b/i],[Ie,[Me,"Nvidia"],[Ce,_n]],[/(sprint) (\w+)/i],[Me,Ie,[Ce,_t]],[/(kin\.[onetw]{3})/i],[[Ie,/\./g," "],[Me,Yp],[Ce,_t]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[Ie,[Me,S1],[Ce,_n]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[Ie,[Me,S1],[Ce,_t]],[/smart-tv.+(samsung)/i],[Me,[Ce,Ar]],[/hbbtv.+maple;(\d+)/i],[[Ie,/^/,"SmartTV"],[Me,wf],[Ce,Ar]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[Me,_1],[Ce,Ar]],[/(apple) ?tv/i],[Me,[Ie,Sf+" TV"],[Ce,Ar]],[/crkey.*devicetype\/chromecast/i],[[Ie,Ua+" Third Generation"],[Me,Ps],[Ce,Ar]],[/crkey.*devicetype\/([^/]*)/i],[[Ie,/^/,"Chromecast "],[Me,Ps],[Ce,Ar]],[/fuchsia.*crkey/i],[[Ie,Ua+" Nest Hub"],[Me,Ps],[Ce,Ar]],[/crkey/i],[[Ie,Ua],[Me,Ps],[Ce,Ar]],[/droid.+aft(\w+)( bui|\))/i],[Ie,[Me,Zp],[Ce,Ar]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[Ie,[Me,ST],[Ce,Ar]],[/(bravia[\w ]+)( bui|\))/i],[Ie,[Me,Wp],[Ce,Ar]],[/(mitv-\w{5}) bui/i],[Ie,[Me,b1],[Ce,Ar]],[/Hbbtv.*(technisat) (.*);/i],[Me,Ie,[Ce,Ar]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[Me,Af],[Ie,Af],[Ce,Ar]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[Ce,Ar]],[/(ouya)/i,/(nintendo) (\w+)/i],[Me,Ie,[Ce,ru]],[/droid.+; (shield) bui/i],[Ie,[Me,"Nvidia"],[Ce,ru]],[/(playstation \w+)/i],[Ie,[Me,Wp],[Ce,ru]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[Ie,[Me,Yp],[Ce,ru]],[/\b(sm-[lr]\d\d[05][fnuw]?s?)\b/i],[Ie,[Me,wf],[Ce,_f]],[/((pebble))app/i],[Me,Ie,[Ce,_f]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[Ie,[Me,Sf],[Ce,_f]],[/droid.+; (wt63?0{2,3})\)/i],[Ie,[Me,S1],[Ce,_f]],[/droid.+; (glass) \d/i],[Ie,[Me,Ps],[Ce,h1]],[/(pico) (4|neo3(?: link|pro)?)/i],[Me,Ie,[Ce,h1]],[/; (quest( \d| pro)?)/i],[Ie,[Me,xT],[Ce,h1]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[Me,[Ce,p1]],[/(aeobc)\b/i],[Ie,[Me,Zp],[Ce,p1]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[Ie,[Ce,_t]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[Ie,[Ce,_n]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[Ce,_n]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[Ce,_t]],[/(android[-\w\. ]{0,9});.+buil/i],[Ie,[Me,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[Ae,[Ee,EZ+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[Ee,Ae],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[Ae,[Ee,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[Ee,Ae],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[Ae,Ee]],os:[[/microsoft (windows) (vista|xp)/i],[Ee,Ae],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[Ee,[Ae,If,kT]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[Ae,If,kT],[Ee,w1]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[Ae,/_/g,"."],[Ee,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[Ee,"macOS"],[Ae,/_/g,"."]],[/android ([\d\.]+).*crkey/i],[Ae,[Ee,Ua+" Android"]],[/fuchsia.*crkey\/([\d\.]+)/i],[Ae,[Ee,Ua+" Fuchsia"]],[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],[Ae,[Ee,Ua+" SmartSpeaker"]],[/linux.*crkey\/([\d\.]+)/i],[Ae,[Ee,Ua+" Linux"]],[/crkey\/([\d\.]+)/i],[Ae,[Ee,Ua]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[Ae,Ee],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish|openharmony)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[Ee,Ae],[/\(bb(10);/i],[Ae,[Ee,vT]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[Ae,[Ee,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[Ae,[Ee,Cf+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[Ae,[Ee,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[Ae,[Ee,"watchOS"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[Ee,"Chrome OS"],Ae],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) (\w+)/i,/(xbox); +xbox ([^\);]+)/i,/(pico) .+os([\w\.]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[Ee,Ae],[/(sunos) ?([\w\.\d]*)/i],[[Ee,"Solaris"],Ae],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[Ee,Ae]]},Xp=function(){var e={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}};return qo.call(e.init,[[ri,[Ee,Ae,yf,Ce]],[Fo,[jr]],[lo,[Ce,Ie,Me]],[Uo,[Ee,Ae]],[_i,[Ee,Ae]]]),qo.call(e.isIgnore,[[ri,[Ae,yf]],[Uo,[Ae]],[_i,[Ae]]]),qo.call(e.isIgnoreRgx,[[ri,/ ?browser$/i],[_i,/ ?os$/i]]),qo.call(e.toString,[[ri,[Ee,Ae]],[Fo,[jr]],[lo,[Me,Ie]],[Uo,[Ee,Ae]],[_i,[Ee,Ae]]]),e}(),IZ=function(e,t){var n=Xp.init[t],r=Xp.isIgnore[t]||0,i=Xp.isIgnoreRgx[t]||0,o=Xp.toString[t]||0;function a(){qo.call(this,n)}return a.prototype.getItem=function(){return e},a.prototype.withClientHints=function(){return za?za.getHighEntropyValues(gT).then(function(u){return e.setCH(new RT(u,!1)).parseCH().get()}):e.parseCH().get()},a.prototype.withFeatureCheck=function(){return e.detectFeature().get()},t!=ou&&(a.prototype.is=function(u){var c=!1;for(var d in this)if(this.hasOwnProperty(d)&&!x1(r,d)&&zo(i?Bs(i,this[d]):this[d])==zo(i?Bs(i,u):u)){if(c=!0,u!=Ba)break}else if(u==Ba&&c){c=!c;break}return c},a.prototype.toString=function(){var u=tu;for(var c in o)typeof this[o[c]]!==Ba&&(u+=(u?" ":tu)+this[o[c]]);return u||Ba}),za||(a.prototype.then=function(u){var c=this,d=function(){for(var h in c)c.hasOwnProperty(h)&&(this[h]=c[h])};d.prototype={is:a.prototype.is,toString:a.prototype.toString};var p=new d;return u(p),p}),new a};function RT(e,t){if(e=e||{},qo.call(this,gT),t)qo.call(this,[[m1,C1(e[Fa])],[v1,C1(e[vZ])],[_t,/\?1/.test(e[SZ])],[Ie,kf(e[wZ])],[iu,kf(e[pT])],[y1,kf(e[xZ])],[jr,kf(e[yZ])],[Ns,C1(e[bZ])],[Vp,kf(e[_Z])]]);else for(var n in e)this.hasOwnProperty(n)&&typeof e[n]!==Ba&&(this[n]=e[n])}function OT(e,t,n,r){return this.get=function(i){return i?this.data.hasOwnProperty(i)?this.data[i]:void 0:this.data},this.set=function(i,o){return this.data[i]=o,this},this.setCH=function(i){return this.uaCH=i,this},this.detectFeature=function(){if(Hr&&Hr.userAgent==this.ua)switch(this.itemType){case ri:Hr.brave&&typeof Hr.brave.isBrave==Gp&&this.set(Ee,"Brave");break;case lo:!this.get(Ce)&&za&&za[_t]&&this.set(Ce,_t),this.get(Ie)=="Macintosh"&&Hr&&typeof Hr.standalone!==Ba&&Hr.maxTouchPoints&&Hr.maxTouchPoints>2&&this.set(Ie,"iPad").set(Ce,_n);break;case _i:!this.get(Ee)&&za&&za[iu]&&this.set(Ee,za[iu]);break;case ou:var i=this.data,o=function(a){return i[a].getItem().detectFeature().get()};this.set(ri,o(ri)).set(Fo,o(Fo)).set(lo,o(lo)).set(Uo,o(Uo)).set(_i,o(_i))}return this},this.parseUA=function(){return this.itemType!=ou&&ET.call(this.data,this.ua,this.rgxMap),this.itemType==ri&&this.set(yf,E1(this.get(Ae))),this},this.parseCH=function(){var i=this.uaCH,o=this.rgxMap;switch(this.itemType){case ri:var a=i[v1]||i[m1],u;if(a)for(var c in a){var d=Bs(/(Google|Microsoft) /,a[c].brand||a[c]),p=a[c].version;!/not.a.brand/i.test(d)&&(!u||/chrom/i.test(u)&&!/chromi/i.test(d))&&(this.set(Ee,d).set(Ae,p).set(yf,E1(p)),u=d)}break;case Fo:var h=i[jr];h&&(h&&i[Vp]=="64"&&(h+="64"),ET.call(this.data,h+";",o));break;case lo:if(i[_t]&&this.set(Ce,_t),i[Ie]&&this.set(Ie,i[Ie]),i[Ie]=="Xbox"&&this.set(Ce,ru).set(Me,Yp),i[Ns]){var m;if(typeof i[Ns]!="string")for(var v=0;!m&&v<i[Ns].length;)m=If(i[Ns][v++],AT);else m=If(i[Ns],AT);this.set(Ce,m)}break;case _i:var _=i[iu];if(_){var x=i[y1];_==w1&&(x=parseInt(E1(x),10)>=13?"11":"10"),this.set(Ee,_).set(Ae,x)}this.get(Ee)==w1&&i[Ie]=="Xbox"&&this.set(Ee,"Xbox").set(Ae,void 0);break;case ou:var S=this.data,b=function(C){return S[C].getItem().setCH(i).parseCH().get()};this.set(ri,b(ri)).set(Fo,b(Fo)).set(lo,b(lo)).set(Uo,b(Uo)).set(_i,b(_i))}return this},qo.call(this,[["itemType",e],["ua",t],["uaCH",r],["rgxMap",n],["data",IZ(this,e)]]),this}function jo(e,t,n){if(typeof e===nu?(Qp(e,!0)?(typeof t===nu&&(n=t),t=e):(n=e,t=void 0),e=void 0):typeof e===d1&&!Qp(t,!0)&&(n=t,t=void 0),n&&typeof n.append===Gp){var r={};n.forEach(function(c,d){r[d]=c}),n=r}if(!(this instanceof jo))return new jo(e,t,n).getResult();var i=typeof e===d1?e:n&&n[hT]?n[hT]:Hr&&Hr.userAgent?Hr.userAgent:tu,o=new RT(n,!0),a=t?AZ(IT,t):IT,u=function(c){return c==ou?function(){return new OT(c,i,a,o).set("ua",i).set(ri,this.getBrowser()).set(Fo,this.getCPU()).set(lo,this.getDevice()).set(Uo,this.getEngine()).set(_i,this.getOS()).get()}:function(){return new OT(c,i,a[c],o).parseUA().get()}};return qo.call(this,[["getBrowser",u(ri)],["getCPU",u(Fo)],["getDevice",u(lo)],["getEngine",u(Uo)],["getOS",u(_i)],["getResult",u(ou)],["getUA",function(){return i}],["setUA",function(c){return su(c)&&(i=c.length>g1?Af(c,g1):c),this}]]).setUA(i),this}jo.VERSION=mZ,jo.BROWSER=Kp([Ee,Ae,yf,Ce]),jo.CPU=Kp([jr]),jo.DEVICE=Kp([Ie,Me,Ce,ru,_t,Ar,_n,_f,p1]),jo.ENGINE=jo.OS=Kp([Ee,Ae]);const ki=class ki{constructor(t){tr(this,"config");tr(this,"storedData");tr(this,"deviceInfo");tr(this,"localStorageKey","_dsjfs312313kj3debales_analytics_");this.config=t,this.deviceInfo=this.getDeviceInfo(),this.localStorageKey=t.localStorageKey||this.localStorageKey+this.config.projectName,this.config.testing=t.testing||(()=>!1);const n=localStorage.getItem(this.localStorageKey);if(n)this.storedData=JSON.parse(n),this.config.debug&&console.log("Using Existing Stored data:",this.storedData);else{const r=crypto.randomUUID();this.storedData={projectName:this.config.projectName,anonId:r,distinctId:r},this.config.debug&&console.log("Using New Stored data:",this.storedData),this.updateStorage()}this.config.debug&&console.log("Analytics initialized:",this.storedData)}static init(t){ki.instance||(ki.instance=new ki(t))}static getInstance(){if(!ki.instance)throw new Error("DebalesAnalytics is not initialized. Call init() first.");return ki.instance}static async identify(t,n){return ki.getInstance().identifyInternal(t,n)}static track(t,n){ki.getInstance().trackInternal(t,n)}static getDistinctId(){return ki.getInstance().storedData.distinctId}static getAnonId(){return ki.getInstance().storedData.anonId}async identifyInternal(t,n){try{if(this.config.testing&&this.config.testing())return;let r,i,o;if(n){const{name:c,phone:d,...p}=n;r=c,i=d,o=p}const a={distinctId:this.storedData.distinctId,anonId:[this.storedData.anonId],projectName:this.config.projectName,email:t,name:r,phone:i,properties:o},u=await this.sendRequest("/api/analytic/identify",a);u&&u.success&&u.distinctId&&(this.config.debug&&console.log("identify success new distint id"),this.storedData.distinctId=u.distinctId,this.storedData.email=t,this.updateStorage(),u.isIdentified&&this.trackInternal("identify")),this.config.debug&&console.log("Identify event sent:",a)}catch(r){console.error("Failed to identify user:",r)}}trackInternal(t,n){if(this.config.testing&&this.config.testing())return;const r={projectName:this.config.projectName,distinctId:this.storedData.distinctId,anonId:this.storedData.anonId,eventName:t,osVersion:this.deviceInfo.osVersion,browserVersion:this.deviceInfo.browserVersion,operatingSystem:this.deviceInfo.os,browser:this.deviceInfo.browser,currentUrl:window.location.href,chatId:cr()+this.config.projectName,properties:n};this.sendRequest("/api/analytic/track",r),this.config.debug&&console.log("Track event sent:",r)}updateStorage(){localStorage.setItem(this.localStorageKey,JSON.stringify(this.storedData))}async sendRequest(t,n){try{const r=await fetch(`${so}${t}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);return await r.json()}catch(r){console.error("Failed to send analytics data:",r)}}getDeviceInfo(){const n=new jo().getResult();return{browser:n.browser.name,os:n.os.name,browserVersion:n.browser.version,osVersion:n.os.version}}};tr(ki,"instance",null);let k1=ki;const Fs=k1;var ji,le=typeof window<"u"?window:void 0,Gr=typeof globalThis<"u"?globalThis:le,TT=Array.prototype,MT=TT.forEach,DT=TT.indexOf,ii=Gr==null?void 0:Gr.navigator,He=Gr==null?void 0:Gr.document,Vr=Gr==null?void 0:Gr.location,A1=Gr==null?void 0:Gr.fetch,I1=Gr!=null&&Gr.XMLHttpRequest&&"withCredentials"in new Gr.XMLHttpRequest?Gr.XMLHttpRequest:void 0,LT=Gr==null?void 0:Gr.AbortController,jn=ii==null?void 0:ii.userAgent,pt=le??{},Ho={DEBUG:!1,LIB_VERSION:"1.235.0"},R1="$copy_autocapture",RZ=["$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"];(function(e){e.GZipJS="gzip-js",e.Base64="base64"})(ji||(ji={}));var OZ=["fatal","error","warning","log","info","debug"];function Rt(e,t){return e.indexOf(t)!==-1}var Jp=function(e){return e.trim()},O1=function(e){return e.replace(/^\$/,"")},TZ=Array.isArray,$T=Object.prototype,NT=$T.hasOwnProperty,eg=$T.toString,An=TZ||function(e){return eg.call(e)==="[object Array]"},Hi=e=>typeof e=="function",In=e=>e===Object(e)&&!An(e),lu=e=>{if(In(e)){for(var t in e)if(NT.call(e,t))return!1;return!0}return!1},Fe=e=>e===void 0,Hn=e=>eg.call(e)=="[object String]",T1=e=>Hn(e)&&e.trim().length===0,qa=e=>e===null,Kt=e=>Fe(e)||qa(e),$r=e=>eg.call(e)=="[object Number]",ja=e=>eg.call(e)==="[object Boolean]",MZ=e=>e instanceof FormData,DZ=e=>Rt(RZ,e),PT=e=>{var t={_log:function(n){if(le&&(Ho.DEBUG||pt.POSTHOG_DEBUG)&&!Fe(le.console)&&le.console){for(var r=("__rrweb_original__"in le.console[n])?le.console[n].__rrweb_original__:le.console[n],i=arguments.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];r(e,...o)}},info:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];t._log("log",...r)},warn:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];t._log("warn",...r)},error:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];t._log("error",...r)},critical:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];console.error(e,...r)},uninitializedWarning:n=>{t.error("You must initialize PostHog before calling ".concat(n))},createLogger:n=>PT("".concat(e," ").concat(n))};return t},tt=PT("[PostHog.js]"),Ir=tt.createLogger,LZ=Ir("[ExternalScriptsLoader]"),BT=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return LZ.warn("".concat(t," was requested but loading of external scripts is disabled.")),n("Loading of external scripts is disabled");var r=He==null?void 0:He.querySelectorAll("script");if(r){for(var i=0;i<r.length;i++)if(r[i].src===t)return n()}var o=()=>{if(!He)return n("document not found");var a=He.createElement("script");if(a.type="text/javascript",a.crossOrigin="anonymous",a.src=t,a.onload=d=>n(void 0,d),a.onerror=d=>n(d),e.config.prepare_external_dependency_script&&(a=e.config.prepare_external_dependency_script(a)),!a)return n("prepare_external_dependency_script returned null");var u,c=He.querySelectorAll("body > script");c.length>0?(u=c[0].parentNode)===null||u===void 0||u.insertBefore(a,c[0]):He.body.appendChild(a)};He!=null&&He.body?o():He==null||He.addEventListener("DOMContentLoaded",o)};function FT(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function pe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?FT(Object(n),!0).forEach(function(r){De(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):FT(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function De(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function UT(e,t){if(e==null)return{};var n,r,i=function(a,u){if(a==null)return{};var c,d,p={},h=Object.keys(a);for(d=0;d<h.length;d++)c=h[d],u.indexOf(c)>=0||(p[c]=a[c]);return p}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}pt.__PosthogExtensions__=pt.__PosthogExtensions__||{},pt.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{var r="/static/".concat(t,".js")+"?v=".concat(e.version);if(t==="remote-config"&&(r="/array/".concat(e.config.token,"/config.js")),t==="toolbar"){var i=3e5,o=Math.floor(Date.now()/i)*i;r="".concat(r,"&t=").concat(o)}var a=e.requestRouter.endpointFor("assets",r);BT(e,a,n)},pt.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{var r=e.requestRouter.endpointFor("api",t);BT(e,r,n)};var tg={};function Ha(e,t,n){if(An(e)){if(MT&&e.forEach===MT)e.forEach(t,n);else if("length"in e&&e.length===+e.length){for(var r=0,i=e.length;r<i;r++)if(r in e&&t.call(n,e[r],r)===tg)return}}}function on(e,t,n){if(!Kt(e)){if(An(e))return Ha(e,t,n);if(MZ(e)){for(var r of e.entries())if(t.call(n,r[1],r[0])===tg)return}else for(var i in e)if(NT.call(e,i)&&t.call(n,e[i],i)===tg)return}}var Gn=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return Ha(n,function(i){for(var o in i)i[o]!==void 0&&(e[o]=i[o])}),e},ng=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return Ha(n,function(i){Ha(i,function(o){e.push(o)})}),e};function rg(e){for(var t=Object.keys(e),n=t.length,r=new Array(n);n--;)r[n]=[t[n],e[t[n]]];return r}var zT=function(e){try{return e()}catch{return}},$Z=function(e){return function(){try{for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.apply(this,n)}catch(i){tt.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),tt.critical(i)}}},Rf=function(e){var t={};return on(e,function(n,r){Hn(n)&&n.length>0&&(t[r]=n)}),t};function NZ(e,t){return n=e,r=o=>Hn(o)&&!qa(t)?o.slice(0,t):o,i=new Set,function o(a,u){return a!==Object(a)?r?r(a,u):a:i.has(a)?void 0:(i.add(a),An(a)?(c=[],Ha(a,d=>{c.push(o(d))})):(c={},on(a,(d,p)=>{i.has(d)||(c[p]=o(d,p))})),c);var c}(n);var n,r,i}var PZ=["herokuapp.com","vercel.app","netlify.app"];function BZ(e){var t=e==null?void 0:e.hostname;if(!Hn(t))return!1;var n=t.split(".").slice(-2).join(".");for(var r of PZ)if(n===r)return!1;return!0}function qT(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return e[n]}function Nn(e,t,n,r){var{capture:i=!1,passive:o=!0}=r??{};e==null||e.addEventListener(t,n,{capture:i,passive:o})}var jT="$people_distinct_id",Of="__alias",Tf="__timers",HT="$autocapture_disabled_server_side",M1="$heatmaps_enabled_server_side",GT="$exception_capture_enabled_server_side",VT="$web_vitals_enabled_server_side",ZT="$dead_clicks_enabled_server_side",YT="$web_vitals_allowed_metrics",D1="$session_recording_enabled_server_side",WT="$console_log_recording_enabled_server_side",KT="$session_recording_network_payload_capture",QT="$session_recording_masking",XT="$session_recording_canvas_recording",JT="$replay_sample_rate",eM="$replay_minimum_duration",tM="$replay_script_config",ig="$sesid",Mf="$session_is_sampled",L1="$session_recording_url_trigger_activated_session",$1="$session_recording_event_trigger_activated_session",uu="$enabled_feature_flags",og="$early_access_features",N1="$feature_flag_details",Df="$stored_person_properties",Us="$stored_group_properties",P1="$surveys",ag="$surveys_activated",sg="$flag_call_reported",Go="$user_state",B1="$client_session_props",F1="$capture_rate_limit",U1="$initial_campaign_params",z1="$initial_referrer_info",q1="$initial_person_info",lg="$epp",nM="__POSTHOG_TOOLBAR__",rM="$posthog_cookieless",FZ=[jT,Of,"__cmpns",Tf,D1,M1,ig,uu,Go,og,N1,Us,Df,P1,sg,B1,F1,U1,z1,lg];function iM(e){var t;return e instanceof Element&&(e.id===nM||!((t=e.closest)===null||t===void 0||!t.call(e,".toolbar-global-fade-container")))}function ug(e){return!!e&&e.nodeType===1}function Ga(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function oM(e){return!!e&&e.nodeType===3}function aM(e){return!!e&&e.nodeType===11}function j1(e){return e?Jp(e).split(/\s+/):[]}function sM(e){var t=le==null?void 0:le.location.href;return!!(t&&e&&e.some(n=>t.match(n)))}function cg(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 j1(t)}function lM(e){return Kt(e)?null:Jp(e).split(/(\s+)/).filter(t=>cu(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function fg(e){var t="";return G1(e)&&!fM(e)&&e.childNodes&&e.childNodes.length&&on(e.childNodes,function(n){var r;oM(n)&&n.textContent&&(t+=(r=lM(n.textContent))!==null&&r!==void 0?r:"")}),Jp(t)}function uM(e){return Fe(e.target)?e.srcElement||null:(t=e.target)!==null&&t!==void 0&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var H1=["a","button","form","input","select","textarea","label"];function cM(e){var t=e.parentNode;return!(!t||!ug(t))&&t}function UZ(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,i=arguments.length>4?arguments[4]:void 0;if(!le||!e||Ga(e,"html")||!ug(e)||n!=null&&n.url_allowlist&&!sM(n.url_allowlist)||n!=null&&n.url_ignorelist&&sM(n.url_ignorelist))return!1;if(n!=null&&n.dom_event_allowlist){var o=n.dom_event_allowlist;if(o&&!o.some(v=>t.type===v))return!1}for(var a=!1,u=[e],c=!0,d=e;d.parentNode&&!Ga(d,"body");)if(aM(d.parentNode))u.push(d.parentNode.host),d=d.parentNode.host;else{if(!(c=cM(d)))break;if(r||H1.indexOf(c.tagName.toLowerCase())>-1)a=!0;else{var p=le.getComputedStyle(c);p&&p.getPropertyValue("cursor")==="pointer"&&(a=!0)}u.push(c),d=c}if(!function(v,_){var x=_==null?void 0:_.element_allowlist;if(Fe(x))return!0;var S=function(E){if(x.some(I=>E.tagName.toLowerCase()===I))return{v:!0}};for(var b of v){var C=S(b);if(typeof C=="object")return C.v}return!1}(u,n)||!function(v,_){var x=_==null?void 0:_.css_selector_allowlist;if(Fe(x))return!0;var S=function(E){if(x.some(I=>E.matches(I)))return{v:!0}};for(var b of v){var C=S(b);if(typeof C=="object")return C.v}return!1}(u,n))return!1;var h=le.getComputedStyle(e);if(h&&h.getPropertyValue("cursor")==="pointer"&&t.type==="click")return!0;var m=e.tagName.toLowerCase();switch(m){case"html":return!1;case"form":return(i||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(i||["change","click"]).indexOf(t.type)>=0;default:return a?(i||["click"]).indexOf(t.type)>=0:(i||["click"]).indexOf(t.type)>=0&&(H1.indexOf(m)>-1||e.getAttribute("contenteditable")==="true")}}function G1(e){for(var t=e;t.parentNode&&!Ga(t,"body");t=t.parentNode){var n=cg(t);if(Rt(n,"ph-sensitive")||Rt(n,"ph-no-capture"))return!1}if(Rt(cg(e),"ph-include"))return!0;var r=e.type||"";if(Hn(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var i=e.name||e.id||"";return!(Hn(i)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(i.replace(/[^a-zA-Z0-9]/g,"")))}function fM(e){return!!(Ga(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Ga(e,"select")||Ga(e,"textarea")||e.getAttribute("contenteditable")==="true")}var dM="(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})",zZ=new RegExp("^(?:".concat(dM,")$")),qZ=new RegExp(dM),hM="\\d{3}-?\\d{2}-?\\d{4}",jZ=new RegExp("^(".concat(hM,")$")),HZ=new RegExp("(".concat(hM,")"));function cu(e){var t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];return!(Kt(e)||Hn(e)&&(e=Jp(e),(t?zZ:qZ).test((e||"").replace(/[- ]/g,""))||(t?jZ:HZ).test(e)))}function pM(e){var t=fg(e);return cu(t="".concat(t," ").concat(gM(e)).trim())?t:""}function gM(e){var t="";return e&&e.childNodes&&e.childNodes.length&&on(e.childNodes,function(n){var r;if(n&&((r=n.tagName)===null||r===void 0?void 0:r.toLowerCase())==="span")try{var i=fg(n);t="".concat(t," ").concat(i).trim(),n.childNodes&&n.childNodes.length&&(t="".concat(t," ").concat(gM(n)).trim())}catch(o){tt.error("[AutoCapture]",o)}}),t}function GZ(e){return function(t){var n=t.map(r=>{var i,o,a="";if(r.tag_name&&(a+=r.tag_name),r.attr_class)for(var u of(r.attr_class.sort(),r.attr_class))a+=".".concat(u.replace(/"/g,""));var c=pe(pe(pe(pe({},r.text?{text:r.text}:{}),{},{"nth-child":(i=r.nth_child)!==null&&i!==void 0?i:0,"nth-of-type":(o=r.nth_of_type)!==null&&o!==void 0?o:0},r.href?{href:r.href}:{}),r.attr_id?{attr_id:r.attr_id}:{}),r.attributes),d={};return rg(c).sort((p,h)=>{var[m]=p,[v]=h;return m.localeCompare(v)}).forEach(p=>{var[h,m]=p;return d[mM(h.toString())]=mM(m.toString())}),a+=":",a+=rg(c).map(p=>{var[h,m]=p;return"".concat(h,'="').concat(m,'"')}).join("")});return n.join(";")}(function(t){return t.map(n=>{var r,i,o={text:(r=n.$el_text)===null||r===void 0?void 0:r.slice(0,400),tag_name:n.tag_name,href:(i=n.attr__href)===null||i===void 0?void 0:i.slice(0,2048),attr_class:VZ(n),attr_id:n.attr__id,nth_child:n.nth_child,nth_of_type:n.nth_of_type,attributes:{}};return rg(n).filter(a=>{var[u]=a;return u.indexOf("attr__")===0}).forEach(a=>{var[u,c]=a;return o.attributes[u]=c}),o})}(e))}function mM(e){return e.replace(/"|\\"/g,'\\"')}function VZ(e){var t=e.attr__class;return t?An(t)?t:j1(t):void 0}class vM{constructor(){this.clicks=[]}isRageClick(t,n,r){var i=this.clicks[this.clicks.length-1];if(i&&Math.abs(t-i.x)+Math.abs(n-i.y)<30&&r-i.timestamp<1e3){if(this.clicks.push({x:t,y:n,timestamp:r}),this.clicks.length===3)return!0}else this.clicks=[{x:t,y:n,timestamp:r}];return!1}}var ZZ=["localhost","127.0.0.1"],fu=e=>{var t=He==null?void 0:He.createElement("a");return Fe(t)?null:(t.href=e,t)},YZ=function(e){var t,n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"&",i=[];return on(e,function(o,a){Fe(o)||Fe(a)||a==="undefined"||(t=encodeURIComponent((u=>u instanceof File)(o)?o.name:o.toString()),n=encodeURIComponent(a),i[i.length]=n+"="+t)}),i.join(r)},dg=function(e,t){for(var n,r=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),i=0;i<r.length;i++){var o=r[i].split("=");if(o[0]===t){n=o;break}}if(!An(n)||n.length<2)return"";var a=n[1];try{a=decodeURIComponent(a)}catch{tt.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},V1=function(e,t,n){if(!e||!t||!t.length)return e;for(var r=e.split("#"),i=r[0]||"",o=r[1],a=i.split("?"),u=a[1],c=a[0],d=(u||"").split("&"),p=[],h=0;h<d.length;h++){var m=d[h].split("=");An(m)&&(t.includes(m[0])?p.push(m[0]+"="+n):p.push(d[h]))}var v=c;return u!=null&&(v+="?"+p.join("&")),o!=null&&(v+="#"+o),v},hg=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},yM=Ir("[AutoCapture]");function Z1(e,t){return t.length>e?t.slice(0,e)+"...":t}function WZ(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!ug(t));return t}function KZ(e,t,n,r){var i=e.tagName.toLowerCase(),o={tag_name:i};H1.indexOf(i)>-1&&!n&&(i.toLowerCase()==="a"||i.toLowerCase()==="button"?o.$el_text=Z1(1024,pM(e)):o.$el_text=Z1(1024,fg(e)));var a=cg(e);a.length>0&&(o.classes=a.filter(function(p){return p!==""})),on(e.attributes,function(p){var h;if((!fM(e)||["name","id","class","aria-label"].indexOf(p.name)!==-1)&&(r==null||!r.includes(p.name))&&!t&&cu(p.value)&&(h=p.name,!Hn(h)||h.substring(0,10)!=="_ngcontent"&&h.substring(0,7)!=="_nghost")){var m=p.value;p.name==="class"&&(m=j1(m).join(" ")),o["attr__"+p.name]=Z1(1024,m)}});for(var u=1,c=1,d=e;d=WZ(d);)u++,d.tagName===e.tagName&&c++;return o.nth_child=u,o.nth_of_type=c,o}function QZ(e,t){for(var n,r,{e:i,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:u,elementsChainAsString:c}=t,d=[e],p=e;p.parentNode&&!Ga(p,"body");)aM(p.parentNode)?(d.push(p.parentNode.host),p=p.parentNode.host):(d.push(p.parentNode),p=p.parentNode);var h,m=[],v={},_=!1,x=!1;if(on(d,I=>{var O=G1(I);I.tagName.toLowerCase()==="a"&&(_=I.getAttribute("href"),_=O&&_&&cu(_)&&_),Rt(cg(I),"ph-no-capture")&&(x=!0),m.push(KZ(I,o,a,u));var T=function($){if(!G1($))return{};var F={};return on($.attributes,function(q){if(q.name&&q.name.indexOf("data-ph-capture-attribute")===0){var P=q.name.replace("data-ph-capture-attribute-",""),G=q.value;P&&G&&cu(G)&&(F[P]=G)}}),F}(I);Gn(v,T)}),x)return{props:{},explicitNoCapture:x};if(a||(e.tagName.toLowerCase()==="a"||e.tagName.toLowerCase()==="button"?m[0].$el_text=pM(e):m[0].$el_text=fg(e)),_){var S,b;m[0].attr__href=_;var C=(S=fu(_))===null||S===void 0?void 0:S.host,E=le==null||(b=le.location)===null||b===void 0?void 0:b.host;C&&E&&C!==E&&(h=_)}return{props:Gn({$event_type:i.type,$ce_version:1},c?{}:{$elements:m},{$elements_chain:GZ(m)},(n=m[0])!==null&&n!==void 0&&n.$el_text?{$el_text:(r=m[0])===null||r===void 0?void 0:r.$el_text}:{},h&&i.type==="click"?{$external_click_url:h}:{},v)}}class XZ{constructor(t){De(this,"_initialized",!1),De(this,"_isDisabledServerSide",null),De(this,"rageclicks",new vM),De(this,"_elementsChainAsString",!1),this.instance=t,this._elementSelectors=null}get config(){var t,n,r=In(this.instance.config.autocapture)?this.instance.config.autocapture:{};return r.url_allowlist=(t=r.url_allowlist)===null||t===void 0?void 0:t.map(i=>new RegExp(i)),r.url_ignorelist=(n=r.url_ignorelist)===null||n===void 0?void 0:n.map(i=>new RegExp(i)),r}_addDomEventHandlers(){if(this.isBrowserSupported()){if(le&&He){var t=r=>{r=r||(le==null?void 0:le.event);try{this._captureEvent(r)}catch(i){yM.error("Failed to capture event",i)}};if(Nn(He,"submit",t,{capture:!0}),Nn(He,"change",t,{capture:!0}),Nn(He,"click",t,{capture:!0}),this.config.capture_copied_text){var n=r=>{r=r||(le==null?void 0:le.event),this._captureEvent(r,R1)};Nn(He,"copy",n,{capture:!0}),Nn(He,"cut",n,{capture:!0})}}}else yM.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this._initialized&&(this._addDomEventHandlers(),this._initialized=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this._elementsChainAsString=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[HT]:!!t.autocapture_opt_out}),this._isDisabledServerSide=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this._elementSelectors=t}getElementSelectors(t){var n,r=[];return(n=this._elementSelectors)===null||n===void 0||n.forEach(i=>{var o=He==null?void 0:He.querySelectorAll(i);o==null||o.forEach(a=>{t===a&&r.push(i)})}),r}get isEnabled(){var t,n,r=(t=this.instance.persistence)===null||t===void 0?void 0:t.props[HT],i=this._isDisabledServerSide;if(qa(i)&&!ja(r)&&!this.instance.config.advanced_disable_decide)return!1;var o=(n=this._isDisabledServerSide)!==null&&n!==void 0?n:!!r;return!!this.instance.config.autocapture&&!o}_captureEvent(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"$autocapture";if(this.isEnabled){var r,i=uM(t);oM(i)&&(i=i.parentNode||null),n==="$autocapture"&&t.type==="click"&&t instanceof MouseEvent&&this.instance.config.rageclick&&(r=this.rageclicks)!==null&&r!==void 0&&r.isRageClick(t.clientX,t.clientY,new Date().getTime())&&this._captureEvent(t,"$rageclick");var o=n===R1;if(i&&UZ(i,t,this.config,o,o?["copy","cut"]:void 0)){var{props:a,explicitNoCapture:u}=QZ(i,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.config.element_attribute_ignorelist,elementsChainAsString:this._elementsChainAsString});if(u)return!1;var c=this.getElementSelectors(i);if(c&&c.length>0&&(a.$element_selectors=c),n===R1){var d,p=lM(le==null||(d=le.getSelection())===null||d===void 0?void 0:d.toString()),h=t.type||"clipboard";if(!p)return!1;a.$selected_content=p,a.$copy_type=h}return this.instance.capture(n,a),!0}}}isBrowserSupported(){return Hi(He==null?void 0:He.querySelectorAll)}}Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return $r(e)&&isFinite(e)&&Math.floor(e)===e});var _M="0123456789abcdef";class pg{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,n,r,i){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(i)||t<0||n<0||r<0||i<0||t>0xffffffffffff||n>4095||r>1073741823||i>4294967295)throw new RangeError("invalid field value");var o=new Uint8Array(16);return o[0]=t/Math.pow(2,40),o[1]=t/Math.pow(2,32),o[2]=t/Math.pow(2,24),o[3]=t/Math.pow(2,16),o[4]=t/Math.pow(2,8),o[5]=t,o[6]=112|n>>>8,o[7]=n,o[8]=128|r>>>24,o[9]=r>>>16,o[10]=r>>>8,o[11]=r,o[12]=i>>>24,o[13]=i>>>16,o[14]=i>>>8,o[15]=i,new pg(o)}toString(){for(var t="",n=0;n<this.bytes.length;n++)t=t+_M.charAt(this.bytes[n]>>>4)+_M.charAt(15&this.bytes[n]),n!==3&&n!==5&&n!==7&&n!==9||(t+="-");if(t.length!==36)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new pg(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(var n=0;n<16;n++){var r=this.bytes[n]-t.bytes[n];if(r!==0)return Math.sign(r)}return 0}}class JZ{constructor(){De(this,"timestamp",0),De(this,"counter",0),De(this,"random",new eY)}generate(){var t=this.generateOrAbort();if(Fe(t)){this.timestamp=0;var n=this.generateOrAbort();if(Fe(n))throw new Error("Could not generate UUID after timestamp reset");return n}return t}generateOrAbort(){var t=Date.now();if(t>this.timestamp)this.timestamp=t,this.resetCounter();else{if(!(t+1e4>this.timestamp))return;this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter())}return pg.fromFieldsV7(this.timestamp,Math.trunc(this.counter/Math.pow(2,30)),this.counter&Math.pow(2,30)-1,this.random.nextUint32())}resetCounter(){this.counter=1024*this.random.nextUint32()+(1023&this.random.nextUint32())}}var bM,SM=e=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;t<e.length;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};le&&!Fe(le.crypto)&&crypto.getRandomValues&&(SM=e=>crypto.getRandomValues(e));class eY{constructor(){De(this,"buffer",new Uint32Array(8)),De(this,"cursor",1/0)}nextUint32(){return this.cursor>=this.buffer.length&&(SM(this.buffer),this.cursor=0),this.buffer[this.cursor++]}}var Va=()=>tY().toString(),tY=()=>(bM||(bM=new JZ)).generate(),nY="Thu, 01 Jan 1970 00:00:00 GMT",Lf="",rY=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function iY(e,t){if(t){var n=function(i){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:He;if(Lf)return Lf;if(!o||["localhost","127.0.0.1"].includes(i))return"";for(var a=i.split("."),u=Math.min(a.length,8),c="dmn_chk_"+Va(),d=new RegExp("(^|;)\\s*"+c+"=1");!Lf&&u--;){var p=a.slice(u).join("."),h=c+"=1;domain=."+p;o.cookie=h,d.test(o.cookie)&&(o.cookie=h+";expires="+nY,Lf=p)}return Lf}(e);if(!n){var r=(i=>{var o=i.match(rY);return o?o[0]:""})(e);r!==n&&tt.info("Warning: cookie subdomain discovery mismatch",r,n),n=r}return n?"; domain=."+n:""}return""}var Za,Vo={is_supported:()=>!!He,error:function(e){tt.error("cookieStore error: "+e)},get:function(e){if(He){try{for(var t=e+"=",n=He.cookie.split(";").filter(o=>o.length),r=0;r<n.length;r++){for(var i=n[r];i.charAt(0)==" ";)i=i.substring(1,i.length);if(i.indexOf(t)===0)return decodeURIComponent(i.substring(t.length,i.length))}}catch{}return null}},parse:function(e){var t;try{t=JSON.parse(Vo.get(e))||{}}catch{}return t},set:function(e,t,n,r,i){if(He)try{var o="",a="",u=iY(He.location.hostname,r);if(n){var c=new Date;c.setTime(c.getTime()+24*n*60*60*1e3),o="; expires="+c.toUTCString()}i&&(a="; secure");var d=e+"="+encodeURIComponent(JSON.stringify(t))+o+"; SameSite=Lax; path=/"+u+a;return d.length>3686.4&&tt.warn("cookieStore warning: large cookie, len="+d.length),He.cookie=d,d}catch{return}},remove:function(e,t){try{Vo.set(e,"",-1,t)}catch{return}}},Y1=null,Qn={is_supported:function(){if(!qa(Y1))return Y1;var e=!0;if(Fe(le))e=!1;else try{var t="__mplssupport__";Qn.set(t,"xyz"),Qn.get(t)!=='"xyz"'&&(e=!1),Qn.remove(t)}catch{e=!1}return e||tt.error("localStorage unsupported; falling back to cookie store"),Y1=e,e},error:function(e){tt.error("localStorage error: "+e)},get:function(e){try{return le==null?void 0:le.localStorage.getItem(e)}catch(t){Qn.error(t)}return null},parse:function(e){try{return JSON.parse(Qn.get(e))||{}}catch{}return null},set:function(e,t){try{le==null||le.localStorage.setItem(e,JSON.stringify(t))}catch(n){Qn.error(n)}},remove:function(e){try{le==null||le.localStorage.removeItem(e)}catch(t){Qn.error(t)}}},oY=["distinct_id",ig,Mf,lg,q1],gg=pe(pe({},Qn),{},{parse:function(e){try{var t={};try{t=Vo.parse(e)||{}}catch{}var n=Gn(t,JSON.parse(Qn.get(e)||"{}"));return Qn.set(e,n),n}catch{}return null},set:function(e,t,n,r,i,o){try{Qn.set(e,t,void 0,void 0,o);var a={};oY.forEach(u=>{t[u]&&(a[u]=t[u])}),Object.keys(a).length&&Vo.set(e,a,n,r,i,o)}catch(u){Qn.error(u)}},remove:function(e,t){try{le==null||le.localStorage.removeItem(e),Vo.remove(e,t)}catch(n){Qn.error(n)}}}),mg={},aY={is_supported:function(){return!0},error:function(e){tt.error("memoryStorage error: "+e)},get:function(e){return mg[e]||null},parse:function(e){return mg[e]||null},set:function(e,t){mg[e]=t},remove:function(e){delete mg[e]}},zs=null,hr={is_supported:function(){if(!qa(zs))return zs;if(zs=!0,Fe(le))zs=!1;else try{var e="__support__";hr.set(e,"xyz"),hr.get(e)!=='"xyz"'&&(zs=!1),hr.remove(e)}catch{zs=!1}return zs},error:function(e){tt.error("sessionStorage error: ",e)},get:function(e){try{return le==null?void 0:le.sessionStorage.getItem(e)}catch(t){hr.error(t)}return null},parse:function(e){try{return JSON.parse(hr.get(e))||null}catch{}return null},set:function(e,t){try{le==null||le.sessionStorage.setItem(e,JSON.stringify(t))}catch(n){hr.error(n)}},remove:function(e){try{le==null||le.sessionStorage.removeItem(e)}catch(t){hr.error(t)}}};(function(e){e[e.PENDING=-1]="PENDING",e[e.DENIED=0]="DENIED",e[e.GRANTED=1]="GRANTED"})(Za||(Za={}));class sY{constructor(t){this.instance=t}get config(){return this.instance.config}get consent(){return this.getDnt()?Za.DENIED:this.storedConsent}isOptedOut(){return this.consent===Za.DENIED||this.consent===Za.PENDING&&this.config.opt_out_capturing_by_default}isOptedIn(){return!this.isOptedOut()}optInOut(t){this.storage.set(this.storageKey,t?1:0,this.config.cookie_expiration,this.config.cross_subdomain_cookie,this.config.secure_cookie)}reset(){this.storage.remove(this.storageKey,this.config.cross_subdomain_cookie)}get storageKey(){var{token:t,opt_out_capturing_cookie_prefix:n}=this.instance.config;return(n||"__ph_opt_in_out_")+t}get storedConsent(){var t=this.storage.get(this.storageKey);return t==="1"?Za.GRANTED:t==="0"?Za.DENIED:Za.PENDING}get storage(){if(!this._storage){var t=this.config.opt_out_capturing_persistence_type;this._storage=t==="localStorage"?Qn:Vo;var n=t==="localStorage"?Vo:Qn;n.get(this.storageKey)&&(this._storage.get(this.storageKey)||this.optInOut(n.get(this.storageKey)==="1"),n.remove(this.storageKey,this.config.cross_subdomain_cookie))}return this._storage}getDnt(){return!!this.config.respect_dnt&&!!qT([ii==null?void 0:ii.doNotTrack,ii==null?void 0:ii.msDoNotTrack,pt.doNotTrack],t=>Rt([!0,1,"1","yes"],t))}}var vg=Ir("[Dead Clicks]"),lY=()=>!0,uY=e=>{var t,n=!((t=e.instance.persistence)===null||t===void 0||!t.get_property(ZT)),r=e.instance.config.capture_dead_clicks;return ja(r)?r:n};class wM{get lazyLoadedDeadClicksAutocapture(){return this._lazyLoadedDeadClicksAutocapture}constructor(t,n,r){this.instance=t,this.isEnabled=n,this.onCapture=r,this.startIfEnabled()}onRemoteConfig(t){this.instance.persistence&&this.instance.persistence.register({[ZT]:t==null?void 0:t.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.loadScript(()=>{this.start()})}loadScript(t){var n,r,i;(n=pt.__PosthogExtensions__)!==null&&n!==void 0&&n.initDeadClicksAutocapture&&t(),(r=pt.__PosthogExtensions__)===null||r===void 0||(i=r.loadExternalDependency)===null||i===void 0||i.call(r,this.instance,"dead-clicks-autocapture",o=>{o?vg.error("failed to load script",o):t()})}start(){var t;if(He){if(!this._lazyLoadedDeadClicksAutocapture&&(t=pt.__PosthogExtensions__)!==null&&t!==void 0&&t.initDeadClicksAutocapture){var n=In(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};n.__onCapture=this.onCapture,this._lazyLoadedDeadClicksAutocapture=pt.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this._lazyLoadedDeadClicksAutocapture.start(He),vg.info("starting...")}}else vg.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,vg.info("stopping..."))}}var W1=Ir("[ExceptionAutocapture]");class cY{constructor(t){var n;De(this,"startCapturing",()=>{var r;if(le&&this.isEnabled&&(r=pt.__PosthogExtensions__)!==null&&r!==void 0&&r.errorWrappingFunctions){var i=pt.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,o=pt.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,a=pt.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.unwrapOnError&&this.config.capture_unhandled_errors&&(this.unwrapOnError=i(this.captureException.bind(this))),!this.unwrapUnhandledRejection&&this.config.capture_unhandled_rejections&&(this.unwrapUnhandledRejection=o(this.captureException.bind(this))),!this.unwrapConsoleError&&this.config.capture_console_errors&&(this.unwrapConsoleError=a(this.captureException.bind(this)))}catch(u){W1.error("failed to start",u),this.stopCapturing()}}}),this.instance=t,this.remoteEnabled=!((n=this.instance.persistence)===null||n===void 0||!n.props[GT]),this.config=this.requiredConfig(),this.startIfEnabled()}requiredConfig(){var t=this.instance.config.capture_exceptions,n={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return In(t)?n=pe(pe({},n),t):(Fe(t)?this.remoteEnabled:t)&&(n=pe(pe({},n),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),n}get isEnabled(){return this.config.capture_console_errors||this.config.capture_unhandled_errors||this.config.capture_unhandled_rejections}startIfEnabled(){this.isEnabled&&(W1.info("enabled"),this.loadScript(this.startCapturing))}loadScript(t){var n,r,i;(n=pt.__PosthogExtensions__)!==null&&n!==void 0&&n.errorWrappingFunctions&&t(),(r=pt.__PosthogExtensions__)===null||r===void 0||(i=r.loadExternalDependency)===null||i===void 0||i.call(r,this.instance,"exception-autocapture",o=>{if(o)return W1.error("failed to load script",o);t()})}stopCapturing(){var t,n,r;(t=this.unwrapOnError)===null||t===void 0||t.call(this),this.unwrapOnError=void 0,(n=this.unwrapUnhandledRejection)===null||n===void 0||n.call(this),this.unwrapUnhandledRejection=void 0,(r=this.unwrapConsoleError)===null||r===void 0||r.call(this),this.unwrapConsoleError=void 0}onRemoteConfig(t){var n=t.autocaptureExceptions;this.remoteEnabled=!!n||!1,this.config=this.requiredConfig(),this.instance.persistence&&this.instance.persistence.register({[GT]:this.remoteEnabled}),this.startIfEnabled()}captureException(t){var n=this.instance.requestRouter.endpointFor("ui");t.$exception_personURL="".concat(n,"/project/").concat(this.instance.config.token,"/person/").concat(this.instance.get_distinct_id()),this.instance.exceptions.sendExceptionEvent(t)}}function xM(e){return!Fe(Event)&&CM(e,Event)}function CM(e,t){try{return e instanceof t}catch{return!1}}function yg(e,t){return Object.prototype.toString.call(e)==="[object ".concat(t,"]")}function K1(e){return yg(e,"DOMError")}var EM=/\(error: (.*)\)/,kM=50,du="?";function Q1(e,t,n,r){var i={platform:"web:javascript",filename:e,function:t==="<anonymous>"?du:t,in_app:!0};return Fe(n)||(i.lineno=n),Fe(r)||(i.colno=r),i}var fY=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,dY=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,hY=/\((\S*)(?::(\d+))(?::(\d+))\)/,pY=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,gY=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,mY=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=t.sort((i,o)=>i[0]-o[0]).map(i=>i[1]);return function(i){for(var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=[],u=i.split(`
137
137
  `),c=o;c<u.length;c++){var d=u[c];if(!(d.length>1024)){var p=EM.test(d)?d.replace(EM,"$1"):d;if(!p.match(/\S*Error: /)){for(var h of r){var m=h(p);if(m){a.push(m);break}}if(a.length>=kM)break}}}return function(v){if(!v.length)return[];var _=Array.from(v);return _.reverse(),_.slice(0,kM).map(x=>pe(pe({},x),{},{filename:x.filename||vY(_).filename,function:x.function||du}))}(a)}}([30,e=>{var t=fY.exec(e);if(t){var[,n,r,i]=t;return Q1(n,du,+r,+i)}var o=dY.exec(e);if(o){if(o[2]&&o[2].indexOf("eval")===0){var a=hY.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[u,c]=IM(o[1]||du,o[2]);return Q1(c,u,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}}],[50,e=>{var t=pY.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var n=gY.exec(t[3]);n&&(t[1]=t[1]||"eval",t[3]=n[1],t[4]=n[2],t[5]="")}var r=t[3],i=t[1]||du;return[i,r]=IM(i,r),Q1(r,i,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}]);function vY(e){return e[e.length-1]||{}}var _g,AM,X1,IM=(e,t)=>{var n=e.indexOf("safari-extension")!==-1,r=e.indexOf("safari-web-extension")!==-1;return n||r?[e.indexOf("@")!==-1?e.split("@")[0]:du,n?"safari-extension:".concat(t):"safari-web-extension:".concat(t)]:[e,t]},yY=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;function J1(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=e.stacktrace||e.stack||"",r=function(a){return a&&_Y.test(a.message)?1:0}(e);try{var i=mY,o=function(a,u){var c=function(d){var p=globalThis._posthogChunkIds;if(!p)return{};var h=Object.keys(p);return X1&&h.length===AM||(AM=h.length,X1=h.reduce((m,v)=>{_g||(_g={});var _=_g[v];if(_)m[_[0]]=_[1];else for(var x=d(v),S=x.length-1;S>=0;S--){var b=x[S],C=b==null?void 0:b.filename,E=p[v];if(C&&E){m[C]=E,_g[v]=[C,E];break}}return m},{})),X1}(u);return a.forEach(d=>{d.filename&&(d.chunk_id=c[d.filename])}),a}(i(n,r),i);return o.slice(0,o.length-t)}catch{}return[]}var _Y=/Minified React error #\d+;/i;function eS(e,t){var n,r,i=J1(e),o=(n=t==null?void 0:t.handled)===null||n===void 0||n,a=(r=t==null?void 0:t.synthetic)!==null&&r!==void 0&&r;return{$exception_list:[{type:t!=null&&t.overrideExceptionType?t.overrideExceptionType:e.name,value:function(u){var c=u.message;return c.error&&typeof c.error.message=="string"?String(c.error.message):String(c)}(e),stacktrace:{frames:i,type:"raw"},mechanism:{handled:o,synthetic:a}}],$exception_level:"error"}}function tS(e,t){var n,r,i,o=(n=t==null?void 0:t.handled)===null||n===void 0||n,a=(r=t==null?void 0:t.synthetic)===null||r===void 0||r,u={type:t!=null&&t.overrideExceptionType?t.overrideExceptionType:(i=t==null?void 0:t.defaultExceptionType)!==null&&i!==void 0?i:"Error",value:e||(t==null?void 0:t.defaultExceptionMessage),mechanism:{handled:o,synthetic:a}};if(t!=null&&t.syntheticException){var c=J1(t.syntheticException,1);c.length&&(u.stacktrace={frames:c,type:"raw"})}return{$exception_list:[u],$exception_level:"error"}}function bY(e){return Hn(e)&&!T1(e)&&OZ.indexOf(e)>=0}function SY(e,t){var n,r,i=(n=t==null?void 0:t.handled)===null||n===void 0||n,o=(r=t==null?void 0:t.synthetic)===null||r===void 0||r,a=t!=null&&t.overrideExceptionType?t.overrideExceptionType:xM(e)?e.constructor.name:"Error",u="Non-Error 'exception' captured with keys: ".concat(function(p){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:40,m=Object.keys(p);if(m.sort(),!m.length)return"[object has no keys]";for(var v=m.length;v>0;v--){var _=m.slice(0,v).join(", ");if(!(_.length>h))return v===m.length||_.length<=h?_:"".concat(_.slice(0,h),"...")}return""}(e)),c={type:a,value:u,mechanism:{handled:i,synthetic:o}};if(t!=null&&t.syntheticException){var d=J1(t==null?void 0:t.syntheticException,1);d.length&&(c.stacktrace={frames:d,type:"raw"})}return{$exception_list:[c],$exception_level:bY(e.level)?e.level:"error"}}function wY(e,t){var{error:n,event:r}=e,i={$exception_list:[]},o=n||r;if(K1(o)||function(v){return yg(v,"DOMException")}(o)){var a=o;if(function(v){return"stack"in v}(o))i=eS(o,t);else{var u=a.name||(K1(a)?"DOMError":"DOMException"),c=a.message?"".concat(u,": ").concat(a.message):u,d=K1(a)?"DOMError":"DOMException";i=tS(c,pe(pe({},t),{},{overrideExceptionType:d,defaultExceptionMessage:c}))}return"code"in a&&(i.$exception_DOMException_code="".concat(a.code)),i}if(function(v){return yg(v,"ErrorEvent")}(o)&&o.error)return eS(o.error,t);if(function(v){switch(Object.prototype.toString.call(v)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":return!0;default:return CM(v,Error)}}(o))return eS(o,t);if(function(v){return yg(v,"Object")}(o)||xM(o))return SY(o,t);if(Fe(n)&&Hn(r)){var p="Error",h=r,m=r.match(yY);return m&&(p=m[1],h=m[2]),tS(h,pe(pe({},t),{},{overrideExceptionType:p,defaultExceptionMessage:h}))}return tS(o,t)}function bg(e){var t,n;return((t=JSON.stringify(e,(n=[],function(r,i){if(In(i)){for(;n.length>0&&n[n.length-1]!==this;)n.pop();return n.includes(i)?"[Circular]":(n.push(i),i)}return i})))===null||t===void 0?void 0:t.length)||0}function nS(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:66060288e-1;if(e.size>=t&&e.data.length>1){var n=Math.floor(e.data.length/2),r=e.data.slice(0,n),i=e.data.slice(n);return[nS({size:bg(r),data:r,sessionId:e.sessionId,windowId:e.windowId}),nS({size:bg(i),data:i,sessionId:e.sessionId,windowId:e.windowId})].flatMap(o=>o)}return[e]}var Zo=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(Zo||{}),Gi=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(Gi||{}),rS="[SessionRecording]",iS="redacted",Sg={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:e=>e,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:1e6,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io",".clarity.ms","analytics.google.com"]},xY=["authorization","x-forwarded-for","authorization","cookie","set-cookie","x-api-key","x-real-ip","remote-addr","forwarded","proxy-authorization","x-csrf-token","x-csrftoken","x-xsrf-token"],CY=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],EY=["/s/","/e/","/i/"];function RM(e,t,n,r){if(Kt(e))return e;var i=(t==null?void 0:t["content-length"])||function(o){return new Blob([o]).size}(e);return Hn(i)&&(i=parseInt(i)),i>n?rS+" ".concat(r," body too large to record (").concat(i," bytes)"):e}function OM(e,t){if(Kt(e))return e;var n=e;return cu(n,!1)||(n=rS+" "+t+" body "+iS),on(CY,r=>{var i,o;(i=n)!==null&&i!==void 0&&i.length&&((o=n)===null||o===void 0?void 0:o.indexOf(r))!==-1&&(n=rS+" "+t+" body "+iS+" as might contain: "+r)}),n}var kY=(e,t)=>{var n,r,i,o={payloadSizeLimitBytes:Sg.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...Sg.performanceEntryTypeToObserve],payloadHostDenyList:[...t.payloadHostDenyList||[],...Sg.payloadHostDenyList]},a=e.session_recording.recordHeaders!==!1&&t.recordHeaders,u=e.session_recording.recordBody!==!1&&t.recordBody,c=e.capture_performance!==!1&&t.recordPerformance,d=(n=o,i=Math.min(1e6,(r=n.payloadSizeLimitBytes)!==null&&r!==void 0?r:1e6),m=>(m!=null&&m.requestBody&&(m.requestBody=RM(m.requestBody,m.requestHeaders,i,"Request")),m!=null&&m.responseBody&&(m.responseBody=RM(m.responseBody,m.responseHeaders,i,"Response")),m)),p=m=>{return d(((x,S)=>{var b,C=fu(x.name),E=S.indexOf("http")===0?(b=fu(S))===null||b===void 0?void 0:b.pathname:S;E==="/"&&(E="");var I=C==null?void 0:C.pathname.replace(E||"","");if(!(C&&I&&EY.some(O=>I.indexOf(O)===0)))return x})((_=(v=m).requestHeaders,Kt(_)||on(Object.keys(_??{}),x=>{xY.includes(x.toLowerCase())&&(_[x]=iS)}),v),e.api_host));var v,_},h=Hi(e.session_recording.maskNetworkRequestFn);return h&&Hi(e.session_recording.maskCapturedNetworkRequestFn)&&tt.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),h&&(e.session_recording.maskCapturedNetworkRequestFn=m=>{var v=e.session_recording.maskNetworkRequestFn({url:m.name});return pe(pe({},m),{},{name:v==null?void 0:v.url})}),o.maskRequestFn=Hi(e.session_recording.maskCapturedNetworkRequestFn)?m=>{var v,_,x,S=p(m);return S&&(v=(_=(x=e.session_recording).maskCapturedNetworkRequestFn)===null||_===void 0?void 0:_.call(x,S))!==null&&v!==void 0?v:void 0}:m=>function(v){if(!Fe(v))return v.requestBody=OM(v.requestBody,"Request"),v.responseBody=OM(v.responseBody,"Response"),v}(p(m)),pe(pe(pe({},Sg),o),{},{recordHeaders:a,recordBody:u,recordPerformance:c,recordInitialRequests:c})};function bi(e,t,n,r,i){return t>n&&(tt.warn("min cannot be greater than max."),t=n),$r(e)?e>n?(r&&tt.warn(r+" cannot be greater than max: "+n+". Using max value instead."),n):e<t?(r&&tt.warn(r+" cannot be less than min: "+t+". Using min value instead."),t):e:(r&&tt.warn(r+" must be a number. using max or fallback. max: "+n+", fallback: "+i),bi(i||n,t,n,r))}class AY{constructor(t){var n,r,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};De(this,"bucketSize",100),De(this,"refillRate",10),De(this,"mutationBuckets",{}),De(this,"loggedTracker",{}),De(this,"refillBuckets",()=>{Object.keys(this.mutationBuckets).forEach(o=>{this.mutationBuckets[o]=this.mutationBuckets[o]+this.refillRate,this.mutationBuckets[o]>=this.bucketSize&&delete this.mutationBuckets[o]})}),De(this,"getNodeOrRelevantParent",o=>{var a=this.rrweb.mirror.getNode(o);if((a==null?void 0:a.nodeName)!=="svg"&&a instanceof Element){var u=a.closest("svg");if(u)return[this.rrweb.mirror.getId(u),u]}return[o,a]}),De(this,"numberOfChanges",o=>{var a,u,c,d,p,h,m,v;return((a=(u=o.removes)===null||u===void 0?void 0:u.length)!==null&&a!==void 0?a:0)+((c=(d=o.attributes)===null||d===void 0?void 0:d.length)!==null&&c!==void 0?c:0)+((p=(h=o.texts)===null||h===void 0?void 0:h.length)!==null&&p!==void 0?p:0)+((m=(v=o.adds)===null||v===void 0?void 0:v.length)!==null&&m!==void 0?m:0)}),De(this,"throttleMutations",o=>{if(o.type!==3||o.data.source!==0)return o;var a=o.data,u=this.numberOfChanges(a);a.attributes&&(a.attributes=a.attributes.filter(d=>{var p,h,m,[v,_]=this.getNodeOrRelevantParent(d.id);return this.mutationBuckets[v]===0?!1:(this.mutationBuckets[v]=(p=this.mutationBuckets[v])!==null&&p!==void 0?p:this.bucketSize,this.mutationBuckets[v]=Math.max(this.mutationBuckets[v]-1,0),this.mutationBuckets[v]===0&&(this.loggedTracker[v]||(this.loggedTracker[v]=!0,(h=(m=this.options).onBlockedNode)===null||h===void 0||h.call(m,v,_))),d)}));var c=this.numberOfChanges(a);return c!==0||u===c?o:void 0}),this.rrweb=t,this.options=i,this.refillRate=bi((n=this.options.refillRate)!==null&&n!==void 0?n:this.refillRate,0,100,"mutation throttling refill rate"),this.bucketSize=bi((r=this.options.bucketSize)!==null&&r!==void 0?r:this.bucketSize,0,100,"mutation throttling bucket size"),setInterval(()=>{this.refillBuckets()},1e3)}}var Si=Uint8Array,Zr=Uint16Array,hu=Uint32Array,oS=new Si([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]),aS=new Si([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]),TM=new Si([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),MM=function(e,t){for(var n=new Zr(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var i=new hu(n[30]);for(r=1;r<30;++r)for(var o=n[r];o<n[r+1];++o)i[o]=o-n[r]<<5|r;return[n,i]},DM=MM(oS,2),IY=DM[0],sS=DM[1];IY[28]=258,sS[258]=28;for(var LM=MM(aS,0)[1],$M=new Zr(32768),mn=0;mn<32768;++mn){var qs=(43690&mn)>>>1|(21845&mn)<<1;qs=(61680&(qs=(52428&qs)>>>2|(13107&qs)<<2))>>>4|(3855&qs)<<4,$M[mn]=((65280&qs)>>>8|(255&qs)<<8)>>>1}var $f=function(e,t,n){for(var r=e.length,i=0,o=new Zr(t);i<r;++i)++o[e[i]-1];var a,u=new Zr(t);for(i=0;i<t;++i)u[i]=u[i-1]+o[i-1]<<1;for(a=new Zr(r),i=0;i<r;++i)a[i]=$M[u[e[i]-1]++]>>>15-e[i];return a},js=new Si(288);for(mn=0;mn<144;++mn)js[mn]=8;for(mn=144;mn<256;++mn)js[mn]=9;for(mn=256;mn<280;++mn)js[mn]=7;for(mn=280;mn<288;++mn)js[mn]=8;var wg=new Si(32);for(mn=0;mn<32;++mn)wg[mn]=5;var RY=$f(js,9),OY=$f(wg,5),NM=function(e){return(e/8>>0)+(7&e&&1)},PM=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var r=new(e instanceof Zr?Zr:e instanceof hu?hu:Si)(n-t);return r.set(e.subarray(t,n)),r},Yo=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8},Nf=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8,e[r+2]|=n>>>16},lS=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,o=n.slice();if(!i)return[new Si(0),0];if(i==1){var a=new Si(n[0].s+1);return a[n[0].s]=1,[a,1]}n.sort(function(O,T){return O.f-T.f}),n.push({s:-1,f:25001});var u=n[0],c=n[1],d=0,p=1,h=2;for(n[0]={s:-1,f:u.f+c.f,l:u,r:c};p!=i-1;)u=n[n[d].f<n[h].f?d++:h++],c=n[d!=p&&n[d].f<n[h].f?d++:h++],n[p++]={s:-1,f:u.f+c.f,l:u,r:c};var m=o[0].s;for(r=1;r<i;++r)o[r].s>m&&(m=o[r].s);var v=new Zr(m+1),_=uS(n[p-1],v,0);if(_>t){r=0;var x=0,S=_-t,b=1<<S;for(o.sort(function(O,T){return v[T.s]-v[O.s]||O.f-T.f});r<i;++r){var C=o[r].s;if(!(v[C]>t))break;x+=b-(1<<_-v[C]),v[C]=t}for(x>>>=S;x>0;){var E=o[r].s;v[E]<t?x-=1<<t-v[E]++-1:++r}for(;r>=0&&x;--r){var I=o[r].s;v[I]==t&&(--v[I],++x)}_=t}return[new Si(v),_]},uS=function(e,t,n){return e.s==-1?Math.max(uS(e.l,t,n+1),uS(e.r,t,n+1)):t[e.s]=n},BM=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Zr(++t),r=0,i=e[0],o=1,a=function(c){n[r++]=c},u=1;u<=t;++u)if(e[u]==i&&u!=t)++o;else{if(!i&&o>2){for(;o>138;o-=138)a(32754);o>2&&(a(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(a(i),--o;o>6;o-=6)a(8304);o>2&&(a(o-3<<5|8208),o=0)}for(;o--;)a(i);o=1,i=e[u]}return[n.subarray(0,r),t]},Pf=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},cS=function(e,t,n){var r=n.length,i=NM(t+2);e[i]=255&r,e[i+1]=r>>>8,e[i+2]=255^e[i],e[i+3]=255^e[i+1];for(var o=0;o<r;++o)e[i+o+4]=n[o];return 8*(i+4+r)},FM=function(e,t,n,r,i,o,a,u,c,d,p){Yo(t,p++,n),++i[256];for(var h=lS(i,15),m=h[0],v=h[1],_=lS(o,15),x=_[0],S=_[1],b=BM(m),C=b[0],E=b[1],I=BM(x),O=I[0],T=I[1],$=new Zr(19),F=0;F<C.length;++F)$[31&C[F]]++;for(F=0;F<O.length;++F)$[31&O[F]]++;for(var q=lS($,7),P=q[0],G=q[1],X=19;X>4&&!P[TM[X-1]];--X);var se,V,ne,z,Z=d+5<<3,ce=Pf(i,js)+Pf(o,wg)+a,we=Pf(i,m)+Pf(o,x)+a+14+3*X+Pf($,P)+(2*$[16]+3*$[17]+7*$[18]);if(Z<=ce&&Z<=we)return cS(t,p,e.subarray(c,c+d));if(Yo(t,p,1+(we<ce)),p+=2,we<ce){se=$f(m,v),V=m,ne=$f(x,S),z=x;var k=$f(P,G);for(Yo(t,p,E-257),Yo(t,p+5,T-1),Yo(t,p+10,X-4),p+=14,F=0;F<X;++F)Yo(t,p+3*F,P[TM[F]]);p+=3*X;for(var J=[C,O],ue=0;ue<2;++ue){var L=J[ue];for(F=0;F<L.length;++F){var _e=31&L[F];Yo(t,p,k[_e]),p+=P[_e],_e>15&&(Yo(t,p,L[F]>>>5&127),p+=L[F]>>>12)}}}else se=RY,V=js,ne=OY,z=wg;for(F=0;F<u;++F)if(r[F]>255){_e=r[F]>>>18&31,Nf(t,p,se[_e+257]),p+=V[_e+257],_e>7&&(Yo(t,p,r[F]>>>23&31),p+=oS[_e]);var Te=31&r[F];Nf(t,p,ne[Te]),p+=z[Te],Te>3&&(Nf(t,p,r[F]>>>5&8191),p+=aS[Te])}else Nf(t,p,se[r[F]]),p+=V[r[F]];return Nf(t,p,se[256]),p+V[256]},TY=new hu([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),MY=function(){for(var e=new hu(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),DY=function(){var e=4294967295;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=MY[255&n^t[r]]^n>>>8;e=n},d:function(){return 4294967295^e}}},LY=function(e,t,n,r,i){return function(o,a,u,c,d,p){var h=o.length,m=new Si(c+h+5*(1+Math.floor(h/7e3))+d),v=m.subarray(c,m.length-d),_=0;if(!a||h<8)for(var x=0;x<=h;x+=65535){var S=x+65535;S<h?_=cS(v,_,o.subarray(x,S)):(v[x]=p,_=cS(v,_,o.subarray(x,h)))}else{for(var b=TY[a-1],C=b>>>13,E=8191&b,I=(1<<u)-1,O=new Zr(32768),T=new Zr(I+1),$=Math.ceil(u/3),F=2*$,q=function(nt){return(o[nt]^o[nt+1]<<$^o[nt+2]<<F)&I},P=new hu(25e3),G=new Zr(288),X=new Zr(32),se=0,V=0,ne=(x=0,0),z=0,Z=0;x<h;++x){var ce=q(x),we=32767&x,k=T[ce];if(O[we]=k,T[ce]=we,z<=x){var J=h-x;if((se>7e3||ne>24576)&&J>423){_=FM(o,v,0,P,G,X,V,ne,Z,x-Z,_),ne=se=V=0,Z=x;for(var ue=0;ue<286;++ue)G[ue]=0;for(ue=0;ue<30;++ue)X[ue]=0}var L=2,_e=0,Te=E,de=we-k&32767;if(J>2&&ce==q(x-de))for(var Ke=Math.min(C,J)-1,Pe=Math.min(32767,x),rt=Math.min(258,J);de<=Pe&&--Te&&we!=k;){if(o[x+L]==o[x+L-de]){for(var st=0;st<rt&&o[x+st]==o[x+st-de];++st);if(st>L){if(L=st,_e=de,st>Ke)break;var $e=Math.min(de,st-2),ye=0;for(ue=0;ue<$e;++ue){var ze=x-de+ue+32768&32767,Ge=ze-O[ze]+32768&32767;Ge>ye&&(ye=Ge,k=ze)}}}de+=(we=k)-(k=O[we])+32768&32767}if(_e){P[ne++]=268435456|sS[L]<<18|LM[_e];var lt=31&sS[L],Xe=31&LM[_e];V+=oS[lt]+aS[Xe],++G[257+lt],++X[Xe],z=x+L,++se}else P[ne++]=o[x],++G[o[x]]}}_=FM(o,v,p,P,G,X,V,ne,Z,x-Z,_)}return PM(m,0,c+NM(_)+d)}(e,t.level==null?6:t.level,t.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,n,r,!0)},fS=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},$Y=function(e,t){var n=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:t.level==9?2:0,e[9]=3,t.mtime!=0&&fS(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var r=0;r<=n.length;++r)e[r+10]=n.charCodeAt(r)}},NY=function(e){return 10+(e.filename&&e.filename.length+1||0)};function UM(e,t){t===void 0&&(t={});var n=DY(),r=e.length;n.p(e);var i=LY(e,t,NY(t),8),o=i.length;return $Y(i,t),fS(i,o-8,n.d()),fS(i,o-4,r),i}function zM(e,t){var n=e.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(e);for(var r=new Si(e.length+(e.length>>>1)),i=0,o=function(d){r[i++]=d},a=0;a<n;++a){if(i+5>r.length){var u=new Si(i+8+(n-a<<1));u.set(r),r=u}var c=e.charCodeAt(a);c<128||t?o(c):c<2048?(o(192|c>>>6),o(128|63&c)):c>55295&&c<57344?(o(240|(c=65536+(1047552&c)|1023&e.charCodeAt(++a))>>>18),o(128|c>>>12&63),o(128|c>>>6&63),o(128|63&c)):(o(224|c>>>12),o(128|c>>>6&63),o(128|63&c))}return PM(r,0,i)}function PY(e,t){return function(n){for(var r=0,i=0;i<n.length;i++)r=(r<<5)-r+n.charCodeAt(i),r|=0;return Math.abs(r)}(e)%100<bi(100*t,0,100)}var Bf="[SessionRecording]",Rr=Ir(Bf);function xg(){var e,t;return pt==null||(e=pt.__PosthogExtensions__)===null||e===void 0||(t=e.rrweb)===null||t===void 0?void 0:t.record}var BY=3e5,FY=[Gi.MouseMove,Gi.MouseInteraction,Gi.Scroll,Gi.ViewportResize,Gi.Input,Gi.TouchMove,Gi.MediaInteraction,Gi.Drag],qM=e=>({rrwebMethod:e,enqueuedAt:Date.now(),attempt:1});function Hs(e){return function(t,n){for(var r="",i=0;i<t.length;){var o=t[i++];r+=String.fromCharCode(o)}return r}(UM(zM(JSON.stringify(e))))}function jM(e){return e.type===Zo.Custom&&e.data.tag==="sessionIdle"}function HM(e,t){return t.some(n=>n.matching==="regex"&&new RegExp(n.url).test(e))}class UY{get sessionIdleThresholdMilliseconds(){return this.instance.config.session_recording.session_idle_threshold_ms||3e5}get started(){return this._captureStarted}get sessionManager(){if(!this.instance.sessionManager)throw new Error(Bf+" must be started with a valid sessionManager.");return this.instance.sessionManager}get fullSnapshotIntervalMillis(){var t,n;return this.triggerStatus==="trigger_pending"?6e4:(t=(n=this.instance.config.session_recording)===null||n===void 0?void 0:n.full_snapshot_interval_millis)!==null&&t!==void 0?t:BY}get isSampled(){var t=this.instance.get_property(Mf);return ja(t)?t:null}get sessionDuration(){var t,n,r=(t=this.buffer)===null||t===void 0?void 0:t.data[((n=this.buffer)===null||n===void 0?void 0:n.data.length)-1],{sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0);return r?r.timestamp-i:null}get isRecordingEnabled(){var t=!!this.instance.get_property(D1),n=!this.instance.config.disable_session_recording;return le&&t&&n}get isConsoleLogCaptureEnabled(){var t=!!this.instance.get_property(WT),n=this.instance.config.enable_recording_console_log;return n??t}get canvasRecording(){var t,n,r,i,o,a,u=this.instance.config.session_recording.captureCanvas,c=this.instance.get_property(XT),d=(t=(n=u==null?void 0:u.recordCanvas)!==null&&n!==void 0?n:c==null?void 0:c.enabled)!==null&&t!==void 0&&t,p=(r=(i=u==null?void 0:u.canvasFps)!==null&&i!==void 0?i:c==null?void 0:c.fps)!==null&&r!==void 0?r:4,h=(o=(a=u==null?void 0:u.canvasQuality)!==null&&a!==void 0?a:c==null?void 0:c.quality)!==null&&o!==void 0?o:.4;if(typeof h=="string"){var m=parseFloat(h);h=isNaN(m)?.4:m}return{enabled:d,fps:bi(p,0,12,"canvas recording fps",4),quality:bi(h,0,1,"canvas recording quality",.4)}}get networkPayloadCapture(){var t,n,r=this.instance.get_property(KT),i={recordHeaders:(t=this.instance.config.session_recording)===null||t===void 0?void 0:t.recordHeaders,recordBody:(n=this.instance.config.session_recording)===null||n===void 0?void 0:n.recordBody},o=(i==null?void 0:i.recordHeaders)||(r==null?void 0:r.recordHeaders),a=(i==null?void 0:i.recordBody)||(r==null?void 0:r.recordBody),u=In(this.instance.config.capture_performance)?this.instance.config.capture_performance.network_timing:this.instance.config.capture_performance,c=!!(ja(u)?u:r!=null&&r.capturePerformance);return o||a||c?{recordHeaders:o,recordBody:a,recordPerformance:c}:void 0}get masking(){var t,n,r,i,o,a,u=this.instance.get_property(QT),c={maskAllInputs:(t=this.instance.config.session_recording)===null||t===void 0?void 0:t.maskAllInputs,maskTextSelector:(n=this.instance.config.session_recording)===null||n===void 0?void 0:n.maskTextSelector,blockSelector:(r=this.instance.config.session_recording)===null||r===void 0?void 0:r.blockSelector},d=(i=c==null?void 0:c.maskAllInputs)!==null&&i!==void 0?i:u==null?void 0:u.maskAllInputs,p=(o=c==null?void 0:c.maskTextSelector)!==null&&o!==void 0?o:u==null?void 0:u.maskTextSelector,h=(a=c==null?void 0:c.blockSelector)!==null&&a!==void 0?a:u==null?void 0:u.blockSelector;return Fe(d)&&Fe(p)&&Fe(h)?void 0:{maskAllInputs:d==null||d,maskTextSelector:p,blockSelector:h}}get sampleRate(){var t=this.instance.get_property(JT);return $r(t)?t:null}get minimumDuration(){var t=this.instance.get_property(eM);return $r(t)?t:null}get status(){return this.receivedDecide?this.isRecordingEnabled?this.isSampled===!1?"disabled":this._urlBlocked?"paused":Kt(this._linkedFlag)||this._linkedFlagSeen?this.triggerStatus==="trigger_pending"?"buffering":ja(this.isSampled)?this.isSampled?"sampled":"disabled":"active":"buffering":"disabled":"buffering"}get urlTriggerStatus(){var t;return this._urlTriggers.length===0?"trigger_disabled":((t=this.instance)===null||t===void 0?void 0:t.get_property(L1))===this.sessionId?"trigger_activated":"trigger_pending"}get eventTriggerStatus(){var t;return this._eventTriggers.length===0?"trigger_disabled":((t=this.instance)===null||t===void 0?void 0:t.get_property($1))===this.sessionId?"trigger_activated":"trigger_pending"}get triggerStatus(){var t=this.eventTriggerStatus==="trigger_activated"||this.urlTriggerStatus==="trigger_activated",n=this.eventTriggerStatus==="trigger_pending"||this.urlTriggerStatus==="trigger_pending";return t?"trigger_activated":n?"trigger_pending":"trigger_disabled"}constructor(t){if(De(this,"queuedRRWebEvents",[]),De(this,"isIdle","unknown"),De(this,"_linkedFlagSeen",!1),De(this,"_lastActivityTimestamp",Date.now()),De(this,"_linkedFlag",null),De(this,"_removePageViewCaptureHook",void 0),De(this,"_onSessionIdListener",void 0),De(this,"_persistDecideOnSessionListener",void 0),De(this,"_samplingSessionListener",void 0),De(this,"_urlTriggers",[]),De(this,"_urlBlocklist",[]),De(this,"_urlBlocked",!1),De(this,"_eventTriggers",[]),De(this,"_removeEventTriggerCaptureHook",void 0),De(this,"_forceAllowLocalhostNetworkCapture",!1),De(this,"_onBeforeUnload",()=>{this._flushBuffer()}),De(this,"_onOffline",()=>{this._tryAddCustomEvent("browser offline",{})}),De(this,"_onOnline",()=>{this._tryAddCustomEvent("browser online",{})}),De(this,"_onVisibilityChange",()=>{if(He!=null&&He.visibilityState){var i="window "+He.visibilityState;this._tryAddCustomEvent(i,{})}}),this.instance=t,this._captureStarted=!1,this._endpoint="/s/",this.stopRrweb=void 0,this.receivedDecide=!1,!this.instance.sessionManager)throw Rr.error("started without valid sessionManager"),new Error(Bf+" started without valid sessionManager. This is a bug.");if(this.instance.config.__preview_experimental_cookieless_mode)throw new Error(Bf+" cannot be used with __preview_experimental_cookieless_mode.");var{sessionId:n,windowId:r}=this.sessionManager.checkAndGetSessionAndWindowId();this.sessionId=n,this.windowId=r,this.buffer=this.clearBuffer(),this.sessionIdleThresholdMilliseconds>=this.sessionManager.sessionTimeoutMs&&Rr.warn("session_idle_threshold_ms (".concat(this.sessionIdleThresholdMilliseconds,") is greater than the session timeout (").concat(this.sessionManager.sessionTimeoutMs,"). Session will never be detected as idle"))}startIfEnabledOrStop(t){this.isRecordingEnabled?(this._startCapture(t),Nn(le,"beforeunload",this._onBeforeUnload),Nn(le,"offline",this._onOffline),Nn(le,"online",this._onOnline),Nn(le,"visibilitychange",this._onVisibilityChange),this._setupSampling(),this._addEventTriggerListener(),Kt(this._removePageViewCaptureHook)&&(this._removePageViewCaptureHook=this.instance.on("eventCaptured",n=>{try{if(n.event==="$pageview"){var r=n!=null&&n.properties.$current_url?this._maskUrl(n==null?void 0:n.properties.$current_url):"";if(!r)return;this._tryAddCustomEvent("$pageview",{href:r})}}catch(i){Rr.error("Could not add $pageview to rrweb session",i)}})),this._onSessionIdListener||(this._onSessionIdListener=this.sessionManager.onSessionId((n,r,i)=>{var o,a,u,c;i&&(this._tryAddCustomEvent("$session_id_change",{sessionId:n,windowId:r,changeReason:i}),(o=this.instance)===null||o===void 0||(a=o.persistence)===null||a===void 0||a.unregister($1),(u=this.instance)===null||u===void 0||(c=u.persistence)===null||c===void 0||c.unregister(L1))}))):this.stopRecording()}stopRecording(){var t,n,r,i;this._captureStarted&&this.stopRrweb&&(this.stopRrweb(),this.stopRrweb=void 0,this._captureStarted=!1,le==null||le.removeEventListener("beforeunload",this._onBeforeUnload),le==null||le.removeEventListener("offline",this._onOffline),le==null||le.removeEventListener("online",this._onOnline),le==null||le.removeEventListener("visibilitychange",this._onVisibilityChange),this.clearBuffer(),clearInterval(this._fullSnapshotTimer),(t=this._removePageViewCaptureHook)===null||t===void 0||t.call(this),this._removePageViewCaptureHook=void 0,(n=this._removeEventTriggerCaptureHook)===null||n===void 0||n.call(this),this._removeEventTriggerCaptureHook=void 0,(r=this._onSessionIdListener)===null||r===void 0||r.call(this),this._onSessionIdListener=void 0,(i=this._samplingSessionListener)===null||i===void 0||i.call(this),this._samplingSessionListener=void 0,Rr.info("stopped"))}_resetSampling(){var t;(t=this.instance.persistence)===null||t===void 0||t.unregister(Mf)}makeSamplingDecision(t){var n,r=this.sessionId!==t,i=this.sampleRate;if($r(i)){var o=this.isSampled,a=r||!ja(o),u=a?PY(t,i):o;a&&(u?this._reportStarted("sampled"):Rr.warn("Sample rate (".concat(i,") has determined that this sessionId (").concat(t,") will not be sent to the server.")),this._tryAddCustomEvent("samplingDecisionMade",{sampleRate:i,isSampled:u})),(n=this.instance.persistence)===null||n===void 0||n.register({[Mf]:u})}else this._resetSampling()}onRemoteConfig(t){var n,r,i,o,a,u;if(this._tryAddCustomEvent("$remote_config_received",t),this._persistRemoteConfig(t),this._linkedFlag=((n=t.sessionRecording)===null||n===void 0?void 0:n.linkedFlag)||null,(r=t.sessionRecording)!==null&&r!==void 0&&r.endpoint&&(this._endpoint=(u=t.sessionRecording)===null||u===void 0?void 0:u.endpoint),this._setupSampling(),!Kt(this._linkedFlag)&&!this._linkedFlagSeen){var c=Hn(this._linkedFlag)?this._linkedFlag:this._linkedFlag.flag,d=Hn(this._linkedFlag)?null:this._linkedFlag.variant;this.instance.onFeatureFlags((p,h)=>{var m=In(h)&&c in h,v=d?h[c]===d:m;v&&this._reportStarted("linked_flag_matched",{linkedFlag:c,linkedVariant:d}),this._linkedFlagSeen=v})}(i=t.sessionRecording)!==null&&i!==void 0&&i.urlTriggers&&(this._urlTriggers=t.sessionRecording.urlTriggers),(o=t.sessionRecording)!==null&&o!==void 0&&o.urlBlocklist&&(this._urlBlocklist=t.sessionRecording.urlBlocklist),(a=t.sessionRecording)!==null&&a!==void 0&&a.eventTriggers&&(this._eventTriggers=t.sessionRecording.eventTriggers),this.receivedDecide=!0,this.startIfEnabledOrStop()}_setupSampling(){$r(this.sampleRate)&&Kt(this._samplingSessionListener)&&(this._samplingSessionListener=this.sessionManager.onSessionId(t=>{this.makeSamplingDecision(t)}))}_persistRemoteConfig(t){if(this.instance.persistence){var n,r=this.instance.persistence,i=()=>{var o,a,u,c,d,p,h,m,v,_=(o=t.sessionRecording)===null||o===void 0?void 0:o.sampleRate,x=Kt(_)?null:parseFloat(_);Kt(x)&&this._resetSampling();var S=(a=t.sessionRecording)===null||a===void 0?void 0:a.minimumDurationMilliseconds;r.register({[D1]:!!t.sessionRecording,[WT]:(u=t.sessionRecording)===null||u===void 0?void 0:u.consoleLogRecordingEnabled,[KT]:pe({capturePerformance:t.capturePerformance},(c=t.sessionRecording)===null||c===void 0?void 0:c.networkPayloadCapture),[QT]:(d=t.sessionRecording)===null||d===void 0?void 0:d.masking,[XT]:{enabled:(p=t.sessionRecording)===null||p===void 0?void 0:p.recordCanvas,fps:(h=t.sessionRecording)===null||h===void 0?void 0:h.canvasFps,quality:(m=t.sessionRecording)===null||m===void 0?void 0:m.canvasQuality},[JT]:x,[eM]:Fe(S)?null:S,[tM]:(v=t.sessionRecording)===null||v===void 0?void 0:v.scriptConfig})};i(),(n=this._persistDecideOnSessionListener)===null||n===void 0||n.call(this),this._persistDecideOnSessionListener=this.sessionManager.onSessionId(i)}}log(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"log";(n=this.instance.sessionRecording)===null||n===void 0||n.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:r,trace:[],payload:[JSON.stringify(t)]}},timestamp:Date.now()})}_startCapture(t){if(!Fe(Object.assign)&&!Fe(Array.from)&&!(this._captureStarted||this.instance.config.disable_session_recording||this.instance.consent.isOptedOut())){var n,r;this._captureStarted=!0,this.sessionManager.checkAndGetSessionAndWindowId(),xg()?this._onScriptLoaded():(n=pt.__PosthogExtensions__)===null||n===void 0||(r=n.loadExternalDependency)===null||r===void 0||r.call(n,this.instance,this.scriptName,i=>{if(i)return Rr.error("could not load recorder",i);this._onScriptLoaded()}),Rr.info("starting"),this.status==="active"&&this._reportStarted(t||"recording_initialized")}}get scriptName(){var t,n,r;return((t=this.instance)===null||t===void 0||(n=t.persistence)===null||n===void 0||(r=n.get_property(tM))===null||r===void 0?void 0:r.script)||"recorder"}isInteractiveEvent(t){var n;return t.type===3&&FY.indexOf((n=t.data)===null||n===void 0?void 0:n.source)!==-1}_updateWindowAndSessionIds(t){var n=this.isInteractiveEvent(t);n||this.isIdle||t.timestamp-this._lastActivityTimestamp>this.sessionIdleThresholdMilliseconds&&(this.isIdle=!0,clearInterval(this._fullSnapshotTimer),this._tryAddCustomEvent("sessionIdle",{eventTimestamp:t.timestamp,lastActivityTimestamp:this._lastActivityTimestamp,threshold:this.sessionIdleThresholdMilliseconds,bufferLength:this.buffer.data.length,bufferSize:this.buffer.size}),this._flushBuffer());var r=!1;if(n&&(this._lastActivityTimestamp=t.timestamp,this.isIdle)){var i=this.isIdle==="unknown";this.isIdle=!1,i||(this._tryAddCustomEvent("sessionNoLongerIdle",{reason:"user activity",type:t.type}),r=!0)}if(!this.isIdle){var{windowId:o,sessionId:a}=this.sessionManager.checkAndGetSessionAndWindowId(!n,t.timestamp),u=this.sessionId!==a,c=this.windowId!==o;this.windowId=o,this.sessionId=a,u||c?(this.stopRecording(),this.startIfEnabledOrStop("session_id_changed")):r&&this._scheduleFullSnapshot()}}_tryRRWebMethod(t){try{return t.rrwebMethod(),!0}catch(n){return this.queuedRRWebEvents.length<10?this.queuedRRWebEvents.push({enqueuedAt:t.enqueuedAt||Date.now(),attempt:t.attempt++,rrwebMethod:t.rrwebMethod}):Rr.warn("could not emit queued rrweb event.",n,t),!1}}_tryAddCustomEvent(t,n){return this._tryRRWebMethod(qM(()=>xg().addCustomEvent(t,n)))}_tryTakeFullSnapshot(){return this._tryRRWebMethod(qM(()=>xg().takeFullSnapshot()))}_onScriptLoaded(){var t,n,r,i,o={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1},a=this.instance.config.session_recording;for(var[u,c]of Object.entries(a||{}))u in o&&(u==="maskInputOptions"?o.maskInputOptions=pe({password:!0},c):o[u]=c);this.canvasRecording&&this.canvasRecording.enabled&&(o.recordCanvas=!0,o.sampling={canvas:this.canvasRecording.fps},o.dataURLOptions={type:"image/webp",quality:this.canvasRecording.quality}),this.masking&&(o.maskAllInputs=(n=this.masking.maskAllInputs)===null||n===void 0||n,o.maskTextSelector=(r=this.masking.maskTextSelector)!==null&&r!==void 0?r:void 0,o.blockSelector=(i=this.masking.blockSelector)!==null&&i!==void 0?i:void 0);var d=xg();if(d){this.mutationRateLimiter=(t=this.mutationRateLimiter)!==null&&t!==void 0?t:new AY(d,{refillRate:this.instance.config.session_recording.__mutationRateLimiterRefillRate,bucketSize:this.instance.config.session_recording.__mutationRateLimiterBucketSize,onBlockedNode:(h,m)=>{var v="Too many mutations on node '".concat(h,"'. Rate limiting. This could be due to SVG animations or something similar");Rr.info(v,{node:m}),this.log(Bf+" "+v,"warn")}});var p=this._gatherRRWebPlugins();this.stopRrweb=d(pe({emit:h=>{this.onRRwebEmit(h)},plugins:p},o)),this._lastActivityTimestamp=Date.now(),this.isIdle=ja(this.isIdle)?this.isIdle:"unknown",this._tryAddCustomEvent("$session_options",{sessionRecordingOptions:o,activePlugins:p.map(h=>h==null?void 0:h.name)}),this._tryAddCustomEvent("$posthog_config",{config:this.instance.config})}else Rr.error("onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.")}_scheduleFullSnapshot(){if(this._fullSnapshotTimer&&clearInterval(this._fullSnapshotTimer),this.isIdle!==!0){var t=this.fullSnapshotIntervalMillis;t&&(this._fullSnapshotTimer=setInterval(()=>{this._tryTakeFullSnapshot()},t))}}_gatherRRWebPlugins(){var t,n,r,i,o=[],a=(t=pt.__PosthogExtensions__)===null||t===void 0||(n=t.rrwebPlugins)===null||n===void 0?void 0:n.getRecordConsolePlugin;a&&this.isConsoleLogCaptureEnabled&&o.push(a());var u=(r=pt.__PosthogExtensions__)===null||r===void 0||(i=r.rrwebPlugins)===null||i===void 0?void 0:i.getRecordNetworkPlugin;return this.networkPayloadCapture&&Hi(u)&&(!ZZ.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?o.push(u(kY(this.instance.config,this.networkPayloadCapture))):Rr.info("NetworkCapture not started because we are on localhost.")),o}onRRwebEmit(t){var n;if(this._processQueuedEvents(),t&&In(t)){if(t.type===Zo.Meta){var r=this._maskUrl(t.data.href);if(this._lastHref=r,!r)return;t.data.href=r}else this._pageViewFallBack();if(this._checkUrlTriggerConditions(),!this._urlBlocked||function(h){return h.type===Zo.Custom&&h.data.tag==="recording paused"}(t)){t.type===Zo.FullSnapshot&&this._scheduleFullSnapshot(),t.type===Zo.FullSnapshot&&this.triggerStatus==="trigger_pending"&&this.clearBuffer();var i=this.mutationRateLimiter?this.mutationRateLimiter.throttleMutations(t):t;if(i){var o=function(h){var m=h;if(m&&In(m)&&m.type===6&&In(m.data)&&m.data.plugin==="rrweb/console@1"){m.data.payload.payload.length>10&&(m.data.payload.payload=m.data.payload.payload.slice(0,10),m.data.payload.payload.push("...[truncated]"));for(var v=[],_=0;_<m.data.payload.payload.length;_++)m.data.payload.payload[_]&&m.data.payload.payload[_].length>2e3?v.push(m.data.payload.payload[_].slice(0,2e3)+"...[truncated]"):v.push(m.data.payload.payload[_]);return m.data.payload.payload=v,h}return h}(i);if(this._updateWindowAndSessionIds(o),this.isIdle!==!0||jM(o)){if(jM(o)){var a=o.data.payload;if(a){var u=a.lastActivityTimestamp,c=a.threshold;o.timestamp=u+c}}var d=(n=this.instance.config.session_recording.compress_events)===null||n===void 0||n?function(h){if(bg(h)<1024)return h;try{if(h.type===Zo.FullSnapshot)return pe(pe({},h),{},{data:Hs(h.data),cv:"2024-10"});if(h.type===Zo.IncrementalSnapshot&&h.data.source===Gi.Mutation)return pe(pe({},h),{},{cv:"2024-10",data:pe(pe({},h.data),{},{texts:Hs(h.data.texts),attributes:Hs(h.data.attributes),removes:Hs(h.data.removes),adds:Hs(h.data.adds)})});if(h.type===Zo.IncrementalSnapshot&&h.data.source===Gi.StyleSheetRule)return pe(pe({},h),{},{cv:"2024-10",data:pe(pe({},h.data),{},{adds:h.data.adds?Hs(h.data.adds):void 0,removes:h.data.removes?Hs(h.data.removes):void 0})})}catch(m){Rr.error("could not compress event - will use uncompressed event",m)}return h}(o):o,p={$snapshot_bytes:bg(d),$snapshot_data:d,$session_id:this.sessionId,$window_id:this.windowId};this.status!=="disabled"?this._captureSnapshotBuffered(p):this.clearBuffer()}}}}}_pageViewFallBack(){if(!this.instance.config.capture_pageview&&le){var t=this._maskUrl(le.location.href);this._lastHref!==t&&(this._tryAddCustomEvent("$url_changed",{href:t}),this._lastHref=t)}}_processQueuedEvents(){if(this.queuedRRWebEvents.length){var t=[...this.queuedRRWebEvents];this.queuedRRWebEvents=[],t.forEach(n=>{Date.now()-n.enqueuedAt<=2e3&&this._tryRRWebMethod(n)})}}_maskUrl(t){var n=this.instance.config.session_recording;if(n.maskNetworkRequestFn){var r,i={url:t};return(r=i=n.maskNetworkRequestFn(i))===null||r===void 0?void 0:r.url}return t}clearBuffer(){return this.buffer={size:0,data:[],sessionId:this.sessionId,windowId:this.windowId},this.buffer}_flushBuffer(){this.flushBufferTimer&&(clearTimeout(this.flushBufferTimer),this.flushBufferTimer=void 0);var t=this.minimumDuration,n=this.sessionDuration,r=$r(n)&&n>=0,i=$r(t)&&r&&n<t;return this.status==="buffering"||this.status==="paused"||this.status==="disabled"||i?(this.flushBufferTimer=setTimeout(()=>{this._flushBuffer()},2e3),this.buffer):(this.buffer.data.length>0&&nS(this.buffer).forEach(o=>{this._captureSnapshot({$snapshot_bytes:o.size,$snapshot_data:o.data,$session_id:o.sessionId,$window_id:o.windowId,$lib:"web",$lib_version:Ho.LIB_VERSION})}),this.clearBuffer())}_captureSnapshotBuffered(t){var n,r=2+(((n=this.buffer)===null||n===void 0?void 0:n.data.length)||0);!this.isIdle&&(this.buffer.size+t.$snapshot_bytes+r>943718.4||this.buffer.sessionId!==this.sessionId)&&(this.buffer=this._flushBuffer()),this.buffer.size+=t.$snapshot_bytes,this.buffer.data.push(t.$snapshot_data),this.flushBufferTimer||this.isIdle||(this.flushBufferTimer=setTimeout(()=>{this._flushBuffer()},2e3))}_captureSnapshot(t){this.instance.capture("$snapshot",t,{_url:this.instance.requestRouter.endpointFor("api",this._endpoint),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}_checkUrlTriggerConditions(){if(le!==void 0&&le.location.href){var t=le.location.href,n=this._urlBlocked,r=HM(t,this._urlBlocklist);r&&!n?this._pauseRecording():!r&&n&&this._resumeRecording(),HM(t,this._urlTriggers)&&this._activateTrigger("url")}}_activateTrigger(t){var n,r;this.triggerStatus==="trigger_pending"&&((n=this.instance)===null||n===void 0||(r=n.persistence)===null||r===void 0||r.register({[t==="url"?L1:$1]:this.sessionId}),this._flushBuffer(),this._reportStarted(t+"_trigger_matched"))}_pauseRecording(){this._urlBlocked||(this._urlBlocked=!0,clearInterval(this._fullSnapshotTimer),Rr.info("recording paused due to URL blocker"),this._tryAddCustomEvent("recording paused",{reason:"url blocker"}))}_resumeRecording(){this._urlBlocked&&(this._urlBlocked=!1,this._tryTakeFullSnapshot(),this._scheduleFullSnapshot(),this._tryAddCustomEvent("recording resumed",{reason:"left blocked url"}),Rr.info("recording resumed"))}_addEventTriggerListener(){this._eventTriggers.length!==0&&Kt(this._removeEventTriggerCaptureHook)&&(this._removeEventTriggerCaptureHook=this.instance.on("eventCaptured",t=>{try{this._eventTriggers.includes(t.event)&&this._activateTrigger("event")}catch(n){Rr.error("Could not activate event trigger",n)}}))}overrideLinkedFlag(){this._linkedFlagSeen=!0,this._tryTakeFullSnapshot(),this._reportStarted("linked_flag_overridden")}overrideSampling(){var t;(t=this.instance.persistence)===null||t===void 0||t.register({[Mf]:!0}),this._tryTakeFullSnapshot(),this._reportStarted("sampling_overridden")}overrideTrigger(t){this._activateTrigger(t)}_reportStarted(t,n){this.instance.register_for_session({$session_recording_start_reason:t}),Rr.info(t.replace("_"," "),n),Rt(["recording_initialized","session_id_changed"],t)||this._tryAddCustomEvent(t,n)}}var dS=Ir("[SegmentIntegration]");function zY(e,t){var n=e.config.segment;if(!n)return t();(function(r,i){var o=r.config.segment;if(!o)return i();var a=c=>{var d=()=>c.anonymousId()||Va();r.config.get_device_id=d,c.id()&&(r.register({distinct_id:c.id(),$device_id:d()}),r.persistence.set_property(Go,"identified")),i()},u=o.user();"then"in u&&Hi(u.then)?u.then(c=>a(c)):a(u)})(e,()=>{n.register((r=>{Promise&&Promise.resolve||dS.warn("This browser does not have Promise support, and can not use the segment integration");var i=(o,a)=>{var u;if(!a)return o;o.event.userId||o.event.anonymousId===r.get_distinct_id()||(dS.info("No userId set, resetting PostHog"),r.reset()),o.event.userId&&o.event.userId!==r.get_distinct_id()&&(dS.info("UserId set, identifying with PostHog"),r.identify(o.event.userId));var c=r._calculate_event_properties(a,(u=o.event.properties)!==null&&u!==void 0?u:{},new Date);return o.event.properties=Object.assign({},c,o.event.properties),o};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:o=>i(o,o.event.event),page:o=>i(o,"$pageview"),identify:o=>i(o,"$identify"),screen:o=>i(o,"$screen")}})(e)).then(()=>{t()})})}var GM="posthog-js";function VM(e){var{organization:t,projectId:n,prefix:r,severityAllowList:i=["error"]}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return o=>{var a,u,c,d,p;if(!(i==="*"||i.includes(o.level))||!e.__loaded)return o;o.tags||(o.tags={});var h=e.requestRouter.endpointFor("ui","/project/".concat(e.config.token,"/person/").concat(e.get_distinct_id()));o.tags["PostHog Person URL"]=h,e.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var m=((a=o.exception)===null||a===void 0?void 0:a.values)||[],v=m.map(x=>pe(pe({},x),{},{stacktrace:x.stacktrace?pe(pe({},x.stacktrace),{},{type:"raw",frames:(x.stacktrace.frames||[]).map(S=>pe(pe({},S),{},{platform:"web:javascript"}))}):void 0})),_={$exception_message:((u=m[0])===null||u===void 0?void 0:u.value)||o.message,$exception_type:(c=m[0])===null||c===void 0?void 0:c.type,$exception_personURL:h,$exception_level:o.level,$exception_list:v,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:((d=m[0])===null||d===void 0?void 0:d.value)||o.message,$sentry_exception_type:(p=m[0])===null||p===void 0?void 0:p.type,$sentry_tags:o.tags};return t&&n&&(_.$sentry_url=(r||"https://sentry.io/organizations/")+t+"/issues/?project="+n+"&query="+o.event_id),e.exceptions.sendExceptionEvent(_),o}}class qY{constructor(t,n,r,i,o){this.name=GM,this.setupOnce=function(a){a(VM(t,{organization:n,projectId:r,prefix:i,severityAllowList:o}))}}}var Wo,jY=le!=null&&le.location?hg(le.location.hash,"__posthog")||hg(location.hash,"state"):null,ZM="_postHogToolbarParams",YM=Ir("[Toolbar]");(function(e){e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED"})(Wo||(Wo={}));class HY{constructor(t){this.instance=t}setToolbarState(t){pt.ph_toolbar_state=t}getToolbarState(){var t;return(t=pt.ph_toolbar_state)!==null&&t!==void 0?t:Wo.UNINITIALIZED}maybeLoadToolbar(){var t,n,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;if(!le||!He)return!1;r=(t=r)!==null&&t!==void 0?t:le.location,o=(n=o)!==null&&n!==void 0?n:le.history;try{if(!i){try{le.localStorage.setItem("test","test"),le.localStorage.removeItem("test")}catch{return!1}i=le==null?void 0:le.localStorage}var a,u=jY||hg(r.hash,"__posthog")||hg(r.hash,"state"),c=u?zT(()=>JSON.parse(atob(decodeURIComponent(u))))||zT(()=>JSON.parse(decodeURIComponent(u))):null;return c&&c.action==="ph_authorize"?((a=c).source="url",a&&Object.keys(a).length>0&&(c.desiredHash?r.hash=c.desiredHash:o?o.replaceState(o.state,"",r.pathname+r.search):r.hash="")):((a=JSON.parse(i.getItem(ZM)||"{}")).source="localstorage",delete a.userIntent),!(!a.token||this.instance.config.token!==a.token)&&(this.loadToolbar(a),!0)}catch{return!1}}_callLoadToolbar(t){var n=pt.ph_load_toolbar||pt.ph_load_editor;!Kt(n)&&Hi(n)?n(t,this.instance):YM.warn("No toolbar load function found")}loadToolbar(t){var n=!(He==null||!He.getElementById(nM));if(!le||n)return!1;var r=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,i=pe(pe({token:this.instance.config.token},t),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(le.localStorage.setItem(ZM,JSON.stringify(pe(pe({},i),{},{source:void 0}))),this.getToolbarState()===Wo.LOADED)this._callLoadToolbar(i);else if(this.getToolbarState()===Wo.UNINITIALIZED){var o,a;this.setToolbarState(Wo.LOADING),(o=pt.__PosthogExtensions__)===null||o===void 0||(a=o.loadExternalDependency)===null||a===void 0||a.call(o,this.instance,"toolbar",u=>{if(u)return YM.error("[Toolbar] Failed to load",u),void this.setToolbarState(Wo.UNINITIALIZED);this.setToolbarState(Wo.LOADED),this._callLoadToolbar(i)}),Nn(le,"turbolinks:load",()=>{this.setToolbarState(Wo.UNINITIALIZED),this.loadToolbar(i)})}return!0}_loadEditor(t){return this.loadToolbar(t)}maybeLoadEditor(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;return this.maybeLoadToolbar(t,n,r)}}var GY=Ir("[TracingHeaders]");class VY{constructor(t){De(this,"_restoreXHRPatch",void 0),De(this,"_restoreFetchPatch",void 0),De(this,"_startCapturing",()=>{var n,r,i,o;Fe(this._restoreXHRPatch)&&((n=pt.__PosthogExtensions__)===null||n===void 0||(r=n.tracingHeadersPatchFns)===null||r===void 0||r._patchXHR(this.instance.sessionManager)),Fe(this._restoreFetchPatch)&&((i=pt.__PosthogExtensions__)===null||i===void 0||(o=i.tracingHeadersPatchFns)===null||o===void 0||o._patchFetch(this.instance.sessionManager))}),this.instance=t}_loadScript(t){var n,r,i;(n=pt.__PosthogExtensions__)!==null&&n!==void 0&&n.tracingHeadersPatchFns&&t(),(r=pt.__PosthogExtensions__)===null||r===void 0||(i=r.loadExternalDependency)===null||i===void 0||i.call(r,this.instance,"tracing-headers",o=>{if(o)return GY.error("failed to load script",o);t()})}startIfEnabledOrStop(){var t,n;this.instance.config.__add_tracing_headers?this._loadScript(this._startCapturing):((t=this._restoreXHRPatch)===null||t===void 0||t.call(this),(n=this._restoreFetchPatch)===null||n===void 0||n.call(this),this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0)}}var Ya=Ir("[Web Vitals]"),WM=9e5;let ZY=class{constructor(t){var n;De(this,"_enabledServerSide",!1),De(this,"_initialized",!1),De(this,"buffer",{url:void 0,metrics:[],firstMetricTimestamp:void 0}),De(this,"_flushToCapture",()=>{clearTimeout(this._delayedFlushTimer),this.buffer.metrics.length!==0&&(this.instance.capture("$web_vitals",this.buffer.metrics.reduce((r,i)=>pe(pe({},r),{},{["$web_vitals_".concat(i.name,"_event")]:pe({},i),["$web_vitals_".concat(i.name,"_value")]:i.value}),{})),this.buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0})}),De(this,"_addToBuffer",r=>{var i,o=(i=this.instance.sessionManager)===null||i===void 0?void 0:i.checkAndGetSessionAndWindowId(!0);if(Fe(o))Ya.error("Could not read session ID. Dropping metrics!");else{this.buffer=this.buffer||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var a=this._currentURL();Fe(a)||(Kt(r==null?void 0:r.name)||Kt(r==null?void 0:r.value)?Ya.error("Invalid metric received",r):this._maxAllowedValue&&r.value>=this._maxAllowedValue?Ya.error("Ignoring metric with value >= "+this._maxAllowedValue,r):(this.buffer.url!==a&&(this._flushToCapture(),this._delayedFlushTimer=setTimeout(this._flushToCapture,this.flushToCaptureTimeoutMs)),Fe(this.buffer.url)&&(this.buffer.url=a),this.buffer.firstMetricTimestamp=Fe(this.buffer.firstMetricTimestamp)?Date.now():this.buffer.firstMetricTimestamp,r.attribution&&r.attribution.interactionTargetElement&&(r.attribution.interactionTargetElement=void 0),this.buffer.metrics.push(pe(pe({},r),{},{$current_url:a,$session_id:o.sessionId,$window_id:o.windowId,timestamp:Date.now()})),this.buffer.metrics.length===this.allowedMetrics.length&&this._flushToCapture()))}}),De(this,"_startCapturing",()=>{var r,i,o,a,u=pt.__PosthogExtensions__;Fe(u)||Fe(u.postHogWebVitalsCallbacks)||({onLCP:r,onCLS:i,onFCP:o,onINP:a}=u.postHogWebVitalsCallbacks),r&&i&&o&&a?(this.allowedMetrics.indexOf("LCP")>-1&&r(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&i(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&o(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&a(this._addToBuffer.bind(this)),this._initialized=!0):Ya.error("web vitals callbacks not loaded - not starting")}),this.instance=t,this._enabledServerSide=!((n=this.instance.persistence)===null||n===void 0||!n.props[VT]),this.startIfEnabled()}get allowedMetrics(){var t,n,r=In(this.instance.config.capture_performance)?(t=this.instance.config.capture_performance)===null||t===void 0?void 0:t.web_vitals_allowed_metrics:void 0;return Fe(r)?((n=this.instance.persistence)===null||n===void 0?void 0:n.props[YT])||["CLS","FCP","INP","LCP"]:r}get flushToCaptureTimeoutMs(){return(In(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get _maxAllowedValue(){var t=In(this.instance.config.capture_performance)&&$r(this.instance.config.capture_performance.__web_vitals_max_value)?this.instance.config.capture_performance.__web_vitals_max_value:WM;return 0<t&&t<=6e4?WM:t}get isEnabled(){var t=Vr==null?void 0:Vr.protocol;if(t!=="http:"&&t!=="https:")return Ya.info("Web Vitals are disabled on non-http/https protocols"),!1;var n=In(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals:void 0;return ja(n)?n:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(Ya.info("enabled, starting..."),this.loadScript(this._startCapturing))}onRemoteConfig(t){var n=In(t.capturePerformance)&&!!t.capturePerformance.web_vitals,r=In(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this.instance.persistence&&(this.instance.persistence.register({[VT]:n}),this.instance.persistence.register({[YT]:r})),this._enabledServerSide=n,this.startIfEnabled()}loadScript(t){var n,r,i;(n=pt.__PosthogExtensions__)!==null&&n!==void 0&&n.postHogWebVitalsCallbacks&&t(),(r=pt.__PosthogExtensions__)===null||r===void 0||(i=r.loadExternalDependency)===null||i===void 0||i.call(r,this.instance,"web-vitals",o=>{o?Ya.error("failed to load script",o):t()})}_currentURL(){var t=le?le.location.href:void 0;return t||Ya.error("Could not determine current URL"),t}};var YY=Ir("[Heatmaps]");function KM(e){return In(e)&&"clientX"in e&&"clientY"in e&&$r(e.clientX)&&$r(e.clientY)}class WY{constructor(t){var n;De(this,"rageclicks",new vM),De(this,"_enabledServerSide",!1),De(this,"_initialized",!1),De(this,"_flushInterval",null),this.instance=t,this._enabledServerSide=!((n=this.instance.persistence)===null||n===void 0||!n.props[M1])}get flushIntervalMilliseconds(){var t=5e3;return In(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(t=this.instance.config.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return Fe(this.instance.config.capture_heatmaps)?Fe(this.instance.config.enable_heatmaps)?this._enabledServerSide:this.instance.config.enable_heatmaps:this.instance.config.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this._initialized)return;YY.info("starting..."),this._setupListeners(),this._flushInterval=setInterval(this.flush.bind(this),this.flushIntervalMilliseconds)}else{var t,n;clearInterval((t=this._flushInterval)!==null&&t!==void 0?t:void 0),(n=this.deadClicksCapture)===null||n===void 0||n.stop(),this.getAndClearBuffer()}}onRemoteConfig(t){var n=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[M1]:n}),this._enabledServerSide=n,this.startIfEnabled()}getAndClearBuffer(){var t=this.buffer;return this.buffer=void 0,t}_onDeadClick(t){this._onClick(t.originalEvent,"deadclick")}_setupListeners(){le&&He&&(Nn(le,"beforeunload",this.flush.bind(this)),Nn(He,"click",t=>this._onClick(t||(le==null?void 0:le.event)),{capture:!0}),Nn(He,"mousemove",t=>this._onMouseMove(t||(le==null?void 0:le.event)),{capture:!0}),this.deadClicksCapture=new wM(this.instance,lY,this._onDeadClick.bind(this)),this.deadClicksCapture.startIfEnabled(),this._initialized=!0)}_getProperties(t,n){var r=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),o=this.instance.scrollManager.scrollElement(),a=function(u,c,d){for(var p=u;p&&ug(p)&&!Ga(p,"body");){if(p===d)return!1;if(Rt(c,le==null?void 0:le.getComputedStyle(p).position))return!0;p=cM(p)}return!1}(uM(t),["fixed","sticky"],o);return{x:t.clientX+(a?0:i),y:t.clientY+(a?0:r),target_fixed:a,type:n}}_onClick(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"click";if(!iM(t.target)&&KM(t)){var i=this._getProperties(t,r);(n=this.rageclicks)!==null&&n!==void 0&&n.isRageClick(t.clientX,t.clientY,new Date().getTime())&&this._capture(pe(pe({},i),{},{type:"rageclick"})),this._capture(i)}}_onMouseMove(t){!iM(t.target)&&KM(t)&&(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout(()=>{this._capture(this._getProperties(t,"mousemove"))},500))}_capture(t){if(le){var n=le.location.href;this.buffer=this.buffer||{},this.buffer[n]||(this.buffer[n]=[]),this.buffer[n].push(t)}}flush(){this.buffer&&!lu(this.buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class KY{constructor(t){this._instance=t}doPageView(t,n){var r,i=this._previousPageViewProperties(t,n);return this._currentPageview={pathname:(r=le==null?void 0:le.location.pathname)!==null&&r!==void 0?r:"",pageViewId:n,timestamp:t},this._instance.scrollManager.resetContext(),i}doPageLeave(t){var n;return this._previousPageViewProperties(t,(n=this._currentPageview)===null||n===void 0?void 0:n.pageViewId)}doEvent(){var t;return{$pageview_id:(t=this._currentPageview)===null||t===void 0?void 0:t.pageViewId}}_previousPageViewProperties(t,n){var r=this._currentPageview;if(!r)return{$pageview_id:n};var i={$pageview_id:n,$prev_pageview_id:r.pageViewId},o=this._instance.scrollManager.getContext();if(o&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:a,lastScrollY:u,maxScrollY:c,maxContentHeight:d,lastContentY:p,maxContentY:h}=o;if(!(Fe(a)||Fe(u)||Fe(c)||Fe(d)||Fe(p)||Fe(h))){a=Math.ceil(a),u=Math.ceil(u),c=Math.ceil(c),d=Math.ceil(d),p=Math.ceil(p),h=Math.ceil(h);var m=a<=1?1:bi(u/a,0,1),v=a<=1?1:bi(c/a,0,1),_=d<=1?1:bi(p/d,0,1),x=d<=1?1:bi(h/d,0,1);i=Gn(i,{$prev_pageview_last_scroll:u,$prev_pageview_last_scroll_percentage:m,$prev_pageview_max_scroll:c,$prev_pageview_max_scroll_percentage:v,$prev_pageview_last_content:p,$prev_pageview_last_content_percentage:_,$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:x})}}return r.pathname&&(i.$prev_pageview_pathname=r.pathname),r.timestamp&&(i.$prev_pageview_duration=(t.getTime()-r.timestamp.getTime())/1e3),i}}class QY{constructor(t){this.instance=t}sendExceptionEvent(t){this.instance.capture("$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent"})}}var wi="Mobile",Cg="iOS",uo="Android",Ff="Tablet",QM=uo+" "+Ff,XM="iPad",JM="Apple",e3=JM+" Watch",Uf="Safari",pu="BlackBerry",t3="Samsung",n3=t3+"Browser",r3=t3+" Internet",Gs="Chrome",XY=Gs+" OS",i3=Gs+" "+Cg,hS="Internet Explorer",o3=hS+" "+wi,pS="Opera",JY=pS+" Mini",gS="Edge",a3="Microsoft "+gS,gu="Firefox",s3=gu+" "+Cg,zf="Nintendo",qf="PlayStation",mu="Xbox",l3=uo+" "+wi,u3=wi+" "+Uf,jf="Windows",mS=jf+" Phone",c3="Nokia",vS="Ouya",f3="Generic",eW=f3+" "+wi.toLowerCase(),d3=f3+" "+Ff.toLowerCase(),yS="Konqueror",Nr="(\\d+(\\.\\d+)?)",_S=new RegExp("Version/"+Nr),tW=new RegExp(mu,"i"),nW=new RegExp(qf+" \\w+","i"),rW=new RegExp(zf+" \\w+","i"),bS=new RegExp(pu+"|PlayBook|BB10","i"),iW={"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"},SS,oW=(e,t)=>t&&Rt(t,JM)||function(n){return Rt(n,Uf)&&!Rt(n,Gs)&&!Rt(n,uo)}(e),h3=function(e,t){return t=t||"",Rt(e," OPR/")&&Rt(e,"Mini")?JY:Rt(e," OPR/")?pS:bS.test(e)?pu:Rt(e,"IE"+wi)||Rt(e,"WPDesktop")?o3:Rt(e,n3)?r3:Rt(e,gS)||Rt(e,"Edg/")?a3:Rt(e,"FBIOS")?"Facebook "+wi:Rt(e,"UCWEB")||Rt(e,"UCBrowser")?"UC Browser":Rt(e,"CriOS")?i3:Rt(e,"CrMo")||Rt(e,Gs)?Gs:Rt(e,uo)&&Rt(e,Uf)?l3:Rt(e,"FxiOS")?s3:Rt(e.toLowerCase(),yS.toLowerCase())?yS:oW(e,t)?Rt(e,wi)?u3:Uf:Rt(e,gu)?gu:Rt(e,"MSIE")||Rt(e,"Trident/")?hS:Rt(e,"Gecko")?gu:""},aW={[o3]:[new RegExp("rv:"+Nr)],[a3]:[new RegExp(gS+"?\\/"+Nr)],[Gs]:[new RegExp("("+Gs+"|CrMo)\\/"+Nr)],[i3]:[new RegExp("CriOS\\/"+Nr)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Nr)],[Uf]:[_S],[u3]:[_S],[pS]:[new RegExp("(Opera|OPR)\\/"+Nr)],[gu]:[new RegExp(gu+"\\/"+Nr)],[s3]:[new RegExp("FxiOS\\/"+Nr)],[yS]:[new RegExp("Konqueror[:/]?"+Nr,"i")],[pu]:[new RegExp(pu+" "+Nr),_S],[l3]:[new RegExp("android\\s"+Nr,"i")],[r3]:[new RegExp(n3+"\\/"+Nr)],[hS]:[new RegExp("(rv:|MSIE )"+Nr)],Mozilla:[new RegExp("rv:"+Nr)]},p3=[[new RegExp(mu+"; "+mu+" (.*?)[);]","i"),e=>[mu,e&&e[1]||""]],[new RegExp(zf,"i"),[zf,""]],[new RegExp(qf,"i"),[qf,""]],[bS,[pu,""]],[new RegExp(jf,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[mS,""];if(new RegExp(wi).test(t)&&!/IEMobile\b/.test(t))return[jf+" "+wi,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var r=n[1],i=iW[r]||"";return/arm/i.test(t)&&(i="RT"),[jf,i]}return[jf,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){var t=[e[3],e[4],e[5]||"0"];return[Cg,t.join(".")]}return[Cg,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=Fe(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+uo+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+uo+")","i"),e=>{if(e&&e[2]){var t=[e[2],e[3],e[4]||"0"];return[uo,t.join(".")]}return[uo,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];if(e&&e[1]){var n=[e[1],e[2],e[3]||"0"];t[1]=n.join(".")}return t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[XY,""]],[/Linux|debian/i,["Linux",""]]],g3=function(e){return rW.test(e)?zf:nW.test(e)?qf:tW.test(e)?mu:new RegExp(vS,"i").test(e)?vS:new RegExp("("+mS+"|WPDesktop)","i").test(e)?mS:/iPad/.test(e)?XM:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?e3:bS.test(e)?pu:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(c3,"i").test(e)?c3:/(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(wi).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)?uo:QM:uo:new RegExp("(pda|"+wi+")","i").test(e)?eW:new RegExp(Ff,"i").test(e)&&!new RegExp(Ff+" pc","i").test(e)?d3:""},Eg="https?://(.*)",kg=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","irclid","_kx"],sW=ng(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],kg),wS="<masked>",bn={campaignParams:function(){var{customTrackedParams:e,maskPersonalDataProperties:t,customPersonalDataProperties:n}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!He)return{};var r=t?ng([],kg,n||[]):[];return this._campaignParamsFromUrl(V1(He.URL,r,wS),e)},_campaignParamsFromUrl:function(e,t){var n=sW.concat(t||[]),r={};return on(n,function(i){var o=dg(e,i);r[i]=o||null}),r},_searchEngine:function(e){return e?e.search(Eg+"google.([^/?]*)")===0?"google":e.search(Eg+"bing.com")===0?"bing":e.search(Eg+"yahoo.com")===0?"yahoo":e.search(Eg+"duckduckgo.com")===0?"duckduckgo":null:null},_searchInfoFromReferrer:function(e){var t=bn._searchEngine(e),n=t!="yahoo"?"q":"p",r={};if(!qa(t)){r.$search_engine=t;var i=He?dg(He.referrer,n):"";i.length&&(r.ph_keyword=i)}return r},searchInfo:function(){var e=He==null?void 0:He.referrer;return e?this._searchInfoFromReferrer(e):{}},browser:h3,browserVersion:function(e,t){var n=h3(e,t),r=aW[n];if(Fe(r))return null;for(var i=0;i<r.length;i++){var o=r[i],a=e.match(o);if(a)return parseFloat(a[a.length-2])}return null},browserLanguage:function(){return navigator.language||navigator.userLanguage},browserLanguagePrefix:function(){var e=this.browserLanguage();return typeof e=="string"?e.split("-")[0]:void 0},os:function(e){for(var t=0;t<p3.length;t++){var[n,r]=p3[t],i=n.exec(e),o=i&&(Hi(r)?r(i,e):r);if(o)return o}return["",""]},device:g3,deviceType:function(e){var t=g3(e);return t===XM||t===QM||t==="Kobo"||t==="Kindle Fire"||t===d3?Ff:t===zf||t===mu||t===qf||t===vS?"Console":t===e3?"Wearable":t?wi:"Desktop"},referrer:function(){return(He==null?void 0:He.referrer)||"$direct"},referringDomain:function(){var e;return He!=null&&He.referrer&&((e=fu(He.referrer))===null||e===void 0?void 0:e.host)||"$direct"},referrerInfo:function(){return{$referrer:this.referrer(),$referring_domain:this.referringDomain()}},personInfo:function(){var{maskPersonalDataProperties:e,customPersonalDataProperties:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e?ng([],kg,t||[]):[],r=Vr==null?void 0:Vr.href.substring(0,1e3);return{r:this.referrer().substring(0,1e3),u:r?V1(r,n,wS):void 0}},personPropsFromInfo:function(e){var t,{r:n,u:r}=e,i={$referrer:n,$referring_domain:n==null?void 0:n=="$direct"?"$direct":(t=fu(n))===null||t===void 0?void 0:t.host};if(r){i.$current_url=r;var o=fu(r);i.$host=o==null?void 0:o.host,i.$pathname=o==null?void 0:o.pathname;var a=this._campaignParamsFromUrl(r);Gn(i,a)}if(n){var u=this._searchInfoFromReferrer(n);Gn(i,u)}return i},initialPersonPropsFromInfo:function(e){var t=this.personPropsFromInfo(e),n={};return on(t,function(r,i){n["$initial_".concat(O1(i))]=r}),n},timezone:function(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}},timezoneOffset:function(){try{return new Date().getTimezoneOffset()}catch{return}},properties:function(){var{maskPersonalDataProperties:e,customPersonalDataProperties:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!jn)return{};var n=e?ng([],kg,t||[]):[],[r,i]=bn.os(jn);return Gn(Rf({$os:r,$os_version:i,$browser:bn.browser(jn,navigator.vendor),$device:bn.device(jn),$device_type:bn.deviceType(jn),$timezone:bn.timezone(),$timezone_offset:bn.timezoneOffset()}),{$current_url:V1(Vr==null?void 0:Vr.href,n,wS),$host:Vr==null?void 0:Vr.host,$pathname:Vr==null?void 0:Vr.pathname,$raw_user_agent:jn.length>1e3?jn.substring(0,997)+"...":jn,$browser_version:bn.browserVersion(jn,navigator.vendor),$browser_language:bn.browserLanguage(),$browser_language_prefix:bn.browserLanguagePrefix(),$screen_height:le==null?void 0:le.screen.height,$screen_width:le==null?void 0:le.screen.width,$viewport_height:le==null?void 0:le.innerHeight,$viewport_width:le==null?void 0:le.innerWidth,$lib:"web",$lib_version:Ho.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})},people_properties:function(){if(!jn)return{};var[e,t]=bn.os(jn);return Gn(Rf({$os:e,$os_version:t,$browser:bn.browser(jn,navigator.vendor)}),{$browser_version:bn.browserVersion(jn,navigator.vendor)})}},co=Ir("[FeatureFlags]"),xS="$active_feature_flags",vu="$override_feature_flags",m3="$feature_flag_payloads",Hf="$override_feature_flag_payloads",v3="$feature_flag_request_id",y3=e=>{var t={};for(var[n,r]of rg(e||{}))r&&(t[n]=r);return t},lW=e=>{var t=e.flags;return t?(e.featureFlags=Object.fromEntries(Object.keys(t).map(n=>{var r;return[n,(r=t[n].variant)!==null&&r!==void 0?r:t[n].enabled]})),e.featureFlagPayloads=Object.fromEntries(Object.keys(t).filter(n=>t[n].enabled).filter(n=>{var r;return(r=t[n].metadata)===null||r===void 0?void 0:r.payload}).map(n=>{var r;return[n,(r=t[n].metadata)===null||r===void 0?void 0:r.payload]}))):co.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e};(function(e){e.FeatureFlags="feature_flags",e.Recordings="recordings"})(SS||(SS={}));class uW{constructor(t){De(this,"_override_warning",!1),De(this,"_hasLoadedFlags",!1),De(this,"_requestInFlight",!1),De(this,"_reloadingDisabled",!1),De(this,"_additionalReloadRequested",!1),De(this,"_decideCalled",!1),De(this,"_flagsLoadedFromRemote",!1),this.instance=t,this.featureFlagEventHandlers=[]}decide(){if(this.instance.config.__preview_remote_config)this._decideCalled=!0;else{var t=!this._reloadDebouncer&&(this.instance.config.advanced_disable_feature_flags||this.instance.config.advanced_disable_feature_flags_on_first_load);this._callDecideEndpoint({disableFlags:t})}}get hasLoadedFlags(){return this._hasLoadedFlags}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.instance.get_property(N1),n=this.instance.get_property(vu),r=this.instance.get_property(Hf);if(!r&&!n)return t||{};var i=Gn({},t||{}),o=[...new Set([...Object.keys(r||{}),...Object.keys(n||{})])];for(var a of o){var u,c,d=i[a],p=n==null?void 0:n[a],h=Fe(p)?(u=d==null?void 0:d.enabled)!==null&&u!==void 0&&u:!!p,m=Fe(p)?d.variant:typeof p=="string"?p:void 0,v=r==null?void 0:r[a],_=pe(pe({},d),{},{enabled:h,variant:h?m??(d==null?void 0:d.variant):void 0});h!==(d==null?void 0:d.enabled)&&(_.original_enabled=d==null?void 0:d.enabled),m!==(d==null?void 0:d.variant)&&(_.original_variant=d==null?void 0:d.variant),v&&(_.metadata=pe(pe({},d==null?void 0:d.metadata),{},{payload:v,original_payload:d==null||(c=d.metadata)===null||c===void 0?void 0:c.payload})),i[a]=_}return this._override_warning||(co.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:r,finalDetails:i}),this._override_warning=!0),i}getFlagVariants(){var t=this.instance.get_property(uu),n=this.instance.get_property(vu);if(!n)return t||{};for(var r=Gn({},t),i=Object.keys(n),o=0;o<i.length;o++)r[i[o]]=n[i[o]];return this._override_warning||(co.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:n,finalFlags:r}),this._override_warning=!0),r}getFlagPayloads(){var t=this.instance.get_property(m3),n=this.instance.get_property(Hf);if(!n)return t||{};for(var r=Gn({},t||{}),i=Object.keys(n),o=0;o<i.length;o++)r[i[o]]=n[i[o]];return this._override_warning||(co.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:n,finalPayloads:r}),this._override_warning=!0),r}reloadFeatureFlags(){this._reloadingDisabled||this.instance.config.advanced_disable_feature_flags||this._reloadDebouncer||(this._reloadDebouncer=setTimeout(()=>{this._callDecideEndpoint()},5))}clearDebouncer(){clearTimeout(this._reloadDebouncer),this._reloadDebouncer=void 0}ensureFlagsLoaded(){this._hasLoadedFlags||this._requestInFlight||this._reloadDebouncer||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this._reloadingDisabled=t}_callDecideEndpoint(t){var n;if(this.clearDebouncer(),!this.instance.config.advanced_disable_decide)if(this._requestInFlight)this._additionalReloadRequested=!0;else{var r={token:this.instance.config.token,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:pe(pe({},((n=this.instance.persistence)===null||n===void 0?void 0:n.get_initial_props())||{}),this.instance.get_property(Df)||{}),group_properties:this.instance.get_property(Us)};(t!=null&&t.disableFlags||this.instance.config.advanced_disable_feature_flags)&&(r.disable_flags=!0);var i=this.instance.config.__preview_flags_v2&&this.instance.config.__preview_remote_config;i&&(r.timezone=bn.timezone()),this._requestInFlight=!0,this.instance._send_request({method:"POST",url:this.instance.requestRouter.endpointFor("api",i?"/flags/?v=2":"/decide/?v=4"),data:r,compression:this.instance.config.disable_compression?void 0:ji.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:o=>{var a,u,c,d=!0;o.statusCode===200&&(this._additionalReloadRequested||(this.$anon_distinct_id=void 0),d=!1),this._requestInFlight=!1,this._decideCalled||(this._decideCalled=!0,this.instance._onRemoteConfig((c=o.json)!==null&&c!==void 0?c:{})),r.disable_flags&&!this._additionalReloadRequested||(this._flagsLoadedFromRemote=!d,o.json&&(a=o.json.quotaLimited)!==null&&a!==void 0&&a.includes(SS.FeatureFlags)?co.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."):(this.receivedFeatureFlags((u=o.json)!==null&&u!==void 0?u:{},d),this._additionalReloadRequested&&(this._additionalReloadRequested=!1,this._callDecideEndpoint())))}})}}getFeatureFlag(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0){var r=this.getFlagVariants()[t],i="".concat(r),o=this.instance.get_property(v3)||void 0,a=this.instance.get_property(sg)||{};if((n.send_event||!("send_event"in n))&&(!(t in a)||!a[t].includes(i))){var u,c,d,p,h,m,v,_,x,S,b;An(a[t])?a[t].push(i):a[t]=[i],(u=this.instance.persistence)===null||u===void 0||u.register({[sg]:a});var C=this.getFeatureFlagDetails(t),E={$feature_flag:t,$feature_flag_response:r,$feature_flag_payload:this.getFeatureFlagPayload(t)||null,$feature_flag_request_id:o,$feature_flag_bootstrapped_response:((c=this.instance.config.bootstrap)===null||c===void 0||(d=c.featureFlags)===null||d===void 0?void 0:d[t])||null,$feature_flag_bootstrapped_payload:((p=this.instance.config.bootstrap)===null||p===void 0||(h=p.featureFlagPayloads)===null||h===void 0?void 0:h[t])||null,$used_bootstrap_value:!this._flagsLoadedFromRemote};Fe(C==null||(m=C.metadata)===null||m===void 0?void 0:m.version)||(E.$feature_flag_version=C.metadata.version);var I,O=(v=C==null||(_=C.reason)===null||_===void 0?void 0:_.description)!==null&&v!==void 0?v:C==null||(x=C.reason)===null||x===void 0?void 0:x.code;O&&(E.$feature_flag_reason=O),C!=null&&(S=C.metadata)!==null&&S!==void 0&&S.id&&(E.$feature_flag_id=C.metadata.id),Fe(C==null?void 0:C.original_variant)&&Fe(C==null?void 0:C.original_enabled)||(E.$feature_flag_original_response=Fe(C.original_variant)?C.original_enabled:C.original_variant),C!=null&&(b=C.metadata)!==null&&b!==void 0&&b.original_payload&&(E.$feature_flag_original_payload=C==null||(I=C.metadata)===null||I===void 0?void 0:I.original_payload),this.instance.capture("$feature_flag_called",E)}return r}co.warn('getFeatureFlag for key "'+t+`" failed. Feature flags didn't load in time.`)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){return this.getFlagPayloads()[t]}getRemoteConfigPayload(t,n){var r=this.instance.config.token;this.instance._send_request({method:"POST",url:this.instance.requestRouter.endpointFor("api","/decide/?v=4"),data:{distinct_id:this.instance.get_distinct_id(),token:r},compression:this.instance.config.disable_compression?void 0:ji.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:i=>{var o,a=(o=i.json)===null||o===void 0?void 0:o.featureFlagPayloads;n((a==null?void 0:a[t])||void 0)}})}isFeatureEnabled(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0)return!!this.getFeatureFlag(t,n);co.warn('isFeatureEnabled for key "'+t+`" failed. Feature flags didn't load in time.`)}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(n=>n!==t)}receivedFeatureFlags(t,n){if(this.instance.persistence){this._hasLoadedFlags=!0;var r=this.getFlagVariants(),i=this.getFlagPayloads(),o=this.getFlagsWithDetails();(function(a,u){var c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},d=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},p=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{},h=lW(a),m=h.flags,v=h.featureFlags,_=h.featureFlagPayloads;if(v){var x=a.requestId;if(An(v)){co.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var S={};if(v)for(var b=0;b<v.length;b++)S[v[b]]=!0;u&&u.register({[xS]:v,[uu]:S})}else{var C=v,E=_,I=m;a.errorsWhileComputingFlags&&(C=pe(pe({},c),C),E=pe(pe({},d),E),I=pe(pe({},p),I)),u&&u.register(pe({[xS]:Object.keys(y3(C)),[uu]:C||{},[m3]:E||{},[N1]:I||{}},x?{[v3]:x}:{}))}}})(t,this.instance.persistence,r,i,o),this._fireFeatureFlagsCallbacks(n)}}override(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1];co.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:n})}overrideFeatureFlags(t){if(!this.instance.__loaded||!this.instance.persistence)return co.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(t===!1)return this.instance.persistence.unregister(vu),this.instance.persistence.unregister(Hf),void this._fireFeatureFlagsCallbacks();if(t&&typeof t=="object"&&("flags"in t||"payloads"in t)){var n,r=t;if(this._override_warning=!!((n=r.suppressWarning)!==null&&n!==void 0&&n),"flags"in r){if(r.flags===!1)this.instance.persistence.unregister(vu);else if(r.flags)if(An(r.flags)){for(var i={},o=0;o<r.flags.length;o++)i[r.flags[o]]=!0;this.instance.persistence.register({[vu]:i})}else this.instance.persistence.register({[vu]:r.flags})}return"payloads"in r&&(r.payloads===!1?this.instance.persistence.unregister(Hf):r.payloads&&this.instance.persistence.register({[Hf]:r.payloads})),void this._fireFeatureFlagsCallbacks()}this._fireFeatureFlagsCallbacks()}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this._hasLoadedFlags){var{flags:n,flagVariants:r}=this._prepareFeatureFlagsForCallbacks();t(n,r)}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,n){var r,i=(this.instance.get_property(og)||[]).find(c=>c.flagKey===t),o={["$feature_enrollment/".concat(t)]:n},a={$feature_flag:t,$feature_enrollment:n,$set:o};i&&(a.$early_access_feature_name=i.name),this.instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(o,!1);var u=pe(pe({},this.getFlagVariants()),{},{[t]:n});(r=this.instance.persistence)===null||r===void 0||r.register({[xS]:Object.keys(y3(u)),[uu]:u}),this._fireFeatureFlagsCallbacks()}getEarlyAccessFeatures(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1],r=arguments.length>2?arguments[2]:void 0,i=this.instance.get_property(og),o=r?"&".concat(r.map(a=>"stage=".concat(a)).join("&")):"";if(i&&!n)return t(i);this.instance._send_request({url:this.instance.requestRouter.endpointFor("api","/api/early_access_features/?token=".concat(this.instance.config.token).concat(o)),method:"GET",callback:a=>{var u;if(a.json){var c=a.json.earlyAccessFeatures;return(u=this.instance.persistence)===null||u===void 0||u.register({[og]:c}),t(c)}}})}_prepareFeatureFlagsForCallbacks(){var t=this.getFlags(),n=this.getFlagVariants();return{flags:t.filter(r=>n[r]),flagVariants:Object.keys(n).filter(r=>n[r]).reduce((r,i)=>(r[i]=n[i],r),{})}}_fireFeatureFlagsCallbacks(t){var{flags:n,flagVariants:r}=this._prepareFeatureFlagsForCallbacks();this.featureFlagEventHandlers.forEach(i=>i(n,r,{errorsLoading:t}))}setPersonPropertiesForFlags(t){var n=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],r=this.instance.get_property(Df)||{};this.instance.register({[Df]:pe(pe({},r),t)}),n&&this.instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this.instance.unregister(Df)}setGroupPropertiesForFlags(t){var n=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],r=this.instance.get_property(Us)||{};Object.keys(r).length!==0&&Object.keys(r).forEach(i=>{r[i]=pe(pe({},r[i]),t[i]),delete t[i]}),this.instance.register({[Us]:pe(pe({},r),t)}),n&&this.instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var n=this.instance.get_property(Us)||{};this.instance.register({[Us]:pe(pe({},n),{},{[t]:{}})})}else this.instance.unregister(Us)}}var cW=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class CS{constructor(t){this.config=t,this.props={},this.campaign_params_saved=!1,this.name=(n=>{var r="";return n.token&&(r=n.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),n.persistence_name?"ph_"+n.persistence_name:"ph_"+r+"_posthog"})(t),this.storage=this.buildStorage(t),this.load(),t.debug&&tt.info("Persistence loaded",t.persistence,pe({},this.props)),this.update_config(t,t),this.save()}buildStorage(t){cW.indexOf(t.persistence.toLowerCase())===-1&&(tt.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var n=t.persistence.toLowerCase();return n==="localstorage"&&Qn.is_supported()?Qn:n==="localstorage+cookie"&&gg.is_supported()?gg:n==="sessionstorage"&&hr.is_supported()?hr:n==="memory"?aY:n==="cookie"?Vo:gg.is_supported()?gg:Vo}properties(){var t={};return on(this.props,function(n,r){if(r===uu&&In(n))for(var i=Object.keys(n),o=0;o<i.length;o++)t["$feature/".concat(i[o])]=n[i[o]];else u=r,c=!1,(qa(a=FZ)?c:DT&&a.indexOf===DT?a.indexOf(u)!=-1:(on(a,function(d){if(c||(c=d===u))return tg}),c))||(t[r]=n);var a,u,c}),t}load(){if(!this.disabled){var t=this.storage.parse(this.name);t&&(this.props=Gn({},t))}}save(){this.disabled||this.storage.set(this.name,this.props,this.expire_days,this.cross_subdomain,this.secure,this.config.debug)}remove(){this.storage.remove(this.name,!1),this.storage.remove(this.name,!0)}clear(){this.remove(),this.props={}}register_once(t,n,r){if(In(t)){Fe(n)&&(n="None"),this.expire_days=Fe(r)?this.default_expiry:r;var i=!1;if(on(t,(o,a)=>{this.props.hasOwnProperty(a)&&this.props[a]!==n||(this.props[a]=o,i=!0)}),i)return this.save(),!0}return!1}register(t,n){if(In(t)){this.expire_days=Fe(n)?this.default_expiry:n;var r=!1;if(on(t,(i,o)=>{t.hasOwnProperty(o)&&this.props[o]!==i&&(this.props[o]=i,r=!0)}),r)return this.save(),!0}return!1}unregister(t){t in this.props&&(delete this.props[t],this.save())}update_campaign_params(){if(!this.campaign_params_saved){var t=bn.campaignParams({customTrackedParams:this.config.custom_campaign_params,maskPersonalDataProperties:this.config.mask_personal_data_properties,customPersonalDataProperties:this.config.custom_personal_data_properties});lu(Rf(t))||this.register(t),this.campaign_params_saved=!0}}update_search_keyword(){this.register(bn.searchInfo())}update_referrer_info(){this.register_once(bn.referrerInfo(),void 0)}set_initial_person_info(){this.props[U1]||this.props[z1]||this.register_once({[q1]:bn.personInfo({maskPersonalDataProperties:this.config.mask_personal_data_properties,customPersonalDataProperties:this.config.custom_personal_data_properties})},void 0)}get_referrer_info(){return Rf({$referrer:this.props.$referrer,$referring_domain:this.props.$referring_domain})}get_initial_props(){var t={};on([z1,U1],i=>{var o=this.props[i];o&&on(o,function(a,u){t["$initial_"+O1(u)]=a})});var n=this.props[q1];if(n){var r=bn.initialPersonPropsFromInfo(n);Gn(t,r)}return t}safe_merge(t){return on(this.props,function(n,r){r in t||(t[r]=n)}),t}update_config(t,n){if(this.default_expiry=this.expire_days=t.cookie_expiration,this.set_disabled(t.disable_persistence),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),t.persistence!==n.persistence){var r=this.buildStorage(t),i=this.props;this.clear(),this.storage=r,this.props=i,this.save()}}set_disabled(t){this.disabled=t,this.disabled?this.remove():this.save()}set_cross_subdomain(t){t!==this.cross_subdomain&&(this.cross_subdomain=t,this.remove(),this.save())}get_cross_subdomain(){return!!this.cross_subdomain}set_secure(t){t!==this.secure&&(this.secure=t,this.remove(),this.save())}set_event_timer(t,n){var r=this.props[Tf]||{};r[t]=n,this.props[Tf]=r,this.save()}remove_event_timer(t){var n=(this.props[Tf]||{})[t];return Fe(n)||(delete this.props[Tf][t],this.save()),n}get_property(t){return this.props[t]}set_property(t,n){this.props[t]=n,this.save()}}var _3,Rn,b3,Vs,S3,w3,ES,x3,C3,E3,k3,A3,I3,kS={},R3=[],fW=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,AS=Array.isArray;function Wa(e,t){for(var n in t)e[n]=t[n];return e}function O3(e){var t=e.parentNode;t&&t.removeChild(e)}function IS(e,t,n,r,i){var o={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:i??++b3,__i:-1,__u:0};return i==null&&Rn.vnode!=null&&Rn.vnode(o),o}function RS(e){return e.children}function Ag(e,t){this.props=e,this.context=t}function yu(e,t){if(t==null)return e.__?yu(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?yu(e):null}function T3(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=e.__c.base=n.__e;break}return T3(e)}}function OS(e){(!e.__d&&(e.__d=!0)&&Vs.push(e)&&!Ig.__r++||S3!==Rn.debounceRendering)&&((S3=Rn.debounceRendering)||w3)(Ig)}function Ig(){var e,t,n,r,i,o,a,u,c;for(Vs.sort(ES);e=Vs.shift();)e.__d&&(t=Vs.length,r=void 0,o=(i=(n=e).__v).__e,u=[],c=[],(a=n.__P)&&((r=Wa({},i)).__v=i.__v+1,Rn.vnode&&Rn.vnode(r),P3(a,r,i,n.__n,a.ownerSVGElement!==void 0,32&i.__u?[o]:null,u,o??yu(i),!!(32&i.__u),c),r.__.__k[r.__i]=r,pW(u,r,c),r.__e!=o&&T3(r)),Vs.length>t&&Vs.sort(ES));Ig.__r=0}function M3(e,t,n,r,i,o,a,u,c,d,p){var h,m,v,_,x,S=r&&r.__k||R3,b=t.length;for(n.__d=c,dW(n,t,S),c=n.__d,h=0;h<b;h++)(v=n.__k[h])!=null&&typeof v!="boolean"&&typeof v!="function"&&(m=v.__i===-1?kS:S[v.__i]||kS,v.__i=h,P3(e,v,m,i,o,a,u,c,d,p),_=v.__e,v.ref&&m.ref!=v.ref&&(m.ref&&TS(m.ref,null,v),p.push(v.ref,v.__c||_,v)),x==null&&_!=null&&(x=_),65536&v.__u||m.__k===v.__k?c=D3(v,c,e):typeof v.type=="function"&&v.__d!==void 0?c=v.__d:_&&(c=_.nextSibling),v.__d=void 0,v.__u&=-196609);n.__d=c,n.__e=x}function dW(e,t,n){var r,i,o,a,u,c=t.length,d=n.length,p=d,h=0;for(e.__k=[],r=0;r<c;r++)(i=e.__k[r]=(i=t[r])==null||typeof i=="boolean"||typeof i=="function"?null:typeof i=="string"||typeof i=="number"||typeof i=="bigint"||i.constructor==String?IS(null,i,null,null,i):AS(i)?IS(RS,{children:i},null,null,null):i.constructor===void 0&&i.__b>0?IS(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i)!=null?(i.__=e,i.__b=e.__b+1,u=hW(i,n,a=r+h,p),i.__i=u,o=null,u!==-1&&(p--,(o=n[u])&&(o.__u|=131072)),o==null||o.__v===null?(u==-1&&h--,typeof i.type!="function"&&(i.__u|=65536)):u!==a&&(u===a+1?h++:u>a?p>c-a?h+=u-a:h--:h=u<a&&u==a-1?u-a:0,u!==r+h&&(i.__u|=65536))):(o=n[r])&&o.key==null&&o.__e&&(o.__e==e.__d&&(e.__d=yu(o)),MS(o,o,!1),n[r]=null,p--);if(p)for(r=0;r<d;r++)(o=n[r])!=null&&(131072&o.__u)==0&&(o.__e==e.__d&&(e.__d=yu(o)),MS(o,o))}function D3(e,t,n){var r,i;if(typeof e.type=="function"){for(r=e.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=e,t=D3(r[i],t,n));return t}return e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function hW(e,t,n,r){var i=e.key,o=e.type,a=n-1,u=n+1,c=t[n];if(c===null||c&&i==c.key&&o===c.type)return n;if(r>(c!=null&&(131072&c.__u)==0?1:0))for(;a>=0||u<t.length;){if(a>=0){if((c=t[a])&&(131072&c.__u)==0&&i==c.key&&o===c.type)return a;a--}if(u<t.length){if((c=t[u])&&(131072&c.__u)==0&&i==c.key&&o===c.type)return u;u++}}return-1}function L3(e,t,n){t[0]==="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||fW.test(t)?n:n+"px"}function Rg(e,t,n,r,i){var o;e:if(t==="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||L3(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||L3(e.style,t,n[t])}else if(t[0]==="o"&&t[1]==="n")o=t!==(t=t.replace(/(PointerCapture)$|Capture$/,"$1")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?r?n.u=r.u:(n.u=Date.now(),e.addEventListener(t,o?N3:$3,o)):e.removeEventListener(t,o?N3:$3,o);else{if(i)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!=="width"&&t!=="height"&&t!=="href"&&t!=="list"&&t!=="form"&&t!=="tabIndex"&&t!=="download"&&t!=="rowSpan"&&t!=="colSpan"&&t!=="role"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!=="-"?e.removeAttribute(t):e.setAttribute(t,n))}}function $3(e){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(Rn.event?Rn.event(e):e)}function N3(e){return this.l[e.type+!0](Rn.event?Rn.event(e):e)}function P3(e,t,n,r,i,o,a,u,c,d){var p,h,m,v,_,x,S,b,C,E,I,O,T,$,F,q=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[u=t.__e=n.__e]),(p=Rn.__b)&&p(t);e:if(typeof q=="function")try{if(b=t.props,C=(p=q.contextType)&&r[p.__c],E=p?C?C.props.value:p.__:r,n.__c?S=(h=t.__c=n.__c).__=h.__E:("prototype"in q&&q.prototype.render?t.__c=h=new q(b,E):(t.__c=h=new Ag(b,E),h.constructor=q,h.render=mW),C&&C.sub(h),h.props=b,h.state||(h.state={}),h.context=E,h.__n=r,m=h.__d=!0,h.__h=[],h._sb=[]),h.__s==null&&(h.__s=h.state),q.getDerivedStateFromProps!=null&&(h.__s==h.state&&(h.__s=Wa({},h.__s)),Wa(h.__s,q.getDerivedStateFromProps(b,h.__s))),v=h.props,_=h.state,h.__v=t,m)q.getDerivedStateFromProps==null&&h.componentWillMount!=null&&h.componentWillMount(),h.componentDidMount!=null&&h.__h.push(h.componentDidMount);else{if(q.getDerivedStateFromProps==null&&b!==v&&h.componentWillReceiveProps!=null&&h.componentWillReceiveProps(b,E),!h.__e&&(h.shouldComponentUpdate!=null&&h.shouldComponentUpdate(b,h.__s,E)===!1||t.__v===n.__v)){for(t.__v!==n.__v&&(h.props=b,h.state=h.__s,h.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(P){P&&(P.__=t)}),I=0;I<h._sb.length;I++)h.__h.push(h._sb[I]);h._sb=[],h.__h.length&&a.push(h);break e}h.componentWillUpdate!=null&&h.componentWillUpdate(b,h.__s,E),h.componentDidUpdate!=null&&h.__h.push(function(){h.componentDidUpdate(v,_,x)})}if(h.context=E,h.props=b,h.__P=e,h.__e=!1,O=Rn.__r,T=0,"prototype"in q&&q.prototype.render){for(h.state=h.__s,h.__d=!1,O&&O(t),p=h.render(h.props,h.state,h.context),$=0;$<h._sb.length;$++)h.__h.push(h._sb[$]);h._sb=[]}else do h.__d=!1,O&&O(t),p=h.render(h.props,h.state,h.context),h.state=h.__s;while(h.__d&&++T<25);h.state=h.__s,h.getChildContext!=null&&(r=Wa(Wa({},r),h.getChildContext())),m||h.getSnapshotBeforeUpdate==null||(x=h.getSnapshotBeforeUpdate(v,_)),M3(e,AS(F=p!=null&&p.type===RS&&p.key==null?p.props.children:p)?F:[F],t,n,r,i,o,a,u,c,d),h.base=t.__e,t.__u&=-161,h.__h.length&&a.push(h),S&&(h.__E=h.__=null)}catch(P){t.__v=null,c||o!=null?(t.__e=u,t.__u|=c?160:32,o[o.indexOf(u)]=null):(t.__e=n.__e,t.__k=n.__k),Rn.__e(P,t,n)}else o==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=gW(n.__e,t,n,r,i,o,a,c,d);(p=Rn.diffed)&&p(t)}function pW(e,t,n){t.__d=void 0;for(var r=0;r<n.length;r++)TS(n[r],n[++r],n[++r]);Rn.__c&&Rn.__c(t,e),e.some(function(i){try{e=i.__h,i.__h=[],e.some(function(o){o.call(i)})}catch(o){Rn.__e(o,i.__v)}})}function gW(e,t,n,r,i,o,a,u,c){var d,p,h,m,v,_,x,S=n.props,b=t.props,C=t.type;if(C==="svg"&&(i=!0),o!=null){for(d=0;d<o.length;d++)if((v=o[d])&&"setAttribute"in v==!!C&&(C?v.localName===C:v.nodeType===3)){e=v,o[d]=null;break}}if(e==null){if(C===null)return document.createTextNode(b);e=i?document.createElementNS("http://www.w3.org/2000/svg",C):document.createElement(C,b.is&&b),o=null,u=!1}if(C===null)S===b||u&&e.data===b||(e.data=b);else{if(o=o&&_3.call(e.childNodes),S=n.props||kS,!u&&o!=null)for(S={},d=0;d<e.attributes.length;d++)S[(v=e.attributes[d]).name]=v.value;for(d in S)v=S[d],d=="children"||(d=="dangerouslySetInnerHTML"?h=v:d==="key"||d in b||Rg(e,d,null,v,i));for(d in b)v=b[d],d=="children"?m=v:d=="dangerouslySetInnerHTML"?p=v:d=="value"?_=v:d=="checked"?x=v:d==="key"||u&&typeof v!="function"||S[d]===v||Rg(e,d,v,S[d],i);if(p)u||h&&(p.__html===h.__html||p.__html===e.innerHTML)||(e.innerHTML=p.__html),t.__k=[];else if(h&&(e.innerHTML=""),M3(e,AS(m)?m:[m],t,n,r,i&&C!=="foreignObject",o,a,o?o[0]:n.__k&&yu(n,0),u,c),o!=null)for(d=o.length;d--;)o[d]!=null&&O3(o[d]);u||(d="value",_!==void 0&&(_!==e[d]||C==="progress"&&!_||C==="option"&&_!==S[d])&&Rg(e,d,_,S[d],!1),d="checked",x!==void 0&&x!==e[d]&&Rg(e,d,x,S[d],!1))}return e}function TS(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(r){Rn.__e(r,n)}}function MS(e,t,n){var r,i;if(Rn.unmount&&Rn.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||TS(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(o){Rn.__e(o,t)}r.base=r.__P=null,e.__c=void 0}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&MS(r[i],t,n||typeof e.type!="function");n||e.__e==null||O3(e.__e),e.__=e.__e=e.__d=void 0}function mW(e,t,n){return this.constructor(e,n)}_3=R3.slice,Rn={__e:function(e,t,n,r){for(var i,o,a;t=t.__;)if((i=t.__c)&&!i.__)try{if((o=i.constructor)&&o.getDerivedStateFromError!=null&&(i.setState(o.getDerivedStateFromError(e)),a=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),a=i.__d),a)return i.__E=i}catch(u){e=u}throw e}},b3=0,Ag.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=Wa({},this.state),typeof e=="function"&&(e=e(Wa({},n),this.props)),e&&Wa(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),OS(this))},Ag.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),OS(this))},Ag.prototype.render=RS,Vs=[],w3=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ES=function(e,t){return e.__v.__b-t.__v.__b},Ig.__r=0,x3=0,function(e){e.Button="button",e.Tab="tab",e.Selector="selector"}(C3||(C3={})),function(e){e.Popover="popover",e.API="api",e.Widget="widget"}(E3||(E3={})),function(e){e.Open="open",e.MultipleChoice="multiple_choice",e.SingleChoice="single_choice",e.Rating="rating",e.Link="link"}(k3||(k3={})),function(e){e.NextQuestion="next_question",e.End="end",e.ResponseBased="response_based",e.SpecificQuestion="specific_question"}(A3||(A3={})),function(e){e.Once="once",e.Recurring="recurring",e.Always="always"}(I3||(I3={})),function(e,t){var n={__c:t="__cC"+x3++,__:e,Consumer:function(r,i){return r.children(i)},Provider:function(r){var i,o;return this.getChildContext||(i=[],(o={})[t]=this,this.getChildContext=function(){return o},this.shouldComponentUpdate=function(a){this.props.value!==a.value&&i.some(function(u){u.__e=!0,OS(u)})},this.sub=function(a){i.push(a);var u=a.componentWillUnmount;a.componentWillUnmount=function(){i.splice(i.indexOf(a),1),u&&u.call(a)}}),r.children}};n.Provider.__=n.Consumer.contextType=n}({isPreviewMode:!1,previewPageIndex:0,onPopupSurveyDismissed:()=>{},isPopup:!0,onPreviewSubmit:()=>{}});var _u=function(e,t){if(!function(n){try{new RegExp(n)}catch{return!1}return!0}(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}};class B3{constructor(){De(this,"events",{}),this.events={}}on(t,n){return this.events[t]||(this.events[t]=[]),this.events[t].push(n),()=>{this.events[t]=this.events[t].filter(r=>r!==n)}}emit(t,n){for(var r of this.events[t]||[])r(n);for(var i of this.events["*"]||[])i(t,n)}}class Zs{constructor(t){De(this,"_debugEventEmitter",new B3),De(this,"checkStep",(n,r)=>this.checkStepEvent(n,r)&&this.checkStepUrl(n,r)&&this.checkStepElement(n,r)),De(this,"checkStepEvent",(n,r)=>r==null||!r.event||(n==null?void 0:n.event)===(r==null?void 0:r.event)),this.instance=t,this.actionEvents=new Set,this.actionRegistry=new Set}init(){var t;if(!Fe((t=this.instance)===null||t===void 0?void 0:t._addCaptureHook)){var n;(n=this.instance)===null||n===void 0||n._addCaptureHook((r,i)=>{this.on(r,i)})}}register(t){var n,r;if(!Fe((n=this.instance)===null||n===void 0?void 0:n._addCaptureHook)&&(t.forEach(a=>{var u,c;(u=this.actionRegistry)===null||u===void 0||u.add(a),(c=a.steps)===null||c===void 0||c.forEach(d=>{var p;(p=this.actionEvents)===null||p===void 0||p.add((d==null?void 0:d.event)||"")})}),(r=this.instance)!==null&&r!==void 0&&r.autocapture)){var i,o=new Set;t.forEach(a=>{var u;(u=a.steps)===null||u===void 0||u.forEach(c=>{c!=null&&c.selector&&o.add(c==null?void 0:c.selector)})}),(i=this.instance)===null||i===void 0||i.autocapture.setElementSelectors(o)}}on(t,n){var r;n!=null&&t.length!=0&&(this.actionEvents.has(t)||this.actionEvents.has(n==null?void 0:n.event))&&this.actionRegistry&&((r=this.actionRegistry)===null||r===void 0?void 0:r.size)>0&&this.actionRegistry.forEach(i=>{this.checkAction(n,i)&&this._debugEventEmitter.emit("actionCaptured",i.name)})}_addActionHook(t){this.onAction("actionCaptured",n=>t(n))}checkAction(t,n){if((n==null?void 0:n.steps)==null)return!1;for(var r of n.steps)if(this.checkStep(t,r))return!0;return!1}onAction(t,n){return this._debugEventEmitter.on(t,n)}checkStepUrl(t,n){if(n!=null&&n.url){var r,i=t==null||(r=t.properties)===null||r===void 0?void 0:r.$current_url;if(!i||typeof i!="string"||!Zs.matchString(i,n==null?void 0:n.url,(n==null?void 0:n.url_matching)||"contains"))return!1}return!0}static matchString(t,n,r){switch(r){case"regex":return!!le&&_u(t,n);case"exact":return n===t;case"contains":var i=Zs.escapeStringRegexp(n).replace(/_/g,".").replace(/%/g,".*");return _u(t,i);default:return!1}}static escapeStringRegexp(t){return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}checkStepElement(t,n){if((n!=null&&n.href||n!=null&&n.tag_name||n!=null&&n.text)&&!this.getElementsList(t).some(o=>!(n!=null&&n.href&&!Zs.matchString(o.href||"",n==null?void 0:n.href,(n==null?void 0:n.href_matching)||"exact"))&&(n==null||!n.tag_name||o.tag_name===(n==null?void 0:n.tag_name))&&!(n!=null&&n.text&&!Zs.matchString(o.text||"",n==null?void 0:n.text,(n==null?void 0:n.text_matching)||"exact")&&!Zs.matchString(o.$el_text||"",n==null?void 0:n.text,(n==null?void 0:n.text_matching)||"exact"))))return!1;if(n!=null&&n.selector){var r,i=t==null||(r=t.properties)===null||r===void 0?void 0:r.$element_selectors;if(!i||!i.includes(n==null?void 0:n.selector))return!1}return!0}getElementsList(t){return(t==null?void 0:t.properties.$elements)==null?[]:t==null?void 0:t.properties.$elements}}class Gf{constructor(t){this.instance=t,this.eventToSurveys=new Map,this.actionToSurveys=new Map}register(t){var n;Fe((n=this.instance)===null||n===void 0?void 0:n._addCaptureHook)||(this.setupEventBasedSurveys(t),this.setupActionBasedSurveys(t))}setupActionBasedSurveys(t){var n=t.filter(r=>{var i,o,a,u;return((i=r.conditions)===null||i===void 0?void 0:i.actions)&&((o=r.conditions)===null||o===void 0||(a=o.actions)===null||a===void 0||(u=a.values)===null||u===void 0?void 0:u.length)>0});n.length!==0&&(this.actionMatcher==null&&(this.actionMatcher=new Zs(this.instance),this.actionMatcher.init(),this.actionMatcher._addActionHook(r=>{this.onAction(r)})),n.forEach(r=>{var i,o,a,u,c,d,p,h,m,v;r.conditions&&(i=r.conditions)!==null&&i!==void 0&&i.actions&&(o=r.conditions)!==null&&o!==void 0&&(a=o.actions)!==null&&a!==void 0&&a.values&&((u=r.conditions)===null||u===void 0||(c=u.actions)===null||c===void 0||(d=c.values)===null||d===void 0?void 0:d.length)>0&&((p=this.actionMatcher)===null||p===void 0||p.register(r.conditions.actions.values),(h=r.conditions)===null||h===void 0||(m=h.actions)===null||m===void 0||(v=m.values)===null||v===void 0||v.forEach(_=>{if(_&&_.name){var x=this.actionToSurveys.get(_.name);x&&x.push(r.id),this.actionToSurveys.set(_.name,x||[r.id])}}))}))}setupEventBasedSurveys(t){var n;t.filter(r=>{var i,o,a,u;return((i=r.conditions)===null||i===void 0?void 0:i.events)&&((o=r.conditions)===null||o===void 0||(a=o.events)===null||a===void 0||(u=a.values)===null||u===void 0?void 0:u.length)>0}).length!==0&&((n=this.instance)===null||n===void 0||n._addCaptureHook((r,i)=>{this.onEvent(r,i)}),t.forEach(r=>{var i,o,a;(i=r.conditions)===null||i===void 0||(o=i.events)===null||o===void 0||(a=o.values)===null||a===void 0||a.forEach(u=>{if(u&&u.name){var c=this.eventToSurveys.get(u.name);c&&c.push(r.id),this.eventToSurveys.set(u.name,c||[r.id])}})}))}onEvent(t,n){var r,i,o=((r=this.instance)===null||r===void 0||(i=r.persistence)===null||i===void 0?void 0:i.props[ag])||[];if(Gf.SURVEY_SHOWN_EVENT_NAME==t&&n&&o.length>0){var a,u=n==null||(a=n.properties)===null||a===void 0?void 0:a.$survey_id;if(u){var c=o.indexOf(u);c>=0&&(o.splice(c,1),this._updateActivatedSurveys(o))}}else this.eventToSurveys.has(t)&&this._updateActivatedSurveys(o.concat(this.eventToSurveys.get(t)||[]))}onAction(t){var n,r,i=((n=this.instance)===null||n===void 0||(r=n.persistence)===null||r===void 0?void 0:r.props[ag])||[];this.actionToSurveys.has(t)&&this._updateActivatedSurveys(i.concat(this.actionToSurveys.get(t)||[]))}_updateActivatedSurveys(t){var n,r;(n=this.instance)===null||n===void 0||(r=n.persistence)===null||r===void 0||r.register({[ag]:[...new Set(t)]})}getSurveys(){var t,n,r=(t=this.instance)===null||t===void 0||(n=t.persistence)===null||n===void 0?void 0:n.props[ag];return r||[]}getEventToSurveys(){return this.eventToSurveys}_getActionMatcher(){return this.actionMatcher}}De(Gf,"SURVEY_SHOWN_EVENT_NAME","survey shown");var pr=Ir("[Surveys]"),F3={icontains:(e,t)=>e.some(n=>t.toLowerCase().includes(n.toLowerCase())),not_icontains:(e,t)=>e.every(n=>!t.toLowerCase().includes(n.toLowerCase())),regex:(e,t)=>e.some(n=>_u(t,n)),not_regex:(e,t)=>e.every(n=>!_u(t,n)),exact:(e,t)=>e.some(n=>t===n),is_not:(e,t)=>e.every(n=>t!==n)};function U3(e){return e??"icontains"}class vW{constructor(t){De(this,"_isFetchingSurveys",!1),De(this,"_isInitializingSurveys",!1),De(this,"_surveyCallbacks",[]),this.instance=t,this._surveyEventReceiver=null}onRemoteConfig(t){var n=t.surveys;if(Kt(n))return pr.warn("Decide not loaded yet. Not loading surveys.");var r=An(n);this._hasSurveys=r?n.length>0:n,pr.info("decide response received, hasSurveys: ".concat(this._hasSurveys)),this._hasSurveys&&this.loadIfEnabled()}reset(){localStorage.removeItem("lastSeenSurveyDate");var t=(()=>{for(var n=[],r=0;r<localStorage.length;r++){var i=localStorage.key(r);i!=null&&i.startsWith("seenSurvey_")&&n.push(i)}return n})();t.forEach(n=>localStorage.removeItem(n))}loadIfEnabled(){if(!this._surveyManager)if(this._isInitializingSurveys)pr.info("Already initializing surveys, skipping...");else if(this.instance.config.disable_surveys)pr.info("Disabled. Not loading surveys.");else{var t=pt==null?void 0:pt.__PosthogExtensions__;if(t)if(this._hasSurveys){this._isInitializingSurveys=!0;try{var n=t.generateSurveys;if(n)this._surveyManager=n(this.instance),this._isInitializingSurveys=!1,this._surveyEventReceiver=new Gf(this.instance),pr.info("Surveys loaded successfully"),this._notifySurveyCallbacks({isLoaded:!0});else{var r=t.loadExternalDependency;if(r)r(this.instance,"surveys",o=>{if(o||!t.generateSurveys)return pr.error("Could not load surveys script",o),void(this._isInitializingSurveys=!1);this._surveyManager=t.generateSurveys(this.instance),this._isInitializingSurveys=!1,this._surveyEventReceiver=new Gf(this.instance),pr.info("Surveys loaded successfully"),this._notifySurveyCallbacks({isLoaded:!0})});else{var i="PostHog loadExternalDependency extension not found. Cannot load remote config.";pr.error(i),this._isInitializingSurveys=!1,this._notifySurveyCallbacks({isLoaded:!1,error:i})}}}catch(o){throw pr.error("Error initializing surveys",o),this._isInitializingSurveys=!1,this._notifySurveyCallbacks({isLoaded:!1,error:"Error initializing surveys"}),o}}else pr.info("No surveys to load.");else pr.error("PostHog Extensions not found.")}}onSurveysLoaded(t){return this._surveyCallbacks.push(t),this._surveyManager&&this._notifySurveyCallbacks({isLoaded:!0}),()=>{this._surveyCallbacks=this._surveyCallbacks.filter(n=>n!==t)}}getSurveys(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1];if(this.instance.config.disable_surveys)return pr.info("Disabled. Not loading surveys."),t([]);var r=this.instance.get_property(P1);if(r&&!n)return t(r,{isLoaded:!0});if(this._isFetchingSurveys)return t([],{isLoaded:!1,error:"Surveys are already being loaded"});try{this._isFetchingSurveys=!0,this.instance._send_request({url:this.instance.requestRouter.endpointFor("api","/api/surveys/?token=".concat(this.instance.config.token)),method:"GET",timeout:this.instance.config.surveys_request_timeout_ms,callback:i=>{var o;this._isFetchingSurveys=!1;var a=i.statusCode;if(a!==200||!i.json){var u="Surveys API could not be loaded, status: ".concat(a);return pr.error(u),t([],{isLoaded:!1,error:u})}var c,d=i.json.surveys||[],p=d.filter(h=>{var m,v,_,x,S,b,C,E,I,O,T,$;return((m=h.conditions)===null||m===void 0?void 0:m.events)&&((v=h.conditions)===null||v===void 0||(_=v.events)===null||_===void 0?void 0:_.values)&&((x=h.conditions)===null||x===void 0||(S=x.events)===null||S===void 0||(b=S.values)===null||b===void 0?void 0:b.length)>0||((C=h.conditions)===null||C===void 0?void 0:C.actions)&&((E=h.conditions)===null||E===void 0||(I=E.actions)===null||I===void 0?void 0:I.values)&&((O=h.conditions)===null||O===void 0||(T=O.actions)===null||T===void 0||($=T.values)===null||$===void 0?void 0:$.length)>0});return p.length>0&&((c=this._surveyEventReceiver)===null||c===void 0||c.register(p)),(o=this.instance.persistence)===null||o===void 0||o.register({[P1]:d}),t(d,{isLoaded:!0})}})}catch(i){throw this._isFetchingSurveys=!1,i}}_notifySurveyCallbacks(t){for(var n of this._surveyCallbacks)try{t.isLoaded?this.getSurveys(n):n([],t)}catch(r){pr.error("Error in survey callback",r)}}isSurveyFeatureFlagEnabled(t){return!t||this.instance.featureFlags.isFeatureEnabled(t)}getActiveMatchingSurveys(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.getSurveys(r=>{var i,o=r.filter(c=>!(!c.start_date||c.end_date)).filter(c=>{var d;if(!c.conditions)return!0;var p=function(v){var _,x,S;if((_=v.conditions)===null||_===void 0||!_.url)return!0;var b=le==null||(x=le.location)===null||x===void 0?void 0:x.href;if(!b)return!1;var C=[v.conditions.url];return F3[U3((S=v.conditions)===null||S===void 0?void 0:S.urlMatchType)](C,b)}(c),h=(d=c.conditions)===null||d===void 0||!d.selector||(He==null?void 0:He.querySelector(c.conditions.selector)),m=function(v){var _,x,S;if((_=v.conditions)===null||_===void 0||!_.deviceTypes||((x=v.conditions)===null||x===void 0?void 0:x.deviceTypes.length)===0)return!0;if(!jn)return!1;var b=bn.deviceType(jn);return F3[U3((S=v.conditions)===null||S===void 0?void 0:S.deviceTypesMatchType)](v.conditions.deviceTypes,b)}(c);return p&&h&&m}),a=(i=this._surveyEventReceiver)===null||i===void 0?void 0:i.getSurveys(),u=o.filter(c=>{var d,p,h,m,v,_,x,S,b;if(!(c.linked_flag_key||c.targeting_flag_key||c.internal_targeting_flag_key||(d=c.feature_flag_keys)!==null&&d!==void 0&&d.length))return!0;var C=this.isSurveyFeatureFlagEnabled(c.linked_flag_key),E=this.isSurveyFeatureFlagEnabled(c.targeting_flag_key),I=((p=(h=c.conditions)===null||h===void 0||(m=h.events)===null||m===void 0||(v=m.values)===null||v===void 0?void 0:v.length)!==null&&p!==void 0?p:0)>0,O=((_=(x=c.conditions)===null||x===void 0||(S=x.actions)===null||S===void 0||(b=S.values)===null||b===void 0?void 0:b.length)!==null&&_!==void 0?_:0)>0,T=!I&&!O||(a==null?void 0:a.includes(c.id)),$=this._canActivateRepeatedly(c)||this.isSurveyFeatureFlagEnabled(c.internal_targeting_flag_key),F=this.checkFlags(c);return C&&E&&$&&T&&F});return t(u)},n)}checkFlags(t){var n;return(n=t.feature_flag_keys)===null||n===void 0||!n.length||t.feature_flag_keys.every(r=>{var{key:i,value:o}=r;return!i||!o||this.instance.featureFlags.isFeatureEnabled(o)})}_canActivateRepeatedly(t){var n;return Kt((n=pt.__PosthogExtensions__)===null||n===void 0?void 0:n.canActivateRepeatedly)?(pr.warn("init was not called"),!1):pt.__PosthogExtensions__.canActivateRepeatedly(t)}canRenderSurvey(t){if(Kt(this._surveyManager))return pr.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var n=null;return this.getSurveys(r=>{var i=r.filter(o=>o.id===t)[0];n=i?pe({},this._surveyManager.canRenderSurvey(i)):{visible:!1,disabledReason:"Survey not found"}}),n}renderSurvey(t,n){Kt(this._surveyManager)?pr.warn("init was not called"):this.getSurveys(r=>{var i=r.filter(o=>o.id===t)[0];this._surveyManager.renderSurvey(i,He==null?void 0:He.querySelector(n))})}}var z3=Ir("[RateLimiter]");class yW{constructor(t){var n,r;De(this,"serverLimits",{}),De(this,"lastEventRateLimited",!1),De(this,"checkForLimiting",i=>{var o=i.text;if(o&&o.length)try{(JSON.parse(o).quota_limited||[]).forEach(a=>{z3.info("".concat(a||"events"," is quota limited.")),this.serverLimits[a]=new Date().getTime()+6e4})}catch(a){return void z3.warn('could not rate limit - continuing. Error: "'.concat(a==null?void 0:a.message,'"'),{text:o})}}),this.instance=t,this.captureEventsPerSecond=((n=t.config.rate_limiting)===null||n===void 0?void 0:n.events_per_second)||10,this.captureEventsBurstLimit=Math.max(((r=t.config.rate_limiting)===null||r===void 0?void 0:r.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(){var t,n,r,i=arguments.length>0&&arguments[0]!==void 0&&arguments[0],o=new Date().getTime(),a=(t=(n=this.instance.persistence)===null||n===void 0?void 0:n.get_property(F1))!==null&&t!==void 0?t:{tokens:this.captureEventsBurstLimit,last:o};a.tokens+=(o-a.last)/1e3*this.captureEventsPerSecond,a.last=o,a.tokens>this.captureEventsBurstLimit&&(a.tokens=this.captureEventsBurstLimit);var u=a.tokens<1;return u||i||(a.tokens=Math.max(0,a.tokens-1)),!u||this.lastEventRateLimited||i||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to ".concat(this.captureEventsPerSecond," events per second and ").concat(this.captureEventsBurstLimit," events burst limit.")},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=u,(r=this.instance.persistence)===null||r===void 0||r.set_property(F1,a),{isRateLimited:u,remainingTokens:a.tokens}}isServerRateLimited(t){var n=this.serverLimits[t||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var Ys=Ir("[RemoteConfig]");class _W{constructor(t){this.instance=t}get remoteConfig(){var t,n;return(t=pt._POSTHOG_REMOTE_CONFIG)===null||t===void 0||(n=t[this.instance.config.token])===null||n===void 0?void 0:n.config}_loadRemoteConfigJs(t){var n,r,i;(n=pt.__PosthogExtensions__)!==null&&n!==void 0&&n.loadExternalDependency?(r=pt.__PosthogExtensions__)===null||r===void 0||(i=r.loadExternalDependency)===null||i===void 0||i.call(r,this.instance,"remote-config",()=>t(this.remoteConfig)):(Ys.error("PostHog Extensions not found. Cannot load remote config."),t())}_loadRemoteConfigJSON(t){this.instance._send_request({method:"GET",url:this.instance.requestRouter.endpointFor("assets","/array/".concat(this.instance.config.token,"/config")),callback:n=>{t(n.json)}})}load(){try{if(this.remoteConfig)return Ys.info("Using preloaded remote config",this.remoteConfig),void this.onRemoteConfig(this.remoteConfig);if(this.instance.config.advanced_disable_decide)return void Ys.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs(t=>{if(!t)return Ys.info("No config found after loading remote JS config. Falling back to JSON."),void this._loadRemoteConfigJSON(n=>{this.onRemoteConfig(n)});this.onRemoteConfig(t)})}catch(t){Ys.error("Error loading remote config",t)}}onRemoteConfig(t){t?this.instance.config.__preview_remote_config?(this.instance._onRemoteConfig(t),t.hasFeatureFlags!==!1&&this.instance.featureFlags.ensureFlagsLoaded()):Ys.info("__preview_remote_config is disabled. Logging config instead",t):Ys.error("Failed to fetch remote config from PostHog.")}}var bW=function(e){var t,n,r,i,o="";for(t=n=0,r=(e=(e+"").replace(/\r\n/g,`
138
138
  `).replace(/\r/g,`
139
139
  `)).length,i=0;i<r;i++){var a=e.charCodeAt(i),u=null;a<128?n++:u=a>127&&a<2048?String.fromCharCode(a>>6|192,63&a|128):String.fromCharCode(a>>12|224,a>>6&63|128,63&a|128),qa(u)||(n>t&&(o+=e.substring(t,n)),o+=u,t=n=i+1)}return n>t&&(o+=e.substring(t,e.length)),o},SW=!!I1||!!A1,q3="text/plain",Og=(e,t)=>{var[n,r]=e.split("?"),i=pe({},t);r==null||r.split("&").forEach(a=>{var[u]=a.split("=");delete i[u]});var o=YZ(i);return o=o?(r?r+"&":"")+o:r,"".concat(n,"?").concat(o)},Vf=(e,t)=>JSON.stringify(e,(n,r)=>typeof r=="bigint"?r.toString():r,t),DS=e=>{var{data:t,compression:n}=e;if(t){if(n===ji.GZipJS){var r=UM(zM(Vf(t)),{mtime:0}),i=new Blob([r],{type:q3});return{contentType:q3,body:i,estimatedSize:i.size}}if(n===ji.Base64){var o=function(c){var d,p,h,m,v,_="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",x=0,S=0,b="",C=[];if(!c)return c;c=bW(c);do d=(v=c.charCodeAt(x++)<<16|c.charCodeAt(x++)<<8|c.charCodeAt(x++))>>18&63,p=v>>12&63,h=v>>6&63,m=63&v,C[S++]=_.charAt(d)+_.charAt(p)+_.charAt(h)+_.charAt(m);while(x<c.length);switch(b=C.join(""),c.length%3){case 1:b=b.slice(0,-2)+"==";break;case 2:b=b.slice(0,-1)+"="}return b}(Vf(t)),a=(c=>"data="+encodeURIComponent(typeof c=="string"?c:Vf(c)))(o);return{contentType:"application/x-www-form-urlencoded",body:a,estimatedSize:new Blob([a]).size}}var u=Vf(t);return{contentType:"application/json",body:u,estimatedSize:new Blob([u]).size}}},Zf=[];A1&&Zf.push({transport:"fetch",method:e=>{var t,n,{contentType:r,body:i,estimatedSize:o}=(t=DS(e))!==null&&t!==void 0?t:{},a=new Headers;on(e.headers,function(p,h){a.append(h,p)}),r&&a.append("Content-Type",r);var u=e.url,c=null;if(LT){var d=new LT;c={signal:d.signal,timeout:setTimeout(()=>d.abort(),e.timeout)}}A1(u,pe({method:(e==null?void 0:e.method)||"GET",headers:a,keepalive:e.method==="POST"&&(o||0)<52428.8,body:i,signal:(n=c)===null||n===void 0?void 0:n.signal},e.fetchOptions)).then(p=>p.text().then(h=>{var m,v={statusCode:p.status,text:h};if(p.status===200)try{v.json=JSON.parse(h)}catch(_){tt.error(_)}(m=e.callback)===null||m===void 0||m.call(e,v)})).catch(p=>{var h;tt.error(p),(h=e.callback)===null||h===void 0||h.call(e,{statusCode:0,text:p})}).finally(()=>c?clearTimeout(c.timeout):null)}}),I1&&Zf.push({transport:"XHR",method:e=>{var t,n=new I1;n.open(e.method||"GET",e.url,!0);var{contentType:r,body:i}=(t=DS(e))!==null&&t!==void 0?t:{};on(e.headers,function(o,a){n.setRequestHeader(a,o)}),r&&n.setRequestHeader("Content-Type",r),e.timeout&&(n.timeout=e.timeout),n.withCredentials=!0,n.onreadystatechange=()=>{if(n.readyState===4){var o,a={statusCode:n.status,text:n.responseText};if(n.status===200)try{a.json=JSON.parse(n.responseText)}catch{}(o=e.callback)===null||o===void 0||o.call(e,a)}},n.send(i)}}),ii!=null&&ii.sendBeacon&&Zf.push({transport:"sendBeacon",method:e=>{var t=Og(e.url,{beacon:"1"});try{var n,{contentType:r,body:i}=(n=DS(e))!==null&&n!==void 0?n:{},o=typeof i=="string"?new Blob([i],{type:r}):i;ii.sendBeacon(t,o)}catch{}}});var LS=3e3;class wW{constructor(t,n){De(this,"isPaused",!0),De(this,"queue",[]),this.flushTimeoutMs=bi((n==null?void 0:n.flush_interval_ms)||LS,250,5e3,"flush interval",LS),this.sendRequest=t}enqueue(t){this.queue.push(t),this.flushTimeout||this.setFlushTimeout()}unload(){this.clearFlushTimeout();var t=this.queue.length>0?this.formatQueue():{},n=Object.values(t),r=[...n.filter(i=>i.url.indexOf("/e")===0),...n.filter(i=>i.url.indexOf("/e")!==0)];r.map(i=>{this.sendRequest(pe(pe({},i),{},{transport:"sendBeacon"}))})}enable(){this.isPaused=!1,this.setFlushTimeout()}setFlushTimeout(){var t=this;this.isPaused||(this.flushTimeout=setTimeout(()=>{if(this.clearFlushTimeout(),this.queue.length>0){var n=this.formatQueue(),r=function(o){var a=n[o],u=new Date().getTime();a.data&&An(a.data)&&on(a.data,c=>{c.offset=Math.abs(c.timestamp-u),delete c.timestamp}),t.sendRequest(a)};for(var i in n)r(i)}},this.flushTimeoutMs))}clearFlushTimeout(){clearTimeout(this.flushTimeout),this.flushTimeout=void 0}formatQueue(){var t={};return on(this.queue,n=>{var r,i=n,o=(i?i.batchKey:null)||i.url;Fe(t[o])&&(t[o]=pe(pe({},i),{},{data:[]})),(r=t[o].data)===null||r===void 0||r.push(i.data)}),this.queue=[],t}}var xW=["retriesPerformedSoFar"];class CW{constructor(t){De(this,"isPolling",!1),De(this,"pollIntervalMs",3e3),De(this,"queue",[]),this.instance=t,this.queue=[],this.areWeOnline=!0,!Fe(le)&&"onLine"in le.navigator&&(this.areWeOnline=le.navigator.onLine,Nn(le,"online",()=>{this.areWeOnline=!0,this.flush()}),Nn(le,"offline",()=>{this.areWeOnline=!1}))}retriableRequest(t){var{retriesPerformedSoFar:n}=t,r=UT(t,xW);$r(n)&&n>0&&(r.url=Og(r.url,{retry_count:n})),this.instance._send_request(pe(pe({},r),{},{callback:i=>{var o;i.statusCode!==200&&(i.statusCode<400||i.statusCode>=500)&&(n??0)<10?this.enqueue(pe({retriesPerformedSoFar:n},r)):(o=r.callback)===null||o===void 0||o.call(r,i)}}))}enqueue(t){var n=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=n+1;var r=function(a){var u=3e3*Math.pow(2,a),c=u/2,d=Math.min(18e5,u),p=(Math.random()-.5)*(d-c);return Math.ceil(d+p)}(n),i=Date.now()+r;this.queue.push({retryAt:i,requestOptions:t});var o="Enqueued failed request for retry in ".concat(r);navigator.onLine||(o+=" (Browser is offline)"),tt.warn(o),this.isPolling||(this.isPolling=!0,this.poll())}poll(){this.poller&&clearTimeout(this.poller),this.poller=setTimeout(()=>{this.areWeOnline&&this.queue.length>0&&this.flush(),this.poll()},this.pollIntervalMs)}flush(){var t=Date.now(),n=[],r=this.queue.filter(o=>o.retryAt<t||(n.push(o),!1));if(this.queue=n,r.length>0)for(var{requestOptions:i}of r)this.retriableRequest(i)}unload(){for(var{requestOptions:t}of(this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.queue))try{this.instance._send_request(pe(pe({},t),{},{transport:"sendBeacon"}))}catch(n){tt.error(n)}this.queue=[]}}class EW{constructor(t){De(this,"_updateScrollData",()=>{var n,r,i,o;this.context||(this.context={});var a=this.scrollElement(),u=this.scrollY(),c=a?Math.max(0,a.scrollHeight-a.clientHeight):0,d=u+((a==null?void 0:a.clientHeight)||0),p=(a==null?void 0:a.scrollHeight)||0;this.context.lastScrollY=Math.ceil(u),this.context.maxScrollY=Math.max(u,(n=this.context.maxScrollY)!==null&&n!==void 0?n:0),this.context.maxScrollHeight=Math.max(c,(r=this.context.maxScrollHeight)!==null&&r!==void 0?r:0),this.context.lastContentY=d,this.context.maxContentY=Math.max(d,(i=this.context.maxContentY)!==null&&i!==void 0?i:0),this.context.maxContentHeight=Math.max(p,(o=this.context.maxContentHeight)!==null&&o!==void 0?o:0)}),this.instance=t}getContext(){return this.context}resetContext(){var t=this.context;return setTimeout(this._updateScrollData,0),t}startMeasuringScrollPosition(){Nn(le,"scroll",this._updateScrollData,{capture:!0}),Nn(le,"scrollend",this._updateScrollData,{capture:!0}),Nn(le,"resize",this._updateScrollData)}scrollElement(){if(!this.instance.config.scroll_root_selector)return le==null?void 0:le.document.documentElement;var t=An(this.instance.config.scroll_root_selector)?this.instance.config.scroll_root_selector:[this.instance.config.scroll_root_selector];for(var n of t){var r=le==null?void 0:le.document.querySelector(n);if(r)return r}}scrollY(){if(this.instance.config.scroll_root_selector){var t=this.scrollElement();return t&&t.scrollTop||0}return le&&(le.scrollY||le.pageYOffset||le.document.documentElement.scrollTop)||0}scrollX(){if(this.instance.config.scroll_root_selector){var t=this.scrollElement();return t&&t.scrollLeft||0}return le&&(le.scrollX||le.pageXOffset||le.document.documentElement.scrollLeft)||0}}var kW=e=>bn.personInfo({maskPersonalDataProperties:e==null?void 0:e.config.mask_personal_data_properties,customPersonalDataProperties:e==null?void 0:e.config.custom_personal_data_properties});class AW{constructor(t,n,r,i){De(this,"_onSessionIdCallback",o=>{var a=this._getStored();if(!a||a.sessionId!==o){var u={sessionId:o,props:this._sessionSourceParamGenerator(this.instance)};this._persistence.register({[B1]:u})}}),this.instance=t,this._sessionIdManager=n,this._persistence=r,this._sessionSourceParamGenerator=i||kW,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[B1]}getSetOnceProps(){var t,n=(t=this._getStored())===null||t===void 0?void 0:t.props;return n?"r"in n?bn.personPropsFromInfo(n):{$referring_domain:n.referringDomain,$pathname:n.initialPathName,utm_source:n.utm_source,utm_campaign:n.utm_campaign,utm_medium:n.utm_medium,utm_content:n.utm_content,utm_term:n.utm_term}:{}}getSessionProps(){var t={};return on(Rf(this.getSetOnceProps()),(n,r)=>{r==="$current_url"&&(r="url"),t["$session_entry_".concat(O1(r))]=n}),t}}var j3=Ir("[SessionId]");class IW{constructor(t,n,r){var i;if(De(this,"_sessionIdChangedHandlers",[]),!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.__preview_experimental_cookieless_mode)throw new Error("SessionIdManager cannot be used with __preview_experimental_cookieless_mode");this.config=t.config,this.persistence=t.persistence,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this._sessionIdGenerator=n||Va,this._windowIdGenerator=r||Va;var o=this.config.persistence_name||this.config.token,a=this.config.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*bi(a,60,36e3,"session_idle_timeout_seconds",1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.resetIdleTimer(),this._window_id_storage_key="ph_"+o+"_window_id",this._primary_window_exists_storage_key="ph_"+o+"_primary_window_exists",this._canUseSessionStorage()){var u=hr.parse(this._window_id_storage_key),c=hr.parse(this._primary_window_exists_storage_key);u&&!c?this._windowId=u:hr.remove(this._window_id_storage_key),hr.set(this._primary_window_exists_storage_key,!0)}if((i=this.config.bootstrap)!==null&&i!==void 0&&i.sessionID)try{var d=(p=>{var h=p.replace(/-/g,"");if(h.length!==32)throw new Error("Not a valid UUID");if(h[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(h.substring(0,12),16)})(this.config.bootstrap.sessionID);this._setSessionId(this.config.bootstrap.sessionID,new Date().getTime(),d)}catch(p){j3.error("Invalid sessionID in bootstrap",p)}this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return Fe(this._sessionIdChangedHandlers)&&(this._sessionIdChangedHandlers=[]),this._sessionIdChangedHandlers.push(t),this._sessionId&&t(this._sessionId,this._windowId),()=>{this._sessionIdChangedHandlers=this._sessionIdChangedHandlers.filter(n=>n!==t)}}_canUseSessionStorage(){return this.config.persistence!=="memory"&&!this.persistence.disabled&&hr.is_supported()}_setWindowId(t){t!==this._windowId&&(this._windowId=t,this._canUseSessionStorage()&&hr.set(this._window_id_storage_key,t))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?hr.parse(this._window_id_storage_key):null}_setSessionId(t,n,r){t===this._sessionId&&n===this._sessionActivityTimestamp&&r===this._sessionStartTimestamp||(this._sessionStartTimestamp=r,this._sessionActivityTimestamp=n,this._sessionId=t,this.persistence.register({[ig]:[n,t,r]}))}_getSessionId(){if(this._sessionId&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this._sessionId,this._sessionStartTimestamp];var t=this.persistence.props[ig];return An(t)&&t.length===2&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this._setSessionId(null,null,null)}_listenToReloadWindow(){Nn(le,"beforeunload",()=>{this._canUseSessionStorage()&&hr.remove(this._primary_window_exists_storage_key)},{capture:!1})}checkAndGetSessionAndWindowId(){var t=arguments.length>0&&arguments[0]!==void 0&&arguments[0],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(this.config.__preview_experimental_cookieless_mode)throw new Error("checkAndGetSessionAndWindowId should not be called in __preview_experimental_cookieless_mode");var r=n||new Date().getTime(),[i,o,a]=this._getSessionId(),u=this._getWindowId(),c=$r(a)&&a>0&&Math.abs(r-a)>864e5,d=!1,p=!o,h=!t&&Math.abs(r-i)>this.sessionTimeoutMs;p||h||c?(o=this._sessionIdGenerator(),u=this._windowIdGenerator(),j3.info("new session ID generated",{sessionId:o,windowId:u,changeReason:{noSessionId:p,activityTimeout:h,sessionPastMaximumLength:c}}),a=r,d=!0):u||(u=this._windowIdGenerator(),d=!0);var m=i===0||!t||c?r:i,v=a===0?new Date().getTime():a;return this._setWindowId(u),this._setSessionId(o,m,v),t||this.resetIdleTimer(),d&&this._sessionIdChangedHandlers.forEach(_=>_(o,u,d?{noSessionId:p,activityTimeout:h,sessionPastMaximumLength:c}:void 0)),{sessionId:o,windowId:u,sessionStartTimestamp:v,changeReason:d?{noSessionId:p,activityTimeout:h,sessionPastMaximumLength:c}:void 0,lastActivityTimestamp:i}}resetIdleTimer(){clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=setTimeout(()=>{this.resetSessionId()},1.1*this.sessionTimeoutMs)}}var RW=["$set_once","$set"],Ka=Ir("[SiteApps]");class OW{constructor(t){this.instance=t,this.bufferedInvocations=[],this.apps={}}get isEnabled(){return!!this.instance.config.opt_in_site_apps}eventCollector(t,n){if(n){var r=this.globalsForEvent(n);this.bufferedInvocations.push(r),this.bufferedInvocations.length>1e3&&(this.bufferedInvocations=this.bufferedInvocations.slice(10))}}get siteAppLoaders(){var t,n;return(t=pt._POSTHOG_REMOTE_CONFIG)===null||t===void 0||(n=t[this.instance.config.token])===null||n===void 0?void 0:n.siteApps}init(){if(this.isEnabled){var t=this.instance._addCaptureHook(this.eventCollector.bind(this));this.stopBuffering=()=>{t(),this.bufferedInvocations=[],this.stopBuffering=void 0}}}globalsForEvent(t){var n,r,i,o,a,u,c;if(!t)throw new Error("Event payload is required");var d={},p=this.instance.get_property("$groups")||[],h=this.instance.get_property("$stored_group_properties")||{};for(var[m,v]of Object.entries(h))d[m]={id:p[m],type:m,properties:v};var{$set_once:_,$set:x}=t;return{event:pe(pe({},UT(t,RW)),{},{properties:pe(pe(pe({},t.properties),x?{$set:pe(pe({},(n=(r=t.properties)===null||r===void 0?void 0:r.$set)!==null&&n!==void 0?n:{}),x)}:{}),_?{$set_once:pe(pe({},(i=(o=t.properties)===null||o===void 0?void 0:o.$set_once)!==null&&i!==void 0?i:{}),_)}:{}),elements_chain:(a=(u=t.properties)===null||u===void 0?void 0:u.$elements_chain)!==null&&a!==void 0?a:"",distinct_id:(c=t.properties)===null||c===void 0?void 0:c.distinct_id}),person:{properties:this.instance.get_property("$stored_person_properties")},groups:d}}setupSiteApp(t){var n=this.apps[t.id],r=()=>{var u;!n.errored&&this.bufferedInvocations.length&&(Ka.info("Processing ".concat(this.bufferedInvocations.length," events for site app with id ").concat(t.id)),this.bufferedInvocations.forEach(c=>{var d;return(d=n.processEvent)===null||d===void 0?void 0:d.call(n,c)}),n.processedBuffer=!0),Object.values(this.apps).every(c=>c.processedBuffer||c.errored)&&((u=this.stopBuffering)===null||u===void 0||u.call(this))},i=!1,o=u=>{n.errored=!u,n.loaded=!0,Ka.info("Site app with id ".concat(t.id," ").concat(u?"loaded":"errored")),i&&r()};try{var{processEvent:a}=t.init({posthog:this.instance,callback:u=>{o(u)}});a&&(n.processEvent=a),i=!0}catch(u){Ka.error("Error while initializing PostHog app with config id ".concat(t.id),u),o(!1)}if(i&&n.loaded)try{r()}catch(u){Ka.error("Error while processing buffered events PostHog app with config id ".concat(t.id),u),n.errored=!0}}setupSiteApps(){var t=this.siteAppLoaders||[];for(var n of t)this.apps[n.id]={id:n.id,loaded:!1,errored:!1,processedBuffer:!1};for(var r of t)this.setupSiteApp(r)}onCapturedEvent(t){if(Object.keys(this.apps).length!==0){var n=this.globalsForEvent(t);for(var r of Object.values(this.apps))try{var i;(i=r.processEvent)===null||i===void 0||i.call(r,n)}catch(o){Ka.error("Error while processing event ".concat(t.event," for site app ").concat(r.id),o)}}}onRemoteConfig(t){var n,r,i,o=this;if((n=this.siteAppLoaders)!==null&&n!==void 0&&n.length)return this.isEnabled?(this.setupSiteApps(),void this.instance.on("eventCaptured",d=>this.onCapturedEvent(d))):void Ka.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((r=this.stopBuffering)===null||r===void 0||r.call(this),(i=t.siteApps)!==null&&i!==void 0&&i.length)if(this.isEnabled){var a=function(d,p){var h,m;pt["__$$ph_site_app_".concat(d)]=o.instance,(h=pt.__PosthogExtensions__)===null||h===void 0||(m=h.loadSiteApp)===null||m===void 0||m.call(h,o.instance,p,v=>{if(v)return Ka.error("Error while initializing PostHog app with config id ".concat(d),v)})};for(var{id:u,url:c}of t.siteApps)a(u,c)}else Ka.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var Ws,TW=["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","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","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","googleweblight","mediapartners-google","storebot-google","bytespider"],H3=function(e,t){if(!e)return!1;var n=e.toLowerCase();return TW.concat(t||[]).some(r=>{var i=r.toLowerCase();return n.indexOf(i)!==-1})},G3=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&H3(n,t))return!0;try{var r=e==null?void 0:e.userAgentData;if(r!=null&&r.brands&&r.brands.some(i=>H3(i==null?void 0:i.brand,t)))return!0}catch{}return!!e.webdriver};function V3(e,t,n){return Vf({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}(function(e){e.US="us",e.EU="eu",e.CUSTOM="custom"})(Ws||(Ws={}));var Z3="i.posthog.com";class MW{constructor(t){De(this,"_regionCache",{}),this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return t==="https://app.posthog.com"?"https://us.i.posthog.com":t}get uiHost(){var t,n=(t=this.instance.config.ui_host)===null||t===void 0?void 0:t.replace(/\/$/,"");return n||(n=this.apiHost.replace(".".concat(Z3),".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this._regionCache[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=Ws.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=Ws.EU:this._regionCache[this.apiHost]=Ws.CUSTOM),this._regionCache[this.apiHost]}endpointFor(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";if(n&&(n=n[0]==="/"?n:"/".concat(n)),t==="ui")return this.uiHost+n;if(this.region===Ws.CUSTOM)return this.apiHost+n;var r=Z3+n;switch(t){case"assets":return"https://".concat(this.region,"-assets.").concat(r);case"api":return"https://".concat(this.region,".").concat(r)}}}var DW={icontains:(e,t)=>!!le&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!le&&t.href.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>!!le&&_u(t.href,e),not_regex:(e,t)=>!!le&&!_u(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class Or{constructor(t){var n=this;De(this,"getWebExperimentsAndEvaluateDisplayLogic",function(){var r=arguments.length>0&&arguments[0]!==void 0&&arguments[0];n.getWebExperiments(i=>{Or.logInfo("retrieved web experiments from the server"),n._flagToExperiments=new Map,i.forEach(o=>{if(o.feature_flag_key){var a;n._flagToExperiments&&(Or.logInfo("setting flag key ",o.feature_flag_key," to web experiment ",o),(a=n._flagToExperiments)===null||a===void 0||a.set(o.feature_flag_key,o));var u=n.instance.getFeatureFlag(o.feature_flag_key);Hn(u)&&o.variants[u]&&n.applyTransforms(o.name,u,o.variants[u].transforms)}else if(o.variants)for(var c in o.variants){var d=o.variants[c];Or.matchesTestVariant(d)&&n.applyTransforms(o.name,c,d.transforms)}})},r)}),this.instance=t,this.instance.onFeatureFlags(r=>{this.onFeatureFlags(r)})}onFeatureFlags(t){if(this._is_bot())Or.logInfo("Refusing to render web experiment since the viewer is a likely bot");else if(!this.instance.config.disable_web_experiments){if(Kt(this._flagToExperiments))return this._flagToExperiments=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Or.logInfo("applying feature flags",t),t.forEach(n=>{var r;if(this._flagToExperiments&&(r=this._flagToExperiments)!==null&&r!==void 0&&r.has(n)){var i,o=this.instance.getFeatureFlag(n),a=(i=this._flagToExperiments)===null||i===void 0?void 0:i.get(n);o&&a!=null&&a.variants[o]&&this.applyTransforms(a.name,o,a.variants[o].transforms)}})}}previewWebExperiment(){var t=Or.getWindowLocation();if(t!=null&&t.search){var n=dg(t==null?void 0:t.search,"__experiment_id"),r=dg(t==null?void 0:t.search,"__experiment_variant");n&&r&&(Or.logInfo("previewing web experiments ".concat(n," && ").concat(r)),this.getWebExperiments(i=>{this.showPreviewWebExperiment(parseInt(n),r,i)},!1,!0))}}loadIfEnabled(){this.instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,n,r){if(this.instance.config.disable_web_experiments&&!r)return t([]);var i=this.instance.get_property("$web_experiments");if(i&&!n)return t(i);this.instance._send_request({url:this.instance.requestRouter.endpointFor("api","/api/web_experiments/?token=".concat(this.instance.config.token)),method:"GET",callback:o=>{if(o.statusCode!==200||!o.json)return t([]);var a=o.json.experiments||[];return t(a)}})}showPreviewWebExperiment(t,n,r){var i=r.filter(o=>o.id===t);i&&i.length>0&&(Or.logInfo("Previewing web experiment [".concat(i[0].name,"] with variant [").concat(n,"]")),this.applyTransforms(i[0].name,n,i[0].variants[n].transforms))}static matchesTestVariant(t){return!Kt(t.conditions)&&Or.matchUrlConditions(t)&&Or.matchUTMConditions(t)}static matchUrlConditions(t){var n;if(Kt(t.conditions)||Kt((n=t.conditions)===null||n===void 0?void 0:n.url))return!0;var r,i,o,a=Or.getWindowLocation();return!!a&&((r=t.conditions)===null||r===void 0||!r.url||DW[(i=(o=t.conditions)===null||o===void 0?void 0:o.urlMatchType)!==null&&i!==void 0?i:"icontains"](t.conditions.url,a))}static getWindowLocation(){return le==null?void 0:le.location}static matchUTMConditions(t){var n;if(Kt(t.conditions)||Kt((n=t.conditions)===null||n===void 0?void 0:n.utm))return!0;var r=bn.campaignParams();if(r.utm_source){var i,o,a,u,c,d,p,h,m,v,_,x,S,b,C,E,I=(i=t.conditions)===null||i===void 0||(o=i.utm)===null||o===void 0||!o.utm_campaign||((a=t.conditions)===null||a===void 0||(u=a.utm)===null||u===void 0?void 0:u.utm_campaign)==r.utm_campaign,O=(c=t.conditions)===null||c===void 0||(d=c.utm)===null||d===void 0||!d.utm_source||((p=t.conditions)===null||p===void 0||(h=p.utm)===null||h===void 0?void 0:h.utm_source)==r.utm_source,T=(m=t.conditions)===null||m===void 0||(v=m.utm)===null||v===void 0||!v.utm_medium||((_=t.conditions)===null||_===void 0||(x=_.utm)===null||x===void 0?void 0:x.utm_medium)==r.utm_medium,$=(S=t.conditions)===null||S===void 0||(b=S.utm)===null||b===void 0||!b.utm_term||((C=t.conditions)===null||C===void 0||(E=C.utm)===null||E===void 0?void 0:E.utm_term)==r.utm_term;return I&&T&&$&&O}return!1}static logInfo(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];tt.info("[WebExperiments] ".concat(t),r)}applyTransforms(t,n,r){this._is_bot()?Or.logInfo("Refusing to render web experiment since the viewer is a likely bot"):n!=="control"?r.forEach(i=>{if(i.selector){var o;Or.logInfo("applying transform of variant ".concat(n," for experiment ").concat(t," "),i);var a=(o=document)===null||o===void 0?void 0:o.querySelectorAll(i.selector);a==null||a.forEach(u=>{var c=u;i.html&&(c.innerHTML=i.html),i.css&&c.setAttribute("style",i.css)})}}):Or.logInfo("Control variants leave the page unmodified.")}_is_bot(){return ii&&this.instance?G3(ii,this.instance.config.custom_blocked_useragents):void 0}}var Yf={},$S=()=>{},bu="posthog",Y3=!SW&&(jn==null?void 0:jn.indexOf("MSIE"))===-1&&(jn==null?void 0:jn.indexOf("Mozilla"))===-1,W3=()=>{var e;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:BZ(He==null?void 0:He.location),persistence:"localStorage+cookie",persistence_name:"",loaded:$S,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:!0,capture_pageleave:"if_capture_pageview",debug:Vr&&Hn(Vr==null?void 0:Vr.search)&&Vr.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(le==null||(e=le.location)===null||e===void 0?void 0:e.protocol)==="https:",ip:!0,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",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,session_recording:{},mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:t=>{var n="Bad HTTP status: "+t.statusCode+" "+t.text;tt.error(n)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:LS},_onCapture:$S}},K3=e=>{var t={};Fe(e.process_person)||(t.person_profiles=e.process_person),Fe(e.xhr_headers)||(t.request_headers=e.xhr_headers),Fe(e.cookie_name)||(t.persistence_name=e.cookie_name),Fe(e.disable_cookie)||(t.disable_persistence=e.disable_cookie),Fe(e.store_google)||(t.save_campaign_params=e.store_google),Fe(e.verbose)||(t.debug=e.verbose);var n=Gn({},t,e);return An(e.property_blacklist)&&(Fe(e.property_denylist)?n.property_denylist=e.property_blacklist:An(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:tt.error("Invalid value for property_denylist config: "+e.property_denylist)),n};class LW{constructor(){De(this,"__forceAllowLocalhost",!1)}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(t){tt.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class Tg{get decideEndpointWasHit(){var t,n;return(t=(n=this.featureFlags)===null||n===void 0?void 0:n.hasLoadedFlags)!==null&&t!==void 0&&t}constructor(){De(this,"webPerformance",new LW),De(this,"_personProcessingSetOncePropertiesSent",!1),De(this,"version",Ho.LIB_VERSION),De(this,"_internalEventEmitter",new B3),this.config=W3(),this.SentryIntegration=qY,this.sentryIntegration=t=>function(n,r){var i=VM(n,r);return{name:GM,processEvent:o=>i(o)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this._initialPersonProfilesConfig=null,this._cachedPersonProperties=null,this.featureFlags=new uW(this),this.toolbar=new HY(this),this.scrollManager=new EW(this),this.pageViewManager=new KY(this),this.surveys=new vW(this),this.experiments=new Or(this),this.exceptions=new QY(this),this.rateLimiter=new yW(this),this.requestRouter=new MW(this),this.consent=new sY(this),this.people={set:(t,n,r)=>{var i=Hn(t)?{[t]:n}:t;this.setPersonProperties(i),r==null||r({})},set_once:(t,n,r)=>{var i=Hn(t)?{[t]:n}:t;this.setPersonProperties(void 0,i),r==null||r({})}},this.on("eventCaptured",t=>tt.info('send "'.concat(t==null?void 0:t.event,'"'),t))}init(t,n,r){if(r&&r!==bu){var i,o=(i=Yf[r])!==null&&i!==void 0?i:new Tg;return o._init(t,n,r),Yf[r]=o,Yf[bu][r]=o,o}return this._init(t,n,r)}_init(t){var n,r,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=arguments.length>2?arguments[2]:void 0;if(Fe(t)||T1(t))return tt.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 tt.warn("You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},this._triggered_notifs=[],i.person_profiles&&(this._initialPersonProfilesConfig=i.person_profiles),this.set_config(Gn({},W3(),K3(i),{name:o,token:t})),this.config.on_xhr_error&&tt.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:ji.GZipJS,this.persistence=new CS(this.config),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new CS(pe(pe({},this.config),{},{persistence:"sessionStorage"}));var a=pe({},this.persistence.props),u=pe({},this.sessionPersistence.props);if(this._requestQueue=new wW(b=>this._send_retriable_request(b),this.config.request_queue_config),this._retryQueue=new CW(this),this.__request_queue=[],this.config.__preview_experimental_cookieless_mode||(this.sessionManager=new IW(this),this.sessionPropsManager=new AW(this,this.sessionManager,this.persistence)),new VY(this).startIfEnabledOrStop(),this.siteApps=new OW(this),(n=this.siteApps)===null||n===void 0||n.init(),this.config.__preview_experimental_cookieless_mode||(this.sessionRecording=new UY(this),this.sessionRecording.startIfEnabledOrStop()),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new XZ(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new WY(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new ZY(this),this.exceptionObserver=new cY(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new wM(this,uY),this.deadClicksAutocapture.startIfEnabled(),Ho.DEBUG=Ho.DEBUG||this.config.debug,Ho.DEBUG&&tt.info("Starting in debug mode",{this:this,config:i,thisC:pe({},this.config),p:a,s:u}),this._sync_opt_out_with_persistence(),((r=i.bootstrap)===null||r===void 0?void 0:r.distinctID)!==void 0){var c,d,p=this.config.get_device_id(Va()),h=(c=i.bootstrap)!==null&&c!==void 0&&c.isIdentifiedID?p:i.bootstrap.distinctID;this.persistence.set_property(Go,(d=i.bootstrap)!==null&&d!==void 0&&d.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:i.bootstrap.distinctID,$device_id:h})}if(this._hasBootstrappedFeatureFlags()){var m,v,_=Object.keys(((m=i.bootstrap)===null||m===void 0?void 0:m.featureFlags)||{}).filter(b=>{var C,E;return!((C=i.bootstrap)===null||C===void 0||(E=C.featureFlags)===null||E===void 0||!E[b])}).reduce((b,C)=>{var E,I;return b[C]=((E=i.bootstrap)===null||E===void 0||(I=E.featureFlags)===null||I===void 0?void 0:I[C])||!1,b},{}),x=Object.keys(((v=i.bootstrap)===null||v===void 0?void 0:v.featureFlagPayloads)||{}).filter(b=>_[b]).reduce((b,C)=>{var E,I,O,T;return(E=i.bootstrap)!==null&&E!==void 0&&(I=E.featureFlagPayloads)!==null&&I!==void 0&&I[C]&&(b[C]=(O=i.bootstrap)===null||O===void 0||(T=O.featureFlagPayloads)===null||T===void 0?void 0:T[C]),b},{});this.featureFlags.receivedFeatureFlags({featureFlags:_,featureFlagPayloads:x})}if(this.config.__preview_experimental_cookieless_mode)this.register_once({distinct_id:rM,$device_id:null},"");else if(!this.get_distinct_id()){var S=this.config.get_device_id(Va());this.register_once({distinct_id:S,$device_id:S},""),this.persistence.set_property(Go,"anonymous")}return Nn(le,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),i.segment?zY(this,()=>this._loaded()):this._loaded(),Hi(this.config._onCapture)&&this.config._onCapture!==$S&&(tt.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",b=>this.config._onCapture(b.event,b))),this}_onRemoteConfig(t){var n,r,i,o,a,u,c,d;if(!He||!He.body)return tt.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this._onRemoteConfig(t)},500);this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=Rt(t.supportedCompression,ji.GZipJS)?ji.GZipJS:Rt(t.supportedCompression,ji.Base64)?ji.Base64:void 0),(n=t.analytics)!==null&&n!==void 0&&n.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:"identified_only"}),(r=this.siteApps)===null||r===void 0||r.onRemoteConfig(t),(i=this.sessionRecording)===null||i===void 0||i.onRemoteConfig(t),(o=this.autocapture)===null||o===void 0||o.onRemoteConfig(t),(a=this.heatmaps)===null||a===void 0||a.onRemoteConfig(t),this.surveys.onRemoteConfig(t),(u=this.webVitalsAutocapture)===null||u===void 0||u.onRemoteConfig(t),(c=this.exceptionObserver)===null||c===void 0||c.onRemoteConfig(t),(d=this.deadClicksAutocapture)===null||d===void 0||d.onRemoteConfig(t)}_loaded(){try{this.config.loaded(this)}catch(t){tt.critical("`loaded` function failed",t)}this._start_queue_if_opted_in(),this.config.capture_pageview&&setTimeout(()=>{this.consent.isOptedIn()&&this._captureInitialPageview()},1),new _W(this).load(),this.featureFlags.decide()}_start_queue_if_opted_in(){var t;this.has_opted_out_capturing()||this.config.request_batching&&((t=this._requestQueue)===null||t===void 0||t.enable())}_dom_loaded(){this.has_opted_out_capturing()||Ha(this.__request_queue,t=>this._send_retriable_request(t)),this.__request_queue=[],this._start_queue_if_opted_in()}_handle_unload(){var t,n;this.config.request_batching?(this._shouldCapturePageleave()&&this.capture("$pageleave"),(t=this._requestQueue)===null||t===void 0||t.unload(),(n=this._retryQueue)===null||n===void 0||n.unload()):this._shouldCapturePageleave()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}_send_request(t){this.__loaded&&(Y3?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)||(t.transport=t.transport||this.config.api_transport,t.url=Og(t.url,{ip:this.config.ip?1:0}),t.headers=pe({},this.config.request_headers),t.compression=t.compression==="best-available"?this.compression:t.compression,t.fetchOptions=t.fetchOptions||this.config.fetch_options,(n=>{var r,i,o,a=pe({},n);a.timeout=a.timeout||6e4,a.url=Og(a.url,{_:new Date().getTime().toString(),ver:Ho.LIB_VERSION,compression:a.compression});var u=(r=a.transport)!==null&&r!==void 0?r:"fetch",c=(i=(o=qT(Zf,d=>d.transport===u))===null||o===void 0?void 0:o.method)!==null&&i!==void 0?i:Zf[0].method;if(!c)throw new Error("No available transport method");c(a)})(pe(pe({},t),{},{callback:n=>{var r,i,o;this.rateLimiter.checkForLimiting(n),n.statusCode>=400&&((i=(o=this.config).on_request_error)===null||i===void 0||i.call(o,n)),(r=t.callback)===null||r===void 0||r.call(t,n)}}))))}_send_retriable_request(t){this._retryQueue?this._retryQueue.retriableRequest(t):this._send_request(t)}_execute_array(t){var n,r=[],i=[],o=[];Ha(t,u=>{u&&(n=u[0],An(n)?o.push(u):Hi(u)?u.call(this):An(u)&&n==="alias"?r.push(u):An(u)&&n.indexOf("capture")!==-1&&Hi(this[n])?o.push(u):i.push(u))});var a=function(u,c){Ha(u,function(d){if(An(d[0])){var p=c;on(d,function(h){p=p[h[0]].apply(p,h.slice(1))})}else this[d[0]].apply(this,d.slice(1))},c)};a(r,this),a(i,this),a(o,this)}_hasBootstrappedFeatureFlags(){var t,n;return((t=this.config.bootstrap)===null||t===void 0?void 0:t.featureFlags)&&Object.keys((n=this.config.bootstrap)===null||n===void 0?void 0:n.featureFlags).length>0||!1}push(t){this._execute_array([t])}capture(t,n,r){var i;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue){if(!this.consent.isOptedOut())if(!Fe(t)&&Hn(t)){if(this.config.opt_out_useragent_filter||!this._is_bot()){var o=r!=null&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(o==null||!o.isRateLimited){n!=null&&n.$current_url&&!Hn(n==null?void 0:n.$current_url)&&(tt.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),n==null||delete n.$current_url),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 a=new Date,u=(r==null?void 0:r.timestamp)||a,c=Va(),d={uuid:c,event:t,properties:this._calculate_event_properties(t,n||{},u,c)};o&&(d.properties.$lib_rate_limit_remaining_tokens=o.remainingTokens),r!=null&&r.$set&&(d.$set=r==null?void 0:r.$set);var p=this._calculate_set_once_properties(r==null?void 0:r.$set_once);p&&(d.$set_once=p),(d=NZ(d,r!=null&&r._noTruncate?null:this.config.properties_string_max_length)).timestamp=u,Fe(r==null?void 0:r.timestamp)||(d.properties.$event_time_override_provided=!0,d.properties.$event_time_override_system_time=a);var h=pe(pe({},d.properties.$set),d.$set);if(lu(h)||this.setPersonPropertiesForFlags(h),!Kt(this.config.before_send)){var m=this._runBeforeSend(d);if(!m)return;d=m}this._internalEventEmitter.emit("eventCaptured",d);var v={method:"POST",url:(i=r==null?void 0:r._url)!==null&&i!==void 0?i:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:d,compression:"best-available",batchKey:r==null?void 0:r._batchKey};return!this.config.request_batching||r&&(r==null||!r._batchKey)||r!=null&&r.send_instantly?this._send_retriable_request(v):this._requestQueue.enqueue(v),d}tt.critical("This capture call is ignored due to client rate limiting.")}}else tt.error("No event name provided to posthog.capture")}else tt.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",n=>t(n.event,n))}_calculate_event_properties(t,n,r,i){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return n;var o=this.persistence.remove_event_timer(t),a=pe({},n);if(a.token=this.config.token,this.config.__preview_experimental_cookieless_mode&&(a.$cookieless_mode=!0),t==="$snapshot"){var u=pe(pe({},this.persistence.properties()),this.sessionPersistence.properties());return a.distinct_id=u.distinct_id,(!Hn(a.distinct_id)&&!$r(a.distinct_id)||T1(a.distinct_id))&&tt.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var c,d=bn.properties({maskPersonalDataProperties:this.config.mask_personal_data_properties,customPersonalDataProperties:this.config.custom_personal_data_properties});if(this.sessionManager){var{sessionId:p,windowId:h}=this.sessionManager.checkAndGetSessionAndWindowId();a.$session_id=p,a.$window_id=h}this.sessionPropsManager&&Gn(a,this.sessionPropsManager.getSessionProps());try{var m,v;this.sessionRecording&&(a.$recording_status=this.sessionRecording.status,a.$sdk_debug_replay_internal_buffer_length=this.sessionRecording.buffer.data.length,a.$sdk_debug_replay_internal_buffer_size=this.sessionRecording.buffer.size),a.$sdk_debug_retry_queue_size=(m=this._retryQueue)===null||m===void 0||(v=m.queue)===null||v===void 0?void 0:v.length}catch(b){a.$sdk_debug_error_capturing_properties=String(b)}if(this.requestRouter.region===Ws.CUSTOM&&(a.$lib_custom_api_host=this.config.api_host),c=t==="$pageview"?this.pageViewManager.doPageView(r,i):t==="$pageleave"?this.pageViewManager.doPageLeave(r):this.pageViewManager.doEvent(),a=Gn(a,c),t==="$pageview"&&He&&(a.title=He.title),!Fe(o)){var _=r.getTime()-o;a.$duration=parseFloat((_/1e3).toFixed(3))}jn&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=Gn({},d,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),An(this.config.property_denylist)?on(this.config.property_denylist,function(b){delete a[b]}):tt.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var x=this.config.sanitize_properties;x&&(tt.error("sanitize_properties is deprecated. Use before_send instead"),a=x(a,t));var S=this._hasPersonProcessing();return a.$process_person_profile=S,S&&this._requirePersonProcessing("_calculate_event_properties"),a}_calculate_set_once_properties(t){var n;if(!this.persistence||!this._hasPersonProcessing()||this._personProcessingSetOncePropertiesSent)return t;var r=this.persistence.get_initial_props(),i=(n=this.sessionPropsManager)===null||n===void 0?void 0:n.getSetOnceProps(),o=Gn({},r,i||{},t||{}),a=this.config.sanitize_properties;return a&&(tt.error("sanitize_properties is deprecated. Use before_send instead"),o=a(o,"$set_once")),this._personProcessingSetOncePropertiesSent=!0,lu(o)?void 0:o}register(t,n){var r;(r=this.persistence)===null||r===void 0||r.register(t,n)}register_once(t,n,r){var i;(i=this.persistence)===null||i===void 0||i.register_once(t,n,r)}register_for_session(t){var n;(n=this.sessionPersistence)===null||n===void 0||n.register(t)}unregister(t){var n;(n=this.persistence)===null||n===void 0||n.unregister(t)}unregister_for_session(t){var n;(n=this.sessionPersistence)===null||n===void 0||n.unregister(t)}_register_single(t,n){this.register({[t]:n})}getFeatureFlag(t,n){return this.featureFlags.getFeatureFlag(t,n)}getFeatureFlagPayload(t){var n=this.featureFlags.getFeatureFlagPayload(t);try{return JSON.parse(n)}catch{return n}}isFeatureEnabled(t,n){return this.featureFlags.isFeatureEnabled(t,n)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateEarlyAccessFeatureEnrollment(t,n){this.featureFlags.updateEarlyAccessFeatureEnrollment(t,n)}getEarlyAccessFeatures(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1],r=arguments.length>2?arguments[2]:void 0;return this.featureFlags.getEarlyAccessFeatures(t,n,r)}on(t,n){return this._internalEventEmitter.on(t,n)}onFeatureFlags(t){return this.featureFlags.onFeatureFlags(t)}onSurveysLoaded(t){return this.surveys.onSurveysLoaded(t)}onSessionId(t){var n,r;return(n=(r=this.sessionManager)===null||r===void 0?void 0:r.onSessionId(t))!==null&&n!==void 0?n:()=>{}}getSurveys(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.surveys.getSurveys(t,n)}getActiveMatchingSurveys(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.surveys.getActiveMatchingSurveys(t,n)}renderSurvey(t,n){this.surveys.renderSurvey(t,n)}canRenderSurvey(t){return this.surveys.canRenderSurvey(t)}identify(t,n,r){if(!this.__loaded||!this.persistence)return tt.uninitializedWarning("posthog.identify");if($r(t)&&(t=t.toString(),tt.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),t){if(["distinct_id","distinctid"].includes(t.toLowerCase()))tt.critical('The string "'.concat(t,'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'));else if(this._requirePersonProcessing("posthog.identify")){var i=this.get_distinct_id();if(this.register({$user_id:t}),!this.get_property("$device_id")){var o=i;this.register_once({$had_persisted_distinct_id:!0,$device_id:o},"")}t!==i&&t!==this.get_property(Of)&&(this.unregister(Of),this.register({distinct_id:t}));var a=(this.persistence.get_property(Go)||"anonymous")==="anonymous";t!==i&&a?(this.persistence.set_property(Go,"identified"),this.setPersonPropertiesForFlags(pe(pe({},r||{}),n||{}),!1),this.capture("$identify",{distinct_id:t,$anon_distinct_id:i},{$set:n||{},$set_once:r||{}}),this._cachedPersonProperties=V3(t,n,r),this.featureFlags.setAnonymousDistinctId(i)):(n||r)&&this.setPersonProperties(n,r),t!==i&&(this.reloadFeatureFlags(),this.unregister(sg))}}else tt.error("Unique user id has not been set in posthog.identify")}setPersonProperties(t,n){if((t||n)&&this._requirePersonProcessing("posthog.setPersonProperties")){var r=V3(this.get_distinct_id(),t,n);this._cachedPersonProperties!==r?(this.setPersonPropertiesForFlags(pe(pe({},n||{}),t||{})),this.capture("$set",{$set:t||{},$set_once:n||{}}),this._cachedPersonProperties=r):tt.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(t,n,r){if(t&&n){if(this._requirePersonProcessing("posthog.group")){var i=this.getGroups();i[t]!==n&&this.resetGroupPropertiesForFlags(t),this.register({$groups:pe(pe({},i),{},{[t]:n})}),r&&(this.capture("$groupidentify",{$group_type:t,$group_key:n,$group_set:r}),this.setGroupPropertiesForFlags({[t]:r})),i[t]===n||r||this.reloadFeatureFlags()}}else tt.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t){var n=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];this.featureFlags.setPersonPropertiesForFlags(t,n)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(t){var n=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(t,n)}resetGroupPropertiesForFlags(t){this.featureFlags.resetGroupPropertiesForFlags(t)}reset(t){var n,r,i,o;if(tt.info("reset"),!this.__loaded)return tt.uninitializedWarning("posthog.reset");var a=this.get_property("$device_id");if(this.consent.reset(),(n=this.persistence)===null||n===void 0||n.clear(),(r=this.sessionPersistence)===null||r===void 0||r.clear(),this.surveys.reset(),(i=this.persistence)===null||i===void 0||i.set_property(Go,"anonymous"),(o=this.sessionManager)===null||o===void 0||o.resetSessionId(),this._cachedPersonProperties=null,this.config.__preview_experimental_cookieless_mode)this.register_once({distinct_id:rM,$device_id:null},"");else{var u=this.config.get_device_id(Va());this.register_once({distinct_id:u,$device_id:t?u:a},"")}this.register({$last_posthog_reset:new Date().toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,n;return(t=(n=this.sessionManager)===null||n===void 0?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&t!==void 0?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var{sessionId:n,sessionStartTimestamp:r}=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=this.requestRouter.endpointFor("ui","/project/".concat(this.config.token,"/replay/").concat(n));if(t!=null&&t.withTimestamp&&r){var o,a=(o=t.timestampLookBack)!==null&&o!==void 0?o:10;if(!r)return i;var u=Math.max(Math.floor((new Date().getTime()-r)/1e3)-a,0);i+="?t=".concat(u)}return i}alias(t,n){return t===this.get_property(jT)?(tt.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(Fe(n)&&(n=this.get_distinct_id()),t!==n?(this._register_single(Of,t),this.capture("$create_alias",{alias:t,distinct_id:n})):(tt.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var n,r,i,o,a=pe({},this.config);In(t)&&(Gn(this.config,K3(t)),(n=this.persistence)===null||n===void 0||n.update_config(this.config,a),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new CS(pe(pe({},this.config),{},{persistence:"sessionStorage"})),Qn.is_supported()&&Qn.get("ph_debug")==="true"&&(this.config.debug=!0),this.config.debug&&(Ho.DEBUG=!0,tt.info("set_config",JSON.stringify({config:t,oldConfig:a,newConfig:pe({},this.config)},null,2))),(r=this.sessionRecording)===null||r===void 0||r.startIfEnabledOrStop(),(i=this.autocapture)===null||i===void 0||i.startIfEnabled(),(o=this.heatmaps)===null||o===void 0||o.startIfEnabled(),this.surveys.loadIfEnabled(),this._sync_opt_out_with_persistence())}startSessionRecording(t){var n=t===!0,r={sampling:n||!(t==null||!t.sampling),linked_flag:n||!(t==null||!t.linked_flag),url_trigger:n||!(t==null||!t.url_trigger),event_trigger:n||!(t==null||!t.event_trigger)};if(Object.values(r).some(Boolean)){var i,o,a,u,c;(i=this.sessionManager)===null||i===void 0||i.checkAndGetSessionAndWindowId(),r.sampling&&((o=this.sessionRecording)===null||o===void 0||o.overrideSampling()),r.linked_flag&&((a=this.sessionRecording)===null||a===void 0||a.overrideLinkedFlag()),r.url_trigger&&((u=this.sessionRecording)===null||u===void 0||u.overrideTrigger("url")),r.event_trigger&&((c=this.sessionRecording)===null||c===void 0||c.overrideTrigger("event"))}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!((t=this.sessionRecording)===null||t===void 0||!t.started)}captureException(t,n){var r=new Error("PostHog syntheticException");this.exceptions.sendExceptionEvent(pe(pe({},wY((i=>i instanceof Error)(t)?{error:t,event:t.message}:{event:t},{syntheticException:r})),n))}loadToolbar(t){return this.toolbar.loadToolbar(t)}get_property(t){var n;return(n=this.persistence)===null||n===void 0?void 0:n.props[t]}getSessionProperty(t){var n;return(n=this.sessionPersistence)===null||n===void 0?void 0:n.props[t]}toString(){var t,n=(t=this.config.name)!==null&&t!==void 0?t:bu;return n!==bu&&(n=bu+"."+n),n}_isIdentified(){var t,n;return((t=this.persistence)===null||t===void 0?void 0:t.get_property(Go))==="identified"||((n=this.sessionPersistence)===null||n===void 0?void 0:n.get_property(Go))==="identified"}_hasPersonProcessing(){var t,n,r,i;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&lu(this.getGroups())&&((t=this.persistence)===null||t===void 0||(n=t.props)===null||n===void 0||!n[Of])&&((r=this.persistence)===null||r===void 0||(i=r.props)===null||i===void 0||!i[lg]))}_shouldCapturePageleave(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&this.config.capture_pageview}createPersonProfile(){this._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}_requirePersonProcessing(t){return this.config.person_profiles==="never"?(tt.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(lg,!0),!0)}_sync_opt_out_with_persistence(){var t,n,r,i,o=this.consent.isOptedOut(),a=this.config.opt_out_persistence_by_default,u=this.config.disable_persistence||o&&!!a;((t=this.persistence)===null||t===void 0?void 0:t.disabled)!==u&&((r=this.persistence)===null||r===void 0||r.set_disabled(u)),((n=this.sessionPersistence)===null||n===void 0?void 0:n.disabled)!==u&&((i=this.sessionPersistence)===null||i===void 0||i.set_disabled(u))}opt_in_capturing(t){var n;this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),(Fe(t==null?void 0:t.captureEventName)||t!=null&&t.captureEventName)&&this.capture((n=t==null?void 0:t.captureEventName)!==null&&n!==void 0?n:"$opt_in",t==null?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._captureInitialPageview()}opt_out_capturing(){this.consent.optInOut(!1),this._sync_opt_out_with_persistence()}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}clear_opt_in_out_capturing(){this.consent.reset(),this._sync_opt_out_with_persistence()}_is_bot(){return ii?G3(ii,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){He&&!this._initialPageviewCaptured&&(this._initialPageviewCaptured=!0,this.capture("$pageview",{title:He.title},{send_instantly:!0}))}debug(t){t===!1?(le==null||le.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(le==null||le.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)`."),localStorage&&localStorage.setItem("ph_debug","true"),this.set_config({debug:!0}))}_runBeforeSend(t){if(Kt(this.config.before_send))return t;var n=An(this.config.before_send)?this.config.before_send:[this.config.before_send],r=t;for(var i of n){if(r=i(r),Kt(r)){var o="Event '".concat(t.event,"' was rejected in beforeSend function");return DZ(t.event)?tt.warn("".concat(o,". This can cause unexpected behavior.")):tt.info(o),null}r.properties&&!lu(r.properties)||tt.warn("Event '".concat(t.event,"' has no properties after beforeSend function, this is likely an error."))}return r}getPageViewId(){var t;return(t=this.pageViewManager._currentPageview)===null||t===void 0?void 0:t.pageViewId}captureTraceFeedback(t,n){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:n})}captureTraceMetric(t,n,r){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:n,$ai_metric_value:String(r)})}}(function(e,t){for(var n=0;n<t.length;n++)e.prototype[t[n]]=$Z(e.prototype[t[n]])})(Tg,["identify"]);var Q3,xi=(Q3=Yf[bu]=new Tg,function(){function e(){e.done||(e.done=!0,Y3=!1,on(Yf,function(t){t._dom_loaded()}))}He!=null&&He.addEventListener?He.readyState==="complete"?e():Nn(He,"DOMContentLoaded",e,{capture:!1}):le&&tt.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),Q3),X3=Y.createContext({client:xi});function J3(e,t,n){if(n===void 0&&(n=new WeakMap),e===t)return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(n.has(e)&&n.get(e)===t)return!0;n.set(e,t);var r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;for(var o=0,a=r;o<a.length;o++){var u=a[o];if(!i.includes(u)||!J3(e[u],t[u],n))return!1}return!0}function $W(e){var t=e.children,n=e.client,r=e.apiKey,i=e.options,o=Y.useState(!1),a=o[0],u=o[1],c=Y.useMemo(function(){return n?(r&&console.warn("[PostHog.js] You have provided both `client` and `apiKey` to `PostHogProvider`. `apiKey` will be ignored in favour of `client`."),i&&console.warn("[PostHog.js] You have provided both `client` and `options` to `PostHogProvider`. `options` will be ignored in favour of `client`."),n):r?a!==!1?(r!==a.previousAPIKey&&console.warn("[PostHog.js] You have provided a different `apiKey` to `PostHogProvider` than the one that was already initialized. This is not supported by our provider and we'll keep using the previous key. If you need to toggle between API Keys you need to control the `client` yourself and pass it in as a prop rather than an `apiKey` prop."),i&&!J3(i,a.previousOptions)&&xi.set_config(i),u({previousAPIKey:r,previousOptions:i??{}}),xi):(xi.__loaded&&console.warn("[PostHog.js] `posthog` was already loaded elsewhere. This may cause issues."),xi.init(r,i),u({previousAPIKey:r,previousOptions:i??{}}),xi):(console.warn("[PostHog.js] No `apiKey` or `client` were provided to `PostHogProvider`. Using default global `window.posthog` instance. You must initialize it manually. This is not recommended behavior."),xi)},[n,r,JSON.stringify(i)]);return Dn.createElement(X3.Provider,{value:{client:c}},t)}var eD=function(){var e=Y.useContext(X3).client;return e};function NS(e){var t=eD(),n=Y.useState(function(){return t.isFeatureEnabled(e)}),r=n[0],i=n[1];return Y.useEffect(function(){return t.onFeatureFlags(function(){i(t.isFeatureEnabled(e))})},[t,e]),r}function NW(e){var t=eD(),n=Y.useState(function(){return t.getFeatureFlagPayload(e)}),r=n[0],i=n[1];return Y.useEffect(function(){return t.onFeatureFlags(function(){i(t.getFeatureFlagPayload(e))})},[t,e]),r}function PW(e){XE(e,[/\r?\n|\r/g,BW])}function BW(){return{type:"break"}}function FW(){return function(e){PW(e)}}const an={OPEN_STATE_CHANGE:"open_state_change",CHAT_BUTTON_CLICKED:"Chat button clicked",USER_FORM_FILLED:"User form filled",ADD_BULK_ITEM:"Add bulk item",USER_FORM_CLOSE:"user_form_close",CHECKOUT_CLICKED:"Checkout Clicked",ADD_TO_CART_CLICKED:"add to cart clicked",SUGGESTED_QUESTION_CLICKED:"Suggested Question Clicked",INITIAL_LEADING_QUERY_SUGGESTED_QUESTION_CLICKED:"Initial Leading Query Suggested Question Clicked",LEADING_QUERY_CLICKED:"Leading Query Clicked",COLLECTION_VIDEO_CLICKED:"Collection Video Clicked",COLLECTION_IMAGE_CLICKED:"Collection Image Clicked",VIEW_PRODUCT_CLICKED:"view product clicked",PRODUCT_VIDEO_CLICKED:"Product Video Clicked",PRODUCT_IMAGE_CLICKED:"Product Image Clicked",SHOW_SIMILAR_CLICKED:"show similar clicked",CHAT_MESSAGE_SENT:"chat_message_sent",CHAT_MESSAGE_TYPING_STARTED:"chat_message_typing_started",CHAT_MESSAGE_TYPING_ENDED:"chat_message_typing_ended",DISCOUNT_VIEWED:"discount_viewed",SHOPIFY_LINK_CLICKED:"shopify_link_clicked"},Ci={OPEN_STATE_CHANGE:"open_state_change"},UW=e=>{window.DebalesChat||(window.DebalesChat={isOpen:!1,projectId:e,getSessionId:()=>cr(),getChatId:()=>cr()+"_"+e,getAnonId:()=>Fs.getAnonId(),isIdentified:()=>{if(xi._isIdentified())return!0;const t=Pa();return!!(t&&t.email)},getIdentifiedUser:()=>Pa(),getDistinctId:()=>xi.get_distinct_id(),getOldDistinctId:()=>Fs.getDistinctId(),debug:!1,identify:(t,n)=>{xi._isIdentified()||xi.identify(t,{...n,project:e}),Fs.identify(t,n),f1({email:t,name:n==null?void 0:n.name,phone:n==null?void 0:n.phone})},track:(t,n)=>{Fs.track(t,{...n,sessionId:window.DebalesChat.getSessionId()}),xi.capture(t,{...n}),dZ(t,{...n,sessionId:cr(),projectId:e})},onOpenChange:t=>{const n=r=>{t(r.detail.isOpen)};return window.addEventListener(Ci.OPEN_STATE_CHANGE,n),()=>window.removeEventListener(Ci.OPEN_STATE_CHANGE,n)},removeOpenChangeListener:t=>{const n=r=>{t(r.detail.isOpen)};window.removeEventListener(Ci.OPEN_STATE_CHANGE,n)},open:()=>{window.DebalesChat.isOpen||window.dispatchEvent(new CustomEvent(Ci.OPEN_STATE_CHANGE,{detail:{isOpen:!0,projectId:e}}))},close:()=>{window.DebalesChat.isOpen&&window.dispatchEvent(new CustomEvent(Ci.OPEN_STATE_CHANGE,{detail:{isOpen:!1,projectId:e}}))},toggle:()=>{window.dispatchEvent(new CustomEvent(Ci.OPEN_STATE_CHANGE,{detail:{isOpen:!window.DebalesChat.isOpen,projectId:e}}))}})};var gr=(e=>(e.DEFAULT="DEFAULT",e.SHOPIFY="SHOPIFY",e.WOOCOMMERCE="WOOCOMMERCE",e.MAGENTO="MAGENTO",e.UNKNOWN="UNKNOWN",e))(gr||{});class Wf{static detect(){var t,n,r,i,o,a;if(typeof window<"u"&&window.Shopify!==void 0&&window.Shopify.routes!==void 0)return gr.SHOPIFY;if(typeof window<"u"&&document.body.classList.contains("woocommerce"))return gr.WOOCOMMERCE;if(typeof window<"u"){if(window.MAGENTO_VERSION!==void 0||window.MAGE!==void 0||window.Mage!==void 0||["page-wrapper","magento-theme","catalog-product-view","catalog-category-view"].some(h=>document.body.classList.contains(h)))return gr.MAGENTO;const c=document.getElementsByTagName("script");for(const h of Array.from(c))if(h.src.includes("mage/")||h.src.includes("magento")||(t=h.textContent)!=null&&t.includes("Mage.")||(n=h.textContent)!=null&&n.includes("require(")||(r=h.getAttribute("data-requiremodule"))!=null&&r.startsWith("mage")||(i=h.getAttribute("data-requiremodule"))!=null&&i.startsWith("Magento"))return gr.MAGENTO;if(document.cookie.split(";").some(h=>h.trim().startsWith("mage-")||h.trim().startsWith("form_key")))return gr.MAGENTO;const p=document.getElementsByTagName("meta");for(const h of Array.from(p))if((o=h.getAttribute("content"))!=null&&o.includes("Magento")||(a=h.getAttribute("name"))!=null&&a.includes("magento"))return gr.MAGENTO}return gr.UNKNOWN}}const zW=ae.button`
@@ -2328,8 +2328,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
2328
2328
  margin-top: 16px;
2329
2329
  display: flex;
2330
2330
  justify-content: flex-end;
2331
- `,Nee=({botId:e})=>{var Ja,Yi;const{uiData:t,storeMetaData:n,onSendMessage:r,isKlaviyoMessage:i,isLoading:o,lastedBotmessageId:a,setLastedBotmessageId:u,messages:c,isMessageLoading:d,setIsMessageLoading:p,setMessages:h,saveConversation:m,changeDisplayModel:v,loadConversation:_,suggestedQuestions:x,setSuggestedQuestions:S,showUserInfoModel:b,setShowUserInfoModel:C,isUserInfoNeeded:E,setPendingQuestion:I}=BS(),{cart:O,addToCart:T,generateCartUrl:$,addCartAttributes:F}=fT(),q=NW("use-chatbot-icon-size"),P=Wf.detect(),G=t==null?void 0:t.isLeft,X=VW(),se=t==null?void 0:t.heightOption,[V,ne]=Y.useState(!1);Y.useEffect(()=>{const K=()=>{ne(window.matchMedia("(max-width: 768px)").matches)};return K(),window.addEventListener("resize",K),()=>window.removeEventListener("resize",K)},[]);const[z,Z]=Y.useState(!1),[ce,we]=Y.useState(!1),[k,J]=Y.useState(""),[ue,L]=Y.useState(""),[,_e]=Y.useState(0);Y.useEffect(()=>{e&&UW(e)},[e]),Y.useEffect(()=>{fZ(e)},[e]),Y.useEffect(()=>{let K=Pa();if(!K&&window.Thinkific){const Le=window.Thinkific.current_user;Le&&(K={name:Le.full_name,email:Le.email},f1(K))}Fs.init({projectName:e,debug:!0,testing:lT}),K&&K.email&&(window.DebalesChat.identify(K.email,{name:K.name,phone:K.phone,email:K.email}),t!=null&&t.KlaviyoIntegration&&window.klaviyo&&window.klaviyo.identify({email:K.email,first_name:K.name,phone:K.phone,from:"Debales-Chatbot"}))},[e,t==null?void 0:t.KlaviyoIntegration]);const Te=Y.useRef(null),de=dr(sr.CLICKED_QUESTIONS,{botId:e}),[Ke,Pe]=Y.useState(()=>{try{const K=sessionStorage.getItem(de);return K?new Set(JSON.parse(K)):new Set}catch{return new Set}});Y.useEffect(()=>{try{sessionStorage.setItem(de,JSON.stringify(Array.from(Ke)))}catch(K){console.error("Failed to save to sessionStorage:",K)}},[Ke]);const rt=Y.useCallback((K,Le)=>{K?(window.dispatchEvent(new CustomEvent(Ci.OPEN_STATE_CHANGE,{detail:{isOpen:K,source:Le,projectId:e}})),setTimeout(()=>{we(!0)},50)):(we(!1),window.dispatchEvent(new CustomEvent(Ci.OPEN_STATE_CHANGE,{detail:{isOpen:K,source:Le,projectId:e}})))},[]);Y.useEffect(()=>{const K=Le=>{Z(Le.detail.isOpen),Le.detail.isOpen&&setTimeout(()=>we(!0),50),window.DebalesChat.isOpen=Le.detail.isOpen,window.DebalesChat.track(an.OPEN_STATE_CHANGE,{isOpen:Le.detail.isOpen,source:Le.detail.source})};return window.addEventListener(Ci.OPEN_STATE_CHANGE,K),()=>{window.removeEventListener(Ci.OPEN_STATE_CHANGE,K)}},[]),Y.useEffect(()=>{const K=Le=>{Z(Le.detail.isOpen),window.DebalesChat.isOpen=Le.detail.isOpen,window.DebalesChat.track(an.OPEN_STATE_CHANGE,{isOpen:Le.detail.isOpen})};return window.addEventListener(Ci.OPEN_STATE_CHANGE,K),()=>{window.removeEventListener(Ci.OPEN_STATE_CHANGE,K)}},[]);const[st,$e]=Y.useState(!1),[ye,ze]=Y.useState(()=>{const K=dr(sr.PENDING_BULK_ITEMS,{botId:e}),Le=sessionStorage.getItem(K);return Le?JSON.parse(Le):[]});Y.useEffect(()=>{const K=dr(sr.PENDING_BULK_ITEMS,{botId:e});sessionStorage.setItem(K,JSON.stringify(ye))},[ye,e]);const[Ge,lt]=Y.useState(!1),[Xe,nt]=Y.useState({name:"",email:"",message:""}),N=NS("exit_model"),[B,H]=Y.useState({text:!0,leadingQueries:!0,collections:!0,products:!0,variants:!0,cartSummary:!0,bulkItems:!0}),[he,me]=Y.useState({suggestions:!1,products:!1,collections:!1,leadingQueries:!1,initialMessage:!1,cartSummary:!1,bulkItems:!1}),[Se,Ve]=Y.useState(!1),[Je,Q]=Y.useState(!0),[fe,Be]=Y.useState(!1),[je,et]=Y.useState(!1),Ht=2e3,Jt=Y.useCallback(K=>{const Le=K.target,Qe=Le.scrollHeight-Le.scrollTop<=Le.clientHeight+0;Q(Qe)},[]);Y.useEffect(()=>{var K,Le,Qe,Ye,Oe,St;if(c.length>0&&!d){const wt=c[c.length-1],Cn=sessionStorage.getItem(dr(sr.LAST_SHOWN_MESSAGE_ID,{botId:e})),na=wt.isBot&&wt.conversationId===a&&wt.conversationId!==Cn,Ii=(O==null?void 0:O.itemCount)&&(O==null?void 0:O.itemCount)>0&&wt.conversationId===a;if(na){Ve(!0),me(kt=>({...kt,initialMessage:!0,leadingQueries:!0})),sessionStorage.setItem(dr(sr.LAST_SHOWN_MESSAGE_ID,{botId:e}),wt.conversationId||""),H({text:!0,leadingQueries:!1,collections:!1,products:!1,variants:!1,cartSummary:!1,bulkItems:!1});const xe=1600;let Uu=xe;const _o=[{type:"leadingQueries",condition:c.length===1&&((K=wt.leading_queries)==null?void 0:K.length)&&((Le=wt.leading_queries)==null?void 0:Le.length)>0},{type:"collections",condition:((Qe=wt.collections)==null?void 0:Qe.length)&&((Ye=wt.collections)==null?void 0:Ye.length)>0},{type:"products",condition:((Oe=wt.products)==null?void 0:Oe.length)&&((St=wt.products)==null?void 0:St.length)>0},{type:"cartSummary",condition:(O==null?void 0:O.itemCount)&&(O==null?void 0:O.itemCount)>0},{type:"bulkItems",condition:(ye==null?void 0:ye.length)>0}].filter(kt=>kt.condition);if(_o.length===0){Ve(!1),me(kt=>({...kt,initialMessage:!1,leadingQueries:!1}));return}_o.forEach(({type:kt},On)=>{setTimeout(()=>{if(me(Xn=>({...Xn,[kt]:!0})),H(Xn=>({...Xn,[kt]:!0})),Je&&Te.current){const Xn=Te.current;Xn.scrollHeight-Xn.scrollTop<=Xn.clientHeight&&Hp(Te)}On===_o.length-1&&Ve(!1)},Uu),Uu+=xe})}else Ii&&H(xe=>({...xe,cartSummary:!0}))}},[c,d,a,O==null?void 0:O.itemCount,ye==null?void 0:ye.length,Je,e]),Y.useEffect(()=>{if(!i&&c.length>0){const K=Te.current;K&&Je&&K.scrollHeight-K.scrollTop<=K.clientHeight+100&&setTimeout(()=>Hp(Te),100)}},[c.length,i,Je]),Y.useEffect(()=>{const K=document.querySelector('meta[name="viewport"]'),Le=K==null?void 0:K.content;if(z){let Qe=K;const Ye=window.matchMedia("(max-width: 768px)").matches;Qe?Qe.content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no":(Qe=document.createElement("meta"),Qe.name="viewport",Qe.content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no",document.head.appendChild(Qe)),Ye&&(t==null?void 0:t.mobileDisplayMode)==="full-screen"&&(document.body.style.overflow="hidden");const Oe=Qe;return()=>{Le&&Oe&&(Oe.content=Le),Ye&&(t==null?void 0:t.mobileDisplayMode)==="full-screen"&&(document.body.style.overflow="")}}return()=>{window.matchMedia("(max-width: 768px)").matches&&(t==null?void 0:t.mobileDisplayMode)==="full-screen"&&(document.body.style.overflow="")}},[z,t==null?void 0:t.mobileDisplayMode]),Y.useEffect(()=>{if(z&&window.matchMedia("(max-width: 768px)").matches&&(t==null?void 0:t.mobileDisplayMode)==="full-screen"){const K=Le=>{let Qe=Le.target,Ye=!1;const Oe=Te.current;if(Oe){for(;Qe&&Qe!==document.body;){if(Qe===Oe){Ye=!0;break}if(Qe.parentNode)Qe=Qe.parentNode;else break}if(!Ye)Le.preventDefault();else{const St=Oe.scrollTop<=0,wt=Oe.scrollTop+Oe.clientHeight>=Oe.scrollHeight-5;if(St&&Le.touches[0].clientY>0||wt&&Le.touches[0].clientY<0)return}}};return document.addEventListener("touchmove",K,{passive:!1}),()=>{document.removeEventListener("touchmove",K)}}return()=>{}},[z,t==null?void 0:t.mobileDisplayMode,Te]),Y.useEffect(()=>{const K=setTimeout(()=>{$e(!0)},1e3);return()=>clearTimeout(K)},[]),Y.useEffect(()=>{i||setTimeout(()=>Hp(Te),100)},[c.length,i]),Y.useEffect(()=>{O!=null&&O.itemCount&&O.itemCount===0&&!i&&setTimeout(()=>Hp(Te),100)},[O==null?void 0:O.itemCount,i]),Y.useEffect(()=>{a&&sessionStorage.setItem(dr(sr.LAST_SHOWN_MESSAGE_ID,{botId:e}),a)},[a,e]);const Nt=Y.useRef(Date.now()),cn=Y.useRef(0),ot=Y.useRef(window.location.pathname),Et=Y.useRef(x),qe=Y.useRef(!1),mt=NS("acquisition_agent");Y.useEffect(()=>{Et.current=x},[x]);const Ai=Y.useCallback(async()=>{const K=Date.now();if(K-Nt.current>=6e3&&K-cn.current>=6e4&&!qe.current)try{qe.current=!0,console.log("fetching acquisition data");const Ye=await fetch(`${so}/api/wordpress/acquisition`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,timestamp:new Date().toISOString(),page_information:window.location.href.split("?")[0],botid:e})});if(Ye.ok){const Oe=await Ye.json(),wt=[...Et.current.filter(Cn=>Cn.path!==ot.current),{question:Oe.Popup_Message,answer:"",path:ot.current,nameSpace:e,type:"dynamic",Follow_up_Question:Oe.Follow_up_Question}];S(wt)}cn.current=K}catch(Ye){console.error("Error fetching acquisition data:",Ye)}finally{qe.current=!1}},[e]);Y.useEffect(()=>{if(!mt||(t==null?void 0:t.show_bot)===!1)return;const K=()=>{Nt.current=Date.now()};document.addEventListener("mousemove",K),document.addEventListener("mousedown",K),document.addEventListener("keypress",K),document.addEventListener("scroll",K),document.addEventListener("touchstart",K),document.addEventListener("touchmove",K);const Le=setInterval(Ai,1e3),Qe=()=>{const Oe=window.location.pathname.split("?")[0],St=ot.current.split("?")[0];(()=>{const Cn=St.split("/").filter(Boolean),na=Oe.split("/").filter(Boolean);return Cn.length!==na.length?!0:Cn.length===0&&na.length===0?!1:Oe!==St})()&&(ot.current=Oe,Nt.current=Date.now())};return window.addEventListener("popstate",Qe),()=>{document.removeEventListener("mousemove",K),document.removeEventListener("mousedown",K),document.removeEventListener("keypress",K),document.removeEventListener("scroll",K),document.removeEventListener("touchstart",K),document.removeEventListener("touchmove",K),window.removeEventListener("popstate",Qe),clearInterval(Le)}},[mt,Ai,t==null?void 0:t.show_bot]);const[go,oi]=Y.useState(!1),[Yr,mo]=Y.useState(!1),[Xa,Qo]=Y.useState(null),vo=async K=>{const Le=cr();if(we(!1),K&&c.length>1)try{(await fetch(`${so}/api/wordpress/userRating`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:Le,userRating:K,nameSpace:e})})).ok||console.error("Error submitting rating")}catch(Qe){console.error("Error submitting rating:",Qe)}setTimeout(()=>{mo(!1),rt(!1,"close_button_clicked")},1e3)},Xo=K=>{p(!0),ye.forEach(Qe=>{T(Qe.id,Qe.quantity)}),window.DebalesChat.track(an.ADD_BULK_ITEM,{products:ye,message:K});const Le=[...c,{text:"🎉 Bulk items added to cart successfully.",leading_queries:["Get GST Invoice for the order","Explore more products"],conversationId:K,isBot:!0}];h(Le),m(Le),u(K),ze([]),p(!1)},Bu=()=>{var K;switch(e){case"minature":case"bodytales":case"imemyselfcare-com":if(window.triggerGokwikCustomCheckout)return window.triggerGokwikCustomCheckout(),!0;break;case"athflex":if((K=window.shiprocketCheckoutEvents)!=null&&K.buyCart)return window.shiprocketCheckoutEvents.buyCart(),!0;break;case"www":if(window.openRzpCheckout)return window.openRzpCheckout(),!0;break;default:return window.location.href=$((t==null?void 0:t.shopifyShopDomain)??""),!1}return window.location.href=$((t==null?void 0:t.shopifyShopDomain)??""),!1},od=async K=>{K.preventDefault(),window.DebalesChat.track(an.CHECKOUT_CLICKED,{chatId:cr()+e,cartValue:Number(O==null?void 0:O.total),cart:O}),F({dbls_method:"checkout_clicked"}),Bu()&&rt(!1,"checkout_clicked")},[Wr,Zn]=Y.useState([]);Y.useEffect(()=>{const K=gZ(cZ(x));Zn(K)},[x]);const xn=Y.useMemo(()=>Wr.map(K=>{if(Array.isArray(K)){const Le=K.filter(Ye=>!Ke.has(Ye.question));if(Le.length===0)return null;const Qe={isHighlighted:K[0].isHighlighted,enable:K[0].enable,type:K[0].type};return Le.map(Ye=>({...Ye,...Qe}))}else return Ke.has(K.question)?null:K}).filter(Boolean),[Wr,Ke]);Y.useEffect(()=>{const K=Ye=>{const Oe=Ye.detail.formId;switch(Ye.detail.type){case"open":case"embedOpen":setTimeout(()=>{const wt=Le(Oe);wt&&J(wt)},800);break;case"close":k&&(t==null?void 0:t.KlaviyoFormIntegration)===!0&&setTimeout(()=>{rt(!0,"klaviyo_form_closed"),L(Oe),r(k,void 0,void 0,!0,void 0,void 0)},1e4);break}},Le=Ye=>{const Oe=document.querySelector(`[data-testid="klaviyo-form-${Ye}"]`);if(console.log(`formElement text ${Ye} =>`,Oe==null?void 0:Oe.innerText,Oe==null?void 0:Oe.textContent),Oe instanceof HTMLElement){const St=Oe.innerText||Oe.textContent;if(St)return console.log("Found form text:",St),`=> Klaviyo form content:
2331
+ `,Nee=({botId:e})=>{var Ja,Yi;const{uiData:t,storeMetaData:n,onSendMessage:r,isKlaviyoMessage:i,isLoading:o,lastedBotmessageId:a,setLastedBotmessageId:u,messages:c,isMessageLoading:d,setIsMessageLoading:p,setMessages:h,saveConversation:m,changeDisplayModel:v,loadConversation:_,suggestedQuestions:x,setSuggestedQuestions:S,showUserInfoModel:b,setShowUserInfoModel:C,isUserInfoNeeded:E,setPendingQuestion:I}=BS(),{cart:O,addToCart:T,generateCartUrl:$,addCartAttributes:F}=fT(),q=NW("use-chatbot-icon-size"),P=Wf.detect(),G=t==null?void 0:t.isLeft,X=VW(),se=t==null?void 0:t.heightOption,[V,ne]=Y.useState(!1);Y.useEffect(()=>{const K=()=>{ne(window.matchMedia("(max-width: 768px)").matches)};return K(),window.addEventListener("resize",K),()=>window.removeEventListener("resize",K)},[]);const[z,Z]=Y.useState(!1),[ce,we]=Y.useState(!1),[k,J]=Y.useState(""),[ue,L]=Y.useState(""),[,_e]=Y.useState(0);Y.useEffect(()=>{e&&UW(e)},[e]),Y.useEffect(()=>{fZ(e)},[e]),Y.useEffect(()=>{let K=Pa();if(!K&&window.Thinkific){const Le=window.Thinkific.current_user;Le&&(K={name:Le.full_name,email:Le.email},f1(K))}Fs.init({projectName:e,debug:!1,testing:lT}),K&&K.email&&(window.DebalesChat.identify(K.email,{name:K.name,phone:K.phone,email:K.email}),t!=null&&t.KlaviyoIntegration&&window.klaviyo&&window.klaviyo.identify({email:K.email,first_name:K.name,phone:K.phone,from:"Debales-Chatbot"}))},[e,t==null?void 0:t.KlaviyoIntegration]);const Te=Y.useRef(null),de=dr(sr.CLICKED_QUESTIONS,{botId:e}),[Ke,Pe]=Y.useState(()=>{try{const K=sessionStorage.getItem(de);return K?new Set(JSON.parse(K)):new Set}catch{return new Set}});Y.useEffect(()=>{try{sessionStorage.setItem(de,JSON.stringify(Array.from(Ke)))}catch(K){console.error("Failed to save to sessionStorage:",K)}},[Ke]);const rt=Y.useCallback((K,Le)=>{K?(window.dispatchEvent(new CustomEvent(Ci.OPEN_STATE_CHANGE,{detail:{isOpen:K,source:Le,projectId:e}})),setTimeout(()=>{we(!0)},50)):(we(!1),window.dispatchEvent(new CustomEvent(Ci.OPEN_STATE_CHANGE,{detail:{isOpen:K,source:Le,projectId:e}})))},[]);Y.useEffect(()=>{const K=Le=>{Z(Le.detail.isOpen),Le.detail.isOpen&&setTimeout(()=>we(!0),50),window.DebalesChat.isOpen=Le.detail.isOpen,window.DebalesChat.track(an.OPEN_STATE_CHANGE,{isOpen:Le.detail.isOpen,source:Le.detail.source})};return window.addEventListener(Ci.OPEN_STATE_CHANGE,K),()=>{window.removeEventListener(Ci.OPEN_STATE_CHANGE,K)}},[]),Y.useEffect(()=>{const K=Le=>{Z(Le.detail.isOpen),window.DebalesChat.isOpen=Le.detail.isOpen,window.DebalesChat.track(an.OPEN_STATE_CHANGE,{isOpen:Le.detail.isOpen})};return window.addEventListener(Ci.OPEN_STATE_CHANGE,K),()=>{window.removeEventListener(Ci.OPEN_STATE_CHANGE,K)}},[]);const[st,$e]=Y.useState(!1),[ye,ze]=Y.useState(()=>{const K=dr(sr.PENDING_BULK_ITEMS,{botId:e}),Le=sessionStorage.getItem(K);return Le?JSON.parse(Le):[]});Y.useEffect(()=>{const K=dr(sr.PENDING_BULK_ITEMS,{botId:e});sessionStorage.setItem(K,JSON.stringify(ye))},[ye,e]);const[Ge,lt]=Y.useState(!1),[Xe,nt]=Y.useState({name:"",email:"",message:""}),N=NS("exit_model"),[B,H]=Y.useState({text:!0,leadingQueries:!0,collections:!0,products:!0,variants:!0,cartSummary:!0,bulkItems:!0}),[he,me]=Y.useState({suggestions:!1,products:!1,collections:!1,leadingQueries:!1,initialMessage:!1,cartSummary:!1,bulkItems:!1}),[Se,Ve]=Y.useState(!1),[Je,Q]=Y.useState(!0),[fe,Be]=Y.useState(!1),[je,et]=Y.useState(!1),Ht=2e3,Jt=Y.useCallback(K=>{const Le=K.target,Qe=Le.scrollHeight-Le.scrollTop<=Le.clientHeight+0;Q(Qe)},[]);Y.useEffect(()=>{var K,Le,Qe,Ye,Oe,St;if(c.length>0&&!d){const wt=c[c.length-1],Cn=sessionStorage.getItem(dr(sr.LAST_SHOWN_MESSAGE_ID,{botId:e})),na=wt.isBot&&wt.conversationId===a&&wt.conversationId!==Cn,Ii=(O==null?void 0:O.itemCount)&&(O==null?void 0:O.itemCount)>0&&wt.conversationId===a;if(na){Ve(!0),me(kt=>({...kt,initialMessage:!0,leadingQueries:!0})),sessionStorage.setItem(dr(sr.LAST_SHOWN_MESSAGE_ID,{botId:e}),wt.conversationId||""),H({text:!0,leadingQueries:!1,collections:!1,products:!1,variants:!1,cartSummary:!1,bulkItems:!1});const xe=1600;let Uu=xe;const _o=[{type:"leadingQueries",condition:c.length===1&&((K=wt.leading_queries)==null?void 0:K.length)&&((Le=wt.leading_queries)==null?void 0:Le.length)>0},{type:"collections",condition:((Qe=wt.collections)==null?void 0:Qe.length)&&((Ye=wt.collections)==null?void 0:Ye.length)>0},{type:"products",condition:((Oe=wt.products)==null?void 0:Oe.length)&&((St=wt.products)==null?void 0:St.length)>0},{type:"cartSummary",condition:(O==null?void 0:O.itemCount)&&(O==null?void 0:O.itemCount)>0},{type:"bulkItems",condition:(ye==null?void 0:ye.length)>0}].filter(kt=>kt.condition);if(_o.length===0){Ve(!1),me(kt=>({...kt,initialMessage:!1,leadingQueries:!1}));return}_o.forEach(({type:kt},On)=>{setTimeout(()=>{if(me(Xn=>({...Xn,[kt]:!0})),H(Xn=>({...Xn,[kt]:!0})),Je&&Te.current){const Xn=Te.current;Xn.scrollHeight-Xn.scrollTop<=Xn.clientHeight&&Hp(Te)}On===_o.length-1&&Ve(!1)},Uu),Uu+=xe})}else Ii&&H(xe=>({...xe,cartSummary:!0}))}},[c,d,a,O==null?void 0:O.itemCount,ye==null?void 0:ye.length,Je,e]),Y.useEffect(()=>{if(!i&&c.length>0){const K=Te.current;K&&Je&&K.scrollHeight-K.scrollTop<=K.clientHeight+100&&setTimeout(()=>Hp(Te),100)}},[c.length,i,Je]),Y.useEffect(()=>{const K=document.querySelector('meta[name="viewport"]'),Le=K==null?void 0:K.content;if(z){let Qe=K;const Ye=window.matchMedia("(max-width: 768px)").matches;Qe?Qe.content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no":(Qe=document.createElement("meta"),Qe.name="viewport",Qe.content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no",document.head.appendChild(Qe)),Ye&&(t==null?void 0:t.mobileDisplayMode)==="full-screen"&&(document.body.style.overflow="hidden");const Oe=Qe;return()=>{Le&&Oe&&(Oe.content=Le),Ye&&(t==null?void 0:t.mobileDisplayMode)==="full-screen"&&(document.body.style.overflow="")}}return()=>{window.matchMedia("(max-width: 768px)").matches&&(t==null?void 0:t.mobileDisplayMode)==="full-screen"&&(document.body.style.overflow="")}},[z,t==null?void 0:t.mobileDisplayMode]),Y.useEffect(()=>{if(z&&window.matchMedia("(max-width: 768px)").matches&&(t==null?void 0:t.mobileDisplayMode)==="full-screen"){const K=Le=>{let Qe=Le.target,Ye=!1;const Oe=Te.current;if(Oe){for(;Qe&&Qe!==document.body;){if(Qe===Oe){Ye=!0;break}if(Qe.parentNode)Qe=Qe.parentNode;else break}if(!Ye)Le.preventDefault();else{const St=Oe.scrollTop<=0,wt=Oe.scrollTop+Oe.clientHeight>=Oe.scrollHeight-5;if(St&&Le.touches[0].clientY>0||wt&&Le.touches[0].clientY<0)return}}};return document.addEventListener("touchmove",K,{passive:!1}),()=>{document.removeEventListener("touchmove",K)}}return()=>{}},[z,t==null?void 0:t.mobileDisplayMode,Te]),Y.useEffect(()=>{const K=setTimeout(()=>{$e(!0)},1e3);return()=>clearTimeout(K)},[]),Y.useEffect(()=>{i||setTimeout(()=>Hp(Te),100)},[c.length,i]),Y.useEffect(()=>{O!=null&&O.itemCount&&O.itemCount===0&&!i&&setTimeout(()=>Hp(Te),100)},[O==null?void 0:O.itemCount,i]),Y.useEffect(()=>{a&&sessionStorage.setItem(dr(sr.LAST_SHOWN_MESSAGE_ID,{botId:e}),a)},[a,e]);const Nt=Y.useRef(Date.now()),cn=Y.useRef(0),ot=Y.useRef(window.location.pathname),Et=Y.useRef(x),qe=Y.useRef(!1),mt=NS("acquisition_agent");Y.useEffect(()=>{Et.current=x},[x]);const Ai=Y.useCallback(async()=>{const K=Date.now();if(K-Nt.current>=6e3&&K-cn.current>=6e4&&!qe.current)try{qe.current=!0,console.log("fetching acquisition data");const Ye=await fetch(`${so}/api/wordpress/acquisition`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,timestamp:new Date().toISOString(),page_information:window.location.href.split("?")[0],botid:e})});if(Ye.ok){const Oe=await Ye.json(),wt=[...Et.current.filter(Cn=>Cn.path!==ot.current),{question:Oe.Popup_Message,answer:"",path:ot.current,nameSpace:e,type:"dynamic",Follow_up_Question:Oe.Follow_up_Question}];S(wt)}cn.current=K}catch(Ye){console.error("Error fetching acquisition data:",Ye)}finally{qe.current=!1}},[e]);Y.useEffect(()=>{if(!mt||(t==null?void 0:t.show_bot)===!1)return;const K=()=>{Nt.current=Date.now()};document.addEventListener("mousemove",K),document.addEventListener("mousedown",K),document.addEventListener("keypress",K),document.addEventListener("scroll",K),document.addEventListener("touchstart",K),document.addEventListener("touchmove",K);const Le=setInterval(Ai,1e3),Qe=()=>{const Oe=window.location.pathname.split("?")[0],St=ot.current.split("?")[0];(()=>{const Cn=St.split("/").filter(Boolean),na=Oe.split("/").filter(Boolean);return Cn.length!==na.length?!0:Cn.length===0&&na.length===0?!1:Oe!==St})()&&(ot.current=Oe,Nt.current=Date.now())};return window.addEventListener("popstate",Qe),()=>{document.removeEventListener("mousemove",K),document.removeEventListener("mousedown",K),document.removeEventListener("keypress",K),document.removeEventListener("scroll",K),document.removeEventListener("touchstart",K),document.removeEventListener("touchmove",K),window.removeEventListener("popstate",Qe),clearInterval(Le)}},[mt,Ai,t==null?void 0:t.show_bot]);const[go,oi]=Y.useState(!1),[Yr,mo]=Y.useState(!1),[Xa,Qo]=Y.useState(null),vo=async K=>{const Le=cr();if(we(!1),K&&c.length>1)try{(await fetch(`${so}/api/wordpress/userRating`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:Le,userRating:K,nameSpace:e})})).ok||console.error("Error submitting rating")}catch(Qe){console.error("Error submitting rating:",Qe)}setTimeout(()=>{mo(!1),rt(!1,"close_button_clicked")},1e3)},Xo=K=>{p(!0),ye.forEach(Qe=>{T(Qe.id,Qe.quantity)}),window.DebalesChat.track(an.ADD_BULK_ITEM,{products:ye,message:K});const Le=[...c,{text:"🎉 Bulk items added to cart successfully.",leading_queries:["Get GST Invoice for the order","Explore more products"],conversationId:K,isBot:!0}];h(Le),m(Le),u(K),ze([]),p(!1)},Bu=()=>{var K;switch(e){case"minature":case"bodytales":case"imemyselfcare-com":if(window.triggerGokwikCustomCheckout)return window.triggerGokwikCustomCheckout(),!0;break;case"athflex":if((K=window.shiprocketCheckoutEvents)!=null&&K.buyCart)return window.shiprocketCheckoutEvents.buyCart(),!0;break;case"www":if(window.openRzpCheckout)return window.openRzpCheckout(),!0;break;default:return window.location.href=$((t==null?void 0:t.shopifyShopDomain)??""),!1}return window.location.href=$((t==null?void 0:t.shopifyShopDomain)??""),!1},od=async K=>{K.preventDefault(),window.DebalesChat.track(an.CHECKOUT_CLICKED,{chatId:cr()+e,cartValue:Number(O==null?void 0:O.total),cart:O}),F({dbls_method:"checkout_clicked"}),Bu()&&rt(!1,"checkout_clicked")},[Wr,Zn]=Y.useState([]);Y.useEffect(()=>{const K=gZ(cZ(x));Zn(K)},[x]);const xn=Y.useMemo(()=>Wr.map(K=>{if(Array.isArray(K)){const Le=K.filter(Ye=>!Ke.has(Ye.question));if(Le.length===0)return null;const Qe={isHighlighted:K[0].isHighlighted,enable:K[0].enable,type:K[0].type};return Le.map(Ye=>({...Ye,...Qe}))}else return Ke.has(K.question)?null:K}).filter(Boolean),[Wr,Ke]);Y.useEffect(()=>{const K=Ye=>{const Oe=Ye.detail.formId;switch(Ye.detail.type){case"open":case"embedOpen":setTimeout(()=>{const wt=Le(Oe);wt&&J(wt)},800);break;case"close":k&&(t==null?void 0:t.KlaviyoFormIntegration)===!0&&setTimeout(()=>{rt(!0,"klaviyo_form_closed"),L(Oe),r(k,void 0,void 0,!0,void 0,void 0)},1e4);break}},Le=Ye=>{const Oe=document.querySelector(`[data-testid="klaviyo-form-${Ye}"]`);if(console.log(`formElement text ${Ye} =>`,Oe==null?void 0:Oe.innerText,Oe==null?void 0:Oe.textContent),Oe instanceof HTMLElement){const St=Oe.innerText||Oe.textContent;if(St)return console.log("Found form text:",St),`=> Klaviyo form content:
2332
2332
 
2333
2333
  `+St+`
2334
2334
 
2335
- => User Action: Klaviyo form closed`}return""},Qe=Ye=>{Ye instanceof CustomEvent&&K(Ye)};return window.addEventListener("klaviyoForms",Qe),()=>{window.removeEventListener("klaviyoForms",Qe)}},[k,t,r]),Y.useEffect(()=>{const K=Te.current;return K?(K.addEventListener("scroll",Jt),()=>K.removeEventListener("scroll",Jt)):()=>{}},[Jt]);const[yo,Jo]=Y.useState(!1),ea=se==="Highest"?"120px":se==="Higher"?"60px":"15px",ad=async()=>{try{const K=await fetch(`${so}/api/wordpress/support`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({chatid:cr()+e,nameSpace:e,userName:Xe.name,userEmail:Xe.email,userMessage:Xe.message,tag:"support"})});if(K.ok)h(Le=>[...Le,{text:"Thanks for reaching out! Our support team has received your request and will get back to you within 24 hours.<br>In the meantime, feel free to continue chatting with me - I'll do my best to help!",isBot:!0}]),console.log("Connected to support with existing user info:",Pa());else{const Le=await K.json();console.error("Failed to connect to support:",Le),h(Qe=>[...Qe,{text:"Sorry, we couldn't connect you to support at the moment.<br>Please try again later.",isBot:!0}])}}catch{h(Le=>[...Le,{text:"Sorry, we couldn't connect you to support at the moment.<br>Please try again later.",isBot:!0}])}},Fu=()=>{const K=Pa();K&&K.name&&K.email&&nt({name:K==null?void 0:K.name,email:K==null?void 0:K.email,message:""}),h(Le=>[...Le,{text:"Please provide your name, email and message to connect with support.",isBot:!0}]),lt(!0)},ta=async K=>{K.preventDefault(),f1({name:Xe.name,email:Xe.email}),lt(!1),h(Le=>Le.slice(0,-1)),await ad()};return Y.useEffect(()=>{if(c.length===1&&c[0].isBot){me(Le=>({...Le,leadingQueries:!0}));const K=setTimeout(()=>{me(Le=>({...Le,leadingQueries:!1}))},2e3);return()=>clearTimeout(K)}},[c]),!t||t.show_bot===!1||o?null:D.jsxs(Oz,{theme:sZ(t),children:[D.jsx("link",{rel:"preconnect",href:"https://fonts.googleapis.com"}),D.jsx("link",{rel:"preconnect",href:"https://fonts.gstatic.com",crossOrigin:"anonymous"}),D.jsx("link",{href:"https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap",rel:"stylesheet"}),D.jsx(Iee,{}),!z&&(xn==null?void 0:xn.length)!==0&&D.jsx(Aee,{className:st?"visible":"",$botId:e,$iconSize:q,$removeLogoBackground:t.removeLogoBackground,topOffset:ea,style:{right:G?"auto":"24px",left:G?"24px":"auto",display:"flex",flexDirection:"column",alignItems:G?"flex-start":"flex-end"},children:he.suggestions?D.jsx(Su,{loading:!0,loadingPhrases:["🎨 Loading","✨ Almost","🚀 Ready"]}):xn.map((K,Le)=>{if(Array.isArray(K)){const Qe=K.map(Ye=>({question:Ye.question,isHighlighted:Ye.isHighlighted??!1})).filter(Ye=>!Ke.has(Ye.question));return D.jsx(eL,{$index:Le,$totalCount:xn.length,children:D.jsx(eQ,{messages:Qe,botId:e,uiData:t,onClick:Ye=>{const Oe=K.find(St=>St.question===Ye);rt(!0,"suggested_question_clicked"),Pe(St=>{const wt=new Set(St);return wt.add(Ye),wt}),window.DebalesChat.track(an.SUGGESTED_QUESTION_CLICKED,{suggested_question:Oe}),!E&&Oe?(Be(!1),et(!0),r(Oe.question,Oe==null?void 0:Oe.answer,Oe==null?void 0:Oe.products,!1,Oe==null?void 0:Oe.leading_queries,Oe==null?void 0:Oe.Follow_up_Question)):(Be(!1),et(!0),C(!0),I(Oe))}})},Le)}else return D.jsx(eL,{$index:Le,$totalCount:xn.length,children:D.jsx(XK,{value:`${K.question}`,index:Le,botId:e,uiData:t,onClose:()=>{Pe(Qe=>{const Ye=new Set(Qe);return Ye.add(K.question),Ye})},onClick:()=>{rt(!0,"suggested_question_clicked"),Pe(Qe=>{const Ye=new Set(Qe);return Ye.add(K.question),Ye}),window.DebalesChat.track(an.SUGGESTED_QUESTION_CLICKED,{suggested_question:K}),E?(Be(!1),et(!0),C(!0),I(K)):(Be(!1),et(!0),r(K.question,K.answer,K.products,void 0,K.leading_queries,K.Follow_up_Question))},isHighlighted:K.isHighlighted??!1})},Le)})}),D.jsxs(lee,{$topOffset:ea,$removeLogoBackground:t.removeLogoBackground,style:{display:z?"none":"inline-flex",right:G?"auto":"24px",left:G?"24px":"auto"},children:[D.jsx(uee,{$showAnimation:t.enableChatButtonBackgroundAnimation??!1,$animationType:"Ping",$animationColor:t.chatButtonBackgroundAnimationColor||"#f48722",$backgroundColor:t.backgroundColor||"#fff",$removeLogoBackground:t.removeLogoBackground,$topOffset:ea,$iconSize:q}),D.jsx(cee,{$backgroundColor:t.removeLogoBackground?"transparent":t.backgroundColor||"#fff",$botId:e,$iconSize:q,$removeLogoBackground:t.removeLogoBackground,topOffset:ea,$showAnimation:t.enableChatButtonBackgroundAnimation,$animationType:"Ping",$animationColor:t.chatButtonBackgroundAnimationColor||"#f48722",id:"debales-chat-button",onClick:()=>{if(window.DebalesChat.track(an.CHAT_BUTTON_CLICKED),rt(!z,"chat_button_clicked"),!z){const K=_();K.length>0?(h(K),Be(!1),et(!0)):(Be(!0),et(!1),me(Le=>({...Le,initialMessage:!0,leadingQueries:!0})),H({text:!0,leadingQueries:!1,collections:!1,products:!1,variants:!1,cartSummary:!1,bulkItems:!1}),setTimeout(()=>{Be(!1),et(!0),me(Qe=>({...Qe,initialMessage:!1}));const Le={text:(t==null?void 0:t.initialMessage)||"Hi, I am an AI chatbot, how can I help you today?",isBot:!0};h([Le]),me(Qe=>({...Qe,leadingQueries:!0})),setTimeout(()=>{H(Qe=>({...Qe,leadingQueries:!0}))},Ht)},Ht))}},"aria-label":"Chat",style:{display:z?"none":"inline-flex",right:G?"auto":"24px",left:G?"24px":"auto"},children:D.jsx(fee,{$botId:e,$removeLogoBackground:t.removeLogoBackground,"aria-hidden":"true",src:t.bot_logo,alt:"Chat Bot Icon"})})]}),z&&p5.createPortal(D.jsx(D.Fragment,{children:D.jsxs(vee,{$backgroundColor:t.backgroundColor||"#fff",$fullScreenOnMobile:t.fullScreenOnMobile,$headerFontColor:t.headerFontColor||"#1C1C1C",$isLeft:G,$topOffset:ea,$mobileDisplayMode:t.mobileDisplayMode,$isVisible:ce,children:[D.jsxs(yee,{$backgroundColor:t.backgroundColor||"#fff",style:{color:t.headerFontColor},children:[D.jsxs("div",{style:{display:"flex",columnGap:"10px",flex:"1 1 0%",alignItems:"center"},children:[D.jsx(dee,{"aria-hidden":"true",src:t.bot_logo,alt:"Chat Bot Icon"}),D.jsxs(hee,{$botNameColor:t.headerFontColor,children:[D.jsxs("div",{style:{fontWeight:"700",wordBreak:"break-word"},children:[t.chatbotName,e==="catch-org-ai"&&D.jsx(gee,{$backgroundColor:t.callToActionBackgroundColor,$fontColor:t.callToActionFontColor,children:"Beta"})]}),D.jsx(pee,{children:D.jsx(RK,{})})]})]}),D.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[D.jsxs(Ree,{children:[D.jsxs(Oee,{onClick:Fu,children:[D.jsx(TK,{color:t.headerFontColor}),D.jsx(Tee,{children:"Support"})]}),D.jsx(tL,{children:"Need more help? I'll connect you with a support agent."})]}),(t.mobileDisplayMode==="half-screen"||t.mobileDisplayMode==="full-screen")&&V&&D.jsx("button",{onClick:()=>{const K=t.mobileDisplayMode==="full-screen"?"half-screen":"full-screen";v(K)},style:{background:"none",border:"none",cursor:"pointer",padding:"0",marginRight:"10px",display:"flex",alignItems:"center"},"aria-label":t.mobileDisplayMode==="full-screen"?"Switch to half screen":"Switch to full screen",children:t.mobileDisplayMode==="full-screen"?D.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:D.jsx("path",{d:"M4.5 15.75V13.5H2.25V12H6V15.75H4.5ZM12 15.75V12H15.75V13.5H13.5V15.75H12ZM2.25 6V4.5H4.5V2.25H6V6H2.25ZM12 6V2.25H13.5V4.5H15.75V6H12Z",fill:"black"})}):D.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:D.jsx("path",{d:"M10 3.75H16.25V10H14.5833V6.595L6.595 14.5833H10V16.25H3.75V10H5.41667V13.405L13.405 5.41667H10V3.75Z",fill:"black"})})}),D.jsx(mee,{onClick:()=>{N?mo(!0):rt(!1,"close_button_clicked")},id:"debales-minimize-button","aria-label":"Minimize",children:D.jsx(GS,{botNameColor:t.headerFontColor})})]})]}),D.jsxs(bee,{$backgroundColor:t.botBackgroundColor||"#fff",$mobileDisplayMode:t.mobileDisplayMode,children:[fe&&D.jsxs(WS,{$fontColor:t.botFontColor||"#000",$botMessageColor:t.botBackgroundColor||"#fff",children:[D.jsx("img",{src:t.bot_logo,alt:"Chat Bot Icon"}),D.jsx(QS,{children:D.jsx(Nu,{$botMessageColor:t.botMessageColor||"#fff",style:{backgroundColor:"transparent",padding:"0px"},children:D.jsx("div",{style:{display:"flex",color:t.botFontColor,alignItems:"center"},children:D.jsx(Su,{loading:fe,loadingPhrases:["🎨 Loading","✨ Almost","🚀 Ready"]})})})})]}),yo&&((Yi=(Ja=t.pluginConfig)==null?void 0:Ja.collectedUserInfo)==null?void 0:Yi.discount)&&D.jsx(QK,{discount:t.pluginConfig.collectedUserInfo.discount,uiData:t,onClose:()=>{Jo(!1),window.DebalesChat.track(an.DISCOUNT_VIEWED,{discount:t.pluginConfig.collectedUserInfo.discount})}}),D.jsx(eee,{uidata:t,product:Xa,showModel:go,setShowModel:oi,onVariantSelect:K=>{T(K.id,1),window.DebalesChat.track(an.ADD_TO_CART_CLICKED,{product:K.title,price:Number(K.price),link:`https://${t.shopifyShopDomain}/variants/${K.id}`,message:a,chatId:cr()+e})}}),Yr&&D.jsx(pQ,{setShowExitModal:mo,handleCloseChatbot:vo,chatId:cr()+e}),D.jsxs(_ee,{id:"debales-conversation-group",$botBackgroundColor:t.botBackgroundColor||"#fff",ref:Te,$mobileDisplayMode:t.mobileDisplayMode,children:[je&&c.map((K,Le)=>{const Qe=K.isBot,Ye=pZ(K.text);return K.hideConfirmation?null:D.jsxs(Y.Fragment,{children:[Qe&&D.jsxs(WS,{$fontColor:t.botFontColor||"#000",$botMessageColor:t.botBackgroundColor||"#fff",children:[D.jsx("img",{src:Qe?t.bot_logo:t.userMessage_logo,alt:"Chat User Icon"}),D.jsxs(QS,{children:[Ye.map(Oe=>D.jsx("div",{children:D.jsx(Nu,{$botMessageColor:Qe?t.botMessageColor||"#fff":t.userMessageColor||"#fff",style:{color:t.botFontColor},children:D.jsx(KE,{components:{a:({href:St,children:wt})=>{const Cn=()=>{St!=null&&St.startsWith("https://shop.catch.org/")&&window.DebalesChat.track(an.SHOPIFY_LINK_CLICKED)};return D.jsx("a",{href:St,target:"_blank",onClick:Cn,children:wt})}},remarkPlugins:[AU,FW],children:Oe})})})),K.collections&&a===K.conversationId&&B.collections&&D.jsx(qK,{message:K,botId:e,uidata:t,onSendMessage:r,loading:d}),K.products&&a===K.conversationId&&B.products&&D.jsx(DQ,{message:K,botId:e,uidata:t,onSendMessage:r,loading:d,storeMetaData:n,platform:P,setShowVariantModel:oi,setSelectedProduct:Qo,setCartVersion:_e}),i&&D.jsx(KS,{children:D.jsx(tD,{onClick:()=>{window._klOnsite&&(window._klOnsite.push(["openForm",ue]),rt(!1,"klaviyo_grab_deal_button"))},children:"🚀 Grab Deal Now!"})}),c.length==1&&Le==0&&!b&&D.jsx(KS,{children:he.leadingQueries?D.jsx("div",{style:{display:"flex"},children:D.jsx(Su,{loading:!0,loadingPhrases:["🎨 Loading","✨ Almost","🚀 Ready"]})}):Wr.map(Oe=>Array.isArray(Oe)?Oe[0]:Oe).map((Oe,St)=>D.jsx(J4,{style:{backgroundColor:t.callToActionBackgroundColor,color:t.callToActionFontColor},onClick:()=>{E?(C(!0),I({question:Oe.question,answer:Oe.answer,products:Oe.products,path:"/",nameSpace:window.DebalesChat.projectId})):(Be(!1),et(!0),r(Oe.question,Oe.answer,Oe.products,void 0,Oe.leading_queries,Oe.Follow_up_Question)),Pe(wt=>{const Cn=new Set(wt);return Cn.add(Oe.question),Cn}),window.DebalesChat.track(an.INITIAL_LEADING_QUERY_SUGGESTED_QUESTION_CLICKED,{question:Oe.question})},disabled:d,$disabled:d,children:Oe.question},St))}),K.leading_queries&&K.leading_queries.length>0&&a===K.conversationId&&B.leadingQueries&&!i&&!b&&D.jsx(KS,{children:he.leadingQueries?D.jsx(Su,{loading:!0,loadingPhrases:["🎨 Loading","✨ Almost","🚀 Ready"]}):K.leading_queries.map((Oe,St)=>D.jsx(J4,{style:{backgroundColor:t.callToActionBackgroundColor,color:t.callToActionFontColor},onClick:()=>{E?(C(!0),I({question:Oe,path:"/",nameSpace:window.DebalesChat.projectId})):r(Oe),window.DebalesChat.track(an.LEADING_QUERY_CLICKED,{query:Oe})},disabled:d,$disabled:d,children:Oe},St))}),O&&O.itemCount>0&&a===K.conversationId&&B.cartSummary&&D.jsxs(Cee,{children:[D.jsx(Nu,{$botMessageColor:t.botMessageColor,style:{width:"max-content",color:t.botFontColor},dangerouslySetInnerHTML:{__html:`<span style="display: flex; align-items: center; justify-content: center;">Total Price: ${GW((O==null?void 0:O.total)??0,(O==null?void 0:O.currency)??"USD")} </span>`}}),D.jsxs(qW,{href:$(t.shopifyShopDomain??""),onClick:od,children:[D.jsx("span",{children:"Checkout"}),D.jsx(AK,{style:{width:"20px",fill:t.callToActionFontColor}})]})]}),ye&&ye.length>0&&a===K.conversationId&&B.bulkItems&&D.jsx(zW,{onClick:()=>Xo(K.conversationId),children:"Add Bulk Items to Cart"}),b&&c.indexOf(K)===c.length-1&&D.jsx(D.Fragment,{children:D.jsx(zJ,{setShowModel:Oe=>{var wt,Cn;const St=typeof Oe=="function"?Oe(b):Oe;C(St),!St&&((Cn=(wt=t.pluginConfig)==null?void 0:wt.collectedUserInfo)!=null&&Cn.discount)&&Jo(!0)},inChat:!0,showFormInstructions:!1})}),Ge&&c.indexOf(K)===c.length-1&&D.jsxs(Mee,{onSubmit:ta,children:[D.jsxs(XS,{children:[D.jsxs(JS,{children:["Name",D.jsx("span",{children:"*"})]}),D.jsx(nL,{type:"text",required:!0,value:Xe.name,onChange:Oe=>nt(St=>({...St,name:Oe.target.value})),placeholder:"John"})]}),D.jsxs(XS,{children:[D.jsxs(JS,{children:["Email",D.jsx("span",{children:"*"})]}),D.jsx(nL,{type:"email",required:!0,value:Xe.email,onChange:Oe=>nt(St=>({...St,email:Oe.target.value})),placeholder:"olivia@untitledui.com"})]}),D.jsxs(XS,{children:[D.jsxs(JS,{children:["Message",D.jsx("span",{children:"*"})]}),D.jsx(Dee,{required:!0,value:Xe.message,onChange:Oe=>nt(St=>({...St,message:Oe.target.value})),placeholder:"I need help with..."})]}),D.jsx($ee,{children:D.jsx(Lee,{type:"submit",children:"Submit"})})]}),Se&&!d&&a===K.conversationId&&D.jsx(Nu,{$botMessageColor:t.botMessageColor,style:{color:t.botFontColor},children:D.jsx(Su,{loading:Se,loadingPhrases:["🎨 Loading","✨ Almost","🚀 Ready"]})})]})]}),!Qe&&D.jsx(Eee,{$fontColor:t.userFontColor||"#000",$botMessageColor:t.botBackgroundColor||"#fff",children:D.jsx(Nu,{$botMessageColor:Qe?t.botMessageColor||"#fff":t.userMessageColor||"#fff",children:D.jsx(KE,{children:K.text})})})]},Le)}),d&&D.jsxs(WS,{$fontColor:t.botFontColor||"#000",$botMessageColor:t.botBackgroundColor||"#fff",children:[D.jsx("img",{src:t.bot_logo,alt:"Chat User Icon"}),D.jsx(QS,{children:D.jsx(Nu,{$botMessageColor:t.botMessageColor||"#fff",style:{backgroundColor:"transparent",padding:"0px"},children:D.jsx("div",{style:{display:"flex",alignItems:"center",gap:"4px",animation:"fadeIn 0.3s ease-in-out"},children:D.jsx(Su,{loading:d})})})})]})]}),D.jsxs("div",{className:"debales-footer-container",style:{width:"calc(100%-24px)",backgroundColor:t.footerBackgroundColor||"#fff",color:t.fontColor||"#000"},children:[e==="catch-org-ai"&&D.jsx(xee,{children:D.jsx("span",{children:'"Catch org AI" can make mistakes.'})}),D.jsx("div",{children:D.jsx(oee,{disabled:d,inputState:!1})}),(t.debales_branding??!0)&&D.jsxs(See,{href:"https://debales.ai/?open=true",target:"_blank",title:"debales-link",style:{color:t.fontColor?t.fontColor:"fff",marginTop:e==="catch-org-ai"?"0":"9px"},children:[D.jsx("p",{children:"Powered by"}),D.jsxs(wee,{children:[D.jsx("img",{src:`${so}/images/debales_logo_d.png`,alt:"Debales logo"}),D.jsx("p",{children:"DEBALES"})]})]})]})]})]})}),X.shadowRoot)]})},rL="debales-ai-assistant",iL="debales-chatbot-container",Pee=Y.forwardRef(({children:e,globalStyles:t="",containerStyles:n={},onReady:r},i)=>{const o=Y.useRef(null),[a,u]=Y.useState(null),c=Y.useRef(null),d=Y.useRef(null),p=Y.useRef({get shadowRoot(){return c.current},get container(){return a},querySelector:h=>{var m;return((m=c.current)==null?void 0:m.querySelector(h))||null},querySelectorAll:h=>{var m;return((m=c.current)==null?void 0:m.querySelectorAll(h))||null}});return Y.useImperativeHandle(i,()=>p.current,[]),Y.useEffect(()=>{const h=document.getElementById(rL);if(h?o.current=h:o.current&&(o.current.id=rL),o.current&&(o.current.style.cssText="position: absolute; top: 0; left: 0; width: 0; height: 0;"),o.current){if(o.current.shadowRoot){c.current=o.current.shadowRoot;const _=c.current.querySelector(`#${iL}`);_&&u(_);return}const m=o.current.attachShadow({mode:"open"});if(c.current=m,t){const _=document.createElement("style");_.textContent=t,m.appendChild(_)}const v=document.createElement("div");v.id=iL,v.style.cssText="position: absolute; top: 0; left: 0; width: 0; height: 0;",m.appendChild(v),u(v),r&&r(m,v)}},[t,r]),Y.useEffect(()=>(a&&!d.current&&(d.current=RC.createRoot(a)),d.current&&a&&d.current.render(D.jsx(Ez,{target:a,children:D.jsx(rD,{value:p.current,children:e})})),()=>{d.current&&d.current.unmount()}),[a,e]),D.jsx("div",{ref:o,style:n})});class ew{isSupported(){return Wf.detect()===this.platform}createSuccessResult(t,n){return{success:!0,data:t,message:n}}createErrorResult(t){return{success:!1,error:t}}}class Bee extends ew{constructor(){super(...arguments);tr(this,"platform",gr.DEFAULT)}async fetchCart(){return console.log("DefaultCartAdapter: fetchCart called"),this.createSuccessResult({items:[],total:0,itemCount:0,currency:"USD",token:"default-token"},"Default cart fetched")}async addToCart(n,r=1,i){return console.log("DefaultCartAdapter: addToCart called",{variantId:n,quantity:r,properties:i}),this.createSuccessResult(void 0,"Item added to cart (mock)")}async removeFromCart(n){return console.log("DefaultCartAdapter: removeFromCart called",{itemId:n}),this.createSuccessResult(void 0,"Item removed from cart (mock)")}async updateQuantity(n){return console.log("DefaultCartAdapter: updateQuantity called",{cartItem:n}),this.createSuccessResult(void 0,"Item quantity updated (mock)")}async clearCart(){return console.log("DefaultCartAdapter: clearCart called"),this.createSuccessResult(void 0,"Cart cleared (mock)")}generateCartUrl(n){const r=n.replace(/^https?:\/\//,"");return console.log("DefaultCartAdapter: generateCartUrl called",{domain:n,sanitizedDomain:r}),`https://${r}/cart`}generateProductUrl(n,r){if(r.handle){const i=new URL(`https://${n}/products/${r.handle}`);return i.searchParams.append("variant",r.product_id),Xs(i.toString())}else return Xs(r.link)}async addCartAttributes(n={}){return console.log("MethodNotImplemented: addCartAttributes called",{attributes:n}),this.createSuccessResult(void 0,"Cart attributes added (mock)")}}class Fee extends ew{constructor(){var n,r;super();tr(this,"platform",gr.SHOPIFY);tr(this,"cartEndpoint");tr(this,"localCartKey","debales_track_cart");this.cartEndpoint=((r=(n=window.Shopify)==null?void 0:n.routes)==null?void 0:r.root)||"/"}normalizeCartData(n){return{items:n.items.map(r=>({id:r.id,variant_id:r.variant_id,quantity:r.quantity,title:r.title,price:r.price,properties:r.properties})),total:n.total_price/100,itemCount:n.item_count,currency:n.currency,token:n.token.split("?")[0]}}generateProductUrl(n,r){const i=Cv(n);if(!i.isValid)return"";if(r.handle){const o=new URL(`/products/${r.handle}`,i.url);return o.searchParams.append("variant",r.product_id),Xs(o.toString())}else return Xs(r.link)}updateTrackCart({cartToken:n,sessionId:r=cr()}){localStorage.setItem(this.localCartKey,JSON.stringify({sessionId:r,cartToken:n}))}async fetchCart(){try{const n=await fetch(`${this.cartEndpoint}cart.js`),r=await n.json();if(!n.ok){const o=r;return this.createErrorResult(o.description||`Failed to fetch cart: ${n.status}`)}const i=r;return this.createSuccessResult(this.normalizeCartData(i),"Cart fetched successfully")}catch(n){return this.createErrorResult(n instanceof Error?`Error fetching cart: ${n.message}`:"Unknown error occurred while fetching cart")}}async addToCart(n,r=1,i){try{const o=await fetch(`${this.cartEndpoint}cart/add.js`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:[{id:n,quantity:r,properties:i}],attributes:{dbls_order_source:"direct_recommendation",dbls_session_id:cr(),dbls_method:"add_to_cart"}})}),a=await o.json();if(!o.ok){const u=a;return this.createErrorResult(u.description||`Failed to add item to cart: ${o.status}`)}return this.fetchCart().then(u=>{u.success&&this.updateTrackCart({cartToken:u==null?void 0:u.data.token})}),this.createSuccessResult(void 0,`Successfully added ${r} item(s) to cart`)}catch(o){return this.createErrorResult(o instanceof Error?`Error adding to cart: ${o.message}`:"Unknown error occurred while adding to cart")}}async removeFromCart(n){return this.updateQuantity({id:n,quantity:0})}async updateQuantity(n){try{const r=await fetch(`${this.cartEndpoint}cart/change.js`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:n.id,quantity:n.quantity})}),i=await r.json();if(!r.ok){const o=i;return this.createErrorResult(o.description||`Failed to update item quantity: ${r.status}`)}return this.fetchCart().then(o=>{o.success&&this.updateTrackCart({cartToken:o==null?void 0:o.data.token})}),this.createSuccessResult(void 0,n.quantity===0?"Item removed from cart":`Quantity updated to ${n.quantity}`)}catch(r){return this.createErrorResult(r instanceof Error?`Error updating quantity: ${r.message}`:"Unknown error occurred while updating quantity")}}async clearCart(){try{const n=await fetch(`${this.cartEndpoint}cart/clear.js`,{method:"POST"});if(!n.ok){const r=await n.json();return this.createErrorResult(r.description||`Failed to clear cart: ${n.status}`)}return this.createSuccessResult(void 0,"Cart cleared successfully")}catch(n){return this.createErrorResult(n instanceof Error?`Error clearing cart: ${n.message}`:"Unknown error occurred while clearing cart")}}async addCartAttributes(n={}){try{const r=await fetch(`${this.cartEndpoint}cart/update.js`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({attributes:{dbls_order_source:"direct_recommendation",dbls_session_id:cr(),...n}})});if(!r.ok){const i=await r.json();return this.createErrorResult(i.description||`Failed to update cart attributes: ${r.status}`)}return this.createSuccessResult(void 0,"Cart attributes updated successfully")}catch(r){return this.createErrorResult(r instanceof Error?`Error updating cart attributes: ${r.message}`:"Unknown error occurred while updating cart attributes")}}generateCartUrl(n){const r=Cv(n);if(!r.isValid)return"";const i=new URL("/cart",r.url);return i.searchParams.append("ref",`debales-ai-${new Date().toISOString()}`),i.searchParams.append("attributes[from]","debales-ai-chatbot"),i.searchParams.append("attributes[through]","add-to-cart"),i.searchParams.append("attributes[dbls_session_id]",cr()),i.searchParams.append("timestamp",Date.now().toString()),Xs(i.toString())}}class Uee extends ew{constructor(){var n,r;super();tr(this,"platform",gr.MAGENTO);tr(this,"checkoutEndpoint");tr(this,"baseUrl");this.checkoutEndpoint=((n=window.checkout)==null?void 0:n.checkoutUrl)||"/",this.baseUrl=((r=window.checkout)==null?void 0:r.baseUrl)||"/"}normalizeCartData(n){return{items:n.items.map(r=>({id:parseInt(r.item_id),variant_id:parseInt(r.product_id),quantity:r.qty,title:r.product_name,price:r.product_price_value,properties:{name:r.product_name}})),total:parseFloat(n.subtotalAmount),itemCount:n.summary_count,currency:"USD",token:n.data_id.toString()}}async fetchCart(){try{const n=await fetch(`${this.baseUrl}customer/section/load/?sections=cart&update_section_id=false`),r=await n.json();if(!n.ok)return this.createErrorResult(`Failed to fetch cart: ${n.status}`);const i=r.cart;return this.createSuccessResult(this.normalizeCartData(i),"Cart fetched successfully")}catch(n){return this.createErrorResult(n instanceof Error?`Error fetching cart: ${n.message}`:"Unknown error occurred while fetching cart")}}async addToCart(n,r=1){var i;try{const o=(i=document.querySelector('input[name="form_key"]'))==null?void 0:i.value;if(!o)return this.createErrorResult("Form key not found");const a=await fetch(`${this.checkoutEndpoint}cart/add`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded","X-Requested-With":"XMLHttpRequest"},body:new URLSearchParams({product:n,qty:r.toString(),form_key:o})});if(!a.ok)return this.createErrorResult(`Failed to add item to cart: ${a.status}`);try{window.require(["Magento_Customer/js/customer-data"],u=>u.reload(["cart"],!0))}catch(u){console.warn("Failed to reload cart data:",u)}return this.createSuccessResult(void 0,`Successfully added ${r} item(s) to cart`)}catch(o){return this.createErrorResult(o instanceof Error?`Error adding to cart: ${o.message}`:"Unknown error occurred while adding to cart")}}async removeFromCart(n){return console.log("MethodNotImplemented: removeFromCart called",{itemId:n}),this.createSuccessResult(void 0,"Item removed from cart (mock)")}async updateQuantity(n){return console.log("MethodNotImplemented: updateQuantity called",{cartItem:n}),this.createSuccessResult(void 0,"Item quantity updated (mock)")}async clearCart(){return console.log("MethodNotImplemented: clearCart called"),this.createSuccessResult(void 0,"Cart cleared (mock)")}generateCartUrl(n){const r=new URL(`https://${n}/checkout/cart?ref=debales-ai-${new Date().toISOString()}&attributes[from]=debales-ai-chatbot&attributes[through]=add-to-cart`);return r.searchParams.append("timestamp",Date.now().toString()),r.toString()}generateProductUrl(n,r){const i=Cv(n);if(!i.isValid)return"";if(r.handle){const o=new URL(`/${r.handle}.html`,i.url);return Xs(o.toString())}else return Xs(r.link)}async addCartAttributes(n={}){return console.log("MethodNotImplemented: addCartAttributes called",{attributes:n}),this.createSuccessResult(void 0,"Cart attributes added (mock)")}}const Js=class Js{constructor(){tr(this,"adapterCache");this.adapterCache=new Map}static getInstance(){return Js.instance||(Js.instance=new Js),Js.instance}getAdapter(t){const n=t||Wf.detect(),r=this.adapterCache.get(n);if(r)return r;let i;switch(n){case gr.SHOPIFY:i=new Fee;break;case gr.MAGENTO:i=new Uee;break;default:console.warn(`No specific adapter found for platform ${n}, using default adapter`),i=new Bee}return this.adapterCache.set(n,i),i}clearCache(){this.adapterCache.clear()}};tr(Js,"instance");let tw=Js;const zee=({adapter:e,children:t,autoFetch:n=!0})=>{const[r,i]=Y.useState(!1),[o,a]=Y.useState(null),[u,c]=Y.useState(null),d=Y.useCallback(async()=>{try{i(!0),a(null);const C=await e.fetchCart();C.success?c(C.data):a(C.error)}catch(C){a(C instanceof Error?C.message:"Failed to fetch cart")}finally{i(!1)}},[e]),p=async(C,E,I)=>{try{a(null);const O=await e.addToCart(C,E,I);return O.success&&await d(),O}catch(O){return{success:!1,error:O instanceof Error?O.message:"Failed to add item to cart"}}},h=async C=>{try{a(null);const E=await e.removeFromCart(C);return E.success&&await d(),E}catch(E){return{success:!1,error:E instanceof Error?E.message:"Failed to remove item from cart"}}},m=async C=>{try{a(null);const E=await e.updateQuantity(C);return E.success&&await d(),E}catch(E){return{success:!1,error:E instanceof Error?E.message:"Failed to update quantity"}}},v=async()=>{try{a(null);const C=await e.clearCart();return C.success&&await d(),C}catch(C){return{success:!1,error:C instanceof Error?C.message:"Failed to clear cart"}}},_=C=>e.generateCartUrl(C),x=(C,E)=>e.generateProductUrl(C,E),S=async C=>e.addCartAttributes(C);Y.useEffect(()=>{n&&d()},[n,d]);const b={isLoading:r,error:o,cart:u,fetchCart:d,addToCart:p,removeFromCart:h,updateQuantity:m,clearCart:v,generateCartUrl:_,generateProductUrl:x,addCartAttributes:S};return D.jsx(cT.Provider,{value:b,children:t})},fo=Object.create(null);fo.open="0",fo.close="1",fo.ping="2",fo.pong="3",fo.message="4",fo.upgrade="5",fo.noop="6";const Ev=Object.create(null);Object.keys(fo).forEach(e=>{Ev[fo[e]]=e});const nw={type:"error",data:"parser error"},oL=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",aL=typeof ArrayBuffer=="function",sL=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,rw=({type:e,data:t},n,r)=>oL&&t instanceof Blob?n?r(t):lL(t,r):aL&&(t instanceof ArrayBuffer||sL(t))?n?r(t):lL(new Blob([t]),r):r(fo[e]+(t||"")),lL=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function uL(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let iw;function qee(e,t){if(oL&&e.data instanceof Blob)return e.data.arrayBuffer().then(uL).then(t);if(aL&&(e.data instanceof ArrayBuffer||sL(e.data)))return t(uL(e.data));rw(e,!1,n=>{iw||(iw=new TextEncoder),t(iw.encode(n))})}const cL="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",rd=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<cL.length;e++)rd[cL.charCodeAt(e)]=e;const jee=e=>{let t=e.length*.75,n=e.length,r,i=0,o,a,u,c;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const d=new ArrayBuffer(t),p=new Uint8Array(d);for(r=0;r<n;r+=4)o=rd[e.charCodeAt(r)],a=rd[e.charCodeAt(r+1)],u=rd[e.charCodeAt(r+2)],c=rd[e.charCodeAt(r+3)],p[i++]=o<<2|a>>4,p[i++]=(a&15)<<4|u>>2,p[i++]=(u&3)<<6|c&63;return d},Hee=typeof ArrayBuffer=="function",ow=(e,t)=>{if(typeof e!="string")return{type:"message",data:fL(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:Gee(e.substring(1),t)}:Ev[n]?e.length>1?{type:Ev[n],data:e.substring(1)}:{type:Ev[n]}:nw},Gee=(e,t)=>{if(Hee){const n=jee(e);return fL(n,t)}else return{base64:!0,data:e}},fL=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},dL="",Vee=(e,t)=>{const n=e.length,r=new Array(n);let i=0;e.forEach((o,a)=>{rw(o,!1,u=>{r[a]=u,++i===n&&t(r.join(dL))})})},Zee=(e,t)=>{const n=e.split(dL),r=[];for(let i=0;i<n.length;i++){const o=ow(n[i],t);if(r.push(o),o.type==="error")break}return r};function Yee(){return new TransformStream({transform(e,t){qee(e,n=>{const r=n.length;let i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);const o=new DataView(i.buffer);o.setUint8(0,126),o.setUint16(1,r)}else{i=new Uint8Array(9);const o=new DataView(i.buffer);o.setUint8(0,127),o.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!="string"&&(i[0]|=128),t.enqueue(i),t.enqueue(n)})}})}let aw;function kv(e){return e.reduce((t,n)=>t+n.length,0)}function Av(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let i=0;i<t;i++)n[i]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),n}function Wee(e,t){aw||(aw=new TextDecoder);const n=[];let r=0,i=-1,o=!1;return new TransformStream({transform(a,u){for(n.push(a);;){if(r===0){if(kv(n)<1)break;const c=Av(n,1);o=(c[0]&128)===128,i=c[0]&127,i<126?r=3:i===126?r=1:r=2}else if(r===1){if(kv(n)<2)break;const c=Av(n,2);i=new DataView(c.buffer,c.byteOffset,c.length).getUint16(0),r=3}else if(r===2){if(kv(n)<8)break;const c=Av(n,8),d=new DataView(c.buffer,c.byteOffset,c.length),p=d.getUint32(0);if(p>Math.pow(2,21)-1){u.enqueue(nw);break}i=p*Math.pow(2,32)+d.getUint32(4),r=3}else{if(kv(n)<i)break;const c=Av(n,i);u.enqueue(ow(o?c:aw.decode(c),t)),r=0}if(i===0||i>e){u.enqueue(nw);break}}}})}const hL=4;function Vn(e){if(e)return Kee(e)}function Kee(e){for(var t in Vn.prototype)e[t]=Vn.prototype[t];return e}Vn.prototype.on=Vn.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},Vn.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},Vn.prototype.off=Vn.prototype.removeListener=Vn.prototype.removeAllListeners=Vn.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var r,i=0;i<n.length;i++)if(r=n[i],r===t||r.fn===t){n.splice(i,1);break}return n.length===0&&delete this._callbacks["$"+e],this},Vn.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,i=n.length;r<i;++r)n[r].apply(this,t)}return this},Vn.prototype.emitReserved=Vn.prototype.emit,Vn.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},Vn.prototype.hasListeners=function(e){return!!this.listeners(e).length};const Iv=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0),Ei=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Qee="arraybuffer";function pie(){}function pL(e,...t){return t.reduce((n,r)=>(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const Xee=Ei.setTimeout,Jee=Ei.clearTimeout;function Rv(e,t){t.useNativeTimers?(e.setTimeoutFn=Xee.bind(Ei),e.clearTimeoutFn=Jee.bind(Ei)):(e.setTimeoutFn=Ei.setTimeout.bind(Ei),e.clearTimeoutFn=Ei.clearTimeout.bind(Ei))}const ete=1.33;function tte(e){return typeof e=="string"?nte(e):Math.ceil((e.byteLength||e.size)*ete)}function nte(e){let t=0,n=0;for(let r=0,i=e.length;r<i;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}function gL(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function rte(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function ite(e){let t={},n=e.split("&");for(let r=0,i=n.length;r<i;r++){let o=n[r].split("=");t[decodeURIComponent(o[0])]=decodeURIComponent(o[1])}return t}class ote extends Error{constructor(t,n,r){super(t),this.description=n,this.context=r,this.type="TransportError"}}class sw extends Vn{constructor(t){super(),this.writable=!1,Rv(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,n,r){return super.emitReserved("error",new ote(t,n,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const n=ow(t,this.socket.binaryType);this.onPacket(n)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,n={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const n=rte(t);return n.length?"?"+n:""}}class ate extends sw{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const n=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let r=0;this._polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};Zee(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,Vee(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=gL()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}}let mL=!1;try{mL=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const ste=mL;function lte(){}class ute extends ate{constructor(t){if(super(t),typeof location<"u"){const n=location.protocol==="https:";let r=location.port;r||(r=n?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||r!==t.port}}doWrite(t,n){const r=this.request({method:"POST",data:t});r.on("success",n),r.on("error",(i,o)=>{this.onError("xhr post error",i,o)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=t}}class ho extends Vn{constructor(t,n,r){super(),this.createRequest=t,Rv(this,r),this._opts=r,this._method=r.method||"GET",this._uri=n,this._data=r.data!==void 0?r.data:null,this._create()}_create(){var t;const n=pL(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let i in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(i)&&r.setRequestHeader(i,this._opts.extraHeaders[i])}}catch{}if(this._method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var i;r.readyState===3&&((i=this._opts.cookieJar)===null||i===void 0||i.parseCookies(r.getResponseHeader("set-cookie"))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status=="number"?r.status:0)},0))},r.send(this._data)}catch(i){this.setTimeoutFn(()=>{this._onError(i)},0);return}typeof document<"u"&&(this._index=ho.requestsCount++,ho.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=lte,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete ho.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}if(ho.requestsCount=0,ho.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",vL);else if(typeof addEventListener=="function"){const e="onpagehide"in Ei?"pagehide":"unload";addEventListener(e,vL,!1)}}function vL(){for(let e in ho.requests)ho.requests.hasOwnProperty(e)&&ho.requests[e].abort()}const cte=function(){const e=yL({xdomain:!1});return e&&e.responseType!==null}();class fte extends ute{constructor(t){super(t);const n=t&&t.forceBase64;this.supportsBinary=cte&&!n}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new ho(yL,this.uri(),t)}}function yL(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||ste))return new XMLHttpRequest}catch{}if(!t)try{return new Ei[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const _L=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class dte extends sw{get name(){return"websocket"}doOpen(){const t=this.uri(),n=this.opts.protocols,r=_L?{}:pL(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,n,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const r=t[n],i=n===t.length-1;rw(r,this.supportsBinary,o=>{try{this.doWrite(r,o)}catch{}i&&Iv(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=gL()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}}const lw=Ei.WebSocket||Ei.MozWebSocket;class hte extends dte{createSocket(t,n,r){return _L?new lw(t,n,r):n?new lw(t,n):new lw(t)}doWrite(t,n){this.ws.send(n)}}class pte extends sw{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const n=Wee(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(n).getReader(),i=Yee();i.readable.pipeTo(t.writable),this._writer=i.writable.getWriter();const o=()=>{r.read().then(({done:u,value:c})=>{u||(this.onPacket(c),o())}).catch(u=>{})};o();const a={type:"open"};this.query.sid&&(a.data=`{"sid":"${this.query.sid}"}`),this._writer.write(a).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const r=t[n],i=n===t.length-1;this._writer.write(r).then(()=>{i&&Iv(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const gte={websocket:hte,webtransport:pte,polling:fte},mte=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,vte=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function uw(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),r=e.indexOf("]");n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let i=mte.exec(e||""),o={},a=14;for(;a--;)o[vte[a]]=i[a]||"";return n!=-1&&r!=-1&&(o.source=t,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=yte(o,o.path),o.queryKey=_te(o,o.query),o}function yte(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&r.splice(0,1),t.slice(-1)=="/"&&r.splice(r.length-1,1),r}function _te(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,o){i&&(n[i]=o)}),n}const cw=typeof addEventListener=="function"&&typeof removeEventListener=="function",Ov=[];cw&&addEventListener("offline",()=>{Ov.forEach(e=>e())},!1);class Qa extends Vn{constructor(t,n){if(super(),this.binaryType=Qee,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(n=t,t=null),t){const r=uw(t);n.hostname=r.host,n.secure=r.protocol==="https"||r.protocol==="wss",n.port=r.port,r.query&&(n.query=r.query)}else n.host&&(n.hostname=uw(n.host).host);Rv(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(r=>{const i=r.prototype.name;this.transports.push(i),this._transportsByName[i]=r}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=ite(this.opts.query)),cw&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Ov.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=hL,n.transport=t,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](r)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&Qa.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",Qa.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=t.data,this._onError(n);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r<this.writeBuffer.length;r++){const i=this.writeBuffer[r].data;if(i&&(n+=tte(i)),r>0&&n>this._maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,Iv(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,n,r){return this._sendPacket("message",t,n,r),this}send(t,n,r){return this._sendPacket("message",t,n,r),this}_sendPacket(t,n,r,i){if(typeof n=="function"&&(i=n,n=void 0),typeof r=="function"&&(i=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const o={type:t,data:n,options:r};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),i&&this.once("flush",i),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():t()}):this.upgrading?r():t()),this}_onError(t){if(Qa.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),cw&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=Ov.indexOf(this._offlineEventListener);r!==-1&&Ov.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this._prevBufferLen=0}}}Qa.protocol=hL;class bte extends Qa{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let n=this.createTransport(t),r=!1;Qa.priorWebsocketSuccess=!1;const i=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",h=>{if(!r)if(h.type==="pong"&&h.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;Qa.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(p(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const m=new Error("probe error");m.transport=n.name,this.emitReserved("upgradeError",m)}}))};function o(){r||(r=!0,p(),n.close(),n=null)}const a=h=>{const m=new Error("probe error: "+h);m.transport=n.name,o(),this.emitReserved("upgradeError",m)};function u(){a("transport closed")}function c(){a("socket closed")}function d(h){n&&h.name!==n.name&&o()}const p=()=>{n.removeListener("open",i),n.removeListener("error",a),n.removeListener("close",u),this.off("close",c),this.off("upgrading",d)};n.once("open",i),n.once("error",a),n.once("close",u),this.once("close",c),this.once("upgrading",d),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const n=[];for(let r=0;r<t.length;r++)~this.transports.indexOf(t[r])&&n.push(t[r]);return n}}let Ste=class extends bte{constructor(t,n={}){const r=typeof t=="object"?t:n;(!r.transports||r.transports&&typeof r.transports[0]=="string")&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(i=>gte[i]).filter(i=>!!i)),super(t,r)}};function wte(e,t="",n){let r=e;n=n||typeof location<"u"&&location,e==null&&(e=n.protocol+"//"+n.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=n.protocol+e:e=n.host+e),/^(https?|wss?):\/\//.test(e)||(typeof n<"u"?e=n.protocol+"//"+e:e="https://"+e),r=uw(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const o=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+o+":"+r.port+t,r.href=r.protocol+"://"+o+(n&&n.port===r.port?"":":"+r.port),r}const xte=typeof ArrayBuffer=="function",Cte=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,bL=Object.prototype.toString,Ete=typeof Blob=="function"||typeof Blob<"u"&&bL.call(Blob)==="[object BlobConstructor]",kte=typeof File=="function"||typeof File<"u"&&bL.call(File)==="[object FileConstructor]";function fw(e){return xte&&(e instanceof ArrayBuffer||Cte(e))||Ete&&e instanceof Blob||kte&&e instanceof File}function Tv(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n<r;n++)if(Tv(e[n]))return!0;return!1}if(fw(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return Tv(e.toJSON(),!0);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&Tv(e[n]))return!0;return!1}function Ate(e){const t=[],n=e.data,r=e;return r.data=dw(n,t),r.attachments=t.length,{packet:r,buffers:t}}function dw(e,t){if(!e)return e;if(fw(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}else if(Array.isArray(e)){const n=new Array(e.length);for(let r=0;r<e.length;r++)n[r]=dw(e[r],t);return n}else if(typeof e=="object"&&!(e instanceof Date)){const n={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=dw(e[r],t));return n}return e}function Ite(e,t){return e.data=hw(e.data,t),delete e.attachments,e}function hw(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=hw(e[n],t);else if(typeof e=="object")for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=hw(e[n],t));return e}const Rte=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],Ote=5;var $t;(function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"})($t||($t={}));class Tte{constructor(t){this.replacer=t}encode(t){return(t.type===$t.EVENT||t.type===$t.ACK)&&Tv(t)?this.encodeAsBinary({type:t.type===$t.EVENT?$t.BINARY_EVENT:$t.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let n=""+t.type;return(t.type===$t.BINARY_EVENT||t.type===$t.BINARY_ACK)&&(n+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(n+=t.nsp+","),t.id!=null&&(n+=t.id),t.data!=null&&(n+=JSON.stringify(t.data,this.replacer)),n}encodeAsBinary(t){const n=Ate(t),r=this.encodeAsString(n.packet),i=n.buffers;return i.unshift(r),i}}function SL(e){return Object.prototype.toString.call(e)==="[object Object]"}class pw extends Vn{constructor(t){super(),this.reviver=t}add(t){let n;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(t);const r=n.type===$t.BINARY_EVENT;r||n.type===$t.BINARY_ACK?(n.type=r?$t.EVENT:$t.ACK,this.reconstructor=new Mte(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(fw(t)||t.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(t),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let n=0;const r={type:Number(t.charAt(0))};if($t[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===$t.BINARY_EVENT||r.type===$t.BINARY_ACK){const o=n+1;for(;t.charAt(++n)!=="-"&&n!=t.length;);const a=t.substring(o,n);if(a!=Number(a)||t.charAt(n)!=="-")throw new Error("Illegal attachments");r.attachments=Number(a)}if(t.charAt(n+1)==="/"){const o=n+1;for(;++n&&!(t.charAt(n)===","||n===t.length););r.nsp=t.substring(o,n)}else r.nsp="/";const i=t.charAt(n+1);if(i!==""&&Number(i)==i){const o=n+1;for(;++n;){const a=t.charAt(n);if(a==null||Number(a)!=a){--n;break}if(n===t.length)break}r.id=Number(t.substring(o,n+1))}if(t.charAt(++n)){const o=this.tryParse(t.substr(n));if(pw.isPayloadValid(r.type,o))r.data=o;else throw new Error("invalid payload")}return r}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,n){switch(t){case $t.CONNECT:return SL(n);case $t.DISCONNECT:return n===void 0;case $t.CONNECT_ERROR:return typeof n=="string"||SL(n);case $t.EVENT:case $t.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&Rte.indexOf(n[0])===-1);case $t.ACK:case $t.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Mte{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const n=Ite(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const Dte=Object.freeze(Object.defineProperty({__proto__:null,Decoder:pw,Encoder:Tte,get PacketType(){return $t},protocol:Ote},Symbol.toStringTag,{value:"Module"}));function Zi(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const Lte=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class wL extends Vn{constructor(t,n,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=n,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[Zi(t,"open",this.onopen.bind(this)),Zi(t,"packet",this.onpacket.bind(this)),Zi(t,"error",this.onerror.bind(this)),Zi(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...n){var r,i,o;if(Lte.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(n.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const a={type:$t.EVENT,data:n};if(a.options={},a.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const p=this.ids++,h=n.pop();this._registerAckCallback(p,h),a.id=p}const u=(i=(r=this.io.engine)===null||r===void 0?void 0:r.transport)===null||i===void 0?void 0:i.writable,c=this.connected&&!(!((o=this.io.engine)===null||o===void 0)&&o._hasPingExpired());return this.flags.volatile&&!u||(c?(this.notifyOutgoingListeners(a),this.packet(a)):this.sendBuffer.push(a)),this.flags={},this}_registerAckCallback(t,n){var r;const i=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(i===void 0){this.acks[t]=n;return}const o=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let u=0;u<this.sendBuffer.length;u++)this.sendBuffer[u].id===t&&this.sendBuffer.splice(u,1);n.call(this,new Error("operation has timed out"))},i),a=(...u)=>{this.io.clearTimeoutFn(o),n.apply(this,u)};a.withError=!0,this.acks[t]=a}emitWithAck(t,...n){return new Promise((r,i)=>{const o=(a,u)=>a?i(a):r(u);o.withError=!0,n.push(o),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((i,...o)=>r!==this._queue[0]?void 0:(i!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(i)):(this._queue.shift(),n&&n(null,...o)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:$t.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(r=>String(r.id)===t)){const r=this.acks[t];delete this.acks[t],r.withError&&r.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case $t.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case $t.EVENT:case $t.BINARY_EVENT:this.onevent(t);break;case $t.ACK:case $t.BINARY_ACK:this.onack(t);break;case $t.DISCONNECT:this.ondisconnect();break;case $t.CONNECT_ERROR:this.destroy();const r=new Error(t.data.message);r.data=t.data.data,this.emitReserved("connect_error",r);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let r=!1;return function(...i){r||(r=!0,n.packet({type:$t.ACK,id:t,data:i}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(delete this.acks[t.id],n.withError&&t.data.unshift(null),n.apply(this,t.data))}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:$t.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let r=0;r<n.length;r++)if(t===n[r])return n.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const n=this._anyOutgoingListeners;for(let r=0;r<n.length;r++)if(t===n[r])return n.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const r of n)r.apply(this,t.data)}}}function Pu(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}Pu.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=(Math.floor(t*10)&1)==0?e-n:e+n}return Math.min(e,this.max)|0},Pu.prototype.reset=function(){this.attempts=0},Pu.prototype.setMin=function(e){this.ms=e},Pu.prototype.setMax=function(e){this.max=e},Pu.prototype.setJitter=function(e){this.jitter=e};class gw extends Vn{constructor(t,n){var r;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,Rv(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new Pu({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const i=n.parser||Dte;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new Ste(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=Zi(n,"open",function(){r.onopen(),t&&t()}),o=u=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",u),t?t(u):this.maybeReconnectOnOpen()},a=Zi(n,"error",o);if(this._timeout!==!1){const u=this._timeout,c=this.setTimeoutFn(()=>{i(),o(new Error("timeout")),n.close()},u);this.opts.autoUnref&&c.unref(),this.subs.push(()=>{this.clearTimeoutFn(c)})}return this.subs.push(i),this.subs.push(a),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Zi(t,"ping",this.onping.bind(this)),Zi(t,"data",this.ondata.bind(this)),Zi(t,"error",this.onerror.bind(this)),Zi(t,"close",this.onclose.bind(this)),Zi(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){Iv(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let r=this.nsps[t];return r?this._autoConnect&&!r.active&&r.connect():(r=new wL(this,t,n),this.nsps[t]=r),r}_destroy(t){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let r=0;r<n.length;r++)this.engine.write(n[r],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,n){var r;this.cleanup(),(r=this.engine)===null||r===void 0||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(i=>{i?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",i)):t.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const id={};function Mv(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=wte(e,t.path||"/socket.io"),r=n.source,i=n.id,o=n.path,a=id[i]&&o in id[i].nsps,u=t.forceNew||t["force new connection"]||t.multiplex===!1||a;let c;return u?c=new gw(r,t):(id[i]||(id[i]=new gw(r,t)),c=id[i]),n.query&&!t.query&&(t.query=n.queryKey),c.socket(n.path,t)}Object.assign(Mv,{Manager:gw,Socket:wL,io:Mv,connect:Mv});const el=class el{constructor(){tr(this,"socket",null);tr(this,"isConnected",!1);tr(this,"eventListeners",new Map)}static getInstance(){return el.instance||(el.instance=new el),el.instance}connect(t){return this.socket?this.socket:(this.socket=Mv(`${oZ}${t}`,{transports:["websocket"]}),this.socket.on("connect",()=>{this.isConnected=!0,this.emitEvent("connect")}),this.socket.on("disconnect",()=>{this.isConnected=!1,this.emitEvent("disconnect")}),this.socket)}disconnect(){this.socket&&(this.socket.disconnect(),this.socket=null,this.isConnected=!1,this.eventListeners.clear())}getSocket(){return this.socket}getIsConnected(){return this.isConnected}on(t,n){var r,i;this.eventListeners.has(t)||this.eventListeners.set(t,[]),(r=this.eventListeners.get(t))==null||r.push(n),(i=this.socket)==null||i.on(t,n)}off(t,n){var i;const r=this.eventListeners.get(t);if(r){const o=r.indexOf(n);o>-1&&r.splice(o,1),(i=this.socket)==null||i.off(t,n)}}emit(t,...n){var r;(r=this.socket)==null||r.emit(t,...n)}emitEvent(t,...n){const r=this.eventListeners.get(t);r&&r.forEach(i=>i(...n))}};tr(el,"instance");let mw=el;const po=mw.getInstance();var $te={MESSAGE:"MESSAGE"},Nte={USER:"USER"};function Dv(e,t){window.dispatchEvent(new StorageEvent("storage",{key:e,newValue:t}))}const xL=(e,t)=>{const n=JSON.stringify(t);window.localStorage.setItem(e,n),Dv(e,n)},Pte=e=>{window.localStorage.removeItem(e),Dv(e,null)},CL=e=>window.localStorage.getItem(e),Bte=e=>(window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)),Fte=()=>{throw Error("useLocalStorage is a client-only hook")};function Ute(e,t){const n=()=>CL(e),r=Y.useSyncExternalStore(Bte,n,Fte),i=Y.useCallback(o=>{try{const a=typeof o=="function"?o(JSON.parse(r)):o;a==null?Pte(e):xL(e,a)}catch(a){console.warn(a)}},[e,r]);return Y.useEffect(()=>{CL(e)===null&&xL(e,t)},[e,t]),[r?JSON.parse(r):t,i]}const EL=(e,t)=>{const n=JSON.stringify(t);window.sessionStorage.setItem(e,n),Dv(e,n)},zte=e=>{window.sessionStorage.removeItem(e),Dv(e,null)},kL=e=>window.sessionStorage.getItem(e),qte=e=>(window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)),jte=()=>{throw Error("useSessionStorage is a client-only hook")};function Hte(e,t){const n=()=>kL(e),r=Y.useSyncExternalStore(qte,n,jte),i=Y.useCallback(o=>{try{const a=typeof o=="function"?o(JSON.parse(r)):o;a==null?zte(e):EL(e,a)}catch(a){console.warn(a)}},[e,r]);return Y.useEffect(()=>{kL(e)===null&&EL(e,t)},[e,t]),[r?JSON.parse(r):t,i]}const Gte=({children:e,nameSpace:t})=>{const[n,r]=Y.useState(""),[i,o]=Y.useState([]),[a,u]=Y.useState(!1),[c,d]=Y.useState(!1),[p,h]=Y.useState([]),[m,v]=Y.useState(!1),[_,x]=Y.useState(!1),[S,b]=Y.useState([]),[C,E]=Ute(dr(sr.USER_INFO),null),[I,O]=Hte(dr(sr.IS_FORM_CLOSED_BY_USER),!1),[T,$]=Dn.useState(null),F=NS("web-socket"),[q,P]=Dn.useState([]),[G,X]=Y.useState(null),[se,V]=Y.useState(!1),[ne,z]=Y.useState(sessionStorage.getItem(dr(sr.LAST_SHOWN_MESSAGE_ID,{botId:t}))),Z=hZ(),ce=cr(),[we,k]=Dn.useState(null),[J,ue]=Y.useState(null);Y.useEffect(()=>{if(F){const $e=po.connect("/api/v1/chat");X($e);const ye=()=>{console.debug("connected to websocket"),V(!0)},ze=()=>{console.debug("disconnected from websocket"),V(!1)},Ge=Xe=>{console.debug("response from websocket",Xe);const nt=Xe.conversationId??crypto.randomUUID().toString();z(nt),Xe.Variants_quantity&&b(B=>[...B,...Xe.Variants_quantity]);const N=[...i,{text:Xe.response,products:Xe.products,conversationId:nt,rating:"neutral",leading_queries:Xe.leading_queries,collections:Xe.collections,variants:Xe.variants,shop:Xe.shop,Variants_quantity:Xe.Variants_quantity,monthlyChatLimitReached:Xe.monthlyChatLimitReached,isBot:!0}];o(N),L(N),h(B=>[...B,[i[i.length-1].text,Xe.response]]),d(!1)},lt=Xe=>{if(Xe.event==="error"){const nt={text:"I am facing some network issues. Can you please check your network and try again?",isBot:!0},N=[...i,nt];o(N),L(N),d(!1)}};return po.on("connect",ye),po.on("disconnect",ze),po.on("response",Ge),po.on("system",lt),()=>{po.off("connect",ye),po.off("disconnect",ze),po.off("response",Ge),po.off("system",lt)}}},[F,i]);const L=$e=>{sessionStorage.setItem(dr(sr.CHAT_HISTORY,{botId:window.DebalesChat.projectId}),JSON.stringify($e))},_e=()=>{const $e=sessionStorage.getItem(dr(sr.CHAT_HISTORY,{botId:window.DebalesChat.projectId}));return $e?JSON.parse($e):[]},Te=Y.useCallback(async()=>{if(t)try{u(!0);const $e=await fetch(`${so}/api/wordpress/UiData?value=${t}`),ye=await $e.json();if(!$e.ok)throw new Error("failed to fetch data"+ye.error);const ze=document.getElementById("debales-ai-assistant");ze&&(ze.style.zIndex=String(ye.zIndex??2031483602)),ue(ye),ye!=null&&ye.shopifyShopDomain&&HW(ye.shopifyShopDomain).then(lt=>{k(lt)}),P(ye.suggestedQuestions);const Ge=_e();if(Ge.length>0)o(Ge);else{const lt={text:ye.initialMessage||"Hi, I am an AI Assistant. How can I help you?",isBot:!0};o([lt])}}catch($e){console.error($e)}finally{u(!1)}},[t]);Y.useEffect(()=>{Te()},[Te]);const de=Y.useMemo(()=>{var $e;return!!(!I&&(($e=J==null?void 0:J.pluginConfig)!=null&&$e.collectedUserInfo)&&(J.pluginConfig.collectedUserInfo.name||J.pluginConfig.collectedUserInfo.email||J.pluginConfig.collectedUserInfo.phone)&&!C)},[J,C,I]),Ke=Y.useCallback(async($e,ye,ze,Ge,lt,Xe)=>{if(!$e||$e.trim()===""||c&&!ze)return;let nt=[...i];Ge?Ge&&i.length<=2?(v(!0),nt=[]):v(!1):(nt.push({text:$e,isBot:!1}),v(!1));const N=cr();d(!0);try{o(nt),L(nt);const B=await fetch(`${so}/api/wordpress/ChatWithBot`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:N,userMessage:$e,nameSpace:t,chat_history:p,leading_queries:lt,answer:ye,products:ze,userInfo:JSON.stringify(C),anonymousUserId:Z,distinctId:Fs.getDistinctId(),timestamp:new Date().toISOString(),timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,followUpQuestion:Xe})});if(!B.ok)throw new Error("Network response was not ok");const H=await B.json(),he=H.conversationId??crypto.randomUUID().toString();z(he),H.Variants_quantity&&b(Se=>[...Se,...H.Variants_quantity]);const me=[...nt,{text:H.response,products:H.products,conversationId:he,rating:"neutral",leading_queries:H.leading_queries,collections:H.collections,variants:H.variants,shop:H.shop,Variants_quantity:H.Variants_quantity,monthlyChatLimitReached:H.monthlyChatLimitReached,isBot:!0}];o(me),L(me),h(Se=>[...Se,[$e,H.response]])}catch(B){console.error(B);const H={text:"I am facing some network issues. Can you please check your network and try again?",isBot:!0},he=[...nt,H];Ge||(o(he),L(he))}finally{d(!1)}},[i,c,p,t,Z,C]),Pe=Y.useCallback($e=>{J&&ue(ye=>ye?{...ye,mobileDisplayMode:$e}:null)},[J]),rt=Y.useCallback(async($e,ye,ze,Ge,lt,Xe)=>{if(!$e||$e.trim()===""||c&&!ze)return;let nt=[...i];if(Ge?Ge&&i.length<=2?(v(!0),nt=[]):v(!1):(nt.push({text:$e,isBot:!1}),v(!1)),d(!0),o(nt),L(nt),G&&se){const N={type:$te.MESSAGE,role:Nte.USER,query:$e,nameSpace:t,leadingQueries:lt,answer:ye,products:ze,userInfo:C,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,timestamp:new Date().toISOString(),sessionId:ce,anonymousUserId:Z,distinctId:Fs.getDistinctId(),followUpQuestion:Xe};po.emit("chat",N)}else Ke($e,ye,ze,Ge,lt,Xe)},[i,c,t,Z,G,se,ce,Ke,C]),st={sessionId:ce,messages:i,isLoading:a,isMessageLoading:c,isKlaviyoMessage:m,showUserInfoModel:_,pendingBulkItems:S,lastedBotmessageId:ne,uiData:J,storeMetaData:we,suggestedQuestions:q,isUserInfoNeeded:de,input:n,pendingQuestion:T,userInfo:C,isFormClosedByUser:I,onSendMessage:F?rt:Ke,setMessages:o,setIsLoading:u,setIsMessageLoading:d,setIsKlaviyoMessage:v,setShowUserInfoModel:x,setPendingBulkItems:b,setLastedBotmessageId:z,fetchUiInfo:Te,changeDisplayModel:Pe,saveConversation:L,loadConversation:_e,setSuggestedQuestions:P,setUserInfo:E,setInput:r,setPendingQuestion:$,setIsFormClosedByUser:O};return D.jsx(iD.Provider,{value:st,children:e})};function Vte(e){const t=tw.getInstance().getAdapter();return D.jsx(Gte,{nameSpace:e.botId,children:D.jsx($W,{apiKey:aZ,options:{capture_pageview:e.botId!=="burgerbaeclothing",capture_pageleave:e.botId!=="burgerbaeclothing",api_host:so+"/ingest",ui_host:"https://us.posthog.com",loaded:n=>{n.register({platform:Wf.detect(),project:e.botId,sessionId:cr()}),n.group("project",e.botId,{platform:Wf.detect()});const r=Pa();r&&r.email&&!n._isIdentified()&&n.identify(r.email,{name:r.name,phone:r.phone,email:r.email,project:e.botId})},debug:!0},children:D.jsx(zee,{adapter:t,children:e.children})})})}function Zte(e){return D.jsx(Pee,{children:D.jsx(Vte,{botId:e.botId,children:D.jsx(Nee,{...e})})})}const Ko=new Map;function Lv(e){const{botId:t}=e;if(Ko.has(t))return console.warn(`Chatbot with botId "${t}" is already initialized. Skipping duplicate initialization.`),Ko.get(t);const n=e.containerId||`debales-chatbot-${t}`;let r=document.getElementById(n);r||(r=document.createElement("div"),r.id=n,document.body.appendChild(r));const i=RC.createRoot(r);i.render(Dn.createElement(Zte,{botId:e.botId}));const o={container:r,unmount:()=>{if(i.unmount(),Ko.delete(t),r&&r.parentNode&&document.body.contains(r))try{r.parentNode.removeChild(r)}catch(a){console.warn("Error removing chatbot container:",a)}}};return Ko.set(t,o),o}typeof window<"u"&&(window.DebalesChatbotBrowser={init:Lv,destroy:e=>{const t=Ko.get(e);return t?(t.unmount(),!0):!1},isInitialized:e=>Ko.has(e),getInitializedBots:()=>Array.from(Ko.keys())});function AL(){document.querySelectorAll('[id="debales-ai-assistant"][data-bot-id]').forEach(n=>{const r=n.getAttribute("data-bot-id");r&&!Ko.has(r)&&Lv({botId:r,containerId:n.id})}),document.querySelectorAll('script[src*="ai-assistant.min.js"][data-bot-id]').forEach(n=>{const r=n.getAttribute("data-bot-id");r&&!Ko.has(r)&&Lv({botId:r})})}return typeof document<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",AL):AL()),Io.initDebalesChatbot=Lv,Object.defineProperty(Io,Symbol.toStringTag,{value:"Module"}),Io}({});
2335
+ => User Action: Klaviyo form closed`}return""},Qe=Ye=>{Ye instanceof CustomEvent&&K(Ye)};return window.addEventListener("klaviyoForms",Qe),()=>{window.removeEventListener("klaviyoForms",Qe)}},[k,t,r]),Y.useEffect(()=>{const K=Te.current;return K?(K.addEventListener("scroll",Jt),()=>K.removeEventListener("scroll",Jt)):()=>{}},[Jt]);const[yo,Jo]=Y.useState(!1),ea=se==="Highest"?"120px":se==="Higher"?"60px":"15px",ad=async()=>{try{const K=await fetch(`${so}/api/wordpress/support`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({chatid:cr()+e,nameSpace:e,userName:Xe.name,userEmail:Xe.email,userMessage:Xe.message,tag:"support"})});if(K.ok)h(Le=>[...Le,{text:"Thanks for reaching out! Our support team has received your request and will get back to you within 24 hours.<br>In the meantime, feel free to continue chatting with me - I'll do my best to help!",isBot:!0}]),console.log("Connected to support with existing user info:",Pa());else{const Le=await K.json();console.error("Failed to connect to support:",Le),h(Qe=>[...Qe,{text:"Sorry, we couldn't connect you to support at the moment.<br>Please try again later.",isBot:!0}])}}catch{h(Le=>[...Le,{text:"Sorry, we couldn't connect you to support at the moment.<br>Please try again later.",isBot:!0}])}},Fu=()=>{const K=Pa();K&&K.name&&K.email&&nt({name:K==null?void 0:K.name,email:K==null?void 0:K.email,message:""}),h(Le=>[...Le,{text:"Please provide your name, email and message to connect with support.",isBot:!0}]),lt(!0)},ta=async K=>{K.preventDefault(),f1({name:Xe.name,email:Xe.email}),lt(!1),h(Le=>Le.slice(0,-1)),await ad()};return Y.useEffect(()=>{if(c.length===1&&c[0].isBot){me(Le=>({...Le,leadingQueries:!0}));const K=setTimeout(()=>{me(Le=>({...Le,leadingQueries:!1}))},2e3);return()=>clearTimeout(K)}},[c]),!t||t.show_bot===!1||o?null:D.jsxs(Oz,{theme:sZ(t),children:[D.jsx("link",{rel:"preconnect",href:"https://fonts.googleapis.com"}),D.jsx("link",{rel:"preconnect",href:"https://fonts.gstatic.com",crossOrigin:"anonymous"}),D.jsx("link",{href:"https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap",rel:"stylesheet"}),D.jsx(Iee,{}),!z&&(xn==null?void 0:xn.length)!==0&&D.jsx(Aee,{className:st?"visible":"",$botId:e,$iconSize:q,$removeLogoBackground:t.removeLogoBackground,topOffset:ea,style:{right:G?"auto":"24px",left:G?"24px":"auto",display:"flex",flexDirection:"column",alignItems:G?"flex-start":"flex-end"},children:he.suggestions?D.jsx(Su,{loading:!0,loadingPhrases:["🎨 Loading","✨ Almost","🚀 Ready"]}):xn.map((K,Le)=>{if(Array.isArray(K)){const Qe=K.map(Ye=>({question:Ye.question,isHighlighted:Ye.isHighlighted??!1})).filter(Ye=>!Ke.has(Ye.question));return D.jsx(eL,{$index:Le,$totalCount:xn.length,children:D.jsx(eQ,{messages:Qe,botId:e,uiData:t,onClick:Ye=>{const Oe=K.find(St=>St.question===Ye);rt(!0,"suggested_question_clicked"),Pe(St=>{const wt=new Set(St);return wt.add(Ye),wt}),window.DebalesChat.track(an.SUGGESTED_QUESTION_CLICKED,{suggested_question:Oe}),!E&&Oe?(Be(!1),et(!0),r(Oe.question,Oe==null?void 0:Oe.answer,Oe==null?void 0:Oe.products,!1,Oe==null?void 0:Oe.leading_queries,Oe==null?void 0:Oe.Follow_up_Question)):(Be(!1),et(!0),C(!0),I(Oe))}})},Le)}else return D.jsx(eL,{$index:Le,$totalCount:xn.length,children:D.jsx(XK,{value:`${K.question}`,index:Le,botId:e,uiData:t,onClose:()=>{Pe(Qe=>{const Ye=new Set(Qe);return Ye.add(K.question),Ye})},onClick:()=>{rt(!0,"suggested_question_clicked"),Pe(Qe=>{const Ye=new Set(Qe);return Ye.add(K.question),Ye}),window.DebalesChat.track(an.SUGGESTED_QUESTION_CLICKED,{suggested_question:K}),E?(Be(!1),et(!0),C(!0),I(K)):(Be(!1),et(!0),r(K.question,K.answer,K.products,void 0,K.leading_queries,K.Follow_up_Question))},isHighlighted:K.isHighlighted??!1})},Le)})}),D.jsxs(lee,{$topOffset:ea,$removeLogoBackground:t.removeLogoBackground,style:{display:z?"none":"inline-flex",right:G?"auto":"24px",left:G?"24px":"auto"},children:[D.jsx(uee,{$showAnimation:t.enableChatButtonBackgroundAnimation??!1,$animationType:"Ping",$animationColor:t.chatButtonBackgroundAnimationColor||"#f48722",$backgroundColor:t.backgroundColor||"#fff",$removeLogoBackground:t.removeLogoBackground,$topOffset:ea,$iconSize:q}),D.jsx(cee,{$backgroundColor:t.removeLogoBackground?"transparent":t.backgroundColor||"#fff",$botId:e,$iconSize:q,$removeLogoBackground:t.removeLogoBackground,topOffset:ea,$showAnimation:t.enableChatButtonBackgroundAnimation,$animationType:"Ping",$animationColor:t.chatButtonBackgroundAnimationColor||"#f48722",id:"debales-chat-button",onClick:()=>{if(window.DebalesChat.track(an.CHAT_BUTTON_CLICKED),rt(!z,"chat_button_clicked"),!z){const K=_();K.length>0?(h(K),Be(!1),et(!0)):(Be(!0),et(!1),me(Le=>({...Le,initialMessage:!0,leadingQueries:!0})),H({text:!0,leadingQueries:!1,collections:!1,products:!1,variants:!1,cartSummary:!1,bulkItems:!1}),setTimeout(()=>{Be(!1),et(!0),me(Qe=>({...Qe,initialMessage:!1}));const Le={text:(t==null?void 0:t.initialMessage)||"Hi, I am an AI chatbot, how can I help you today?",isBot:!0};h([Le]),me(Qe=>({...Qe,leadingQueries:!0})),setTimeout(()=>{H(Qe=>({...Qe,leadingQueries:!0}))},Ht)},Ht))}},"aria-label":"Chat",style:{display:z?"none":"inline-flex",right:G?"auto":"24px",left:G?"24px":"auto"},children:D.jsx(fee,{$botId:e,$removeLogoBackground:t.removeLogoBackground,"aria-hidden":"true",src:t.bot_logo,alt:"Chat Bot Icon"})})]}),z&&p5.createPortal(D.jsx(D.Fragment,{children:D.jsxs(vee,{$backgroundColor:t.backgroundColor||"#fff",$fullScreenOnMobile:t.fullScreenOnMobile,$headerFontColor:t.headerFontColor||"#1C1C1C",$isLeft:G,$topOffset:ea,$mobileDisplayMode:t.mobileDisplayMode,$isVisible:ce,children:[D.jsxs(yee,{$backgroundColor:t.backgroundColor||"#fff",style:{color:t.headerFontColor},children:[D.jsxs("div",{style:{display:"flex",columnGap:"10px",flex:"1 1 0%",alignItems:"center"},children:[D.jsx(dee,{"aria-hidden":"true",src:t.bot_logo,alt:"Chat Bot Icon"}),D.jsxs(hee,{$botNameColor:t.headerFontColor,children:[D.jsxs("div",{style:{fontWeight:"700",wordBreak:"break-word"},children:[t.chatbotName,e==="catch-org-ai"&&D.jsx(gee,{$backgroundColor:t.callToActionBackgroundColor,$fontColor:t.callToActionFontColor,children:"Beta"})]}),D.jsx(pee,{children:D.jsx(RK,{})})]})]}),D.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[D.jsxs(Ree,{children:[D.jsxs(Oee,{onClick:Fu,children:[D.jsx(TK,{color:t.headerFontColor}),D.jsx(Tee,{children:"Support"})]}),D.jsx(tL,{children:"Need more help? I'll connect you with a support agent."})]}),(t.mobileDisplayMode==="half-screen"||t.mobileDisplayMode==="full-screen")&&V&&D.jsx("button",{onClick:()=>{const K=t.mobileDisplayMode==="full-screen"?"half-screen":"full-screen";v(K)},style:{background:"none",border:"none",cursor:"pointer",padding:"0",marginRight:"10px",display:"flex",alignItems:"center"},"aria-label":t.mobileDisplayMode==="full-screen"?"Switch to half screen":"Switch to full screen",children:t.mobileDisplayMode==="full-screen"?D.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:D.jsx("path",{d:"M4.5 15.75V13.5H2.25V12H6V15.75H4.5ZM12 15.75V12H15.75V13.5H13.5V15.75H12ZM2.25 6V4.5H4.5V2.25H6V6H2.25ZM12 6V2.25H13.5V4.5H15.75V6H12Z",fill:"black"})}):D.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:D.jsx("path",{d:"M10 3.75H16.25V10H14.5833V6.595L6.595 14.5833H10V16.25H3.75V10H5.41667V13.405L13.405 5.41667H10V3.75Z",fill:"black"})})}),D.jsx(mee,{onClick:()=>{N?mo(!0):rt(!1,"close_button_clicked")},id:"debales-minimize-button","aria-label":"Minimize",children:D.jsx(GS,{botNameColor:t.headerFontColor})})]})]}),D.jsxs(bee,{$backgroundColor:t.botBackgroundColor||"#fff",$mobileDisplayMode:t.mobileDisplayMode,children:[fe&&D.jsxs(WS,{$fontColor:t.botFontColor||"#000",$botMessageColor:t.botBackgroundColor||"#fff",children:[D.jsx("img",{src:t.bot_logo,alt:"Chat Bot Icon"}),D.jsx(QS,{children:D.jsx(Nu,{$botMessageColor:t.botMessageColor||"#fff",style:{backgroundColor:"transparent",padding:"0px"},children:D.jsx("div",{style:{display:"flex",color:t.botFontColor,alignItems:"center"},children:D.jsx(Su,{loading:fe,loadingPhrases:["🎨 Loading","✨ Almost","🚀 Ready"]})})})})]}),yo&&((Yi=(Ja=t.pluginConfig)==null?void 0:Ja.collectedUserInfo)==null?void 0:Yi.discount)&&D.jsx(QK,{discount:t.pluginConfig.collectedUserInfo.discount,uiData:t,onClose:()=>{Jo(!1),window.DebalesChat.track(an.DISCOUNT_VIEWED,{discount:t.pluginConfig.collectedUserInfo.discount})}}),D.jsx(eee,{uidata:t,product:Xa,showModel:go,setShowModel:oi,onVariantSelect:K=>{T(K.id,1),window.DebalesChat.track(an.ADD_TO_CART_CLICKED,{product:K.title,price:Number(K.price),link:`https://${t.shopifyShopDomain}/variants/${K.id}`,message:a,chatId:cr()+e})}}),Yr&&D.jsx(pQ,{setShowExitModal:mo,handleCloseChatbot:vo,chatId:cr()+e}),D.jsxs(_ee,{id:"debales-conversation-group",$botBackgroundColor:t.botBackgroundColor||"#fff",ref:Te,$mobileDisplayMode:t.mobileDisplayMode,children:[je&&c.map((K,Le)=>{const Qe=K.isBot,Ye=pZ(K.text);return K.hideConfirmation?null:D.jsxs(Y.Fragment,{children:[Qe&&D.jsxs(WS,{$fontColor:t.botFontColor||"#000",$botMessageColor:t.botBackgroundColor||"#fff",children:[D.jsx("img",{src:Qe?t.bot_logo:t.userMessage_logo,alt:"Chat User Icon"}),D.jsxs(QS,{children:[Ye.map(Oe=>D.jsx("div",{children:D.jsx(Nu,{$botMessageColor:Qe?t.botMessageColor||"#fff":t.userMessageColor||"#fff",style:{color:t.botFontColor},children:D.jsx(KE,{components:{a:({href:St,children:wt})=>{const Cn=()=>{St!=null&&St.startsWith("https://shop.catch.org/")&&window.DebalesChat.track(an.SHOPIFY_LINK_CLICKED)};return D.jsx("a",{href:St,target:"_blank",onClick:Cn,children:wt})}},remarkPlugins:[AU,FW],children:Oe})})})),K.collections&&a===K.conversationId&&B.collections&&D.jsx(qK,{message:K,botId:e,uidata:t,onSendMessage:r,loading:d}),K.products&&a===K.conversationId&&B.products&&D.jsx(DQ,{message:K,botId:e,uidata:t,onSendMessage:r,loading:d,storeMetaData:n,platform:P,setShowVariantModel:oi,setSelectedProduct:Qo,setCartVersion:_e}),i&&D.jsx(KS,{children:D.jsx(tD,{onClick:()=>{window._klOnsite&&(window._klOnsite.push(["openForm",ue]),rt(!1,"klaviyo_grab_deal_button"))},children:"🚀 Grab Deal Now!"})}),c.length==1&&Le==0&&!b&&D.jsx(KS,{children:he.leadingQueries?D.jsx("div",{style:{display:"flex"},children:D.jsx(Su,{loading:!0,loadingPhrases:["🎨 Loading","✨ Almost","🚀 Ready"]})}):Wr.map(Oe=>Array.isArray(Oe)?Oe[0]:Oe).map((Oe,St)=>D.jsx(J4,{style:{backgroundColor:t.callToActionBackgroundColor,color:t.callToActionFontColor},onClick:()=>{E?(C(!0),I({question:Oe.question,answer:Oe.answer,products:Oe.products,path:"/",nameSpace:window.DebalesChat.projectId})):(Be(!1),et(!0),r(Oe.question,Oe.answer,Oe.products,void 0,Oe.leading_queries,Oe.Follow_up_Question)),Pe(wt=>{const Cn=new Set(wt);return Cn.add(Oe.question),Cn}),window.DebalesChat.track(an.INITIAL_LEADING_QUERY_SUGGESTED_QUESTION_CLICKED,{question:Oe.question})},disabled:d,$disabled:d,children:Oe.question},St))}),K.leading_queries&&K.leading_queries.length>0&&a===K.conversationId&&B.leadingQueries&&!i&&!b&&D.jsx(KS,{children:he.leadingQueries?D.jsx(Su,{loading:!0,loadingPhrases:["🎨 Loading","✨ Almost","🚀 Ready"]}):K.leading_queries.map((Oe,St)=>D.jsx(J4,{style:{backgroundColor:t.callToActionBackgroundColor,color:t.callToActionFontColor},onClick:()=>{E?(C(!0),I({question:Oe,path:"/",nameSpace:window.DebalesChat.projectId})):r(Oe),window.DebalesChat.track(an.LEADING_QUERY_CLICKED,{query:Oe})},disabled:d,$disabled:d,children:Oe},St))}),O&&O.itemCount>0&&a===K.conversationId&&B.cartSummary&&D.jsxs(Cee,{children:[D.jsx(Nu,{$botMessageColor:t.botMessageColor,style:{width:"max-content",color:t.botFontColor},dangerouslySetInnerHTML:{__html:`<span style="display: flex; align-items: center; justify-content: center;">Total Price: ${GW((O==null?void 0:O.total)??0,(O==null?void 0:O.currency)??"USD")} </span>`}}),D.jsxs(qW,{href:$(t.shopifyShopDomain??""),onClick:od,children:[D.jsx("span",{children:"Checkout"}),D.jsx(AK,{style:{width:"20px",fill:t.callToActionFontColor}})]})]}),ye&&ye.length>0&&a===K.conversationId&&B.bulkItems&&D.jsx(zW,{onClick:()=>Xo(K.conversationId),children:"Add Bulk Items to Cart"}),b&&c.indexOf(K)===c.length-1&&D.jsx(D.Fragment,{children:D.jsx(zJ,{setShowModel:Oe=>{var wt,Cn;const St=typeof Oe=="function"?Oe(b):Oe;C(St),!St&&((Cn=(wt=t.pluginConfig)==null?void 0:wt.collectedUserInfo)!=null&&Cn.discount)&&Jo(!0)},inChat:!0,showFormInstructions:!1})}),Ge&&c.indexOf(K)===c.length-1&&D.jsxs(Mee,{onSubmit:ta,children:[D.jsxs(XS,{children:[D.jsxs(JS,{children:["Name",D.jsx("span",{children:"*"})]}),D.jsx(nL,{type:"text",required:!0,value:Xe.name,onChange:Oe=>nt(St=>({...St,name:Oe.target.value})),placeholder:"John"})]}),D.jsxs(XS,{children:[D.jsxs(JS,{children:["Email",D.jsx("span",{children:"*"})]}),D.jsx(nL,{type:"email",required:!0,value:Xe.email,onChange:Oe=>nt(St=>({...St,email:Oe.target.value})),placeholder:"olivia@untitledui.com"})]}),D.jsxs(XS,{children:[D.jsxs(JS,{children:["Message",D.jsx("span",{children:"*"})]}),D.jsx(Dee,{required:!0,value:Xe.message,onChange:Oe=>nt(St=>({...St,message:Oe.target.value})),placeholder:"I need help with..."})]}),D.jsx($ee,{children:D.jsx(Lee,{type:"submit",children:"Submit"})})]}),Se&&!d&&a===K.conversationId&&D.jsx(Nu,{$botMessageColor:t.botMessageColor,style:{color:t.botFontColor},children:D.jsx(Su,{loading:Se,loadingPhrases:["🎨 Loading","✨ Almost","🚀 Ready"]})})]})]}),!Qe&&D.jsx(Eee,{$fontColor:t.userFontColor||"#000",$botMessageColor:t.botBackgroundColor||"#fff",children:D.jsx(Nu,{$botMessageColor:Qe?t.botMessageColor||"#fff":t.userMessageColor||"#fff",children:D.jsx(KE,{children:K.text})})})]},Le)}),d&&D.jsxs(WS,{$fontColor:t.botFontColor||"#000",$botMessageColor:t.botBackgroundColor||"#fff",children:[D.jsx("img",{src:t.bot_logo,alt:"Chat User Icon"}),D.jsx(QS,{children:D.jsx(Nu,{$botMessageColor:t.botMessageColor||"#fff",style:{backgroundColor:"transparent",padding:"0px"},children:D.jsx("div",{style:{display:"flex",alignItems:"center",gap:"4px",animation:"fadeIn 0.3s ease-in-out"},children:D.jsx(Su,{loading:d})})})})]})]}),D.jsxs("div",{className:"debales-footer-container",style:{width:"calc(100%-24px)",backgroundColor:t.footerBackgroundColor||"#fff",color:t.fontColor||"#000"},children:[e==="catch-org-ai"&&D.jsx(xee,{children:D.jsx("span",{children:'"Catch org AI" can make mistakes.'})}),D.jsx("div",{children:D.jsx(oee,{disabled:d,inputState:!1})}),(t.debales_branding??!0)&&D.jsxs(See,{href:"https://debales.ai/?open=true",target:"_blank",title:"debales-link",style:{color:t.fontColor?t.fontColor:"fff",marginTop:e==="catch-org-ai"?"0":"9px"},children:[D.jsx("p",{children:"Powered by"}),D.jsxs(wee,{children:[D.jsx("img",{src:`${so}/images/debales_logo_d.png`,alt:"Debales logo"}),D.jsx("p",{children:"DEBALES"})]})]})]})]})]})}),X.shadowRoot)]})},rL="debales-ai-assistant",iL="debales-chatbot-container",Pee=Y.forwardRef(({children:e,globalStyles:t="",containerStyles:n={},onReady:r},i)=>{const o=Y.useRef(null),[a,u]=Y.useState(null),c=Y.useRef(null),d=Y.useRef(null),p=Y.useRef({get shadowRoot(){return c.current},get container(){return a},querySelector:h=>{var m;return((m=c.current)==null?void 0:m.querySelector(h))||null},querySelectorAll:h=>{var m;return((m=c.current)==null?void 0:m.querySelectorAll(h))||null}});return Y.useImperativeHandle(i,()=>p.current,[]),Y.useEffect(()=>{const h=document.getElementById(rL);if(h?o.current=h:o.current&&(o.current.id=rL),o.current&&(o.current.style.cssText="position: absolute; top: 0; left: 0; width: 0; height: 0;"),o.current){if(o.current.shadowRoot){c.current=o.current.shadowRoot;const _=c.current.querySelector(`#${iL}`);_&&u(_);return}const m=o.current.attachShadow({mode:"open"});if(c.current=m,t){const _=document.createElement("style");_.textContent=t,m.appendChild(_)}const v=document.createElement("div");v.id=iL,v.style.cssText="position: absolute; top: 0; left: 0; width: 0; height: 0;",m.appendChild(v),u(v),r&&r(m,v)}},[t,r]),Y.useEffect(()=>(a&&!d.current&&(d.current=RC.createRoot(a)),d.current&&a&&d.current.render(D.jsx(Ez,{target:a,children:D.jsx(rD,{value:p.current,children:e})})),()=>{d.current&&d.current.unmount()}),[a,e]),D.jsx("div",{ref:o,style:n})});class ew{isSupported(){return Wf.detect()===this.platform}createSuccessResult(t,n){return{success:!0,data:t,message:n}}createErrorResult(t){return{success:!1,error:t}}}class Bee extends ew{constructor(){super(...arguments);tr(this,"platform",gr.DEFAULT)}async fetchCart(){return console.log("DefaultCartAdapter: fetchCart called"),this.createSuccessResult({items:[],total:0,itemCount:0,currency:"USD",token:"default-token"},"Default cart fetched")}async addToCart(n,r=1,i){return console.log("DefaultCartAdapter: addToCart called",{variantId:n,quantity:r,properties:i}),this.createSuccessResult(void 0,"Item added to cart (mock)")}async removeFromCart(n){return console.log("DefaultCartAdapter: removeFromCart called",{itemId:n}),this.createSuccessResult(void 0,"Item removed from cart (mock)")}async updateQuantity(n){return console.log("DefaultCartAdapter: updateQuantity called",{cartItem:n}),this.createSuccessResult(void 0,"Item quantity updated (mock)")}async clearCart(){return console.log("DefaultCartAdapter: clearCart called"),this.createSuccessResult(void 0,"Cart cleared (mock)")}generateCartUrl(n){const r=n.replace(/^https?:\/\//,"");return console.log("DefaultCartAdapter: generateCartUrl called",{domain:n,sanitizedDomain:r}),`https://${r}/cart`}generateProductUrl(n,r){if(r.handle){const i=new URL(`https://${n}/products/${r.handle}`);return i.searchParams.append("variant",r.product_id),Xs(i.toString())}else return Xs(r.link)}async addCartAttributes(n={}){return console.log("MethodNotImplemented: addCartAttributes called",{attributes:n}),this.createSuccessResult(void 0,"Cart attributes added (mock)")}}class Fee extends ew{constructor(){var n,r;super();tr(this,"platform",gr.SHOPIFY);tr(this,"cartEndpoint");tr(this,"localCartKey","debales_track_cart");this.cartEndpoint=((r=(n=window.Shopify)==null?void 0:n.routes)==null?void 0:r.root)||"/"}normalizeCartData(n){return{items:n.items.map(r=>({id:r.id,variant_id:r.variant_id,quantity:r.quantity,title:r.title,price:r.price,properties:r.properties})),total:n.total_price/100,itemCount:n.item_count,currency:n.currency,token:n.token.split("?")[0]}}generateProductUrl(n,r){const i=Cv(n);if(!i.isValid)return"";if(r.handle){const o=new URL(`/products/${r.handle}`,i.url);return o.searchParams.append("variant",r.product_id),Xs(o.toString())}else return Xs(r.link)}updateTrackCart({cartToken:n,sessionId:r=cr()}){localStorage.setItem(this.localCartKey,JSON.stringify({sessionId:r,cartToken:n}))}async fetchCart(){try{const n=await fetch(`${this.cartEndpoint}cart.js`),r=await n.json();if(!n.ok){const o=r;return this.createErrorResult(o.description||`Failed to fetch cart: ${n.status}`)}const i=r;return this.createSuccessResult(this.normalizeCartData(i),"Cart fetched successfully")}catch(n){return this.createErrorResult(n instanceof Error?`Error fetching cart: ${n.message}`:"Unknown error occurred while fetching cart")}}async addToCart(n,r=1,i){try{const o=await fetch(`${this.cartEndpoint}cart/add.js`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:[{id:n,quantity:r,properties:i}],attributes:{dbls_order_source:"direct_recommendation",dbls_session_id:cr(),dbls_method:"add_to_cart"}})}),a=await o.json();if(!o.ok){const u=a;return this.createErrorResult(u.description||`Failed to add item to cart: ${o.status}`)}return this.fetchCart().then(u=>{u.success&&this.updateTrackCart({cartToken:u==null?void 0:u.data.token})}),this.createSuccessResult(void 0,`Successfully added ${r} item(s) to cart`)}catch(o){return this.createErrorResult(o instanceof Error?`Error adding to cart: ${o.message}`:"Unknown error occurred while adding to cart")}}async removeFromCart(n){return this.updateQuantity({id:n,quantity:0})}async updateQuantity(n){try{const r=await fetch(`${this.cartEndpoint}cart/change.js`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:n.id,quantity:n.quantity})}),i=await r.json();if(!r.ok){const o=i;return this.createErrorResult(o.description||`Failed to update item quantity: ${r.status}`)}return this.fetchCart().then(o=>{o.success&&this.updateTrackCart({cartToken:o==null?void 0:o.data.token})}),this.createSuccessResult(void 0,n.quantity===0?"Item removed from cart":`Quantity updated to ${n.quantity}`)}catch(r){return this.createErrorResult(r instanceof Error?`Error updating quantity: ${r.message}`:"Unknown error occurred while updating quantity")}}async clearCart(){try{const n=await fetch(`${this.cartEndpoint}cart/clear.js`,{method:"POST"});if(!n.ok){const r=await n.json();return this.createErrorResult(r.description||`Failed to clear cart: ${n.status}`)}return this.createSuccessResult(void 0,"Cart cleared successfully")}catch(n){return this.createErrorResult(n instanceof Error?`Error clearing cart: ${n.message}`:"Unknown error occurred while clearing cart")}}async addCartAttributes(n={}){try{const r=await fetch(`${this.cartEndpoint}cart/update.js`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({attributes:{dbls_order_source:"direct_recommendation",dbls_session_id:cr(),...n}})});if(!r.ok){const i=await r.json();return this.createErrorResult(i.description||`Failed to update cart attributes: ${r.status}`)}return this.createSuccessResult(void 0,"Cart attributes updated successfully")}catch(r){return this.createErrorResult(r instanceof Error?`Error updating cart attributes: ${r.message}`:"Unknown error occurred while updating cart attributes")}}generateCartUrl(n){const r=Cv(n);if(!r.isValid)return"";const i=new URL("/cart",r.url);return i.searchParams.append("ref",`debales-ai-${new Date().toISOString()}`),i.searchParams.append("attributes[from]","debales-ai-chatbot"),i.searchParams.append("attributes[through]","add-to-cart"),i.searchParams.append("attributes[dbls_session_id]",cr()),i.searchParams.append("timestamp",Date.now().toString()),Xs(i.toString())}}class Uee extends ew{constructor(){var n,r;super();tr(this,"platform",gr.MAGENTO);tr(this,"checkoutEndpoint");tr(this,"baseUrl");this.checkoutEndpoint=((n=window.checkout)==null?void 0:n.checkoutUrl)||"/",this.baseUrl=((r=window.checkout)==null?void 0:r.baseUrl)||"/"}normalizeCartData(n){return{items:n.items.map(r=>({id:parseInt(r.item_id),variant_id:parseInt(r.product_id),quantity:r.qty,title:r.product_name,price:r.product_price_value,properties:{name:r.product_name}})),total:parseFloat(n.subtotalAmount),itemCount:n.summary_count,currency:"USD",token:n.data_id.toString()}}async fetchCart(){try{const n=await fetch(`${this.baseUrl}customer/section/load/?sections=cart&update_section_id=false`),r=await n.json();if(!n.ok)return this.createErrorResult(`Failed to fetch cart: ${n.status}`);const i=r.cart;return this.createSuccessResult(this.normalizeCartData(i),"Cart fetched successfully")}catch(n){return this.createErrorResult(n instanceof Error?`Error fetching cart: ${n.message}`:"Unknown error occurred while fetching cart")}}async addToCart(n,r=1){var i;try{const o=(i=document.querySelector('input[name="form_key"]'))==null?void 0:i.value;if(!o)return this.createErrorResult("Form key not found");const a=await fetch(`${this.checkoutEndpoint}cart/add`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded","X-Requested-With":"XMLHttpRequest"},body:new URLSearchParams({product:n,qty:r.toString(),form_key:o})});if(!a.ok)return this.createErrorResult(`Failed to add item to cart: ${a.status}`);try{window.require(["Magento_Customer/js/customer-data"],u=>u.reload(["cart"],!0))}catch(u){console.warn("Failed to reload cart data:",u)}return this.createSuccessResult(void 0,`Successfully added ${r} item(s) to cart`)}catch(o){return this.createErrorResult(o instanceof Error?`Error adding to cart: ${o.message}`:"Unknown error occurred while adding to cart")}}async removeFromCart(n){return console.log("MethodNotImplemented: removeFromCart called",{itemId:n}),this.createSuccessResult(void 0,"Item removed from cart (mock)")}async updateQuantity(n){return console.log("MethodNotImplemented: updateQuantity called",{cartItem:n}),this.createSuccessResult(void 0,"Item quantity updated (mock)")}async clearCart(){return console.log("MethodNotImplemented: clearCart called"),this.createSuccessResult(void 0,"Cart cleared (mock)")}generateCartUrl(n){const r=new URL(`https://${n}/checkout/cart?ref=debales-ai-${new Date().toISOString()}&attributes[from]=debales-ai-chatbot&attributes[through]=add-to-cart`);return r.searchParams.append("timestamp",Date.now().toString()),r.toString()}generateProductUrl(n,r){const i=Cv(n);if(!i.isValid)return"";if(r.handle){const o=new URL(`/${r.handle}.html`,i.url);return Xs(o.toString())}else return Xs(r.link)}async addCartAttributes(n={}){return console.log("MethodNotImplemented: addCartAttributes called",{attributes:n}),this.createSuccessResult(void 0,"Cart attributes added (mock)")}}const Js=class Js{constructor(){tr(this,"adapterCache");this.adapterCache=new Map}static getInstance(){return Js.instance||(Js.instance=new Js),Js.instance}getAdapter(t){const n=t||Wf.detect(),r=this.adapterCache.get(n);if(r)return r;let i;switch(n){case gr.SHOPIFY:i=new Fee;break;case gr.MAGENTO:i=new Uee;break;default:console.warn(`No specific adapter found for platform ${n}, using default adapter`),i=new Bee}return this.adapterCache.set(n,i),i}clearCache(){this.adapterCache.clear()}};tr(Js,"instance");let tw=Js;const zee=({adapter:e,children:t,autoFetch:n=!0})=>{const[r,i]=Y.useState(!1),[o,a]=Y.useState(null),[u,c]=Y.useState(null),d=Y.useCallback(async()=>{try{i(!0),a(null);const C=await e.fetchCart();C.success?c(C.data):a(C.error)}catch(C){a(C instanceof Error?C.message:"Failed to fetch cart")}finally{i(!1)}},[e]),p=async(C,E,I)=>{try{a(null);const O=await e.addToCart(C,E,I);return O.success&&await d(),O}catch(O){return{success:!1,error:O instanceof Error?O.message:"Failed to add item to cart"}}},h=async C=>{try{a(null);const E=await e.removeFromCart(C);return E.success&&await d(),E}catch(E){return{success:!1,error:E instanceof Error?E.message:"Failed to remove item from cart"}}},m=async C=>{try{a(null);const E=await e.updateQuantity(C);return E.success&&await d(),E}catch(E){return{success:!1,error:E instanceof Error?E.message:"Failed to update quantity"}}},v=async()=>{try{a(null);const C=await e.clearCart();return C.success&&await d(),C}catch(C){return{success:!1,error:C instanceof Error?C.message:"Failed to clear cart"}}},_=C=>e.generateCartUrl(C),x=(C,E)=>e.generateProductUrl(C,E),S=async C=>e.addCartAttributes(C);Y.useEffect(()=>{n&&d()},[n,d]);const b={isLoading:r,error:o,cart:u,fetchCart:d,addToCart:p,removeFromCart:h,updateQuantity:m,clearCart:v,generateCartUrl:_,generateProductUrl:x,addCartAttributes:S};return D.jsx(cT.Provider,{value:b,children:t})},fo=Object.create(null);fo.open="0",fo.close="1",fo.ping="2",fo.pong="3",fo.message="4",fo.upgrade="5",fo.noop="6";const Ev=Object.create(null);Object.keys(fo).forEach(e=>{Ev[fo[e]]=e});const nw={type:"error",data:"parser error"},oL=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",aL=typeof ArrayBuffer=="function",sL=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,rw=({type:e,data:t},n,r)=>oL&&t instanceof Blob?n?r(t):lL(t,r):aL&&(t instanceof ArrayBuffer||sL(t))?n?r(t):lL(new Blob([t]),r):r(fo[e]+(t||"")),lL=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function uL(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let iw;function qee(e,t){if(oL&&e.data instanceof Blob)return e.data.arrayBuffer().then(uL).then(t);if(aL&&(e.data instanceof ArrayBuffer||sL(e.data)))return t(uL(e.data));rw(e,!1,n=>{iw||(iw=new TextEncoder),t(iw.encode(n))})}const cL="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",rd=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<cL.length;e++)rd[cL.charCodeAt(e)]=e;const jee=e=>{let t=e.length*.75,n=e.length,r,i=0,o,a,u,c;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const d=new ArrayBuffer(t),p=new Uint8Array(d);for(r=0;r<n;r+=4)o=rd[e.charCodeAt(r)],a=rd[e.charCodeAt(r+1)],u=rd[e.charCodeAt(r+2)],c=rd[e.charCodeAt(r+3)],p[i++]=o<<2|a>>4,p[i++]=(a&15)<<4|u>>2,p[i++]=(u&3)<<6|c&63;return d},Hee=typeof ArrayBuffer=="function",ow=(e,t)=>{if(typeof e!="string")return{type:"message",data:fL(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:Gee(e.substring(1),t)}:Ev[n]?e.length>1?{type:Ev[n],data:e.substring(1)}:{type:Ev[n]}:nw},Gee=(e,t)=>{if(Hee){const n=jee(e);return fL(n,t)}else return{base64:!0,data:e}},fL=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},dL="",Vee=(e,t)=>{const n=e.length,r=new Array(n);let i=0;e.forEach((o,a)=>{rw(o,!1,u=>{r[a]=u,++i===n&&t(r.join(dL))})})},Zee=(e,t)=>{const n=e.split(dL),r=[];for(let i=0;i<n.length;i++){const o=ow(n[i],t);if(r.push(o),o.type==="error")break}return r};function Yee(){return new TransformStream({transform(e,t){qee(e,n=>{const r=n.length;let i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);const o=new DataView(i.buffer);o.setUint8(0,126),o.setUint16(1,r)}else{i=new Uint8Array(9);const o=new DataView(i.buffer);o.setUint8(0,127),o.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!="string"&&(i[0]|=128),t.enqueue(i),t.enqueue(n)})}})}let aw;function kv(e){return e.reduce((t,n)=>t+n.length,0)}function Av(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let i=0;i<t;i++)n[i]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),n}function Wee(e,t){aw||(aw=new TextDecoder);const n=[];let r=0,i=-1,o=!1;return new TransformStream({transform(a,u){for(n.push(a);;){if(r===0){if(kv(n)<1)break;const c=Av(n,1);o=(c[0]&128)===128,i=c[0]&127,i<126?r=3:i===126?r=1:r=2}else if(r===1){if(kv(n)<2)break;const c=Av(n,2);i=new DataView(c.buffer,c.byteOffset,c.length).getUint16(0),r=3}else if(r===2){if(kv(n)<8)break;const c=Av(n,8),d=new DataView(c.buffer,c.byteOffset,c.length),p=d.getUint32(0);if(p>Math.pow(2,21)-1){u.enqueue(nw);break}i=p*Math.pow(2,32)+d.getUint32(4),r=3}else{if(kv(n)<i)break;const c=Av(n,i);u.enqueue(ow(o?c:aw.decode(c),t)),r=0}if(i===0||i>e){u.enqueue(nw);break}}}})}const hL=4;function Vn(e){if(e)return Kee(e)}function Kee(e){for(var t in Vn.prototype)e[t]=Vn.prototype[t];return e}Vn.prototype.on=Vn.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},Vn.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},Vn.prototype.off=Vn.prototype.removeListener=Vn.prototype.removeAllListeners=Vn.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var r,i=0;i<n.length;i++)if(r=n[i],r===t||r.fn===t){n.splice(i,1);break}return n.length===0&&delete this._callbacks["$"+e],this},Vn.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,i=n.length;r<i;++r)n[r].apply(this,t)}return this},Vn.prototype.emitReserved=Vn.prototype.emit,Vn.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},Vn.prototype.hasListeners=function(e){return!!this.listeners(e).length};const Iv=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0),Ei=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Qee="arraybuffer";function pie(){}function pL(e,...t){return t.reduce((n,r)=>(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const Xee=Ei.setTimeout,Jee=Ei.clearTimeout;function Rv(e,t){t.useNativeTimers?(e.setTimeoutFn=Xee.bind(Ei),e.clearTimeoutFn=Jee.bind(Ei)):(e.setTimeoutFn=Ei.setTimeout.bind(Ei),e.clearTimeoutFn=Ei.clearTimeout.bind(Ei))}const ete=1.33;function tte(e){return typeof e=="string"?nte(e):Math.ceil((e.byteLength||e.size)*ete)}function nte(e){let t=0,n=0;for(let r=0,i=e.length;r<i;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}function gL(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function rte(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function ite(e){let t={},n=e.split("&");for(let r=0,i=n.length;r<i;r++){let o=n[r].split("=");t[decodeURIComponent(o[0])]=decodeURIComponent(o[1])}return t}class ote extends Error{constructor(t,n,r){super(t),this.description=n,this.context=r,this.type="TransportError"}}class sw extends Vn{constructor(t){super(),this.writable=!1,Rv(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,n,r){return super.emitReserved("error",new ote(t,n,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const n=ow(t,this.socket.binaryType);this.onPacket(n)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,n={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const n=rte(t);return n.length?"?"+n:""}}class ate extends sw{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const n=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let r=0;this._polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};Zee(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,Vee(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=gL()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}}let mL=!1;try{mL=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const ste=mL;function lte(){}class ute extends ate{constructor(t){if(super(t),typeof location<"u"){const n=location.protocol==="https:";let r=location.port;r||(r=n?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||r!==t.port}}doWrite(t,n){const r=this.request({method:"POST",data:t});r.on("success",n),r.on("error",(i,o)=>{this.onError("xhr post error",i,o)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=t}}class ho extends Vn{constructor(t,n,r){super(),this.createRequest=t,Rv(this,r),this._opts=r,this._method=r.method||"GET",this._uri=n,this._data=r.data!==void 0?r.data:null,this._create()}_create(){var t;const n=pL(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let i in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(i)&&r.setRequestHeader(i,this._opts.extraHeaders[i])}}catch{}if(this._method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var i;r.readyState===3&&((i=this._opts.cookieJar)===null||i===void 0||i.parseCookies(r.getResponseHeader("set-cookie"))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status=="number"?r.status:0)},0))},r.send(this._data)}catch(i){this.setTimeoutFn(()=>{this._onError(i)},0);return}typeof document<"u"&&(this._index=ho.requestsCount++,ho.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=lte,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete ho.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}if(ho.requestsCount=0,ho.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",vL);else if(typeof addEventListener=="function"){const e="onpagehide"in Ei?"pagehide":"unload";addEventListener(e,vL,!1)}}function vL(){for(let e in ho.requests)ho.requests.hasOwnProperty(e)&&ho.requests[e].abort()}const cte=function(){const e=yL({xdomain:!1});return e&&e.responseType!==null}();class fte extends ute{constructor(t){super(t);const n=t&&t.forceBase64;this.supportsBinary=cte&&!n}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new ho(yL,this.uri(),t)}}function yL(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||ste))return new XMLHttpRequest}catch{}if(!t)try{return new Ei[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const _L=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class dte extends sw{get name(){return"websocket"}doOpen(){const t=this.uri(),n=this.opts.protocols,r=_L?{}:pL(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,n,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const r=t[n],i=n===t.length-1;rw(r,this.supportsBinary,o=>{try{this.doWrite(r,o)}catch{}i&&Iv(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=gL()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}}const lw=Ei.WebSocket||Ei.MozWebSocket;class hte extends dte{createSocket(t,n,r){return _L?new lw(t,n,r):n?new lw(t,n):new lw(t)}doWrite(t,n){this.ws.send(n)}}class pte extends sw{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const n=Wee(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(n).getReader(),i=Yee();i.readable.pipeTo(t.writable),this._writer=i.writable.getWriter();const o=()=>{r.read().then(({done:u,value:c})=>{u||(this.onPacket(c),o())}).catch(u=>{})};o();const a={type:"open"};this.query.sid&&(a.data=`{"sid":"${this.query.sid}"}`),this._writer.write(a).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const r=t[n],i=n===t.length-1;this._writer.write(r).then(()=>{i&&Iv(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const gte={websocket:hte,webtransport:pte,polling:fte},mte=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,vte=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function uw(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),r=e.indexOf("]");n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let i=mte.exec(e||""),o={},a=14;for(;a--;)o[vte[a]]=i[a]||"";return n!=-1&&r!=-1&&(o.source=t,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=yte(o,o.path),o.queryKey=_te(o,o.query),o}function yte(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&r.splice(0,1),t.slice(-1)=="/"&&r.splice(r.length-1,1),r}function _te(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,o){i&&(n[i]=o)}),n}const cw=typeof addEventListener=="function"&&typeof removeEventListener=="function",Ov=[];cw&&addEventListener("offline",()=>{Ov.forEach(e=>e())},!1);class Qa extends Vn{constructor(t,n){if(super(),this.binaryType=Qee,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(n=t,t=null),t){const r=uw(t);n.hostname=r.host,n.secure=r.protocol==="https"||r.protocol==="wss",n.port=r.port,r.query&&(n.query=r.query)}else n.host&&(n.hostname=uw(n.host).host);Rv(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(r=>{const i=r.prototype.name;this.transports.push(i),this._transportsByName[i]=r}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=ite(this.opts.query)),cw&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Ov.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=hL,n.transport=t,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](r)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&Qa.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",Qa.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=t.data,this._onError(n);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r<this.writeBuffer.length;r++){const i=this.writeBuffer[r].data;if(i&&(n+=tte(i)),r>0&&n>this._maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,Iv(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,n,r){return this._sendPacket("message",t,n,r),this}send(t,n,r){return this._sendPacket("message",t,n,r),this}_sendPacket(t,n,r,i){if(typeof n=="function"&&(i=n,n=void 0),typeof r=="function"&&(i=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const o={type:t,data:n,options:r};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),i&&this.once("flush",i),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():t()}):this.upgrading?r():t()),this}_onError(t){if(Qa.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),cw&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=Ov.indexOf(this._offlineEventListener);r!==-1&&Ov.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this._prevBufferLen=0}}}Qa.protocol=hL;class bte extends Qa{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let n=this.createTransport(t),r=!1;Qa.priorWebsocketSuccess=!1;const i=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",h=>{if(!r)if(h.type==="pong"&&h.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;Qa.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(p(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const m=new Error("probe error");m.transport=n.name,this.emitReserved("upgradeError",m)}}))};function o(){r||(r=!0,p(),n.close(),n=null)}const a=h=>{const m=new Error("probe error: "+h);m.transport=n.name,o(),this.emitReserved("upgradeError",m)};function u(){a("transport closed")}function c(){a("socket closed")}function d(h){n&&h.name!==n.name&&o()}const p=()=>{n.removeListener("open",i),n.removeListener("error",a),n.removeListener("close",u),this.off("close",c),this.off("upgrading",d)};n.once("open",i),n.once("error",a),n.once("close",u),this.once("close",c),this.once("upgrading",d),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const n=[];for(let r=0;r<t.length;r++)~this.transports.indexOf(t[r])&&n.push(t[r]);return n}}let Ste=class extends bte{constructor(t,n={}){const r=typeof t=="object"?t:n;(!r.transports||r.transports&&typeof r.transports[0]=="string")&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(i=>gte[i]).filter(i=>!!i)),super(t,r)}};function wte(e,t="",n){let r=e;n=n||typeof location<"u"&&location,e==null&&(e=n.protocol+"//"+n.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=n.protocol+e:e=n.host+e),/^(https?|wss?):\/\//.test(e)||(typeof n<"u"?e=n.protocol+"//"+e:e="https://"+e),r=uw(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const o=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+o+":"+r.port+t,r.href=r.protocol+"://"+o+(n&&n.port===r.port?"":":"+r.port),r}const xte=typeof ArrayBuffer=="function",Cte=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,bL=Object.prototype.toString,Ete=typeof Blob=="function"||typeof Blob<"u"&&bL.call(Blob)==="[object BlobConstructor]",kte=typeof File=="function"||typeof File<"u"&&bL.call(File)==="[object FileConstructor]";function fw(e){return xte&&(e instanceof ArrayBuffer||Cte(e))||Ete&&e instanceof Blob||kte&&e instanceof File}function Tv(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n<r;n++)if(Tv(e[n]))return!0;return!1}if(fw(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return Tv(e.toJSON(),!0);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&Tv(e[n]))return!0;return!1}function Ate(e){const t=[],n=e.data,r=e;return r.data=dw(n,t),r.attachments=t.length,{packet:r,buffers:t}}function dw(e,t){if(!e)return e;if(fw(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}else if(Array.isArray(e)){const n=new Array(e.length);for(let r=0;r<e.length;r++)n[r]=dw(e[r],t);return n}else if(typeof e=="object"&&!(e instanceof Date)){const n={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=dw(e[r],t));return n}return e}function Ite(e,t){return e.data=hw(e.data,t),delete e.attachments,e}function hw(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=hw(e[n],t);else if(typeof e=="object")for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=hw(e[n],t));return e}const Rte=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],Ote=5;var $t;(function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"})($t||($t={}));class Tte{constructor(t){this.replacer=t}encode(t){return(t.type===$t.EVENT||t.type===$t.ACK)&&Tv(t)?this.encodeAsBinary({type:t.type===$t.EVENT?$t.BINARY_EVENT:$t.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let n=""+t.type;return(t.type===$t.BINARY_EVENT||t.type===$t.BINARY_ACK)&&(n+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(n+=t.nsp+","),t.id!=null&&(n+=t.id),t.data!=null&&(n+=JSON.stringify(t.data,this.replacer)),n}encodeAsBinary(t){const n=Ate(t),r=this.encodeAsString(n.packet),i=n.buffers;return i.unshift(r),i}}function SL(e){return Object.prototype.toString.call(e)==="[object Object]"}class pw extends Vn{constructor(t){super(),this.reviver=t}add(t){let n;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(t);const r=n.type===$t.BINARY_EVENT;r||n.type===$t.BINARY_ACK?(n.type=r?$t.EVENT:$t.ACK,this.reconstructor=new Mte(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(fw(t)||t.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(t),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let n=0;const r={type:Number(t.charAt(0))};if($t[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===$t.BINARY_EVENT||r.type===$t.BINARY_ACK){const o=n+1;for(;t.charAt(++n)!=="-"&&n!=t.length;);const a=t.substring(o,n);if(a!=Number(a)||t.charAt(n)!=="-")throw new Error("Illegal attachments");r.attachments=Number(a)}if(t.charAt(n+1)==="/"){const o=n+1;for(;++n&&!(t.charAt(n)===","||n===t.length););r.nsp=t.substring(o,n)}else r.nsp="/";const i=t.charAt(n+1);if(i!==""&&Number(i)==i){const o=n+1;for(;++n;){const a=t.charAt(n);if(a==null||Number(a)!=a){--n;break}if(n===t.length)break}r.id=Number(t.substring(o,n+1))}if(t.charAt(++n)){const o=this.tryParse(t.substr(n));if(pw.isPayloadValid(r.type,o))r.data=o;else throw new Error("invalid payload")}return r}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,n){switch(t){case $t.CONNECT:return SL(n);case $t.DISCONNECT:return n===void 0;case $t.CONNECT_ERROR:return typeof n=="string"||SL(n);case $t.EVENT:case $t.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&Rte.indexOf(n[0])===-1);case $t.ACK:case $t.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Mte{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const n=Ite(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const Dte=Object.freeze(Object.defineProperty({__proto__:null,Decoder:pw,Encoder:Tte,get PacketType(){return $t},protocol:Ote},Symbol.toStringTag,{value:"Module"}));function Zi(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const Lte=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class wL extends Vn{constructor(t,n,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=n,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[Zi(t,"open",this.onopen.bind(this)),Zi(t,"packet",this.onpacket.bind(this)),Zi(t,"error",this.onerror.bind(this)),Zi(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...n){var r,i,o;if(Lte.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(n.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const a={type:$t.EVENT,data:n};if(a.options={},a.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const p=this.ids++,h=n.pop();this._registerAckCallback(p,h),a.id=p}const u=(i=(r=this.io.engine)===null||r===void 0?void 0:r.transport)===null||i===void 0?void 0:i.writable,c=this.connected&&!(!((o=this.io.engine)===null||o===void 0)&&o._hasPingExpired());return this.flags.volatile&&!u||(c?(this.notifyOutgoingListeners(a),this.packet(a)):this.sendBuffer.push(a)),this.flags={},this}_registerAckCallback(t,n){var r;const i=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(i===void 0){this.acks[t]=n;return}const o=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let u=0;u<this.sendBuffer.length;u++)this.sendBuffer[u].id===t&&this.sendBuffer.splice(u,1);n.call(this,new Error("operation has timed out"))},i),a=(...u)=>{this.io.clearTimeoutFn(o),n.apply(this,u)};a.withError=!0,this.acks[t]=a}emitWithAck(t,...n){return new Promise((r,i)=>{const o=(a,u)=>a?i(a):r(u);o.withError=!0,n.push(o),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((i,...o)=>r!==this._queue[0]?void 0:(i!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(i)):(this._queue.shift(),n&&n(null,...o)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:$t.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(r=>String(r.id)===t)){const r=this.acks[t];delete this.acks[t],r.withError&&r.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case $t.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case $t.EVENT:case $t.BINARY_EVENT:this.onevent(t);break;case $t.ACK:case $t.BINARY_ACK:this.onack(t);break;case $t.DISCONNECT:this.ondisconnect();break;case $t.CONNECT_ERROR:this.destroy();const r=new Error(t.data.message);r.data=t.data.data,this.emitReserved("connect_error",r);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let r=!1;return function(...i){r||(r=!0,n.packet({type:$t.ACK,id:t,data:i}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(delete this.acks[t.id],n.withError&&t.data.unshift(null),n.apply(this,t.data))}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:$t.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let r=0;r<n.length;r++)if(t===n[r])return n.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const n=this._anyOutgoingListeners;for(let r=0;r<n.length;r++)if(t===n[r])return n.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const r of n)r.apply(this,t.data)}}}function Pu(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}Pu.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=(Math.floor(t*10)&1)==0?e-n:e+n}return Math.min(e,this.max)|0},Pu.prototype.reset=function(){this.attempts=0},Pu.prototype.setMin=function(e){this.ms=e},Pu.prototype.setMax=function(e){this.max=e},Pu.prototype.setJitter=function(e){this.jitter=e};class gw extends Vn{constructor(t,n){var r;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,Rv(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new Pu({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const i=n.parser||Dte;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new Ste(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=Zi(n,"open",function(){r.onopen(),t&&t()}),o=u=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",u),t?t(u):this.maybeReconnectOnOpen()},a=Zi(n,"error",o);if(this._timeout!==!1){const u=this._timeout,c=this.setTimeoutFn(()=>{i(),o(new Error("timeout")),n.close()},u);this.opts.autoUnref&&c.unref(),this.subs.push(()=>{this.clearTimeoutFn(c)})}return this.subs.push(i),this.subs.push(a),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Zi(t,"ping",this.onping.bind(this)),Zi(t,"data",this.ondata.bind(this)),Zi(t,"error",this.onerror.bind(this)),Zi(t,"close",this.onclose.bind(this)),Zi(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){Iv(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let r=this.nsps[t];return r?this._autoConnect&&!r.active&&r.connect():(r=new wL(this,t,n),this.nsps[t]=r),r}_destroy(t){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let r=0;r<n.length;r++)this.engine.write(n[r],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,n){var r;this.cleanup(),(r=this.engine)===null||r===void 0||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(i=>{i?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",i)):t.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const id={};function Mv(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=wte(e,t.path||"/socket.io"),r=n.source,i=n.id,o=n.path,a=id[i]&&o in id[i].nsps,u=t.forceNew||t["force new connection"]||t.multiplex===!1||a;let c;return u?c=new gw(r,t):(id[i]||(id[i]=new gw(r,t)),c=id[i]),n.query&&!t.query&&(t.query=n.queryKey),c.socket(n.path,t)}Object.assign(Mv,{Manager:gw,Socket:wL,io:Mv,connect:Mv});const el=class el{constructor(){tr(this,"socket",null);tr(this,"isConnected",!1);tr(this,"eventListeners",new Map)}static getInstance(){return el.instance||(el.instance=new el),el.instance}connect(t){return this.socket?this.socket:(this.socket=Mv(`${oZ}${t}`,{transports:["websocket"]}),this.socket.on("connect",()=>{this.isConnected=!0,this.emitEvent("connect")}),this.socket.on("disconnect",()=>{this.isConnected=!1,this.emitEvent("disconnect")}),this.socket)}disconnect(){this.socket&&(this.socket.disconnect(),this.socket=null,this.isConnected=!1,this.eventListeners.clear())}getSocket(){return this.socket}getIsConnected(){return this.isConnected}on(t,n){var r,i;this.eventListeners.has(t)||this.eventListeners.set(t,[]),(r=this.eventListeners.get(t))==null||r.push(n),(i=this.socket)==null||i.on(t,n)}off(t,n){var i;const r=this.eventListeners.get(t);if(r){const o=r.indexOf(n);o>-1&&r.splice(o,1),(i=this.socket)==null||i.off(t,n)}}emit(t,...n){var r;(r=this.socket)==null||r.emit(t,...n)}emitEvent(t,...n){const r=this.eventListeners.get(t);r&&r.forEach(i=>i(...n))}};tr(el,"instance");let mw=el;const po=mw.getInstance();var $te={MESSAGE:"MESSAGE"},Nte={USER:"USER"};function Dv(e,t){window.dispatchEvent(new StorageEvent("storage",{key:e,newValue:t}))}const xL=(e,t)=>{const n=JSON.stringify(t);window.localStorage.setItem(e,n),Dv(e,n)},Pte=e=>{window.localStorage.removeItem(e),Dv(e,null)},CL=e=>window.localStorage.getItem(e),Bte=e=>(window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)),Fte=()=>{throw Error("useLocalStorage is a client-only hook")};function Ute(e,t){const n=()=>CL(e),r=Y.useSyncExternalStore(Bte,n,Fte),i=Y.useCallback(o=>{try{const a=typeof o=="function"?o(JSON.parse(r)):o;a==null?Pte(e):xL(e,a)}catch(a){console.warn(a)}},[e,r]);return Y.useEffect(()=>{CL(e)===null&&xL(e,t)},[e,t]),[r?JSON.parse(r):t,i]}const EL=(e,t)=>{const n=JSON.stringify(t);window.sessionStorage.setItem(e,n),Dv(e,n)},zte=e=>{window.sessionStorage.removeItem(e),Dv(e,null)},kL=e=>window.sessionStorage.getItem(e),qte=e=>(window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)),jte=()=>{throw Error("useSessionStorage is a client-only hook")};function Hte(e,t){const n=()=>kL(e),r=Y.useSyncExternalStore(qte,n,jte),i=Y.useCallback(o=>{try{const a=typeof o=="function"?o(JSON.parse(r)):o;a==null?zte(e):EL(e,a)}catch(a){console.warn(a)}},[e,r]);return Y.useEffect(()=>{kL(e)===null&&EL(e,t)},[e,t]),[r?JSON.parse(r):t,i]}const Gte=({children:e,nameSpace:t})=>{const[n,r]=Y.useState(""),[i,o]=Y.useState([]),[a,u]=Y.useState(!1),[c,d]=Y.useState(!1),[p,h]=Y.useState([]),[m,v]=Y.useState(!1),[_,x]=Y.useState(!1),[S,b]=Y.useState([]),[C,E]=Ute(dr(sr.USER_INFO),null),[I,O]=Hte(dr(sr.IS_FORM_CLOSED_BY_USER),!1),[T,$]=Dn.useState(null),F=NS("web-socket"),[q,P]=Dn.useState([]),[G,X]=Y.useState(null),[se,V]=Y.useState(!1),[ne,z]=Y.useState(sessionStorage.getItem(dr(sr.LAST_SHOWN_MESSAGE_ID,{botId:t}))),Z=hZ(),ce=cr(),[we,k]=Dn.useState(null),[J,ue]=Y.useState(null);Y.useEffect(()=>{if(F){const $e=po.connect("/api/v1/chat");X($e);const ye=()=>{console.debug("connected to websocket"),V(!0)},ze=()=>{console.debug("disconnected from websocket"),V(!1)},Ge=Xe=>{console.debug("response from websocket",Xe);const nt=Xe.conversationId??crypto.randomUUID().toString();z(nt),Xe.Variants_quantity&&b(B=>[...B,...Xe.Variants_quantity]);const N=[...i,{text:Xe.response,products:Xe.products,conversationId:nt,rating:"neutral",leading_queries:Xe.leading_queries,collections:Xe.collections,variants:Xe.variants,shop:Xe.shop,Variants_quantity:Xe.Variants_quantity,monthlyChatLimitReached:Xe.monthlyChatLimitReached,isBot:!0}];o(N),L(N),h(B=>[...B,[i[i.length-1].text,Xe.response]]),d(!1)},lt=Xe=>{if(Xe.event==="error"){const nt={text:"I am facing some network issues. Can you please check your network and try again?",isBot:!0},N=[...i,nt];o(N),L(N),d(!1)}};return po.on("connect",ye),po.on("disconnect",ze),po.on("response",Ge),po.on("system",lt),()=>{po.off("connect",ye),po.off("disconnect",ze),po.off("response",Ge),po.off("system",lt)}}},[F,i]);const L=$e=>{sessionStorage.setItem(dr(sr.CHAT_HISTORY,{botId:window.DebalesChat.projectId}),JSON.stringify($e))},_e=()=>{const $e=sessionStorage.getItem(dr(sr.CHAT_HISTORY,{botId:window.DebalesChat.projectId}));return $e?JSON.parse($e):[]},Te=Y.useCallback(async()=>{if(t)try{u(!0);const $e=await fetch(`${so}/api/wordpress/UiData?value=${t}`),ye=await $e.json();if(!$e.ok)throw new Error("failed to fetch data"+ye.error);const ze=document.getElementById("debales-ai-assistant");ze&&(ze.style.zIndex=String(ye.zIndex??2031483602)),ue(ye),ye!=null&&ye.shopifyShopDomain&&HW(ye.shopifyShopDomain).then(lt=>{k(lt)}),P(ye.suggestedQuestions);const Ge=_e();if(Ge.length>0)o(Ge);else{const lt={text:ye.initialMessage||"Hi, I am an AI Assistant. How can I help you?",isBot:!0};o([lt])}}catch($e){console.error($e)}finally{u(!1)}},[t]);Y.useEffect(()=>{Te()},[Te]);const de=Y.useMemo(()=>{var $e;return!!(!I&&(($e=J==null?void 0:J.pluginConfig)!=null&&$e.collectedUserInfo)&&(J.pluginConfig.collectedUserInfo.name||J.pluginConfig.collectedUserInfo.email||J.pluginConfig.collectedUserInfo.phone)&&!C)},[J,C,I]),Ke=Y.useCallback(async($e,ye,ze,Ge,lt,Xe)=>{if(!$e||$e.trim()===""||c&&!ze)return;let nt=[...i];Ge?Ge&&i.length<=2?(v(!0),nt=[]):v(!1):(nt.push({text:$e,isBot:!1}),v(!1));const N=cr();d(!0);try{o(nt),L(nt);const B=await fetch(`${so}/api/wordpress/ChatWithBot`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:N,userMessage:$e,nameSpace:t,chat_history:p,leading_queries:lt,answer:ye,products:ze,userInfo:JSON.stringify(C),anonymousUserId:Z,distinctId:Fs.getDistinctId(),timestamp:new Date().toISOString(),timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,followUpQuestion:Xe})});if(!B.ok)throw new Error("Network response was not ok");const H=await B.json(),he=H.conversationId??crypto.randomUUID().toString();z(he),H.Variants_quantity&&b(Se=>[...Se,...H.Variants_quantity]);const me=[...nt,{text:H.response,products:H.products,conversationId:he,rating:"neutral",leading_queries:H.leading_queries,collections:H.collections,variants:H.variants,shop:H.shop,Variants_quantity:H.Variants_quantity,monthlyChatLimitReached:H.monthlyChatLimitReached,isBot:!0}];o(me),L(me),h(Se=>[...Se,[$e,H.response]])}catch(B){console.error(B);const H={text:"I am facing some network issues. Can you please check your network and try again?",isBot:!0},he=[...nt,H];Ge||(o(he),L(he))}finally{d(!1)}},[i,c,p,t,Z,C]),Pe=Y.useCallback($e=>{J&&ue(ye=>ye?{...ye,mobileDisplayMode:$e}:null)},[J]),rt=Y.useCallback(async($e,ye,ze,Ge,lt,Xe)=>{if(!$e||$e.trim()===""||c&&!ze)return;let nt=[...i];if(Ge?Ge&&i.length<=2?(v(!0),nt=[]):v(!1):(nt.push({text:$e,isBot:!1}),v(!1)),d(!0),o(nt),L(nt),G&&se){const N={type:$te.MESSAGE,role:Nte.USER,query:$e,nameSpace:t,leadingQueries:lt,answer:ye,products:ze,userInfo:C,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,timestamp:new Date().toISOString(),sessionId:ce,anonymousUserId:Z,distinctId:Fs.getDistinctId(),followUpQuestion:Xe};po.emit("chat",N)}else Ke($e,ye,ze,Ge,lt,Xe)},[i,c,t,Z,G,se,ce,Ke,C]),st={sessionId:ce,messages:i,isLoading:a,isMessageLoading:c,isKlaviyoMessage:m,showUserInfoModel:_,pendingBulkItems:S,lastedBotmessageId:ne,uiData:J,storeMetaData:we,suggestedQuestions:q,isUserInfoNeeded:de,input:n,pendingQuestion:T,userInfo:C,isFormClosedByUser:I,onSendMessage:F?rt:Ke,setMessages:o,setIsLoading:u,setIsMessageLoading:d,setIsKlaviyoMessage:v,setShowUserInfoModel:x,setPendingBulkItems:b,setLastedBotmessageId:z,fetchUiInfo:Te,changeDisplayModel:Pe,saveConversation:L,loadConversation:_e,setSuggestedQuestions:P,setUserInfo:E,setInput:r,setPendingQuestion:$,setIsFormClosedByUser:O};return D.jsx(iD.Provider,{value:st,children:e})};function Vte(e){const t=tw.getInstance().getAdapter();return D.jsx(Gte,{nameSpace:e.botId,children:D.jsx($W,{apiKey:aZ,options:{capture_pageview:e.botId!=="burgerbaeclothing",capture_pageleave:e.botId!=="burgerbaeclothing",api_host:so+"/ingest",ui_host:"https://us.posthog.com",loaded:n=>{n.register({platform:Wf.detect(),project:e.botId,sessionId:cr()}),n.group("project",e.botId,{platform:Wf.detect()});const r=Pa();r&&r.email&&!n._isIdentified()&&n.identify(r.email,{name:r.name,phone:r.phone,email:r.email,project:e.botId})},debug:!1},children:D.jsx(zee,{adapter:t,children:e.children})})})}function Zte(e){return D.jsx(Pee,{children:D.jsx(Vte,{botId:e.botId,children:D.jsx(Nee,{...e})})})}const Ko=new Map;function Lv(e){const{botId:t}=e;if(Ko.has(t))return console.warn(`Chatbot with botId "${t}" is already initialized. Skipping duplicate initialization.`),Ko.get(t);const n=e.containerId||`debales-chatbot-${t}`;let r=document.getElementById(n);r||(r=document.createElement("div"),r.id=n,document.body.appendChild(r));const i=RC.createRoot(r);i.render(Dn.createElement(Zte,{botId:e.botId}));const o={container:r,unmount:()=>{if(i.unmount(),Ko.delete(t),r&&r.parentNode&&document.body.contains(r))try{r.parentNode.removeChild(r)}catch(a){console.warn("Error removing chatbot container:",a)}}};return Ko.set(t,o),o}typeof window<"u"&&(window.DebalesChatbotBrowser={init:Lv,destroy:e=>{const t=Ko.get(e);return t?(t.unmount(),!0):!1},isInitialized:e=>Ko.has(e),getInitializedBots:()=>Array.from(Ko.keys())});function AL(){document.querySelectorAll('[id="debales-ai-assistant"][data-bot-id]').forEach(n=>{const r=n.getAttribute("data-bot-id");r&&!Ko.has(r)&&Lv({botId:r,containerId:n.id})}),document.querySelectorAll('script[src*="ai-assistant.min.js"][data-bot-id]').forEach(n=>{const r=n.getAttribute("data-bot-id");r&&!Ko.has(r)&&Lv({botId:r})})}return typeof document<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",AL):AL()),Io.initDebalesChatbot=Lv,Object.defineProperty(Io,Symbol.toStringTag,{value:"Module"}),Io}({});