@debales/ai 1.1.4 → 1.1.5-canary.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -75,7 +75,7 @@ Error generating stack: `+f.message+`
75
75
  `,...o.current()});return/^[\t ]/.test(d)&&(d=Mc(d.charCodeAt(0))+d.slice(1)),d=d?s+" "+d:s,n.options.closeAtx&&(d+=" "+s),c(),u(),d}ok.peek=pF;function ok(e){return e.value||""}function pF(){return"<"}ak.peek=gF;function ak(e,t,n,r){const i=Dy(n),o=i==='"'?"Quote":"Apostrophe",s=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(")"),s(),d}function gF(){return"!"}sk.peek=mF;function sk(e,t,n,r){const i=e.referenceType,o=n.enter("imageReference");let s=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+"]["),s();const p=n.stack;n.stack=[],s=n.enter("reference");const h=n.safe(n.associationId(e),{before:c,after:"]",...u.current()});return s(),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 mF(){return"!"}lk.peek=vF;function lk(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 s=n.unsafe[o],u=n.compilePattern(s);let c;if(s.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 vF(){return"`"}function uk(e,t){const n=oy(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))}ck.peek=yF;function ck(e,t,n,r){const i=Dy(n),o=i==='"'?"Quote":"Apostrophe",s=n.createTracker(r);let u,c;if(uk(e,n)){const p=n.stack;n.stack=[],u=n.enter("autolink");let h=s.move("<");return h+=s.move(n.containerPhrasing(e,{before:h,after:">",...s.current()})),h+=s.move(">"),u(),n.stack=p,h}u=n.enter("link"),c=n.enter("label");let d=s.move("[");return d+=s.move(n.containerPhrasing(e,{before:d,after:"](",...s.current()})),d+=s.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),d+=s.move("<"),d+=s.move(n.safe(e.url,{before:d,after:">",...s.current()})),d+=s.move(">")):(c=n.enter("destinationRaw"),d+=s.move(n.safe(e.url,{before:d,after:e.title?" ":")",...s.current()}))),c(),e.title&&(c=n.enter(`title${o}`),d+=s.move(" "+i),d+=s.move(n.safe(e.title,{before:d,after:i,...s.current()})),d+=s.move(i),c()),d+=s.move(")"),u(),d}function yF(e,t,n){return uk(e,n)?"<":"["}fk.peek=_F;function fk(e,t,n,r){const i=e.referenceType,o=n.enter("linkReference");let s=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+"]["),s();const p=n.stack;n.stack=[],s=n.enter("reference");const h=n.safe(n.associationId(e),{before:c,after:"]",...u.current()});return s(),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 _F(){return"["}function $y(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 bF(e){const t=$y(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 SF(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 dk(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 wF(e,t,n,r){const i=n.enter("list"),o=n.bulletCurrent;let s=e.ordered?SF(n):$y(n);const u=e.ordered?s==="."?")":".":bF(n);let c=t&&n.bulletLastUsed?s===n.bulletLastUsed:!1;if(!e.ordered){const p=e.children?e.children[0]:void 0;if((s==="*"||s==="-")&&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),dk(n)===s&&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&&(s=u),n.bulletCurrent=s;const d=n.containerFlow(e,r);return n.bulletLastUsed=s,n.bulletCurrent=o,i(),d}function xF(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 CF(e,t,n,r){const i=xF(n);let o=n.bulletCurrent||$y(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 s=o.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(s=Math.ceil(s/4)*4);const u=n.createTracker(r);u.move(o+" ".repeat(s-o.length)),u.shift(s);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(s))+h:(v?o:o+" ".repeat(s-o.length))+h}}function EF(e,t,n,r){const i=n.enter("paragraph"),o=n.enter("phrasing"),s=n.containerPhrasing(e,r);return o(),i(),s}const kF=ah(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function AF(e,t,n,r){return(e.children.some(function(s){return kF(s)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function IF(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}hk.peek=RF;function hk(e,t,n,r){const i=IF(n),o=n.enter("strong"),s=n.createTracker(r),u=s.move(i+i);let c=s.move(n.containerPhrasing(e,{after:i,before:u,...s.current()}));const d=c.charCodeAt(0),p=uh(r.before.charCodeAt(r.before.length-1),d,i);p.inside&&(c=Mc(d)+c.slice(1));const h=c.charCodeAt(c.length-1),m=uh(r.after.charCodeAt(0),h,i);m.inside&&(c=c.slice(0,-1)+Mc(h));const v=s.move(i+i);return o(),n.attentionEncodeSurroundingInfo={after:m.outside,before:p.outside},u+c+v}function RF(e,t,n){return n.options.strong||"*"}function OF(e,t,n,r){return n.safe(e.value,r)}function TF(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 MF(e,t,n){const r=(dk(n)+(n.options.ruleSpaces?" ":"")).repeat(TF(n));return n.options.ruleSpaces?r.slice(0,-1):r}const pk={blockquote:tF,break:rk,code:sF,definition:uF,emphasis:ik,hardBreak:rk,heading:hF,html:ok,image:ak,imageReference:sk,inlineCode:lk,link:ck,linkReference:fk,list:wF,listItem:CF,paragraph:EF,root:AF,strong:hk,text:OF,thematicBreak:MF};function DF(){return{enter:{table:$F,tableData:gk,tableHeader:gk,tableRow:NF},exit:{codeText:PF,table:LF,tableData:Ly,tableHeader:Ly,tableRow:Ly}}}function $F(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 LF(e){this.exit(e),this.data.inTable=void 0}function NF(e){this.enter({type:"tableRow",children:[]},e)}function Ly(e){this.exit(e)}function gk(e){this.enter({type:"tableCell",children:[]},e)}function PF(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,BF));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function BF(e,t){return t==="|"?t:e}function FF(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:s,tableCell:c,tableRow:u}};function s(v,_,x,w){return d(p(v,x,w),v.align)}function u(v,_,x,w){const b=h(v,x,w),C=d([b]);return C.slice(0,C.indexOf(`
77
77
  `))}function c(v,_,x,w){const b=x.enter("tableCell"),C=x.enter("phrasing"),E=x.containerPhrasing(v,{...w,before:o,after:o});return C(),b(),E}function d(v,_){return J8(v,{align:_,alignDelimiters:r,padding:n,stringLength:i})}function p(v,_,x){const w=v.children;let b=-1;const C=[],E=_.enter("table");for(;++b<w.length;)C[b]=h(w[b],_,x);return E(),C}function h(v,_,x){const w=v.children;let b=-1;const C=[],E=_.enter("tableRow");for(;++b<w.length;)C[b]=c(w[b],v,_,x);return E(),C}function m(v,_,x){let w=pk.inlineCode(v,_,x);return x.stack.includes("tableCell")&&(w=w.replace(/\|/g,"\\$&")),w}}function UF(){return{exit:{taskListCheckValueChecked:mk,taskListCheckValueUnchecked:mk,paragraph:qF}}}function zF(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:jF}}}function mk(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function qF(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,s;for(;++o<i.length;){const u=i[o];if(u.type==="paragraph"){s=u;break}}s===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 jF(e,t,n,r){const i=e.children[0],o=typeof e.checked=="boolean"&&i&&i.type==="paragraph",s="["+(e.checked?"x":" ")+"] ",u=n.createTracker(r);o&&u.move(s);let c=pk.listItem(e,t,n,{...r,...u.current()});return o&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),c;function d(p){return p+s}}function HF(){return[w8(),j8(),Z8(),DF(),UF()]}function GF(e){return{extensions:[x8(),H8(e),Y8(),FF(e),zF()]}}const VF={tokenize:XF,partial:!0},vk={tokenize:JF,partial:!0},yk={tokenize:eU,partial:!0},_k={tokenize:tU,partial:!0},ZF={tokenize:nU,partial:!0},bk={name:"wwwAutolink",tokenize:KF,previous:wk},Sk={name:"protocolAutolink",tokenize:QF,previous:xk},To={name:"emailAutolink",tokenize:WF,previous:Ck},oo={};function YF(){return{text:oo}}let Es=48;for(;Es<123;)oo[Es]=To,Es++,Es===58?Es=65:Es===91&&(Es=97);oo[43]=To,oo[45]=To,oo[46]=To,oo[95]=To,oo[72]=[To,Sk],oo[104]=[To,Sk],oo[87]=[To,bk],oo[119]=[To,bk];function WF(e,t,n){const r=this;let i,o;return s;function s(h){return!Ny(h)||!Ck.call(r,r.previous)||Py(r.events)?n(h):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),u(h))}function u(h){return Ny(h)?(e.consume(h),u):h===64?(e.consume(h),c):n(h)}function c(h){return h===46?e.check(ZF,p,d)(h):h===45||h===95||_r(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&&Tr(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(h)):n(h)}}function KF(e,t,n){const r=this;return i;function i(s){return s!==87&&s!==119||!wk.call(r,r.previous)||Py(r.events)?n(s):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(VF,e.attempt(vk,e.attempt(yk,o),n),n)(s))}function o(s){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(s)}}function QF(e,t,n){const r=this;let i="",o=!1;return s;function s(h){return(h===72||h===104)&&xk.call(r,r.previous)&&!Py(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(h),e.consume(h),u):n(h)}function u(h){if(Tr(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||Qd(h)||nn(h)||Cs(h)||Xd(h)?n(h):e.attempt(vk,e.attempt(yk,p),n)(h)}function p(h){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(h)}}function XF(e,t,n){let r=0;return i;function i(s){return(s===87||s===119)&&r<3?(r++,e.consume(s),i):s===46&&r===3?(e.consume(s),o):n(s)}function o(s){return s===null?n(s):t(s)}}function JF(e,t,n){let r,i,o;return s;function s(d){return d===46||d===95?e.check(_k,c,u)(d):d===null||nn(d)||Cs(d)||d!==45&&Xd(d)?c(d):(o=!0,e.consume(d),s)}function u(d){return d===95?r=!0:(i=r,r=void 0),e.consume(d),s}function c(d){return i||r||!o?n(d):t(d)}}function eU(e,t){let n=0,r=0;return i;function i(s){return s===40?(n++,e.consume(s),i):s===41&&r<n?o(s):s===33||s===34||s===38||s===39||s===41||s===42||s===44||s===46||s===58||s===59||s===60||s===63||s===93||s===95||s===126?e.check(_k,t,o)(s):s===null||nn(s)||Cs(s)?t(s):(e.consume(s),i)}function o(s){return s===41&&r++,e.consume(s),i}}function tU(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||nn(u)||Cs(u)?t(u):n(u)}function i(u){return u===null||u===40||u===91||nn(u)||Cs(u)?t(u):r(u)}function o(u){return Tr(u)?s(u):n(u)}function s(u){return u===59?(e.consume(u),r):Tr(u)?(e.consume(u),s):n(u)}}function nU(e,t,n){return r;function r(o){return e.consume(o),i}function i(o){return _r(o)?n(o):t(o)}}function wk(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||nn(e)}function xk(e){return!Tr(e)}function Ck(e){return!(e===47||Ny(e))}function Ny(e){return e===43||e===45||e===46||e===95||_r(e)}function Py(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 rU={tokenize:fU,partial:!0};function iU(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:lU,continuation:{tokenize:uU},exit:cU}},text:{91:{name:"gfmFootnoteCall",tokenize:sU},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:oU,resolveTo:aU}}}}function oU(e,t,n){const r=this;let i=r.events.length;const o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s;for(;i--;){const c=r.events[i][1];if(c.type==="labelImage"){s=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(!s||!s._balanced)return n(c);const d=zi(r.sliceSerialize({start:s.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 aU(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)},s={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",s,t],["exit",s,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 sU(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o=0,s;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&&!s||h===null||h===91||nn(h))return n(h);if(h===93){e.exit("chunkString");const m=e.exit("gfmFootnoteCallString");return i.includes(zi(r.sliceSerialize(m)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(h)}return nn(h)||(s=!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 lU(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,s=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(s>999||_===93&&!u||_===null||_===91||nn(_))return n(_);if(_===93){e.exit("chunkString");const x=e.exit("gfmFootnoteDefinitionLabelString");return o=zi(r.sliceSerialize(x)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(_),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),m}return nn(_)||(u=!0),s++,e.consume(_),_===92?h:p}function h(_){return _===91||_===92||_===93?(e.consume(_),s++,p):p(_)}function m(_){return _===58?(e.enter("definitionMarker"),e.consume(_),e.exit("definitionMarker"),i.includes(o)||i.push(o),Lt(e,v,"gfmFootnoteDefinitionWhitespace")):n(_)}function v(_){return t(_)}}function uU(e,t,n){return e.check(kc,t,e.attempt(rU,t,n))}function cU(e){e.exit("gfmFootnoteDefinition")}function fU(e,t,n){const r=this;return Lt(e,i,"gfmFootnoteDefinitionIndent",5);function i(o){const s=r.events[r.events.length-1];return s&&s[1].type==="gfmFootnoteDefinitionIndent"&&s[2].sliceSerialize(s[1],!0).length===4?t(o):n(o)}}function dU(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(s,u){let c=-1;for(;++c<s.length;)if(s[c][0]==="enter"&&s[c][1].type==="strikethroughSequenceTemporary"&&s[c][1]._close){let d=c;for(;d--;)if(s[d][0]==="exit"&&s[d][1].type==="strikethroughSequenceTemporary"&&s[d][1]._open&&s[c][1].end.offset-s[c][1].start.offset===s[d][1].end.offset-s[d][1].start.offset){s[c][1].type="strikethroughSequence",s[d][1].type="strikethroughSequence";const p={type:"strikethrough",start:Object.assign({},s[d][1].start),end:Object.assign({},s[c][1].end)},h={type:"strikethroughText",start:Object.assign({},s[d][1].end),end:Object.assign({},s[c][1].start)},m=[["enter",p,u],["enter",s[d][1],u],["exit",s[d][1],u],["enter",h,u]],v=u.parser.constructs.insideSpan.null;v&&ei(m,m.length,0,Jd(v,s.slice(d+1,c),u)),ei(m,m.length,0,[["exit",h,u],["enter",s[c][1],u],["exit",s[c][1],u],["exit",p,u]]),ei(s,d-1,c-d+3,m),c=d+m.length-2;break}}for(c=-1;++c<s.length;)s[c][1].type==="strikethroughSequenceTemporary"&&(s[c][1].type="data");return s}function o(s,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(_):(s.enter("strikethroughSequenceTemporary"),v(_))}function v(_){const x=xl(d);if(_===126)return h>1?c(_):(s.consume(_),h++,v);if(h<2&&!n)return c(_);const w=s.exit("strikethroughSequenceTemporary"),b=xl(_);return w._open=!b||b===2&&!!x,w._close=!x||x===2&&!!b,u(_)}}}class hU{constructor(){this.map=[]}add(t,n,r){pU(this,t,n,r)}consume(t){if(this.map.sort(function(o,s){return o[0]-s[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 pU(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 gU(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 mU(){return{flow:{null:{name:"table",tokenize:vU,resolveAll:yU}}}}function vU(e,t,n){const r=this;let i=0,o=0,s;return u;function u(N){let G=r.events.length-1;for(;G>-1;){const H=r.events[G][1].type;if(H==="lineEnding"||H==="linePrefix")G--;else break}const Q=G>-1?r.events[G][1].type:null,se=Q==="tableHead"||Q==="tableRow"?T:c;return se===T&&r.parser.lazy[r.now().line]?n(N):se(N)}function c(N){return e.enter("tableHead"),e.enter("tableRow"),d(N)}function d(N){return N===124||(s=!0,o+=1),p(N)}function p(N){return N===null?n(N):ot(N)?o>1?(o=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),v):n(N):Et(N)?Lt(e,p,"whitespace")(N):(o+=1,s&&(s=!1,i+=1),N===124?(e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),s=!0,p):(e.enter("data"),h(N)))}function h(N){return N===null||N===124||nn(N)?(e.exit("data"),p(N)):(e.consume(N),N===92?m:h)}function m(N){return N===92||N===124?(e.consume(N),h):h(N)}function v(N){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(N):(e.enter("tableDelimiterRow"),s=!1,Et(N)?Lt(e,_,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):_(N))}function _(N){return N===45||N===58?w(N):N===124?(s=!0,e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),x):O(N)}function x(N){return Et(N)?Lt(e,w,"whitespace")(N):w(N)}function w(N){return N===58?(o+=1,s=!0,e.enter("tableDelimiterMarker"),e.consume(N),e.exit("tableDelimiterMarker"),b):N===45?(o+=1,b(N)):N===null||ot(N)?k(N):O(N)}function b(N){return N===45?(e.enter("tableDelimiterFiller"),C(N)):O(N)}function C(N){return N===45?(e.consume(N),C):N===58?(s=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(N),e.exit("tableDelimiterMarker"),E):(e.exit("tableDelimiterFiller"),E(N))}function E(N){return Et(N)?Lt(e,k,"whitespace")(N):k(N)}function k(N){return N===124?_(N):N===null||ot(N)?!s||i!==o?O(N):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(N)):O(N)}function O(N){return n(N)}function T(N){return e.enter("tableRow"),L(N)}function L(N){return N===124?(e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),L):N===null||ot(N)?(e.exit("tableRow"),t(N)):Et(N)?Lt(e,L,"whitespace")(N):(e.enter("data"),B(N))}function B(N){return N===null||N===124||nn(N)?(e.exit("data"),L(N)):(e.consume(N),N===92?z:B)}function z(N){return N===92||N===124?(e.consume(N),B):B(N)}}function yU(e,t){let n=-1,r=!0,i=0,o=[0,0,0,0],s=[0,0,0,0],u=!1,c=0,d,p,h;const m=new hU;for(;++n<e.length;){const v=e[n],_=v[1];v[0]==="enter"?_.type==="tableHead"?(u=!1,c!==0&&(Ek(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],s=[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,s[2]===0&&(o[1]!==0&&(s[0]=s[1],h=ch(m,t,o,i,void 0,h),o=[0,0,0,0]),s[2]=n)):_.type==="tableCellDivider"&&(r?r=!1:(o[1]!==0&&(s[0]=s[1],h=ch(m,t,o,i,void 0,h)),o=s,s=[o[1],n,0,0])):_.type==="tableHead"?(u=!0,c=n):_.type==="tableRow"||_.type==="tableDelimiterRow"?(c=n,o[1]!==0?(s[0]=s[1],h=ch(m,t,o,i,n,h)):s[1]!==0&&(h=ch(m,t,s,i,n,h)),i=0):i&&(_.type==="data"||_.type==="tableDelimiterMarker"||_.type==="tableDelimiterFiller")&&(s[3]=n)}for(c!==0&&Ek(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=gU(t.events,n))}return e}function ch(e,t,n,r,i,o){const s=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",u="tableContent";n[0]!==0&&(o.end=Object.assign({},El(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const c=El(t.events,n[1]);if(o={type:s,start:Object.assign({},c),end:Object.assign({},c)},e.add(n[1],0,[["enter",o,t]]),n[2]!==0){const d=El(t.events,n[2]),p=El(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({},El(t.events,i)),e.add(i,0,[["exit",o,t]]),o=void 0),o}function Ek(e,t,n,r,i){const o=[],s=El(t.events,n);i&&(i.end=Object.assign({},s),o.push(["exit",i,t])),r.end=Object.assign({},s),o.push(["exit",r,t]),e.add(n+1,0,o)}function El(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const _U={name:"tasklistCheck",tokenize:SU};function bU(){return{text:{91:_U}}}function SU(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 nn(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),s):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),s):n(c)}function s(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),u):n(c)}function u(c){return ot(c)?t(c):Et(c)?e.check({tokenize:wU},t,n)(c):n(c)}}function wU(e,t,n){return Lt(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function xU(e){return iE([YF(),iU(),dU(e),mU(),bU()])}const CU={};function EU(e){const t=this,n=e||CU,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),o=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),s=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(xU(n)),o.push(HF()),s.push(GF(n))}var tr=function(){return tr=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},tr.apply(this,arguments)};function Dc(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 By,kk;function kU(){return kk||(kk=1,By=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 s=Object.keys(t),u=Object.keys(n);if(s.length!==u.length)return!1;for(var c=Object.prototype.hasOwnProperty.bind(n),d=0;d<s.length;d++){var p=s[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}),By}var AU=kU();const IU=hi(AU);var fn="-ms-",$c="-moz-",Gt="-webkit-",Ak="comm",fh="rule",Fy="decl",RU="@import",Ik="@keyframes",OU="@layer",Rk=Math.abs,Uy=String.fromCharCode,zy=Object.assign;function TU(e,t){return nr(e,0)^45?(((t<<2^nr(e,0))<<2^nr(e,1))<<2^nr(e,2))<<2^nr(e,3):0}function Ok(e){return e.trim()}function Mo(e,t){return(e=t.exec(e))?e[0]:e}function bt(e,t,n){return e.replace(t,n)}function dh(e,t,n){return e.indexOf(t,n)}function nr(e,t){return e.charCodeAt(t)|0}function kl(e,t,n){return e.slice(t,n)}function ao(e){return e.length}function Tk(e){return e.length}function Lc(e,t){return t.push(e),e}function MU(e,t){return e.map(t).join("")}function Mk(e,t){return e.filter(function(n){return!Mo(n,t)})}var hh=1,Al=1,Dk=0,gi=0,Fn=0,Il="";function ph(e,t,n,r,i,o,s,u){return{value:e,root:t,parent:n,type:r,props:i,children:o,line:hh,column:Al,length:s,return:"",siblings:u}}function wa(e,t){return zy(ph("",null,null,"",null,null,0,e.siblings),e,{length:-e.length},t)}function Rl(e){for(;e.root;)e=wa(e.root,{children:[e]});Lc(e,e.siblings)}function DU(){return Fn}function $U(){return Fn=gi>0?nr(Il,--gi):0,Al--,Fn===10&&(Al=1,hh--),Fn}function qi(){return Fn=gi<Dk?nr(Il,gi++):0,Al++,Fn===10&&(Al=1,hh++),Fn}function ks(){return nr(Il,gi)}function gh(){return gi}function mh(e,t){return kl(Il,e,t)}function qy(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 LU(e){return hh=Al=1,Dk=ao(Il=e),gi=0,[]}function NU(e){return Il="",e}function jy(e){return Ok(mh(gi-1,Hy(e===91?e+2:e===40?e+1:e)))}function PU(e){for(;(Fn=ks())&&Fn<33;)qi();return qy(e)>2||qy(Fn)>3?"":" "}function BU(e,t){for(;--t&&qi()&&!(Fn<48||Fn>102||Fn>57&&Fn<65||Fn>70&&Fn<97););return mh(e,gh()+(t<6&&ks()==32&&qi()==32))}function Hy(e){for(;qi();)switch(Fn){case e:return gi;case 34:case 39:e!==34&&e!==39&&Hy(Fn);break;case 40:e===41&&Hy(e);break;case 92:qi();break}return gi}function FU(e,t){for(;qi()&&e+Fn!==57;)if(e+Fn===84&&ks()===47)break;return"/*"+mh(t,gi-1)+"*"+Uy(e===47?e:qi())}function UU(e){for(;!qy(ks());)qi();return mh(e,gi)}function zU(e){return NU(vh("",null,null,null,[""],e=LU(e),0,[0],e))}function vh(e,t,n,r,i,o,s,u,c){for(var d=0,p=0,h=s,m=0,v=0,_=0,x=1,w=1,b=1,C=0,E="",k=i,O=o,T=r,L=E;w;)switch(_=C,C=qi()){case 40:if(_!=108&&nr(L,h-1)==58){dh(L+=bt(jy(C),"&","&\f"),"&\f",Rk(d?u[d-1]:0))!=-1&&(b=-1);break}case 34:case 39:case 91:L+=jy(C);break;case 9:case 10:case 13:case 32:L+=PU(_);break;case 92:L+=BU(gh()-1,7);continue;case 47:switch(ks()){case 42:case 47:Lc(qU(FU(qi(),gh()),t,n,c),c);break;default:L+="/"}break;case 123*x:u[d++]=ao(L)*b;case 125*x:case 59:case 0:switch(C){case 0:case 125:w=0;case 59+p:b==-1&&(L=bt(L,/\f/g,"")),v>0&&ao(L)-h&&Lc(v>32?Lk(L+";",r,n,h-1,c):Lk(bt(L," ","")+";",r,n,h-2,c),c);break;case 59:L+=";";default:if(Lc(T=$k(L,t,n,d,p,i,u,E,k=[],O=[],h,o),o),C===123)if(p===0)vh(L,t,T,T,k,o,h,u,O);else switch(m===99&&nr(L,3)===110?100:m){case 100:case 108:case 109:case 115:vh(e,T,T,r&&Lc($k(e,T,T,0,0,i,u,E,i,k=[],h,O),O),i,O,h,u,r?k:O);break;default:vh(L,T,T,T,[""],O,0,u,O)}}d=p=v=0,x=b=1,E=L="",h=s;break;case 58:h=1+ao(L),v=_;default:if(x<1){if(C==123)--x;else if(C==125&&x++==0&&$U()==125)continue}switch(L+=Uy(C),C*x){case 38:b=p>0?1:(L+="\f",-1);break;case 44:u[d++]=(ao(L)-1)*b,b=1;break;case 64:ks()===45&&(L+=jy(qi())),m=ks(),p=h=ao(E=L+=UU(gh())),C++;break;case 45:_===45&&ao(L)==2&&(x=0)}}return o}function $k(e,t,n,r,i,o,s,u,c,d,p,h){for(var m=i-1,v=i===0?o:[""],_=Tk(v),x=0,w=0,b=0;x<r;++x)for(var C=0,E=kl(e,m+1,m=Rk(w=s[x])),k=e;C<_;++C)(k=Ok(w>0?v[C]+" "+E:bt(E,/&\f/g,v[C])))&&(c[b++]=k);return ph(e,t,n,i===0?fh:u,c,d,p,h)}function qU(e,t,n,r){return ph(e,t,n,Ak,Uy(DU()),kl(e,2,-2),0,r)}function Lk(e,t,n,r,i){return ph(e,t,n,Fy,kl(e,0,r),kl(e,r+1,-1),r,i)}function Nk(e,t,n){switch(TU(e,t)){case 5103:return Gt+"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 Gt+e+e;case 4789:return $c+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return Gt+e+$c+e+fn+e+e;case 5936:switch(nr(e,t+11)){case 114:return Gt+e+fn+bt(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return Gt+e+fn+bt(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return Gt+e+fn+bt(e,/[svh]\w+-[tblr]{2}/,"lr")+e}case 6828:case 4268:case 2903:return Gt+e+fn+e+e;case 6165:return Gt+e+fn+"flex-"+e+e;case 5187:return Gt+e+bt(e,/(\w+).+(:[^]+)/,Gt+"box-$1$2"+fn+"flex-$1$2")+e;case 5443:return Gt+e+fn+"flex-item-"+bt(e,/flex-|-self/g,"")+(Mo(e,/flex-|baseline/)?"":fn+"grid-row-"+bt(e,/flex-|-self/g,""))+e;case 4675:return Gt+e+fn+"flex-line-pack"+bt(e,/align-content|flex-|-self/g,"")+e;case 5548:return Gt+e+fn+bt(e,"shrink","negative")+e;case 5292:return Gt+e+fn+bt(e,"basis","preferred-size")+e;case 6060:return Gt+"box-"+bt(e,"-grow","")+Gt+e+fn+bt(e,"grow","positive")+e;case 4554:return Gt+bt(e,/([^-])(transform)/g,"$1"+Gt+"$2")+e;case 6187:return bt(bt(bt(e,/(zoom-|grab)/,Gt+"$1"),/(image-set)/,Gt+"$1"),e,"")+e;case 5495:case 3959:return bt(e,/(image-set\([^]*)/,Gt+"$1$`$1");case 4968:return bt(bt(e,/(.+:)(flex-)?(.*)/,Gt+"box-pack:$3"+fn+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Gt+e+e;case 4200:if(!Mo(e,/flex-|baseline/))return fn+"grid-column-align"+kl(e,t)+e;break;case 2592:case 3360:return fn+bt(e,"template-","")+e;case 4384:case 3616:return n&&n.some(function(r,i){return t=i,Mo(r.props,/grid-\w+-end/)})?~dh(e+(n=n[t].value),"span",0)?e:fn+bt(e,"-start","")+e+fn+"grid-row-span:"+(~dh(n,"span",0)?Mo(n,/\d+/):+Mo(n,/\d+/)-+Mo(e,/\d+/))+";":fn+bt(e,"-start","")+e;case 4896:case 4128:return n&&n.some(function(r){return Mo(r.props,/grid-\w+-start/)})?e:fn+bt(bt(e,"-end","-span"),"span ","")+e;case 4095:case 3583:case 4068:case 2532:return bt(e,/(.+)-inline(.+)/,Gt+"$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(ao(e)-1-t>6)switch(nr(e,t+1)){case 109:if(nr(e,t+4)!==45)break;case 102:return bt(e,/(.+:)(.+)-([^]+)/,"$1"+Gt+"$2-$3$1"+$c+(nr(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~dh(e,"stretch",0)?Nk(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,s,u,c,d){return fn+i+":"+o+d+(s?fn+i+"-span:"+(u?c:+c-+o)+d:"")+e});case 4949:if(nr(e,t+6)===121)return bt(e,":",":"+Gt)+e;break;case 6444:switch(nr(e,nr(e,14)===45?18:11)){case 120:return bt(e,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+Gt+(nr(e,14)===45?"inline-":"")+"box$3$1"+Gt+"$2$3$1"+fn+"$2box$3")+e;case 100:return bt(e,":",":"+fn)+e}break;case 5719:case 2647:case 2135:case 3927:case 2391:return bt(e,"scroll-","scroll-snap-")+e}return e}function yh(e,t){for(var n="",r=0;r<e.length;r++)n+=t(e[r],r,e,t)||"";return n}function jU(e,t,n,r){switch(e.type){case OU:if(e.children.length)break;case RU:case Fy:return e.return=e.return||e.value;case Ak:return"";case Ik:return e.return=e.value+"{"+yh(e.children,r)+"}";case fh:if(!ao(e.value=e.props.join(",")))return""}return ao(n=yh(e.children,r))?e.return=e.value+"{"+n+"}":""}function HU(e){var t=Tk(e);return function(n,r,i,o){for(var s="",u=0;u<t;u++)s+=e[u](n,r,i,o)||"";return s}}function GU(e){return function(t){t.root||(t=t.return)&&e(t)}}function VU(e,t,n,r){if(e.length>-1&&!e.return)switch(e.type){case Fy:e.return=Nk(e.value,e.length,n);return;case Ik:return yh([wa(e,{value:bt(e.value,"@","@"+Gt)})],r);case fh:if(e.length)return MU(n=e.props,function(i){switch(Mo(i,r=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":Rl(wa(e,{props:[bt(i,/:(read-\w+)/,":"+$c+"$1")]})),Rl(wa(e,{props:[i]})),zy(e,{props:Mk(n,r)});break;case"::placeholder":Rl(wa(e,{props:[bt(i,/:(plac\w+)/,":"+Gt+"input-$1")]})),Rl(wa(e,{props:[bt(i,/:(plac\w+)/,":"+$c+"$1")]})),Rl(wa(e,{props:[bt(i,/:(plac\w+)/,fn+"input-$1")]})),Rl(wa(e,{props:[i]})),zy(e,{props:Mk(n,r)});break}return""})}}var ZU={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},br={NODE_ENV:"production"},Ol=typeof process<"u"&&br!==void 0&&(br.REACT_APP_SC_ATTR||br.SC_ATTR)||"data-styled",Pk="active",Bk="data-styled-version",_h="6.1.17",Gy=`/*!sc*/
78
- `,bh=typeof window<"u"&&"HTMLElement"in window,YU=!!(typeof SC_DISABLE_SPEEDY=="boolean"?SC_DISABLE_SPEEDY:typeof process<"u"&&br!==void 0&&br.REACT_APP_SC_DISABLE_SPEEDY!==void 0&&br.REACT_APP_SC_DISABLE_SPEEDY!==""?br.REACT_APP_SC_DISABLE_SPEEDY!=="false"&&br.REACT_APP_SC_DISABLE_SPEEDY:typeof process<"u"&&br!==void 0&&br.SC_DISABLE_SPEEDY!==void 0&&br.SC_DISABLE_SPEEDY!==""?br.SC_DISABLE_SPEEDY!=="false"&&br.SC_DISABLE_SPEEDY:br.NODE_ENV!=="production"),WU={},Sh=Object.freeze([]),Tl=Object.freeze({});function Fk(e,t,n){return n===void 0&&(n=Tl),e.theme!==n.theme&&e.theme||t||n.theme}var Uk=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"]),KU=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,QU=/(^-|-$)/g;function zk(e){return e.replace(KU,"-").replace(QU,"")}var XU=/(a)(d)/gi,wh=52,qk=function(e){return String.fromCharCode(e+(e>25?39:97))};function Vy(e){var t,n="";for(t=Math.abs(e);t>wh;t=t/wh|0)n=qk(t%wh)+n;return(qk(t%wh)+n).replace(XU,"$1-$2")}var Zy,jk=5381,Ml=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},Hk=function(e){return Ml(jk,e)};function Gk(e){return Vy(Hk(e)>>>0)}function JU(e){return e.displayName||e.name||"Component"}function Yy(e){return typeof e=="string"&&br.NODE_ENV==="production"}var Vk=typeof Symbol=="function"&&Symbol.for,Zk=Vk?Symbol.for("react.memo"):60115,ez=Vk?Symbol.for("react.forward_ref"):60112,tz={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},nz={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},Yk={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},rz=((Zy={})[ez]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},Zy[Zk]=Yk,Zy);function Wk(e){return("type"in(t=e)&&t.type.$$typeof)===Zk?Yk:"$$typeof"in e?rz[e.$$typeof]:tz;var t}var iz=Object.defineProperty,oz=Object.getOwnPropertyNames,Kk=Object.getOwnPropertySymbols,az=Object.getOwnPropertyDescriptor,sz=Object.getPrototypeOf,Qk=Object.prototype;function Xk(e,t,n){if(typeof t!="string"){if(Qk){var r=sz(t);r&&r!==Qk&&Xk(e,r,n)}var i=oz(t);Kk&&(i=i.concat(Kk(t)));for(var o=Wk(e),s=Wk(t),u=0;u<i.length;++u){var c=i[u];if(!(c in nz||n&&n[c]||s&&c in s||o&&c in o)){var d=az(t,c);try{iz(e,c,d)}catch{}}}}return e}function As(e){return typeof e=="function"}function Wy(e){return typeof e=="object"&&"styledComponentId"in e}function Is(e,t){return e&&t?"".concat(e," ").concat(t):e||t||""}function Ky(e,t){if(e.length===0)return"";for(var n=e[0],r=1;r<e.length;r++)n+=e[r];return n}function Nc(e){return e!==null&&typeof e=="object"&&e.constructor.name===Object.name&&!("props"in e&&e.$$typeof)}function Qy(e,t,n){if(n===void 0&&(n=!1),!n&&!Nc(e)&&!Array.isArray(e))return t;if(Array.isArray(t))for(var r=0;r<t.length;r++)e[r]=Qy(e[r],t[r]);else if(Nc(t))for(var r in t)e[r]=Qy(e[r],t[r]);return e}function Xy(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 lz=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 s=i;s<o;s++)this.groupSizes[s]=0}for(var u=this.indexOfGroup(t+1),c=(s=0,n.length);s<c;s++)this.tag.insertRule(u,n[s])&&(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,s=i;s<o;s++)n+="".concat(this.tag.getRule(s)).concat(Gy);return n},e}(),xh=new Map,Ch=new Map,Eh=1,kh=function(e){if(xh.has(e))return xh.get(e);for(;Ch.has(Eh);)Eh++;var t=Eh++;return xh.set(e,t),Ch.set(t,e),t},uz=function(e,t){Eh=t+1,xh.set(e,t),Ch.set(t,e)},cz="style[".concat(Ol,"][").concat(Bk,'="').concat(_h,'"]'),fz=new RegExp("^".concat(Ol,'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')),dz=function(e,t,n){for(var r,i=n.split(","),o=0,s=i.length;o<s;o++)(r=i[o])&&e.registerName(t,r)},hz=function(e,t){for(var n,r=((n=t.textContent)!==null&&n!==void 0?n:"").split(Gy),i=[],o=0,s=r.length;o<s;o++){var u=r[o].trim();if(u){var c=u.match(fz);if(c){var d=0|parseInt(c[1],10),p=c[2];d!==0&&(uz(p,d),dz(e,p,c[3]),e.getTag().insertRules(d,i)),i.length=0}else i.push(u)}}},Jk=function(e){for(var t=document.querySelectorAll(cz),n=0,r=t.length;n<r;n++){var i=t[n];i&&i.getAttribute(Ol)!==Pk&&(hz(e,i),i.parentNode&&i.parentNode.removeChild(i))}};function pz(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:null}var eA=function(e){var t=document.head,n=e||t,r=document.createElement("style"),i=function(u){var c=Array.from(u.querySelectorAll("style[".concat(Ol,"]")));return c[c.length-1]}(n),o=i!==void 0?i.nextSibling:null;r.setAttribute(Ol,Pk),r.setAttribute(Bk,_h);var s=pz();return s&&r.setAttribute("nonce",s),n.insertBefore(r,o),r},gz=function(){function e(t){this.element=eA(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 s=r[i];if(s.ownerNode===n)return s}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}(),mz=function(){function e(t){this.element=eA(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}(),vz=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}(),tA=bh,yz={isServer:!bh,useCSSOMInjection:!YU},Ah=function(){function e(t,n,r){t===void 0&&(t=Tl),n===void 0&&(n={});var i=this;this.options=tr(tr({},yz),t),this.gs=n,this.names=new Map(r),this.server=!!t.isServer,!this.server&&bh&&tA&&(tA=!1,Jk(this)),Xy(this,function(){return function(o){for(var s=o.getTag(),u=s.length,c="",d=function(h){var m=function(b){return Ch.get(b)}(h);if(m===void 0)return"continue";var v=o.names.get(m),_=s.getGroup(h);if(v===void 0||!v.size||_.length===0)return"continue";var x="".concat(Ol,".g").concat(h,'[id="').concat(m,'"]'),w="";v!==void 0&&v.forEach(function(b){b.length>0&&(w+="".concat(b,","))}),c+="".concat(_).concat(x,'{content:"').concat(w,'"}').concat(Gy)},p=0;p<u;p++)d(p);return c}(i)})}return e.registerId=function(t){return kh(t)},e.prototype.rehydrate=function(){!this.server&&bh&&Jk(this)},e.prototype.reconstructWithOptions=function(t,n){return n===void 0&&(n=!0),new e(tr(tr({},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 vz(i):r?new gz(i):new mz(i)}(this.options),new lz(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(kh(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(kh(t),r)},e.prototype.clearNames=function(t){this.names.has(t)&&this.names.get(t).clear()},e.prototype.clearRules=function(t){this.getTag().clearGroup(kh(t)),this.clearNames(t)},e.prototype.clearTag=function(){this.tag=void 0},e}(),_z=/&/g,bz=/^\s*\/\/.*$/gm;function nA(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=nA(n.children,t)),n})}function rA(e){var t,n,r,i=e===void 0?Tl:e,o=i.options,s=o===void 0?Tl:o,u=i.plugins,c=u===void 0?Sh: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===fh&&m.value.includes("&")&&(m.props[0]=m.props[0].replace(_z,n).replace(r,d))}),s.prefix&&p.push(VU),p.push(jU);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 w=m.replace(bz,""),b=zU(_||v?"".concat(_," ").concat(v," { ").concat(w," }"):w);s.namespace&&(b=nA(b,s.namespace));var C=[];return yh(b,HU(p.concat(GU(function(E){return C.push(E)})))),C};return h.hash=c.length?c.reduce(function(m,v){return v.name||Rs(15),Ml(m,v.name)},jk).toString():"",h}var Sz=new Ah,Jy=rA(),e_=Tn.createContext({shouldForwardProp:void 0,styleSheet:Sz,stylis:Jy});e_.Consumer;var wz=Tn.createContext(void 0);function Ih(){return W.useContext(e_)}function xz(e){var t=W.useState(e.stylisPlugins),n=t[0],r=t[1],i=Ih().styleSheet,o=W.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]),s=W.useMemo(function(){return rA({options:{namespace:e.namespace,prefix:e.enableVendorPrefixes},plugins:n})},[e.enableVendorPrefixes,e.namespace,n]);W.useEffect(function(){IU(n,e.stylisPlugins)||r(e.stylisPlugins)},[e.stylisPlugins]);var u=W.useMemo(function(){return{shouldForwardProp:e.shouldForwardProp,styleSheet:o,stylis:s}},[e.shouldForwardProp,o,s]);return Tn.createElement(e_.Provider,{value:u},Tn.createElement(wz.Provider,{value:s},e.children))}var Cz=function(){function e(t,n){var r=this;this.inject=function(i,o){o===void 0&&(o=Jy);var s=r.name+o.hash;i.hasNameForId(r.id,s)||i.insertRules(r.id,s,o(r.rules,s,"@keyframes"))},this.name=t,this.id="sc-keyframes-".concat(t),this.rules=n,Xy(this,function(){throw Rs(12,String(r.name))})}return e.prototype.getName=function(t){return t===void 0&&(t=Jy),this.name+t.hash},e}(),Ez=function(e){return e>="A"&&e<="Z"};function iA(e){for(var t="",n=0;n<e.length;n++){var r=e[n];if(n===1&&r==="-"&&e[0]==="-")return e;Ez(r)?t+="-"+r.toLowerCase():t+=r}return t.startsWith("ms-")?"-"+t:t}var oA=function(e){return e==null||e===!1||e===""},aA=function(e){var t,n,r=[];for(var i in e){var o=e[i];e.hasOwnProperty(i)&&!oA(o)&&(Array.isArray(o)&&o.isCss||As(o)?r.push("".concat(iA(i),":"),o,";"):Nc(o)?r.push.apply(r,Dc(Dc(["".concat(i," {")],aA(o),!1),["}"],!1)):r.push("".concat(iA(i),": ").concat((t=i,(n=o)==null||typeof n=="boolean"||n===""?"":typeof n!="number"||n===0||t in ZU||t.startsWith("--")?String(n).trim():"".concat(n,"px")),";")))}return r};function xa(e,t,n,r){if(oA(e))return[];if(Wy(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 xa(i,t,n,r)}var o;return e instanceof Cz?n?(e.inject(n,r),[e.getName(r)]):[e]:Nc(e)?aA(e):Array.isArray(e)?Array.prototype.concat.apply(Sh,e.map(function(s){return xa(s,t,n,r)})):[e.toString()]}function sA(e){for(var t=0;t<e.length;t+=1){var n=e[t];if(As(n)&&!Wy(n))return!1}return!0}var kz=Hk(_h),Az=function(){function e(t,n,r){this.rules=t,this.staticRulesId="",this.isStatic=(r===void 0||r.isStatic)&&sA(t),this.componentId=n,this.baseHash=Ml(kz,n),this.baseStyle=r,Ah.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=Ky(xa(this.rules,t,n,r)),s=Vy(Ml(this.baseHash,o)>>>0);if(!n.hasNameForId(this.componentId,s)){var u=r(o,".".concat(s),void 0,this.componentId);n.insertRules(this.componentId,s,u)}i=Is(i,s),this.staticRulesId=s}else{for(var c=Ml(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=Ky(xa(h,t,n,r));c=Ml(c,m+p),d+=m}}if(d){var v=Vy(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}(),Pc=Tn.createContext(void 0);Pc.Consumer;function Iz(e){var t=Tn.useContext(Pc),n=W.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?tr(tr({},i),r):r}(e.theme,t)},[e.theme,t]);return e.children?Tn.createElement(Pc.Provider,{value:n},e.children):null}var t_={};function Rz(e,t,n){var r=Wy(e),i=e,o=!Yy(e),s=t.attrs,u=s===void 0?Sh:s,c=t.componentId,d=c===void 0?function(k,O){var T=typeof k!="string"?"sc":zk(k);t_[T]=(t_[T]||0)+1;var L="".concat(T,"-").concat(Gk(_h+T+t_[T]));return O?"".concat(O,"-").concat(L):L}(t.displayName,t.parentComponentId):c,p=t.displayName,h=p===void 0?function(k){return Yy(k)?"styled.".concat(k):"Styled(".concat(JU(k),")")}(e):p,m=t.displayName&&t.componentId?"".concat(zk(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 w=t.shouldForwardProp;_=function(k,O){return x(k,O)&&w(k,O)}}else _=x}var b=new Az(n,m,r?i.componentStyle:void 0);function C(k,O){return function(T,L,B){var z=T.attrs,N=T.componentStyle,G=T.defaultProps,Q=T.foldedComponentIds,se=T.styledComponentId,H=T.target,J=Tn.useContext(Pc),q=Ih(),V=T.shouldForwardProp||q.shouldForwardProp,fe=Fk(L,J,G)||Tl,be=function(Ne,ie,Fe){for(var we,We=tr(tr({},ie),{className:void 0,theme:Fe}),Qe=0;Qe<Ne.length;Qe+=1){var Pe=As(we=Ne[Qe])?we(We):we;for(var Se in Pe)We[Se]=Se==="className"?Is(We[Se],Pe[Se]):Se==="style"?tr(tr({},We[Se]),Pe[Se]):Pe[Se]}return ie.className&&(We.className=Is(We.className,ie.className)),We}(z,L,fe),A=be.as||H,ne={};for(var ce in be)be[ce]===void 0||ce[0]==="$"||ce==="as"||ce==="theme"&&be.theme===fe||(ce==="forwardedAs"?ne.as=be.forwardedAs:V&&!V(ce,A)||(ne[ce]=be[ce],V||br.NODE_ENV));var $=function(Ne,ie){var Fe=Ih(),we=Ne.generateAndInjectStyles(ie,Fe.styleSheet,Fe.stylis);return we}(N,be),he=Is(Q,se);return $&&(he+=" "+$),be.className&&(he+=" "+be.className),ne[Yy(A)&&!Uk.has(A)?"class":"className"]=he,B&&(ne.ref=B),W.createElement(A,ne)}(E,k,O)}C.displayName=h;var E=Tn.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(k){this._foldedDefaultProps=r?function(O){for(var T=[],L=1;L<arguments.length;L++)T[L-1]=arguments[L];for(var B=0,z=T;B<z.length;B++)Qy(O,z[B],!0);return O}({},i.defaultProps,k):k}}),Xy(E,function(){return".".concat(E.styledComponentId)}),o&&Xk(E,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0}),E}function lA(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 uA=function(e){return Object.assign(e,{isCss:!0})};function Do(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(As(e)||Nc(e))return uA(xa(lA(Sh,Dc([e],t,!0))));var r=e;return t.length===0&&r.length===1&&typeof r[0]=="string"?xa(r):uA(xa(lA(r,t)))}function n_(e,t,n){if(n===void 0&&(n=Tl),!t)throw Rs(1,t);var r=function(i){for(var o=[],s=1;s<arguments.length;s++)o[s-1]=arguments[s];return e(t,n,Do.apply(void 0,Dc([i],o,!1)))};return r.attrs=function(i){return n_(e,t,tr(tr({},n),{attrs:Array.prototype.concat(n.attrs,i).filter(Boolean)}))},r.withConfig=function(i){return n_(e,t,tr(tr({},n),i))},r}var cA=function(e){return n_(Rz,e)},le=cA;Uk.forEach(function(e){le[e]=cA(e)});var Oz=function(){function e(t,n){this.rules=t,this.componentId=n,this.isStatic=sA(t),Ah.registerId(this.componentId+1)}return e.prototype.createStyles=function(t,n,r,i){var o=i(Ky(xa(this.rules,n,r,i)),""),s=this.componentId+t;r.insertRules(s,s,o)},e.prototype.removeStyles=function(t,n){n.clearRules(this.componentId+t)},e.prototype.renderStyles=function(t,n,r,i){t>2&&Ah.registerId(this.componentId+t),this.removeStyles(t,r),this.createStyles(t,n,r,i)},e}();function Tz(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=Do.apply(void 0,Dc([e],t,!1)),i="sc-global-".concat(Gk(JSON.stringify(r))),o=new Oz(r,i),s=function(c){var d=Ih(),p=Tn.useContext(Pc),h=Tn.useRef(d.styleSheet.allocateGSInstance(i)).current;return d.styleSheet.server&&u(h,c,d.styleSheet,p,d.stylis),Tn.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,WU,p,m);else{var v=tr(tr({},d),{theme:Fk(d,h,s.defaultProps)});o.renderStyles(c,v,p,m)}}return Tn.memo(s)}const mi={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"};var Rh={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:"729295",WAYLAND_DISPLAY:"wayland-0",LOGNAME:"anurag",PULSE_SERVER:"unix:/mnt/wslg/PulseServer",WSL_INTEROP:"/run/WSL/376_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:"c2ed422b-203c-46c9-b60f-f866ef8a3d39",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.4",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"},ze;if(typeof window>"u"){var fA={hostname:""};ze={crypto:{randomUUID:function(){throw Error("unsupported")}},navigator:{userAgent:"",onLine:!0},document:{createElement:function(){return{}},location:fA,referrer:""},screen:{width:0,height:0},location:fA,addEventListener:function(){},removeEventListener:function(){}}}else ze=window;function dA(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 hA(e,t,n,r,i,o,s){try{var u=e[o](s),c=u.value}catch(d){n(d);return}u.done?t(c):Promise.resolve(c).then(r,i)}function r_(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(c){hA(o,r,i,s,u,"next",c)}function u(c){hA(o,r,i,s,u,"throw",c)}s(void 0)})}}function Oh(e,t,n){return pA()?Oh=Reflect.construct:Oh=function(i,o,s){var u=[null];u.push.apply(u,o);var c=Function.bind.apply(i,u),d=new c;return s&&Fc(d,s.prototype),d},Oh.apply(null,arguments)}function Mz(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 sr(e,t,n){return t&&Mz(e.prototype,t),e}function Ft(){return Ft=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},Ft.apply(this,arguments)}function i_(e){return i_=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},i_(e)}function Sr(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&&Fc(e,t)}function mt(e,t){return t!=null&&typeof Symbol<"u"&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function Dz(e){return Function.toString.call(e).indexOf("[native code]")!==-1}function Bc(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 Fc(e,t){return Fc=Object.setPrototypeOf||function(r,i){return r.__proto__=i,r},Fc(e,t)}function Ot(e){"@swc/helpers - typeof";return e&&typeof Symbol<"u"&&e.constructor===Symbol?"symbol":typeof e}function $z(e,t){if(e){if(typeof e=="string")return dA(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 dA(e,t)}}function Th(e){var t=typeof Map=="function"?new Map:void 0;return Th=function(r){if(r===null||!Dz(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 Oh(r,arguments,i_(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Fc(i,r)},Th(e)}function pA(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(pA=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=$z(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 Uc(e,t){var n,r,i,o,s={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(;s;)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 s.label++,{value:d[1],done:!1};case 5:s.label++,r=d[1],d=[0];continue;case 7:d=s.ops.pop(),s.trys.pop();continue;default:if(i=s.trys,!(i=i.length>0&&i[i.length-1])&&(d[0]===6||d[0]===2)){s=0;continue}if(d[0]===3&&(!i||d[1]>i[0]&&d[1]<i[3])){s.label=d[1];break}if(d[0]===6&&s.label<i[1]){s.label=i[1],i=d;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(d);break}i[2]&&s.ops.pop(),s.trys.pop();continue}d=t.call(e,s)}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 gA(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 Lz=Object.defineProperty,Nz=function(e,t,n){return t in e?Lz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},Le=function(e,t,n){return Nz(e,(typeof t>"u"?"undefined":Ot(t))!=="symbol"?t+"":t,n)},mA,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},vA=function(e,t,n){return Bz(e,(typeof t>"u"?"undefined":Ot(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||{}),yA={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},_A={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Mh={},Fz=function(){return!!globalThis.Zone};function o_(e){if(Mh[e])return Mh[e];var t=globalThis[e],n=t.prototype,r=e in yA?yA[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 _A?_A[e]:void 0,s=!!(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&&s&&!Fz())return Mh[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?Mh[e]=d:n}catch{return n}}var a_={};function Ca(e,t,n){var r,i=e+"."+String(n);if(a_[i])return a_[i].call(t);var o=o_(e),s=(r=Object.getOwnPropertyDescriptor(o,n))==null?void 0:r.get;return s?(a_[i]=s,s.call(t)):t[n]}var s_={};function bA(e,t,n){var r=e+"."+String(n);if(s_[r])return s_[r].bind(t);var i=o_(e),o=i[n];return typeof o!="function"?t[n]:(s_[r]=o,o.bind(t))}function Uz(e){return Ca("Node",e,"childNodes")}function zz(e){return Ca("Node",e,"parentNode")}function qz(e){return Ca("Node",e,"parentElement")}function jz(e){return Ca("Node",e,"textContent")}function Hz(e,t){return bA("Node",e,"contains")(t)}function Gz(e){return bA("Node",e,"getRootNode")()}function Vz(e){return!e||!("host"in e)?null:Ca("ShadowRoot",e,"host")}function Zz(e){return e.styleSheets}function Yz(e){return!e||!("shadowRoot"in e)?null:Ca("Element",e,"shadowRoot")}function Wz(e,t){return Ca("Element",e,"querySelector")(t)}function Kz(e,t){return Ca("Element",e,"querySelectorAll")(t)}function Qz(){return o_("MutationObserver").constructor}var wr={childNodes:Uz,parentNode:zz,parentElement:qz,textContent:jz,contains:Hz,getRootNode:Gz,host:Vz,styleSheets:Zz,shadowRoot:Yz,querySelector:Wz,querySelectorAll:Kz,mutationObserver:Qz};function SA(e){return e.nodeType===e.ELEMENT_NODE}function zc(e){var t=e&&"host"in e&&"mode"in e&&wr.host(e)||null;return!!(t&&"shadowRoot"in t&&wr.shadowRoot(t)===e)}function qc(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function Xz(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 Jz(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 l_(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 wA(i,n)}).join("");return Xz(r)}catch{return null}}function wA(e,t){if(t7(e)){var n;try{n=l_(e.styleSheet)||Jz(e)}catch{n=e.cssText}return e.styleSheet.href?Dh(n,e.styleSheet.href):n}else{var r=e.cssText;return n7(e)&&e.selectorText.includes(":")&&(r=e7(r)),t?Dh(r,t):r}}function e7(e){var t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function t7(e){return"styleSheet"in e}function n7(e){return"selectorText"in e}var xA=function(){function e(){vA(this,"idNodeMap",new Map),vA(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(s){return i.removeNodeFromMap(s)})},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 s=this.nodeMetaMap.get(o);s&&this.nodeMetaMap.set(i,s)}this.idNodeMap.set(r,i)},t.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},e}();function r7(){return new xA}function u_(e){var t=e.element,n=e.maskInputOptions,r=e.tagName,i=e.type,o=e.value,s=e.maskInputFn,u=o||"",c=i&&Os(i);return(n[r.toLowerCase()]||c&&n[c])&&(s?u=s(u,t):u="*".repeat(u.length)),u}function Os(e){return e.toLowerCase()}var CA="__rrweb_original__";function i7(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,s=CA in o?o[CA]:o,u=new Uint32Array(s.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 c_(e){var t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?Os(t):null}function EA(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 o7(e){var t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var a7=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,s7=/^(?:[a-z+]+:)?\/\//i,l7=/^www\..*/i,u7=/^(data:)([^,]*),(.*)/i;function Dh(e,t){return(e||"").replace(a7,function(n,r,i,o,s,u){var c=i||s||u,d=r||o||"";if(!c)return n;if(s7.test(c)||l7.test(c)||u7.test(c))return"url("+d+c+d+")";if(c[0]==="/")return"url("+d+(o7(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 f_(e){return e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"")}function c7(e,t){var n=Array.from(t.childNodes),r=[];if(n.length>1&&e&&typeof e=="string"){for(var i=f_(e),o=1;o<n.length;o++)if(n[o].textContent&&typeof n[o].textContent=="string")for(var s=f_(n[o].textContent),u=3;u<s.length;u++){var c=s.substring(0,u);if(i.split(c).length===2){for(var d=i.indexOf(c),p=d;p<e.length;p++)if(f_(e.substring(0,p)).length===d){r.push(e.substring(0,p)),e=e.substring(p);break}break}}}return r.push(e),r}function f7(e,t){return c7(e,t).join("/* rr_split */")}var d7=1,h7=new RegExp("[^a-z0-9-_:]"),jc=-2;function kA(){return d7++}function p7(e){if(mt(e,HTMLFormElement))return"form";var t=Os(e.tagName);return h7.test(t)?"div":t}var Dl,AA,g7=/^[^ \t\n\r\u000c]+/,m7=/^[, \t\n\r\u000c]+/;function v7(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(m7),!(n>=t.length);){var o=r(g7);if(o.slice(-1)===",")o=$l(e,o.substring(0,o.length-1)),i.push(o);else{var s="";o=$l(e,o);for(var u=!1;;){var c=t.charAt(n);if(c===""){i.push((o+s).trim());break}else if(u)c===")"&&(u=!1);else if(c===","){n+=1,i.push((o+s).trim());break}else c==="("&&(u=!0);s+=c,n+=1}}}return i.join(", ")}var IA=new WeakMap;function $l(e,t){return!t||t.trim()===""?t:d_(e,t)}function y7(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function d_(e,t){var n=IA.get(e);if(n||(n=e.createElement("a"),IA.set(e,n)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return n.setAttribute("href",t),n.href}function RA(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")?$l(e,r):n==="srcset"?v7(e,r):n==="style"?Dh(r,d_(e)):t==="object"&&n==="data"?$l(e,r):r)}function OA(e,t,n){return(e==="video"||e==="audio")&&t==="autoplay"}function _7(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 $h(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return n?$h(wr.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?$h(wr.parentNode(e),t,n):!1}function TA(e,t,n,r){var i;if(SA(e)){if(i=e,!wr.childNodes(i).length)return!1}else{if(wr.parentElement(e)===null)return!1;i=wr.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($h(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 b7(e,t,n){var r=e.contentWindow;if(r){var i=!1,o;try{o=r.document.readyState}catch{return}if(o!=="complete"){var s=setTimeout(function(){i||(t(),i=!0)},n);e.addEventListener("load",function(){clearTimeout(s),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 S7(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 w7(e,t){var n=t.doc,r=t.mirror,i=t.blockClass,o=t.blockSelector,s=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,w=t.keepIframeSrcFn,b=t.newlyAddedElement,C=b===void 0?!1:b,E=t.cssCaptured,k=E===void 0?!1:E,O=x7(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 E7(e,{doc:n,blockClass:i,blockSelector:o,inlineStylesheet:u,maskInputOptions:d,maskInputFn:h,dataURLOptions:v,inlineImages:_,recordCanvas:x,keepIframeSrcFn:w,newlyAddedElement:C,rootId:O});case e.TEXT_NODE:return C7(e,{doc:n,needsMask:s,maskTextFn:p,rootId:O,cssCaptured:k});case e.CDATA_SECTION_NODE:return{type:Kn.CDATA,textContent:"",rootId:O};case e.COMMENT_NODE:return{type:Kn.Comment,textContent:wr.textContent(e)||"",rootId:O};default:return!1}}function x7(e,t){if(t.hasNode(e)){var n=t.getId(e);return n===1?void 0:n}}function C7(e,t){var n=t.needsMask,r=t.maskTextFn,i=t.rootId,o=t.cssCaptured,s=wr.parentNode(e),u=s&&s.tagName,c="",d=u==="STYLE"?!0:void 0,p=u==="SCRIPT"?!0:void 0;return p?c="SCRIPT_PLACEHOLDER":o||(c=wr.textContent(e),d&&c&&(c=Dh(c,d_(t.doc)))),!d&&!p&&c&&n&&(c=r?r(c,wr.parentElement(e)):c.replace(/[\S]/g,"*")),{type:Kn.Text,textContent:c||"",rootId:i}}function E7(e,t){for(var n=t.doc,r=t.blockClass,i=t.blockSelector,o=t.inlineStylesheet,s=t.maskInputOptions,u=s===void 0?{}:s,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:_,w=t.rootId,b=_7(e,r,i),C=p7(e),E={},k=e.attributes.length,O=0;O<k;O++){var T=e.attributes[O];OA(C,T.name,T.value)||(E[T.name]=RA(n,C,Os(T.name),T.value))}if(C==="link"&&o){var L=Array.from(n.styleSheets).find(function(he){return he.href===e.href}),B=null;L&&(B=l_(L)),B&&(delete E.rel,delete E.href,E._cssText=B)}if(C==="style"&&e.sheet){var z=l_(e.sheet);z&&(e.childNodes.length>1&&(z=f7(z,e)),E._cssText=z)}if(C==="input"||C==="textarea"||C==="select"){var N=e.value,G=e.checked;E.type!=="radio"&&E.type!=="checkbox"&&E.type!=="submit"&&E.type!=="button"&&N?E.value=u_({element:e,type:c_(e),tagName:C,value:N,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")i7(e)||(E.rr_dataURL=e.toDataURL(p.type,p.quality));else if(!("__context"in e)){var Q=e.toDataURL(p.type,p.quality),se=n.createElement("canvas");se.width=e.width,se.height=e.height;var H=se.toDataURL(p.type,p.quality);Q!==H&&(E.rr_dataURL=Q)}}if(C==="img"&&h){Dl||(Dl=n.createElement("canvas"),AA=Dl.getContext("2d"));var J=e,q=J.currentSrc||J.getAttribute("src")||"<unknown-src>",V=J.crossOrigin,fe=function(){J.removeEventListener("load",fe);try{Dl.width=J.naturalWidth,Dl.height=J.naturalHeight,AA.drawImage(J,0,0),E.rr_dataURL=Dl.toDataURL(p.type,p.quality)}catch(he){if(J.crossOrigin!=="anonymous"){J.crossOrigin="anonymous",J.complete&&J.naturalWidth!==0?fe():J.addEventListener("load",fe);return}else console.warn("Cannot inline img src="+q+"! Error: "+he)}J.crossOrigin==="anonymous"&&(V?E.crossOrigin=V:J.removeAttribute("crossorigin"))};J.complete&&J.naturalWidth!==0?fe():J.addEventListener("load",fe)}if(C==="audio"||C==="video"){var be=E;be.rr_mediaState=e.paused?"paused":"played",be.rr_mediaCurrentTime=e.currentTime,be.rr_mediaPlaybackRate=e.playbackRate,be.rr_mediaMuted=e.muted,be.rr_mediaLoop=e.loop,be.rr_mediaVolume=e.volume}if(x||(e.scrollLeft&&(E.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(E.rr_scrollTop=e.scrollTop)),b){var A=e.getBoundingClientRect(),ne=A.width,ce=A.height;E={class:E.class,rr_width:""+ne+"px",rr_height:""+ce+"px"}}C==="iframe"&&!v(E.src)&&(e.contentDocument||(E.rr_src=E.src),delete E.src);var $;try{customElements.get(C)&&($=!0)}catch{}return{type:Kn.Element,tagName:C,attributes:E,childNodes:[],isSVG:y7(e)||void 0,needBlock:b,rootId:w,isCustom:$}}function ln(e){return e==null?"":e.toLowerCase()}function k7(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"&&EA(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(ln(e.attributes.name).match(/^msapplication-tile(image|color)$/)||ln(e.attributes.name)==="application-name"||ln(e.attributes.rel)==="icon"||ln(e.attributes.rel)==="apple-touch-icon"||ln(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&ln(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(ln(e.attributes.property).match(/^(og|twitter|fb):/)||ln(e.attributes.name).match(/^(og|twitter):/)||ln(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(ln(e.attributes.name)==="robots"||ln(e.attributes.name)==="googlebot"||ln(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(ln(e.attributes.name)==="author"||ln(e.attributes.name)==="generator"||ln(e.attributes.name)==="framework"||ln(e.attributes.name)==="publisher"||ln(e.attributes.name)==="progid"||ln(e.attributes.property).match(/^article:/)||ln(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(ln(e.attributes.name)==="google-site-verification"||ln(e.attributes.name)==="yandex-verification"||ln(e.attributes.name)==="csrf-token"||ln(e.attributes.name)==="p:domain_verify"||ln(e.attributes.name)==="verify-v1"||ln(e.attributes.name)==="verification"||ln(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function Ll(e,t){var n=t.doc,r=t.mirror,i=t.blockClass,o=t.blockSelector,s=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,w=t.slimDOMOptions,b=t.dataURLOptions,C=b===void 0?{}:b,E=t.inlineImages,k=E===void 0?!1:E,O=t.recordCanvas,T=O===void 0?!1:O,L=t.onSerialize,B=t.onIframeLoad,z=t.iframeLoadTimeout,N=z===void 0?5e3:z,G=t.onStylesheetLoad,Q=t.stylesheetLoadTimeout,se=Q===void 0?5e3:Q,H=t.keepIframeSrcFn,J=H===void 0?function(){return!1}:H,q=t.newlyAddedElement,V=q===void 0?!1:q,fe=t.cssCaptured,be=fe===void 0?!1:fe,A=t.needsMask,ne=t.preserveWhiteSpace,ce=ne===void 0?!0:ne;if(!A){var $=A===void 0;A=TA(e,s,u,$)}var he=w7(e,{doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:A,inlineStylesheet:h,maskInputOptions:v,maskTextFn:_,maskInputFn:x,dataURLOptions:C,inlineImages:k,recordCanvas:T,keepIframeSrcFn:J,newlyAddedElement:V,cssCaptured:be});if(!he)return console.warn(e,"not serialized"),null;var Ne;r.hasNode(e)?Ne=r.getId(e):k7(he,w)||!ce&&he.type===Kn.Text&&!he.textContent.replace(/^\s+|\s+$/gm,"").length?Ne=jc:Ne=kA();var ie=Object.assign(he,{id:Ne});if(r.add(e,ie),Ne===jc)return null;L&&L(e);var Fe=!d;if(ie.type===Kn.Element){Fe=Fe&&!ie.needBlock,delete ie.needBlock;var we=wr.shadowRoot(e);we&&qc(we)&&(ie.isShadowHost=!0)}if((ie.type===Kn.Document||ie.type===Kn.Element)&&Fe){w.headWhitespace&&ie.type===Kn.Element&&ie.tagName==="head"&&(ce=!1);var We={doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:A,maskTextClass:s,maskTextSelector:u,skipChild:d,inlineStylesheet:h,maskInputOptions:v,maskTextFn:_,maskInputFn:x,slimDOMOptions:w,dataURLOptions:C,inlineImages:k,recordCanvas:T,preserveWhiteSpace:ce,onSerialize:L,onIframeLoad:B,iframeLoadTimeout:N,onStylesheetLoad:G,stylesheetLoadTimeout:se,keepIframeSrcFn:J,cssCaptured:!1};if(!(ie.type===Kn.Element&&ie.tagName==="textarea"&&ie.attributes.value!==void 0)){ie.type===Kn.Element&&ie.attributes._cssText!==void 0&&typeof ie.attributes._cssText=="string"&&(We.cssCaptured=!0);for(var Qe=Ze(Array.from(wr.childNodes(e))),Pe;!(Pe=Qe()).done;){var Se=Pe.value,$e=Ll(Se,We);$e&&ie.childNodes.push($e)}}var Ke=null;if(SA(e)&&(Ke=wr.shadowRoot(e)))for(var nt=Ze(Array.from(wr.childNodes(Ke))),yt;!(yt=nt()).done;){var ut=yt.value,P=Ll(ut,We);P&&(qc(Ke)&&(P.isShadow=!0),ie.childNodes.push(P))}}var F=wr.parentNode(e);return F&&zc(F)&&qc(F)&&(ie.isShadow=!0),ie.type===Kn.Element&&ie.tagName==="iframe"&&b7(e,function(){var Y=e.contentDocument;if(Y&&B){var me=Ll(Y,{doc:Y,mirror:r,blockClass:i,blockSelector:o,needsMask:A,maskTextClass:s,maskTextSelector:u,skipChild:!1,inlineStylesheet:h,maskInputOptions:v,maskTextFn:_,maskInputFn:x,slimDOMOptions:w,dataURLOptions:C,inlineImages:k,recordCanvas:T,preserveWhiteSpace:ce,onSerialize:L,onIframeLoad:B,iframeLoadTimeout:N,onStylesheetLoad:G,stylesheetLoadTimeout:se,keepIframeSrcFn:J});me&&B(e,me)}},N),ie.type===Kn.Element&&ie.tagName==="link"&&typeof ie.attributes.rel=="string"&&(ie.attributes.rel==="stylesheet"||ie.attributes.rel==="preload"&&typeof ie.attributes.href=="string"&&EA(ie.attributes.href)==="css")&&S7(e,function(){if(G){var Y=Ll(e,{doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:A,maskTextClass:s,maskTextSelector:u,skipChild:!1,inlineStylesheet:h,maskInputOptions:v,maskTextFn:_,maskInputFn:x,slimDOMOptions:w,dataURLOptions:C,inlineImages:k,recordCanvas:T,preserveWhiteSpace:ce,onSerialize:L,onIframeLoad:B,iframeLoadTimeout:N,onStylesheetLoad:G,stylesheetLoadTimeout:se,keepIframeSrcFn:J});Y&&G(e,Y)}},se),ie}function A7(e,t){var n=t||{},r=n.mirror,i=r===void 0?new xA:r,o=n.blockClass,s=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,w=x===void 0?!1:x,b=n.recordCanvas,C=b===void 0?!1:b,E=n.maskAllInputs,k=E===void 0?!1:E,O=n.maskTextFn,T=n.maskInputFn,L=n.slimDOM,B=L===void 0?!1:L,z=n.dataURLOptions,N=n.preserveWhiteSpace,G=n.onSerialize,Q=n.onIframeLoad,se=n.iframeLoadTimeout,H=n.onStylesheetLoad,J=n.stylesheetLoadTimeout,q=n.keepIframeSrcFn,V=q===void 0?function(){return!1}:q,fe=k===!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}:k===!1?{password:!0}:k,be=B===!0||B==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:B==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:B===!1?{}:B;return Ll(e,{doc:e,mirror:i,blockClass:s,blockSelector:c,maskTextClass:p,maskTextSelector:m,skipChild:!1,inlineStylesheet:_,maskInputOptions:fe,maskTextFn:O,maskInputFn:T,slimDOMOptions:be,dataURLOptions:z,inlineImages:w,recordCanvas:C,preserveWhiteSpace:N,onSerialize:G,onIframeLoad:Q,iframeLoadTimeout:se,onStylesheetLoad:H,stylesheetLoadTimeout:J,keepIframeSrcFn:V,newlyAddedElement:!1})}function I7(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function R7(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return mt(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 h_={exports:{}},dn=String,MA=function(){return{isColorSupported:!1,reset:dn,bold:dn,dim:dn,italic:dn,underline:dn,inverse:dn,hidden:dn,strikethrough:dn,black:dn,red:dn,green:dn,yellow:dn,blue:dn,magenta:dn,cyan:dn,white:dn,gray:dn,bgBlack:dn,bgRed:dn,bgGreen:dn,bgYellow:dn,bgBlue:dn,bgMagenta:dn,bgCyan:dn,bgWhite:dn}};h_.exports=MA(),h_.exports.createColors=MA;var O7=h_.exports,T7={},M7=Object.freeze(Object.defineProperty({__proto__:null,default:T7},Symbol.toStringTag,{value:"Module"})),Mn=R7(M7),DA=O7,$A=Mn,p_=function(e){Sr(t,e);function t(r,i,o,s,u,c){var d;return d=e.call(this,r)||this,d.name="CssSyntaxError",d.reason=r,u&&(d.file=u),s&&(d.source=s),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 s=this.source;i==null&&(i=DA.isColorSupported),$A&&i&&(s=$A(s));var u=s.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=DA.createColors(!0),_=v.bold,x=v.gray,w=v.red;h=function(b){return _(w(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,k=" "+(" "+E).slice(-p)+" | ";if(E===o.line){var O=m(k.replace(/\d/g," "))+b.slice(0,o.column-1).replace(/[^\t]/g," ");return h(">")+m(k)+b+`
78
+ `,bh=typeof window<"u"&&"HTMLElement"in window,YU=!!(typeof SC_DISABLE_SPEEDY=="boolean"?SC_DISABLE_SPEEDY:typeof process<"u"&&br!==void 0&&br.REACT_APP_SC_DISABLE_SPEEDY!==void 0&&br.REACT_APP_SC_DISABLE_SPEEDY!==""?br.REACT_APP_SC_DISABLE_SPEEDY!=="false"&&br.REACT_APP_SC_DISABLE_SPEEDY:typeof process<"u"&&br!==void 0&&br.SC_DISABLE_SPEEDY!==void 0&&br.SC_DISABLE_SPEEDY!==""?br.SC_DISABLE_SPEEDY!=="false"&&br.SC_DISABLE_SPEEDY:br.NODE_ENV!=="production"),WU={},Sh=Object.freeze([]),Tl=Object.freeze({});function Fk(e,t,n){return n===void 0&&(n=Tl),e.theme!==n.theme&&e.theme||t||n.theme}var Uk=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"]),KU=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,QU=/(^-|-$)/g;function zk(e){return e.replace(KU,"-").replace(QU,"")}var XU=/(a)(d)/gi,wh=52,qk=function(e){return String.fromCharCode(e+(e>25?39:97))};function Vy(e){var t,n="";for(t=Math.abs(e);t>wh;t=t/wh|0)n=qk(t%wh)+n;return(qk(t%wh)+n).replace(XU,"$1-$2")}var Zy,jk=5381,Ml=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},Hk=function(e){return Ml(jk,e)};function Gk(e){return Vy(Hk(e)>>>0)}function JU(e){return e.displayName||e.name||"Component"}function Yy(e){return typeof e=="string"&&br.NODE_ENV==="production"}var Vk=typeof Symbol=="function"&&Symbol.for,Zk=Vk?Symbol.for("react.memo"):60115,ez=Vk?Symbol.for("react.forward_ref"):60112,tz={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},nz={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},Yk={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},rz=((Zy={})[ez]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},Zy[Zk]=Yk,Zy);function Wk(e){return("type"in(t=e)&&t.type.$$typeof)===Zk?Yk:"$$typeof"in e?rz[e.$$typeof]:tz;var t}var iz=Object.defineProperty,oz=Object.getOwnPropertyNames,Kk=Object.getOwnPropertySymbols,az=Object.getOwnPropertyDescriptor,sz=Object.getPrototypeOf,Qk=Object.prototype;function Xk(e,t,n){if(typeof t!="string"){if(Qk){var r=sz(t);r&&r!==Qk&&Xk(e,r,n)}var i=oz(t);Kk&&(i=i.concat(Kk(t)));for(var o=Wk(e),s=Wk(t),u=0;u<i.length;++u){var c=i[u];if(!(c in nz||n&&n[c]||s&&c in s||o&&c in o)){var d=az(t,c);try{iz(e,c,d)}catch{}}}}return e}function As(e){return typeof e=="function"}function Wy(e){return typeof e=="object"&&"styledComponentId"in e}function Is(e,t){return e&&t?"".concat(e," ").concat(t):e||t||""}function Ky(e,t){if(e.length===0)return"";for(var n=e[0],r=1;r<e.length;r++)n+=e[r];return n}function Nc(e){return e!==null&&typeof e=="object"&&e.constructor.name===Object.name&&!("props"in e&&e.$$typeof)}function Qy(e,t,n){if(n===void 0&&(n=!1),!n&&!Nc(e)&&!Array.isArray(e))return t;if(Array.isArray(t))for(var r=0;r<t.length;r++)e[r]=Qy(e[r],t[r]);else if(Nc(t))for(var r in t)e[r]=Qy(e[r],t[r]);return e}function Xy(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 lz=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 s=i;s<o;s++)this.groupSizes[s]=0}for(var u=this.indexOfGroup(t+1),c=(s=0,n.length);s<c;s++)this.tag.insertRule(u,n[s])&&(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,s=i;s<o;s++)n+="".concat(this.tag.getRule(s)).concat(Gy);return n},e}(),xh=new Map,Ch=new Map,Eh=1,kh=function(e){if(xh.has(e))return xh.get(e);for(;Ch.has(Eh);)Eh++;var t=Eh++;return xh.set(e,t),Ch.set(t,e),t},uz=function(e,t){Eh=t+1,xh.set(e,t),Ch.set(t,e)},cz="style[".concat(Ol,"][").concat(Bk,'="').concat(_h,'"]'),fz=new RegExp("^".concat(Ol,'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')),dz=function(e,t,n){for(var r,i=n.split(","),o=0,s=i.length;o<s;o++)(r=i[o])&&e.registerName(t,r)},hz=function(e,t){for(var n,r=((n=t.textContent)!==null&&n!==void 0?n:"").split(Gy),i=[],o=0,s=r.length;o<s;o++){var u=r[o].trim();if(u){var c=u.match(fz);if(c){var d=0|parseInt(c[1],10),p=c[2];d!==0&&(uz(p,d),dz(e,p,c[3]),e.getTag().insertRules(d,i)),i.length=0}else i.push(u)}}},Jk=function(e){for(var t=document.querySelectorAll(cz),n=0,r=t.length;n<r;n++){var i=t[n];i&&i.getAttribute(Ol)!==Pk&&(hz(e,i),i.parentNode&&i.parentNode.removeChild(i))}};function pz(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:null}var eA=function(e){var t=document.head,n=e||t,r=document.createElement("style"),i=function(u){var c=Array.from(u.querySelectorAll("style[".concat(Ol,"]")));return c[c.length-1]}(n),o=i!==void 0?i.nextSibling:null;r.setAttribute(Ol,Pk),r.setAttribute(Bk,_h);var s=pz();return s&&r.setAttribute("nonce",s),n.insertBefore(r,o),r},gz=function(){function e(t){this.element=eA(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 s=r[i];if(s.ownerNode===n)return s}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}(),mz=function(){function e(t){this.element=eA(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}(),vz=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}(),tA=bh,yz={isServer:!bh,useCSSOMInjection:!YU},Ah=function(){function e(t,n,r){t===void 0&&(t=Tl),n===void 0&&(n={});var i=this;this.options=tr(tr({},yz),t),this.gs=n,this.names=new Map(r),this.server=!!t.isServer,!this.server&&bh&&tA&&(tA=!1,Jk(this)),Xy(this,function(){return function(o){for(var s=o.getTag(),u=s.length,c="",d=function(h){var m=function(b){return Ch.get(b)}(h);if(m===void 0)return"continue";var v=o.names.get(m),_=s.getGroup(h);if(v===void 0||!v.size||_.length===0)return"continue";var x="".concat(Ol,".g").concat(h,'[id="').concat(m,'"]'),w="";v!==void 0&&v.forEach(function(b){b.length>0&&(w+="".concat(b,","))}),c+="".concat(_).concat(x,'{content:"').concat(w,'"}').concat(Gy)},p=0;p<u;p++)d(p);return c}(i)})}return e.registerId=function(t){return kh(t)},e.prototype.rehydrate=function(){!this.server&&bh&&Jk(this)},e.prototype.reconstructWithOptions=function(t,n){return n===void 0&&(n=!0),new e(tr(tr({},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 vz(i):r?new gz(i):new mz(i)}(this.options),new lz(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(kh(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(kh(t),r)},e.prototype.clearNames=function(t){this.names.has(t)&&this.names.get(t).clear()},e.prototype.clearRules=function(t){this.getTag().clearGroup(kh(t)),this.clearNames(t)},e.prototype.clearTag=function(){this.tag=void 0},e}(),_z=/&/g,bz=/^\s*\/\/.*$/gm;function nA(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=nA(n.children,t)),n})}function rA(e){var t,n,r,i=e===void 0?Tl:e,o=i.options,s=o===void 0?Tl:o,u=i.plugins,c=u===void 0?Sh: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===fh&&m.value.includes("&")&&(m.props[0]=m.props[0].replace(_z,n).replace(r,d))}),s.prefix&&p.push(VU),p.push(jU);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 w=m.replace(bz,""),b=zU(_||v?"".concat(_," ").concat(v," { ").concat(w," }"):w);s.namespace&&(b=nA(b,s.namespace));var C=[];return yh(b,HU(p.concat(GU(function(E){return C.push(E)})))),C};return h.hash=c.length?c.reduce(function(m,v){return v.name||Rs(15),Ml(m,v.name)},jk).toString():"",h}var Sz=new Ah,Jy=rA(),e_=Tn.createContext({shouldForwardProp:void 0,styleSheet:Sz,stylis:Jy});e_.Consumer;var wz=Tn.createContext(void 0);function Ih(){return W.useContext(e_)}function xz(e){var t=W.useState(e.stylisPlugins),n=t[0],r=t[1],i=Ih().styleSheet,o=W.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]),s=W.useMemo(function(){return rA({options:{namespace:e.namespace,prefix:e.enableVendorPrefixes},plugins:n})},[e.enableVendorPrefixes,e.namespace,n]);W.useEffect(function(){IU(n,e.stylisPlugins)||r(e.stylisPlugins)},[e.stylisPlugins]);var u=W.useMemo(function(){return{shouldForwardProp:e.shouldForwardProp,styleSheet:o,stylis:s}},[e.shouldForwardProp,o,s]);return Tn.createElement(e_.Provider,{value:u},Tn.createElement(wz.Provider,{value:s},e.children))}var Cz=function(){function e(t,n){var r=this;this.inject=function(i,o){o===void 0&&(o=Jy);var s=r.name+o.hash;i.hasNameForId(r.id,s)||i.insertRules(r.id,s,o(r.rules,s,"@keyframes"))},this.name=t,this.id="sc-keyframes-".concat(t),this.rules=n,Xy(this,function(){throw Rs(12,String(r.name))})}return e.prototype.getName=function(t){return t===void 0&&(t=Jy),this.name+t.hash},e}(),Ez=function(e){return e>="A"&&e<="Z"};function iA(e){for(var t="",n=0;n<e.length;n++){var r=e[n];if(n===1&&r==="-"&&e[0]==="-")return e;Ez(r)?t+="-"+r.toLowerCase():t+=r}return t.startsWith("ms-")?"-"+t:t}var oA=function(e){return e==null||e===!1||e===""},aA=function(e){var t,n,r=[];for(var i in e){var o=e[i];e.hasOwnProperty(i)&&!oA(o)&&(Array.isArray(o)&&o.isCss||As(o)?r.push("".concat(iA(i),":"),o,";"):Nc(o)?r.push.apply(r,Dc(Dc(["".concat(i," {")],aA(o),!1),["}"],!1)):r.push("".concat(iA(i),": ").concat((t=i,(n=o)==null||typeof n=="boolean"||n===""?"":typeof n!="number"||n===0||t in ZU||t.startsWith("--")?String(n).trim():"".concat(n,"px")),";")))}return r};function xa(e,t,n,r){if(oA(e))return[];if(Wy(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 xa(i,t,n,r)}var o;return e instanceof Cz?n?(e.inject(n,r),[e.getName(r)]):[e]:Nc(e)?aA(e):Array.isArray(e)?Array.prototype.concat.apply(Sh,e.map(function(s){return xa(s,t,n,r)})):[e.toString()]}function sA(e){for(var t=0;t<e.length;t+=1){var n=e[t];if(As(n)&&!Wy(n))return!1}return!0}var kz=Hk(_h),Az=function(){function e(t,n,r){this.rules=t,this.staticRulesId="",this.isStatic=(r===void 0||r.isStatic)&&sA(t),this.componentId=n,this.baseHash=Ml(kz,n),this.baseStyle=r,Ah.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=Ky(xa(this.rules,t,n,r)),s=Vy(Ml(this.baseHash,o)>>>0);if(!n.hasNameForId(this.componentId,s)){var u=r(o,".".concat(s),void 0,this.componentId);n.insertRules(this.componentId,s,u)}i=Is(i,s),this.staticRulesId=s}else{for(var c=Ml(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=Ky(xa(h,t,n,r));c=Ml(c,m+p),d+=m}}if(d){var v=Vy(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}(),Pc=Tn.createContext(void 0);Pc.Consumer;function Iz(e){var t=Tn.useContext(Pc),n=W.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?tr(tr({},i),r):r}(e.theme,t)},[e.theme,t]);return e.children?Tn.createElement(Pc.Provider,{value:n},e.children):null}var t_={};function Rz(e,t,n){var r=Wy(e),i=e,o=!Yy(e),s=t.attrs,u=s===void 0?Sh:s,c=t.componentId,d=c===void 0?function(k,O){var T=typeof k!="string"?"sc":zk(k);t_[T]=(t_[T]||0)+1;var L="".concat(T,"-").concat(Gk(_h+T+t_[T]));return O?"".concat(O,"-").concat(L):L}(t.displayName,t.parentComponentId):c,p=t.displayName,h=p===void 0?function(k){return Yy(k)?"styled.".concat(k):"Styled(".concat(JU(k),")")}(e):p,m=t.displayName&&t.componentId?"".concat(zk(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 w=t.shouldForwardProp;_=function(k,O){return x(k,O)&&w(k,O)}}else _=x}var b=new Az(n,m,r?i.componentStyle:void 0);function C(k,O){return function(T,L,B){var z=T.attrs,N=T.componentStyle,G=T.defaultProps,Q=T.foldedComponentIds,se=T.styledComponentId,H=T.target,J=Tn.useContext(Pc),q=Ih(),V=T.shouldForwardProp||q.shouldForwardProp,fe=Fk(L,J,G)||Tl,be=function(Ne,ie,Fe){for(var we,We=tr(tr({},ie),{className:void 0,theme:Fe}),Qe=0;Qe<Ne.length;Qe+=1){var Pe=As(we=Ne[Qe])?we(We):we;for(var Se in Pe)We[Se]=Se==="className"?Is(We[Se],Pe[Se]):Se==="style"?tr(tr({},We[Se]),Pe[Se]):Pe[Se]}return ie.className&&(We.className=Is(We.className,ie.className)),We}(z,L,fe),A=be.as||H,ne={};for(var ce in be)be[ce]===void 0||ce[0]==="$"||ce==="as"||ce==="theme"&&be.theme===fe||(ce==="forwardedAs"?ne.as=be.forwardedAs:V&&!V(ce,A)||(ne[ce]=be[ce],V||br.NODE_ENV));var $=function(Ne,ie){var Fe=Ih(),we=Ne.generateAndInjectStyles(ie,Fe.styleSheet,Fe.stylis);return we}(N,be),he=Is(Q,se);return $&&(he+=" "+$),be.className&&(he+=" "+be.className),ne[Yy(A)&&!Uk.has(A)?"class":"className"]=he,B&&(ne.ref=B),W.createElement(A,ne)}(E,k,O)}C.displayName=h;var E=Tn.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(k){this._foldedDefaultProps=r?function(O){for(var T=[],L=1;L<arguments.length;L++)T[L-1]=arguments[L];for(var B=0,z=T;B<z.length;B++)Qy(O,z[B],!0);return O}({},i.defaultProps,k):k}}),Xy(E,function(){return".".concat(E.styledComponentId)}),o&&Xk(E,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0}),E}function lA(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 uA=function(e){return Object.assign(e,{isCss:!0})};function Do(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(As(e)||Nc(e))return uA(xa(lA(Sh,Dc([e],t,!0))));var r=e;return t.length===0&&r.length===1&&typeof r[0]=="string"?xa(r):uA(xa(lA(r,t)))}function n_(e,t,n){if(n===void 0&&(n=Tl),!t)throw Rs(1,t);var r=function(i){for(var o=[],s=1;s<arguments.length;s++)o[s-1]=arguments[s];return e(t,n,Do.apply(void 0,Dc([i],o,!1)))};return r.attrs=function(i){return n_(e,t,tr(tr({},n),{attrs:Array.prototype.concat(n.attrs,i).filter(Boolean)}))},r.withConfig=function(i){return n_(e,t,tr(tr({},n),i))},r}var cA=function(e){return n_(Rz,e)},le=cA;Uk.forEach(function(e){le[e]=cA(e)});var Oz=function(){function e(t,n){this.rules=t,this.componentId=n,this.isStatic=sA(t),Ah.registerId(this.componentId+1)}return e.prototype.createStyles=function(t,n,r,i){var o=i(Ky(xa(this.rules,n,r,i)),""),s=this.componentId+t;r.insertRules(s,s,o)},e.prototype.removeStyles=function(t,n){n.clearRules(this.componentId+t)},e.prototype.renderStyles=function(t,n,r,i){t>2&&Ah.registerId(this.componentId+t),this.removeStyles(t,r),this.createStyles(t,n,r,i)},e}();function Tz(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=Do.apply(void 0,Dc([e],t,!1)),i="sc-global-".concat(Gk(JSON.stringify(r))),o=new Oz(r,i),s=function(c){var d=Ih(),p=Tn.useContext(Pc),h=Tn.useRef(d.styleSheet.allocateGSInstance(i)).current;return d.styleSheet.server&&u(h,c,d.styleSheet,p,d.stylis),Tn.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,WU,p,m);else{var v=tr(tr({},d),{theme:Fk(d,h,s.defaultProps)});o.renderStyles(c,v,p,m)}}return Tn.memo(s)}const mi={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"};var Rh={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:"791803",WAYLAND_DISPLAY:"wayland-0",LOGNAME:"anurag",PULSE_SERVER:"unix:/mnt/wslg/PulseServer",WSL_INTEROP:"/run/WSL/7352_interop",NAME:"Anurag-PC",_P9K_SSH_TTY:"/dev/pts/2",_:"/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:"5b6a92d8-e4b7-4f7e-8bc5-c003db86c4a8",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.5-canary.0",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",_P9K_TTY:"/dev/pts/2",GVM_ROOT:"/home/anurag/.gvm",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"},ze;if(typeof window>"u"){var fA={hostname:""};ze={crypto:{randomUUID:function(){throw Error("unsupported")}},navigator:{userAgent:"",onLine:!0},document:{createElement:function(){return{}},location:fA,referrer:""},screen:{width:0,height:0},location:fA,addEventListener:function(){},removeEventListener:function(){}}}else ze=window;function dA(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 hA(e,t,n,r,i,o,s){try{var u=e[o](s),c=u.value}catch(d){n(d);return}u.done?t(c):Promise.resolve(c).then(r,i)}function r_(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(c){hA(o,r,i,s,u,"next",c)}function u(c){hA(o,r,i,s,u,"throw",c)}s(void 0)})}}function Oh(e,t,n){return pA()?Oh=Reflect.construct:Oh=function(i,o,s){var u=[null];u.push.apply(u,o);var c=Function.bind.apply(i,u),d=new c;return s&&Fc(d,s.prototype),d},Oh.apply(null,arguments)}function Mz(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 sr(e,t,n){return t&&Mz(e.prototype,t),e}function Ft(){return Ft=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},Ft.apply(this,arguments)}function i_(e){return i_=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},i_(e)}function Sr(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&&Fc(e,t)}function mt(e,t){return t!=null&&typeof Symbol<"u"&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function Dz(e){return Function.toString.call(e).indexOf("[native code]")!==-1}function Bc(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 Fc(e,t){return Fc=Object.setPrototypeOf||function(r,i){return r.__proto__=i,r},Fc(e,t)}function Ot(e){"@swc/helpers - typeof";return e&&typeof Symbol<"u"&&e.constructor===Symbol?"symbol":typeof e}function $z(e,t){if(e){if(typeof e=="string")return dA(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 dA(e,t)}}function Th(e){var t=typeof Map=="function"?new Map:void 0;return Th=function(r){if(r===null||!Dz(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 Oh(r,arguments,i_(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Fc(i,r)},Th(e)}function pA(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(pA=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=$z(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 Uc(e,t){var n,r,i,o,s={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(;s;)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 s.label++,{value:d[1],done:!1};case 5:s.label++,r=d[1],d=[0];continue;case 7:d=s.ops.pop(),s.trys.pop();continue;default:if(i=s.trys,!(i=i.length>0&&i[i.length-1])&&(d[0]===6||d[0]===2)){s=0;continue}if(d[0]===3&&(!i||d[1]>i[0]&&d[1]<i[3])){s.label=d[1];break}if(d[0]===6&&s.label<i[1]){s.label=i[1],i=d;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(d);break}i[2]&&s.ops.pop(),s.trys.pop();continue}d=t.call(e,s)}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 gA(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 Lz=Object.defineProperty,Nz=function(e,t,n){return t in e?Lz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},Le=function(e,t,n){return Nz(e,(typeof t>"u"?"undefined":Ot(t))!=="symbol"?t+"":t,n)},mA,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},vA=function(e,t,n){return Bz(e,(typeof t>"u"?"undefined":Ot(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||{}),yA={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},_A={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Mh={},Fz=function(){return!!globalThis.Zone};function o_(e){if(Mh[e])return Mh[e];var t=globalThis[e],n=t.prototype,r=e in yA?yA[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 _A?_A[e]:void 0,s=!!(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&&s&&!Fz())return Mh[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?Mh[e]=d:n}catch{return n}}var a_={};function Ca(e,t,n){var r,i=e+"."+String(n);if(a_[i])return a_[i].call(t);var o=o_(e),s=(r=Object.getOwnPropertyDescriptor(o,n))==null?void 0:r.get;return s?(a_[i]=s,s.call(t)):t[n]}var s_={};function bA(e,t,n){var r=e+"."+String(n);if(s_[r])return s_[r].bind(t);var i=o_(e),o=i[n];return typeof o!="function"?t[n]:(s_[r]=o,o.bind(t))}function Uz(e){return Ca("Node",e,"childNodes")}function zz(e){return Ca("Node",e,"parentNode")}function qz(e){return Ca("Node",e,"parentElement")}function jz(e){return Ca("Node",e,"textContent")}function Hz(e,t){return bA("Node",e,"contains")(t)}function Gz(e){return bA("Node",e,"getRootNode")()}function Vz(e){return!e||!("host"in e)?null:Ca("ShadowRoot",e,"host")}function Zz(e){return e.styleSheets}function Yz(e){return!e||!("shadowRoot"in e)?null:Ca("Element",e,"shadowRoot")}function Wz(e,t){return Ca("Element",e,"querySelector")(t)}function Kz(e,t){return Ca("Element",e,"querySelectorAll")(t)}function Qz(){return o_("MutationObserver").constructor}var wr={childNodes:Uz,parentNode:zz,parentElement:qz,textContent:jz,contains:Hz,getRootNode:Gz,host:Vz,styleSheets:Zz,shadowRoot:Yz,querySelector:Wz,querySelectorAll:Kz,mutationObserver:Qz};function SA(e){return e.nodeType===e.ELEMENT_NODE}function zc(e){var t=e&&"host"in e&&"mode"in e&&wr.host(e)||null;return!!(t&&"shadowRoot"in t&&wr.shadowRoot(t)===e)}function qc(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function Xz(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 Jz(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 l_(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 wA(i,n)}).join("");return Xz(r)}catch{return null}}function wA(e,t){if(t7(e)){var n;try{n=l_(e.styleSheet)||Jz(e)}catch{n=e.cssText}return e.styleSheet.href?Dh(n,e.styleSheet.href):n}else{var r=e.cssText;return n7(e)&&e.selectorText.includes(":")&&(r=e7(r)),t?Dh(r,t):r}}function e7(e){var t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function t7(e){return"styleSheet"in e}function n7(e){return"selectorText"in e}var xA=function(){function e(){vA(this,"idNodeMap",new Map),vA(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(s){return i.removeNodeFromMap(s)})},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 s=this.nodeMetaMap.get(o);s&&this.nodeMetaMap.set(i,s)}this.idNodeMap.set(r,i)},t.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},e}();function r7(){return new xA}function u_(e){var t=e.element,n=e.maskInputOptions,r=e.tagName,i=e.type,o=e.value,s=e.maskInputFn,u=o||"",c=i&&Os(i);return(n[r.toLowerCase()]||c&&n[c])&&(s?u=s(u,t):u="*".repeat(u.length)),u}function Os(e){return e.toLowerCase()}var CA="__rrweb_original__";function i7(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,s=CA in o?o[CA]:o,u=new Uint32Array(s.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 c_(e){var t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?Os(t):null}function EA(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 o7(e){var t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var a7=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,s7=/^(?:[a-z+]+:)?\/\//i,l7=/^www\..*/i,u7=/^(data:)([^,]*),(.*)/i;function Dh(e,t){return(e||"").replace(a7,function(n,r,i,o,s,u){var c=i||s||u,d=r||o||"";if(!c)return n;if(s7.test(c)||l7.test(c)||u7.test(c))return"url("+d+c+d+")";if(c[0]==="/")return"url("+d+(o7(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 f_(e){return e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"")}function c7(e,t){var n=Array.from(t.childNodes),r=[];if(n.length>1&&e&&typeof e=="string"){for(var i=f_(e),o=1;o<n.length;o++)if(n[o].textContent&&typeof n[o].textContent=="string")for(var s=f_(n[o].textContent),u=3;u<s.length;u++){var c=s.substring(0,u);if(i.split(c).length===2){for(var d=i.indexOf(c),p=d;p<e.length;p++)if(f_(e.substring(0,p)).length===d){r.push(e.substring(0,p)),e=e.substring(p);break}break}}}return r.push(e),r}function f7(e,t){return c7(e,t).join("/* rr_split */")}var d7=1,h7=new RegExp("[^a-z0-9-_:]"),jc=-2;function kA(){return d7++}function p7(e){if(mt(e,HTMLFormElement))return"form";var t=Os(e.tagName);return h7.test(t)?"div":t}var Dl,AA,g7=/^[^ \t\n\r\u000c]+/,m7=/^[, \t\n\r\u000c]+/;function v7(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(m7),!(n>=t.length);){var o=r(g7);if(o.slice(-1)===",")o=$l(e,o.substring(0,o.length-1)),i.push(o);else{var s="";o=$l(e,o);for(var u=!1;;){var c=t.charAt(n);if(c===""){i.push((o+s).trim());break}else if(u)c===")"&&(u=!1);else if(c===","){n+=1,i.push((o+s).trim());break}else c==="("&&(u=!0);s+=c,n+=1}}}return i.join(", ")}var IA=new WeakMap;function $l(e,t){return!t||t.trim()===""?t:d_(e,t)}function y7(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function d_(e,t){var n=IA.get(e);if(n||(n=e.createElement("a"),IA.set(e,n)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return n.setAttribute("href",t),n.href}function RA(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")?$l(e,r):n==="srcset"?v7(e,r):n==="style"?Dh(r,d_(e)):t==="object"&&n==="data"?$l(e,r):r)}function OA(e,t,n){return(e==="video"||e==="audio")&&t==="autoplay"}function _7(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 $h(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return n?$h(wr.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?$h(wr.parentNode(e),t,n):!1}function TA(e,t,n,r){var i;if(SA(e)){if(i=e,!wr.childNodes(i).length)return!1}else{if(wr.parentElement(e)===null)return!1;i=wr.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($h(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 b7(e,t,n){var r=e.contentWindow;if(r){var i=!1,o;try{o=r.document.readyState}catch{return}if(o!=="complete"){var s=setTimeout(function(){i||(t(),i=!0)},n);e.addEventListener("load",function(){clearTimeout(s),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 S7(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 w7(e,t){var n=t.doc,r=t.mirror,i=t.blockClass,o=t.blockSelector,s=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,w=t.keepIframeSrcFn,b=t.newlyAddedElement,C=b===void 0?!1:b,E=t.cssCaptured,k=E===void 0?!1:E,O=x7(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 E7(e,{doc:n,blockClass:i,blockSelector:o,inlineStylesheet:u,maskInputOptions:d,maskInputFn:h,dataURLOptions:v,inlineImages:_,recordCanvas:x,keepIframeSrcFn:w,newlyAddedElement:C,rootId:O});case e.TEXT_NODE:return C7(e,{doc:n,needsMask:s,maskTextFn:p,rootId:O,cssCaptured:k});case e.CDATA_SECTION_NODE:return{type:Kn.CDATA,textContent:"",rootId:O};case e.COMMENT_NODE:return{type:Kn.Comment,textContent:wr.textContent(e)||"",rootId:O};default:return!1}}function x7(e,t){if(t.hasNode(e)){var n=t.getId(e);return n===1?void 0:n}}function C7(e,t){var n=t.needsMask,r=t.maskTextFn,i=t.rootId,o=t.cssCaptured,s=wr.parentNode(e),u=s&&s.tagName,c="",d=u==="STYLE"?!0:void 0,p=u==="SCRIPT"?!0:void 0;return p?c="SCRIPT_PLACEHOLDER":o||(c=wr.textContent(e),d&&c&&(c=Dh(c,d_(t.doc)))),!d&&!p&&c&&n&&(c=r?r(c,wr.parentElement(e)):c.replace(/[\S]/g,"*")),{type:Kn.Text,textContent:c||"",rootId:i}}function E7(e,t){for(var n=t.doc,r=t.blockClass,i=t.blockSelector,o=t.inlineStylesheet,s=t.maskInputOptions,u=s===void 0?{}:s,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:_,w=t.rootId,b=_7(e,r,i),C=p7(e),E={},k=e.attributes.length,O=0;O<k;O++){var T=e.attributes[O];OA(C,T.name,T.value)||(E[T.name]=RA(n,C,Os(T.name),T.value))}if(C==="link"&&o){var L=Array.from(n.styleSheets).find(function(he){return he.href===e.href}),B=null;L&&(B=l_(L)),B&&(delete E.rel,delete E.href,E._cssText=B)}if(C==="style"&&e.sheet){var z=l_(e.sheet);z&&(e.childNodes.length>1&&(z=f7(z,e)),E._cssText=z)}if(C==="input"||C==="textarea"||C==="select"){var N=e.value,G=e.checked;E.type!=="radio"&&E.type!=="checkbox"&&E.type!=="submit"&&E.type!=="button"&&N?E.value=u_({element:e,type:c_(e),tagName:C,value:N,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")i7(e)||(E.rr_dataURL=e.toDataURL(p.type,p.quality));else if(!("__context"in e)){var Q=e.toDataURL(p.type,p.quality),se=n.createElement("canvas");se.width=e.width,se.height=e.height;var H=se.toDataURL(p.type,p.quality);Q!==H&&(E.rr_dataURL=Q)}}if(C==="img"&&h){Dl||(Dl=n.createElement("canvas"),AA=Dl.getContext("2d"));var J=e,q=J.currentSrc||J.getAttribute("src")||"<unknown-src>",V=J.crossOrigin,fe=function(){J.removeEventListener("load",fe);try{Dl.width=J.naturalWidth,Dl.height=J.naturalHeight,AA.drawImage(J,0,0),E.rr_dataURL=Dl.toDataURL(p.type,p.quality)}catch(he){if(J.crossOrigin!=="anonymous"){J.crossOrigin="anonymous",J.complete&&J.naturalWidth!==0?fe():J.addEventListener("load",fe);return}else console.warn("Cannot inline img src="+q+"! Error: "+he)}J.crossOrigin==="anonymous"&&(V?E.crossOrigin=V:J.removeAttribute("crossorigin"))};J.complete&&J.naturalWidth!==0?fe():J.addEventListener("load",fe)}if(C==="audio"||C==="video"){var be=E;be.rr_mediaState=e.paused?"paused":"played",be.rr_mediaCurrentTime=e.currentTime,be.rr_mediaPlaybackRate=e.playbackRate,be.rr_mediaMuted=e.muted,be.rr_mediaLoop=e.loop,be.rr_mediaVolume=e.volume}if(x||(e.scrollLeft&&(E.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(E.rr_scrollTop=e.scrollTop)),b){var A=e.getBoundingClientRect(),ne=A.width,ce=A.height;E={class:E.class,rr_width:""+ne+"px",rr_height:""+ce+"px"}}C==="iframe"&&!v(E.src)&&(e.contentDocument||(E.rr_src=E.src),delete E.src);var $;try{customElements.get(C)&&($=!0)}catch{}return{type:Kn.Element,tagName:C,attributes:E,childNodes:[],isSVG:y7(e)||void 0,needBlock:b,rootId:w,isCustom:$}}function ln(e){return e==null?"":e.toLowerCase()}function k7(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"&&EA(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(ln(e.attributes.name).match(/^msapplication-tile(image|color)$/)||ln(e.attributes.name)==="application-name"||ln(e.attributes.rel)==="icon"||ln(e.attributes.rel)==="apple-touch-icon"||ln(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&ln(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(ln(e.attributes.property).match(/^(og|twitter|fb):/)||ln(e.attributes.name).match(/^(og|twitter):/)||ln(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(ln(e.attributes.name)==="robots"||ln(e.attributes.name)==="googlebot"||ln(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(ln(e.attributes.name)==="author"||ln(e.attributes.name)==="generator"||ln(e.attributes.name)==="framework"||ln(e.attributes.name)==="publisher"||ln(e.attributes.name)==="progid"||ln(e.attributes.property).match(/^article:/)||ln(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(ln(e.attributes.name)==="google-site-verification"||ln(e.attributes.name)==="yandex-verification"||ln(e.attributes.name)==="csrf-token"||ln(e.attributes.name)==="p:domain_verify"||ln(e.attributes.name)==="verify-v1"||ln(e.attributes.name)==="verification"||ln(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function Ll(e,t){var n=t.doc,r=t.mirror,i=t.blockClass,o=t.blockSelector,s=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,w=t.slimDOMOptions,b=t.dataURLOptions,C=b===void 0?{}:b,E=t.inlineImages,k=E===void 0?!1:E,O=t.recordCanvas,T=O===void 0?!1:O,L=t.onSerialize,B=t.onIframeLoad,z=t.iframeLoadTimeout,N=z===void 0?5e3:z,G=t.onStylesheetLoad,Q=t.stylesheetLoadTimeout,se=Q===void 0?5e3:Q,H=t.keepIframeSrcFn,J=H===void 0?function(){return!1}:H,q=t.newlyAddedElement,V=q===void 0?!1:q,fe=t.cssCaptured,be=fe===void 0?!1:fe,A=t.needsMask,ne=t.preserveWhiteSpace,ce=ne===void 0?!0:ne;if(!A){var $=A===void 0;A=TA(e,s,u,$)}var he=w7(e,{doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:A,inlineStylesheet:h,maskInputOptions:v,maskTextFn:_,maskInputFn:x,dataURLOptions:C,inlineImages:k,recordCanvas:T,keepIframeSrcFn:J,newlyAddedElement:V,cssCaptured:be});if(!he)return console.warn(e,"not serialized"),null;var Ne;r.hasNode(e)?Ne=r.getId(e):k7(he,w)||!ce&&he.type===Kn.Text&&!he.textContent.replace(/^\s+|\s+$/gm,"").length?Ne=jc:Ne=kA();var ie=Object.assign(he,{id:Ne});if(r.add(e,ie),Ne===jc)return null;L&&L(e);var Fe=!d;if(ie.type===Kn.Element){Fe=Fe&&!ie.needBlock,delete ie.needBlock;var we=wr.shadowRoot(e);we&&qc(we)&&(ie.isShadowHost=!0)}if((ie.type===Kn.Document||ie.type===Kn.Element)&&Fe){w.headWhitespace&&ie.type===Kn.Element&&ie.tagName==="head"&&(ce=!1);var We={doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:A,maskTextClass:s,maskTextSelector:u,skipChild:d,inlineStylesheet:h,maskInputOptions:v,maskTextFn:_,maskInputFn:x,slimDOMOptions:w,dataURLOptions:C,inlineImages:k,recordCanvas:T,preserveWhiteSpace:ce,onSerialize:L,onIframeLoad:B,iframeLoadTimeout:N,onStylesheetLoad:G,stylesheetLoadTimeout:se,keepIframeSrcFn:J,cssCaptured:!1};if(!(ie.type===Kn.Element&&ie.tagName==="textarea"&&ie.attributes.value!==void 0)){ie.type===Kn.Element&&ie.attributes._cssText!==void 0&&typeof ie.attributes._cssText=="string"&&(We.cssCaptured=!0);for(var Qe=Ze(Array.from(wr.childNodes(e))),Pe;!(Pe=Qe()).done;){var Se=Pe.value,$e=Ll(Se,We);$e&&ie.childNodes.push($e)}}var Ke=null;if(SA(e)&&(Ke=wr.shadowRoot(e)))for(var nt=Ze(Array.from(wr.childNodes(Ke))),yt;!(yt=nt()).done;){var ut=yt.value,P=Ll(ut,We);P&&(qc(Ke)&&(P.isShadow=!0),ie.childNodes.push(P))}}var F=wr.parentNode(e);return F&&zc(F)&&qc(F)&&(ie.isShadow=!0),ie.type===Kn.Element&&ie.tagName==="iframe"&&b7(e,function(){var Y=e.contentDocument;if(Y&&B){var me=Ll(Y,{doc:Y,mirror:r,blockClass:i,blockSelector:o,needsMask:A,maskTextClass:s,maskTextSelector:u,skipChild:!1,inlineStylesheet:h,maskInputOptions:v,maskTextFn:_,maskInputFn:x,slimDOMOptions:w,dataURLOptions:C,inlineImages:k,recordCanvas:T,preserveWhiteSpace:ce,onSerialize:L,onIframeLoad:B,iframeLoadTimeout:N,onStylesheetLoad:G,stylesheetLoadTimeout:se,keepIframeSrcFn:J});me&&B(e,me)}},N),ie.type===Kn.Element&&ie.tagName==="link"&&typeof ie.attributes.rel=="string"&&(ie.attributes.rel==="stylesheet"||ie.attributes.rel==="preload"&&typeof ie.attributes.href=="string"&&EA(ie.attributes.href)==="css")&&S7(e,function(){if(G){var Y=Ll(e,{doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:A,maskTextClass:s,maskTextSelector:u,skipChild:!1,inlineStylesheet:h,maskInputOptions:v,maskTextFn:_,maskInputFn:x,slimDOMOptions:w,dataURLOptions:C,inlineImages:k,recordCanvas:T,preserveWhiteSpace:ce,onSerialize:L,onIframeLoad:B,iframeLoadTimeout:N,onStylesheetLoad:G,stylesheetLoadTimeout:se,keepIframeSrcFn:J});Y&&G(e,Y)}},se),ie}function A7(e,t){var n=t||{},r=n.mirror,i=r===void 0?new xA:r,o=n.blockClass,s=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,w=x===void 0?!1:x,b=n.recordCanvas,C=b===void 0?!1:b,E=n.maskAllInputs,k=E===void 0?!1:E,O=n.maskTextFn,T=n.maskInputFn,L=n.slimDOM,B=L===void 0?!1:L,z=n.dataURLOptions,N=n.preserveWhiteSpace,G=n.onSerialize,Q=n.onIframeLoad,se=n.iframeLoadTimeout,H=n.onStylesheetLoad,J=n.stylesheetLoadTimeout,q=n.keepIframeSrcFn,V=q===void 0?function(){return!1}:q,fe=k===!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}:k===!1?{password:!0}:k,be=B===!0||B==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:B==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:B===!1?{}:B;return Ll(e,{doc:e,mirror:i,blockClass:s,blockSelector:c,maskTextClass:p,maskTextSelector:m,skipChild:!1,inlineStylesheet:_,maskInputOptions:fe,maskTextFn:O,maskInputFn:T,slimDOMOptions:be,dataURLOptions:z,inlineImages:w,recordCanvas:C,preserveWhiteSpace:N,onSerialize:G,onIframeLoad:Q,iframeLoadTimeout:se,onStylesheetLoad:H,stylesheetLoadTimeout:J,keepIframeSrcFn:V,newlyAddedElement:!1})}function I7(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function R7(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return mt(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 h_={exports:{}},dn=String,MA=function(){return{isColorSupported:!1,reset:dn,bold:dn,dim:dn,italic:dn,underline:dn,inverse:dn,hidden:dn,strikethrough:dn,black:dn,red:dn,green:dn,yellow:dn,blue:dn,magenta:dn,cyan:dn,white:dn,gray:dn,bgBlack:dn,bgRed:dn,bgGreen:dn,bgYellow:dn,bgBlue:dn,bgMagenta:dn,bgCyan:dn,bgWhite:dn}};h_.exports=MA(),h_.exports.createColors=MA;var O7=h_.exports,T7={},M7=Object.freeze(Object.defineProperty({__proto__:null,default:T7},Symbol.toStringTag,{value:"Module"})),Mn=R7(M7),DA=O7,$A=Mn,p_=function(e){Sr(t,e);function t(r,i,o,s,u,c){var d;return d=e.call(this,r)||this,d.name="CssSyntaxError",d.reason=r,u&&(d.file=u),s&&(d.source=s),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 s=this.source;i==null&&(i=DA.isColorSupported),$A&&i&&(s=$A(s));var u=s.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=DA.createColors(!0),_=v.bold,x=v.gray,w=v.red;h=function(b){return _(w(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,k=" "+(" "+E).slice(-p)+" | ";if(E===o.line){var O=m(k.replace(/\d/g," "))+b.slice(0,o.column-1).replace(/[^\t]/g," ");return h(">")+m(k)+b+`
79
79
  `+O+h("^")}return" "+m(k)+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.`,kR
133
133
  `+m+"]":"["+v.join(",")+"]",s=m,p}for(d in _)Dp.call(_,d)&&(p=r(d,_),p&&v.push(n(d)+(s?": ":":")+p));return p=v.length===0?"{}":s?"{"+v.join(",")+m+"}":"{"+v.join(",")+"}",s=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},s=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="",w;if(t==='"')for(;o();){if(t==='"')return o(),x;if(t==="\\")if(o(),t==="u"){for(w=0,_=0;_<4&&(v=parseInt(o(),16),!!isFinite(v));_+=1)w=w*16+v;x+=String.fromCharCode(w)}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 s();default:return t>="0"&&t<="9"?s():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,s,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,s=d>>12&63,u=d>>6&63,c=d&63,v[h++]=t.charAt(o)+t.charAt(s)+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 s=e.charCodeAt(o),u=null;s<128?r++:s>127&&s<2048?u=String.fromCharCode(s>>6|192,s&63|128):u=String.fromCharCode(s>>12|224,s>>6&63|128,s&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 ze.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 pO=["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<pO.length;t++)if(e.indexOf(pO[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,s){n=encodeURIComponent(o.toString()),r=encodeURIComponent(s),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{Ut.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},R.cookie={get:function(e){for(var t=e+"=",n=Vt.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,s){var u="",c="",d="";if(s)u="; domain="+s;else if(r){var p=vO(Vt.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"),Vt.cookie=e+"="+encodeURIComponent(t)+c+"; path=/"+u+d},set:function(e,t,n,r,i,o,s){var u="",c="",d="";if(s)u="; domain="+s;else if(r){var p=vO(Vt.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 Vt.cookie=m,m},remove:function(e,t,n){R.cookie.set(e,"",-1,t,!1,!1,n)}};var gO=function(e){var t=!0;try{var n="__mplss_"+Nb(8),r="xyz";e.setItem(n,r),e.getItem(n)!==r&&(t=!1),e.removeItem(n)}catch{t=!1}return t},$b=null,ff=function(e,t){return $b!==null&&!t?$b:$b=gO(e||ze.localStorage)},Lb=null,lV=function(e,t){return Lb!==null&&!t?Lb:Lb=gO(e||ze.sessionStorage)};function mO(e,t,n){var r=function(i){Ut.error(t+" error: "+i)};return{is_supported:function(i){var o=n(e,i);return o||Ut.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(s){r(s)}},remove:function(i){try{e.removeItem(i)}catch(o){r(o)}}}}R.localStorage=mO(ze.localStorage,"localStorage",ff),R.sessionStorage=mO(ze.sessionStorage,"sessionStorage",lV),R.register_event=function(){var e=function(r,i,o,s,u){if(!r){Ut.error("No valid element provided to register_event");return}if(r.addEventListener&&!s)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 s=function(u){if(u=u||n(ze.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 s}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 uV=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 s=" "+o+" ";return(" "+i.className+" ").replace(t," ").indexOf(s)>=0}function r(i){if(!Vt.getElementsByTagName)return[];var o=i.split(" "),s,u,c,d,p,h,m,v,_,x,w=[Vt];for(h=0;h<o.length;h++){if(s=o[h].replace(/^\s+/,"").replace(/\s+$/,""),s.indexOf("#")>-1){u=s.split("#"),c=u[0];var b=u[1],C=Vt.getElementById(b);if(!C||c&&C.nodeName.toLowerCase()!=c)return[];w=[C];continue}if(s.indexOf(".")>-1){u=s.split("."),c=u[0];var E=u[1];for(c||(c="*"),d=[],p=0,m=0;m<w.length;m++)for(c=="*"?_=e(w[m]):_=w[m].getElementsByTagName(c),v=0;v<_.length;v++)d[p++]=_[v];for(w=[],x=0,m=0;m<d.length;m++)d[m].className&&R.isString(d[m].className)&&n(d[m],E)&&(w[x++]=d[m]);continue}var k=s.match(uV);if(k){c=k[1];var O=k[2],T=k[3],L=k[4];for(c||(c="*"),d=[],p=0,m=0;m<w.length;m++)for(c=="*"?_=e(w[m]):_=w[m].getElementsByTagName(c),v=0;v<_.length;v++)d[p++]=_[v];w=[],x=0;var B;switch(T){case"=":B=function(z){return z.getAttribute(O)==L};break;case"~":B=function(z){return z.getAttribute(O).match(new RegExp("\\b"+L+"\\b"))};break;case"|":B=function(z){return z.getAttribute(O).match(new RegExp("^"+L+"-?"))};break;case"^":B=function(z){return z.getAttribute(O).indexOf(L)===0};break;case"$":B=function(z){return z.getAttribute(O).lastIndexOf(L)==z.getAttribute(O).length-L.length};break;case"*":B=function(z){return z.getAttribute(O).indexOf(L)>-1};break;default:B=function(z){return z.getAttribute(O)}}for(w=[],x=0,m=0;m<d.length;m++)B(d[m])&&(w[x++]=d[m]);continue}for(c=s,d=[],p=0,m=0;m<w.length;m++)for(_=w[m].getElementsByTagName(c),v=0;v<_.length;v++)d[p++]=_[v];w=d}return w}return function(i){return R.isElement(i)?[i]:R.isObject(i)&&!R.isUndefined(i.length)?i:r.call(this,i)}}();var cV=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_source_platform","utm_campaign_id","utm_creative_format","utm_marketing_tactic"],fV=["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(cV,function(r){t=R.getQueryParam(Vt.URL,r),t.length?n[r]=t:e!==void 0&&(n[r]=e)}),n},clickParams:function(){var e="",t={};return R.each(fV,function(n){e=R.getQueryParam(Vt.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 s=e.match(o);return s?parseFloat(s[s.length-2]):null},os:function(){var e=Po;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 ze.location.href},properties:function(e){return typeof e!="object"&&(e={}),R.extend(R.strip_empty_properties({$os:R.info.os(),$browser:R.info.browser(Po,Da.vendor,$p),$referrer:Vt.referrer,$referring_domain:R.info.referringDomain(Vt.referrer),$device:R.info.device(Po)}),{$current_url:R.info.currentUrl(),$browser_version:R.info.browserVersion(Po,Da.vendor,$p),$screen_height:cO.height,$screen_width:cO.width,mp_lib:"web",$lib_version:Hi.LIB_VERSION,$insert_id:Nb(),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(Po,Da.vendor,$p)}),{$browser_version:R.info.browserVersion(Po,Da.vendor,$p)})},mpPageViewProperties:function(){return R.strip_empty_properties({current_page_title:Vt.title,current_domain:ze.location.hostname,current_url_path:ze.location.pathname,current_url_protocol:ze.location.protocol,current_url_search:ze.location.search})}};var dV=function(e,t){var n=null,r=[];return function(i){var o=this;return r.push(i),n||(n=new jt(function(s){setTimeout(function(){var u=e.apply(o,[r]);n=null,r=[],s(u)},t)})),n}},Nb=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},hV=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,pV=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,vO=function(e){var t=pV,n=e.split("."),r=n[n.length-1];(r.length>4||r==="com"||r==="org")&&(t=hV);var i=e.match(t);return i?i[0]:""},gV=function(){var e=ze.navigator.onLine;return R.isUndefined(e)||e},$a=function(){},Yl=null,Lp=null;typeof JSON<"u"&&(Yl=JSON.stringify,Lp=JSON.parse),Yl=Yl||R.JSONEncode,Lp=Lp||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=Ta;var mV="mixpanelBrowserDb",yO="mixpanelRecordingEvents",Pb="mixpanelRecordingRegistry",vV=1,yV=[yO,Pb],uo=function(e){this.dbPromise=null,this.storeName=e};uo.prototype._openDb=function(){return new jt(function(e,t){var n=ze.indexedDB.open(mV,vV);n.onerror=function(){t(n.error)},n.onsuccess=function(){e(n.result)},n.onupgradeneeded=function(r){var i=r.target.result;yV.forEach(function(o){i.createObjectStore(o)})}})},uo.prototype.init=function(){return ze.indexedDB?(this.dbPromise||(this.dbPromise=this._openDb()),this.dbPromise.then(function(e){return e instanceof ze.IDBDatabase?jt.resolve():jt.reject(e)})):jt.reject("indexedDB is not supported in this browser")},uo.prototype.makeTransaction=function(e,t){var n=this.storeName,r=function(i){return new jt(function(o,s){var u=i.transaction(n,e);u.oncomplete=function(){o(u)},u.onabort=u.onerror=function(){s(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))},uo.prototype.setItem=function(e,t){return this.makeTransaction("readwrite",function(n){n.put(t,e)})},uo.prototype.getItem=function(e){var t;return this.makeTransaction("readonly",function(n){t=n.get(e)}).then(function(){return t.result})},uo.prototype.removeItem=function(e){return this.makeTransaction("readwrite",function(t){t.delete(e)})},uo.prototype.getAll=function(){var e;return this.makeTransaction("readonly",function(t){e=t.getAll()}).then(function(){return e.result})};var _V="__mp_opt_in_out_";function bV(e,t){SO(!0,e,t)}function SV(e,t){SO(!1,e,t)}function wV(e,t){return bO(e,t)==="1"}function _O(e,t){if(CV(t))return Ut.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=bO(e,t)==="0";return n&&Ut.warn("You are opted out of Mixpanel tracking. This will prevent the Mixpanel SDK from sending any data."),n}function La(e){return Ub(e,function(t){return this.get_config(t)})}function Na(e){return Ub(e,function(t){return this._get_config(t)})}function Wl(e){return Ub(e,function(t){return this._get_config(t)})}function xV(e,t){t=t||{},Bb(t).remove(Fb(e,t),!!t.crossSubdomainCookie,t.cookieDomain)}function Bb(e){return e=e||{},e.persistenceType==="localStorage"?R.localStorage:R.cookie}function Fb(e,t){return t=t||{},(t.persistencePrefix||_V)+e}function bO(e,t){return Bb(t).get(Fb(e,t))}function CV(e){if(e&&e.ignoreDnt)return!1;var t=e&&e.window||ze,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 SO(e,t,n){if(!R.isString(t)||!t.length){Ut.error("gdpr."+(e?"optIn":"optOut")+" called with an invalid token");return}n=n||{},Bb(n).set(Fb(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 Ub(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"),s=t.call(this,"opt_out_tracking_cookie_prefix"),u=t.call(this,"window");r&&(n=_O(r,{ignoreDnt:i,persistenceType:o,persistencePrefix:s,window:u}))}catch(d){Ut.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 EV=Zl("lock"),wO=function(e,t){t=t||{},this.storageKey=e,this.storage=t.storage||ze.localStorage,this.pollIntervalMS=t.pollIntervalMS||100,this.timeoutMS=t.timeoutMS||2e3,this.promiseImpl=t.promiseImpl||jt};wO.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(),s=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()-s>d){EV.error("Timeout waiting for mutex on "+u+"; clearing lock. ["+o+"]"),p.removeItem(v),p.removeItem(m),b();return}setTimeout(function(){try{E()}catch(k){i(k)}},c*(Math.random()+.1))},x=function(E,k){E()?k():_(function(){x(E,k)})},w=function(){var E=p.getItem(m);return E&&E!==o?!1:(p.setItem(m,o),p.getItem(m)===o?!0:(ff(p,!0)||i(new Error("localStorage support dropped while acquiring lock")),!1))},b=function(){p.setItem(h,o),x(w,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(k){E(),r(k)}).catch(function(k){E(),i(k)})};try{if(ff(p,!0))b();else throw new Error("localStorage support check failed")}catch(E){i(E)}},this))};var df=function(e){this.storage=e||ze.localStorage};df.prototype.init=function(){return jt.resolve()},df.prototype.setItem=function(e,t){return new jt(R.bind(function(n,r){try{this.storage.setItem(e,Yl(t))}catch(i){r(i)}n()},this))},df.prototype.getItem=function(e){return new jt(R.bind(function(t,n){var r;try{r=Lp(this.storage.getItem(e))}catch(i){n(i)}t(r)},this))},df.prototype.removeItem=function(e){return new jt(R.bind(function(t,n){try{this.storage.removeItem(e)}catch(r){n(r)}t()},this))};var xO=Zl("batch"),co=function(e,t){t=t||{},this.storageKey=e,this.usePersistence=t.usePersistence,this.usePersistence&&(this.queueStorage=t.queueStorage||new df,this.lock=new wO(e,{storage:t.sharedLockStorage||ze.localStorage,timeoutMS:t.sharedLockTimeoutMS})),this.reportError=t.errorReporter||R.bind(xO.error,xO),this.pid=t.pid||null,this.memQueue=[],this.initialized=!1,t.enqueueThrottleMs?this.enqueuePersisted=dV(R.bind(this._enqueuePersisted,this),t.enqueueThrottleMs):this.enqueuePersisted=R.bind(function(n){return this._enqueuePersisted([n])},this)};co.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))},co.prototype.enqueue=function(e,t){var n={id:Nb(),flushAfter:new Date().getTime()+t*2,payload:e};return this.usePersistence?this.enqueuePersisted(n):(this.memQueue.push(n),jt.resolve(!0))},co.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))},co.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(s){r[s.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 CO=function(e,t){var n=[];return R.each(e,function(r){r.id&&!t[r.id]&&n.push(r)}),n};co.prototype.removeItemsByID=function(e){var t={};if(R.each(e,function(r){t[r]=!0}),this.memQueue=CO(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=CO(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),ff(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 EO=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};co.prototype.updatePayloads=function(e){return this.memQueue=EO(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=EO(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)},co.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))},co.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))},co.prototype.clear=function(){return this.memQueue=[],this.usePersistence?this.ensureInit().then(R.bind(function(){return this.queueStorage.removeItem(this.storageKey)},this)):jt.resolve()};var kV=10*60*1e3,hf=Zl("batch"),yi=function(e,t){this.errorReporter=t.errorReporter,this.queue=new co(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};yi.prototype.enqueue=function(e){return this.queue.enqueue(e,this.flushInterval)},yi.prototype.start=function(){return this.stopped=!1,this.consecutiveRemovalFailures=0,this.flush()},yi.prototype.stop=function(){this.stopped=!0,this.timeoutID&&(clearTimeout(this.timeoutID),this.timeoutID=null)},yi.prototype.clear=function(){return this.queue.clear()},yi.prototype.resetBatchSize=function(){this.batchSize=this.libConfig.batch_size},yi.prototype.resetFlush=function(){this.scheduleFlush(this.libConfig.batch_flush_interval_ms)},yi.prototype.scheduleFlush=function(e){this.flushInterval=e,this.stopped||(this.timeoutID=setTimeout(R.bind(function(){this.stopped||(this._flushPromise=this.flush())},this),this.flushInterval))},yi.prototype.sendRequestPromise=function(e,t){return new jt(R.bind(function(n){this.sendRequest(e,t,n)},this))},yi.prototype.flush=function(e){if(this.requestInProgress)return hf.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,s=[],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:Hi.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&&s.push(m)}u[h.id]=m},this),s.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&&!gV()||h.error==="timeout")){var m=this.flushInterval*2;return h.retryAfter&&(m=parseInt(h.retryAfter,10)*1e3||m),m=Math.min(kV,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"),hf.log("MIXPANEL REQUEST:",s),this.sendRequestPromise(s,p).then(d)},this)).catch(R.bind(function(i){this.reportError("Error flushing request queue",i),this.resetFlush()},this))},yi.prototype.reportError=function(e,t){if(hf.error.apply(hf.error,arguments),this.errorReporter)try{t instanceof Error||(t=new Error(e)),this.errorReporter(e,t)}catch(n){hf.error(n)}};var zb=function(e){var t=Date.now();return!e||t>e.maxExpires||t>e.idleExpires},AV=250,Kl=Zl("recorder"),kO=ze.CompressionStream,IV={batch_size:1e3,batch_flush_interval_ms:10*1e3,batch_request_timeout_ms:90*1e3,batch_autostart:!0},RV=new Set([ft.MouseMove,ft.MouseInteraction,ft.Scroll,ft.ViewportResize,ft.Input,ft.TouchMove,ft.MediaInteraction,ft.Drag,ft.Selection]);function OV(e){return e.type===Dt.IncrementalSnapshot&&RV.has(e.data.source)}var xr=function(e){this._mixpanel=e.mixpanelInstance,this._onIdleTimeout=e.onIdleTimeout||$a,this._onMaxLengthReached=e.onMaxLengthReached||$a,this._onBatchSent=e.onBatchSent||$a,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=uf,this.recordMinMs=0;var t=ff(e.sharedLockStorage,!0);this.batcherKey="__mprec_"+this.getConfig("name")+"_"+this.getConfig("token")+"_"+this.replayId,this.queueStorage=new uo(yO),this.batcher=new yi(this.batcherKey,{errorReporter:this.reportError.bind(this),flushOnlyOnInterval:!0,libConfig:IV,sendRequestFunc:this.flushEventsWithOptOut.bind(this),queueStorage:this.queueStorage,sharedLockStorage:e.sharedLockStorage,usePersistence:t,stopAllBatchingFunc:this.stopRecording.bind(this),enqueueThrottleMs:AV,sharedLockTimeoutMS:10*1e3})};xr.prototype.unloadPersistedData=function(){return this.batcher.stop(),this.batcher.flush().then((function(){return this.queueStorage.removeItem(this.batcherKey)}).bind(this))},xr.prototype.getConfig=function(e){return this._mixpanel.get_config(e)},xr.prototype.get_config=function(e){return this.getConfig(e)},xr.prototype.startRecording=function(e){if(this._rrwebRecord===null){this.reportError("rrweb record function not provided. ");return}if(this._stopRecording!==null){Kl.log("Recording already in progress, skipping startRecording.");return}this.recordMaxMs=this.getConfig("record_max_ms"),this.recordMaxMs>uf&&(this.recordMaxMs=uf,Kl.critical("record_max_ms cannot be greater than "+uf+"ms. Capping value.")),this.maxExpires||(this.maxExpires=new Date().getTime()+this.recordMaxMs),this.recordMinMs=this.getConfig("record_min_ms"),this.recordMinMs>Rb&&(this.recordMinMs=Rb,Kl.critical("record_min_ms cannot be greater than "+Rb+"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}OV(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)},xr.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},xr.prototype.isRrwebStopped=function(){return this._stopRecording===null},xr.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)},xr.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}},xr.deserialize=function(e,t){var n=new xr(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},xr.prototype._sendRequest=function(e,t,n,r){var i=(function(o,s){o.status===200&&this.replayId===e&&(this.seqNo++,this.batchStartUrl=R.info.currentUrl()),this._onBatchSent(),r({status:0,httpStatusCode:o.status,responseBody:s,retryAfter:o.headers.get("Retry-After")})}).bind(this);ze.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(s){i(o,s)}).catch(function(s){r({error:s})})}).catch(function(o){r({error:o,httpStatusCode:0})})},xr.prototype._flushEvents=La(function(e,t,n){var r=e.length;if(r>0){for(var i=this.replayId,o=1/0,s=-1/0,u=!1,c=0;c<r;c++)o=Math.min(o,e[c].timestamp),s=Math.max(s,e[c].timestamp),e[c].type===Dt.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=s-this.replayStartTime,p={$current_url:this.batchStartUrl,$lib_version:Hi.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),kO){var _=new Blob([h],{type:"application/json"}).stream(),x=_.pipeThrough(new kO("gzip"));new Response(x).blob().then((function(w){p.format="gzip",this._sendRequest(i,p,w,n)}).bind(this))}else p.format="body",this._sendRequest(i,p,h,n)}}),xr.prototype.reportError=function(e,t){Kl.error.apply(Kl.error,arguments);try{!t&&!(e instanceof Error)&&(e=new Error(e)),this.getConfig("error_reporter")(e,t)}catch(n){Kl.error(n)}};var Ql=function(e){this.idb=new uo(Pb),this.errorReporter=e.errorReporter,this.mixpanelInstance=e.mixpanelInstance,this.sharedLockStorage=e.sharedLockStorage};Ql.prototype.handleError=function(e){this.errorReporter("IndexedDB error: ",e)},Ql.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())},Ql.prototype.getActiveRecording=function(){return this.idb.init().then((function(){return this.idb.getItem(this.mixpanelInstance.get_tab_id())}).bind(this)).then((function(e){return zb(e)?null:e}).bind(this)).catch(this.handleError.bind(this))},Ql.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))},Ql.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 zb(n)}).map((function(n){var r=xr.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 pf=Zl("recorder"),Bo=function(e,t,n){this.mixpanelInstance=e,this.rrwebRecord=t||Ra,this.sharedLockStorage=n,this.recordingRegistry=new Ql({mixpanelInstance:this.mixpanelInstance,errorReporter:pf.error,sharedLockStorage:n}),this._flushInactivePromise=this.recordingRegistry.flushInactiveRecordings(),this.activeRecording=null};Bo.prototype.startRecording=function(e){if(e=e||{},this.activeRecording&&!this.activeRecording.isRrwebStopped()){pf.log("Recording already in progress, skipping startRecording.");return}var t=(function(){pf.log("Idle timeout reached, restarting recording."),this.resetRecording()}).bind(this),n=(function(){pf.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=xr.deserialize(e.activeSerializedRecording,i):this.activeRecording=new xr(i),this.activeRecording.startRecording(e.shouldStopBatcher),this.recordingRegistry.setActiveRecording(this.activeRecording.serialize())},Bo.prototype.stopRecording=function(){var e=this._stopCurrentRecording(!1);return this.recordingRegistry.clearActiveRecording(),this.activeRecording=null,e},Bo.prototype.pauseRecording=function(){return this._stopCurrentRecording(!1)},Bo.prototype._stopCurrentRecording=function(e){return this.activeRecording?this.activeRecording.stopRecording(e):jt.resolve()},Bo.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}):(pf.log("No resumable recording found."),null)}).bind(this))},Bo.prototype.resetRecording=function(){this.stopRecording(),this.startRecording({shouldStopBatcher:!0})},Bo.prototype.getActiveReplayId=function(){return this.activeRecording&&!this.activeRecording.isRrwebStopped()?this.activeRecording.replayId:null},Object.defineProperty(Bo.prototype,"replayId",{get:function(){return this.getActiveReplayId()}}),ze.__mp_recorder=Bo;var Np="change",gf="click",AO="hashchange",Xl="mp_locationchange",IO="popstate",RO="scrollend",qb="submit",TV=["clientX","clientY","offsetX","offsetY","pageX","pageY","screenX","screenY","x","y"],OO=["mp-include"],jb=["mp-no-track"],TO=jb.concat(["mp-sensitive"]),MV=["aria-label","aria-labelledby","aria-describedby","href","name","role","title","type"],qr=Zl("autocapture");function Hb(e){for(var t={},n=MO(e).split(" "),r=0;r<n.length;r++){var i=n[r];i&&(t[i]=!0)}return t}function MO(e){switch(typeof e.className){case"string":return e.className;case"object":return e.className.baseVal||e.getAttribute("class")||"";default:return""}}function DV(e){if(e.previousElementSibling)return e.previousElementSibling;do e=e.previousSibling;while(e&&!LO(e));return e}function DO(e,t,n,r,i,o){var s={$classes:MO(e).split(" "),$tag_name:e.tagName.toLowerCase()},u=e.id;u&&(s.$id=u),Zb(e,t,i,o)&&R.each(MV.concat(r),function(h){if(e.hasAttribute(h)&&!n[h]){var m=e.getAttribute(h);Pp(m)&&(s["$attr-"+h]=m)}});for(var c=1,d=1,p=e;p=DV(p);)c++,p.tagName===e.tagName&&d++;return s.$nth_child=c,s.$nth_of_type=d,s}function $V(e,t){var n=t.allowElementCallback,r=t.allowSelectors||[],i=t.blockAttrs||[],o=t.blockElementCallback,s=t.blockSelectors||[],u=t.captureTextContent||!1,c=t.captureExtraAttrs||[],d={};R.each(i,function(k){d[k]=!0});var p=null,h=typeof e.target>"u"?e.srcElement:e.target;if(NO(h)&&(h=h.parentNode),PV(h,e)&&Gb(h,e,n,r)&&!Vb(h,e,o,s)){for(var m=[h],v=h;v.parentNode&&!fo(v,"body");)m.push(v.parentNode),v=v.parentNode;var _=[],x,w=!1;if(R.each(m,function(k){var O=Zb(k,e,n,r);!d.href&&k.tagName.toLowerCase()==="a"&&(x=k.getAttribute("href"),x=O&&Pp(x)&&x),Vb(k,e,o,s)&&(w=!0),_.push(DO(k,e,d,c,n,r))},this),!w){var b=Vt.documentElement;if(p={$event_type:e.type,$host:ze.location.host,$pathname:ze.location.pathname,$elements:_,$el_attr__href:x,$viewportHeight:Math.max(b.clientHeight,ze.innerHeight||0),$viewportWidth:Math.max(b.clientWidth,ze.innerWidth||0)},R.each(c,function(k){if(!d[k]&&h.hasAttribute(k)){var O=h.getAttribute(k);Pp(O)&&(p["$el_attr__"+k]=O)}}),u&&(C=$O(h,e,n,r),C&&C.length&&(p.$el_text=C)),e.type===gf&&(R.each(TV,function(k){k in e&&(p["$"+k]=e[k])}),h=LV(e)),u){var C=$O(h,e,n,r);C&&C.length&&(p.$el_text=C)}if(h){if(!Gb(h,e,n,r)||Vb(h,e,o,s))return null;var E=DO(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 $O(e,t,n,r){var i="";return Zb(e,t,n,r)&&e.childNodes&&e.childNodes.length&&R.each(e.childNodes,function(o){NO(o)&&o.textContent&&(i+=R.trim(o.textContent).split(/(\s+)/).filter(Pp).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255))}),R.trim(i)}function LV(e){for(var t=e.target,n=e.composedPath(),r=0;r<n.length;r++){var i=n[r];if(fo(i,"a")||fo(i,"button")||fo(i,"input")||fo(i,"select")||i.getAttribute&&i.getAttribute("role")==="button"){t=i;break}if(i===t)break}return t}function Gb(e,t,n,r){if(n)try{if(!n(e,t))return!1}catch(s){return qr.critical("Error while checking element in allowElementCallback",s),!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(s){qr.critical("Error while checking selector: "+o,s)}}return!1}function Vb(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 s=Hb(e);for(i=0;i<jb.length;i++)if(s[jb[i]])return!0;return!1}function LO(e){return e&&e.nodeType===1}function fo(e,t){return e&&e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function NO(e){return e&&e.nodeType===3}function NV(){try{var e=Vt.createElement("div");return!!e.matches}catch{return!1}}function PV(e,t){if(!e||fo(e,"html")||!LO(e))return!1;var n=e.tagName.toLowerCase();switch(n){case"form":return t.type===qb;case"input":return["button","submit"].indexOf(e.getAttribute("type"))===-1?t.type===Np:t.type===gf;case"select":case"textarea":return t.type===Np;default:return t.type===gf}}function Zb(e,t,n,r){var i;if(!Gb(e,t,n,r))return!1;for(var o=e;o.parentNode&&!fo(o,"body");o=o.parentNode){var s=Hb(o);for(i=0;i<TO.length;i++)if(s[TO[i]])return!1}var u=Hb(e);for(i=0;i<OO.length;i++)if(u[OO[i]])return!0;if(fo(e,"input")||fo(e,"select")||fo(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 Pp(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 PO="autocapture",BV="track_pageview",BO="full-url",FV="url-with-path-and-query-string",UV="url-with-path",zV="allow_element_callback",FO="allow_selectors",UO="allow_url_regexes",zO="block_attrs",qO="block_element_callback",jO="block_selectors",HO="block_url_regexes",GO="capture_extra_attrs",VO="capture_text_content",ZO="scroll_capture_all",YO="scroll_depth_percent_checkpoints",Yb="click",Wb="input",WO="pageview",Kb="scroll",Qb="submit",lr={};lr[FO]=[],lr[UO]=[],lr[zO]=[],lr[qO]=null,lr[jO]=[],lr[HO]=[],lr[GO]=[],lr[VO]=!1,lr[ZO]=!1,lr[YO]=[25,50,75,100],lr[Yb]=!0,lr[Wb]=!0,lr[WO]=BO,lr[Kb]=!0,lr[Qb]=!0;var Bp={$mp_autocapture:!0},qV="$mp_click",jV="$mp_input_change",HV="$mp_scroll",GV="$mp_submit",ti=function(e){this.mp=e};ti.prototype.init=function(){if(!NV()){qr.critical("Autocapture unavailable: missing required DOM APIs");return}this.initPageviewTracking(),this.initClickTracking(),this.initInputTracking(),this.initScrollTracking(),this.initSubmitTracking()},ti.prototype.getFullConfig=function(){var e=this.mp.get_config(PO);return e?R.isObject(e)?R.extend({},lr,e):lr:{}},ti.prototype.getConfig=function(e){return this.getFullConfig()[e]},ti.prototype.currentUrlBlocked=function(){var e,t=R.info.currentUrl(),n=this.getConfig(UO)||[];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(s){return qr.critical("Error while checking block URL regex: "+i,s),!0}}if(!r)return!0}var o=this.getConfig(HO)||[];if(!o||!o.length)return!1;for(e=0;e<o.length;e++)try{if(t.match(o[e]))return!0}catch(s){return qr.critical("Error while checking block URL regex: "+o[e],s),!0}return!1},ti.prototype.pageviewTrackingConfig=function(){return this.mp.get_config(PO)?this.getConfig(WO):this.mp.get_config(BV)},ti.prototype.trackDomEvent=function(e,t){if(!this.currentUrlBlocked()){var n=$V(e,{allowElementCallback:this.getConfig(zV),allowSelectors:this.getConfig(FO),blockAttrs:this.getConfig(zO),blockElementCallback:this.getConfig(qO),blockSelectors:this.getConfig(jO),captureExtraAttrs:this.getConfig(GO),captureTextContent:this.getConfig(VO)});n&&(R.extend(n,Bp),this.mp.track(t,n))}},ti.prototype.initClickTracking=function(){ze.removeEventListener(gf,this.listenerClick),this.getConfig(Yb)&&(qr.log("Initializing click tracking"),this.listenerClick=ze.addEventListener(gf,(function(e){this.getConfig(Yb)&&this.trackDomEvent(e,qV)}).bind(this)))},ti.prototype.initInputTracking=function(){ze.removeEventListener(Np,this.listenerChange),this.getConfig(Wb)&&(qr.log("Initializing input tracking"),this.listenerChange=ze.addEventListener(Np,(function(e){this.getConfig(Wb)&&this.trackDomEvent(e,jV)}).bind(this)))},ti.prototype.initPageviewTracking=function(){if(ze.removeEventListener(IO,this.listenerPopstate),ze.removeEventListener(AO,this.listenerHashchange),ze.removeEventListener(Xl,this.listenerLocationchange),!!this.pageviewTrackingConfig()){qr.log("Initializing pageview tracking");var e="",t=!1;this.currentUrlBlocked()||(t=this.mp.track_pageview(Bp)),t&&(e=R.info.currentUrl()),this.listenerPopstate=ze.addEventListener(IO,function(){ze.dispatchEvent(new Event(Xl))}),this.listenerHashchange=ze.addEventListener(AO,function(){ze.dispatchEvent(new Event(Xl))});var n=ze.history.pushState;typeof n=="function"&&(ze.history.pushState=function(i,o,s){n.call(ze.history,i,o,s),ze.dispatchEvent(new Event(Xl))});var r=ze.history.replaceState;typeof r=="function"&&(ze.history.replaceState=function(i,o,s){r.call(ze.history,i,o,s),ze.dispatchEvent(new Event(Xl))}),this.listenerLocationchange=ze.addEventListener(Xl,Db((function(){if(!this.currentUrlBlocked()){var i=R.info.currentUrl(),o=!1,s=i.split("#")[0].split("?")[0]!==e.split("#")[0].split("?")[0],u=this.pageviewTrackingConfig();if(u===BO?o=i!==e:u===FV?o=i.split("#")[0]!==e.split("#")[0]:u===UV&&(o=s),o){var c=this.mp.track_pageview(Bp);c&&(e=i),s&&(this.lastScrollCheckpoint=0,qr.log("Path change: re-initializing scroll depth checkpoints"))}}}).bind(this)))}},ti.prototype.initScrollTracking=function(){ze.removeEventListener(RO,this.listenerScroll),this.getConfig(Kb)&&(qr.log("Initializing scroll tracking"),this.lastScrollCheckpoint=0,this.listenerScroll=ze.addEventListener(RO,Db((function(){if(this.getConfig(Kb)&&!this.currentUrlBlocked()){var e=this.getConfig(ZO),t=(this.getConfig(YO)||[]).slice().sort(function(c,d){return c-d}),n=ze.scrollY,r=R.extend({$scroll_top:n},Bp);try{var i=Vt.body.scrollHeight,o=Math.round(n/(i-ze.innerHeight)*100);if(r.$scroll_height=i,r.$scroll_percentage=o,o>this.lastScrollCheckpoint)for(var s=0;s<t.length;s++){var u=t[s];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(HV,r)}}).bind(this))))},ti.prototype.initSubmitTracking=function(){ze.removeEventListener(qb,this.listenerSubmit),this.getConfig(Qb)&&(qr.log("Initializing submit tracking"),this.listenerSubmit=ze.addEventListener(qb,(function(e){this.getConfig(Qb)&&this.trackDomEvent(e,GV)}).bind(this)))},sV(ti);var Fo=function(){};Fo.prototype.create_properties=function(){},Fo.prototype.event_handler=function(){},Fo.prototype.after_track_handler=function(){},Fo.prototype.init=function(e){return this.mp=e,this},Fo.prototype.track=function(e,t,n,r){var i=this,o=R.dom_query(e);if(o.length===0){Ut.error("The DOM query ("+e+") returned 0 elements");return}return R.each(o,function(s){R.register_event(s,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},Fo.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))}},Fo.prototype.create_properties=function(e,t){var n;return typeof e=="function"?n=e(t):n=R.extend({},e),n};var Jl=function(){this.override_event="click"};R.inherit(Jl,Fo),Jl.prototype.create_properties=function(e,t){var n=Jl.superclass.create_properties.apply(this,arguments);return t.href&&(n.url=t.href),n},Jl.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()},Jl.prototype.after_track_handler=function(e,t){t.new_tab||setTimeout(function(){window.location=t.href},0)};var Fp=function(){this.override_event="submit"};R.inherit(Fp,Fo),Fp.prototype.event_handler=function(e,t,n){n.element=t,e.preventDefault()},Fp.prototype.after_track_handler=function(e,t){setTimeout(function(){t.element.submit()},0)};var Pa="$set",eu="$set_once",Gi="$unset",$s="$add",ho="$append",Ls="$union",Uo="$remove",VV="$delete",KO={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[Pa]=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[Gi]=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[eu]=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[Ls]=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[ho]=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[Uo]=r,n},delete_action:function(){var e={};return e[VV]="",e}},pn=function(){};R.extend(pn.prototype,KO),pn.prototype._init=function(e,t,n){this._mixpanel=e,this._group_key=t,this._group_id=n},pn.prototype.set=Wl(function(e,t,n){var r=this.set_action(e,t);return R.isObject(e)&&(n=t),this._send_request(r,n)}),pn.prototype.set_once=Wl(function(e,t,n){var r=this.set_once_action(e,t);return R.isObject(e)&&(n=t),this._send_request(r,n)}),pn.prototype.unset=Wl(function(e,t){var n=this.unset_action(e);return this._send_request(n,t)}),pn.prototype.union=Wl(function(e,t,n){R.isObject(e)&&(n=t);var r=this.union_action(e,t);return this._send_request(r,n)}),pn.prototype.delete=Wl(function(e){var t=this.delete_action();return this._send_request(t,e)}),pn.prototype.remove=Wl(function(e,t,n){var r=this.remove_action(e,t);return this._send_request(r,n)}),pn.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)},pn.prototype._is_reserved_property=function(e){return e==="$group_key"||e==="$group_id"},pn.prototype._get_config=function(e){return this._mixpanel.get_config(e)},pn.prototype.toString=function(){return this._mixpanel.toString()+".group."+this._group_key+"."+this._group_id},pn.prototype.remove=pn.prototype.remove,pn.prototype.set=pn.prototype.set,pn.prototype.set_once=pn.prototype.set_once,pn.prototype.union=pn.prototype.union,pn.prototype.unset=pn.prototype.unset,pn.prototype.toString=pn.prototype.toString;var dt=function(){};R.extend(dt.prototype,KO),dt.prototype._init=function(e){this._mixpanel=e},dt.prototype.set=Na(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[Pa]=R.extend({},R.info.people_properties(),r[Pa]),this._send_request(r,n)}),dt.prototype.set_once=Na(function(e,t,n){var r=this.set_once_action(e,t);return R.isObject(e)&&(n=t),this._send_request(r,n)}),dt.prototype.unset=Na(function(e,t){var n=this.unset_action(e);return this._send_request(n,t)}),dt.prototype.increment=Na(function(e,t,n){var r={},i={};return R.isObject(e)?(R.each(e,function(o,s){if(!this._is_reserved_property(s))if(isNaN(parseFloat(o))){Ut.error("Invalid increment value passed to mixpanel.people.increment - must be a number");return}else i[s]=o},this),n=t):(R.isUndefined(t)&&(t=1),i[e]=t),r[$s]=i,this._send_request(r,n)}),dt.prototype.append=Na(function(e,t,n){R.isObject(e)&&(n=t);var r=this.append_action(e,t);return this._send_request(r,n)}),dt.prototype.remove=Na(function(e,t,n){R.isObject(e)&&(n=t);var r=this.remove_action(e,t);return this._send_request(r,n)}),dt.prototype.union=Na(function(e,t,n){R.isObject(e)&&(n=t);var r=this.union_action(e,t);return this._send_request(r,n)}),dt.prototype.track_charge=Na(function(e,t,n){if(!R.isNumber(e)&&(e=parseFloat(e),isNaN(e))){Ut.error("Invalid value passed to mixpanel.people.track_charge - must be a number");return}return this.append("$transactions",R.extend({$amount:e},t),n)}),dt.prototype.clear_charges=function(e){return this.set("$transactions",[],e)},dt.prototype.delete_user=function(){if(!this._identify_called()){Ut.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)},dt.prototype.toString=function(){return this._mixpanel.toString()+".people"},dt.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))},dt.prototype._get_config=function(e){return this._mixpanel.get_config(e)},dt.prototype._identify_called=function(){return this._mixpanel._flags.identify_called===!0},dt.prototype._enqueue=function(e){Pa in e?this._mixpanel.persistence._add_to_people_queue(Pa,e):eu in e?this._mixpanel.persistence._add_to_people_queue(eu,e):Gi in e?this._mixpanel.persistence._add_to_people_queue(Gi,e):$s in e?this._mixpanel.persistence._add_to_people_queue($s,e):ho in e?this._mixpanel.persistence._add_to_people_queue(ho,e):Uo in e?this._mixpanel.persistence._add_to_people_queue(Uo,e):Ls in e?this._mixpanel.persistence._add_to_people_queue(Ls,e):Ut.error("Invalid call to _enqueue():",e)},dt.prototype._flush_one_queue=function(e,t,n,r){var i=this,o=R.extend({},this._mixpanel.persistence.load_queue(e)),s=o;!R.isUndefined(o)&&R.isObject(o)&&!R.isEmptyObject(o)&&(i._mixpanel.persistence._pop_from_people_queue(e,o),i._mixpanel.persistence.save(),r&&(s=r(o)),t.call(i,s,function(u,c){u===0&&i._mixpanel.persistence._add_to_people_queue(e,o),R.isUndefined(n)||n(u,c)}))},dt.prototype._flush=function(e,t,n,r,i,o,s){var u=this;this._flush_one_queue(Pa,this.set,e),this._flush_one_queue(eu,this.set_once,r),this._flush_one_queue(Gi,this.unset,o,function(w){return R.keys(w)}),this._flush_one_queue($s,this.increment,t),this._flush_one_queue(Ls,this.union,i);var c=this._mixpanel.persistence.load_queue(ho);if(!R.isUndefined(c)&&R.isArray(c)&&c.length)for(var d,p=function(w,b){w===0&&u._mixpanel.persistence._add_to_people_queue(ho,d),R.isUndefined(n)||n(w,b)},h=c.length-1;h>=0;h--)c=this._mixpanel.persistence.load_queue(ho),d=c.pop(),u._mixpanel.persistence.save(),R.isEmptyObject(d)||u.append(d,p);var m=this._mixpanel.persistence.load_queue(Uo);if(!R.isUndefined(m)&&R.isArray(m)&&m.length)for(var v,_=function(w,b){w===0&&u._mixpanel.persistence._add_to_people_queue(Uo,v),R.isUndefined(s)||s(w,b)},x=m.length-1;x>=0;x--)m=this._mixpanel.persistence.load_queue(Uo),v=m.pop(),u._mixpanel.persistence.save(),R.isEmptyObject(v)||u.remove(v,_)},dt.prototype._is_reserved_property=function(e){return e==="$distinct_id"||e==="$token"||e==="$device_id"||e==="$user_id"||e==="$had_persisted_distinct_id"},dt.prototype.set=dt.prototype.set,dt.prototype.set_once=dt.prototype.set_once,dt.prototype.unset=dt.prototype.unset,dt.prototype.increment=dt.prototype.increment,dt.prototype.append=dt.prototype.append,dt.prototype.remove=dt.prototype.remove,dt.prototype.union=dt.prototype.union,dt.prototype.track_charge=dt.prototype.track_charge,dt.prototype.clear_charges=dt.prototype.clear_charges,dt.prototype.delete_user=dt.prototype.delete_user,dt.prototype.toString=dt.prototype.toString;var Xb="__mps",Jb="__mpso",e1="__mpus",t1="__mpa",n1="__mpap",r1="__mpr",i1="__mpu",QO="$people_distinct_id",Up="__alias",mf="__timers",ZV=[Xb,Jb,e1,t1,n1,r1,i1,QO,Up,mf],xt=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"&&(Ut.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()};xt.prototype.properties=function(){var e={};return this.load(),R.each(this.props,function(t,n){R.include(ZV,n)||(e[n]=t)}),e},xt.prototype.load=function(){if(!this.disabled){var e=this.storage.parse(this.name);e&&(this.props=R.extend({},e))}},xt.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))},xt.prototype.save=function(){this.disabled||this.storage.set(this.name,Yl(this.props),this.expire_days,this.cross_subdomain,this.secure,this.cross_site,this.cookie_domain)},xt.prototype.load_prop=function(e){return this.load(),this.props[e]},xt.prototype.remove=function(){this.storage.remove(this.name,!1,this.cookie_domain),this.storage.remove(this.name,!0,this.cookie_domain)},xt.prototype.clear=function(){this.remove(),this.props={}},xt.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},xt.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},xt.prototype.unregister=function(e){this.load(),e in this.props&&(delete this.props[e],this.save())},xt.prototype.update_search_keyword=function(e){this.register(R.info.searchInfo(e))},xt.prototype.update_referrer_info=function(e){this.register_once({$initial_referrer:e||"$direct",$initial_referring_domain:R.info.referringDomain(e)||"$direct"},"")},xt.prototype.get_referrer_info=function(){return R.strip_empty_properties({$initial_referrer:this.props.$initial_referrer,$initial_referring_domain:this.props.$initial_referring_domain})},xt.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)},xt.prototype.set_disabled=function(e){this.disabled=e,this.disabled?this.remove():this.save()},xt.prototype.set_cookie_domain=function(e){e!==this.cookie_domain&&(this.remove(),this.cookie_domain=e,this.save())},xt.prototype.set_cross_site=function(e){e!==this.cross_site&&(this.cross_site=e,this.remove(),this.save())},xt.prototype.set_cross_subdomain=function(e){e!==this.cross_subdomain&&(this.cross_subdomain=e,this.remove(),this.save())},xt.prototype.get_cross_subdomain=function(){return this.cross_subdomain},xt.prototype.set_secure=function(e){e!==this.secure&&(this.secure=!!e,this.remove(),this.save())},xt.prototype._add_to_people_queue=function(e,t){var n=this._get_queue_key(e),r=t[e],i=this._get_or_create_queue(Pa),o=this._get_or_create_queue(eu),s=this._get_or_create_queue(Gi),u=this._get_or_create_queue($s),c=this._get_or_create_queue(Ls),d=this._get_or_create_queue(Uo,[]),p=this._get_or_create_queue(ho,[]);n===Xb?(R.extend(i,r),this._pop_from_people_queue($s,r),this._pop_from_people_queue(Ls,r),this._pop_from_people_queue(Gi,r)):n===Jb?(R.each(r,function(h,m){m in o||(o[m]=h)}),this._pop_from_people_queue(Gi,r)):n===e1?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]}),s[h]=!0}):n===t1?(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(Gi,r)):n===i1?(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(Gi,r)):n===r1?(d.push(r),this._pop_from_people_queue(ho,r)):n===n1&&(p.push(r),this._pop_from_people_queue(Gi,r)),Ut.log("MIXPANEL PEOPLE REQUEST (QUEUED, PENDING IDENTIFY):"),Ut.log(t),this.save()},xt.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===ho||e===Uo?R.each(n,function(o){o[i]===r&&delete o[i]}):delete n[i]},this)},xt.prototype.load_queue=function(e){return this.load_prop(this._get_queue_key(e))},xt.prototype._get_queue_key=function(e){if(e===Pa)return Xb;if(e===eu)return Jb;if(e===Gi)return e1;if(e===$s)return t1;if(e===ho)return n1;if(e===Uo)return r1;if(e===Ls)return i1;Ut.error("Invalid queue:",e)},xt.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)},xt.prototype.set_event_timer=function(e,t){var n=this.load_prop(mf)||{};n[e]=t,this.props[mf]=n,this.save()},xt.prototype.remove_event_timer=function(e){var t=this.load_prop(mf)||{},n=t[e];return R.isUndefined(n)||(delete this.props[mf][e],this.save()),n};var o1,XO=function(e,t){throw new Error(e+" not available in this build.")},Cr,JO=0,YV=1,WV=function(e){return e},_i="mixpanel",eT="base64",KV="json",a1="$device:",tu=ze.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,tT=!tu&&Po.indexOf("MSIE")===-1&&Po.indexOf("Mozilla")===-1,zp=null;Da.sendBeacon&&(zp=function(){return Da.sendBeacon.apply(Da,arguments)});var nT={track:"track/",engage:"engage/",groups:"groups/",record:"record/"},rT={api_host:"https://api-js.mixpanel.com",api_routes:nT,api_method:"POST",api_transport:"XHR",api_payload_format:eT,app_host:"https://mixpanel.com",autocapture:!1,cdn:"https://cdn.mxpnl.com",cross_site_cookie:!1,cross_subdomain_cookie:!0,error_reporter:$a,persistence:"cookie",persistence_name:"",cookie_domain:"",cookie_name:"",loaded:$a,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:uf,record_min_ms:0,record_sessions_percent:0,recorder_src:"https://cdn.mxpnl.com/libs/mixpanel-recorder.min.js"},iT=!1,ae=function(){},s1=function(e,t,n){var r,i=n===_i?Cr:Cr[n];if(i&&o1===JO)r=i;else{if(i&&!R.isArray(i)){Ut.error("You have already initialized "+n);return}r=new ae}if(r._cached_groups={},r._init(e,t,n),r.people=new dt,r.people._init(r),!r.get_config("skip_first_touch_marketing")){var o=R.info.campaignParams(null),s={},u=!1;R.each(o,function(c,d){s["initial_"+d]=c,c&&(u=!0)}),u&&r.people.set_once(s)}return Hi.DEBUG=Hi.DEBUG||r.get_config("debug"),!R.isUndefined(i)&&R.isArray(i)&&(r._execute_array.call(r.people,i.people),r._execute_array(i)),r};ae.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===_i){this.report_error("You must initialize the main mixpanel object right after you include the Mixpanel js snippet");return}var r=s1(e,t,n);return Cr[n]=r,r._loaded(),r},ae.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||rT.api_host;i.match(/\.mixpanel\.com/)&&(r.api_payload_format=KV)}if(this.set_config(R.extend({},rT,r,t,{name:n,token:e,callback_fn:(n===_i?n:_i+"."+n)+"._jsc"})),this._jsc=$a,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)||!tu)this._batch_requests=!1,Ut.log("Turning off Mixpanel request-queueing; needs XHR and localStorage support"),R.each(this.get_batcher_configs(),function(u){Ut.log("Clearing batch queue "+u.queue_key),R.localStorage.remove(u.queue_key)});else if(this.init_batchers(),zp&&ze.addEventListener){var o=R.bind(function(){this.request_batchers.events.stopped||this.request_batchers.events.flush({unloading:!0})},this);ze.addEventListener("pagehide",function(u){u.persisted&&o()}),ze.addEventListener("visibilitychange",function(){Vt.visibilityState==="hidden"&&o()})}}this.persistence=this.cookie=new xt(this.config),this.unpersisted_superprops={},this._gdpr_init();var s=R.UUID();this.get_distinct_id()||this.register_once({distinct_id:a1+s,$device_id:s},""),this.autocapture=new ti(this),this.autocapture.init(),this._init_tab_id(),this._check_and_start_session_recording()},ae.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),ze.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.")},ae.prototype.get_tab_id=function(){return this.tab_id||null},ae.prototype._should_load_recorder=function(){var e=new uo(Pb),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(zb(n[r])||n[r].tabId===t)return!0;return!1}).catch(R.bind(function(n){this.report_error("Error checking recording registry",n)},this))},ae.prototype._check_and_start_session_recording=La(function(e){if(!ze.MutationObserver){Ut.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 ze.__mp_recorder(this),this._recorder.resumeRecording(r)},this);R.isUndefined(ze.__mp_recorder)?XO(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)})}),ae.prototype.start_session_recording=function(){this._check_and_start_session_recording(!0)},ae.prototype.stop_session_recording=function(){this._recorder&&this._recorder.stopRecording()},ae.prototype.pause_session_recording=function(){this._recorder&&this._recorder.pauseRecording()},ae.prototype.resume_session_recording=function(){this._recorder&&this._recorder.resumeRecording()},ae.prototype.get_session_recording_properties=function(){var e={},t=this._get_session_replay_id();return t&&(e.$mp_replay_id=t),e},ae.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},ae.prototype._get_session_replay_id=function(){var e=null;return this._recorder&&(e=this._recorder.replayId),e||null},ae.prototype.__get_recorder=function(){return this._recorder},ae.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))}},ae.prototype._set_default_superprops=function(){this.persistence.update_search_keyword(Vt.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(Vt.referrer)},ae.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},ae.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(!iT)return this.__dom_loaded_queue.push([e,t]),!1;var n=new e().init(this);return n.track.apply(n,t)},ae.prototype._prepare_callback=function(e,t){if(R.isUndefined(e))return null;if(tu){var n=function(s){e(s,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(s){delete r[i],e(s,t)},o}},ae.prototype._send_request=function(e,t,n,r){var i=!0;if(tT)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")},s=null;!r&&(R.isFunction(n)||typeof n=="string")&&(r=n,n=null),n=R.extend(o,n||{}),tu||(n.method="GET");var u=n.method==="POST",c=zp&&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),tu||(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&&(s="data="+encodeURIComponent(t.data),delete t.data),e+="?"+R.HTTPBuildQuery(t);var p=this;if("img"in t){var h=Vt.createElement("img");h.src=e,Vt.body.appendChild(h)}else if(c){try{i=zp(e,s)}catch(b){p.report_error(b),i=!1}try{r&&r(i?1:0)}catch(b){p.report_error(b)}}else if(tu)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(k){if(p.report_error(k),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(s)}catch(b){p.report_error(b),i=!1}else{var x=Vt.createElement("script");x.type="text/javascript",x.async=!0,x.defer=!0,x.src=e;var w=Vt.getElementsByTagName("script")[0];w.parentNode.insertBefore(x,w)}return i},ae.prototype._execute_array=function(e){var t,n=[],r=[],i=[];R.each(e,function(s){s&&(t=s[0],R.isArray(t)?i.push(s):typeof s=="function"?s.call(this):R.isArray(s)&&t==="alias"?n.push(s):R.isArray(s)&&t.indexOf("track")!==-1&&typeof this[t]=="function"?i.push(s):r.push(s))},this);var o=function(s,u){R.each(s,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)},ae.prototype.are_batchers_initialized=function(){return!!this.request_batchers.events},ae.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},ae.prototype.init_batchers=function(){if(!this.are_batchers_initialized()){var e=R.bind(function(n){return new yi(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()},ae.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()}))},ae.prototype.stop_batch_senders=function(){this._batch_requests=!1,R.each(this.request_batchers,function(e){e.stop(),e.clear()})},ae.prototype.push=function(e){this._execute_array([e])},ae.prototype.disable=function(e){typeof e>"u"?this._flags.disable_all_events=!0:this.__disabled_events=this.__disabled_events.concat(e)},ae.prototype._encode_data_for_request=function(e){var t=Yl(e);return this.get_config("api_payload_format")===eT&&(t=R.base64Encode(t)),{data:t}},ae.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,s=e.send_request_options||{};t=t||$a;var u=!0,c=R.bind(function(){return s.skip_hooks||(n=this._run_hook("before_send_"+e.type,n)),n?(Ut.log("MIXPANEL REQUEST:"),Ut.log(n),this._send_request(r,this._encode_data_for_request(n),s,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},ae.prototype.track=La(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=$a),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 s=this.persistence.remove_event_timer(e);if(!R.isUndefined(s)){var u=new Date().getTime()-s;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}),ae.prototype.set_group=La(function(e,t,n){R.isArray(t)||(t=[t]);var r={};return r[e]=t,this.register(r),this.people.set(e,t,n)}),ae.prototype.add_group=La(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)}),ae.prototype.remove_group=La(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)}),ae.prototype.track_with_groups=La(function(e,t,n,r){var i=R.extend({},t||{});return R.each(n,function(o,s){o!=null&&(i[s]=o)}),this.track(e,i,r)}),ae.prototype._create_map_key=function(e,t){return e+"_"+JSON.stringify(t)},ae.prototype._remove_group_from_cache=function(e,t){delete this._cached_groups[this._create_map_key(e,t)]},ae.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 pn,r._init(this,e,t),this._cached_groups[n]=r),r},ae.prototype.track_pageview=La(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)}),ae.prototype.track_links=function(){return this._track_dom.call(this,Jl,arguments)},ae.prototype.track_forms=function(){return this._track_dom.call(this,Fp,arguments)},ae.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 QV={persistent:!0},l1=function(e){var t;return R.isObject(e)?t=e:R.isUndefined(e)?t={}:t={days:e},R.extend({},QV,t)};ae.prototype.register=function(e,t){var n=l1(t);n.persistent?this.persistence.register(e,n.days):R.extend(this.unpersisted_superprops,e)},ae.prototype.register_once=function(e,t,n){var r=l1(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))},ae.prototype.unregister=function(e,t){t=l1(t),t.persistent?this.persistence.unregister(e):delete this.unpersisted_superprops[e]},ae.prototype._register_single=function(e,t){var n={};n[e]=t,this.register(n)},ae.prototype.identify=function(e,t,n,r,i,o,s,u){var c=this.get_distinct_id();if(e&&c!==e){if(typeof e=="string"&&e.indexOf(a1)===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(Up)&&(this.unregister(Up),this.register({distinct_id:e})),this._flags.identify_called=!0,this.people._flush(t,n,r,i,o,s,u),e!==c&&this.track("$identify",{distinct_id:e,$anon_distinct_id:c},{skip_hooks:!0})},ae.prototype.reset=function(){this.persistence.clear(),this._flags.identify_called=!1;var e=R.UUID();this.register_once({distinct_id:a1+e,$device_id:e},"")},ae.prototype.get_distinct_id=function(){return this.get_property("distinct_id")},ae.prototype.alias=function(e,t){if(e===this.get_property(QO))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(Up,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)},ae.prototype.name_tag=function(e){this._register_single("mp_name_tag",e)},ae.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),Hi.DEBUG=Hi.DEBUG||this.get_config("debug"),"autocapture"in e&&this.autocapture&&this.autocapture.init()}},ae.prototype.get_config=function(e){return this.config[e]},ae.prototype._run_hook=function(e){var t=(this.config.hooks[e]||WV).apply(this,Ma.call(arguments,1));return typeof t>"u"&&(this.report_error(e+" hook did not return a value"),t=null),t},ae.prototype.get_property=function(e){return this.persistence.load_prop([e])},ae.prototype.toString=function(){var e=this.get_config("name");return e!==_i&&(e=_i+"."+e),e},ae.prototype._event_is_disabled=function(e){return R.isBlockedUA(Po)||this._flags.disable_all_events||R.include(this.__disabled_events,e)},ae.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")}))},ae.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()},ae.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})},ae.prototype.opt_in_tracking=function(e){e=R.extend({enable_persistence:!0},e),this._gdpr_call_func(bV,e),this._gdpr_update_persistence(e)},ae.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(SV,e),this._gdpr_update_persistence(e)},ae.prototype.has_opted_in_tracking=function(e){return this._gdpr_call_func(wV,e)},ae.prototype.has_opted_out_tracking=function(e){return this._gdpr_call_func(_O,e)},ae.prototype.clear_opt_in_out_tracking=function(e){e=R.extend({enable_persistence:!0},e),this._gdpr_call_func(xV,e),this._gdpr_update_persistence(e)},ae.prototype.report_error=function(e,t){Ut.error.apply(Ut.error,arguments);try{!t&&!(e instanceof Error)&&(e=new Error(e)),this.get_config("error_reporter")(e,t)}catch(n){Ut.error(n)}},ae.prototype.init=ae.prototype.init,ae.prototype.reset=ae.prototype.reset,ae.prototype.disable=ae.prototype.disable,ae.prototype.time_event=ae.prototype.time_event,ae.prototype.track=ae.prototype.track,ae.prototype.track_links=ae.prototype.track_links,ae.prototype.track_forms=ae.prototype.track_forms,ae.prototype.track_pageview=ae.prototype.track_pageview,ae.prototype.register=ae.prototype.register,ae.prototype.register_once=ae.prototype.register_once,ae.prototype.unregister=ae.prototype.unregister,ae.prototype.identify=ae.prototype.identify,ae.prototype.alias=ae.prototype.alias,ae.prototype.name_tag=ae.prototype.name_tag,ae.prototype.set_config=ae.prototype.set_config,ae.prototype.get_config=ae.prototype.get_config,ae.prototype.get_property=ae.prototype.get_property,ae.prototype.get_distinct_id=ae.prototype.get_distinct_id,ae.prototype.toString=ae.prototype.toString,ae.prototype.opt_out_tracking=ae.prototype.opt_out_tracking,ae.prototype.opt_in_tracking=ae.prototype.opt_in_tracking,ae.prototype.has_opted_out_tracking=ae.prototype.has_opted_out_tracking,ae.prototype.has_opted_in_tracking=ae.prototype.has_opted_in_tracking,ae.prototype.clear_opt_in_out_tracking=ae.prototype.clear_opt_in_out_tracking,ae.prototype.get_group=ae.prototype.get_group,ae.prototype.set_group=ae.prototype.set_group,ae.prototype.add_group=ae.prototype.add_group,ae.prototype.remove_group=ae.prototype.remove_group,ae.prototype.track_with_groups=ae.prototype.track_with_groups,ae.prototype.start_batch_senders=ae.prototype.start_batch_senders,ae.prototype.stop_batch_senders=ae.prototype.stop_batch_senders,ae.prototype.start_session_recording=ae.prototype.start_session_recording,ae.prototype.stop_session_recording=ae.prototype.stop_session_recording,ae.prototype.pause_session_recording=ae.prototype.pause_session_recording,ae.prototype.resume_session_recording=ae.prototype.resume_session_recording,ae.prototype.get_session_recording_properties=ae.prototype.get_session_recording_properties,ae.prototype.get_session_replay_url=ae.prototype.get_session_replay_url,ae.prototype.get_tab_id=ae.prototype.get_tab_id,ae.prototype.DEFAULT_API_ROUTES=nT,ae.prototype.__get_recorder=ae.prototype.__get_recorder,xt.prototype.properties=xt.prototype.properties,xt.prototype.update_search_keyword=xt.prototype.update_search_keyword,xt.prototype.update_referrer_info=xt.prototype.update_referrer_info,xt.prototype.get_cross_subdomain=xt.prototype.get_cross_subdomain,xt.prototype.clear=xt.prototype.clear;var nu={},XV=function(){R.each(nu,function(e,t){t!==_i&&(Cr[t]=e)}),Cr._=R},JV=function(){Cr.init=function(e,t,n){if(n)return Cr[n]||(Cr[n]=nu[n]=s1(e,t,n),Cr[n]._loaded()),Cr[n];var r=Cr;nu[_i]?r=nu[_i]:e&&(r=s1(e,t,_i),r._loaded(),nu[_i]=r),Cr=r,o1===YV&&(ze[_i]=Cr),XV()}},eZ=function(){function e(){e.done||(e.done=!0,iT=!0,tT=!1,R.each(nu,function(r){r._dom_loaded()}))}function t(){try{Vt.documentElement.doScroll("left")}catch{setTimeout(t,1);return}e()}if(Vt.addEventListener)Vt.readyState==="complete"?e():Vt.addEventListener("DOMContentLoaded",e,!1);else if(Vt.attachEvent){Vt.attachEvent("onreadystatechange",e);var n=!1;try{n=ze.frameElement===null}catch{}Vt.documentElement.doScroll&&n&&t()}R.register_event(ze,"load",e,!0)};function tZ(e){return XO=e,o1=JO,Cr=new ae,JV(),Cr.init(),eZ(),Cr}function nZ(e,t){t()}var Ba=tZ(nZ);const po="https://debales.ai",rZ="https://debales-web-app-server-prod.azurewebsites.net",oT={"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"},iZ="phc_OKaClHZDmbEpVscrwceWJB5lsMYbMaV586L7pai6ZKD",oZ=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 ur(){const e=sessionStorage.getItem("debalesSessionID");if(e)return e;const t=crypto.randomUUID();return sessionStorage.setItem("debalesSessionID",t),t}function aZ(){return sessionStorage.getItem(bi(window.DebalesChat.projectId,mi.LAST_SHOWN_MESSAGE_ID))}function u1(e){sessionStorage.setItem("formstate",e.toString())}function Vi(){const e=localStorage.getItem("debalesUserInfo");return e?JSON.parse(e):null}function qp(e){localStorage.setItem("debalesUserInfo",JSON.stringify(e))}function jp(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,s=performance.now(),u=c=>{const d=c-s,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 sZ(){return window.location.pathname}function aT(){const e=/test|demo|example|debales/i,t=Vi()??"";return!!(t&&e.test(t.email))}function lZ(e){const t=sZ(),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,s)=>(o.sortOrder??0)-(s.sortOrder??0))}const sT=new Set,uZ=e=>{const t=oT[e];if(!t)return console.warn("No Mixpanel token found"),null;if(sT.has(e))return Ba;Ba.init(t,{debug:!1,track_pageview:!0,persistence:"localStorage"}),console.log("Mixpanel initialized");const n=Vi();return n&&n.email&&Ba.identify(n.email),sT.add(e),Ba},cZ=async(e,t)=>{if(aT())return;const n=window.DebalesChat.projectId??t.projectId;if(!oT[n]){console.warn("No Mixpanel token found");return}Ba.track(e,t)},fZ=()=>{const e=localStorage.getItem("anonymousUserId");if(e)return e;const t=crypto.randomUUID();return localStorage.setItem("anonymousUserId",t),t};function dZ(e){return e?e.split("<br>").filter(n=>n.trim().length>0).map(n=>n.trim()):[""]}const cr=e=>e.toLowerCase().includes("gaiabay")||e.toLowerCase().includes("debales-testing"),hZ=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 bi(e,t){return`debales_${e}_${t}`}const lT=W.createContext(null),uT=()=>{const e=W.useContext(lT);if(!e)throw new Error("useCart must be used within a CartProvider");return e};var pZ="2.0.0",ru="",cT="?",Hp="function",Fa="undefined",iu="object",c1="string",vf="major",Re="model",ke="name",Ce="type",Te="vendor",Ie="version",jr="architecture",ou="console",vt="mobile",_n="tablet",Er="smarttv",yf="wearable",f1="xr",d1="embedded",_f="inapp",fT="user-agent",h1=500,p1="brands",Ns="formFactors",g1="fullVersionList",au="platform",m1="platformVersion",Gp="bitness",Ua="sec-ch-ua",gZ=Ua+"-full-version-list",mZ=Ua+"-arch",vZ=Ua+"-"+Gp,yZ=Ua+"-form-factors",_Z=Ua+"-"+vt,bZ=Ua+"-"+Re,dT=Ua+"-"+au,SZ=dT+"-version",hT=[p1,g1,vt,Re,au,m1,jr,Ns,Gp],ni="browser",zo="cpu",go="device",qo="engine",Si="os",su="result",Vp="Amazon",bf="Apple",pT="ASUS",gT="BlackBerry",Ps="Google",mT="Huawei",vT="Lenovo",wZ="Honor",v1="LG",Zp="Microsoft",yT="Motorola",Sf="Samsung",_T="Sharp",Yp="Sony",y1="Xiaomi",_1="Zebra",lu="Mobile ",wf=" Browser",bT="Chrome",za="Chromecast",xZ="Edge",xf="Firefox",Cf="Opera",ST="Facebook",wT="Sogou",b1="Windows",CZ=typeof window!==Fa,Hr=CZ&&window.navigator?window.navigator:void 0,qa=Hr&&Hr.userAgentData?Hr.userAgentData:void 0,EZ=function(e,t){var n={},r=t;if(!Kp(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 s in e)n[s]=r[s]&&r[s].length%2===0?r[s].concat(e[s]):e[s];return n},Wp=function(e){for(var t={},n=0;n<e.length;n++)t[e[n].toUpperCase()]=e[n];return t},S1=function(e,t){if(typeof e===iu&&e.length>0){for(var n in e)if(jo(e[n])==jo(t))return!0;return!1}return uu(e)?jo(t).indexOf(jo(e))!==-1:!1},Kp=function(e,t){for(var n in e)return/^(browser|cpu|device|engine|os)$/.test(n)||(t?Kp(e[n]):!1)},uu=function(e){return typeof e===c1},w1=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=kf(n[r]).split(";v=");t[r]={brand:i[0],version:i[1]}}else t[r]=kf(n[r]);return t}},jo=function(e){return uu(e)?e.toLowerCase():e},x1=function(e){return uu(e)?Bs(/[^\d\.]/g,e).split(".")[0]:void 0},Ho=function(e){for(var t in e){var n=e[t];typeof n==iu&&n.length==2?this[n[0]]=n[1]:this[n]=void 0}return this},Bs=function(e,t){return uu(t)?t.replace(e,ru):t},Ef=function(e){return Bs(/\\?\"/g,e)},kf=function(e,t){if(uu(e))return e=Bs(/^\s\s*/,e),typeof t===Fa?e:e.substring(0,h1)},xT=function(e,t){if(!(!e||!t))for(var n=0,r,i,o,s,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],s=p[o],typeof s===iu&&s.length>0?s.length===2?typeof s[1]==Hp?this[s[0]]=s[1].call(this,c):this[s[0]]=s[1]:s.length===3?typeof s[1]===Hp&&!(s[1].exec&&s[1].test)?this[s[0]]=c?s[1].call(this,c,s[2]):void 0:this[s[0]]=c?c.replace(s[1],s[2]):void 0:s.length===4&&(this[s[0]]=c?s[3].call(this,c.replace(s[1],s[2])):void 0):this[s]=c||void 0;n+=2}},Af=function(e,t){for(var n in t)if(typeof t[n]===iu&&t[n].length>0){for(var r=0;r<t[n].length;r++)if(S1(t[n][r],e))return n===cT?void 0:n}else if(S1(t[n],e))return n===cT?void 0:n;return t.hasOwnProperty("*")?t["*"]:e},CT={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"},ET={embedded:"Automotive",mobile:"Mobile",tablet:["Tablet","EInk"],smarttv:"TV",wearable:"Watch",xr:["VR","XR"],"?":["Desktop","Unknown"],"*":void 0},kT={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[Ie,[ke,lu+"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[Ie,[ke,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[ke,Ie],[/opios[\/ ]+([\w\.]+)/i],[Ie,[ke,Cf+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[Ie,[ke,Cf+" GX"]],[/\bopr\/([\w\.]+)/i],[Ie,[ke,Cf]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[Ie,[ke,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[Ie,[ke,"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],[ke,Ie],[/quark(?:pc)?\/([-\w\.]+)/i],[Ie,[ke,"Quark"]],[/\bddg\/([\w\.]+)/i],[Ie,[ke,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[Ie,[ke,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[Ie,[ke,"WeChat"]],[/konqueror\/([\w\.]+)/i],[Ie,[ke,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[Ie,[ke,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[Ie,[ke,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[Ie,[ke,"Smart "+vT+wf]],[/(avast|avg)\/([\w\.]+)/i],[[ke,/(.+)/,"$1 Secure"+wf],Ie],[/\bfocus\/([\w\.]+)/i],[Ie,[ke,xf+" Focus"]],[/\bopt\/([\w\.]+)/i],[Ie,[ke,Cf+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[Ie,[ke,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[Ie,[ke,"Dolphin"]],[/coast\/([\w\.]+)/i],[Ie,[ke,Cf+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[Ie,[ke,"MIUI"+wf]],[/fxios\/([\w\.-]+)/i],[Ie,[ke,lu+xf]],[/\bqihoobrowser\/?([\w\.]*)/i],[Ie,[ke,"360"]],[/\b(qq)\/([\w\.]+)/i],[[ke,/(.+)/,"$1Browser"],Ie],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[ke,/(.+)/,"$1"+wf],Ie],[/samsungbrowser\/([\w\.]+)/i],[Ie,[ke,Sf+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[Ie,[ke,wT+" Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[ke,wT+" Mobile"],Ie],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[ke,Ie],[/(lbbrowser|rekonq)/i],[ke],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[Ie,ke],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[ke,ST],Ie,[Ce,_f]],[/(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],[ke,Ie,[Ce,_f]],[/\bgsa\/([\w\.]+) .*safari\//i],[Ie,[ke,"GSA"],[Ce,_f]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[Ie,[ke,"TikTok"],[Ce,_f]],[/\[(linkedin)app\]/i],[ke,[Ce,_f]],[/(chromium)[\/ ]([-\w\.]+)/i],[ke,Ie],[/headlesschrome(?:\/([\w\.]+)| )/i],[Ie,[ke,bT+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[ke,bT+" WebView"],Ie],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[Ie,[ke,"Android"+wf]],[/chrome\/([\w\.]+) mobile/i],[Ie,[ke,lu+"Chrome"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[ke,Ie],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[Ie,[ke,lu+"Safari"]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[ke,lu+"Safari"]],[/version\/([\w\.\,]+) .*(safari)/i],[Ie,ke],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[ke,[Ie,"1"]],[/(webkit|khtml)\/([\w\.]+)/i],[ke,Ie],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[ke,lu+xf],Ie],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[ke,"Netscape"],Ie],[/(wolvic|librewolf)\/([\w\.]+)/i],[ke,Ie],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[Ie,[ke,xf+" 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],[ke,[Ie,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[ke,[Ie,/[^\d\.]+./,ru]]],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/,ru,jo]],[/(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,jo]]],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],[Re,[Te,Sf],[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],[Re,[Te,Sf],[Ce,vt]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[Re,[Te,bf],[Ce,vt]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[Re,[Te,bf],[Ce,_n]],[/(macintosh);/i],[Re,[Te,bf]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[Re,[Te,_T],[Ce,vt]],[/(?:honor)([-\w ]+)[;\)]/i],[Re,[Te,wZ],[Ce,vt]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[Re,[Te,mT],[Ce,_n]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[Re,[Te,mT],[Ce,vt]],[/\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],[[Re,/_/g," "],[Te,y1],[Ce,vt]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[Re,/_/g," "],[Te,y1],[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],[Re,[Te,"OPPO"],[Ce,vt]],[/\b(opd2\d{3}a?) bui/i],[Re,[Te,"OPPO"],[Ce,_n]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[Re,[Te,"Vivo"],[Ce,vt]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[Re,[Te,"Realme"],[Ce,vt]],[/\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],[Re,[Te,yT],[Ce,vt]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[Re,[Te,yT],[Ce,_n]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[Re,[Te,v1],[Ce,_n]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[Re,[Te,v1],[Ce,vt]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[Re,[Te,vT],[Ce,_n]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[Re,/_/g," "],[Te,"Nokia"],[Ce,vt]],[/(pixel c)\b/i],[Re,[Te,Ps],[Ce,_n]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[Re,[Te,Ps],[Ce,vt]],[/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],[Re,[Te,Yp],[Ce,vt]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[Re,"Xperia Tablet"],[Te,Yp],[Ce,_n]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[Re,[Te,"OnePlus"],[Ce,vt]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[Re,[Te,Vp],[Ce,_n]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[Re,/(.+)/g,"Fire Phone $1"],[Te,Vp],[Ce,vt]],[/(playbook);[-\w\),; ]+(rim)/i],[Re,Te,[Ce,_n]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[Re,[Te,gT],[Ce,vt]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[Re,[Te,pT],[Ce,_n]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[Re,[Te,pT],[Ce,vt]],[/(nexus 9)/i],[Re,[Te,"HTC"],[Ce,_n]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[Te,[Re,/_/g," "],[Ce,vt]],[/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],[Re,[Te,"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],[Re,[Te,"TCL"],[Ce,vt]],[/(itel) ((\w+))/i],[[Te,jo],Re,[Ce,Af,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[Re,[Te,"Acer"],[Ce,_n]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[Re,[Te,"Meizu"],[Ce,vt]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[Re,[Te,"Ulefone"],[Ce,vt]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[Re,[Te,"Energizer"],[Ce,vt]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[Re,[Te,"Cat"],[Ce,vt]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[Re,[Te,"Smartfren"],[Ce,vt]],[/droid.+; (a(?:015|06[35]|142p?))/i],[Re,[Te,"Nothing"],[Ce,vt]],[/(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],[Te,Re,[Ce,vt]],[/(imo) (tab \w+)/i,/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[Te,Re,[Ce,_n]],[/(surface duo)/i],[Re,[Te,Zp],[Ce,_n]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[Re,[Te,"Fairphone"],[Ce,vt]],[/(shield[\w ]+) b/i],[Re,[Te,"Nvidia"],[Ce,_n]],[/(sprint) (\w+)/i],[Te,Re,[Ce,vt]],[/(kin\.[onetw]{3})/i],[[Re,/\./g," "],[Te,Zp],[Ce,vt]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[Re,[Te,_1],[Ce,_n]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[Re,[Te,_1],[Ce,vt]],[/smart-tv.+(samsung)/i],[Te,[Ce,Er]],[/hbbtv.+maple;(\d+)/i],[[Re,/^/,"SmartTV"],[Te,Sf],[Ce,Er]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[Te,v1],[Ce,Er]],[/(apple) ?tv/i],[Te,[Re,bf+" TV"],[Ce,Er]],[/crkey.*devicetype\/chromecast/i],[[Re,za+" Third Generation"],[Te,Ps],[Ce,Er]],[/crkey.*devicetype\/([^/]*)/i],[[Re,/^/,"Chromecast "],[Te,Ps],[Ce,Er]],[/fuchsia.*crkey/i],[[Re,za+" Nest Hub"],[Te,Ps],[Ce,Er]],[/crkey/i],[[Re,za],[Te,Ps],[Ce,Er]],[/droid.+aft(\w+)( bui|\))/i],[Re,[Te,Vp],[Ce,Er]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[Re,[Te,_T],[Ce,Er]],[/(bravia[\w ]+)( bui|\))/i],[Re,[Te,Yp],[Ce,Er]],[/(mitv-\w{5}) bui/i],[Re,[Te,y1],[Ce,Er]],[/Hbbtv.*(technisat) (.*);/i],[Te,Re,[Ce,Er]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[Te,kf],[Re,kf],[Ce,Er]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[Ce,Er]],[/(ouya)/i,/(nintendo) (\w+)/i],[Te,Re,[Ce,ou]],[/droid.+; (shield) bui/i],[Re,[Te,"Nvidia"],[Ce,ou]],[/(playstation \w+)/i],[Re,[Te,Yp],[Ce,ou]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[Re,[Te,Zp],[Ce,ou]],[/\b(sm-[lr]\d\d[05][fnuw]?s?)\b/i],[Re,[Te,Sf],[Ce,yf]],[/((pebble))app/i],[Te,Re,[Ce,yf]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[Re,[Te,bf],[Ce,yf]],[/droid.+; (wt63?0{2,3})\)/i],[Re,[Te,_1],[Ce,yf]],[/droid.+; (glass) \d/i],[Re,[Te,Ps],[Ce,f1]],[/(pico) (4|neo3(?: link|pro)?)/i],[Te,Re,[Ce,f1]],[/; (quest( \d| pro)?)/i],[Re,[Te,ST],[Ce,f1]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[Te,[Ce,d1]],[/(aeobc)\b/i],[Re,[Te,Vp],[Ce,d1]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[Re,[Ce,vt]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[Re,[Ce,_n]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[Ce,_n]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[Ce,vt]],[/(android[-\w\. ]{0,9});.+buil/i],[Re,[Te,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[Ie,[ke,xZ+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[ke,Ie],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[Ie,[ke,"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],[ke,Ie],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[Ie,ke]],os:[[/microsoft (windows) (vista|xp)/i],[ke,Ie],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[ke,[Ie,Af,CT]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[Ie,Af,CT],[ke,b1]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[Ie,/_/g,"."],[ke,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[ke,"macOS"],[Ie,/_/g,"."]],[/android ([\d\.]+).*crkey/i],[Ie,[ke,za+" Android"]],[/fuchsia.*crkey\/([\d\.]+)/i],[Ie,[ke,za+" Fuchsia"]],[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],[Ie,[ke,za+" SmartSpeaker"]],[/linux.*crkey\/([\d\.]+)/i],[Ie,[ke,za+" Linux"]],[/crkey\/([\d\.]+)/i],[Ie,[ke,za]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[Ie,ke],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish|openharmony)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[ke,Ie],[/\(bb(10);/i],[Ie,[ke,gT]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[Ie,[ke,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[Ie,[ke,xf+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[Ie,[ke,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[Ie,[ke,"watchOS"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[ke,"Chrome OS"],Ie],[/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],[ke,Ie],[/(sunos) ?([\w\.\d]*)/i],[[ke,"Solaris"],Ie],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[ke,Ie]]},Qp=function(){var e={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}};return Ho.call(e.init,[[ni,[ke,Ie,vf,Ce]],[zo,[jr]],[go,[Ce,Re,Te]],[qo,[ke,Ie]],[Si,[ke,Ie]]]),Ho.call(e.isIgnore,[[ni,[Ie,vf]],[qo,[Ie]],[Si,[Ie]]]),Ho.call(e.isIgnoreRgx,[[ni,/ ?browser$/i],[Si,/ ?os$/i]]),Ho.call(e.toString,[[ni,[ke,Ie]],[zo,[jr]],[go,[Te,Re]],[qo,[ke,Ie]],[Si,[ke,Ie]]]),e}(),kZ=function(e,t){var n=Qp.init[t],r=Qp.isIgnore[t]||0,i=Qp.isIgnoreRgx[t]||0,o=Qp.toString[t]||0;function s(){Ho.call(this,n)}return s.prototype.getItem=function(){return e},s.prototype.withClientHints=function(){return qa?qa.getHighEntropyValues(hT).then(function(u){return e.setCH(new AT(u,!1)).parseCH().get()}):e.parseCH().get()},s.prototype.withFeatureCheck=function(){return e.detectFeature().get()},t!=su&&(s.prototype.is=function(u){var c=!1;for(var d in this)if(this.hasOwnProperty(d)&&!S1(r,d)&&jo(i?Bs(i,this[d]):this[d])==jo(i?Bs(i,u):u)){if(c=!0,u!=Fa)break}else if(u==Fa&&c){c=!c;break}return c},s.prototype.toString=function(){var u=ru;for(var c in o)typeof this[o[c]]!==Fa&&(u+=(u?" ":ru)+this[o[c]]);return u||Fa}),qa||(s.prototype.then=function(u){var c=this,d=function(){for(var h in c)c.hasOwnProperty(h)&&(this[h]=c[h])};d.prototype={is:s.prototype.is,toString:s.prototype.toString};var p=new d;return u(p),p}),new s};function AT(e,t){if(e=e||{},Ho.call(this,hT),t)Ho.call(this,[[p1,w1(e[Ua])],[g1,w1(e[gZ])],[vt,/\?1/.test(e[_Z])],[Re,Ef(e[bZ])],[au,Ef(e[dT])],[m1,Ef(e[SZ])],[jr,Ef(e[mZ])],[Ns,w1(e[yZ])],[Gp,Ef(e[vZ])]]);else for(var n in e)this.hasOwnProperty(n)&&typeof e[n]!==Fa&&(this[n]=e[n])}function IT(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 ni:Hr.brave&&typeof Hr.brave.isBrave==Hp&&this.set(ke,"Brave");break;case go:!this.get(Ce)&&qa&&qa[vt]&&this.set(Ce,vt),this.get(Re)=="Macintosh"&&Hr&&typeof Hr.standalone!==Fa&&Hr.maxTouchPoints&&Hr.maxTouchPoints>2&&this.set(Re,"iPad").set(Ce,_n);break;case Si:!this.get(ke)&&qa&&qa[au]&&this.set(ke,qa[au]);break;case su:var i=this.data,o=function(s){return i[s].getItem().detectFeature().get()};this.set(ni,o(ni)).set(zo,o(zo)).set(go,o(go)).set(qo,o(qo)).set(Si,o(Si))}return this},this.parseUA=function(){return this.itemType!=su&&xT.call(this.data,this.ua,this.rgxMap),this.itemType==ni&&this.set(vf,x1(this.get(Ie))),this},this.parseCH=function(){var i=this.uaCH,o=this.rgxMap;switch(this.itemType){case ni:var s=i[g1]||i[p1],u;if(s)for(var c in s){var d=Bs(/(Google|Microsoft) /,s[c].brand||s[c]),p=s[c].version;!/not.a.brand/i.test(d)&&(!u||/chrom/i.test(u)&&!/chromi/i.test(d))&&(this.set(ke,d).set(Ie,p).set(vf,x1(p)),u=d)}break;case zo:var h=i[jr];h&&(h&&i[Gp]=="64"&&(h+="64"),xT.call(this.data,h+";",o));break;case go:if(i[vt]&&this.set(Ce,vt),i[Re]&&this.set(Re,i[Re]),i[Re]=="Xbox"&&this.set(Ce,ou).set(Te,Zp),i[Ns]){var m;if(typeof i[Ns]!="string")for(var v=0;!m&&v<i[Ns].length;)m=Af(i[Ns][v++],ET);else m=Af(i[Ns],ET);this.set(Ce,m)}break;case Si:var _=i[au];if(_){var x=i[m1];_==b1&&(x=parseInt(x1(x),10)>=13?"11":"10"),this.set(ke,_).set(Ie,x)}this.get(ke)==b1&&i[Re]=="Xbox"&&this.set(ke,"Xbox").set(Ie,void 0);break;case su:var w=this.data,b=function(C){return w[C].getItem().setCH(i).parseCH().get()};this.set(ni,b(ni)).set(zo,b(zo)).set(go,b(go)).set(qo,b(qo)).set(Si,b(Si))}return this},Ho.call(this,[["itemType",e],["ua",t],["uaCH",r],["rgxMap",n],["data",kZ(this,e)]]),this}function Go(e,t,n){if(typeof e===iu?(Kp(e,!0)?(typeof t===iu&&(n=t),t=e):(n=e,t=void 0),e=void 0):typeof e===c1&&!Kp(t,!0)&&(n=t,t=void 0),n&&typeof n.append===Hp){var r={};n.forEach(function(c,d){r[d]=c}),n=r}if(!(this instanceof Go))return new Go(e,t,n).getResult();var i=typeof e===c1?e:n&&n[fT]?n[fT]:Hr&&Hr.userAgent?Hr.userAgent:ru,o=new AT(n,!0),s=t?EZ(kT,t):kT,u=function(c){return c==su?function(){return new IT(c,i,s,o).set("ua",i).set(ni,this.getBrowser()).set(zo,this.getCPU()).set(go,this.getDevice()).set(qo,this.getEngine()).set(Si,this.getOS()).get()}:function(){return new IT(c,i,s[c],o).parseUA().get()}};return Ho.call(this,[["getBrowser",u(ni)],["getCPU",u(zo)],["getDevice",u(go)],["getEngine",u(qo)],["getOS",u(Si)],["getResult",u(su)],["getUA",function(){return i}],["setUA",function(c){return uu(c)&&(i=c.length>h1?kf(c,h1):c),this}]]).setUA(i),this}Go.VERSION=pZ,Go.BROWSER=Wp([ke,Ie,vf,Ce]),Go.CPU=Wp([jr]),Go.DEVICE=Wp([Re,Te,Ce,ou,vt,Er,_n,yf,d1]),Go.ENGINE=Go.OS=Wp([ke,Ie]);const Ii=class Ii{constructor(t){er(this,"config");er(this,"storedData");er(this,"deviceInfo");er(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){Ii.instance||(Ii.instance=new Ii(t))}static getInstance(){if(!Ii.instance)throw new Error("DebalesAnalytics is not initialized. Call init() first.");return Ii.instance}static async identify(t,n){return Ii.getInstance().identifyInternal(t,n)}static track(t,n){Ii.getInstance().trackInternal(t,n)}static getDistinctId(){return Ii.getInstance().storedData.distinctId}static getAnonId(){return Ii.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 s={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",s);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:",s)}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:ur()+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(`${po}${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 Go().getResult();return{browser:n.browser.name,os:n.os.name,browserVersion:n.browser.version,osVersion:n.os.version}}};er(Ii,"instance",null);let C1=Ii;const Fs=C1;var Zi,ue=typeof window<"u"?window:void 0,Gr=typeof globalThis<"u"?globalThis:ue,RT=Array.prototype,OT=RT.forEach,TT=RT.indexOf,ri=Gr==null?void 0:Gr.navigator,Ge=Gr==null?void 0:Gr.document,Vr=Gr==null?void 0:Gr.location,E1=Gr==null?void 0:Gr.fetch,k1=Gr!=null&&Gr.XMLHttpRequest&&"withCredentials"in new Gr.XMLHttpRequest?Gr.XMLHttpRequest:void 0,MT=Gr==null?void 0:Gr.AbortController,zn=ri==null?void 0:ri.userAgent,ht=ue??{},Vo={DEBUG:!1,LIB_VERSION:"1.235.0"},A1="$copy_autocapture",AZ=["$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"})(Zi||(Zi={}));var IZ=["fatal","error","warning","log","info","debug"];function kt(e,t){return e.indexOf(t)!==-1}var Xp=function(e){return e.trim()},I1=function(e){return e.replace(/^\$/,"")},RZ=Array.isArray,DT=Object.prototype,$T=DT.hasOwnProperty,Jp=DT.toString,En=RZ||function(e){return Jp.call(e)==="[object Array]"},Yi=e=>typeof e=="function",kn=e=>e===Object(e)&&!En(e),cu=e=>{if(kn(e)){for(var t in e)if($T.call(e,t))return!1;return!0}return!1},Be=e=>e===void 0,qn=e=>Jp.call(e)=="[object String]",R1=e=>qn(e)&&e.trim().length===0,ja=e=>e===null,Wt=e=>Be(e)||ja(e),$r=e=>Jp.call(e)=="[object Number]",Ha=e=>Jp.call(e)==="[object Boolean]",OZ=e=>e instanceof FormData,TZ=e=>kt(AZ,e),LT=e=>{var t={_log:function(n){if(ue&&(Vo.DEBUG||ht.POSTHOG_DEBUG)&&!Be(ue.console)&&ue.console){for(var r=("__rrweb_original__"in ue.console[n])?ue.console[n].__rrweb_original__:ue.console[n],i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];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=>LT("".concat(e," ").concat(n))};return t},Xe=LT("[PostHog.js]"),kr=Xe.createLogger,MZ=kr("[ExternalScriptsLoader]"),NT=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return MZ.warn("".concat(t," was requested but loading of external scripts is disabled.")),n("Loading of external scripts is disabled");var r=Ge==null?void 0:Ge.querySelectorAll("script");if(r){for(var i=0;i<r.length;i++)if(r[i].src===t)return n()}var o=()=>{if(!Ge)return n("document not found");var s=Ge.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=t,s.onload=d=>n(void 0,d),s.onerror=d=>n(d),e.config.prepare_external_dependency_script&&(s=e.config.prepare_external_dependency_script(s)),!s)return n("prepare_external_dependency_script returned null");var u,c=Ge.querySelectorAll("body > script");c.length>0?(u=c[0].parentNode)===null||u===void 0||u.insertBefore(s,c[0]):Ge.body.appendChild(s)};Ge!=null&&Ge.body?o():Ge==null||Ge.addEventListener("DOMContentLoaded",o)};function PT(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?PT(Object(n),!0).forEach(function(r){Me(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):PT(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Me(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function BT(e,t){if(e==null)return{};var n,r,i=function(s,u){if(s==null)return{};var c,d,p={},h=Object.keys(s);for(d=0;d<h.length;d++)c=h[d],u.indexOf(c)>=0||(p[c]=s[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}ht.__PosthogExtensions__=ht.__PosthogExtensions__||{},ht.__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 s=e.requestRouter.endpointFor("assets",r);NT(e,s,n)},ht.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{var r=e.requestRouter.endpointFor("api",t);NT(e,r,n)};var eg={};function Ga(e,t,n){if(En(e)){if(OT&&e.forEach===OT)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)===eg)return}}}function rn(e,t,n){if(!Wt(e)){if(En(e))return Ga(e,t,n);if(OZ(e)){for(var r of e.entries())if(t.call(n,r[1],r[0])===eg)return}else for(var i in e)if($T.call(e,i)&&t.call(n,e[i],i)===eg)return}}var jn=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 Ga(n,function(i){for(var o in i)i[o]!==void 0&&(e[o]=i[o])}),e},tg=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 Ga(n,function(i){Ga(i,function(o){e.push(o)})}),e};function ng(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 FT=function(e){try{return e()}catch{return}},DZ=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){Xe.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Xe.critical(i)}}},If=function(e){var t={};return rn(e,function(n,r){qn(n)&&n.length>0&&(t[r]=n)}),t};function $Z(e,t){return n=e,r=o=>qn(o)&&!ja(t)?o.slice(0,t):o,i=new Set,function o(s,u){return s!==Object(s)?r?r(s,u):s:i.has(s)?void 0:(i.add(s),En(s)?(c=[],Ga(s,d=>{c.push(o(d))})):(c={},rn(s,(d,p)=>{i.has(d)||(c[p]=o(d,p))})),c);var c}(n);var n,r,i}var LZ=["herokuapp.com","vercel.app","netlify.app"];function NZ(e){var t=e==null?void 0:e.hostname;if(!qn(t))return!1;var n=t.split(".").slice(-2).join(".");for(var r of LZ)if(n===r)return!1;return!0}function UT(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return e[n]}function $n(e,t,n,r){var{capture:i=!1,passive:o=!0}=r??{};e==null||e.addEventListener(t,n,{capture:i,passive:o})}var zT="$people_distinct_id",Rf="__alias",Of="__timers",qT="$autocapture_disabled_server_side",O1="$heatmaps_enabled_server_side",jT="$exception_capture_enabled_server_side",HT="$web_vitals_enabled_server_side",GT="$dead_clicks_enabled_server_side",VT="$web_vitals_allowed_metrics",T1="$session_recording_enabled_server_side",ZT="$console_log_recording_enabled_server_side",YT="$session_recording_network_payload_capture",WT="$session_recording_masking",KT="$session_recording_canvas_recording",QT="$replay_sample_rate",XT="$replay_minimum_duration",JT="$replay_script_config",rg="$sesid",Tf="$session_is_sampled",M1="$session_recording_url_trigger_activated_session",D1="$session_recording_event_trigger_activated_session",fu="$enabled_feature_flags",ig="$early_access_features",$1="$feature_flag_details",Mf="$stored_person_properties",Us="$stored_group_properties",L1="$surveys",og="$surveys_activated",ag="$flag_call_reported",Zo="$user_state",N1="$client_session_props",P1="$capture_rate_limit",B1="$initial_campaign_params",F1="$initial_referrer_info",U1="$initial_person_info",sg="$epp",eM="__POSTHOG_TOOLBAR__",tM="$posthog_cookieless",PZ=[zT,Rf,"__cmpns",Of,T1,O1,rg,fu,Zo,ig,$1,Us,Mf,L1,ag,N1,P1,B1,F1,sg];function nM(e){var t;return e instanceof Element&&(e.id===eM||!((t=e.closest)===null||t===void 0||!t.call(e,".toolbar-global-fade-container")))}function lg(e){return!!e&&e.nodeType===1}function Va(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function rM(e){return!!e&&e.nodeType===3}function iM(e){return!!e&&e.nodeType===11}function z1(e){return e?Xp(e).split(/\s+/):[]}function oM(e){var t=ue==null?void 0:ue.location.href;return!!(t&&e&&e.some(n=>t.match(n)))}function ug(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 z1(t)}function aM(e){return Wt(e)?null:Xp(e).split(/(\s+)/).filter(t=>du(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function cg(e){var t="";return j1(e)&&!uM(e)&&e.childNodes&&e.childNodes.length&&rn(e.childNodes,function(n){var r;rM(n)&&n.textContent&&(t+=(r=aM(n.textContent))!==null&&r!==void 0?r:"")}),Xp(t)}function sM(e){return Be(e.target)?e.srcElement||null:(t=e.target)!==null&&t!==void 0&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var q1=["a","button","form","input","select","textarea","label"];function lM(e){var t=e.parentNode;return!(!t||!lg(t))&&t}function BZ(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(!ue||!e||Va(e,"html")||!lg(e)||n!=null&&n.url_allowlist&&!oM(n.url_allowlist)||n!=null&&n.url_ignorelist&&oM(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 s=!1,u=[e],c=!0,d=e;d.parentNode&&!Va(d,"body");)if(iM(d.parentNode))u.push(d.parentNode.host),d=d.parentNode.host;else{if(!(c=lM(d)))break;if(r||q1.indexOf(c.tagName.toLowerCase())>-1)s=!0;else{var p=ue.getComputedStyle(c);p&&p.getPropertyValue("cursor")==="pointer"&&(s=!0)}u.push(c),d=c}if(!function(v,_){var x=_==null?void 0:_.element_allowlist;if(Be(x))return!0;var w=function(E){if(x.some(k=>E.tagName.toLowerCase()===k))return{v:!0}};for(var b of v){var C=w(b);if(typeof C=="object")return C.v}return!1}(u,n)||!function(v,_){var x=_==null?void 0:_.css_selector_allowlist;if(Be(x))return!0;var w=function(E){if(x.some(k=>E.matches(k)))return{v:!0}};for(var b of v){var C=w(b);if(typeof C=="object")return C.v}return!1}(u,n))return!1;var h=ue.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 s?(i||["click"]).indexOf(t.type)>=0:(i||["click"]).indexOf(t.type)>=0&&(q1.indexOf(m)>-1||e.getAttribute("contenteditable")==="true")}}function j1(e){for(var t=e;t.parentNode&&!Va(t,"body");t=t.parentNode){var n=ug(t);if(kt(n,"ph-sensitive")||kt(n,"ph-no-capture"))return!1}if(kt(ug(e),"ph-include"))return!0;var r=e.type||"";if(qn(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var i=e.name||e.id||"";return!(qn(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 uM(e){return!!(Va(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Va(e,"select")||Va(e,"textarea")||e.getAttribute("contenteditable")==="true")}var cM="(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})",FZ=new RegExp("^(?:".concat(cM,")$")),UZ=new RegExp(cM),fM="\\d{3}-?\\d{2}-?\\d{4}",zZ=new RegExp("^(".concat(fM,")$")),qZ=new RegExp("(".concat(fM,")"));function du(e){var t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];return!(Wt(e)||qn(e)&&(e=Xp(e),(t?FZ:UZ).test((e||"").replace(/[- ]/g,""))||(t?zZ:qZ).test(e)))}function dM(e){var t=cg(e);return du(t="".concat(t," ").concat(hM(e)).trim())?t:""}function hM(e){var t="";return e&&e.childNodes&&e.childNodes.length&&rn(e.childNodes,function(n){var r;if(n&&((r=n.tagName)===null||r===void 0?void 0:r.toLowerCase())==="span")try{var i=cg(n);t="".concat(t," ").concat(i).trim(),n.childNodes&&n.childNodes.length&&(t="".concat(t," ").concat(hM(n)).trim())}catch(o){Xe.error("[AutoCapture]",o)}}),t}function jZ(e){return function(t){var n=t.map(r=>{var i,o,s="";if(r.tag_name&&(s+=r.tag_name),r.attr_class)for(var u of(r.attr_class.sort(),r.attr_class))s+=".".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 ng(c).sort((p,h)=>{var[m]=p,[v]=h;return m.localeCompare(v)}).forEach(p=>{var[h,m]=p;return d[pM(h.toString())]=pM(m.toString())}),s+=":",s+=ng(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:HZ(n),attr_id:n.attr__id,nth_child:n.nth_child,nth_of_type:n.nth_of_type,attributes:{}};return ng(n).filter(s=>{var[u]=s;return u.indexOf("attr__")===0}).forEach(s=>{var[u,c]=s;return o.attributes[u]=c}),o})}(e))}function pM(e){return e.replace(/"|\\"/g,'\\"')}function HZ(e){var t=e.attr__class;return t?En(t)?t:z1(t):void 0}class gM{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 GZ=["localhost","127.0.0.1"],hu=e=>{var t=Ge==null?void 0:Ge.createElement("a");return Be(t)?null:(t.href=e,t)},VZ=function(e){var t,n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"&",i=[];return rn(e,function(o,s){Be(o)||Be(s)||s==="undefined"||(t=encodeURIComponent((u=>u instanceof File)(o)?o.name:o.toString()),n=encodeURIComponent(s),i[i.length]=n+"="+t)}),i.join(r)},fg=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(!En(n)||n.length<2)return"";var s=n[1];try{s=decodeURIComponent(s)}catch{Xe.error("Skipping decoding for malformed query param: "+s)}return s.replace(/\+/g," ")},H1=function(e,t,n){if(!e||!t||!t.length)return e;for(var r=e.split("#"),i=r[0]||"",o=r[1],s=i.split("?"),u=s[1],c=s[0],d=(u||"").split("&"),p=[],h=0;h<d.length;h++){var m=d[h].split("=");En(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},dg=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},mM=kr("[AutoCapture]");function G1(e,t){return t.length>e?t.slice(0,e)+"...":t}function ZZ(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!lg(t));return t}function YZ(e,t,n,r){var i=e.tagName.toLowerCase(),o={tag_name:i};q1.indexOf(i)>-1&&!n&&(i.toLowerCase()==="a"||i.toLowerCase()==="button"?o.$el_text=G1(1024,dM(e)):o.$el_text=G1(1024,cg(e)));var s=ug(e);s.length>0&&(o.classes=s.filter(function(p){return p!==""})),rn(e.attributes,function(p){var h;if((!uM(e)||["name","id","class","aria-label"].indexOf(p.name)!==-1)&&(r==null||!r.includes(p.name))&&!t&&du(p.value)&&(h=p.name,!qn(h)||h.substring(0,10)!=="_ngcontent"&&h.substring(0,7)!=="_nghost")){var m=p.value;p.name==="class"&&(m=z1(m).join(" ")),o["attr__"+p.name]=G1(1024,m)}});for(var u=1,c=1,d=e;d=ZZ(d);)u++,d.tagName===e.tagName&&c++;return o.nth_child=u,o.nth_of_type=c,o}function WZ(e,t){for(var n,r,{e:i,maskAllElementAttributes:o,maskAllText:s,elementAttributeIgnoreList:u,elementsChainAsString:c}=t,d=[e],p=e;p.parentNode&&!Va(p,"body");)iM(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(rn(d,k=>{var O=j1(k);k.tagName.toLowerCase()==="a"&&(_=k.getAttribute("href"),_=O&&_&&du(_)&&_),kt(ug(k),"ph-no-capture")&&(x=!0),m.push(YZ(k,o,s,u));var T=function(L){if(!j1(L))return{};var B={};return rn(L.attributes,function(z){if(z.name&&z.name.indexOf("data-ph-capture-attribute")===0){var N=z.name.replace("data-ph-capture-attribute-",""),G=z.value;N&&G&&du(G)&&(B[N]=G)}}),B}(k);jn(v,T)}),x)return{props:{},explicitNoCapture:x};if(s||(e.tagName.toLowerCase()==="a"||e.tagName.toLowerCase()==="button"?m[0].$el_text=dM(e):m[0].$el_text=cg(e)),_){var w,b;m[0].attr__href=_;var C=(w=hu(_))===null||w===void 0?void 0:w.host,E=ue==null||(b=ue.location)===null||b===void 0?void 0:b.host;C&&E&&C!==E&&(h=_)}return{props:jn({$event_type:i.type,$ce_version:1},c?{}:{$elements:m},{$elements_chain:jZ(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 KZ{constructor(t){Me(this,"_initialized",!1),Me(this,"_isDisabledServerSide",null),Me(this,"rageclicks",new gM),Me(this,"_elementsChainAsString",!1),this.instance=t,this._elementSelectors=null}get config(){var t,n,r=kn(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(ue&&Ge){var t=r=>{r=r||(ue==null?void 0:ue.event);try{this._captureEvent(r)}catch(i){mM.error("Failed to capture event",i)}};if($n(Ge,"submit",t,{capture:!0}),$n(Ge,"change",t,{capture:!0}),$n(Ge,"click",t,{capture:!0}),this.config.capture_copied_text){var n=r=>{r=r||(ue==null?void 0:ue.event),this._captureEvent(r,A1)};$n(Ge,"copy",n,{capture:!0}),$n(Ge,"cut",n,{capture:!0})}}}else mM.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({[qT]:!!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=Ge==null?void 0:Ge.querySelectorAll(i);o==null||o.forEach(s=>{t===s&&r.push(i)})}),r}get isEnabled(){var t,n,r=(t=this.instance.persistence)===null||t===void 0?void 0:t.props[qT],i=this._isDisabledServerSide;if(ja(i)&&!Ha(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=sM(t);rM(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===A1;if(i&&BZ(i,t,this.config,o,o?["copy","cut"]:void 0)){var{props:s,explicitNoCapture:u}=WZ(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&&(s.$element_selectors=c),n===A1){var d,p=aM(ue==null||(d=ue.getSelection())===null||d===void 0?void 0:d.toString()),h=t.type||"clipboard";if(!p)return!1;s.$selected_content=p,s.$copy_type=h}return this.instance.capture(n,s),!0}}}isBrowserSupported(){return Yi(Ge==null?void 0:Ge.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 vM="0123456789abcdef";class hg{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 hg(o)}toString(){for(var t="",n=0;n<this.bytes.length;n++)t=t+vM.charAt(this.bytes[n]>>>4)+vM.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 hg(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 QZ{constructor(){Me(this,"timestamp",0),Me(this,"counter",0),Me(this,"random",new XZ)}generate(){var t=this.generateOrAbort();if(Be(t)){this.timestamp=0;var n=this.generateOrAbort();if(Be(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 hg.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 yM,_M=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};ue&&!Be(ue.crypto)&&crypto.getRandomValues&&(_M=e=>crypto.getRandomValues(e));class XZ{constructor(){Me(this,"buffer",new Uint32Array(8)),Me(this,"cursor",1/0)}nextUint32(){return this.cursor>=this.buffer.length&&(_M(this.buffer),this.cursor=0),this.buffer[this.cursor++]}}var Za=()=>JZ().toString(),JZ=()=>(yM||(yM=new QZ)).generate(),eY="Thu, 01 Jan 1970 00:00:00 GMT",Df="",tY=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function nY(e,t){if(t){var n=function(i){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ge;if(Df)return Df;if(!o||["localhost","127.0.0.1"].includes(i))return"";for(var s=i.split("."),u=Math.min(s.length,8),c="dmn_chk_"+Za(),d=new RegExp("(^|;)\\s*"+c+"=1");!Df&&u--;){var p=s.slice(u).join("."),h=c+"=1;domain=."+p;o.cookie=h,d.test(o.cookie)&&(o.cookie=h+";expires="+eY,Df=p)}return Df}(e);if(!n){var r=(i=>{var o=i.match(tY);return o?o[0]:""})(e);r!==n&&Xe.info("Warning: cookie subdomain discovery mismatch",r,n),n=r}return n?"; domain=."+n:""}return""}var Ya,Yo={is_supported:()=>!!Ge,error:function(e){Xe.error("cookieStore error: "+e)},get:function(e){if(Ge){try{for(var t=e+"=",n=Ge.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(Yo.get(e))||{}}catch{}return t},set:function(e,t,n,r,i){if(Ge)try{var o="",s="",u=nY(Ge.location.hostname,r);if(n){var c=new Date;c.setTime(c.getTime()+24*n*60*60*1e3),o="; expires="+c.toUTCString()}i&&(s="; secure");var d=e+"="+encodeURIComponent(JSON.stringify(t))+o+"; SameSite=Lax; path=/"+u+s;return d.length>3686.4&&Xe.warn("cookieStore warning: large cookie, len="+d.length),Ge.cookie=d,d}catch{return}},remove:function(e,t){try{Yo.set(e,"",-1,t)}catch{return}}},V1=null,Qn={is_supported:function(){if(!ja(V1))return V1;var e=!0;if(Be(ue))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||Xe.error("localStorage unsupported; falling back to cookie store"),V1=e,e},error:function(e){Xe.error("localStorage error: "+e)},get:function(e){try{return ue==null?void 0:ue.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{ue==null||ue.localStorage.setItem(e,JSON.stringify(t))}catch(n){Qn.error(n)}},remove:function(e){try{ue==null||ue.localStorage.removeItem(e)}catch(t){Qn.error(t)}}},rY=["distinct_id",rg,Tf,sg,U1],pg=pe(pe({},Qn),{},{parse:function(e){try{var t={};try{t=Yo.parse(e)||{}}catch{}var n=jn(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 s={};rY.forEach(u=>{t[u]&&(s[u]=t[u])}),Object.keys(s).length&&Yo.set(e,s,n,r,i,o)}catch(u){Qn.error(u)}},remove:function(e,t){try{ue==null||ue.localStorage.removeItem(e),Yo.remove(e,t)}catch(n){Qn.error(n)}}}),gg={},iY={is_supported:function(){return!0},error:function(e){Xe.error("memoryStorage error: "+e)},get:function(e){return gg[e]||null},parse:function(e){return gg[e]||null},set:function(e,t){gg[e]=t},remove:function(e){delete gg[e]}},zs=null,fr={is_supported:function(){if(!ja(zs))return zs;if(zs=!0,Be(ue))zs=!1;else try{var e="__support__";fr.set(e,"xyz"),fr.get(e)!=='"xyz"'&&(zs=!1),fr.remove(e)}catch{zs=!1}return zs},error:function(e){Xe.error("sessionStorage error: ",e)},get:function(e){try{return ue==null?void 0:ue.sessionStorage.getItem(e)}catch(t){fr.error(t)}return null},parse:function(e){try{return JSON.parse(fr.get(e))||null}catch{}return null},set:function(e,t){try{ue==null||ue.sessionStorage.setItem(e,JSON.stringify(t))}catch(n){fr.error(n)}},remove:function(e){try{ue==null||ue.sessionStorage.removeItem(e)}catch(t){fr.error(t)}}};(function(e){e[e.PENDING=-1]="PENDING",e[e.DENIED=0]="DENIED",e[e.GRANTED=1]="GRANTED"})(Ya||(Ya={}));class oY{constructor(t){this.instance=t}get config(){return this.instance.config}get consent(){return this.getDnt()?Ya.DENIED:this.storedConsent}isOptedOut(){return this.consent===Ya.DENIED||this.consent===Ya.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"?Ya.GRANTED:t==="0"?Ya.DENIED:Ya.PENDING}get storage(){if(!this._storage){var t=this.config.opt_out_capturing_persistence_type;this._storage=t==="localStorage"?Qn:Yo;var n=t==="localStorage"?Yo: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&&!!UT([ri==null?void 0:ri.doNotTrack,ri==null?void 0:ri.msDoNotTrack,ht.doNotTrack],t=>kt([!0,1,"1","yes"],t))}}var mg=kr("[Dead Clicks]"),aY=()=>!0,sY=e=>{var t,n=!((t=e.instance.persistence)===null||t===void 0||!t.get_property(GT)),r=e.instance.config.capture_dead_clicks;return Ha(r)?r:n};class bM{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({[GT]:t==null?void 0:t.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.loadScript(()=>{this.start()})}loadScript(t){var n,r,i;(n=ht.__PosthogExtensions__)!==null&&n!==void 0&&n.initDeadClicksAutocapture&&t(),(r=ht.__PosthogExtensions__)===null||r===void 0||(i=r.loadExternalDependency)===null||i===void 0||i.call(r,this.instance,"dead-clicks-autocapture",o=>{o?mg.error("failed to load script",o):t()})}start(){var t;if(Ge){if(!this._lazyLoadedDeadClicksAutocapture&&(t=ht.__PosthogExtensions__)!==null&&t!==void 0&&t.initDeadClicksAutocapture){var n=kn(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};n.__onCapture=this.onCapture,this._lazyLoadedDeadClicksAutocapture=ht.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this._lazyLoadedDeadClicksAutocapture.start(Ge),mg.info("starting...")}}else mg.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,mg.info("stopping..."))}}var Z1=kr("[ExceptionAutocapture]");class lY{constructor(t){var n;Me(this,"startCapturing",()=>{var r;if(ue&&this.isEnabled&&(r=ht.__PosthogExtensions__)!==null&&r!==void 0&&r.errorWrappingFunctions){var i=ht.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,o=ht.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=ht.__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=s(this.captureException.bind(this)))}catch(u){Z1.error("failed to start",u),this.stopCapturing()}}}),this.instance=t,this.remoteEnabled=!((n=this.instance.persistence)===null||n===void 0||!n.props[jT]),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 kn(t)?n=pe(pe({},n),t):(Be(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&&(Z1.info("enabled"),this.loadScript(this.startCapturing))}loadScript(t){var n,r,i;(n=ht.__PosthogExtensions__)!==null&&n!==void 0&&n.errorWrappingFunctions&&t(),(r=ht.__PosthogExtensions__)===null||r===void 0||(i=r.loadExternalDependency)===null||i===void 0||i.call(r,this.instance,"exception-autocapture",o=>{if(o)return Z1.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({[jT]: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 SM(e){return!Be(Event)&&wM(e,Event)}function wM(e,t){try{return e instanceof t}catch{return!1}}function vg(e,t){return Object.prototype.toString.call(e)==="[object ".concat(t,"]")}function Y1(e){return vg(e,"DOMError")}var xM=/\(error: (.*)\)/,CM=50,pu="?";function W1(e,t,n,r){var i={platform:"web:javascript",filename:e,function:t==="<anonymous>"?pu:t,in_app:!0};return Be(n)||(i.lineno=n),Be(r)||(i.colno=r),i}var uY=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,cY=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,fY=/\((\S*)(?::(\d+))(?::(\d+))\)/,dY=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,hY=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,pY=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,s=[],u=i.split(`
136
+ `);var t="",n,r,i=0,o;for(n=r=0,i=e.length,o=0;o<i;o++){var s=e.charCodeAt(o),u=null;s<128?r++:s>127&&s<2048?u=String.fromCharCode(s>>6|192,s&63|128):u=String.fromCharCode(s>>12|224,s>>6&63|128,s&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 ze.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 pO=["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<pO.length;t++)if(e.indexOf(pO[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,s){n=encodeURIComponent(o.toString()),r=encodeURIComponent(s),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{Ut.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},R.cookie={get:function(e){for(var t=e+"=",n=Vt.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,s){var u="",c="",d="";if(s)u="; domain="+s;else if(r){var p=vO(Vt.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"),Vt.cookie=e+"="+encodeURIComponent(t)+c+"; path=/"+u+d},set:function(e,t,n,r,i,o,s){var u="",c="",d="";if(s)u="; domain="+s;else if(r){var p=vO(Vt.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 Vt.cookie=m,m},remove:function(e,t,n){R.cookie.set(e,"",-1,t,!1,!1,n)}};var gO=function(e){var t=!0;try{var n="__mplss_"+Nb(8),r="xyz";e.setItem(n,r),e.getItem(n)!==r&&(t=!1),e.removeItem(n)}catch{t=!1}return t},$b=null,ff=function(e,t){return $b!==null&&!t?$b:$b=gO(e||ze.localStorage)},Lb=null,lV=function(e,t){return Lb!==null&&!t?Lb:Lb=gO(e||ze.sessionStorage)};function mO(e,t,n){var r=function(i){Ut.error(t+" error: "+i)};return{is_supported:function(i){var o=n(e,i);return o||Ut.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(s){r(s)}},remove:function(i){try{e.removeItem(i)}catch(o){r(o)}}}}R.localStorage=mO(ze.localStorage,"localStorage",ff),R.sessionStorage=mO(ze.sessionStorage,"sessionStorage",lV),R.register_event=function(){var e=function(r,i,o,s,u){if(!r){Ut.error("No valid element provided to register_event");return}if(r.addEventListener&&!s)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 s=function(u){if(u=u||n(ze.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 s}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 uV=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 s=" "+o+" ";return(" "+i.className+" ").replace(t," ").indexOf(s)>=0}function r(i){if(!Vt.getElementsByTagName)return[];var o=i.split(" "),s,u,c,d,p,h,m,v,_,x,w=[Vt];for(h=0;h<o.length;h++){if(s=o[h].replace(/^\s+/,"").replace(/\s+$/,""),s.indexOf("#")>-1){u=s.split("#"),c=u[0];var b=u[1],C=Vt.getElementById(b);if(!C||c&&C.nodeName.toLowerCase()!=c)return[];w=[C];continue}if(s.indexOf(".")>-1){u=s.split("."),c=u[0];var E=u[1];for(c||(c="*"),d=[],p=0,m=0;m<w.length;m++)for(c=="*"?_=e(w[m]):_=w[m].getElementsByTagName(c),v=0;v<_.length;v++)d[p++]=_[v];for(w=[],x=0,m=0;m<d.length;m++)d[m].className&&R.isString(d[m].className)&&n(d[m],E)&&(w[x++]=d[m]);continue}var k=s.match(uV);if(k){c=k[1];var O=k[2],T=k[3],L=k[4];for(c||(c="*"),d=[],p=0,m=0;m<w.length;m++)for(c=="*"?_=e(w[m]):_=w[m].getElementsByTagName(c),v=0;v<_.length;v++)d[p++]=_[v];w=[],x=0;var B;switch(T){case"=":B=function(z){return z.getAttribute(O)==L};break;case"~":B=function(z){return z.getAttribute(O).match(new RegExp("\\b"+L+"\\b"))};break;case"|":B=function(z){return z.getAttribute(O).match(new RegExp("^"+L+"-?"))};break;case"^":B=function(z){return z.getAttribute(O).indexOf(L)===0};break;case"$":B=function(z){return z.getAttribute(O).lastIndexOf(L)==z.getAttribute(O).length-L.length};break;case"*":B=function(z){return z.getAttribute(O).indexOf(L)>-1};break;default:B=function(z){return z.getAttribute(O)}}for(w=[],x=0,m=0;m<d.length;m++)B(d[m])&&(w[x++]=d[m]);continue}for(c=s,d=[],p=0,m=0;m<w.length;m++)for(_=w[m].getElementsByTagName(c),v=0;v<_.length;v++)d[p++]=_[v];w=d}return w}return function(i){return R.isElement(i)?[i]:R.isObject(i)&&!R.isUndefined(i.length)?i:r.call(this,i)}}();var cV=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_source_platform","utm_campaign_id","utm_creative_format","utm_marketing_tactic"],fV=["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(cV,function(r){t=R.getQueryParam(Vt.URL,r),t.length?n[r]=t:e!==void 0&&(n[r]=e)}),n},clickParams:function(){var e="",t={};return R.each(fV,function(n){e=R.getQueryParam(Vt.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 s=e.match(o);return s?parseFloat(s[s.length-2]):null},os:function(){var e=Po;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 ze.location.href},properties:function(e){return typeof e!="object"&&(e={}),R.extend(R.strip_empty_properties({$os:R.info.os(),$browser:R.info.browser(Po,Da.vendor,$p),$referrer:Vt.referrer,$referring_domain:R.info.referringDomain(Vt.referrer),$device:R.info.device(Po)}),{$current_url:R.info.currentUrl(),$browser_version:R.info.browserVersion(Po,Da.vendor,$p),$screen_height:cO.height,$screen_width:cO.width,mp_lib:"web",$lib_version:Hi.LIB_VERSION,$insert_id:Nb(),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(Po,Da.vendor,$p)}),{$browser_version:R.info.browserVersion(Po,Da.vendor,$p)})},mpPageViewProperties:function(){return R.strip_empty_properties({current_page_title:Vt.title,current_domain:ze.location.hostname,current_url_path:ze.location.pathname,current_url_protocol:ze.location.protocol,current_url_search:ze.location.search})}};var dV=function(e,t){var n=null,r=[];return function(i){var o=this;return r.push(i),n||(n=new jt(function(s){setTimeout(function(){var u=e.apply(o,[r]);n=null,r=[],s(u)},t)})),n}},Nb=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},hV=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,pV=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,vO=function(e){var t=pV,n=e.split("."),r=n[n.length-1];(r.length>4||r==="com"||r==="org")&&(t=hV);var i=e.match(t);return i?i[0]:""},gV=function(){var e=ze.navigator.onLine;return R.isUndefined(e)||e},$a=function(){},Yl=null,Lp=null;typeof JSON<"u"&&(Yl=JSON.stringify,Lp=JSON.parse),Yl=Yl||R.JSONEncode,Lp=Lp||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=Ta;var mV="mixpanelBrowserDb",yO="mixpanelRecordingEvents",Pb="mixpanelRecordingRegistry",vV=1,yV=[yO,Pb],uo=function(e){this.dbPromise=null,this.storeName=e};uo.prototype._openDb=function(){return new jt(function(e,t){var n=ze.indexedDB.open(mV,vV);n.onerror=function(){t(n.error)},n.onsuccess=function(){e(n.result)},n.onupgradeneeded=function(r){var i=r.target.result;yV.forEach(function(o){i.createObjectStore(o)})}})},uo.prototype.init=function(){return ze.indexedDB?(this.dbPromise||(this.dbPromise=this._openDb()),this.dbPromise.then(function(e){return e instanceof ze.IDBDatabase?jt.resolve():jt.reject(e)})):jt.reject("indexedDB is not supported in this browser")},uo.prototype.makeTransaction=function(e,t){var n=this.storeName,r=function(i){return new jt(function(o,s){var u=i.transaction(n,e);u.oncomplete=function(){o(u)},u.onabort=u.onerror=function(){s(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))},uo.prototype.setItem=function(e,t){return this.makeTransaction("readwrite",function(n){n.put(t,e)})},uo.prototype.getItem=function(e){var t;return this.makeTransaction("readonly",function(n){t=n.get(e)}).then(function(){return t.result})},uo.prototype.removeItem=function(e){return this.makeTransaction("readwrite",function(t){t.delete(e)})},uo.prototype.getAll=function(){var e;return this.makeTransaction("readonly",function(t){e=t.getAll()}).then(function(){return e.result})};var _V="__mp_opt_in_out_";function bV(e,t){SO(!0,e,t)}function SV(e,t){SO(!1,e,t)}function wV(e,t){return bO(e,t)==="1"}function _O(e,t){if(CV(t))return Ut.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=bO(e,t)==="0";return n&&Ut.warn("You are opted out of Mixpanel tracking. This will prevent the Mixpanel SDK from sending any data."),n}function La(e){return Ub(e,function(t){return this.get_config(t)})}function Na(e){return Ub(e,function(t){return this._get_config(t)})}function Wl(e){return Ub(e,function(t){return this._get_config(t)})}function xV(e,t){t=t||{},Bb(t).remove(Fb(e,t),!!t.crossSubdomainCookie,t.cookieDomain)}function Bb(e){return e=e||{},e.persistenceType==="localStorage"?R.localStorage:R.cookie}function Fb(e,t){return t=t||{},(t.persistencePrefix||_V)+e}function bO(e,t){return Bb(t).get(Fb(e,t))}function CV(e){if(e&&e.ignoreDnt)return!1;var t=e&&e.window||ze,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 SO(e,t,n){if(!R.isString(t)||!t.length){Ut.error("gdpr."+(e?"optIn":"optOut")+" called with an invalid token");return}n=n||{},Bb(n).set(Fb(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 Ub(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"),s=t.call(this,"opt_out_tracking_cookie_prefix"),u=t.call(this,"window");r&&(n=_O(r,{ignoreDnt:i,persistenceType:o,persistencePrefix:s,window:u}))}catch(d){Ut.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 EV=Zl("lock"),wO=function(e,t){t=t||{},this.storageKey=e,this.storage=t.storage||ze.localStorage,this.pollIntervalMS=t.pollIntervalMS||100,this.timeoutMS=t.timeoutMS||2e3,this.promiseImpl=t.promiseImpl||jt};wO.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(),s=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()-s>d){EV.error("Timeout waiting for mutex on "+u+"; clearing lock. ["+o+"]"),p.removeItem(v),p.removeItem(m),b();return}setTimeout(function(){try{E()}catch(k){i(k)}},c*(Math.random()+.1))},x=function(E,k){E()?k():_(function(){x(E,k)})},w=function(){var E=p.getItem(m);return E&&E!==o?!1:(p.setItem(m,o),p.getItem(m)===o?!0:(ff(p,!0)||i(new Error("localStorage support dropped while acquiring lock")),!1))},b=function(){p.setItem(h,o),x(w,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(k){E(),r(k)}).catch(function(k){E(),i(k)})};try{if(ff(p,!0))b();else throw new Error("localStorage support check failed")}catch(E){i(E)}},this))};var df=function(e){this.storage=e||ze.localStorage};df.prototype.init=function(){return jt.resolve()},df.prototype.setItem=function(e,t){return new jt(R.bind(function(n,r){try{this.storage.setItem(e,Yl(t))}catch(i){r(i)}n()},this))},df.prototype.getItem=function(e){return new jt(R.bind(function(t,n){var r;try{r=Lp(this.storage.getItem(e))}catch(i){n(i)}t(r)},this))},df.prototype.removeItem=function(e){return new jt(R.bind(function(t,n){try{this.storage.removeItem(e)}catch(r){n(r)}t()},this))};var xO=Zl("batch"),co=function(e,t){t=t||{},this.storageKey=e,this.usePersistence=t.usePersistence,this.usePersistence&&(this.queueStorage=t.queueStorage||new df,this.lock=new wO(e,{storage:t.sharedLockStorage||ze.localStorage,timeoutMS:t.sharedLockTimeoutMS})),this.reportError=t.errorReporter||R.bind(xO.error,xO),this.pid=t.pid||null,this.memQueue=[],this.initialized=!1,t.enqueueThrottleMs?this.enqueuePersisted=dV(R.bind(this._enqueuePersisted,this),t.enqueueThrottleMs):this.enqueuePersisted=R.bind(function(n){return this._enqueuePersisted([n])},this)};co.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))},co.prototype.enqueue=function(e,t){var n={id:Nb(),flushAfter:new Date().getTime()+t*2,payload:e};return this.usePersistence?this.enqueuePersisted(n):(this.memQueue.push(n),jt.resolve(!0))},co.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))},co.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(s){r[s.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 CO=function(e,t){var n=[];return R.each(e,function(r){r.id&&!t[r.id]&&n.push(r)}),n};co.prototype.removeItemsByID=function(e){var t={};if(R.each(e,function(r){t[r]=!0}),this.memQueue=CO(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=CO(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),ff(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 EO=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};co.prototype.updatePayloads=function(e){return this.memQueue=EO(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=EO(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)},co.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))},co.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))},co.prototype.clear=function(){return this.memQueue=[],this.usePersistence?this.ensureInit().then(R.bind(function(){return this.queueStorage.removeItem(this.storageKey)},this)):jt.resolve()};var kV=10*60*1e3,hf=Zl("batch"),yi=function(e,t){this.errorReporter=t.errorReporter,this.queue=new co(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};yi.prototype.enqueue=function(e){return this.queue.enqueue(e,this.flushInterval)},yi.prototype.start=function(){return this.stopped=!1,this.consecutiveRemovalFailures=0,this.flush()},yi.prototype.stop=function(){this.stopped=!0,this.timeoutID&&(clearTimeout(this.timeoutID),this.timeoutID=null)},yi.prototype.clear=function(){return this.queue.clear()},yi.prototype.resetBatchSize=function(){this.batchSize=this.libConfig.batch_size},yi.prototype.resetFlush=function(){this.scheduleFlush(this.libConfig.batch_flush_interval_ms)},yi.prototype.scheduleFlush=function(e){this.flushInterval=e,this.stopped||(this.timeoutID=setTimeout(R.bind(function(){this.stopped||(this._flushPromise=this.flush())},this),this.flushInterval))},yi.prototype.sendRequestPromise=function(e,t){return new jt(R.bind(function(n){this.sendRequest(e,t,n)},this))},yi.prototype.flush=function(e){if(this.requestInProgress)return hf.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,s=[],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:Hi.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&&s.push(m)}u[h.id]=m},this),s.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&&!gV()||h.error==="timeout")){var m=this.flushInterval*2;return h.retryAfter&&(m=parseInt(h.retryAfter,10)*1e3||m),m=Math.min(kV,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"),hf.log("MIXPANEL REQUEST:",s),this.sendRequestPromise(s,p).then(d)},this)).catch(R.bind(function(i){this.reportError("Error flushing request queue",i),this.resetFlush()},this))},yi.prototype.reportError=function(e,t){if(hf.error.apply(hf.error,arguments),this.errorReporter)try{t instanceof Error||(t=new Error(e)),this.errorReporter(e,t)}catch(n){hf.error(n)}};var zb=function(e){var t=Date.now();return!e||t>e.maxExpires||t>e.idleExpires},AV=250,Kl=Zl("recorder"),kO=ze.CompressionStream,IV={batch_size:1e3,batch_flush_interval_ms:10*1e3,batch_request_timeout_ms:90*1e3,batch_autostart:!0},RV=new Set([ft.MouseMove,ft.MouseInteraction,ft.Scroll,ft.ViewportResize,ft.Input,ft.TouchMove,ft.MediaInteraction,ft.Drag,ft.Selection]);function OV(e){return e.type===Dt.IncrementalSnapshot&&RV.has(e.data.source)}var xr=function(e){this._mixpanel=e.mixpanelInstance,this._onIdleTimeout=e.onIdleTimeout||$a,this._onMaxLengthReached=e.onMaxLengthReached||$a,this._onBatchSent=e.onBatchSent||$a,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=uf,this.recordMinMs=0;var t=ff(e.sharedLockStorage,!0);this.batcherKey="__mprec_"+this.getConfig("name")+"_"+this.getConfig("token")+"_"+this.replayId,this.queueStorage=new uo(yO),this.batcher=new yi(this.batcherKey,{errorReporter:this.reportError.bind(this),flushOnlyOnInterval:!0,libConfig:IV,sendRequestFunc:this.flushEventsWithOptOut.bind(this),queueStorage:this.queueStorage,sharedLockStorage:e.sharedLockStorage,usePersistence:t,stopAllBatchingFunc:this.stopRecording.bind(this),enqueueThrottleMs:AV,sharedLockTimeoutMS:10*1e3})};xr.prototype.unloadPersistedData=function(){return this.batcher.stop(),this.batcher.flush().then((function(){return this.queueStorage.removeItem(this.batcherKey)}).bind(this))},xr.prototype.getConfig=function(e){return this._mixpanel.get_config(e)},xr.prototype.get_config=function(e){return this.getConfig(e)},xr.prototype.startRecording=function(e){if(this._rrwebRecord===null){this.reportError("rrweb record function not provided. ");return}if(this._stopRecording!==null){Kl.log("Recording already in progress, skipping startRecording.");return}this.recordMaxMs=this.getConfig("record_max_ms"),this.recordMaxMs>uf&&(this.recordMaxMs=uf,Kl.critical("record_max_ms cannot be greater than "+uf+"ms. Capping value.")),this.maxExpires||(this.maxExpires=new Date().getTime()+this.recordMaxMs),this.recordMinMs=this.getConfig("record_min_ms"),this.recordMinMs>Rb&&(this.recordMinMs=Rb,Kl.critical("record_min_ms cannot be greater than "+Rb+"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}OV(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)},xr.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},xr.prototype.isRrwebStopped=function(){return this._stopRecording===null},xr.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)},xr.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}},xr.deserialize=function(e,t){var n=new xr(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},xr.prototype._sendRequest=function(e,t,n,r){var i=(function(o,s){o.status===200&&this.replayId===e&&(this.seqNo++,this.batchStartUrl=R.info.currentUrl()),this._onBatchSent(),r({status:0,httpStatusCode:o.status,responseBody:s,retryAfter:o.headers.get("Retry-After")})}).bind(this);ze.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(s){i(o,s)}).catch(function(s){r({error:s})})}).catch(function(o){r({error:o,httpStatusCode:0})})},xr.prototype._flushEvents=La(function(e,t,n){var r=e.length;if(r>0){for(var i=this.replayId,o=1/0,s=-1/0,u=!1,c=0;c<r;c++)o=Math.min(o,e[c].timestamp),s=Math.max(s,e[c].timestamp),e[c].type===Dt.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=s-this.replayStartTime,p={$current_url:this.batchStartUrl,$lib_version:Hi.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),kO){var _=new Blob([h],{type:"application/json"}).stream(),x=_.pipeThrough(new kO("gzip"));new Response(x).blob().then((function(w){p.format="gzip",this._sendRequest(i,p,w,n)}).bind(this))}else p.format="body",this._sendRequest(i,p,h,n)}}),xr.prototype.reportError=function(e,t){Kl.error.apply(Kl.error,arguments);try{!t&&!(e instanceof Error)&&(e=new Error(e)),this.getConfig("error_reporter")(e,t)}catch(n){Kl.error(n)}};var Ql=function(e){this.idb=new uo(Pb),this.errorReporter=e.errorReporter,this.mixpanelInstance=e.mixpanelInstance,this.sharedLockStorage=e.sharedLockStorage};Ql.prototype.handleError=function(e){this.errorReporter("IndexedDB error: ",e)},Ql.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())},Ql.prototype.getActiveRecording=function(){return this.idb.init().then((function(){return this.idb.getItem(this.mixpanelInstance.get_tab_id())}).bind(this)).then((function(e){return zb(e)?null:e}).bind(this)).catch(this.handleError.bind(this))},Ql.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))},Ql.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 zb(n)}).map((function(n){var r=xr.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 pf=Zl("recorder"),Bo=function(e,t,n){this.mixpanelInstance=e,this.rrwebRecord=t||Ra,this.sharedLockStorage=n,this.recordingRegistry=new Ql({mixpanelInstance:this.mixpanelInstance,errorReporter:pf.error,sharedLockStorage:n}),this._flushInactivePromise=this.recordingRegistry.flushInactiveRecordings(),this.activeRecording=null};Bo.prototype.startRecording=function(e){if(e=e||{},this.activeRecording&&!this.activeRecording.isRrwebStopped()){pf.log("Recording already in progress, skipping startRecording.");return}var t=(function(){pf.log("Idle timeout reached, restarting recording."),this.resetRecording()}).bind(this),n=(function(){pf.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=xr.deserialize(e.activeSerializedRecording,i):this.activeRecording=new xr(i),this.activeRecording.startRecording(e.shouldStopBatcher),this.recordingRegistry.setActiveRecording(this.activeRecording.serialize())},Bo.prototype.stopRecording=function(){var e=this._stopCurrentRecording(!1);return this.recordingRegistry.clearActiveRecording(),this.activeRecording=null,e},Bo.prototype.pauseRecording=function(){return this._stopCurrentRecording(!1)},Bo.prototype._stopCurrentRecording=function(e){return this.activeRecording?this.activeRecording.stopRecording(e):jt.resolve()},Bo.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}):(pf.log("No resumable recording found."),null)}).bind(this))},Bo.prototype.resetRecording=function(){this.stopRecording(),this.startRecording({shouldStopBatcher:!0})},Bo.prototype.getActiveReplayId=function(){return this.activeRecording&&!this.activeRecording.isRrwebStopped()?this.activeRecording.replayId:null},Object.defineProperty(Bo.prototype,"replayId",{get:function(){return this.getActiveReplayId()}}),ze.__mp_recorder=Bo;var Np="change",gf="click",AO="hashchange",Xl="mp_locationchange",IO="popstate",RO="scrollend",qb="submit",TV=["clientX","clientY","offsetX","offsetY","pageX","pageY","screenX","screenY","x","y"],OO=["mp-include"],jb=["mp-no-track"],TO=jb.concat(["mp-sensitive"]),MV=["aria-label","aria-labelledby","aria-describedby","href","name","role","title","type"],qr=Zl("autocapture");function Hb(e){for(var t={},n=MO(e).split(" "),r=0;r<n.length;r++){var i=n[r];i&&(t[i]=!0)}return t}function MO(e){switch(typeof e.className){case"string":return e.className;case"object":return e.className.baseVal||e.getAttribute("class")||"";default:return""}}function DV(e){if(e.previousElementSibling)return e.previousElementSibling;do e=e.previousSibling;while(e&&!LO(e));return e}function DO(e,t,n,r,i,o){var s={$classes:MO(e).split(" "),$tag_name:e.tagName.toLowerCase()},u=e.id;u&&(s.$id=u),Zb(e,t,i,o)&&R.each(MV.concat(r),function(h){if(e.hasAttribute(h)&&!n[h]){var m=e.getAttribute(h);Pp(m)&&(s["$attr-"+h]=m)}});for(var c=1,d=1,p=e;p=DV(p);)c++,p.tagName===e.tagName&&d++;return s.$nth_child=c,s.$nth_of_type=d,s}function $V(e,t){var n=t.allowElementCallback,r=t.allowSelectors||[],i=t.blockAttrs||[],o=t.blockElementCallback,s=t.blockSelectors||[],u=t.captureTextContent||!1,c=t.captureExtraAttrs||[],d={};R.each(i,function(k){d[k]=!0});var p=null,h=typeof e.target>"u"?e.srcElement:e.target;if(NO(h)&&(h=h.parentNode),PV(h,e)&&Gb(h,e,n,r)&&!Vb(h,e,o,s)){for(var m=[h],v=h;v.parentNode&&!fo(v,"body");)m.push(v.parentNode),v=v.parentNode;var _=[],x,w=!1;if(R.each(m,function(k){var O=Zb(k,e,n,r);!d.href&&k.tagName.toLowerCase()==="a"&&(x=k.getAttribute("href"),x=O&&Pp(x)&&x),Vb(k,e,o,s)&&(w=!0),_.push(DO(k,e,d,c,n,r))},this),!w){var b=Vt.documentElement;if(p={$event_type:e.type,$host:ze.location.host,$pathname:ze.location.pathname,$elements:_,$el_attr__href:x,$viewportHeight:Math.max(b.clientHeight,ze.innerHeight||0),$viewportWidth:Math.max(b.clientWidth,ze.innerWidth||0)},R.each(c,function(k){if(!d[k]&&h.hasAttribute(k)){var O=h.getAttribute(k);Pp(O)&&(p["$el_attr__"+k]=O)}}),u&&(C=$O(h,e,n,r),C&&C.length&&(p.$el_text=C)),e.type===gf&&(R.each(TV,function(k){k in e&&(p["$"+k]=e[k])}),h=LV(e)),u){var C=$O(h,e,n,r);C&&C.length&&(p.$el_text=C)}if(h){if(!Gb(h,e,n,r)||Vb(h,e,o,s))return null;var E=DO(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 $O(e,t,n,r){var i="";return Zb(e,t,n,r)&&e.childNodes&&e.childNodes.length&&R.each(e.childNodes,function(o){NO(o)&&o.textContent&&(i+=R.trim(o.textContent).split(/(\s+)/).filter(Pp).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255))}),R.trim(i)}function LV(e){for(var t=e.target,n=e.composedPath(),r=0;r<n.length;r++){var i=n[r];if(fo(i,"a")||fo(i,"button")||fo(i,"input")||fo(i,"select")||i.getAttribute&&i.getAttribute("role")==="button"){t=i;break}if(i===t)break}return t}function Gb(e,t,n,r){if(n)try{if(!n(e,t))return!1}catch(s){return qr.critical("Error while checking element in allowElementCallback",s),!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(s){qr.critical("Error while checking selector: "+o,s)}}return!1}function Vb(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 s=Hb(e);for(i=0;i<jb.length;i++)if(s[jb[i]])return!0;return!1}function LO(e){return e&&e.nodeType===1}function fo(e,t){return e&&e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function NO(e){return e&&e.nodeType===3}function NV(){try{var e=Vt.createElement("div");return!!e.matches}catch{return!1}}function PV(e,t){if(!e||fo(e,"html")||!LO(e))return!1;var n=e.tagName.toLowerCase();switch(n){case"form":return t.type===qb;case"input":return["button","submit"].indexOf(e.getAttribute("type"))===-1?t.type===Np:t.type===gf;case"select":case"textarea":return t.type===Np;default:return t.type===gf}}function Zb(e,t,n,r){var i;if(!Gb(e,t,n,r))return!1;for(var o=e;o.parentNode&&!fo(o,"body");o=o.parentNode){var s=Hb(o);for(i=0;i<TO.length;i++)if(s[TO[i]])return!1}var u=Hb(e);for(i=0;i<OO.length;i++)if(u[OO[i]])return!0;if(fo(e,"input")||fo(e,"select")||fo(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 Pp(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 PO="autocapture",BV="track_pageview",BO="full-url",FV="url-with-path-and-query-string",UV="url-with-path",zV="allow_element_callback",FO="allow_selectors",UO="allow_url_regexes",zO="block_attrs",qO="block_element_callback",jO="block_selectors",HO="block_url_regexes",GO="capture_extra_attrs",VO="capture_text_content",ZO="scroll_capture_all",YO="scroll_depth_percent_checkpoints",Yb="click",Wb="input",WO="pageview",Kb="scroll",Qb="submit",lr={};lr[FO]=[],lr[UO]=[],lr[zO]=[],lr[qO]=null,lr[jO]=[],lr[HO]=[],lr[GO]=[],lr[VO]=!1,lr[ZO]=!1,lr[YO]=[25,50,75,100],lr[Yb]=!0,lr[Wb]=!0,lr[WO]=BO,lr[Kb]=!0,lr[Qb]=!0;var Bp={$mp_autocapture:!0},qV="$mp_click",jV="$mp_input_change",HV="$mp_scroll",GV="$mp_submit",ti=function(e){this.mp=e};ti.prototype.init=function(){if(!NV()){qr.critical("Autocapture unavailable: missing required DOM APIs");return}this.initPageviewTracking(),this.initClickTracking(),this.initInputTracking(),this.initScrollTracking(),this.initSubmitTracking()},ti.prototype.getFullConfig=function(){var e=this.mp.get_config(PO);return e?R.isObject(e)?R.extend({},lr,e):lr:{}},ti.prototype.getConfig=function(e){return this.getFullConfig()[e]},ti.prototype.currentUrlBlocked=function(){var e,t=R.info.currentUrl(),n=this.getConfig(UO)||[];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(s){return qr.critical("Error while checking block URL regex: "+i,s),!0}}if(!r)return!0}var o=this.getConfig(HO)||[];if(!o||!o.length)return!1;for(e=0;e<o.length;e++)try{if(t.match(o[e]))return!0}catch(s){return qr.critical("Error while checking block URL regex: "+o[e],s),!0}return!1},ti.prototype.pageviewTrackingConfig=function(){return this.mp.get_config(PO)?this.getConfig(WO):this.mp.get_config(BV)},ti.prototype.trackDomEvent=function(e,t){if(!this.currentUrlBlocked()){var n=$V(e,{allowElementCallback:this.getConfig(zV),allowSelectors:this.getConfig(FO),blockAttrs:this.getConfig(zO),blockElementCallback:this.getConfig(qO),blockSelectors:this.getConfig(jO),captureExtraAttrs:this.getConfig(GO),captureTextContent:this.getConfig(VO)});n&&(R.extend(n,Bp),this.mp.track(t,n))}},ti.prototype.initClickTracking=function(){ze.removeEventListener(gf,this.listenerClick),this.getConfig(Yb)&&(qr.log("Initializing click tracking"),this.listenerClick=ze.addEventListener(gf,(function(e){this.getConfig(Yb)&&this.trackDomEvent(e,qV)}).bind(this)))},ti.prototype.initInputTracking=function(){ze.removeEventListener(Np,this.listenerChange),this.getConfig(Wb)&&(qr.log("Initializing input tracking"),this.listenerChange=ze.addEventListener(Np,(function(e){this.getConfig(Wb)&&this.trackDomEvent(e,jV)}).bind(this)))},ti.prototype.initPageviewTracking=function(){if(ze.removeEventListener(IO,this.listenerPopstate),ze.removeEventListener(AO,this.listenerHashchange),ze.removeEventListener(Xl,this.listenerLocationchange),!!this.pageviewTrackingConfig()){qr.log("Initializing pageview tracking");var e="",t=!1;this.currentUrlBlocked()||(t=this.mp.track_pageview(Bp)),t&&(e=R.info.currentUrl()),this.listenerPopstate=ze.addEventListener(IO,function(){ze.dispatchEvent(new Event(Xl))}),this.listenerHashchange=ze.addEventListener(AO,function(){ze.dispatchEvent(new Event(Xl))});var n=ze.history.pushState;typeof n=="function"&&(ze.history.pushState=function(i,o,s){n.call(ze.history,i,o,s),ze.dispatchEvent(new Event(Xl))});var r=ze.history.replaceState;typeof r=="function"&&(ze.history.replaceState=function(i,o,s){r.call(ze.history,i,o,s),ze.dispatchEvent(new Event(Xl))}),this.listenerLocationchange=ze.addEventListener(Xl,Db((function(){if(!this.currentUrlBlocked()){var i=R.info.currentUrl(),o=!1,s=i.split("#")[0].split("?")[0]!==e.split("#")[0].split("?")[0],u=this.pageviewTrackingConfig();if(u===BO?o=i!==e:u===FV?o=i.split("#")[0]!==e.split("#")[0]:u===UV&&(o=s),o){var c=this.mp.track_pageview(Bp);c&&(e=i),s&&(this.lastScrollCheckpoint=0,qr.log("Path change: re-initializing scroll depth checkpoints"))}}}).bind(this)))}},ti.prototype.initScrollTracking=function(){ze.removeEventListener(RO,this.listenerScroll),this.getConfig(Kb)&&(qr.log("Initializing scroll tracking"),this.lastScrollCheckpoint=0,this.listenerScroll=ze.addEventListener(RO,Db((function(){if(this.getConfig(Kb)&&!this.currentUrlBlocked()){var e=this.getConfig(ZO),t=(this.getConfig(YO)||[]).slice().sort(function(c,d){return c-d}),n=ze.scrollY,r=R.extend({$scroll_top:n},Bp);try{var i=Vt.body.scrollHeight,o=Math.round(n/(i-ze.innerHeight)*100);if(r.$scroll_height=i,r.$scroll_percentage=o,o>this.lastScrollCheckpoint)for(var s=0;s<t.length;s++){var u=t[s];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(HV,r)}}).bind(this))))},ti.prototype.initSubmitTracking=function(){ze.removeEventListener(qb,this.listenerSubmit),this.getConfig(Qb)&&(qr.log("Initializing submit tracking"),this.listenerSubmit=ze.addEventListener(qb,(function(e){this.getConfig(Qb)&&this.trackDomEvent(e,GV)}).bind(this)))},sV(ti);var Fo=function(){};Fo.prototype.create_properties=function(){},Fo.prototype.event_handler=function(){},Fo.prototype.after_track_handler=function(){},Fo.prototype.init=function(e){return this.mp=e,this},Fo.prototype.track=function(e,t,n,r){var i=this,o=R.dom_query(e);if(o.length===0){Ut.error("The DOM query ("+e+") returned 0 elements");return}return R.each(o,function(s){R.register_event(s,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},Fo.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))}},Fo.prototype.create_properties=function(e,t){var n;return typeof e=="function"?n=e(t):n=R.extend({},e),n};var Jl=function(){this.override_event="click"};R.inherit(Jl,Fo),Jl.prototype.create_properties=function(e,t){var n=Jl.superclass.create_properties.apply(this,arguments);return t.href&&(n.url=t.href),n},Jl.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()},Jl.prototype.after_track_handler=function(e,t){t.new_tab||setTimeout(function(){window.location=t.href},0)};var Fp=function(){this.override_event="submit"};R.inherit(Fp,Fo),Fp.prototype.event_handler=function(e,t,n){n.element=t,e.preventDefault()},Fp.prototype.after_track_handler=function(e,t){setTimeout(function(){t.element.submit()},0)};var Pa="$set",eu="$set_once",Gi="$unset",$s="$add",ho="$append",Ls="$union",Uo="$remove",VV="$delete",KO={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[Pa]=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[Gi]=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[eu]=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[Ls]=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[ho]=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[Uo]=r,n},delete_action:function(){var e={};return e[VV]="",e}},pn=function(){};R.extend(pn.prototype,KO),pn.prototype._init=function(e,t,n){this._mixpanel=e,this._group_key=t,this._group_id=n},pn.prototype.set=Wl(function(e,t,n){var r=this.set_action(e,t);return R.isObject(e)&&(n=t),this._send_request(r,n)}),pn.prototype.set_once=Wl(function(e,t,n){var r=this.set_once_action(e,t);return R.isObject(e)&&(n=t),this._send_request(r,n)}),pn.prototype.unset=Wl(function(e,t){var n=this.unset_action(e);return this._send_request(n,t)}),pn.prototype.union=Wl(function(e,t,n){R.isObject(e)&&(n=t);var r=this.union_action(e,t);return this._send_request(r,n)}),pn.prototype.delete=Wl(function(e){var t=this.delete_action();return this._send_request(t,e)}),pn.prototype.remove=Wl(function(e,t,n){var r=this.remove_action(e,t);return this._send_request(r,n)}),pn.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)},pn.prototype._is_reserved_property=function(e){return e==="$group_key"||e==="$group_id"},pn.prototype._get_config=function(e){return this._mixpanel.get_config(e)},pn.prototype.toString=function(){return this._mixpanel.toString()+".group."+this._group_key+"."+this._group_id},pn.prototype.remove=pn.prototype.remove,pn.prototype.set=pn.prototype.set,pn.prototype.set_once=pn.prototype.set_once,pn.prototype.union=pn.prototype.union,pn.prototype.unset=pn.prototype.unset,pn.prototype.toString=pn.prototype.toString;var dt=function(){};R.extend(dt.prototype,KO),dt.prototype._init=function(e){this._mixpanel=e},dt.prototype.set=Na(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[Pa]=R.extend({},R.info.people_properties(),r[Pa]),this._send_request(r,n)}),dt.prototype.set_once=Na(function(e,t,n){var r=this.set_once_action(e,t);return R.isObject(e)&&(n=t),this._send_request(r,n)}),dt.prototype.unset=Na(function(e,t){var n=this.unset_action(e);return this._send_request(n,t)}),dt.prototype.increment=Na(function(e,t,n){var r={},i={};return R.isObject(e)?(R.each(e,function(o,s){if(!this._is_reserved_property(s))if(isNaN(parseFloat(o))){Ut.error("Invalid increment value passed to mixpanel.people.increment - must be a number");return}else i[s]=o},this),n=t):(R.isUndefined(t)&&(t=1),i[e]=t),r[$s]=i,this._send_request(r,n)}),dt.prototype.append=Na(function(e,t,n){R.isObject(e)&&(n=t);var r=this.append_action(e,t);return this._send_request(r,n)}),dt.prototype.remove=Na(function(e,t,n){R.isObject(e)&&(n=t);var r=this.remove_action(e,t);return this._send_request(r,n)}),dt.prototype.union=Na(function(e,t,n){R.isObject(e)&&(n=t);var r=this.union_action(e,t);return this._send_request(r,n)}),dt.prototype.track_charge=Na(function(e,t,n){if(!R.isNumber(e)&&(e=parseFloat(e),isNaN(e))){Ut.error("Invalid value passed to mixpanel.people.track_charge - must be a number");return}return this.append("$transactions",R.extend({$amount:e},t),n)}),dt.prototype.clear_charges=function(e){return this.set("$transactions",[],e)},dt.prototype.delete_user=function(){if(!this._identify_called()){Ut.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)},dt.prototype.toString=function(){return this._mixpanel.toString()+".people"},dt.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))},dt.prototype._get_config=function(e){return this._mixpanel.get_config(e)},dt.prototype._identify_called=function(){return this._mixpanel._flags.identify_called===!0},dt.prototype._enqueue=function(e){Pa in e?this._mixpanel.persistence._add_to_people_queue(Pa,e):eu in e?this._mixpanel.persistence._add_to_people_queue(eu,e):Gi in e?this._mixpanel.persistence._add_to_people_queue(Gi,e):$s in e?this._mixpanel.persistence._add_to_people_queue($s,e):ho in e?this._mixpanel.persistence._add_to_people_queue(ho,e):Uo in e?this._mixpanel.persistence._add_to_people_queue(Uo,e):Ls in e?this._mixpanel.persistence._add_to_people_queue(Ls,e):Ut.error("Invalid call to _enqueue():",e)},dt.prototype._flush_one_queue=function(e,t,n,r){var i=this,o=R.extend({},this._mixpanel.persistence.load_queue(e)),s=o;!R.isUndefined(o)&&R.isObject(o)&&!R.isEmptyObject(o)&&(i._mixpanel.persistence._pop_from_people_queue(e,o),i._mixpanel.persistence.save(),r&&(s=r(o)),t.call(i,s,function(u,c){u===0&&i._mixpanel.persistence._add_to_people_queue(e,o),R.isUndefined(n)||n(u,c)}))},dt.prototype._flush=function(e,t,n,r,i,o,s){var u=this;this._flush_one_queue(Pa,this.set,e),this._flush_one_queue(eu,this.set_once,r),this._flush_one_queue(Gi,this.unset,o,function(w){return R.keys(w)}),this._flush_one_queue($s,this.increment,t),this._flush_one_queue(Ls,this.union,i);var c=this._mixpanel.persistence.load_queue(ho);if(!R.isUndefined(c)&&R.isArray(c)&&c.length)for(var d,p=function(w,b){w===0&&u._mixpanel.persistence._add_to_people_queue(ho,d),R.isUndefined(n)||n(w,b)},h=c.length-1;h>=0;h--)c=this._mixpanel.persistence.load_queue(ho),d=c.pop(),u._mixpanel.persistence.save(),R.isEmptyObject(d)||u.append(d,p);var m=this._mixpanel.persistence.load_queue(Uo);if(!R.isUndefined(m)&&R.isArray(m)&&m.length)for(var v,_=function(w,b){w===0&&u._mixpanel.persistence._add_to_people_queue(Uo,v),R.isUndefined(s)||s(w,b)},x=m.length-1;x>=0;x--)m=this._mixpanel.persistence.load_queue(Uo),v=m.pop(),u._mixpanel.persistence.save(),R.isEmptyObject(v)||u.remove(v,_)},dt.prototype._is_reserved_property=function(e){return e==="$distinct_id"||e==="$token"||e==="$device_id"||e==="$user_id"||e==="$had_persisted_distinct_id"},dt.prototype.set=dt.prototype.set,dt.prototype.set_once=dt.prototype.set_once,dt.prototype.unset=dt.prototype.unset,dt.prototype.increment=dt.prototype.increment,dt.prototype.append=dt.prototype.append,dt.prototype.remove=dt.prototype.remove,dt.prototype.union=dt.prototype.union,dt.prototype.track_charge=dt.prototype.track_charge,dt.prototype.clear_charges=dt.prototype.clear_charges,dt.prototype.delete_user=dt.prototype.delete_user,dt.prototype.toString=dt.prototype.toString;var Xb="__mps",Jb="__mpso",e1="__mpus",t1="__mpa",n1="__mpap",r1="__mpr",i1="__mpu",QO="$people_distinct_id",Up="__alias",mf="__timers",ZV=[Xb,Jb,e1,t1,n1,r1,i1,QO,Up,mf],xt=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"&&(Ut.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()};xt.prototype.properties=function(){var e={};return this.load(),R.each(this.props,function(t,n){R.include(ZV,n)||(e[n]=t)}),e},xt.prototype.load=function(){if(!this.disabled){var e=this.storage.parse(this.name);e&&(this.props=R.extend({},e))}},xt.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))},xt.prototype.save=function(){this.disabled||this.storage.set(this.name,Yl(this.props),this.expire_days,this.cross_subdomain,this.secure,this.cross_site,this.cookie_domain)},xt.prototype.load_prop=function(e){return this.load(),this.props[e]},xt.prototype.remove=function(){this.storage.remove(this.name,!1,this.cookie_domain),this.storage.remove(this.name,!0,this.cookie_domain)},xt.prototype.clear=function(){this.remove(),this.props={}},xt.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},xt.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},xt.prototype.unregister=function(e){this.load(),e in this.props&&(delete this.props[e],this.save())},xt.prototype.update_search_keyword=function(e){this.register(R.info.searchInfo(e))},xt.prototype.update_referrer_info=function(e){this.register_once({$initial_referrer:e||"$direct",$initial_referring_domain:R.info.referringDomain(e)||"$direct"},"")},xt.prototype.get_referrer_info=function(){return R.strip_empty_properties({$initial_referrer:this.props.$initial_referrer,$initial_referring_domain:this.props.$initial_referring_domain})},xt.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)},xt.prototype.set_disabled=function(e){this.disabled=e,this.disabled?this.remove():this.save()},xt.prototype.set_cookie_domain=function(e){e!==this.cookie_domain&&(this.remove(),this.cookie_domain=e,this.save())},xt.prototype.set_cross_site=function(e){e!==this.cross_site&&(this.cross_site=e,this.remove(),this.save())},xt.prototype.set_cross_subdomain=function(e){e!==this.cross_subdomain&&(this.cross_subdomain=e,this.remove(),this.save())},xt.prototype.get_cross_subdomain=function(){return this.cross_subdomain},xt.prototype.set_secure=function(e){e!==this.secure&&(this.secure=!!e,this.remove(),this.save())},xt.prototype._add_to_people_queue=function(e,t){var n=this._get_queue_key(e),r=t[e],i=this._get_or_create_queue(Pa),o=this._get_or_create_queue(eu),s=this._get_or_create_queue(Gi),u=this._get_or_create_queue($s),c=this._get_or_create_queue(Ls),d=this._get_or_create_queue(Uo,[]),p=this._get_or_create_queue(ho,[]);n===Xb?(R.extend(i,r),this._pop_from_people_queue($s,r),this._pop_from_people_queue(Ls,r),this._pop_from_people_queue(Gi,r)):n===Jb?(R.each(r,function(h,m){m in o||(o[m]=h)}),this._pop_from_people_queue(Gi,r)):n===e1?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]}),s[h]=!0}):n===t1?(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(Gi,r)):n===i1?(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(Gi,r)):n===r1?(d.push(r),this._pop_from_people_queue(ho,r)):n===n1&&(p.push(r),this._pop_from_people_queue(Gi,r)),Ut.log("MIXPANEL PEOPLE REQUEST (QUEUED, PENDING IDENTIFY):"),Ut.log(t),this.save()},xt.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===ho||e===Uo?R.each(n,function(o){o[i]===r&&delete o[i]}):delete n[i]},this)},xt.prototype.load_queue=function(e){return this.load_prop(this._get_queue_key(e))},xt.prototype._get_queue_key=function(e){if(e===Pa)return Xb;if(e===eu)return Jb;if(e===Gi)return e1;if(e===$s)return t1;if(e===ho)return n1;if(e===Uo)return r1;if(e===Ls)return i1;Ut.error("Invalid queue:",e)},xt.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)},xt.prototype.set_event_timer=function(e,t){var n=this.load_prop(mf)||{};n[e]=t,this.props[mf]=n,this.save()},xt.prototype.remove_event_timer=function(e){var t=this.load_prop(mf)||{},n=t[e];return R.isUndefined(n)||(delete this.props[mf][e],this.save()),n};var o1,XO=function(e,t){throw new Error(e+" not available in this build.")},Cr,JO=0,YV=1,WV=function(e){return e},_i="mixpanel",eT="base64",KV="json",a1="$device:",tu=ze.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,tT=!tu&&Po.indexOf("MSIE")===-1&&Po.indexOf("Mozilla")===-1,zp=null;Da.sendBeacon&&(zp=function(){return Da.sendBeacon.apply(Da,arguments)});var nT={track:"track/",engage:"engage/",groups:"groups/",record:"record/"},rT={api_host:"https://api-js.mixpanel.com",api_routes:nT,api_method:"POST",api_transport:"XHR",api_payload_format:eT,app_host:"https://mixpanel.com",autocapture:!1,cdn:"https://cdn.mxpnl.com",cross_site_cookie:!1,cross_subdomain_cookie:!0,error_reporter:$a,persistence:"cookie",persistence_name:"",cookie_domain:"",cookie_name:"",loaded:$a,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:uf,record_min_ms:0,record_sessions_percent:0,recorder_src:"https://cdn.mxpnl.com/libs/mixpanel-recorder.min.js"},iT=!1,ae=function(){},s1=function(e,t,n){var r,i=n===_i?Cr:Cr[n];if(i&&o1===JO)r=i;else{if(i&&!R.isArray(i)){Ut.error("You have already initialized "+n);return}r=new ae}if(r._cached_groups={},r._init(e,t,n),r.people=new dt,r.people._init(r),!r.get_config("skip_first_touch_marketing")){var o=R.info.campaignParams(null),s={},u=!1;R.each(o,function(c,d){s["initial_"+d]=c,c&&(u=!0)}),u&&r.people.set_once(s)}return Hi.DEBUG=Hi.DEBUG||r.get_config("debug"),!R.isUndefined(i)&&R.isArray(i)&&(r._execute_array.call(r.people,i.people),r._execute_array(i)),r};ae.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===_i){this.report_error("You must initialize the main mixpanel object right after you include the Mixpanel js snippet");return}var r=s1(e,t,n);return Cr[n]=r,r._loaded(),r},ae.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||rT.api_host;i.match(/\.mixpanel\.com/)&&(r.api_payload_format=KV)}if(this.set_config(R.extend({},rT,r,t,{name:n,token:e,callback_fn:(n===_i?n:_i+"."+n)+"._jsc"})),this._jsc=$a,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)||!tu)this._batch_requests=!1,Ut.log("Turning off Mixpanel request-queueing; needs XHR and localStorage support"),R.each(this.get_batcher_configs(),function(u){Ut.log("Clearing batch queue "+u.queue_key),R.localStorage.remove(u.queue_key)});else if(this.init_batchers(),zp&&ze.addEventListener){var o=R.bind(function(){this.request_batchers.events.stopped||this.request_batchers.events.flush({unloading:!0})},this);ze.addEventListener("pagehide",function(u){u.persisted&&o()}),ze.addEventListener("visibilitychange",function(){Vt.visibilityState==="hidden"&&o()})}}this.persistence=this.cookie=new xt(this.config),this.unpersisted_superprops={},this._gdpr_init();var s=R.UUID();this.get_distinct_id()||this.register_once({distinct_id:a1+s,$device_id:s},""),this.autocapture=new ti(this),this.autocapture.init(),this._init_tab_id(),this._check_and_start_session_recording()},ae.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),ze.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.")},ae.prototype.get_tab_id=function(){return this.tab_id||null},ae.prototype._should_load_recorder=function(){var e=new uo(Pb),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(zb(n[r])||n[r].tabId===t)return!0;return!1}).catch(R.bind(function(n){this.report_error("Error checking recording registry",n)},this))},ae.prototype._check_and_start_session_recording=La(function(e){if(!ze.MutationObserver){Ut.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 ze.__mp_recorder(this),this._recorder.resumeRecording(r)},this);R.isUndefined(ze.__mp_recorder)?XO(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)})}),ae.prototype.start_session_recording=function(){this._check_and_start_session_recording(!0)},ae.prototype.stop_session_recording=function(){this._recorder&&this._recorder.stopRecording()},ae.prototype.pause_session_recording=function(){this._recorder&&this._recorder.pauseRecording()},ae.prototype.resume_session_recording=function(){this._recorder&&this._recorder.resumeRecording()},ae.prototype.get_session_recording_properties=function(){var e={},t=this._get_session_replay_id();return t&&(e.$mp_replay_id=t),e},ae.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},ae.prototype._get_session_replay_id=function(){var e=null;return this._recorder&&(e=this._recorder.replayId),e||null},ae.prototype.__get_recorder=function(){return this._recorder},ae.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))}},ae.prototype._set_default_superprops=function(){this.persistence.update_search_keyword(Vt.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(Vt.referrer)},ae.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},ae.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(!iT)return this.__dom_loaded_queue.push([e,t]),!1;var n=new e().init(this);return n.track.apply(n,t)},ae.prototype._prepare_callback=function(e,t){if(R.isUndefined(e))return null;if(tu){var n=function(s){e(s,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(s){delete r[i],e(s,t)},o}},ae.prototype._send_request=function(e,t,n,r){var i=!0;if(tT)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")},s=null;!r&&(R.isFunction(n)||typeof n=="string")&&(r=n,n=null),n=R.extend(o,n||{}),tu||(n.method="GET");var u=n.method==="POST",c=zp&&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),tu||(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&&(s="data="+encodeURIComponent(t.data),delete t.data),e+="?"+R.HTTPBuildQuery(t);var p=this;if("img"in t){var h=Vt.createElement("img");h.src=e,Vt.body.appendChild(h)}else if(c){try{i=zp(e,s)}catch(b){p.report_error(b),i=!1}try{r&&r(i?1:0)}catch(b){p.report_error(b)}}else if(tu)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(k){if(p.report_error(k),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(s)}catch(b){p.report_error(b),i=!1}else{var x=Vt.createElement("script");x.type="text/javascript",x.async=!0,x.defer=!0,x.src=e;var w=Vt.getElementsByTagName("script")[0];w.parentNode.insertBefore(x,w)}return i},ae.prototype._execute_array=function(e){var t,n=[],r=[],i=[];R.each(e,function(s){s&&(t=s[0],R.isArray(t)?i.push(s):typeof s=="function"?s.call(this):R.isArray(s)&&t==="alias"?n.push(s):R.isArray(s)&&t.indexOf("track")!==-1&&typeof this[t]=="function"?i.push(s):r.push(s))},this);var o=function(s,u){R.each(s,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)},ae.prototype.are_batchers_initialized=function(){return!!this.request_batchers.events},ae.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},ae.prototype.init_batchers=function(){if(!this.are_batchers_initialized()){var e=R.bind(function(n){return new yi(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()},ae.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()}))},ae.prototype.stop_batch_senders=function(){this._batch_requests=!1,R.each(this.request_batchers,function(e){e.stop(),e.clear()})},ae.prototype.push=function(e){this._execute_array([e])},ae.prototype.disable=function(e){typeof e>"u"?this._flags.disable_all_events=!0:this.__disabled_events=this.__disabled_events.concat(e)},ae.prototype._encode_data_for_request=function(e){var t=Yl(e);return this.get_config("api_payload_format")===eT&&(t=R.base64Encode(t)),{data:t}},ae.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,s=e.send_request_options||{};t=t||$a;var u=!0,c=R.bind(function(){return s.skip_hooks||(n=this._run_hook("before_send_"+e.type,n)),n?(Ut.log("MIXPANEL REQUEST:"),Ut.log(n),this._send_request(r,this._encode_data_for_request(n),s,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},ae.prototype.track=La(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=$a),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 s=this.persistence.remove_event_timer(e);if(!R.isUndefined(s)){var u=new Date().getTime()-s;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}),ae.prototype.set_group=La(function(e,t,n){R.isArray(t)||(t=[t]);var r={};return r[e]=t,this.register(r),this.people.set(e,t,n)}),ae.prototype.add_group=La(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)}),ae.prototype.remove_group=La(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)}),ae.prototype.track_with_groups=La(function(e,t,n,r){var i=R.extend({},t||{});return R.each(n,function(o,s){o!=null&&(i[s]=o)}),this.track(e,i,r)}),ae.prototype._create_map_key=function(e,t){return e+"_"+JSON.stringify(t)},ae.prototype._remove_group_from_cache=function(e,t){delete this._cached_groups[this._create_map_key(e,t)]},ae.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 pn,r._init(this,e,t),this._cached_groups[n]=r),r},ae.prototype.track_pageview=La(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)}),ae.prototype.track_links=function(){return this._track_dom.call(this,Jl,arguments)},ae.prototype.track_forms=function(){return this._track_dom.call(this,Fp,arguments)},ae.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 QV={persistent:!0},l1=function(e){var t;return R.isObject(e)?t=e:R.isUndefined(e)?t={}:t={days:e},R.extend({},QV,t)};ae.prototype.register=function(e,t){var n=l1(t);n.persistent?this.persistence.register(e,n.days):R.extend(this.unpersisted_superprops,e)},ae.prototype.register_once=function(e,t,n){var r=l1(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))},ae.prototype.unregister=function(e,t){t=l1(t),t.persistent?this.persistence.unregister(e):delete this.unpersisted_superprops[e]},ae.prototype._register_single=function(e,t){var n={};n[e]=t,this.register(n)},ae.prototype.identify=function(e,t,n,r,i,o,s,u){var c=this.get_distinct_id();if(e&&c!==e){if(typeof e=="string"&&e.indexOf(a1)===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(Up)&&(this.unregister(Up),this.register({distinct_id:e})),this._flags.identify_called=!0,this.people._flush(t,n,r,i,o,s,u),e!==c&&this.track("$identify",{distinct_id:e,$anon_distinct_id:c},{skip_hooks:!0})},ae.prototype.reset=function(){this.persistence.clear(),this._flags.identify_called=!1;var e=R.UUID();this.register_once({distinct_id:a1+e,$device_id:e},"")},ae.prototype.get_distinct_id=function(){return this.get_property("distinct_id")},ae.prototype.alias=function(e,t){if(e===this.get_property(QO))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(Up,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)},ae.prototype.name_tag=function(e){this._register_single("mp_name_tag",e)},ae.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),Hi.DEBUG=Hi.DEBUG||this.get_config("debug"),"autocapture"in e&&this.autocapture&&this.autocapture.init()}},ae.prototype.get_config=function(e){return this.config[e]},ae.prototype._run_hook=function(e){var t=(this.config.hooks[e]||WV).apply(this,Ma.call(arguments,1));return typeof t>"u"&&(this.report_error(e+" hook did not return a value"),t=null),t},ae.prototype.get_property=function(e){return this.persistence.load_prop([e])},ae.prototype.toString=function(){var e=this.get_config("name");return e!==_i&&(e=_i+"."+e),e},ae.prototype._event_is_disabled=function(e){return R.isBlockedUA(Po)||this._flags.disable_all_events||R.include(this.__disabled_events,e)},ae.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")}))},ae.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()},ae.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})},ae.prototype.opt_in_tracking=function(e){e=R.extend({enable_persistence:!0},e),this._gdpr_call_func(bV,e),this._gdpr_update_persistence(e)},ae.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(SV,e),this._gdpr_update_persistence(e)},ae.prototype.has_opted_in_tracking=function(e){return this._gdpr_call_func(wV,e)},ae.prototype.has_opted_out_tracking=function(e){return this._gdpr_call_func(_O,e)},ae.prototype.clear_opt_in_out_tracking=function(e){e=R.extend({enable_persistence:!0},e),this._gdpr_call_func(xV,e),this._gdpr_update_persistence(e)},ae.prototype.report_error=function(e,t){Ut.error.apply(Ut.error,arguments);try{!t&&!(e instanceof Error)&&(e=new Error(e)),this.get_config("error_reporter")(e,t)}catch(n){Ut.error(n)}},ae.prototype.init=ae.prototype.init,ae.prototype.reset=ae.prototype.reset,ae.prototype.disable=ae.prototype.disable,ae.prototype.time_event=ae.prototype.time_event,ae.prototype.track=ae.prototype.track,ae.prototype.track_links=ae.prototype.track_links,ae.prototype.track_forms=ae.prototype.track_forms,ae.prototype.track_pageview=ae.prototype.track_pageview,ae.prototype.register=ae.prototype.register,ae.prototype.register_once=ae.prototype.register_once,ae.prototype.unregister=ae.prototype.unregister,ae.prototype.identify=ae.prototype.identify,ae.prototype.alias=ae.prototype.alias,ae.prototype.name_tag=ae.prototype.name_tag,ae.prototype.set_config=ae.prototype.set_config,ae.prototype.get_config=ae.prototype.get_config,ae.prototype.get_property=ae.prototype.get_property,ae.prototype.get_distinct_id=ae.prototype.get_distinct_id,ae.prototype.toString=ae.prototype.toString,ae.prototype.opt_out_tracking=ae.prototype.opt_out_tracking,ae.prototype.opt_in_tracking=ae.prototype.opt_in_tracking,ae.prototype.has_opted_out_tracking=ae.prototype.has_opted_out_tracking,ae.prototype.has_opted_in_tracking=ae.prototype.has_opted_in_tracking,ae.prototype.clear_opt_in_out_tracking=ae.prototype.clear_opt_in_out_tracking,ae.prototype.get_group=ae.prototype.get_group,ae.prototype.set_group=ae.prototype.set_group,ae.prototype.add_group=ae.prototype.add_group,ae.prototype.remove_group=ae.prototype.remove_group,ae.prototype.track_with_groups=ae.prototype.track_with_groups,ae.prototype.start_batch_senders=ae.prototype.start_batch_senders,ae.prototype.stop_batch_senders=ae.prototype.stop_batch_senders,ae.prototype.start_session_recording=ae.prototype.start_session_recording,ae.prototype.stop_session_recording=ae.prototype.stop_session_recording,ae.prototype.pause_session_recording=ae.prototype.pause_session_recording,ae.prototype.resume_session_recording=ae.prototype.resume_session_recording,ae.prototype.get_session_recording_properties=ae.prototype.get_session_recording_properties,ae.prototype.get_session_replay_url=ae.prototype.get_session_replay_url,ae.prototype.get_tab_id=ae.prototype.get_tab_id,ae.prototype.DEFAULT_API_ROUTES=nT,ae.prototype.__get_recorder=ae.prototype.__get_recorder,xt.prototype.properties=xt.prototype.properties,xt.prototype.update_search_keyword=xt.prototype.update_search_keyword,xt.prototype.update_referrer_info=xt.prototype.update_referrer_info,xt.prototype.get_cross_subdomain=xt.prototype.get_cross_subdomain,xt.prototype.clear=xt.prototype.clear;var nu={},XV=function(){R.each(nu,function(e,t){t!==_i&&(Cr[t]=e)}),Cr._=R},JV=function(){Cr.init=function(e,t,n){if(n)return Cr[n]||(Cr[n]=nu[n]=s1(e,t,n),Cr[n]._loaded()),Cr[n];var r=Cr;nu[_i]?r=nu[_i]:e&&(r=s1(e,t,_i),r._loaded(),nu[_i]=r),Cr=r,o1===YV&&(ze[_i]=Cr),XV()}},eZ=function(){function e(){e.done||(e.done=!0,iT=!0,tT=!1,R.each(nu,function(r){r._dom_loaded()}))}function t(){try{Vt.documentElement.doScroll("left")}catch{setTimeout(t,1);return}e()}if(Vt.addEventListener)Vt.readyState==="complete"?e():Vt.addEventListener("DOMContentLoaded",e,!1);else if(Vt.attachEvent){Vt.attachEvent("onreadystatechange",e);var n=!1;try{n=ze.frameElement===null}catch{}Vt.documentElement.doScroll&&n&&t()}R.register_event(ze,"load",e,!0)};function tZ(e){return XO=e,o1=JO,Cr=new ae,JV(),Cr.init(),eZ(),Cr}function nZ(e,t){t()}var Ba=tZ(nZ);const po="https://saas.brainlox.com",rZ="https://debales-web-app-server.azurewebsites.net",oT={"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"},iZ="phc_nzwftWluHb06OLHwbfhb2xmhk88Ffc9OjjR8Jz5Q327",oZ=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 ur(){const e=sessionStorage.getItem("debalesSessionID");if(e)return e;const t=crypto.randomUUID();return sessionStorage.setItem("debalesSessionID",t),t}function aZ(){return sessionStorage.getItem(bi(window.DebalesChat.projectId,mi.LAST_SHOWN_MESSAGE_ID))}function u1(e){sessionStorage.setItem("formstate",e.toString())}function Vi(){const e=localStorage.getItem("debalesUserInfo");return e?JSON.parse(e):null}function qp(e){localStorage.setItem("debalesUserInfo",JSON.stringify(e))}function jp(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,s=performance.now(),u=c=>{const d=c-s,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 sZ(){return window.location.pathname}function aT(){const e=/test|demo|example|debales/i,t=Vi()??"";return!!(t&&e.test(t.email))}function lZ(e){const t=sZ(),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,s)=>(o.sortOrder??0)-(s.sortOrder??0))}const sT=new Set,uZ=e=>{const t=oT[e];if(!t)return console.warn("No Mixpanel token found"),null;if(sT.has(e))return Ba;Ba.init(t,{debug:!0,track_pageview:!0,persistence:"localStorage"}),console.log("Mixpanel initialized");const n=Vi();return n&&n.email&&Ba.identify(n.email),sT.add(e),Ba},cZ=async(e,t)=>{if(aT())return;const n=window.DebalesChat.projectId??t.projectId;if(!oT[n]){console.warn("No Mixpanel token found");return}Ba.track(e,t)},fZ=()=>{const e=localStorage.getItem("anonymousUserId");if(e)return e;const t=crypto.randomUUID();return localStorage.setItem("anonymousUserId",t),t};function dZ(e){return e?e.split("<br>").filter(n=>n.trim().length>0).map(n=>n.trim()):[""]}const cr=e=>e.toLowerCase().includes("gaiabay")||e.toLowerCase().includes("debales-testing"),hZ=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 bi(e,t){return`debales_${e}_${t}`}const lT=W.createContext(null),uT=()=>{const e=W.useContext(lT);if(!e)throw new Error("useCart must be used within a CartProvider");return e};var pZ="2.0.0",ru="",cT="?",Hp="function",Fa="undefined",iu="object",c1="string",vf="major",Re="model",ke="name",Ce="type",Te="vendor",Ie="version",jr="architecture",ou="console",vt="mobile",_n="tablet",Er="smarttv",yf="wearable",f1="xr",d1="embedded",_f="inapp",fT="user-agent",h1=500,p1="brands",Ns="formFactors",g1="fullVersionList",au="platform",m1="platformVersion",Gp="bitness",Ua="sec-ch-ua",gZ=Ua+"-full-version-list",mZ=Ua+"-arch",vZ=Ua+"-"+Gp,yZ=Ua+"-form-factors",_Z=Ua+"-"+vt,bZ=Ua+"-"+Re,dT=Ua+"-"+au,SZ=dT+"-version",hT=[p1,g1,vt,Re,au,m1,jr,Ns,Gp],ni="browser",zo="cpu",go="device",qo="engine",Si="os",su="result",Vp="Amazon",bf="Apple",pT="ASUS",gT="BlackBerry",Ps="Google",mT="Huawei",vT="Lenovo",wZ="Honor",v1="LG",Zp="Microsoft",yT="Motorola",Sf="Samsung",_T="Sharp",Yp="Sony",y1="Xiaomi",_1="Zebra",lu="Mobile ",wf=" Browser",bT="Chrome",za="Chromecast",xZ="Edge",xf="Firefox",Cf="Opera",ST="Facebook",wT="Sogou",b1="Windows",CZ=typeof window!==Fa,Hr=CZ&&window.navigator?window.navigator:void 0,qa=Hr&&Hr.userAgentData?Hr.userAgentData:void 0,EZ=function(e,t){var n={},r=t;if(!Kp(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 s in e)n[s]=r[s]&&r[s].length%2===0?r[s].concat(e[s]):e[s];return n},Wp=function(e){for(var t={},n=0;n<e.length;n++)t[e[n].toUpperCase()]=e[n];return t},S1=function(e,t){if(typeof e===iu&&e.length>0){for(var n in e)if(jo(e[n])==jo(t))return!0;return!1}return uu(e)?jo(t).indexOf(jo(e))!==-1:!1},Kp=function(e,t){for(var n in e)return/^(browser|cpu|device|engine|os)$/.test(n)||(t?Kp(e[n]):!1)},uu=function(e){return typeof e===c1},w1=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=kf(n[r]).split(";v=");t[r]={brand:i[0],version:i[1]}}else t[r]=kf(n[r]);return t}},jo=function(e){return uu(e)?e.toLowerCase():e},x1=function(e){return uu(e)?Bs(/[^\d\.]/g,e).split(".")[0]:void 0},Ho=function(e){for(var t in e){var n=e[t];typeof n==iu&&n.length==2?this[n[0]]=n[1]:this[n]=void 0}return this},Bs=function(e,t){return uu(t)?t.replace(e,ru):t},Ef=function(e){return Bs(/\\?\"/g,e)},kf=function(e,t){if(uu(e))return e=Bs(/^\s\s*/,e),typeof t===Fa?e:e.substring(0,h1)},xT=function(e,t){if(!(!e||!t))for(var n=0,r,i,o,s,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],s=p[o],typeof s===iu&&s.length>0?s.length===2?typeof s[1]==Hp?this[s[0]]=s[1].call(this,c):this[s[0]]=s[1]:s.length===3?typeof s[1]===Hp&&!(s[1].exec&&s[1].test)?this[s[0]]=c?s[1].call(this,c,s[2]):void 0:this[s[0]]=c?c.replace(s[1],s[2]):void 0:s.length===4&&(this[s[0]]=c?s[3].call(this,c.replace(s[1],s[2])):void 0):this[s]=c||void 0;n+=2}},Af=function(e,t){for(var n in t)if(typeof t[n]===iu&&t[n].length>0){for(var r=0;r<t[n].length;r++)if(S1(t[n][r],e))return n===cT?void 0:n}else if(S1(t[n],e))return n===cT?void 0:n;return t.hasOwnProperty("*")?t["*"]:e},CT={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"},ET={embedded:"Automotive",mobile:"Mobile",tablet:["Tablet","EInk"],smarttv:"TV",wearable:"Watch",xr:["VR","XR"],"?":["Desktop","Unknown"],"*":void 0},kT={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[Ie,[ke,lu+"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[Ie,[ke,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[ke,Ie],[/opios[\/ ]+([\w\.]+)/i],[Ie,[ke,Cf+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[Ie,[ke,Cf+" GX"]],[/\bopr\/([\w\.]+)/i],[Ie,[ke,Cf]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[Ie,[ke,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[Ie,[ke,"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],[ke,Ie],[/quark(?:pc)?\/([-\w\.]+)/i],[Ie,[ke,"Quark"]],[/\bddg\/([\w\.]+)/i],[Ie,[ke,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[Ie,[ke,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[Ie,[ke,"WeChat"]],[/konqueror\/([\w\.]+)/i],[Ie,[ke,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[Ie,[ke,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[Ie,[ke,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[Ie,[ke,"Smart "+vT+wf]],[/(avast|avg)\/([\w\.]+)/i],[[ke,/(.+)/,"$1 Secure"+wf],Ie],[/\bfocus\/([\w\.]+)/i],[Ie,[ke,xf+" Focus"]],[/\bopt\/([\w\.]+)/i],[Ie,[ke,Cf+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[Ie,[ke,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[Ie,[ke,"Dolphin"]],[/coast\/([\w\.]+)/i],[Ie,[ke,Cf+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[Ie,[ke,"MIUI"+wf]],[/fxios\/([\w\.-]+)/i],[Ie,[ke,lu+xf]],[/\bqihoobrowser\/?([\w\.]*)/i],[Ie,[ke,"360"]],[/\b(qq)\/([\w\.]+)/i],[[ke,/(.+)/,"$1Browser"],Ie],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[ke,/(.+)/,"$1"+wf],Ie],[/samsungbrowser\/([\w\.]+)/i],[Ie,[ke,Sf+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[Ie,[ke,wT+" Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[ke,wT+" Mobile"],Ie],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[ke,Ie],[/(lbbrowser|rekonq)/i],[ke],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[Ie,ke],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[ke,ST],Ie,[Ce,_f]],[/(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],[ke,Ie,[Ce,_f]],[/\bgsa\/([\w\.]+) .*safari\//i],[Ie,[ke,"GSA"],[Ce,_f]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[Ie,[ke,"TikTok"],[Ce,_f]],[/\[(linkedin)app\]/i],[ke,[Ce,_f]],[/(chromium)[\/ ]([-\w\.]+)/i],[ke,Ie],[/headlesschrome(?:\/([\w\.]+)| )/i],[Ie,[ke,bT+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[ke,bT+" WebView"],Ie],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[Ie,[ke,"Android"+wf]],[/chrome\/([\w\.]+) mobile/i],[Ie,[ke,lu+"Chrome"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[ke,Ie],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[Ie,[ke,lu+"Safari"]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[ke,lu+"Safari"]],[/version\/([\w\.\,]+) .*(safari)/i],[Ie,ke],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[ke,[Ie,"1"]],[/(webkit|khtml)\/([\w\.]+)/i],[ke,Ie],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[ke,lu+xf],Ie],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[ke,"Netscape"],Ie],[/(wolvic|librewolf)\/([\w\.]+)/i],[ke,Ie],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[Ie,[ke,xf+" 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],[ke,[Ie,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[ke,[Ie,/[^\d\.]+./,ru]]],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/,ru,jo]],[/(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,jo]]],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],[Re,[Te,Sf],[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],[Re,[Te,Sf],[Ce,vt]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[Re,[Te,bf],[Ce,vt]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[Re,[Te,bf],[Ce,_n]],[/(macintosh);/i],[Re,[Te,bf]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[Re,[Te,_T],[Ce,vt]],[/(?:honor)([-\w ]+)[;\)]/i],[Re,[Te,wZ],[Ce,vt]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[Re,[Te,mT],[Ce,_n]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[Re,[Te,mT],[Ce,vt]],[/\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],[[Re,/_/g," "],[Te,y1],[Ce,vt]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[Re,/_/g," "],[Te,y1],[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],[Re,[Te,"OPPO"],[Ce,vt]],[/\b(opd2\d{3}a?) bui/i],[Re,[Te,"OPPO"],[Ce,_n]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[Re,[Te,"Vivo"],[Ce,vt]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[Re,[Te,"Realme"],[Ce,vt]],[/\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],[Re,[Te,yT],[Ce,vt]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[Re,[Te,yT],[Ce,_n]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[Re,[Te,v1],[Ce,_n]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[Re,[Te,v1],[Ce,vt]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[Re,[Te,vT],[Ce,_n]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[Re,/_/g," "],[Te,"Nokia"],[Ce,vt]],[/(pixel c)\b/i],[Re,[Te,Ps],[Ce,_n]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[Re,[Te,Ps],[Ce,vt]],[/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],[Re,[Te,Yp],[Ce,vt]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[Re,"Xperia Tablet"],[Te,Yp],[Ce,_n]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[Re,[Te,"OnePlus"],[Ce,vt]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[Re,[Te,Vp],[Ce,_n]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[Re,/(.+)/g,"Fire Phone $1"],[Te,Vp],[Ce,vt]],[/(playbook);[-\w\),; ]+(rim)/i],[Re,Te,[Ce,_n]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[Re,[Te,gT],[Ce,vt]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[Re,[Te,pT],[Ce,_n]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[Re,[Te,pT],[Ce,vt]],[/(nexus 9)/i],[Re,[Te,"HTC"],[Ce,_n]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[Te,[Re,/_/g," "],[Ce,vt]],[/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],[Re,[Te,"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],[Re,[Te,"TCL"],[Ce,vt]],[/(itel) ((\w+))/i],[[Te,jo],Re,[Ce,Af,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[Re,[Te,"Acer"],[Ce,_n]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[Re,[Te,"Meizu"],[Ce,vt]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[Re,[Te,"Ulefone"],[Ce,vt]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[Re,[Te,"Energizer"],[Ce,vt]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[Re,[Te,"Cat"],[Ce,vt]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[Re,[Te,"Smartfren"],[Ce,vt]],[/droid.+; (a(?:015|06[35]|142p?))/i],[Re,[Te,"Nothing"],[Ce,vt]],[/(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],[Te,Re,[Ce,vt]],[/(imo) (tab \w+)/i,/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[Te,Re,[Ce,_n]],[/(surface duo)/i],[Re,[Te,Zp],[Ce,_n]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[Re,[Te,"Fairphone"],[Ce,vt]],[/(shield[\w ]+) b/i],[Re,[Te,"Nvidia"],[Ce,_n]],[/(sprint) (\w+)/i],[Te,Re,[Ce,vt]],[/(kin\.[onetw]{3})/i],[[Re,/\./g," "],[Te,Zp],[Ce,vt]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[Re,[Te,_1],[Ce,_n]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[Re,[Te,_1],[Ce,vt]],[/smart-tv.+(samsung)/i],[Te,[Ce,Er]],[/hbbtv.+maple;(\d+)/i],[[Re,/^/,"SmartTV"],[Te,Sf],[Ce,Er]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[Te,v1],[Ce,Er]],[/(apple) ?tv/i],[Te,[Re,bf+" TV"],[Ce,Er]],[/crkey.*devicetype\/chromecast/i],[[Re,za+" Third Generation"],[Te,Ps],[Ce,Er]],[/crkey.*devicetype\/([^/]*)/i],[[Re,/^/,"Chromecast "],[Te,Ps],[Ce,Er]],[/fuchsia.*crkey/i],[[Re,za+" Nest Hub"],[Te,Ps],[Ce,Er]],[/crkey/i],[[Re,za],[Te,Ps],[Ce,Er]],[/droid.+aft(\w+)( bui|\))/i],[Re,[Te,Vp],[Ce,Er]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[Re,[Te,_T],[Ce,Er]],[/(bravia[\w ]+)( bui|\))/i],[Re,[Te,Yp],[Ce,Er]],[/(mitv-\w{5}) bui/i],[Re,[Te,y1],[Ce,Er]],[/Hbbtv.*(technisat) (.*);/i],[Te,Re,[Ce,Er]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[Te,kf],[Re,kf],[Ce,Er]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[Ce,Er]],[/(ouya)/i,/(nintendo) (\w+)/i],[Te,Re,[Ce,ou]],[/droid.+; (shield) bui/i],[Re,[Te,"Nvidia"],[Ce,ou]],[/(playstation \w+)/i],[Re,[Te,Yp],[Ce,ou]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[Re,[Te,Zp],[Ce,ou]],[/\b(sm-[lr]\d\d[05][fnuw]?s?)\b/i],[Re,[Te,Sf],[Ce,yf]],[/((pebble))app/i],[Te,Re,[Ce,yf]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[Re,[Te,bf],[Ce,yf]],[/droid.+; (wt63?0{2,3})\)/i],[Re,[Te,_1],[Ce,yf]],[/droid.+; (glass) \d/i],[Re,[Te,Ps],[Ce,f1]],[/(pico) (4|neo3(?: link|pro)?)/i],[Te,Re,[Ce,f1]],[/; (quest( \d| pro)?)/i],[Re,[Te,ST],[Ce,f1]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[Te,[Ce,d1]],[/(aeobc)\b/i],[Re,[Te,Vp],[Ce,d1]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[Re,[Ce,vt]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[Re,[Ce,_n]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[Ce,_n]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[Ce,vt]],[/(android[-\w\. ]{0,9});.+buil/i],[Re,[Te,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[Ie,[ke,xZ+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[ke,Ie],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[Ie,[ke,"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],[ke,Ie],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[Ie,ke]],os:[[/microsoft (windows) (vista|xp)/i],[ke,Ie],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[ke,[Ie,Af,CT]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[Ie,Af,CT],[ke,b1]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[Ie,/_/g,"."],[ke,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[ke,"macOS"],[Ie,/_/g,"."]],[/android ([\d\.]+).*crkey/i],[Ie,[ke,za+" Android"]],[/fuchsia.*crkey\/([\d\.]+)/i],[Ie,[ke,za+" Fuchsia"]],[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],[Ie,[ke,za+" SmartSpeaker"]],[/linux.*crkey\/([\d\.]+)/i],[Ie,[ke,za+" Linux"]],[/crkey\/([\d\.]+)/i],[Ie,[ke,za]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[Ie,ke],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish|openharmony)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[ke,Ie],[/\(bb(10);/i],[Ie,[ke,gT]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[Ie,[ke,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[Ie,[ke,xf+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[Ie,[ke,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[Ie,[ke,"watchOS"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[ke,"Chrome OS"],Ie],[/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],[ke,Ie],[/(sunos) ?([\w\.\d]*)/i],[[ke,"Solaris"],Ie],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[ke,Ie]]},Qp=function(){var e={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}};return Ho.call(e.init,[[ni,[ke,Ie,vf,Ce]],[zo,[jr]],[go,[Ce,Re,Te]],[qo,[ke,Ie]],[Si,[ke,Ie]]]),Ho.call(e.isIgnore,[[ni,[Ie,vf]],[qo,[Ie]],[Si,[Ie]]]),Ho.call(e.isIgnoreRgx,[[ni,/ ?browser$/i],[Si,/ ?os$/i]]),Ho.call(e.toString,[[ni,[ke,Ie]],[zo,[jr]],[go,[Te,Re]],[qo,[ke,Ie]],[Si,[ke,Ie]]]),e}(),kZ=function(e,t){var n=Qp.init[t],r=Qp.isIgnore[t]||0,i=Qp.isIgnoreRgx[t]||0,o=Qp.toString[t]||0;function s(){Ho.call(this,n)}return s.prototype.getItem=function(){return e},s.prototype.withClientHints=function(){return qa?qa.getHighEntropyValues(hT).then(function(u){return e.setCH(new AT(u,!1)).parseCH().get()}):e.parseCH().get()},s.prototype.withFeatureCheck=function(){return e.detectFeature().get()},t!=su&&(s.prototype.is=function(u){var c=!1;for(var d in this)if(this.hasOwnProperty(d)&&!S1(r,d)&&jo(i?Bs(i,this[d]):this[d])==jo(i?Bs(i,u):u)){if(c=!0,u!=Fa)break}else if(u==Fa&&c){c=!c;break}return c},s.prototype.toString=function(){var u=ru;for(var c in o)typeof this[o[c]]!==Fa&&(u+=(u?" ":ru)+this[o[c]]);return u||Fa}),qa||(s.prototype.then=function(u){var c=this,d=function(){for(var h in c)c.hasOwnProperty(h)&&(this[h]=c[h])};d.prototype={is:s.prototype.is,toString:s.prototype.toString};var p=new d;return u(p),p}),new s};function AT(e,t){if(e=e||{},Ho.call(this,hT),t)Ho.call(this,[[p1,w1(e[Ua])],[g1,w1(e[gZ])],[vt,/\?1/.test(e[_Z])],[Re,Ef(e[bZ])],[au,Ef(e[dT])],[m1,Ef(e[SZ])],[jr,Ef(e[mZ])],[Ns,w1(e[yZ])],[Gp,Ef(e[vZ])]]);else for(var n in e)this.hasOwnProperty(n)&&typeof e[n]!==Fa&&(this[n]=e[n])}function IT(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 ni:Hr.brave&&typeof Hr.brave.isBrave==Hp&&this.set(ke,"Brave");break;case go:!this.get(Ce)&&qa&&qa[vt]&&this.set(Ce,vt),this.get(Re)=="Macintosh"&&Hr&&typeof Hr.standalone!==Fa&&Hr.maxTouchPoints&&Hr.maxTouchPoints>2&&this.set(Re,"iPad").set(Ce,_n);break;case Si:!this.get(ke)&&qa&&qa[au]&&this.set(ke,qa[au]);break;case su:var i=this.data,o=function(s){return i[s].getItem().detectFeature().get()};this.set(ni,o(ni)).set(zo,o(zo)).set(go,o(go)).set(qo,o(qo)).set(Si,o(Si))}return this},this.parseUA=function(){return this.itemType!=su&&xT.call(this.data,this.ua,this.rgxMap),this.itemType==ni&&this.set(vf,x1(this.get(Ie))),this},this.parseCH=function(){var i=this.uaCH,o=this.rgxMap;switch(this.itemType){case ni:var s=i[g1]||i[p1],u;if(s)for(var c in s){var d=Bs(/(Google|Microsoft) /,s[c].brand||s[c]),p=s[c].version;!/not.a.brand/i.test(d)&&(!u||/chrom/i.test(u)&&!/chromi/i.test(d))&&(this.set(ke,d).set(Ie,p).set(vf,x1(p)),u=d)}break;case zo:var h=i[jr];h&&(h&&i[Gp]=="64"&&(h+="64"),xT.call(this.data,h+";",o));break;case go:if(i[vt]&&this.set(Ce,vt),i[Re]&&this.set(Re,i[Re]),i[Re]=="Xbox"&&this.set(Ce,ou).set(Te,Zp),i[Ns]){var m;if(typeof i[Ns]!="string")for(var v=0;!m&&v<i[Ns].length;)m=Af(i[Ns][v++],ET);else m=Af(i[Ns],ET);this.set(Ce,m)}break;case Si:var _=i[au];if(_){var x=i[m1];_==b1&&(x=parseInt(x1(x),10)>=13?"11":"10"),this.set(ke,_).set(Ie,x)}this.get(ke)==b1&&i[Re]=="Xbox"&&this.set(ke,"Xbox").set(Ie,void 0);break;case su:var w=this.data,b=function(C){return w[C].getItem().setCH(i).parseCH().get()};this.set(ni,b(ni)).set(zo,b(zo)).set(go,b(go)).set(qo,b(qo)).set(Si,b(Si))}return this},Ho.call(this,[["itemType",e],["ua",t],["uaCH",r],["rgxMap",n],["data",kZ(this,e)]]),this}function Go(e,t,n){if(typeof e===iu?(Kp(e,!0)?(typeof t===iu&&(n=t),t=e):(n=e,t=void 0),e=void 0):typeof e===c1&&!Kp(t,!0)&&(n=t,t=void 0),n&&typeof n.append===Hp){var r={};n.forEach(function(c,d){r[d]=c}),n=r}if(!(this instanceof Go))return new Go(e,t,n).getResult();var i=typeof e===c1?e:n&&n[fT]?n[fT]:Hr&&Hr.userAgent?Hr.userAgent:ru,o=new AT(n,!0),s=t?EZ(kT,t):kT,u=function(c){return c==su?function(){return new IT(c,i,s,o).set("ua",i).set(ni,this.getBrowser()).set(zo,this.getCPU()).set(go,this.getDevice()).set(qo,this.getEngine()).set(Si,this.getOS()).get()}:function(){return new IT(c,i,s[c],o).parseUA().get()}};return Ho.call(this,[["getBrowser",u(ni)],["getCPU",u(zo)],["getDevice",u(go)],["getEngine",u(qo)],["getOS",u(Si)],["getResult",u(su)],["getUA",function(){return i}],["setUA",function(c){return uu(c)&&(i=c.length>h1?kf(c,h1):c),this}]]).setUA(i),this}Go.VERSION=pZ,Go.BROWSER=Wp([ke,Ie,vf,Ce]),Go.CPU=Wp([jr]),Go.DEVICE=Wp([Re,Te,Ce,ou,vt,Er,_n,yf,d1]),Go.ENGINE=Go.OS=Wp([ke,Ie]);const Ii=class Ii{constructor(t){er(this,"config");er(this,"storedData");er(this,"deviceInfo");er(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){Ii.instance||(Ii.instance=new Ii(t))}static getInstance(){if(!Ii.instance)throw new Error("DebalesAnalytics is not initialized. Call init() first.");return Ii.instance}static async identify(t,n){return Ii.getInstance().identifyInternal(t,n)}static track(t,n){Ii.getInstance().trackInternal(t,n)}static getDistinctId(){return Ii.getInstance().storedData.distinctId}static getAnonId(){return Ii.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 s={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",s);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:",s)}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:ur()+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(`${po}${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 Go().getResult();return{browser:n.browser.name,os:n.os.name,browserVersion:n.browser.version,osVersion:n.os.version}}};er(Ii,"instance",null);let C1=Ii;const Fs=C1;var Zi,ue=typeof window<"u"?window:void 0,Gr=typeof globalThis<"u"?globalThis:ue,RT=Array.prototype,OT=RT.forEach,TT=RT.indexOf,ri=Gr==null?void 0:Gr.navigator,Ge=Gr==null?void 0:Gr.document,Vr=Gr==null?void 0:Gr.location,E1=Gr==null?void 0:Gr.fetch,k1=Gr!=null&&Gr.XMLHttpRequest&&"withCredentials"in new Gr.XMLHttpRequest?Gr.XMLHttpRequest:void 0,MT=Gr==null?void 0:Gr.AbortController,zn=ri==null?void 0:ri.userAgent,ht=ue??{},Vo={DEBUG:!1,LIB_VERSION:"1.235.0"},A1="$copy_autocapture",AZ=["$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"})(Zi||(Zi={}));var IZ=["fatal","error","warning","log","info","debug"];function kt(e,t){return e.indexOf(t)!==-1}var Xp=function(e){return e.trim()},I1=function(e){return e.replace(/^\$/,"")},RZ=Array.isArray,DT=Object.prototype,$T=DT.hasOwnProperty,Jp=DT.toString,En=RZ||function(e){return Jp.call(e)==="[object Array]"},Yi=e=>typeof e=="function",kn=e=>e===Object(e)&&!En(e),cu=e=>{if(kn(e)){for(var t in e)if($T.call(e,t))return!1;return!0}return!1},Be=e=>e===void 0,qn=e=>Jp.call(e)=="[object String]",R1=e=>qn(e)&&e.trim().length===0,ja=e=>e===null,Wt=e=>Be(e)||ja(e),$r=e=>Jp.call(e)=="[object Number]",Ha=e=>Jp.call(e)==="[object Boolean]",OZ=e=>e instanceof FormData,TZ=e=>kt(AZ,e),LT=e=>{var t={_log:function(n){if(ue&&(Vo.DEBUG||ht.POSTHOG_DEBUG)&&!Be(ue.console)&&ue.console){for(var r=("__rrweb_original__"in ue.console[n])?ue.console[n].__rrweb_original__:ue.console[n],i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];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=>LT("".concat(e," ").concat(n))};return t},Xe=LT("[PostHog.js]"),kr=Xe.createLogger,MZ=kr("[ExternalScriptsLoader]"),NT=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return MZ.warn("".concat(t," was requested but loading of external scripts is disabled.")),n("Loading of external scripts is disabled");var r=Ge==null?void 0:Ge.querySelectorAll("script");if(r){for(var i=0;i<r.length;i++)if(r[i].src===t)return n()}var o=()=>{if(!Ge)return n("document not found");var s=Ge.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=t,s.onload=d=>n(void 0,d),s.onerror=d=>n(d),e.config.prepare_external_dependency_script&&(s=e.config.prepare_external_dependency_script(s)),!s)return n("prepare_external_dependency_script returned null");var u,c=Ge.querySelectorAll("body > script");c.length>0?(u=c[0].parentNode)===null||u===void 0||u.insertBefore(s,c[0]):Ge.body.appendChild(s)};Ge!=null&&Ge.body?o():Ge==null||Ge.addEventListener("DOMContentLoaded",o)};function PT(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?PT(Object(n),!0).forEach(function(r){Me(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):PT(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Me(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function BT(e,t){if(e==null)return{};var n,r,i=function(s,u){if(s==null)return{};var c,d,p={},h=Object.keys(s);for(d=0;d<h.length;d++)c=h[d],u.indexOf(c)>=0||(p[c]=s[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}ht.__PosthogExtensions__=ht.__PosthogExtensions__||{},ht.__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 s=e.requestRouter.endpointFor("assets",r);NT(e,s,n)},ht.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{var r=e.requestRouter.endpointFor("api",t);NT(e,r,n)};var eg={};function Ga(e,t,n){if(En(e)){if(OT&&e.forEach===OT)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)===eg)return}}}function rn(e,t,n){if(!Wt(e)){if(En(e))return Ga(e,t,n);if(OZ(e)){for(var r of e.entries())if(t.call(n,r[1],r[0])===eg)return}else for(var i in e)if($T.call(e,i)&&t.call(n,e[i],i)===eg)return}}var jn=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 Ga(n,function(i){for(var o in i)i[o]!==void 0&&(e[o]=i[o])}),e},tg=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 Ga(n,function(i){Ga(i,function(o){e.push(o)})}),e};function ng(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 FT=function(e){try{return e()}catch{return}},DZ=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){Xe.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Xe.critical(i)}}},If=function(e){var t={};return rn(e,function(n,r){qn(n)&&n.length>0&&(t[r]=n)}),t};function $Z(e,t){return n=e,r=o=>qn(o)&&!ja(t)?o.slice(0,t):o,i=new Set,function o(s,u){return s!==Object(s)?r?r(s,u):s:i.has(s)?void 0:(i.add(s),En(s)?(c=[],Ga(s,d=>{c.push(o(d))})):(c={},rn(s,(d,p)=>{i.has(d)||(c[p]=o(d,p))})),c);var c}(n);var n,r,i}var LZ=["herokuapp.com","vercel.app","netlify.app"];function NZ(e){var t=e==null?void 0:e.hostname;if(!qn(t))return!1;var n=t.split(".").slice(-2).join(".");for(var r of LZ)if(n===r)return!1;return!0}function UT(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return e[n]}function $n(e,t,n,r){var{capture:i=!1,passive:o=!0}=r??{};e==null||e.addEventListener(t,n,{capture:i,passive:o})}var zT="$people_distinct_id",Rf="__alias",Of="__timers",qT="$autocapture_disabled_server_side",O1="$heatmaps_enabled_server_side",jT="$exception_capture_enabled_server_side",HT="$web_vitals_enabled_server_side",GT="$dead_clicks_enabled_server_side",VT="$web_vitals_allowed_metrics",T1="$session_recording_enabled_server_side",ZT="$console_log_recording_enabled_server_side",YT="$session_recording_network_payload_capture",WT="$session_recording_masking",KT="$session_recording_canvas_recording",QT="$replay_sample_rate",XT="$replay_minimum_duration",JT="$replay_script_config",rg="$sesid",Tf="$session_is_sampled",M1="$session_recording_url_trigger_activated_session",D1="$session_recording_event_trigger_activated_session",fu="$enabled_feature_flags",ig="$early_access_features",$1="$feature_flag_details",Mf="$stored_person_properties",Us="$stored_group_properties",L1="$surveys",og="$surveys_activated",ag="$flag_call_reported",Zo="$user_state",N1="$client_session_props",P1="$capture_rate_limit",B1="$initial_campaign_params",F1="$initial_referrer_info",U1="$initial_person_info",sg="$epp",eM="__POSTHOG_TOOLBAR__",tM="$posthog_cookieless",PZ=[zT,Rf,"__cmpns",Of,T1,O1,rg,fu,Zo,ig,$1,Us,Mf,L1,ag,N1,P1,B1,F1,sg];function nM(e){var t;return e instanceof Element&&(e.id===eM||!((t=e.closest)===null||t===void 0||!t.call(e,".toolbar-global-fade-container")))}function lg(e){return!!e&&e.nodeType===1}function Va(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function rM(e){return!!e&&e.nodeType===3}function iM(e){return!!e&&e.nodeType===11}function z1(e){return e?Xp(e).split(/\s+/):[]}function oM(e){var t=ue==null?void 0:ue.location.href;return!!(t&&e&&e.some(n=>t.match(n)))}function ug(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 z1(t)}function aM(e){return Wt(e)?null:Xp(e).split(/(\s+)/).filter(t=>du(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function cg(e){var t="";return j1(e)&&!uM(e)&&e.childNodes&&e.childNodes.length&&rn(e.childNodes,function(n){var r;rM(n)&&n.textContent&&(t+=(r=aM(n.textContent))!==null&&r!==void 0?r:"")}),Xp(t)}function sM(e){return Be(e.target)?e.srcElement||null:(t=e.target)!==null&&t!==void 0&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var q1=["a","button","form","input","select","textarea","label"];function lM(e){var t=e.parentNode;return!(!t||!lg(t))&&t}function BZ(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(!ue||!e||Va(e,"html")||!lg(e)||n!=null&&n.url_allowlist&&!oM(n.url_allowlist)||n!=null&&n.url_ignorelist&&oM(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 s=!1,u=[e],c=!0,d=e;d.parentNode&&!Va(d,"body");)if(iM(d.parentNode))u.push(d.parentNode.host),d=d.parentNode.host;else{if(!(c=lM(d)))break;if(r||q1.indexOf(c.tagName.toLowerCase())>-1)s=!0;else{var p=ue.getComputedStyle(c);p&&p.getPropertyValue("cursor")==="pointer"&&(s=!0)}u.push(c),d=c}if(!function(v,_){var x=_==null?void 0:_.element_allowlist;if(Be(x))return!0;var w=function(E){if(x.some(k=>E.tagName.toLowerCase()===k))return{v:!0}};for(var b of v){var C=w(b);if(typeof C=="object")return C.v}return!1}(u,n)||!function(v,_){var x=_==null?void 0:_.css_selector_allowlist;if(Be(x))return!0;var w=function(E){if(x.some(k=>E.matches(k)))return{v:!0}};for(var b of v){var C=w(b);if(typeof C=="object")return C.v}return!1}(u,n))return!1;var h=ue.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 s?(i||["click"]).indexOf(t.type)>=0:(i||["click"]).indexOf(t.type)>=0&&(q1.indexOf(m)>-1||e.getAttribute("contenteditable")==="true")}}function j1(e){for(var t=e;t.parentNode&&!Va(t,"body");t=t.parentNode){var n=ug(t);if(kt(n,"ph-sensitive")||kt(n,"ph-no-capture"))return!1}if(kt(ug(e),"ph-include"))return!0;var r=e.type||"";if(qn(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var i=e.name||e.id||"";return!(qn(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 uM(e){return!!(Va(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Va(e,"select")||Va(e,"textarea")||e.getAttribute("contenteditable")==="true")}var cM="(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})",FZ=new RegExp("^(?:".concat(cM,")$")),UZ=new RegExp(cM),fM="\\d{3}-?\\d{2}-?\\d{4}",zZ=new RegExp("^(".concat(fM,")$")),qZ=new RegExp("(".concat(fM,")"));function du(e){var t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];return!(Wt(e)||qn(e)&&(e=Xp(e),(t?FZ:UZ).test((e||"").replace(/[- ]/g,""))||(t?zZ:qZ).test(e)))}function dM(e){var t=cg(e);return du(t="".concat(t," ").concat(hM(e)).trim())?t:""}function hM(e){var t="";return e&&e.childNodes&&e.childNodes.length&&rn(e.childNodes,function(n){var r;if(n&&((r=n.tagName)===null||r===void 0?void 0:r.toLowerCase())==="span")try{var i=cg(n);t="".concat(t," ").concat(i).trim(),n.childNodes&&n.childNodes.length&&(t="".concat(t," ").concat(hM(n)).trim())}catch(o){Xe.error("[AutoCapture]",o)}}),t}function jZ(e){return function(t){var n=t.map(r=>{var i,o,s="";if(r.tag_name&&(s+=r.tag_name),r.attr_class)for(var u of(r.attr_class.sort(),r.attr_class))s+=".".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 ng(c).sort((p,h)=>{var[m]=p,[v]=h;return m.localeCompare(v)}).forEach(p=>{var[h,m]=p;return d[pM(h.toString())]=pM(m.toString())}),s+=":",s+=ng(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:HZ(n),attr_id:n.attr__id,nth_child:n.nth_child,nth_of_type:n.nth_of_type,attributes:{}};return ng(n).filter(s=>{var[u]=s;return u.indexOf("attr__")===0}).forEach(s=>{var[u,c]=s;return o.attributes[u]=c}),o})}(e))}function pM(e){return e.replace(/"|\\"/g,'\\"')}function HZ(e){var t=e.attr__class;return t?En(t)?t:z1(t):void 0}class gM{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 GZ=["localhost","127.0.0.1"],hu=e=>{var t=Ge==null?void 0:Ge.createElement("a");return Be(t)?null:(t.href=e,t)},VZ=function(e){var t,n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"&",i=[];return rn(e,function(o,s){Be(o)||Be(s)||s==="undefined"||(t=encodeURIComponent((u=>u instanceof File)(o)?o.name:o.toString()),n=encodeURIComponent(s),i[i.length]=n+"="+t)}),i.join(r)},fg=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(!En(n)||n.length<2)return"";var s=n[1];try{s=decodeURIComponent(s)}catch{Xe.error("Skipping decoding for malformed query param: "+s)}return s.replace(/\+/g," ")},H1=function(e,t,n){if(!e||!t||!t.length)return e;for(var r=e.split("#"),i=r[0]||"",o=r[1],s=i.split("?"),u=s[1],c=s[0],d=(u||"").split("&"),p=[],h=0;h<d.length;h++){var m=d[h].split("=");En(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},dg=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},mM=kr("[AutoCapture]");function G1(e,t){return t.length>e?t.slice(0,e)+"...":t}function ZZ(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!lg(t));return t}function YZ(e,t,n,r){var i=e.tagName.toLowerCase(),o={tag_name:i};q1.indexOf(i)>-1&&!n&&(i.toLowerCase()==="a"||i.toLowerCase()==="button"?o.$el_text=G1(1024,dM(e)):o.$el_text=G1(1024,cg(e)));var s=ug(e);s.length>0&&(o.classes=s.filter(function(p){return p!==""})),rn(e.attributes,function(p){var h;if((!uM(e)||["name","id","class","aria-label"].indexOf(p.name)!==-1)&&(r==null||!r.includes(p.name))&&!t&&du(p.value)&&(h=p.name,!qn(h)||h.substring(0,10)!=="_ngcontent"&&h.substring(0,7)!=="_nghost")){var m=p.value;p.name==="class"&&(m=z1(m).join(" ")),o["attr__"+p.name]=G1(1024,m)}});for(var u=1,c=1,d=e;d=ZZ(d);)u++,d.tagName===e.tagName&&c++;return o.nth_child=u,o.nth_of_type=c,o}function WZ(e,t){for(var n,r,{e:i,maskAllElementAttributes:o,maskAllText:s,elementAttributeIgnoreList:u,elementsChainAsString:c}=t,d=[e],p=e;p.parentNode&&!Va(p,"body");)iM(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(rn(d,k=>{var O=j1(k);k.tagName.toLowerCase()==="a"&&(_=k.getAttribute("href"),_=O&&_&&du(_)&&_),kt(ug(k),"ph-no-capture")&&(x=!0),m.push(YZ(k,o,s,u));var T=function(L){if(!j1(L))return{};var B={};return rn(L.attributes,function(z){if(z.name&&z.name.indexOf("data-ph-capture-attribute")===0){var N=z.name.replace("data-ph-capture-attribute-",""),G=z.value;N&&G&&du(G)&&(B[N]=G)}}),B}(k);jn(v,T)}),x)return{props:{},explicitNoCapture:x};if(s||(e.tagName.toLowerCase()==="a"||e.tagName.toLowerCase()==="button"?m[0].$el_text=dM(e):m[0].$el_text=cg(e)),_){var w,b;m[0].attr__href=_;var C=(w=hu(_))===null||w===void 0?void 0:w.host,E=ue==null||(b=ue.location)===null||b===void 0?void 0:b.host;C&&E&&C!==E&&(h=_)}return{props:jn({$event_type:i.type,$ce_version:1},c?{}:{$elements:m},{$elements_chain:jZ(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 KZ{constructor(t){Me(this,"_initialized",!1),Me(this,"_isDisabledServerSide",null),Me(this,"rageclicks",new gM),Me(this,"_elementsChainAsString",!1),this.instance=t,this._elementSelectors=null}get config(){var t,n,r=kn(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(ue&&Ge){var t=r=>{r=r||(ue==null?void 0:ue.event);try{this._captureEvent(r)}catch(i){mM.error("Failed to capture event",i)}};if($n(Ge,"submit",t,{capture:!0}),$n(Ge,"change",t,{capture:!0}),$n(Ge,"click",t,{capture:!0}),this.config.capture_copied_text){var n=r=>{r=r||(ue==null?void 0:ue.event),this._captureEvent(r,A1)};$n(Ge,"copy",n,{capture:!0}),$n(Ge,"cut",n,{capture:!0})}}}else mM.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({[qT]:!!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=Ge==null?void 0:Ge.querySelectorAll(i);o==null||o.forEach(s=>{t===s&&r.push(i)})}),r}get isEnabled(){var t,n,r=(t=this.instance.persistence)===null||t===void 0?void 0:t.props[qT],i=this._isDisabledServerSide;if(ja(i)&&!Ha(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=sM(t);rM(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===A1;if(i&&BZ(i,t,this.config,o,o?["copy","cut"]:void 0)){var{props:s,explicitNoCapture:u}=WZ(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&&(s.$element_selectors=c),n===A1){var d,p=aM(ue==null||(d=ue.getSelection())===null||d===void 0?void 0:d.toString()),h=t.type||"clipboard";if(!p)return!1;s.$selected_content=p,s.$copy_type=h}return this.instance.capture(n,s),!0}}}isBrowserSupported(){return Yi(Ge==null?void 0:Ge.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 vM="0123456789abcdef";class hg{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 hg(o)}toString(){for(var t="",n=0;n<this.bytes.length;n++)t=t+vM.charAt(this.bytes[n]>>>4)+vM.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 hg(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 QZ{constructor(){Me(this,"timestamp",0),Me(this,"counter",0),Me(this,"random",new XZ)}generate(){var t=this.generateOrAbort();if(Be(t)){this.timestamp=0;var n=this.generateOrAbort();if(Be(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 hg.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 yM,_M=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};ue&&!Be(ue.crypto)&&crypto.getRandomValues&&(_M=e=>crypto.getRandomValues(e));class XZ{constructor(){Me(this,"buffer",new Uint32Array(8)),Me(this,"cursor",1/0)}nextUint32(){return this.cursor>=this.buffer.length&&(_M(this.buffer),this.cursor=0),this.buffer[this.cursor++]}}var Za=()=>JZ().toString(),JZ=()=>(yM||(yM=new QZ)).generate(),eY="Thu, 01 Jan 1970 00:00:00 GMT",Df="",tY=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function nY(e,t){if(t){var n=function(i){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ge;if(Df)return Df;if(!o||["localhost","127.0.0.1"].includes(i))return"";for(var s=i.split("."),u=Math.min(s.length,8),c="dmn_chk_"+Za(),d=new RegExp("(^|;)\\s*"+c+"=1");!Df&&u--;){var p=s.slice(u).join("."),h=c+"=1;domain=."+p;o.cookie=h,d.test(o.cookie)&&(o.cookie=h+";expires="+eY,Df=p)}return Df}(e);if(!n){var r=(i=>{var o=i.match(tY);return o?o[0]:""})(e);r!==n&&Xe.info("Warning: cookie subdomain discovery mismatch",r,n),n=r}return n?"; domain=."+n:""}return""}var Ya,Yo={is_supported:()=>!!Ge,error:function(e){Xe.error("cookieStore error: "+e)},get:function(e){if(Ge){try{for(var t=e+"=",n=Ge.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(Yo.get(e))||{}}catch{}return t},set:function(e,t,n,r,i){if(Ge)try{var o="",s="",u=nY(Ge.location.hostname,r);if(n){var c=new Date;c.setTime(c.getTime()+24*n*60*60*1e3),o="; expires="+c.toUTCString()}i&&(s="; secure");var d=e+"="+encodeURIComponent(JSON.stringify(t))+o+"; SameSite=Lax; path=/"+u+s;return d.length>3686.4&&Xe.warn("cookieStore warning: large cookie, len="+d.length),Ge.cookie=d,d}catch{return}},remove:function(e,t){try{Yo.set(e,"",-1,t)}catch{return}}},V1=null,Qn={is_supported:function(){if(!ja(V1))return V1;var e=!0;if(Be(ue))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||Xe.error("localStorage unsupported; falling back to cookie store"),V1=e,e},error:function(e){Xe.error("localStorage error: "+e)},get:function(e){try{return ue==null?void 0:ue.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{ue==null||ue.localStorage.setItem(e,JSON.stringify(t))}catch(n){Qn.error(n)}},remove:function(e){try{ue==null||ue.localStorage.removeItem(e)}catch(t){Qn.error(t)}}},rY=["distinct_id",rg,Tf,sg,U1],pg=pe(pe({},Qn),{},{parse:function(e){try{var t={};try{t=Yo.parse(e)||{}}catch{}var n=jn(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 s={};rY.forEach(u=>{t[u]&&(s[u]=t[u])}),Object.keys(s).length&&Yo.set(e,s,n,r,i,o)}catch(u){Qn.error(u)}},remove:function(e,t){try{ue==null||ue.localStorage.removeItem(e),Yo.remove(e,t)}catch(n){Qn.error(n)}}}),gg={},iY={is_supported:function(){return!0},error:function(e){Xe.error("memoryStorage error: "+e)},get:function(e){return gg[e]||null},parse:function(e){return gg[e]||null},set:function(e,t){gg[e]=t},remove:function(e){delete gg[e]}},zs=null,fr={is_supported:function(){if(!ja(zs))return zs;if(zs=!0,Be(ue))zs=!1;else try{var e="__support__";fr.set(e,"xyz"),fr.get(e)!=='"xyz"'&&(zs=!1),fr.remove(e)}catch{zs=!1}return zs},error:function(e){Xe.error("sessionStorage error: ",e)},get:function(e){try{return ue==null?void 0:ue.sessionStorage.getItem(e)}catch(t){fr.error(t)}return null},parse:function(e){try{return JSON.parse(fr.get(e))||null}catch{}return null},set:function(e,t){try{ue==null||ue.sessionStorage.setItem(e,JSON.stringify(t))}catch(n){fr.error(n)}},remove:function(e){try{ue==null||ue.sessionStorage.removeItem(e)}catch(t){fr.error(t)}}};(function(e){e[e.PENDING=-1]="PENDING",e[e.DENIED=0]="DENIED",e[e.GRANTED=1]="GRANTED"})(Ya||(Ya={}));class oY{constructor(t){this.instance=t}get config(){return this.instance.config}get consent(){return this.getDnt()?Ya.DENIED:this.storedConsent}isOptedOut(){return this.consent===Ya.DENIED||this.consent===Ya.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"?Ya.GRANTED:t==="0"?Ya.DENIED:Ya.PENDING}get storage(){if(!this._storage){var t=this.config.opt_out_capturing_persistence_type;this._storage=t==="localStorage"?Qn:Yo;var n=t==="localStorage"?Yo: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&&!!UT([ri==null?void 0:ri.doNotTrack,ri==null?void 0:ri.msDoNotTrack,ht.doNotTrack],t=>kt([!0,1,"1","yes"],t))}}var mg=kr("[Dead Clicks]"),aY=()=>!0,sY=e=>{var t,n=!((t=e.instance.persistence)===null||t===void 0||!t.get_property(GT)),r=e.instance.config.capture_dead_clicks;return Ha(r)?r:n};class bM{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({[GT]:t==null?void 0:t.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.loadScript(()=>{this.start()})}loadScript(t){var n,r,i;(n=ht.__PosthogExtensions__)!==null&&n!==void 0&&n.initDeadClicksAutocapture&&t(),(r=ht.__PosthogExtensions__)===null||r===void 0||(i=r.loadExternalDependency)===null||i===void 0||i.call(r,this.instance,"dead-clicks-autocapture",o=>{o?mg.error("failed to load script",o):t()})}start(){var t;if(Ge){if(!this._lazyLoadedDeadClicksAutocapture&&(t=ht.__PosthogExtensions__)!==null&&t!==void 0&&t.initDeadClicksAutocapture){var n=kn(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};n.__onCapture=this.onCapture,this._lazyLoadedDeadClicksAutocapture=ht.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this._lazyLoadedDeadClicksAutocapture.start(Ge),mg.info("starting...")}}else mg.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,mg.info("stopping..."))}}var Z1=kr("[ExceptionAutocapture]");class lY{constructor(t){var n;Me(this,"startCapturing",()=>{var r;if(ue&&this.isEnabled&&(r=ht.__PosthogExtensions__)!==null&&r!==void 0&&r.errorWrappingFunctions){var i=ht.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,o=ht.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=ht.__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=s(this.captureException.bind(this)))}catch(u){Z1.error("failed to start",u),this.stopCapturing()}}}),this.instance=t,this.remoteEnabled=!((n=this.instance.persistence)===null||n===void 0||!n.props[jT]),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 kn(t)?n=pe(pe({},n),t):(Be(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&&(Z1.info("enabled"),this.loadScript(this.startCapturing))}loadScript(t){var n,r,i;(n=ht.__PosthogExtensions__)!==null&&n!==void 0&&n.errorWrappingFunctions&&t(),(r=ht.__PosthogExtensions__)===null||r===void 0||(i=r.loadExternalDependency)===null||i===void 0||i.call(r,this.instance,"exception-autocapture",o=>{if(o)return Z1.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({[jT]: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 SM(e){return!Be(Event)&&wM(e,Event)}function wM(e,t){try{return e instanceof t}catch{return!1}}function vg(e,t){return Object.prototype.toString.call(e)==="[object ".concat(t,"]")}function Y1(e){return vg(e,"DOMError")}var xM=/\(error: (.*)\)/,CM=50,pu="?";function W1(e,t,n,r){var i={platform:"web:javascript",filename:e,function:t==="<anonymous>"?pu:t,in_app:!0};return Be(n)||(i.lineno=n),Be(r)||(i.colno=r),i}var uY=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,cY=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,fY=/\((\S*)(?::(\d+))(?::(\d+))\)/,dY=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,hY=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,pY=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,s=[],u=i.split(`
137
137
  `),c=o;c<u.length;c++){var d=u[c];if(!(d.length>1024)){var p=xM.test(d)?d.replace(xM,"$1"):d;if(!p.match(/\S*Error: /)){for(var h of r){var m=h(p);if(m){s.push(m);break}}if(s.length>=CM)break}}}return function(v){if(!v.length)return[];var _=Array.from(v);return _.reverse(),_.slice(0,CM).map(x=>pe(pe({},x),{},{filename:x.filename||gY(_).filename,function:x.function||pu}))}(s)}}([30,e=>{var t=uY.exec(e);if(t){var[,n,r,i]=t;return W1(n,pu,+r,+i)}var o=cY.exec(e);if(o){if(o[2]&&o[2].indexOf("eval")===0){var s=fY.exec(o[2]);s&&(o[2]=s[1],o[3]=s[2],o[4]=s[3])}var[u,c]=kM(o[1]||pu,o[2]);return W1(c,u,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}}],[50,e=>{var t=dY.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var n=hY.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]||pu;return[i,r]=kM(i,r),W1(r,i,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}]);function gY(e){return e[e.length-1]||{}}var yg,EM,K1,kM=(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]:pu,n?"safari-extension:".concat(t):"safari-web-extension:".concat(t)]:[e,t]},mY=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;function Q1(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=e.stacktrace||e.stack||"",r=function(s){return s&&vY.test(s.message)?1:0}(e);try{var i=pY,o=function(s,u){var c=function(d){var p=globalThis._posthogChunkIds;if(!p)return{};var h=Object.keys(p);return K1&&h.length===EM||(EM=h.length,K1=h.reduce((m,v)=>{yg||(yg={});var _=yg[v];if(_)m[_[0]]=_[1];else for(var x=d(v),w=x.length-1;w>=0;w--){var b=x[w],C=b==null?void 0:b.filename,E=p[v];if(C&&E){m[C]=E,yg[v]=[C,E];break}}return m},{})),K1}(u);return s.forEach(d=>{d.filename&&(d.chunk_id=c[d.filename])}),s}(i(n,r),i);return o.slice(0,o.length-t)}catch{}return[]}var vY=/Minified React error #\d+;/i;function X1(e,t){var n,r,i=Q1(e),o=(n=t==null?void 0:t.handled)===null||n===void 0||n,s=(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:s}}],$exception_level:"error"}}function J1(e,t){var n,r,i,o=(n=t==null?void 0:t.handled)===null||n===void 0||n,s=(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:s}};if(t!=null&&t.syntheticException){var c=Q1(t.syntheticException,1);c.length&&(u.stacktrace={frames:c,type:"raw"})}return{$exception_list:[u],$exception_level:"error"}}function yY(e){return qn(e)&&!R1(e)&&IZ.indexOf(e)>=0}function _Y(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,s=t!=null&&t.overrideExceptionType?t.overrideExceptionType:SM(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:s,value:u,mechanism:{handled:i,synthetic:o}};if(t!=null&&t.syntheticException){var d=Q1(t==null?void 0:t.syntheticException,1);d.length&&(c.stacktrace={frames:d,type:"raw"})}return{$exception_list:[c],$exception_level:yY(e.level)?e.level:"error"}}function bY(e,t){var{error:n,event:r}=e,i={$exception_list:[]},o=n||r;if(Y1(o)||function(v){return vg(v,"DOMException")}(o)){var s=o;if(function(v){return"stack"in v}(o))i=X1(o,t);else{var u=s.name||(Y1(s)?"DOMError":"DOMException"),c=s.message?"".concat(u,": ").concat(s.message):u,d=Y1(s)?"DOMError":"DOMException";i=J1(c,pe(pe({},t),{},{overrideExceptionType:d,defaultExceptionMessage:c}))}return"code"in s&&(i.$exception_DOMException_code="".concat(s.code)),i}if(function(v){return vg(v,"ErrorEvent")}(o)&&o.error)return X1(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 wM(v,Error)}}(o))return X1(o,t);if(function(v){return vg(v,"Object")}(o)||SM(o))return _Y(o,t);if(Be(n)&&qn(r)){var p="Error",h=r,m=r.match(mY);return m&&(p=m[1],h=m[2]),J1(h,pe(pe({},t),{},{overrideExceptionType:p,defaultExceptionMessage:h}))}return J1(o,t)}function _g(e){var t,n;return((t=JSON.stringify(e,(n=[],function(r,i){if(kn(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 eS(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[eS({size:_g(r),data:r,sessionId:e.sessionId,windowId:e.windowId}),eS({size:_g(i),data:i,sessionId:e.sessionId,windowId:e.windowId})].flatMap(o=>o)}return[e]}var Wo=(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))(Wo||{}),Wi=(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))(Wi||{}),tS="[SessionRecording]",nS="redacted",bg={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"]},SY=["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"],wY=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],xY=["/s/","/e/","/i/"];function AM(e,t,n,r){if(Wt(e))return e;var i=(t==null?void 0:t["content-length"])||function(o){return new Blob([o]).size}(e);return qn(i)&&(i=parseInt(i)),i>n?tS+" ".concat(r," body too large to record (").concat(i," bytes)"):e}function IM(e,t){if(Wt(e))return e;var n=e;return du(n,!1)||(n=tS+" "+t+" body "+nS),rn(wY,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=tS+" "+t+" body "+nS+" as might contain: "+r)}),n}var CY=(e,t)=>{var n,r,i,o={payloadSizeLimitBytes:bg.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...bg.performanceEntryTypeToObserve],payloadHostDenyList:[...t.payloadHostDenyList||[],...bg.payloadHostDenyList]},s=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=AM(m.requestBody,m.requestHeaders,i,"Request")),m!=null&&m.responseBody&&(m.responseBody=AM(m.responseBody,m.responseHeaders,i,"Response")),m)),p=m=>{return d(((x,w)=>{var b,C=hu(x.name),E=w.indexOf("http")===0?(b=hu(w))===null||b===void 0?void 0:b.pathname:w;E==="/"&&(E="");var k=C==null?void 0:C.pathname.replace(E||"","");if(!(C&&k&&xY.some(O=>k.indexOf(O)===0)))return x})((_=(v=m).requestHeaders,Wt(_)||rn(Object.keys(_??{}),x=>{SY.includes(x.toLowerCase())&&(_[x]=nS)}),v),e.api_host));var v,_},h=Yi(e.session_recording.maskNetworkRequestFn);return h&&Yi(e.session_recording.maskCapturedNetworkRequestFn)&&Xe.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=Yi(e.session_recording.maskCapturedNetworkRequestFn)?m=>{var v,_,x,w=p(m);return w&&(v=(_=(x=e.session_recording).maskCapturedNetworkRequestFn)===null||_===void 0?void 0:_.call(x,w))!==null&&v!==void 0?v:void 0}:m=>function(v){if(!Be(v))return v.requestBody=IM(v.requestBody,"Request"),v.responseBody=IM(v.responseBody,"Response"),v}(p(m)),pe(pe(pe({},bg),o),{},{recordHeaders:s,recordBody:u,recordPerformance:c,recordInitialRequests:c})};function wi(e,t,n,r,i){return t>n&&(Xe.warn("min cannot be greater than max."),t=n),$r(e)?e>n?(r&&Xe.warn(r+" cannot be greater than max: "+n+". Using max value instead."),n):e<t?(r&&Xe.warn(r+" cannot be less than min: "+t+". Using min value instead."),t):e:(r&&Xe.warn(r+" must be a number. using max or fallback. max: "+n+", fallback: "+i),wi(i||n,t,n,r))}class EY{constructor(t){var n,r,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Me(this,"bucketSize",100),Me(this,"refillRate",10),Me(this,"mutationBuckets",{}),Me(this,"loggedTracker",{}),Me(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]})}),Me(this,"getNodeOrRelevantParent",o=>{var s=this.rrweb.mirror.getNode(o);if((s==null?void 0:s.nodeName)!=="svg"&&s instanceof Element){var u=s.closest("svg");if(u)return[this.rrweb.mirror.getId(u),u]}return[o,s]}),Me(this,"numberOfChanges",o=>{var s,u,c,d,p,h,m,v;return((s=(u=o.removes)===null||u===void 0?void 0:u.length)!==null&&s!==void 0?s: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)}),Me(this,"throttleMutations",o=>{if(o.type!==3||o.data.source!==0)return o;var s=o.data,u=this.numberOfChanges(s);s.attributes&&(s.attributes=s.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(s);return c!==0||u===c?o:void 0}),this.rrweb=t,this.options=i,this.refillRate=wi((n=this.options.refillRate)!==null&&n!==void 0?n:this.refillRate,0,100,"mutation throttling refill rate"),this.bucketSize=wi((r=this.options.bucketSize)!==null&&r!==void 0?r:this.bucketSize,0,100,"mutation throttling bucket size"),setInterval(()=>{this.refillBuckets()},1e3)}}var xi=Uint8Array,Zr=Uint16Array,gu=Uint32Array,rS=new xi([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]),iS=new xi([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]),RM=new xi([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),OM=function(e,t){for(var n=new Zr(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var i=new gu(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]},TM=OM(rS,2),kY=TM[0],oS=TM[1];kY[28]=258,oS[258]=28;for(var MM=OM(iS,0)[1],DM=new Zr(32768),gn=0;gn<32768;++gn){var qs=(43690&gn)>>>1|(21845&gn)<<1;qs=(61680&(qs=(52428&qs)>>>2|(13107&qs)<<2))>>>4|(3855&qs)<<4,DM[gn]=((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 s,u=new Zr(t);for(i=0;i<t;++i)u[i]=u[i-1]+o[i-1]<<1;for(s=new Zr(r),i=0;i<r;++i)s[i]=DM[u[e[i]-1]++]>>>15-e[i];return s},js=new xi(288);for(gn=0;gn<144;++gn)js[gn]=8;for(gn=144;gn<256;++gn)js[gn]=9;for(gn=256;gn<280;++gn)js[gn]=7;for(gn=280;gn<288;++gn)js[gn]=8;var Sg=new xi(32);for(gn=0;gn<32;++gn)Sg[gn]=5;var AY=$f(js,9),IY=$f(Sg,5),$M=function(e){return(e/8>>0)+(7&e&&1)},LM=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var r=new(e instanceof Zr?Zr:e instanceof gu?gu:xi)(n-t);return r.set(e.subarray(t,n)),r},Ko=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8},Lf=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},aS=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 xi(0),0];if(i==1){var s=new xi(n[0].s+1);return s[n[0].s]=1,[s,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),_=sS(n[p-1],v,0);if(_>t){r=0;var x=0,w=_-t,b=1<<w;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>>>=w;x>0;){var E=o[r].s;v[E]<t?x-=1<<t-v[E]++-1:++r}for(;r>=0&&x;--r){var k=o[r].s;v[k]==t&&(--v[k],++x)}_=t}return[new xi(v),_]},sS=function(e,t,n){return e.s==-1?Math.max(sS(e.l,t,n+1),sS(e.r,t,n+1)):t[e.s]=n},NM=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Zr(++t),r=0,i=e[0],o=1,s=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)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(i),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(i);o=1,i=e[u]}return[n.subarray(0,r),t]},Nf=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},lS=function(e,t,n){var r=n.length,i=$M(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)},PM=function(e,t,n,r,i,o,s,u,c,d,p){Ko(t,p++,n),++i[256];for(var h=aS(i,15),m=h[0],v=h[1],_=aS(o,15),x=_[0],w=_[1],b=NM(m),C=b[0],E=b[1],k=NM(x),O=k[0],T=k[1],L=new Zr(19),B=0;B<C.length;++B)L[31&C[B]]++;for(B=0;B<O.length;++B)L[31&O[B]]++;for(var z=aS(L,7),N=z[0],G=z[1],Q=19;Q>4&&!N[RM[Q-1]];--Q);var se,H,J,q,V=d+5<<3,fe=Nf(i,js)+Nf(o,Sg)+s,be=Nf(i,m)+Nf(o,x)+s+14+3*Q+Nf(L,N)+(2*L[16]+3*L[17]+7*L[18]);if(V<=fe&&V<=be)return lS(t,p,e.subarray(c,c+d));if(Ko(t,p,1+(be<fe)),p+=2,be<fe){se=$f(m,v),H=m,J=$f(x,w),q=x;var A=$f(N,G);for(Ko(t,p,E-257),Ko(t,p+5,T-1),Ko(t,p+10,Q-4),p+=14,B=0;B<Q;++B)Ko(t,p+3*B,N[RM[B]]);p+=3*Q;for(var ne=[C,O],ce=0;ce<2;++ce){var $=ne[ce];for(B=0;B<$.length;++B){var he=31&$[B];Ko(t,p,A[he]),p+=N[he],he>15&&(Ko(t,p,$[B]>>>5&127),p+=$[B]>>>12)}}}else se=AY,H=js,J=IY,q=Sg;for(B=0;B<u;++B)if(r[B]>255){he=r[B]>>>18&31,Lf(t,p,se[he+257]),p+=H[he+257],he>7&&(Ko(t,p,r[B]>>>23&31),p+=rS[he]);var Ne=31&r[B];Lf(t,p,J[Ne]),p+=q[Ne],Ne>3&&(Lf(t,p,r[B]>>>5&8191),p+=iS[Ne])}else Lf(t,p,se[r[B]]),p+=H[r[B]];return Lf(t,p,se[256]),p+H[256]},RY=new gu([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),OY=function(){for(var e=new gu(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),TY=function(){var e=4294967295;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=OY[255&n^t[r]]^n>>>8;e=n},d:function(){return 4294967295^e}}},MY=function(e,t,n,r,i){return function(o,s,u,c,d,p){var h=o.length,m=new xi(c+h+5*(1+Math.floor(h/7e3))+d),v=m.subarray(c,m.length-d),_=0;if(!s||h<8)for(var x=0;x<=h;x+=65535){var w=x+65535;w<h?_=lS(v,_,o.subarray(x,w)):(v[x]=p,_=lS(v,_,o.subarray(x,h)))}else{for(var b=RY[s-1],C=b>>>13,E=8191&b,k=(1<<u)-1,O=new Zr(32768),T=new Zr(k+1),L=Math.ceil(u/3),B=2*L,z=function(ut){return(o[ut]^o[ut+1]<<L^o[ut+2]<<B)&k},N=new gu(25e3),G=new Zr(288),Q=new Zr(32),se=0,H=0,J=(x=0,0),q=0,V=0;x<h;++x){var fe=z(x),be=32767&x,A=T[fe];if(O[be]=A,T[fe]=be,q<=x){var ne=h-x;if((se>7e3||J>24576)&&ne>423){_=PM(o,v,0,N,G,Q,H,J,V,x-V,_),J=se=H=0,V=x;for(var ce=0;ce<286;++ce)G[ce]=0;for(ce=0;ce<30;++ce)Q[ce]=0}var $=2,he=0,Ne=E,ie=be-A&32767;if(ne>2&&fe==z(x-ie))for(var Fe=Math.min(C,ne)-1,we=Math.min(32767,x),We=Math.min(258,ne);ie<=we&&--Ne&&be!=A;){if(o[x+$]==o[x+$-ie]){for(var Qe=0;Qe<We&&o[x+Qe]==o[x+Qe-ie];++Qe);if(Qe>$){if($=Qe,he=ie,Qe>Fe)break;var Pe=Math.min(ie,Qe-2),Se=0;for(ce=0;ce<Pe;++ce){var $e=x-ie+ce+32768&32767,Ke=$e-O[$e]+32768&32767;Ke>Se&&(Se=Ke,A=$e)}}}ie+=(be=A)-(A=O[be])+32768&32767}if(he){N[J++]=268435456|oS[$]<<18|MM[he];var nt=31&oS[$],yt=31&MM[he];H+=rS[nt]+iS[yt],++G[257+nt],++Q[yt],q=x+$,++se}else N[J++]=o[x],++G[o[x]]}}_=PM(o,v,p,N,G,Q,H,J,V,x-V,_)}return LM(m,0,c+$M(_)+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)},uS=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},DY=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&&uS(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)}},$Y=function(e){return 10+(e.filename&&e.filename.length+1||0)};function BM(e,t){t===void 0&&(t={});var n=TY(),r=e.length;n.p(e);var i=MY(e,t,$Y(t),8),o=i.length;return DY(i,t),uS(i,o-8,n.d()),uS(i,o-4,r),i}function FM(e,t){var n=e.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(e);for(var r=new xi(e.length+(e.length>>>1)),i=0,o=function(d){r[i++]=d},s=0;s<n;++s){if(i+5>r.length){var u=new xi(i+8+(n-s<<1));u.set(r),r=u}var c=e.charCodeAt(s);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(++s))>>>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 LM(r,0,i)}function LY(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<wi(100*t,0,100)}var Pf="[SessionRecording]",Ar=kr(Pf);function wg(){var e,t;return ht==null||(e=ht.__PosthogExtensions__)===null||e===void 0||(t=e.rrweb)===null||t===void 0?void 0:t.record}var NY=3e5,PY=[Wi.MouseMove,Wi.MouseInteraction,Wi.Scroll,Wi.ViewportResize,Wi.Input,Wi.TouchMove,Wi.MediaInteraction,Wi.Drag],UM=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}(BM(FM(JSON.stringify(e))))}function zM(e){return e.type===Wo.Custom&&e.data.tag==="sessionIdle"}function qM(e,t){return t.some(n=>n.matching==="regex"&&new RegExp(n.url).test(e))}class BY{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(Pf+" 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:NY}get isSampled(){var t=this.instance.get_property(Tf);return Ha(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(T1),n=!this.instance.config.disable_session_recording;return ue&&t&&n}get isConsoleLogCaptureEnabled(){var t=!!this.instance.get_property(ZT),n=this.instance.config.enable_recording_console_log;return n??t}get canvasRecording(){var t,n,r,i,o,s,u=this.instance.config.session_recording.captureCanvas,c=this.instance.get_property(KT),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=(s=u==null?void 0:u.canvasQuality)!==null&&s!==void 0?s: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:wi(p,0,12,"canvas recording fps",4),quality:wi(h,0,1,"canvas recording quality",.4)}}get networkPayloadCapture(){var t,n,r=this.instance.get_property(YT),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),s=(i==null?void 0:i.recordBody)||(r==null?void 0:r.recordBody),u=kn(this.instance.config.capture_performance)?this.instance.config.capture_performance.network_timing:this.instance.config.capture_performance,c=!!(Ha(u)?u:r!=null&&r.capturePerformance);return o||s||c?{recordHeaders:o,recordBody:s,recordPerformance:c}:void 0}get masking(){var t,n,r,i,o,s,u=this.instance.get_property(WT),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=(s=c==null?void 0:c.blockSelector)!==null&&s!==void 0?s:u==null?void 0:u.blockSelector;return Be(d)&&Be(p)&&Be(h)?void 0:{maskAllInputs:d==null||d,maskTextSelector:p,blockSelector:h}}get sampleRate(){var t=this.instance.get_property(QT);return $r(t)?t:null}get minimumDuration(){var t=this.instance.get_property(XT);return $r(t)?t:null}get status(){return this.receivedDecide?this.isRecordingEnabled?this.isSampled===!1?"disabled":this._urlBlocked?"paused":Wt(this._linkedFlag)||this._linkedFlagSeen?this.triggerStatus==="trigger_pending"?"buffering":Ha(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(M1))===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(D1))===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(Me(this,"queuedRRWebEvents",[]),Me(this,"isIdle","unknown"),Me(this,"_linkedFlagSeen",!1),Me(this,"_lastActivityTimestamp",Date.now()),Me(this,"_linkedFlag",null),Me(this,"_removePageViewCaptureHook",void 0),Me(this,"_onSessionIdListener",void 0),Me(this,"_persistDecideOnSessionListener",void 0),Me(this,"_samplingSessionListener",void 0),Me(this,"_urlTriggers",[]),Me(this,"_urlBlocklist",[]),Me(this,"_urlBlocked",!1),Me(this,"_eventTriggers",[]),Me(this,"_removeEventTriggerCaptureHook",void 0),Me(this,"_forceAllowLocalhostNetworkCapture",!1),Me(this,"_onBeforeUnload",()=>{this._flushBuffer()}),Me(this,"_onOffline",()=>{this._tryAddCustomEvent("browser offline",{})}),Me(this,"_onOnline",()=>{this._tryAddCustomEvent("browser online",{})}),Me(this,"_onVisibilityChange",()=>{if(Ge!=null&&Ge.visibilityState){var i="window "+Ge.visibilityState;this._tryAddCustomEvent(i,{})}}),this.instance=t,this._captureStarted=!1,this._endpoint="/s/",this.stopRrweb=void 0,this.receivedDecide=!1,!this.instance.sessionManager)throw Ar.error("started without valid sessionManager"),new Error(Pf+" started without valid sessionManager. This is a bug.");if(this.instance.config.__preview_experimental_cookieless_mode)throw new Error(Pf+" 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&&Ar.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),$n(ue,"beforeunload",this._onBeforeUnload),$n(ue,"offline",this._onOffline),$n(ue,"online",this._onOnline),$n(ue,"visibilitychange",this._onVisibilityChange),this._setupSampling(),this._addEventTriggerListener(),Wt(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){Ar.error("Could not add $pageview to rrweb session",i)}})),this._onSessionIdListener||(this._onSessionIdListener=this.sessionManager.onSessionId((n,r,i)=>{var o,s,u,c;i&&(this._tryAddCustomEvent("$session_id_change",{sessionId:n,windowId:r,changeReason:i}),(o=this.instance)===null||o===void 0||(s=o.persistence)===null||s===void 0||s.unregister(D1),(u=this.instance)===null||u===void 0||(c=u.persistence)===null||c===void 0||c.unregister(M1))}))):this.stopRecording()}stopRecording(){var t,n,r,i;this._captureStarted&&this.stopRrweb&&(this.stopRrweb(),this.stopRrweb=void 0,this._captureStarted=!1,ue==null||ue.removeEventListener("beforeunload",this._onBeforeUnload),ue==null||ue.removeEventListener("offline",this._onOffline),ue==null||ue.removeEventListener("online",this._onOnline),ue==null||ue.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,Ar.info("stopped"))}_resetSampling(){var t;(t=this.instance.persistence)===null||t===void 0||t.unregister(Tf)}makeSamplingDecision(t){var n,r=this.sessionId!==t,i=this.sampleRate;if($r(i)){var o=this.isSampled,s=r||!Ha(o),u=s?LY(t,i):o;s&&(u?this._reportStarted("sampled"):Ar.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({[Tf]:u})}else this._resetSampling()}onRemoteConfig(t){var n,r,i,o,s,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(),!Wt(this._linkedFlag)&&!this._linkedFlagSeen){var c=qn(this._linkedFlag)?this._linkedFlag:this._linkedFlag.flag,d=qn(this._linkedFlag)?null:this._linkedFlag.variant;this.instance.onFeatureFlags((p,h)=>{var m=kn(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),(s=t.sessionRecording)!==null&&s!==void 0&&s.eventTriggers&&(this._eventTriggers=t.sessionRecording.eventTriggers),this.receivedDecide=!0,this.startIfEnabledOrStop()}_setupSampling(){$r(this.sampleRate)&&Wt(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,s,u,c,d,p,h,m,v,_=(o=t.sessionRecording)===null||o===void 0?void 0:o.sampleRate,x=Wt(_)?null:parseFloat(_);Wt(x)&&this._resetSampling();var w=(s=t.sessionRecording)===null||s===void 0?void 0:s.minimumDurationMilliseconds;r.register({[T1]:!!t.sessionRecording,[ZT]:(u=t.sessionRecording)===null||u===void 0?void 0:u.consoleLogRecordingEnabled,[YT]:pe({capturePerformance:t.capturePerformance},(c=t.sessionRecording)===null||c===void 0?void 0:c.networkPayloadCapture),[WT]:(d=t.sessionRecording)===null||d===void 0?void 0:d.masking,[KT]:{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},[QT]:x,[XT]:Be(w)?null:w,[JT]:(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(!Be(Object.assign)&&!Be(Array.from)&&!(this._captureStarted||this.instance.config.disable_session_recording||this.instance.consent.isOptedOut())){var n,r;this._captureStarted=!0,this.sessionManager.checkAndGetSessionAndWindowId(),wg()?this._onScriptLoaded():(n=ht.__PosthogExtensions__)===null||n===void 0||(r=n.loadExternalDependency)===null||r===void 0||r.call(n,this.instance,this.scriptName,i=>{if(i)return Ar.error("could not load recorder",i);this._onScriptLoaded()}),Ar.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(JT))===null||r===void 0?void 0:r.script)||"recorder"}isInteractiveEvent(t){var n;return t.type===3&&PY.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:s}=this.sessionManager.checkAndGetSessionAndWindowId(!n,t.timestamp),u=this.sessionId!==s,c=this.windowId!==o;this.windowId=o,this.sessionId=s,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}):Ar.warn("could not emit queued rrweb event.",n,t),!1}}_tryAddCustomEvent(t,n){return this._tryRRWebMethod(UM(()=>wg().addCustomEvent(t,n)))}_tryTakeFullSnapshot(){return this._tryRRWebMethod(UM(()=>wg().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},s=this.instance.config.session_recording;for(var[u,c]of Object.entries(s||{}))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=wg();if(d){this.mutationRateLimiter=(t=this.mutationRateLimiter)!==null&&t!==void 0?t:new EY(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");Ar.info(v,{node:m}),this.log(Pf+" "+v,"warn")}});var p=this._gatherRRWebPlugins();this.stopRrweb=d(pe({emit:h=>{this.onRRwebEmit(h)},plugins:p},o)),this._lastActivityTimestamp=Date.now(),this.isIdle=Ha(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 Ar.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=[],s=(t=ht.__PosthogExtensions__)===null||t===void 0||(n=t.rrwebPlugins)===null||n===void 0?void 0:n.getRecordConsolePlugin;s&&this.isConsoleLogCaptureEnabled&&o.push(s());var u=(r=ht.__PosthogExtensions__)===null||r===void 0||(i=r.rrwebPlugins)===null||i===void 0?void 0:i.getRecordNetworkPlugin;return this.networkPayloadCapture&&Yi(u)&&(!GZ.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?o.push(u(CY(this.instance.config,this.networkPayloadCapture))):Ar.info("NetworkCapture not started because we are on localhost.")),o}onRRwebEmit(t){var n;if(this._processQueuedEvents(),t&&kn(t)){if(t.type===Wo.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===Wo.Custom&&h.data.tag==="recording paused"}(t)){t.type===Wo.FullSnapshot&&this._scheduleFullSnapshot(),t.type===Wo.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&&kn(m)&&m.type===6&&kn(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||zM(o)){if(zM(o)){var s=o.data.payload;if(s){var u=s.lastActivityTimestamp,c=s.threshold;o.timestamp=u+c}}var d=(n=this.instance.config.session_recording.compress_events)===null||n===void 0||n?function(h){if(_g(h)<1024)return h;try{if(h.type===Wo.FullSnapshot)return pe(pe({},h),{},{data:Hs(h.data),cv:"2024-10"});if(h.type===Wo.IncrementalSnapshot&&h.data.source===Wi.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===Wo.IncrementalSnapshot&&h.data.source===Wi.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){Ar.error("could not compress event - will use uncompressed event",m)}return h}(o):o,p={$snapshot_bytes:_g(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&&ue){var t=this._maskUrl(ue.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&&eS(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:Vo.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(ue!==void 0&&ue.location.href){var t=ue.location.href,n=this._urlBlocked,r=qM(t,this._urlBlocklist);r&&!n?this._pauseRecording():!r&&n&&this._resumeRecording(),qM(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"?M1:D1]:this.sessionId}),this._flushBuffer(),this._reportStarted(t+"_trigger_matched"))}_pauseRecording(){this._urlBlocked||(this._urlBlocked=!0,clearInterval(this._fullSnapshotTimer),Ar.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"}),Ar.info("recording resumed"))}_addEventTriggerListener(){this._eventTriggers.length!==0&&Wt(this._removeEventTriggerCaptureHook)&&(this._removeEventTriggerCaptureHook=this.instance.on("eventCaptured",t=>{try{this._eventTriggers.includes(t.event)&&this._activateTrigger("event")}catch(n){Ar.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({[Tf]:!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}),Ar.info(t.replace("_"," "),n),kt(["recording_initialized","session_id_changed"],t)||this._tryAddCustomEvent(t,n)}}var cS=kr("[SegmentIntegration]");function FY(e,t){var n=e.config.segment;if(!n)return t();(function(r,i){var o=r.config.segment;if(!o)return i();var s=c=>{var d=()=>c.anonymousId()||Za();r.config.get_device_id=d,c.id()&&(r.register({distinct_id:c.id(),$device_id:d()}),r.persistence.set_property(Zo,"identified")),i()},u=o.user();"then"in u&&Yi(u.then)?u.then(c=>s(c)):s(u)})(e,()=>{n.register((r=>{Promise&&Promise.resolve||cS.warn("This browser does not have Promise support, and can not use the segment integration");var i=(o,s)=>{var u;if(!s)return o;o.event.userId||o.event.anonymousId===r.get_distinct_id()||(cS.info("No userId set, resetting PostHog"),r.reset()),o.event.userId&&o.event.userId!==r.get_distinct_id()&&(cS.info("UserId set, identifying with PostHog"),r.identify(o.event.userId));var c=r._calculate_event_properties(s,(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 jM="posthog-js";function HM(e){var{organization:t,projectId:n,prefix:r,severityAllowList:i=["error"]}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return o=>{var s,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=((s=o.exception)===null||s===void 0?void 0:s.values)||[],v=m.map(x=>pe(pe({},x),{},{stacktrace:x.stacktrace?pe(pe({},x.stacktrace),{},{type:"raw",frames:(x.stacktrace.frames||[]).map(w=>pe(pe({},w),{},{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 UY{constructor(t,n,r,i,o){this.name=jM,this.setupOnce=function(s){s(HM(t,{organization:n,projectId:r,prefix:i,severityAllowList:o}))}}}var Qo,zY=ue!=null&&ue.location?dg(ue.location.hash,"__posthog")||dg(location.hash,"state"):null,GM="_postHogToolbarParams",VM=kr("[Toolbar]");(function(e){e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED"})(Qo||(Qo={}));class qY{constructor(t){this.instance=t}setToolbarState(t){ht.ph_toolbar_state=t}getToolbarState(){var t;return(t=ht.ph_toolbar_state)!==null&&t!==void 0?t:Qo.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(!ue||!Ge)return!1;r=(t=r)!==null&&t!==void 0?t:ue.location,o=(n=o)!==null&&n!==void 0?n:ue.history;try{if(!i){try{ue.localStorage.setItem("test","test"),ue.localStorage.removeItem("test")}catch{return!1}i=ue==null?void 0:ue.localStorage}var s,u=zY||dg(r.hash,"__posthog")||dg(r.hash,"state"),c=u?FT(()=>JSON.parse(atob(decodeURIComponent(u))))||FT(()=>JSON.parse(decodeURIComponent(u))):null;return c&&c.action==="ph_authorize"?((s=c).source="url",s&&Object.keys(s).length>0&&(c.desiredHash?r.hash=c.desiredHash:o?o.replaceState(o.state,"",r.pathname+r.search):r.hash="")):((s=JSON.parse(i.getItem(GM)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token)&&(this.loadToolbar(s),!0)}catch{return!1}}_callLoadToolbar(t){var n=ht.ph_load_toolbar||ht.ph_load_editor;!Wt(n)&&Yi(n)?n(t,this.instance):VM.warn("No toolbar load function found")}loadToolbar(t){var n=!(Ge==null||!Ge.getElementById(eM));if(!ue||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(ue.localStorage.setItem(GM,JSON.stringify(pe(pe({},i),{},{source:void 0}))),this.getToolbarState()===Qo.LOADED)this._callLoadToolbar(i);else if(this.getToolbarState()===Qo.UNINITIALIZED){var o,s;this.setToolbarState(Qo.LOADING),(o=ht.__PosthogExtensions__)===null||o===void 0||(s=o.loadExternalDependency)===null||s===void 0||s.call(o,this.instance,"toolbar",u=>{if(u)return VM.error("[Toolbar] Failed to load",u),void this.setToolbarState(Qo.UNINITIALIZED);this.setToolbarState(Qo.LOADED),this._callLoadToolbar(i)}),$n(ue,"turbolinks:load",()=>{this.setToolbarState(Qo.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 jY=kr("[TracingHeaders]");class HY{constructor(t){Me(this,"_restoreXHRPatch",void 0),Me(this,"_restoreFetchPatch",void 0),Me(this,"_startCapturing",()=>{var n,r,i,o;Be(this._restoreXHRPatch)&&((n=ht.__PosthogExtensions__)===null||n===void 0||(r=n.tracingHeadersPatchFns)===null||r===void 0||r._patchXHR(this.instance.sessionManager)),Be(this._restoreFetchPatch)&&((i=ht.__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=ht.__PosthogExtensions__)!==null&&n!==void 0&&n.tracingHeadersPatchFns&&t(),(r=ht.__PosthogExtensions__)===null||r===void 0||(i=r.loadExternalDependency)===null||i===void 0||i.call(r,this.instance,"tracing-headers",o=>{if(o)return jY.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 Wa=kr("[Web Vitals]"),ZM=9e5;let GY=class{constructor(t){var n;Me(this,"_enabledServerSide",!1),Me(this,"_initialized",!1),Me(this,"buffer",{url:void 0,metrics:[],firstMetricTimestamp:void 0}),Me(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})}),Me(this,"_addToBuffer",r=>{var i,o=(i=this.instance.sessionManager)===null||i===void 0?void 0:i.checkAndGetSessionAndWindowId(!0);if(Be(o))Wa.error("Could not read session ID. Dropping metrics!");else{this.buffer=this.buffer||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var s=this._currentURL();Be(s)||(Wt(r==null?void 0:r.name)||Wt(r==null?void 0:r.value)?Wa.error("Invalid metric received",r):this._maxAllowedValue&&r.value>=this._maxAllowedValue?Wa.error("Ignoring metric with value >= "+this._maxAllowedValue,r):(this.buffer.url!==s&&(this._flushToCapture(),this._delayedFlushTimer=setTimeout(this._flushToCapture,this.flushToCaptureTimeoutMs)),Be(this.buffer.url)&&(this.buffer.url=s),this.buffer.firstMetricTimestamp=Be(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:s,$session_id:o.sessionId,$window_id:o.windowId,timestamp:Date.now()})),this.buffer.metrics.length===this.allowedMetrics.length&&this._flushToCapture()))}}),Me(this,"_startCapturing",()=>{var r,i,o,s,u=ht.__PosthogExtensions__;Be(u)||Be(u.postHogWebVitalsCallbacks)||({onLCP:r,onCLS:i,onFCP:o,onINP:s}=u.postHogWebVitalsCallbacks),r&&i&&o&&s?(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&&s(this._addToBuffer.bind(this)),this._initialized=!0):Wa.error("web vitals callbacks not loaded - not starting")}),this.instance=t,this._enabledServerSide=!((n=this.instance.persistence)===null||n===void 0||!n.props[HT]),this.startIfEnabled()}get allowedMetrics(){var t,n,r=kn(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 Be(r)?((n=this.instance.persistence)===null||n===void 0?void 0:n.props[VT])||["CLS","FCP","INP","LCP"]:r}get flushToCaptureTimeoutMs(){return(kn(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get _maxAllowedValue(){var t=kn(this.instance.config.capture_performance)&&$r(this.instance.config.capture_performance.__web_vitals_max_value)?this.instance.config.capture_performance.__web_vitals_max_value:ZM;return 0<t&&t<=6e4?ZM:t}get isEnabled(){var t=Vr==null?void 0:Vr.protocol;if(t!=="http:"&&t!=="https:")return Wa.info("Web Vitals are disabled on non-http/https protocols"),!1;var n=kn(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals:void 0;return Ha(n)?n:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(Wa.info("enabled, starting..."),this.loadScript(this._startCapturing))}onRemoteConfig(t){var n=kn(t.capturePerformance)&&!!t.capturePerformance.web_vitals,r=kn(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this.instance.persistence&&(this.instance.persistence.register({[HT]:n}),this.instance.persistence.register({[VT]:r})),this._enabledServerSide=n,this.startIfEnabled()}loadScript(t){var n,r,i;(n=ht.__PosthogExtensions__)!==null&&n!==void 0&&n.postHogWebVitalsCallbacks&&t(),(r=ht.__PosthogExtensions__)===null||r===void 0||(i=r.loadExternalDependency)===null||i===void 0||i.call(r,this.instance,"web-vitals",o=>{o?Wa.error("failed to load script",o):t()})}_currentURL(){var t=ue?ue.location.href:void 0;return t||Wa.error("Could not determine current URL"),t}};var VY=kr("[Heatmaps]");function YM(e){return kn(e)&&"clientX"in e&&"clientY"in e&&$r(e.clientX)&&$r(e.clientY)}class ZY{constructor(t){var n;Me(this,"rageclicks",new gM),Me(this,"_enabledServerSide",!1),Me(this,"_initialized",!1),Me(this,"_flushInterval",null),this.instance=t,this._enabledServerSide=!((n=this.instance.persistence)===null||n===void 0||!n.props[O1])}get flushIntervalMilliseconds(){var t=5e3;return kn(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 Be(this.instance.config.capture_heatmaps)?Be(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;VY.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({[O1]: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(){ue&&Ge&&($n(ue,"beforeunload",this.flush.bind(this)),$n(Ge,"click",t=>this._onClick(t||(ue==null?void 0:ue.event)),{capture:!0}),$n(Ge,"mousemove",t=>this._onMouseMove(t||(ue==null?void 0:ue.event)),{capture:!0}),this.deadClicksCapture=new bM(this.instance,aY,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(),s=function(u,c,d){for(var p=u;p&&lg(p)&&!Va(p,"body");){if(p===d)return!1;if(kt(c,ue==null?void 0:ue.getComputedStyle(p).position))return!0;p=lM(p)}return!1}(sM(t),["fixed","sticky"],o);return{x:t.clientX+(s?0:i),y:t.clientY+(s?0:r),target_fixed:s,type:n}}_onClick(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"click";if(!nM(t.target)&&YM(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){!nM(t.target)&&YM(t)&&(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout(()=>{this._capture(this._getProperties(t,"mousemove"))},500))}_capture(t){if(ue){var n=ue.location.href;this.buffer=this.buffer||{},this.buffer[n]||(this.buffer[n]=[]),this.buffer[n].push(t)}}flush(){this.buffer&&!cu(this.buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class YY{constructor(t){this._instance=t}doPageView(t,n){var r,i=this._previousPageViewProperties(t,n);return this._currentPageview={pathname:(r=ue==null?void 0:ue.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:s,lastScrollY:u,maxScrollY:c,maxContentHeight:d,lastContentY:p,maxContentY:h}=o;if(!(Be(s)||Be(u)||Be(c)||Be(d)||Be(p)||Be(h))){s=Math.ceil(s),u=Math.ceil(u),c=Math.ceil(c),d=Math.ceil(d),p=Math.ceil(p),h=Math.ceil(h);var m=s<=1?1:wi(u/s,0,1),v=s<=1?1:wi(c/s,0,1),_=d<=1?1:wi(p/d,0,1),x=d<=1?1:wi(h/d,0,1);i=jn(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 WY{constructor(t){this.instance=t}sendExceptionEvent(t){this.instance.capture("$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent"})}}var Ci="Mobile",xg="iOS",mo="Android",Bf="Tablet",WM=mo+" "+Bf,KM="iPad",QM="Apple",XM=QM+" Watch",Ff="Safari",mu="BlackBerry",JM="Samsung",e3=JM+"Browser",t3=JM+" Internet",Gs="Chrome",KY=Gs+" OS",n3=Gs+" "+xg,fS="Internet Explorer",r3=fS+" "+Ci,dS="Opera",QY=dS+" Mini",hS="Edge",i3="Microsoft "+hS,vu="Firefox",o3=vu+" "+xg,Uf="Nintendo",zf="PlayStation",yu="Xbox",a3=mo+" "+Ci,s3=Ci+" "+Ff,qf="Windows",pS=qf+" Phone",l3="Nokia",gS="Ouya",u3="Generic",XY=u3+" "+Ci.toLowerCase(),c3=u3+" "+Bf.toLowerCase(),mS="Konqueror",Lr="(\\d+(\\.\\d+)?)",vS=new RegExp("Version/"+Lr),JY=new RegExp(yu,"i"),eW=new RegExp(zf+" \\w+","i"),tW=new RegExp(Uf+" \\w+","i"),yS=new RegExp(mu+"|PlayBook|BB10","i"),nW={"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"},_S,rW=(e,t)=>t&&kt(t,QM)||function(n){return kt(n,Ff)&&!kt(n,Gs)&&!kt(n,mo)}(e),f3=function(e,t){return t=t||"",kt(e," OPR/")&&kt(e,"Mini")?QY:kt(e," OPR/")?dS:yS.test(e)?mu:kt(e,"IE"+Ci)||kt(e,"WPDesktop")?r3:kt(e,e3)?t3:kt(e,hS)||kt(e,"Edg/")?i3:kt(e,"FBIOS")?"Facebook "+Ci:kt(e,"UCWEB")||kt(e,"UCBrowser")?"UC Browser":kt(e,"CriOS")?n3:kt(e,"CrMo")||kt(e,Gs)?Gs:kt(e,mo)&&kt(e,Ff)?a3:kt(e,"FxiOS")?o3:kt(e.toLowerCase(),mS.toLowerCase())?mS:rW(e,t)?kt(e,Ci)?s3:Ff:kt(e,vu)?vu:kt(e,"MSIE")||kt(e,"Trident/")?fS:kt(e,"Gecko")?vu:""},iW={[r3]:[new RegExp("rv:"+Lr)],[i3]:[new RegExp(hS+"?\\/"+Lr)],[Gs]:[new RegExp("("+Gs+"|CrMo)\\/"+Lr)],[n3]:[new RegExp("CriOS\\/"+Lr)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Lr)],[Ff]:[vS],[s3]:[vS],[dS]:[new RegExp("(Opera|OPR)\\/"+Lr)],[vu]:[new RegExp(vu+"\\/"+Lr)],[o3]:[new RegExp("FxiOS\\/"+Lr)],[mS]:[new RegExp("Konqueror[:/]?"+Lr,"i")],[mu]:[new RegExp(mu+" "+Lr),vS],[a3]:[new RegExp("android\\s"+Lr,"i")],[t3]:[new RegExp(e3+"\\/"+Lr)],[fS]:[new RegExp("(rv:|MSIE )"+Lr)],Mozilla:[new RegExp("rv:"+Lr)]},d3=[[new RegExp(yu+"; "+yu+" (.*?)[);]","i"),e=>[yu,e&&e[1]||""]],[new RegExp(Uf,"i"),[Uf,""]],[new RegExp(zf,"i"),[zf,""]],[yS,[mu,""]],[new RegExp(qf,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[pS,""];if(new RegExp(Ci).test(t)&&!/IEMobile\b/.test(t))return[qf+" "+Ci,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var r=n[1],i=nW[r]||"";return/arm/i.test(t)&&(i="RT"),[qf,i]}return[qf,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){var t=[e[3],e[4],e[5]||"0"];return[xg,t.join(".")]}return[xg,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=Be(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+mo+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+mo+")","i"),e=>{if(e&&e[2]){var t=[e[2],e[3],e[4]||"0"];return[mo,t.join(".")]}return[mo,""]}],[/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/,[KY,""]],[/Linux|debian/i,["Linux",""]]],h3=function(e){return tW.test(e)?Uf:eW.test(e)?zf:JY.test(e)?yu:new RegExp(gS,"i").test(e)?gS:new RegExp("("+pS+"|WPDesktop)","i").test(e)?pS:/iPad/.test(e)?KM:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?XM:yS.test(e)?mu:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(l3,"i").test(e)?l3:/(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(Ci).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)?mo:WM:mo:new RegExp("(pda|"+Ci+")","i").test(e)?XY:new RegExp(Bf,"i").test(e)&&!new RegExp(Bf+" pc","i").test(e)?c3:""},Cg="https?://(.*)",Eg=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","irclid","_kx"],oW=tg(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],Eg),bS="<masked>",bn={campaignParams:function(){var{customTrackedParams:e,maskPersonalDataProperties:t,customPersonalDataProperties:n}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!Ge)return{};var r=t?tg([],Eg,n||[]):[];return this._campaignParamsFromUrl(H1(Ge.URL,r,bS),e)},_campaignParamsFromUrl:function(e,t){var n=oW.concat(t||[]),r={};return rn(n,function(i){var o=fg(e,i);r[i]=o||null}),r},_searchEngine:function(e){return e?e.search(Cg+"google.([^/?]*)")===0?"google":e.search(Cg+"bing.com")===0?"bing":e.search(Cg+"yahoo.com")===0?"yahoo":e.search(Cg+"duckduckgo.com")===0?"duckduckgo":null:null},_searchInfoFromReferrer:function(e){var t=bn._searchEngine(e),n=t!="yahoo"?"q":"p",r={};if(!ja(t)){r.$search_engine=t;var i=Ge?fg(Ge.referrer,n):"";i.length&&(r.ph_keyword=i)}return r},searchInfo:function(){var e=Ge==null?void 0:Ge.referrer;return e?this._searchInfoFromReferrer(e):{}},browser:f3,browserVersion:function(e,t){var n=f3(e,t),r=iW[n];if(Be(r))return null;for(var i=0;i<r.length;i++){var o=r[i],s=e.match(o);if(s)return parseFloat(s[s.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<d3.length;t++){var[n,r]=d3[t],i=n.exec(e),o=i&&(Yi(r)?r(i,e):r);if(o)return o}return["",""]},device:h3,deviceType:function(e){var t=h3(e);return t===KM||t===WM||t==="Kobo"||t==="Kindle Fire"||t===c3?Bf:t===Uf||t===yu||t===zf||t===gS?"Console":t===XM?"Wearable":t?Ci:"Desktop"},referrer:function(){return(Ge==null?void 0:Ge.referrer)||"$direct"},referringDomain:function(){var e;return Ge!=null&&Ge.referrer&&((e=hu(Ge.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?tg([],Eg,t||[]):[],r=Vr==null?void 0:Vr.href.substring(0,1e3);return{r:this.referrer().substring(0,1e3),u:r?H1(r,n,bS):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=hu(n))===null||t===void 0?void 0:t.host};if(r){i.$current_url=r;var o=hu(r);i.$host=o==null?void 0:o.host,i.$pathname=o==null?void 0:o.pathname;var s=this._campaignParamsFromUrl(r);jn(i,s)}if(n){var u=this._searchInfoFromReferrer(n);jn(i,u)}return i},initialPersonPropsFromInfo:function(e){var t=this.personPropsFromInfo(e),n={};return rn(t,function(r,i){n["$initial_".concat(I1(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(!zn)return{};var n=e?tg([],Eg,t||[]):[],[r,i]=bn.os(zn);return jn(If({$os:r,$os_version:i,$browser:bn.browser(zn,navigator.vendor),$device:bn.device(zn),$device_type:bn.deviceType(zn),$timezone:bn.timezone(),$timezone_offset:bn.timezoneOffset()}),{$current_url:H1(Vr==null?void 0:Vr.href,n,bS),$host:Vr==null?void 0:Vr.host,$pathname:Vr==null?void 0:Vr.pathname,$raw_user_agent:zn.length>1e3?zn.substring(0,997)+"...":zn,$browser_version:bn.browserVersion(zn,navigator.vendor),$browser_language:bn.browserLanguage(),$browser_language_prefix:bn.browserLanguagePrefix(),$screen_height:ue==null?void 0:ue.screen.height,$screen_width:ue==null?void 0:ue.screen.width,$viewport_height:ue==null?void 0:ue.innerHeight,$viewport_width:ue==null?void 0:ue.innerWidth,$lib:"web",$lib_version:Vo.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(!zn)return{};var[e,t]=bn.os(zn);return jn(If({$os:e,$os_version:t,$browser:bn.browser(zn,navigator.vendor)}),{$browser_version:bn.browserVersion(zn,navigator.vendor)})}},vo=kr("[FeatureFlags]"),SS="$active_feature_flags",_u="$override_feature_flags",p3="$feature_flag_payloads",jf="$override_feature_flag_payloads",g3="$feature_flag_request_id",m3=e=>{var t={};for(var[n,r]of ng(e||{}))r&&(t[n]=r);return t},aW=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]}))):vo.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"})(_S||(_S={}));class sW{constructor(t){Me(this,"_override_warning",!1),Me(this,"_hasLoadedFlags",!1),Me(this,"_requestInFlight",!1),Me(this,"_reloadingDisabled",!1),Me(this,"_additionalReloadRequested",!1),Me(this,"_decideCalled",!1),Me(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($1),n=this.instance.get_property(_u),r=this.instance.get_property(jf);if(!r&&!n)return t||{};var i=jn({},t||{}),o=[...new Set([...Object.keys(r||{}),...Object.keys(n||{})])];for(var s of o){var u,c,d=i[s],p=n==null?void 0:n[s],h=Be(p)?(u=d==null?void 0:d.enabled)!==null&&u!==void 0&&u:!!p,m=Be(p)?d.variant:typeof p=="string"?p:void 0,v=r==null?void 0:r[s],_=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[s]=_}return this._override_warning||(vo.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:r,finalDetails:i}),this._override_warning=!0),i}getFlagVariants(){var t=this.instance.get_property(fu),n=this.instance.get_property(_u);if(!n)return t||{};for(var r=jn({},t),i=Object.keys(n),o=0;o<i.length;o++)r[i[o]]=n[i[o]];return this._override_warning||(vo.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:n,finalFlags:r}),this._override_warning=!0),r}getFlagPayloads(){var t=this.instance.get_property(p3),n=this.instance.get_property(jf);if(!n)return t||{};for(var r=jn({},t||{}),i=Object.keys(n),o=0;o<i.length;o++)r[i[o]]=n[i[o]];return this._override_warning||(vo.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(Mf)||{}),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:Zi.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:o=>{var s,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&&(s=o.json.quotaLimited)!==null&&s!==void 0&&s.includes(_S.FeatureFlags)?vo.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(g3)||void 0,s=this.instance.get_property(ag)||{};if((n.send_event||!("send_event"in n))&&(!(t in s)||!s[t].includes(i))){var u,c,d,p,h,m,v,_,x,w,b;En(s[t])?s[t].push(i):s[t]=[i],(u=this.instance.persistence)===null||u===void 0||u.register({[ag]:s});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};Be(C==null||(m=C.metadata)===null||m===void 0?void 0:m.version)||(E.$feature_flag_version=C.metadata.version);var k,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&&(w=C.metadata)!==null&&w!==void 0&&w.id&&(E.$feature_flag_id=C.metadata.id),Be(C==null?void 0:C.original_variant)&&Be(C==null?void 0:C.original_enabled)||(E.$feature_flag_original_response=Be(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||(k=C.metadata)===null||k===void 0?void 0:k.original_payload),this.instance.capture("$feature_flag_called",E)}return r}vo.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:Zi.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:i=>{var o,s=(o=i.json)===null||o===void 0?void 0:o.featureFlagPayloads;n((s==null?void 0:s[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);vo.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(s,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=aW(s),m=h.flags,v=h.featureFlags,_=h.featureFlagPayloads;if(v){var x=s.requestId;if(En(v)){vo.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var w={};if(v)for(var b=0;b<v.length;b++)w[v[b]]=!0;u&&u.register({[SS]:v,[fu]:w})}else{var C=v,E=_,k=m;s.errorsWhileComputingFlags&&(C=pe(pe({},c),C),E=pe(pe({},d),E),k=pe(pe({},p),k)),u&&u.register(pe({[SS]:Object.keys(m3(C)),[fu]:C||{},[p3]:E||{},[$1]:k||{}},x?{[g3]:x}:{}))}}})(t,this.instance.persistence,r,i,o),this._fireFeatureFlagsCallbacks(n)}}override(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1];vo.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:n})}overrideFeatureFlags(t){if(!this.instance.__loaded||!this.instance.persistence)return vo.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(t===!1)return this.instance.persistence.unregister(_u),this.instance.persistence.unregister(jf),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(_u);else if(r.flags)if(En(r.flags)){for(var i={},o=0;o<r.flags.length;o++)i[r.flags[o]]=!0;this.instance.persistence.register({[_u]:i})}else this.instance.persistence.register({[_u]:r.flags})}return"payloads"in r&&(r.payloads===!1?this.instance.persistence.unregister(jf):r.payloads&&this.instance.persistence.register({[jf]: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(ig)||[]).find(c=>c.flagKey===t),o={["$feature_enrollment/".concat(t)]:n},s={$feature_flag:t,$feature_enrollment:n,$set:o};i&&(s.$early_access_feature_name=i.name),this.instance.capture("$feature_enrollment_update",s),this.setPersonPropertiesForFlags(o,!1);var u=pe(pe({},this.getFlagVariants()),{},{[t]:n});(r=this.instance.persistence)===null||r===void 0||r.register({[SS]:Object.keys(m3(u)),[fu]: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(ig),o=r?"&".concat(r.map(s=>"stage=".concat(s)).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:s=>{var u;if(s.json){var c=s.json.earlyAccessFeatures;return(u=this.instance.persistence)===null||u===void 0||u.register({[ig]: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(Mf)||{};this.instance.register({[Mf]:pe(pe({},r),t)}),n&&this.instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this.instance.unregister(Mf)}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 lW=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class wS{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&&Xe.info("Persistence loaded",t.persistence,pe({},this.props)),this.update_config(t,t),this.save()}buildStorage(t){lW.indexOf(t.persistence.toLowerCase())===-1&&(Xe.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"&&pg.is_supported()?pg:n==="sessionstorage"&&fr.is_supported()?fr:n==="memory"?iY:n==="cookie"?Yo:pg.is_supported()?pg:Yo}properties(){var t={};return rn(this.props,function(n,r){if(r===fu&&kn(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,(ja(s=PZ)?c:TT&&s.indexOf===TT?s.indexOf(u)!=-1:(rn(s,function(d){if(c||(c=d===u))return eg}),c))||(t[r]=n);var s,u,c}),t}load(){if(!this.disabled){var t=this.storage.parse(this.name);t&&(this.props=jn({},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(kn(t)){Be(n)&&(n="None"),this.expire_days=Be(r)?this.default_expiry:r;var i=!1;if(rn(t,(o,s)=>{this.props.hasOwnProperty(s)&&this.props[s]!==n||(this.props[s]=o,i=!0)}),i)return this.save(),!0}return!1}register(t,n){if(kn(t)){this.expire_days=Be(n)?this.default_expiry:n;var r=!1;if(rn(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});cu(If(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[B1]||this.props[F1]||this.register_once({[U1]:bn.personInfo({maskPersonalDataProperties:this.config.mask_personal_data_properties,customPersonalDataProperties:this.config.custom_personal_data_properties})},void 0)}get_referrer_info(){return If({$referrer:this.props.$referrer,$referring_domain:this.props.$referring_domain})}get_initial_props(){var t={};rn([F1,B1],i=>{var o=this.props[i];o&&rn(o,function(s,u){t["$initial_"+I1(u)]=s})});var n=this.props[U1];if(n){var r=bn.initialPersonPropsFromInfo(n);jn(t,r)}return t}safe_merge(t){return rn(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[Of]||{};r[t]=n,this.props[Of]=r,this.save()}remove_event_timer(t){var n=(this.props[Of]||{})[t];return Be(n)||(delete this.props[Of][t],this.save()),n}get_property(t){return this.props[t]}set_property(t,n){this.props[t]=n,this.save()}}var v3,An,y3,Vs,_3,b3,xS,S3,w3,x3,C3,E3,k3,CS={},A3=[],uW=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ES=Array.isArray;function Ka(e,t){for(var n in t)e[n]=t[n];return e}function I3(e){var t=e.parentNode;t&&t.removeChild(e)}function kS(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??++y3,__i:-1,__u:0};return i==null&&An.vnode!=null&&An.vnode(o),o}function AS(e){return e.children}function kg(e,t){this.props=e,this.context=t}function bu(e,t){if(t==null)return e.__?bu(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"?bu(e):null}function R3(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 R3(e)}}function IS(e){(!e.__d&&(e.__d=!0)&&Vs.push(e)&&!Ag.__r++||_3!==An.debounceRendering)&&((_3=An.debounceRendering)||b3)(Ag)}function Ag(){var e,t,n,r,i,o,s,u,c;for(Vs.sort(xS);e=Vs.shift();)e.__d&&(t=Vs.length,r=void 0,o=(i=(n=e).__v).__e,u=[],c=[],(s=n.__P)&&((r=Ka({},i)).__v=i.__v+1,An.vnode&&An.vnode(r),L3(s,r,i,n.__n,s.ownerSVGElement!==void 0,32&i.__u?[o]:null,u,o??bu(i),!!(32&i.__u),c),r.__.__k[r.__i]=r,dW(u,r,c),r.__e!=o&&R3(r)),Vs.length>t&&Vs.sort(xS));Ag.__r=0}function O3(e,t,n,r,i,o,s,u,c,d,p){var h,m,v,_,x,w=r&&r.__k||A3,b=t.length;for(n.__d=c,cW(n,t,w),c=n.__d,h=0;h<b;h++)(v=n.__k[h])!=null&&typeof v!="boolean"&&typeof v!="function"&&(m=v.__i===-1?CS:w[v.__i]||CS,v.__i=h,L3(e,v,m,i,o,s,u,c,d,p),_=v.__e,v.ref&&m.ref!=v.ref&&(m.ref&&RS(m.ref,null,v),p.push(v.ref,v.__c||_,v)),x==null&&_!=null&&(x=_),65536&v.__u||m.__k===v.__k?c=T3(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 cW(e,t,n){var r,i,o,s,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?kS(null,i,null,null,i):ES(i)?kS(AS,{children:i},null,null,null):i.constructor===void 0&&i.__b>0?kS(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i)!=null?(i.__=e,i.__b=e.__b+1,u=fW(i,n,s=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!==s&&(u===s+1?h++:u>s?p>c-s?h+=u-s:h--:h=u<s&&u==s-1?u-s:0,u!==r+h&&(i.__u|=65536))):(o=n[r])&&o.key==null&&o.__e&&(o.__e==e.__d&&(e.__d=bu(o)),OS(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=bu(o)),OS(o,o))}function T3(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=T3(r[i],t,n));return t}return e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function fW(e,t,n,r){var i=e.key,o=e.type,s=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(;s>=0||u<t.length;){if(s>=0){if((c=t[s])&&(131072&c.__u)==0&&i==c.key&&o===c.type)return s;s--}if(u<t.length){if((c=t[u])&&(131072&c.__u)==0&&i==c.key&&o===c.type)return u;u++}}return-1}function M3(e,t,n){t[0]==="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||uW.test(t)?n:n+"px"}function Ig(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||M3(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||M3(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?$3:D3,o)):e.removeEventListener(t,o?$3:D3,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 D3(e){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(An.event?An.event(e):e)}function $3(e){return this.l[e.type+!0](An.event?An.event(e):e)}function L3(e,t,n,r,i,o,s,u,c,d){var p,h,m,v,_,x,w,b,C,E,k,O,T,L,B,z=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[u=t.__e=n.__e]),(p=An.__b)&&p(t);e:if(typeof z=="function")try{if(b=t.props,C=(p=z.contextType)&&r[p.__c],E=p?C?C.props.value:p.__:r,n.__c?w=(h=t.__c=n.__c).__=h.__E:("prototype"in z&&z.prototype.render?t.__c=h=new z(b,E):(t.__c=h=new kg(b,E),h.constructor=z,h.render=pW),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),z.getDerivedStateFromProps!=null&&(h.__s==h.state&&(h.__s=Ka({},h.__s)),Ka(h.__s,z.getDerivedStateFromProps(b,h.__s))),v=h.props,_=h.state,h.__v=t,m)z.getDerivedStateFromProps==null&&h.componentWillMount!=null&&h.componentWillMount(),h.componentDidMount!=null&&h.__h.push(h.componentDidMount);else{if(z.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(N){N&&(N.__=t)}),k=0;k<h._sb.length;k++)h.__h.push(h._sb[k]);h._sb=[],h.__h.length&&s.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=An.__r,T=0,"prototype"in z&&z.prototype.render){for(h.state=h.__s,h.__d=!1,O&&O(t),p=h.render(h.props,h.state,h.context),L=0;L<h._sb.length;L++)h.__h.push(h._sb[L]);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=Ka(Ka({},r),h.getChildContext())),m||h.getSnapshotBeforeUpdate==null||(x=h.getSnapshotBeforeUpdate(v,_)),O3(e,ES(B=p!=null&&p.type===AS&&p.key==null?p.props.children:p)?B:[B],t,n,r,i,o,s,u,c,d),h.base=t.__e,t.__u&=-161,h.__h.length&&s.push(h),w&&(h.__E=h.__=null)}catch(N){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),An.__e(N,t,n)}else o==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=hW(n.__e,t,n,r,i,o,s,c,d);(p=An.diffed)&&p(t)}function dW(e,t,n){t.__d=void 0;for(var r=0;r<n.length;r++)RS(n[r],n[++r],n[++r]);An.__c&&An.__c(t,e),e.some(function(i){try{e=i.__h,i.__h=[],e.some(function(o){o.call(i)})}catch(o){An.__e(o,i.__v)}})}function hW(e,t,n,r,i,o,s,u,c){var d,p,h,m,v,_,x,w=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)w===b||u&&e.data===b||(e.data=b);else{if(o=o&&v3.call(e.childNodes),w=n.props||CS,!u&&o!=null)for(w={},d=0;d<e.attributes.length;d++)w[(v=e.attributes[d]).name]=v.value;for(d in w)v=w[d],d=="children"||(d=="dangerouslySetInnerHTML"?h=v:d==="key"||d in b||Ig(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"||w[d]===v||Ig(e,d,v,w[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=""),O3(e,ES(m)?m:[m],t,n,r,i&&C!=="foreignObject",o,s,o?o[0]:n.__k&&bu(n,0),u,c),o!=null)for(d=o.length;d--;)o[d]!=null&&I3(o[d]);u||(d="value",_!==void 0&&(_!==e[d]||C==="progress"&&!_||C==="option"&&_!==w[d])&&Ig(e,d,_,w[d],!1),d="checked",x!==void 0&&x!==e[d]&&Ig(e,d,x,w[d],!1))}return e}function RS(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(r){An.__e(r,n)}}function OS(e,t,n){var r,i;if(An.unmount&&An.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||RS(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(o){An.__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]&&OS(r[i],t,n||typeof e.type!="function");n||e.__e==null||I3(e.__e),e.__=e.__e=e.__d=void 0}function pW(e,t,n){return this.constructor(e,n)}v3=A3.slice,An={__e:function(e,t,n,r){for(var i,o,s;t=t.__;)if((i=t.__c)&&!i.__)try{if((o=i.constructor)&&o.getDerivedStateFromError!=null&&(i.setState(o.getDerivedStateFromError(e)),s=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),s=i.__d),s)return i.__E=i}catch(u){e=u}throw e}},y3=0,kg.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=Ka({},this.state),typeof e=="function"&&(e=e(Ka({},n),this.props)),e&&Ka(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),IS(this))},kg.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),IS(this))},kg.prototype.render=AS,Vs=[],b3=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,xS=function(e,t){return e.__v.__b-t.__v.__b},Ag.__r=0,S3=0,function(e){e.Button="button",e.Tab="tab",e.Selector="selector"}(w3||(w3={})),function(e){e.Popover="popover",e.API="api",e.Widget="widget"}(x3||(x3={})),function(e){e.Open="open",e.MultipleChoice="multiple_choice",e.SingleChoice="single_choice",e.Rating="rating",e.Link="link"}(C3||(C3={})),function(e){e.NextQuestion="next_question",e.End="end",e.ResponseBased="response_based",e.SpecificQuestion="specific_question"}(E3||(E3={})),function(e){e.Once="once",e.Recurring="recurring",e.Always="always"}(k3||(k3={})),function(e,t){var n={__c:t="__cC"+S3++,__: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(s){this.props.value!==s.value&&i.some(function(u){u.__e=!0,IS(u)})},this.sub=function(s){i.push(s);var u=s.componentWillUnmount;s.componentWillUnmount=function(){i.splice(i.indexOf(s),1),u&&u.call(s)}}),r.children}};n.Provider.__=n.Consumer.contextType=n}({isPreviewMode:!1,previewPageIndex:0,onPopupSurveyDismissed:()=>{},isPopup:!0,onPreviewSubmit:()=>{}});var Su=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 N3{constructor(){Me(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){Me(this,"_debugEventEmitter",new N3),Me(this,"checkStep",(n,r)=>this.checkStepEvent(n,r)&&this.checkStepUrl(n,r)&&this.checkStepElement(n,r)),Me(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(!Be((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(!Be((n=this.instance)===null||n===void 0?void 0:n._addCaptureHook)&&(t.forEach(s=>{var u,c;(u=this.actionRegistry)===null||u===void 0||u.add(s),(c=s.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(s=>{var u;(u=s.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!!ue&&Su(t,n);case"exact":return n===t;case"contains":var i=Zs.escapeStringRegexp(n).replace(/_/g,".").replace(/%/g,".*");return Su(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 Hf{constructor(t){this.instance=t,this.eventToSurveys=new Map,this.actionToSurveys=new Map}register(t){var n;Be((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,s,u;return((i=r.conditions)===null||i===void 0?void 0:i.actions)&&((o=r.conditions)===null||o===void 0||(s=o.actions)===null||s===void 0||(u=s.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,s,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&&(s=o.actions)!==null&&s!==void 0&&s.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,s,u;return((i=r.conditions)===null||i===void 0?void 0:i.events)&&((o=r.conditions)===null||o===void 0||(s=o.events)===null||s===void 0||(u=s.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,s;(i=r.conditions)===null||i===void 0||(o=i.events)===null||o===void 0||(s=o.values)===null||s===void 0||s.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[og])||[];if(Hf.SURVEY_SHOWN_EVENT_NAME==t&&n&&o.length>0){var s,u=n==null||(s=n.properties)===null||s===void 0?void 0:s.$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[og])||[];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({[og]:[...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[og];return r||[]}getEventToSurveys(){return this.eventToSurveys}_getActionMatcher(){return this.actionMatcher}}Me(Hf,"SURVEY_SHOWN_EVENT_NAME","survey shown");var dr=kr("[Surveys]"),P3={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=>Su(t,n)),not_regex:(e,t)=>e.every(n=>!Su(t,n)),exact:(e,t)=>e.some(n=>t===n),is_not:(e,t)=>e.every(n=>t!==n)};function B3(e){return e??"icontains"}class gW{constructor(t){Me(this,"_isFetchingSurveys",!1),Me(this,"_isInitializingSurveys",!1),Me(this,"_surveyCallbacks",[]),this.instance=t,this._surveyEventReceiver=null}onRemoteConfig(t){var n=t.surveys;if(Wt(n))return dr.warn("Decide not loaded yet. Not loading surveys.");var r=En(n);this._hasSurveys=r?n.length>0:n,dr.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)dr.info("Already initializing surveys, skipping...");else if(this.instance.config.disable_surveys)dr.info("Disabled. Not loading surveys.");else{var t=ht==null?void 0:ht.__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 Hf(this.instance),dr.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 dr.error("Could not load surveys script",o),void(this._isInitializingSurveys=!1);this._surveyManager=t.generateSurveys(this.instance),this._isInitializingSurveys=!1,this._surveyEventReceiver=new Hf(this.instance),dr.info("Surveys loaded successfully"),this._notifySurveyCallbacks({isLoaded:!0})});else{var i="PostHog loadExternalDependency extension not found. Cannot load remote config.";dr.error(i),this._isInitializingSurveys=!1,this._notifySurveyCallbacks({isLoaded:!1,error:i})}}}catch(o){throw dr.error("Error initializing surveys",o),this._isInitializingSurveys=!1,this._notifySurveyCallbacks({isLoaded:!1,error:"Error initializing surveys"}),o}}else dr.info("No surveys to load.");else dr.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 dr.info("Disabled. Not loading surveys."),t([]);var r=this.instance.get_property(L1);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 s=i.statusCode;if(s!==200||!i.json){var u="Surveys API could not be loaded, status: ".concat(s);return dr.error(u),t([],{isLoaded:!1,error:u})}var c,d=i.json.surveys||[],p=d.filter(h=>{var m,v,_,x,w,b,C,E,k,O,T,L;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||(w=x.events)===null||w===void 0||(b=w.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||(k=E.actions)===null||k===void 0?void 0:k.values)&&((O=h.conditions)===null||O===void 0||(T=O.actions)===null||T===void 0||(L=T.values)===null||L===void 0?void 0:L.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({[L1]: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){dr.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,w;if((_=v.conditions)===null||_===void 0||!_.url)return!0;var b=ue==null||(x=ue.location)===null||x===void 0?void 0:x.href;if(!b)return!1;var C=[v.conditions.url];return P3[B3((w=v.conditions)===null||w===void 0?void 0:w.urlMatchType)](C,b)}(c),h=(d=c.conditions)===null||d===void 0||!d.selector||(Ge==null?void 0:Ge.querySelector(c.conditions.selector)),m=function(v){var _,x,w;if((_=v.conditions)===null||_===void 0||!_.deviceTypes||((x=v.conditions)===null||x===void 0?void 0:x.deviceTypes.length)===0)return!0;if(!zn)return!1;var b=bn.deviceType(zn);return P3[B3((w=v.conditions)===null||w===void 0?void 0:w.deviceTypesMatchType)](v.conditions.deviceTypes,b)}(c);return p&&h&&m}),s=(i=this._surveyEventReceiver)===null||i===void 0?void 0:i.getSurveys(),u=o.filter(c=>{var d,p,h,m,v,_,x,w,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),k=((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||(w=x.actions)===null||w===void 0||(b=w.values)===null||b===void 0?void 0:b.length)!==null&&_!==void 0?_:0)>0,T=!k&&!O||(s==null?void 0:s.includes(c.id)),L=this._canActivateRepeatedly(c)||this.isSurveyFeatureFlagEnabled(c.internal_targeting_flag_key),B=this.checkFlags(c);return C&&E&&L&&T&&B});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 Wt((n=ht.__PosthogExtensions__)===null||n===void 0?void 0:n.canActivateRepeatedly)?(dr.warn("init was not called"),!1):ht.__PosthogExtensions__.canActivateRepeatedly(t)}canRenderSurvey(t){if(Wt(this._surveyManager))return dr.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){Wt(this._surveyManager)?dr.warn("init was not called"):this.getSurveys(r=>{var i=r.filter(o=>o.id===t)[0];this._surveyManager.renderSurvey(i,Ge==null?void 0:Ge.querySelector(n))})}}var F3=kr("[RateLimiter]");class mW{constructor(t){var n,r;Me(this,"serverLimits",{}),Me(this,"lastEventRateLimited",!1),Me(this,"checkForLimiting",i=>{var o=i.text;if(o&&o.length)try{(JSON.parse(o).quota_limited||[]).forEach(s=>{F3.info("".concat(s||"events"," is quota limited.")),this.serverLimits[s]=new Date().getTime()+6e4})}catch(s){return void F3.warn('could not rate limit - continuing. Error: "'.concat(s==null?void 0:s.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(),s=(t=(n=this.instance.persistence)===null||n===void 0?void 0:n.get_property(P1))!==null&&t!==void 0?t:{tokens:this.captureEventsBurstLimit,last:o};s.tokens+=(o-s.last)/1e3*this.captureEventsPerSecond,s.last=o,s.tokens>this.captureEventsBurstLimit&&(s.tokens=this.captureEventsBurstLimit);var u=s.tokens<1;return u||i||(s.tokens=Math.max(0,s.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(P1,s),{isRateLimited:u,remainingTokens:s.tokens}}isServerRateLimited(t){var n=this.serverLimits[t||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var Ys=kr("[RemoteConfig]");class vW{constructor(t){this.instance=t}get remoteConfig(){var t,n;return(t=ht._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=ht.__PosthogExtensions__)!==null&&n!==void 0&&n.loadExternalDependency?(r=ht.__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 yW=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 s=e.charCodeAt(i),u=null;s<128?n++:u=s>127&&s<2048?String.fromCharCode(s>>6|192,63&s|128):String.fromCharCode(s>>12|224,s>>6&63|128,63&s|128),ja(u)||(n>t&&(o+=e.substring(t,n)),o+=u,t=n=i+1)}return n>t&&(o+=e.substring(t,e.length)),o},_W=!!k1||!!E1,U3="text/plain",Rg=(e,t)=>{var[n,r]=e.split("?"),i=pe({},t);r==null||r.split("&").forEach(s=>{var[u]=s.split("=");delete i[u]});var o=VZ(i);return o=o?(r?r+"&":"")+o:r,"".concat(n,"?").concat(o)},Gf=(e,t)=>JSON.stringify(e,(n,r)=>typeof r=="bigint"?r.toString():r,t),TS=e=>{var{data:t,compression:n}=e;if(t){if(n===Zi.GZipJS){var r=BM(FM(Gf(t)),{mtime:0}),i=new Blob([r],{type:U3});return{contentType:U3,body:i,estimatedSize:i.size}}if(n===Zi.Base64){var o=function(c){var d,p,h,m,v,_="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",x=0,w=0,b="",C=[];if(!c)return c;c=yW(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[w++]=_.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}(Gf(t)),s=(c=>"data="+encodeURIComponent(typeof c=="string"?c:Gf(c)))(o);return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var u=Gf(t);return{contentType:"application/json",body:u,estimatedSize:new Blob([u]).size}}},Vf=[];E1&&Vf.push({transport:"fetch",method:e=>{var t,n,{contentType:r,body:i,estimatedSize:o}=(t=TS(e))!==null&&t!==void 0?t:{},s=new Headers;rn(e.headers,function(p,h){s.append(h,p)}),r&&s.append("Content-Type",r);var u=e.url,c=null;if(MT){var d=new MT;c={signal:d.signal,timeout:setTimeout(()=>d.abort(),e.timeout)}}E1(u,pe({method:(e==null?void 0:e.method)||"GET",headers:s,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(_){Xe.error(_)}(m=e.callback)===null||m===void 0||m.call(e,v)})).catch(p=>{var h;Xe.error(p),(h=e.callback)===null||h===void 0||h.call(e,{statusCode:0,text:p})}).finally(()=>c?clearTimeout(c.timeout):null)}}),k1&&Vf.push({transport:"XHR",method:e=>{var t,n=new k1;n.open(e.method||"GET",e.url,!0);var{contentType:r,body:i}=(t=TS(e))!==null&&t!==void 0?t:{};rn(e.headers,function(o,s){n.setRequestHeader(s,o)}),r&&n.setRequestHeader("Content-Type",r),e.timeout&&(n.timeout=e.timeout),n.withCredentials=!0,n.onreadystatechange=()=>{if(n.readyState===4){var o,s={statusCode:n.status,text:n.responseText};if(n.status===200)try{s.json=JSON.parse(n.responseText)}catch{}(o=e.callback)===null||o===void 0||o.call(e,s)}},n.send(i)}}),ri!=null&&ri.sendBeacon&&Vf.push({transport:"sendBeacon",method:e=>{var t=Rg(e.url,{beacon:"1"});try{var n,{contentType:r,body:i}=(n=TS(e))!==null&&n!==void 0?n:{},o=typeof i=="string"?new Blob([i],{type:r}):i;ri.sendBeacon(t,o)}catch{}}});var MS=3e3;class bW{constructor(t,n){Me(this,"isPaused",!0),Me(this,"queue",[]),this.flushTimeoutMs=wi((n==null?void 0:n.flush_interval_ms)||MS,250,5e3,"flush interval",MS),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 s=n[o],u=new Date().getTime();s.data&&En(s.data)&&rn(s.data,c=>{c.offset=Math.abs(c.timestamp-u),delete c.timestamp}),t.sendRequest(s)};for(var i in n)r(i)}},this.flushTimeoutMs))}clearFlushTimeout(){clearTimeout(this.flushTimeout),this.flushTimeout=void 0}formatQueue(){var t={};return rn(this.queue,n=>{var r,i=n,o=(i?i.batchKey:null)||i.url;Be(t[o])&&(t[o]=pe(pe({},i),{},{data:[]})),(r=t[o].data)===null||r===void 0||r.push(i.data)}),this.queue=[],t}}var SW=["retriesPerformedSoFar"];class wW{constructor(t){Me(this,"isPolling",!1),Me(this,"pollIntervalMs",3e3),Me(this,"queue",[]),this.instance=t,this.queue=[],this.areWeOnline=!0,!Be(ue)&&"onLine"in ue.navigator&&(this.areWeOnline=ue.navigator.onLine,$n(ue,"online",()=>{this.areWeOnline=!0,this.flush()}),$n(ue,"offline",()=>{this.areWeOnline=!1}))}retriableRequest(t){var{retriesPerformedSoFar:n}=t,r=BT(t,SW);$r(n)&&n>0&&(r.url=Rg(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(s){var u=3e3*Math.pow(2,s),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)"),Xe.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){Xe.error(n)}this.queue=[]}}class xW{constructor(t){Me(this,"_updateScrollData",()=>{var n,r,i,o;this.context||(this.context={});var s=this.scrollElement(),u=this.scrollY(),c=s?Math.max(0,s.scrollHeight-s.clientHeight):0,d=u+((s==null?void 0:s.clientHeight)||0),p=(s==null?void 0:s.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(){$n(ue,"scroll",this._updateScrollData,{capture:!0}),$n(ue,"scrollend",this._updateScrollData,{capture:!0}),$n(ue,"resize",this._updateScrollData)}scrollElement(){if(!this.instance.config.scroll_root_selector)return ue==null?void 0:ue.document.documentElement;var t=En(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=ue==null?void 0:ue.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 ue&&(ue.scrollY||ue.pageYOffset||ue.document.documentElement.scrollTop)||0}scrollX(){if(this.instance.config.scroll_root_selector){var t=this.scrollElement();return t&&t.scrollLeft||0}return ue&&(ue.scrollX||ue.pageXOffset||ue.document.documentElement.scrollLeft)||0}}var CW=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 EW{constructor(t,n,r,i){Me(this,"_onSessionIdCallback",o=>{var s=this._getStored();if(!s||s.sessionId!==o){var u={sessionId:o,props:this._sessionSourceParamGenerator(this.instance)};this._persistence.register({[N1]:u})}}),this.instance=t,this._sessionIdManager=n,this._persistence=r,this._sessionSourceParamGenerator=i||CW,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[N1]}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 rn(If(this.getSetOnceProps()),(n,r)=>{r==="$current_url"&&(r="url"),t["$session_entry_".concat(I1(r))]=n}),t}}var z3=kr("[SessionId]");class kW{constructor(t,n,r){var i;if(Me(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||Za,this._windowIdGenerator=r||Za;var o=this.config.persistence_name||this.config.token,s=this.config.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*wi(s,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=fr.parse(this._window_id_storage_key),c=fr.parse(this._primary_window_exists_storage_key);u&&!c?this._windowId=u:fr.remove(this._window_id_storage_key),fr.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){z3.error("Invalid sessionID in bootstrap",p)}this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return Be(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&&fr.is_supported()}_setWindowId(t){t!==this._windowId&&(this._windowId=t,this._canUseSessionStorage()&&fr.set(this._window_id_storage_key,t))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?fr.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({[rg]:[n,t,r]}))}_getSessionId(){if(this._sessionId&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this._sessionId,this._sessionStartTimestamp];var t=this.persistence.props[rg];return En(t)&&t.length===2&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this._setSessionId(null,null,null)}_listenToReloadWindow(){$n(ue,"beforeunload",()=>{this._canUseSessionStorage()&&fr.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,s]=this._getSessionId(),u=this._getWindowId(),c=$r(s)&&s>0&&Math.abs(r-s)>864e5,d=!1,p=!o,h=!t&&Math.abs(r-i)>this.sessionTimeoutMs;p||h||c?(o=this._sessionIdGenerator(),u=this._windowIdGenerator(),z3.info("new session ID generated",{sessionId:o,windowId:u,changeReason:{noSessionId:p,activityTimeout:h,sessionPastMaximumLength:c}}),s=r,d=!0):u||(u=this._windowIdGenerator(),d=!0);var m=i===0||!t||c?r:i,v=s===0?new Date().getTime():s;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 AW=["$set_once","$set"],Qa=kr("[SiteApps]");class IW{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=ht._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,s,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({},BT(t,AW)),{},{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:(s=(u=t.properties)===null||u===void 0?void 0:u.$elements_chain)!==null&&s!==void 0?s:"",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&&(Qa.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,Qa.info("Site app with id ".concat(t.id," ").concat(u?"loaded":"errored")),i&&r()};try{var{processEvent:s}=t.init({posthog:this.instance,callback:u=>{o(u)}});s&&(n.processEvent=s),i=!0}catch(u){Qa.error("Error while initializing PostHog app with config id ".concat(t.id),u),o(!1)}if(i&&n.loaded)try{r()}catch(u){Qa.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){Qa.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 Qa.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 s=function(d,p){var h,m;ht["__$$ph_site_app_".concat(d)]=o.instance,(h=ht.__PosthogExtensions__)===null||h===void 0||(m=h.loadSiteApp)===null||m===void 0||m.call(h,o.instance,p,v=>{if(v)return Qa.error("Error while initializing PostHog app with config id ".concat(d),v)})};for(var{id:u,url:c}of t.siteApps)s(u,c)}else Qa.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var Ws,RW=["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"],q3=function(e,t){if(!e)return!1;var n=e.toLowerCase();return RW.concat(t||[]).some(r=>{var i=r.toLowerCase();return n.indexOf(i)!==-1})},j3=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&q3(n,t))return!0;try{var r=e==null?void 0:e.userAgentData;if(r!=null&&r.brands&&r.brands.some(i=>q3(i==null?void 0:i.brand,t)))return!0}catch{}return!!e.webdriver};function H3(e,t,n){return Gf({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}(function(e){e.US="us",e.EU="eu",e.CUSTOM="custom"})(Ws||(Ws={}));var G3="i.posthog.com";class OW{constructor(t){Me(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(G3),".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=G3+n;switch(t){case"assets":return"https://".concat(this.region,"-assets.").concat(r);case"api":return"https://".concat(this.region,".").concat(r)}}}var TW={icontains:(e,t)=>!!ue&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!ue&&t.href.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>!!ue&&Su(t.href,e),not_regex:(e,t)=>!!ue&&!Su(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class Ir{constructor(t){var n=this;Me(this,"getWebExperimentsAndEvaluateDisplayLogic",function(){var r=arguments.length>0&&arguments[0]!==void 0&&arguments[0];n.getWebExperiments(i=>{Ir.logInfo("retrieved web experiments from the server"),n._flagToExperiments=new Map,i.forEach(o=>{if(o.feature_flag_key){var s;n._flagToExperiments&&(Ir.logInfo("setting flag key ",o.feature_flag_key," to web experiment ",o),(s=n._flagToExperiments)===null||s===void 0||s.set(o.feature_flag_key,o));var u=n.instance.getFeatureFlag(o.feature_flag_key);qn(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];Ir.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())Ir.logInfo("Refusing to render web experiment since the viewer is a likely bot");else if(!this.instance.config.disable_web_experiments){if(Wt(this._flagToExperiments))return this._flagToExperiments=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Ir.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),s=(i=this._flagToExperiments)===null||i===void 0?void 0:i.get(n);o&&s!=null&&s.variants[o]&&this.applyTransforms(s.name,o,s.variants[o].transforms)}})}}previewWebExperiment(){var t=Ir.getWindowLocation();if(t!=null&&t.search){var n=fg(t==null?void 0:t.search,"__experiment_id"),r=fg(t==null?void 0:t.search,"__experiment_variant");n&&r&&(Ir.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 s=o.json.experiments||[];return t(s)}})}showPreviewWebExperiment(t,n,r){var i=r.filter(o=>o.id===t);i&&i.length>0&&(Ir.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!Wt(t.conditions)&&Ir.matchUrlConditions(t)&&Ir.matchUTMConditions(t)}static matchUrlConditions(t){var n;if(Wt(t.conditions)||Wt((n=t.conditions)===null||n===void 0?void 0:n.url))return!0;var r,i,o,s=Ir.getWindowLocation();return!!s&&((r=t.conditions)===null||r===void 0||!r.url||TW[(i=(o=t.conditions)===null||o===void 0?void 0:o.urlMatchType)!==null&&i!==void 0?i:"icontains"](t.conditions.url,s))}static getWindowLocation(){return ue==null?void 0:ue.location}static matchUTMConditions(t){var n;if(Wt(t.conditions)||Wt((n=t.conditions)===null||n===void 0?void 0:n.utm))return!0;var r=bn.campaignParams();if(r.utm_source){var i,o,s,u,c,d,p,h,m,v,_,x,w,b,C,E,k=(i=t.conditions)===null||i===void 0||(o=i.utm)===null||o===void 0||!o.utm_campaign||((s=t.conditions)===null||s===void 0||(u=s.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,L=(w=t.conditions)===null||w===void 0||(b=w.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 k&&T&&L&&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];Xe.info("[WebExperiments] ".concat(t),r)}applyTransforms(t,n,r){this._is_bot()?Ir.logInfo("Refusing to render web experiment since the viewer is a likely bot"):n!=="control"?r.forEach(i=>{if(i.selector){var o;Ir.logInfo("applying transform of variant ".concat(n," for experiment ").concat(t," "),i);var s=(o=document)===null||o===void 0?void 0:o.querySelectorAll(i.selector);s==null||s.forEach(u=>{var c=u;i.html&&(c.innerHTML=i.html),i.css&&c.setAttribute("style",i.css)})}}):Ir.logInfo("Control variants leave the page unmodified.")}_is_bot(){return ri&&this.instance?j3(ri,this.instance.config.custom_blocked_useragents):void 0}}var Zf={},DS=()=>{},wu="posthog",V3=!_W&&(zn==null?void 0:zn.indexOf("MSIE"))===-1&&(zn==null?void 0:zn.indexOf("Mozilla"))===-1,Z3=()=>{var e;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:NZ(Ge==null?void 0:Ge.location),persistence:"localStorage+cookie",persistence_name:"",loaded:DS,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:!0,capture_pageleave:"if_capture_pageview",debug:Vr&&qn(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:(ue==null||(e=ue.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;Xe.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:MS},_onCapture:DS}},Y3=e=>{var t={};Be(e.process_person)||(t.person_profiles=e.process_person),Be(e.xhr_headers)||(t.request_headers=e.xhr_headers),Be(e.cookie_name)||(t.persistence_name=e.cookie_name),Be(e.disable_cookie)||(t.disable_persistence=e.disable_cookie),Be(e.store_google)||(t.save_campaign_params=e.store_google),Be(e.verbose)||(t.debug=e.verbose);var n=jn({},t,e);return En(e.property_blacklist)&&(Be(e.property_denylist)?n.property_denylist=e.property_blacklist:En(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:Xe.error("Invalid value for property_denylist config: "+e.property_denylist)),n};class MW{constructor(){Me(this,"__forceAllowLocalhost",!1)}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(t){Xe.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class Og{get decideEndpointWasHit(){var t,n;return(t=(n=this.featureFlags)===null||n===void 0?void 0:n.hasLoadedFlags)!==null&&t!==void 0&&t}constructor(){Me(this,"webPerformance",new MW),Me(this,"_personProcessingSetOncePropertiesSent",!1),Me(this,"version",Vo.LIB_VERSION),Me(this,"_internalEventEmitter",new N3),this.config=Z3(),this.SentryIntegration=UY,this.sentryIntegration=t=>function(n,r){var i=HM(n,r);return{name:jM,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 sW(this),this.toolbar=new qY(this),this.scrollManager=new xW(this),this.pageViewManager=new YY(this),this.surveys=new gW(this),this.experiments=new Ir(this),this.exceptions=new WY(this),this.rateLimiter=new mW(this),this.requestRouter=new OW(this),this.consent=new oY(this),this.people={set:(t,n,r)=>{var i=qn(t)?{[t]:n}:t;this.setPersonProperties(i),r==null||r({})},set_once:(t,n,r)=>{var i=qn(t)?{[t]:n}:t;this.setPersonProperties(void 0,i),r==null||r({})}},this.on("eventCaptured",t=>Xe.info('send "'.concat(t==null?void 0:t.event,'"'),t))}init(t,n,r){if(r&&r!==wu){var i,o=(i=Zf[r])!==null&&i!==void 0?i:new Og;return o._init(t,n,r),Zf[r]=o,Zf[wu][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(Be(t)||R1(t))return Xe.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 Xe.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(jn({},Z3(),Y3(i),{name:o,token:t})),this.config.on_xhr_error&&Xe.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:Zi.GZipJS,this.persistence=new wS(this.config),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new wS(pe(pe({},this.config),{},{persistence:"sessionStorage"}));var s=pe({},this.persistence.props),u=pe({},this.sessionPersistence.props);if(this._requestQueue=new bW(b=>this._send_retriable_request(b),this.config.request_queue_config),this._retryQueue=new wW(this),this.__request_queue=[],this.config.__preview_experimental_cookieless_mode||(this.sessionManager=new kW(this),this.sessionPropsManager=new EW(this,this.sessionManager,this.persistence)),new HY(this).startIfEnabledOrStop(),this.siteApps=new IW(this),(n=this.siteApps)===null||n===void 0||n.init(),this.config.__preview_experimental_cookieless_mode||(this.sessionRecording=new BY(this),this.sessionRecording.startIfEnabledOrStop()),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new KZ(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new ZY(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new GY(this),this.exceptionObserver=new lY(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new bM(this,sY),this.deadClicksAutocapture.startIfEnabled(),Vo.DEBUG=Vo.DEBUG||this.config.debug,Vo.DEBUG&&Xe.info("Starting in debug mode",{this:this,config:i,thisC:pe({},this.config),p:s,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(Za()),h=(c=i.bootstrap)!==null&&c!==void 0&&c.isIdentifiedID?p:i.bootstrap.distinctID;this.persistence.set_property(Zo,(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,k;return b[C]=((E=i.bootstrap)===null||E===void 0||(k=E.featureFlags)===null||k===void 0?void 0:k[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,k,O,T;return(E=i.bootstrap)!==null&&E!==void 0&&(k=E.featureFlagPayloads)!==null&&k!==void 0&&k[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:tM,$device_id:null},"");else if(!this.get_distinct_id()){var w=this.config.get_device_id(Za());this.register_once({distinct_id:w,$device_id:w},""),this.persistence.set_property(Zo,"anonymous")}return $n(ue,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),i.segment?FY(this,()=>this._loaded()):this._loaded(),Yi(this.config._onCapture)&&this.config._onCapture!==DS&&(Xe.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,s,u,c,d;if(!Ge||!Ge.body)return Xe.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=kt(t.supportedCompression,Zi.GZipJS)?Zi.GZipJS:kt(t.supportedCompression,Zi.Base64)?Zi.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),(s=this.heatmaps)===null||s===void 0||s.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){Xe.critical("`loaded` function failed",t)}this._start_queue_if_opted_in(),this.config.capture_pageview&&setTimeout(()=>{this.consent.isOptedIn()&&this._captureInitialPageview()},1),new vW(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()||Ga(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&&(V3?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)||(t.transport=t.transport||this.config.api_transport,t.url=Rg(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,s=pe({},n);s.timeout=s.timeout||6e4,s.url=Rg(s.url,{_:new Date().getTime().toString(),ver:Vo.LIB_VERSION,compression:s.compression});var u=(r=s.transport)!==null&&r!==void 0?r:"fetch",c=(i=(o=UT(Vf,d=>d.transport===u))===null||o===void 0?void 0:o.method)!==null&&i!==void 0?i:Vf[0].method;if(!c)throw new Error("No available transport method");c(s)})(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=[];Ga(t,u=>{u&&(n=u[0],En(n)?o.push(u):Yi(u)?u.call(this):En(u)&&n==="alias"?r.push(u):En(u)&&n.indexOf("capture")!==-1&&Yi(this[n])?o.push(u):i.push(u))});var s=function(u,c){Ga(u,function(d){if(En(d[0])){var p=c;rn(d,function(h){p=p[h[0]].apply(p,h.slice(1))})}else this[d[0]].apply(this,d.slice(1))},c)};s(r,this),s(i,this),s(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(!Be(t)&&qn(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&&!qn(n==null?void 0:n.$current_url)&&(Xe.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 s=new Date,u=(r==null?void 0:r.timestamp)||s,c=Za(),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=$Z(d,r!=null&&r._noTruncate?null:this.config.properties_string_max_length)).timestamp=u,Be(r==null?void 0:r.timestamp)||(d.properties.$event_time_override_provided=!0,d.properties.$event_time_override_system_time=s);var h=pe(pe({},d.properties.$set),d.$set);if(cu(h)||this.setPersonPropertiesForFlags(h),!Wt(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}Xe.critical("This capture call is ignored due to client rate limiting.")}}else Xe.error("No event name provided to posthog.capture")}else Xe.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),s=pe({},n);if(s.token=this.config.token,this.config.__preview_experimental_cookieless_mode&&(s.$cookieless_mode=!0),t==="$snapshot"){var u=pe(pe({},this.persistence.properties()),this.sessionPersistence.properties());return s.distinct_id=u.distinct_id,(!qn(s.distinct_id)&&!$r(s.distinct_id)||R1(s.distinct_id))&&Xe.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),s}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();s.$session_id=p,s.$window_id=h}this.sessionPropsManager&&jn(s,this.sessionPropsManager.getSessionProps());try{var m,v;this.sessionRecording&&(s.$recording_status=this.sessionRecording.status,s.$sdk_debug_replay_internal_buffer_length=this.sessionRecording.buffer.data.length,s.$sdk_debug_replay_internal_buffer_size=this.sessionRecording.buffer.size),s.$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){s.$sdk_debug_error_capturing_properties=String(b)}if(this.requestRouter.region===Ws.CUSTOM&&(s.$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(),s=jn(s,c),t==="$pageview"&&Ge&&(s.title=Ge.title),!Be(o)){var _=r.getTime()-o;s.$duration=parseFloat((_/1e3).toFixed(3))}zn&&this.config.opt_out_useragent_filter&&(s.$browser_type=this._is_bot()?"bot":"browser"),(s=jn({},d,this.persistence.properties(),this.sessionPersistence.properties(),s)).$is_identified=this._isIdentified(),En(this.config.property_denylist)?rn(this.config.property_denylist,function(b){delete s[b]}):Xe.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&&(Xe.error("sanitize_properties is deprecated. Use before_send instead"),s=x(s,t));var w=this._hasPersonProcessing();return s.$process_person_profile=w,w&&this._requirePersonProcessing("_calculate_event_properties"),s}_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=jn({},r,i||{},t||{}),s=this.config.sanitize_properties;return s&&(Xe.error("sanitize_properties is deprecated. Use before_send instead"),o=s(o,"$set_once")),this._personProcessingSetOncePropertiesSent=!0,cu(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 Xe.uninitializedWarning("posthog.identify");if($r(t)&&(t=t.toString(),Xe.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()))Xe.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(Rf)&&(this.unregister(Rf),this.register({distinct_id:t}));var s=(this.persistence.get_property(Zo)||"anonymous")==="anonymous";t!==i&&s?(this.persistence.set_property(Zo,"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=H3(t,n,r),this.featureFlags.setAnonymousDistinctId(i)):(n||r)&&this.setPersonProperties(n,r),t!==i&&(this.reloadFeatureFlags(),this.unregister(ag))}}else Xe.error("Unique user id has not been set in posthog.identify")}setPersonProperties(t,n){if((t||n)&&this._requirePersonProcessing("posthog.setPersonProperties")){var r=H3(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):Xe.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 Xe.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(Xe.info("reset"),!this.__loaded)return Xe.uninitializedWarning("posthog.reset");var s=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(Zo,"anonymous"),(o=this.sessionManager)===null||o===void 0||o.resetSessionId(),this._cachedPersonProperties=null,this.config.__preview_experimental_cookieless_mode)this.register_once({distinct_id:tM,$device_id:null},"");else{var u=this.config.get_device_id(Za());this.register_once({distinct_id:u,$device_id:t?u:s},"")}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,s=(o=t.timestampLookBack)!==null&&o!==void 0?o:10;if(!r)return i;var u=Math.max(Math.floor((new Date().getTime()-r)/1e3)-s,0);i+="?t=".concat(u)}return i}alias(t,n){return t===this.get_property(zT)?(Xe.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(Be(n)&&(n=this.get_distinct_id()),t!==n?(this._register_single(Rf,t),this.capture("$create_alias",{alias:t,distinct_id:n})):(Xe.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var n,r,i,o,s=pe({},this.config);kn(t)&&(jn(this.config,Y3(t)),(n=this.persistence)===null||n===void 0||n.update_config(this.config,s),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new wS(pe(pe({},this.config),{},{persistence:"sessionStorage"})),Qn.is_supported()&&Qn.get("ph_debug")==="true"&&(this.config.debug=!0),this.config.debug&&(Vo.DEBUG=!0,Xe.info("set_config",JSON.stringify({config:t,oldConfig:s,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,s,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&&((s=this.sessionRecording)===null||s===void 0||s.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({},bY((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:wu;return n!==wu&&(n=wu+"."+n),n}_isIdentified(){var t,n;return((t=this.persistence)===null||t===void 0?void 0:t.get_property(Zo))==="identified"||((n=this.sessionPersistence)===null||n===void 0?void 0:n.get_property(Zo))==="identified"}_hasPersonProcessing(){var t,n,r,i;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&cu(this.getGroups())&&((t=this.persistence)===null||t===void 0||(n=t.props)===null||n===void 0||!n[Rf])&&((r=this.persistence)===null||r===void 0||(i=r.props)===null||i===void 0||!i[sg]))}_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"?(Xe.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(sg,!0),!0)}_sync_opt_out_with_persistence(){var t,n,r,i,o=this.consent.isOptedOut(),s=this.config.opt_out_persistence_by_default,u=this.config.disable_persistence||o&&!!s;((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(),(Be(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 ri?j3(ri,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){Ge&&!this._initialPageviewCaptured&&(this._initialPageviewCaptured=!0,this.capture("$pageview",{title:Ge.title},{send_instantly:!0}))}debug(t){t===!1?(ue==null||ue.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(ue==null||ue.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(Wt(this.config.before_send))return t;var n=En(this.config.before_send)?this.config.before_send:[this.config.before_send],r=t;for(var i of n){if(r=i(r),Wt(r)){var o="Event '".concat(t.event,"' was rejected in beforeSend function");return TZ(t.event)?Xe.warn("".concat(o,". This can cause unexpected behavior.")):Xe.info(o),null}r.properties&&!cu(r.properties)||Xe.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]]=DZ(e.prototype[t[n]])})(Og,["identify"]);var W3,Ei=(W3=Zf[wu]=new Og,function(){function e(){e.done||(e.done=!0,V3=!1,rn(Zf,function(t){t._dom_loaded()}))}Ge!=null&&Ge.addEventListener?Ge.readyState==="complete"?e():$n(Ge,"DOMContentLoaded",e,{capture:!1}):ue&&Xe.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),W3),K3=W.createContext({client:Ei});function Q3(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,s=r;o<s.length;o++){var u=s[o];if(!i.includes(u)||!Q3(e[u],t[u],n))return!1}return!0}function DW(e){var t=e.children,n=e.client,r=e.apiKey,i=e.options,o=W.useState(!1),s=o[0],u=o[1],c=W.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?s!==!1?(r!==s.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&&!Q3(i,s.previousOptions)&&Ei.set_config(i),u({previousAPIKey:r,previousOptions:i??{}}),Ei):(Ei.__loaded&&console.warn("[PostHog.js] `posthog` was already loaded elsewhere. This may cause issues."),Ei.init(r,i),u({previousAPIKey:r,previousOptions:i??{}}),Ei):(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."),Ei)},[n,r,JSON.stringify(i)]);return Tn.createElement(K3.Provider,{value:{client:c}},t)}var X3=function(){var e=W.useContext(K3).client;return e};function $S(e){var t=X3(),n=W.useState(function(){return t.isFeatureEnabled(e)}),r=n[0],i=n[1];return W.useEffect(function(){return t.onFeatureFlags(function(){i(t.isFeatureEnabled(e))})},[t,e]),r}function $W(e){var t=X3(),n=W.useState(function(){return t.getFeatureFlagPayload(e)}),r=n[0],i=n[1];return W.useEffect(function(){return t.onFeatureFlags(function(){i(t.getFeatureFlagPayload(e))})},[t,e]),r}function LW(e){KE(e,[/\r?\n|\r/g,NW])}function NW(){return{type:"break"}}function PW(){return function(e){LW(e)}}const un={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"},ki={OPEN_STATE_CHANGE:"open_state_change"},BW=e=>{window.DebalesChat||(window.DebalesChat={isOpen:!1,projectId:e,getSessionId:()=>ur(),getChatId:()=>ur()+"_"+e,getAnonId:()=>Fs.getAnonId(),isIdentified:()=>{if(Ei._isIdentified())return!0;const t=Vi();return!!(t&&t.email)},getIdentifiedUser:()=>Vi(),getDistinctId:()=>Ei.get_distinct_id(),getOldDistinctId:()=>Fs.getDistinctId(),debug:!1,identify:(t,n)=>{Ei._isIdentified()||Ei.identify(t,{...n,project:e}),Fs.identify(t,n),qp({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()}),Ei.capture(t,{...n}),cZ(t,{...n,sessionId:ur(),projectId:e})},onOpenChange:t=>{const n=r=>{t(r.detail.isOpen)};return window.addEventListener(ki.OPEN_STATE_CHANGE,n),()=>window.removeEventListener(ki.OPEN_STATE_CHANGE,n)},removeOpenChangeListener:t=>{const n=r=>{t(r.detail.isOpen)};window.removeEventListener(ki.OPEN_STATE_CHANGE,n)},open:()=>{window.DebalesChat.isOpen||window.dispatchEvent(new CustomEvent(ki.OPEN_STATE_CHANGE,{detail:{isOpen:!0,projectId:e}}))},close:()=>{window.DebalesChat.isOpen&&window.dispatchEvent(new CustomEvent(ki.OPEN_STATE_CHANGE,{detail:{isOpen:!1,projectId:e}}))},toggle:()=>{window.dispatchEvent(new CustomEvent(ki.OPEN_STATE_CHANGE,{detail:{isOpen:!window.DebalesChat.isOpen,projectId:e}}))}})};var hr=(e=>(e.DEFAULT="DEFAULT",e.SHOPIFY="SHOPIFY",e.WOOCOMMERCE="WOOCOMMERCE",e.MAGENTO="MAGENTO",e.UNKNOWN="UNKNOWN",e))(hr||{});class Yf{static detect(){var t,n,r,i,o,s;if(typeof window<"u"&&window.Shopify!==void 0&&window.Shopify.routes!==void 0)return hr.SHOPIFY;if(typeof window<"u"&&document.body.classList.contains("woocommerce"))return hr.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 hr.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 hr.MAGENTO;if(document.cookie.split(";").some(h=>h.trim().startsWith("mage-")||h.trim().startsWith("form_key")))return hr.MAGENTO;const p=document.getElementsByTagName("meta");for(const h of Array.from(p))if((o=h.getAttribute("content"))!=null&&o.includes("Magento")||(s=h.getAttribute("name"))!=null&&s.includes("magento"))return hr.MAGENTO}return hr.UNKNOWN}}const FW=le.button`
@@ -2316,8 +2316,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
2316
2316
  margin-top: 16px;
2317
2317
  display: flex;
2318
2318
  justify-content: flex-end;
2319
- `,Ree=({botId:e})=>{var Ji,na;const{uiData:t,storeMetaData:n,onSendMessage:r,isKlaviyoMessage:i,isLoading:o,lastedBotmessageId:s,setLastedBotmessageId:u,messages:c,isMessageLoading:d,setIsMessageLoading:p,setMessages:h,saveConversation:m,changeDisplayModel:v,loadConversation:_,suggestedQuestions:x,setSuggestedQuestions:w,showUserInfoModel:b,setShowUserInfoModel:C,needUserInfo:E}=rD(),{cart:k,addToCart:O,generateCartUrl:T,addCartAttributes:L}=uT(),B=$W("use-chatbot-icon-size"),z=Yf.detect(),N=t==null?void 0:t.isLeft,G=HW(),Q=t==null?void 0:t.heightOption,[se,H]=W.useState(!1);W.useEffect(()=>{const X=()=>{H(window.matchMedia("(max-width: 768px)").matches)};return X(),window.addEventListener("resize",X),()=>window.removeEventListener("resize",X)},[]);const[J,q]=W.useState(!1),[V,fe]=W.useState(!1),[be,A]=W.useState(""),[ne,ce]=W.useState(""),[,$]=W.useState(0);W.useEffect(()=>{e&&BW(e)},[e]),W.useEffect(()=>{uZ(e)},[e]),W.useEffect(()=>{let X=Vi();if(!X&&window.Thinkific){const Ue=window.Thinkific.current_user;Ue&&(X={name:Ue.full_name,email:Ue.email},qp(X))}Fs.init({projectName:e,debug:!1,testing:aT}),X&&X.email&&(window.DebalesChat.identify(X.email,{name:X.name,phone:X.phone,email:X.email}),t!=null&&t.KlaviyoIntegration&&window.klaviyo&&window.klaviyo.identify({email:X.email,first_name:X.name,phone:X.phone,from:"Debales-Chatbot"}))},[e,t==null?void 0:t.KlaviyoIntegration]);const he=W.useRef(null),Ne=bi(e,mi.CLICKED_QUESTIONS),[ie,Fe]=W.useState(()=>{try{const X=sessionStorage.getItem(Ne);return X?new Set(JSON.parse(X)):new Set}catch{return new Set}});W.useEffect(()=>{try{sessionStorage.setItem(Ne,JSON.stringify(Array.from(ie)))}catch(X){console.error("Failed to save to sessionStorage:",X)}},[ie]);const we=W.useCallback((X,Ue)=>{X?(window.dispatchEvent(new CustomEvent(ki.OPEN_STATE_CHANGE,{detail:{isOpen:X,source:Ue,projectId:e}})),setTimeout(()=>{fe(!0)},50)):(fe(!1),window.dispatchEvent(new CustomEvent(ki.OPEN_STATE_CHANGE,{detail:{isOpen:X,source:Ue,projectId:e}})))},[]);W.useEffect(()=>{const X=Ue=>{q(Ue.detail.isOpen),Ue.detail.isOpen&&setTimeout(()=>fe(!0),50),window.DebalesChat.isOpen=Ue.detail.isOpen,window.DebalesChat.track(un.OPEN_STATE_CHANGE,{isOpen:Ue.detail.isOpen,source:Ue.detail.source})};return window.addEventListener(ki.OPEN_STATE_CHANGE,X),()=>{window.removeEventListener(ki.OPEN_STATE_CHANGE,X)}},[]),W.useEffect(()=>{const X=Ue=>{q(Ue.detail.isOpen),window.DebalesChat.isOpen=Ue.detail.isOpen,window.DebalesChat.track(un.OPEN_STATE_CHANGE,{isOpen:Ue.detail.isOpen})};return window.addEventListener(ki.OPEN_STATE_CHANGE,X),()=>{window.removeEventListener(ki.OPEN_STATE_CHANGE,X)}},[]);const[We,Qe]=W.useState(!1),[Pe,Se]=W.useState(null),[$e,Ke]=W.useState(()=>{const X=bi(e,mi.PENDING_BULK_ITEMS),Ue=sessionStorage.getItem(X);return Ue?JSON.parse(Ue):[]});W.useEffect(()=>{const X=bi(e,mi.PENDING_BULK_ITEMS);sessionStorage.setItem(X,JSON.stringify($e))},[$e,e]);const[nt,yt]=W.useState(!1),[ut,P]=W.useState({name:"",email:"",message:""}),F=$S("exit_model"),[Y,me]=W.useState({text:!0,leadingQueries:!0,collections:!0,products:!0,variants:!0,cartSummary:!0,bulkItems:!0}),[_e,xe]=W.useState(!1),[Ve,Je]=W.useState(!0),K=W.useCallback(X=>{const Ue=X.target,it=Ue.scrollHeight-Ue.scrollTop<=Ue.clientHeight+0;Je(it)},[]);W.useEffect(()=>{var X,Ue,it,at,De,St;if(c.length>0&&!d){const Mt=c[c.length-1],Vn=sessionStorage.getItem(bi(e,mi.LAST_SHOWN_MESSAGE_ID)),ii=Mt.isBot&&Mt.conversationId===s&&Mt.conversationId!==Vn,In=(k==null?void 0:k.itemCount)&&(k==null?void 0:k.itemCount)>0&&Mt.conversationId===s;if(ii){xe(!0),sessionStorage.setItem(bi(e,mi.LAST_SHOWN_MESSAGE_ID),Mt.conversationId||""),me({text:!0,leadingQueries:!1,collections:!1,products:!1,variants:!1,cartSummary:!1,bulkItems:!1});const ra=1600;let nl=ra;const oi=[{type:"collections",condition:((X=Mt.collections)==null?void 0:X.length)&&((Ue=Mt.collections)==null?void 0:Ue.length)>0},{type:"products",condition:((it=Mt.products)==null?void 0:it.length)&&((at=Mt.products)==null?void 0:at.length)>0},{type:"leadingQueries",condition:((De=Mt.leading_queries)==null?void 0:De.length)&&((St=Mt.leading_queries)==null?void 0:St.length)>0},{type:"cartSummary",condition:(k==null?void 0:k.itemCount)&&(k==null?void 0:k.itemCount)>0},{type:"bulkItems",condition:($e==null?void 0:$e.length)>0}].filter(Ti=>Ti.condition);if(oi.length===0){xe(!1);return}oi.forEach(({type:Ti},Bu)=>{setTimeout(()=>{if(me(Rr=>({...Rr,[Ti]:!0})),Ve&&he.current){const Rr=he.current;Rr.scrollHeight-Rr.scrollTop<=Rr.clientHeight&&jp(he)}Bu===oi.length-1&&xe(!1)},nl),nl+=ra})}else In&&me(ra=>({...ra,cartSummary:!0}))}},[c,d,s,k==null?void 0:k.itemCount,$e==null?void 0:$e.length,Ve,e]),W.useEffect(()=>{if(!i&&c.length>0){const X=he.current;X&&Ve&&X.scrollHeight-X.scrollTop<=X.clientHeight+100&&setTimeout(()=>jp(he),100)}},[c.length,i,Ve]),W.useEffect(()=>{const X=document.querySelector('meta[name="viewport"]'),Ue=X==null?void 0:X.content;if(J){let it=X;const at=window.matchMedia("(max-width: 768px)").matches;it?it.content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no":(it=document.createElement("meta"),it.name="viewport",it.content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no",document.head.appendChild(it)),at&&(t==null?void 0:t.mobileDisplayMode)==="full-screen"&&(document.body.style.overflow="hidden");const De=it;return()=>{Ue&&De&&(De.content=Ue),at&&(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="")}},[J,t==null?void 0:t.mobileDisplayMode]),W.useEffect(()=>{if(J&&window.matchMedia("(max-width: 768px)").matches&&(t==null?void 0:t.mobileDisplayMode)==="full-screen"){const X=Ue=>{let it=Ue.target,at=!1;const De=he.current;if(De){for(;it&&it!==document.body;){if(it===De){at=!0;break}if(it.parentNode)it=it.parentNode;else break}if(!at)Ue.preventDefault();else{const St=De.scrollTop<=0,Mt=De.scrollTop+De.clientHeight>=De.scrollHeight-5;if(St&&Ue.touches[0].clientY>0||Mt&&Ue.touches[0].clientY<0)return}}};return document.addEventListener("touchmove",X,{passive:!1}),()=>{document.removeEventListener("touchmove",X)}}return()=>{}},[J,t==null?void 0:t.mobileDisplayMode,he]),W.useEffect(()=>{const X=setTimeout(()=>{Qe(!0)},1e3);return()=>clearTimeout(X)},[]),W.useEffect(()=>{i||setTimeout(()=>jp(he),100)},[c.length,i]),W.useEffect(()=>{k!=null&&k.itemCount&&k.itemCount===0&&!i&&setTimeout(()=>jp(he),100)},[k==null?void 0:k.itemCount,i]),W.useEffect(()=>{s&&sessionStorage.setItem(bi(e,mi.LAST_SHOWN_MESSAGE_ID),s)},[s,e]);const de=W.useRef(Date.now()),He=W.useRef(0),qe=W.useRef(window.location.pathname),tt=W.useRef(x),zt=W.useRef(!1),on=$S("acquisition_agent");W.useEffect(()=>{tt.current=x},[x]);const Pt=W.useCallback(async()=>{const X=Date.now();if(X-de.current>=6e3&&X-He.current>=6e4&&!zt.current)try{zt.current=!0,console.log("fetching acquisition data");const at=await fetch(`${po}/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(at.ok){const De=await at.json(),Mt=[...tt.current.filter(Vn=>Vn.path!==qe.current),{question:De.Popup_Message,answer:"",path:qe.current,nameSpace:e,type:"dynamic",Follow_up_Question:De.Follow_up_Question}];w(Mt)}He.current=X}catch(at){console.error("Error fetching acquisition data:",at)}finally{zt.current=!1}},[e]);W.useEffect(()=>{if(!on||(t==null?void 0:t.show_bot)===!1)return;const X=()=>{de.current=Date.now()};document.addEventListener("mousemove",X),document.addEventListener("mousedown",X),document.addEventListener("keypress",X),document.addEventListener("scroll",X),document.addEventListener("touchstart",X),document.addEventListener("touchmove",X);const Ue=setInterval(Pt,1e3),it=()=>{const De=window.location.pathname.split("?")[0],St=qe.current.split("?")[0];(()=>{const Vn=St.split("/").filter(Boolean),ii=De.split("/").filter(Boolean);return Vn.length!==ii.length?!0:Vn.length===0&&ii.length===0?!1:De!==St})()&&(qe.current=De,de.current=Date.now())};return window.addEventListener("popstate",it),()=>{document.removeEventListener("mousemove",X),document.removeEventListener("mousedown",X),document.removeEventListener("keypress",X),document.removeEventListener("scroll",X),document.removeEventListener("touchstart",X),document.removeEventListener("touchmove",X),window.removeEventListener("popstate",it),clearInterval(Ue)}},[on,Pt,t==null?void 0:t.show_bot]);const[mn,rt]=W.useState(!1),[At,je]=W.useState(!1),[_t,Xi]=W.useState(null),So=async X=>{const Ue=ur();if(fe(!1),X&&c.length>1)try{(await fetch(`${po}/api/wordpress/userRating`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:Ue,userRating:X,nameSpace:e})})).ok||console.error("Error submitting rating")}catch(it){console.error("Error submitting rating:",it)}setTimeout(()=>{je(!1),we(!1,"close_button_clicked")},1e3)},Ri=X=>{p(!0),$e.forEach(it=>{O(it.id,it.quantity)}),window.DebalesChat.track(un.ADD_BULK_ITEM,{products:$e,message:X});const Ue=[...c,{text:"🎉 Bulk items added to cart successfully.",leading_queries:["Get GST Invoice for the order","Explore more products"],conversationId:X,isBot:!0}];h(Ue),m(Ue),u(X),Ke([]),p(!1)},Yr=()=>{var X;switch(e){case"minature":case"bodytales":case"imemyselfcare-com":if(window.triggerGokwikCustomCheckout)return window.triggerGokwikCustomCheckout(),!0;break;case"athflex":if((X=window.shiprocketCheckoutEvents)!=null&&X.buyCart)return window.shiprocketCheckoutEvents.buyCart(),!0;break;case"www":if(window.openRzpCheckout)return window.openRzpCheckout(),!0;break;default:return window.location.href=T((t==null?void 0:t.shopifyShopDomain)??""),!1}return window.location.href=T((t==null?void 0:t.shopifyShopDomain)??""),!1},Ja=async X=>{X.preventDefault(),window.DebalesChat.track(un.CHECKOUT_CLICKED,{chatId:ur()+e,cartValue:Number(k==null?void 0:k.total),cart:k}),L({dbls_method:"checkout_clicked"}),Yr()&&we(!1,"checkout_clicked")},[wo,Jo]=W.useState([]);W.useEffect(()=>{const X=hZ(lZ(x));Jo(X)},[x]);const Pr=W.useMemo(()=>wo.map(X=>{if(Array.isArray(X)){const Ue=X.filter(at=>!ie.has(at.question));if(Ue.length===0)return null;const it={isHighlighted:X[0].isHighlighted,enable:X[0].enable,type:X[0].type};return Ue.map(at=>({...at,...it}))}else return ie.has(X.question)?null:X}).filter(Boolean),[wo,ie]);W.useEffect(()=>{const X=at=>{const De=at.detail.formId;switch(at.detail.type){case"open":case"embedOpen":setTimeout(()=>{const Mt=Ue(De);Mt&&A(Mt)},800);break;case"close":be&&(t==null?void 0:t.KlaviyoFormIntegration)===!0&&setTimeout(()=>{we(!0,"klaviyo_form_closed"),ce(De),r(be,void 0,void 0,!0)},1e4);break}},Ue=at=>{const De=document.querySelector(`[data-testid="klaviyo-form-${at}"]`);if(console.log(`formElement text ${at} =>`,De==null?void 0:De.innerText,De==null?void 0:De.textContent),De instanceof HTMLElement){const St=De.innerText||De.textContent;if(St)return console.log("Found form text:",St),`=> Klaviyo form content:
2319
+ `,Ree=({botId:e})=>{var Ji,na;const{uiData:t,storeMetaData:n,onSendMessage:r,isKlaviyoMessage:i,isLoading:o,lastedBotmessageId:s,setLastedBotmessageId:u,messages:c,isMessageLoading:d,setIsMessageLoading:p,setMessages:h,saveConversation:m,changeDisplayModel:v,loadConversation:_,suggestedQuestions:x,setSuggestedQuestions:w,showUserInfoModel:b,setShowUserInfoModel:C,needUserInfo:E}=rD(),{cart:k,addToCart:O,generateCartUrl:T,addCartAttributes:L}=uT(),B=$W("use-chatbot-icon-size"),z=Yf.detect(),N=t==null?void 0:t.isLeft,G=HW(),Q=t==null?void 0:t.heightOption,[se,H]=W.useState(!1);W.useEffect(()=>{const X=()=>{H(window.matchMedia("(max-width: 768px)").matches)};return X(),window.addEventListener("resize",X),()=>window.removeEventListener("resize",X)},[]);const[J,q]=W.useState(!1),[V,fe]=W.useState(!1),[be,A]=W.useState(""),[ne,ce]=W.useState(""),[,$]=W.useState(0);W.useEffect(()=>{e&&BW(e)},[e]),W.useEffect(()=>{uZ(e)},[e]),W.useEffect(()=>{let X=Vi();if(!X&&window.Thinkific){const Ue=window.Thinkific.current_user;Ue&&(X={name:Ue.full_name,email:Ue.email},qp(X))}Fs.init({projectName:e,debug:!0,testing:aT}),X&&X.email&&(window.DebalesChat.identify(X.email,{name:X.name,phone:X.phone,email:X.email}),t!=null&&t.KlaviyoIntegration&&window.klaviyo&&window.klaviyo.identify({email:X.email,first_name:X.name,phone:X.phone,from:"Debales-Chatbot"}))},[e,t==null?void 0:t.KlaviyoIntegration]);const he=W.useRef(null),Ne=bi(e,mi.CLICKED_QUESTIONS),[ie,Fe]=W.useState(()=>{try{const X=sessionStorage.getItem(Ne);return X?new Set(JSON.parse(X)):new Set}catch{return new Set}});W.useEffect(()=>{try{sessionStorage.setItem(Ne,JSON.stringify(Array.from(ie)))}catch(X){console.error("Failed to save to sessionStorage:",X)}},[ie]);const we=W.useCallback((X,Ue)=>{X?(window.dispatchEvent(new CustomEvent(ki.OPEN_STATE_CHANGE,{detail:{isOpen:X,source:Ue,projectId:e}})),setTimeout(()=>{fe(!0)},50)):(fe(!1),window.dispatchEvent(new CustomEvent(ki.OPEN_STATE_CHANGE,{detail:{isOpen:X,source:Ue,projectId:e}})))},[]);W.useEffect(()=>{const X=Ue=>{q(Ue.detail.isOpen),Ue.detail.isOpen&&setTimeout(()=>fe(!0),50),window.DebalesChat.isOpen=Ue.detail.isOpen,window.DebalesChat.track(un.OPEN_STATE_CHANGE,{isOpen:Ue.detail.isOpen,source:Ue.detail.source})};return window.addEventListener(ki.OPEN_STATE_CHANGE,X),()=>{window.removeEventListener(ki.OPEN_STATE_CHANGE,X)}},[]),W.useEffect(()=>{const X=Ue=>{q(Ue.detail.isOpen),window.DebalesChat.isOpen=Ue.detail.isOpen,window.DebalesChat.track(un.OPEN_STATE_CHANGE,{isOpen:Ue.detail.isOpen})};return window.addEventListener(ki.OPEN_STATE_CHANGE,X),()=>{window.removeEventListener(ki.OPEN_STATE_CHANGE,X)}},[]);const[We,Qe]=W.useState(!1),[Pe,Se]=W.useState(null),[$e,Ke]=W.useState(()=>{const X=bi(e,mi.PENDING_BULK_ITEMS),Ue=sessionStorage.getItem(X);return Ue?JSON.parse(Ue):[]});W.useEffect(()=>{const X=bi(e,mi.PENDING_BULK_ITEMS);sessionStorage.setItem(X,JSON.stringify($e))},[$e,e]);const[nt,yt]=W.useState(!1),[ut,P]=W.useState({name:"",email:"",message:""}),F=$S("exit_model"),[Y,me]=W.useState({text:!0,leadingQueries:!0,collections:!0,products:!0,variants:!0,cartSummary:!0,bulkItems:!0}),[_e,xe]=W.useState(!1),[Ve,Je]=W.useState(!0),K=W.useCallback(X=>{const Ue=X.target,it=Ue.scrollHeight-Ue.scrollTop<=Ue.clientHeight+0;Je(it)},[]);W.useEffect(()=>{var X,Ue,it,at,De,St;if(c.length>0&&!d){const Mt=c[c.length-1],Vn=sessionStorage.getItem(bi(e,mi.LAST_SHOWN_MESSAGE_ID)),ii=Mt.isBot&&Mt.conversationId===s&&Mt.conversationId!==Vn,In=(k==null?void 0:k.itemCount)&&(k==null?void 0:k.itemCount)>0&&Mt.conversationId===s;if(ii){xe(!0),sessionStorage.setItem(bi(e,mi.LAST_SHOWN_MESSAGE_ID),Mt.conversationId||""),me({text:!0,leadingQueries:!1,collections:!1,products:!1,variants:!1,cartSummary:!1,bulkItems:!1});const ra=1600;let nl=ra;const oi=[{type:"collections",condition:((X=Mt.collections)==null?void 0:X.length)&&((Ue=Mt.collections)==null?void 0:Ue.length)>0},{type:"products",condition:((it=Mt.products)==null?void 0:it.length)&&((at=Mt.products)==null?void 0:at.length)>0},{type:"leadingQueries",condition:((De=Mt.leading_queries)==null?void 0:De.length)&&((St=Mt.leading_queries)==null?void 0:St.length)>0},{type:"cartSummary",condition:(k==null?void 0:k.itemCount)&&(k==null?void 0:k.itemCount)>0},{type:"bulkItems",condition:($e==null?void 0:$e.length)>0}].filter(Ti=>Ti.condition);if(oi.length===0){xe(!1);return}oi.forEach(({type:Ti},Bu)=>{setTimeout(()=>{if(me(Rr=>({...Rr,[Ti]:!0})),Ve&&he.current){const Rr=he.current;Rr.scrollHeight-Rr.scrollTop<=Rr.clientHeight&&jp(he)}Bu===oi.length-1&&xe(!1)},nl),nl+=ra})}else In&&me(ra=>({...ra,cartSummary:!0}))}},[c,d,s,k==null?void 0:k.itemCount,$e==null?void 0:$e.length,Ve,e]),W.useEffect(()=>{if(!i&&c.length>0){const X=he.current;X&&Ve&&X.scrollHeight-X.scrollTop<=X.clientHeight+100&&setTimeout(()=>jp(he),100)}},[c.length,i,Ve]),W.useEffect(()=>{const X=document.querySelector('meta[name="viewport"]'),Ue=X==null?void 0:X.content;if(J){let it=X;const at=window.matchMedia("(max-width: 768px)").matches;it?it.content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no":(it=document.createElement("meta"),it.name="viewport",it.content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no",document.head.appendChild(it)),at&&(t==null?void 0:t.mobileDisplayMode)==="full-screen"&&(document.body.style.overflow="hidden");const De=it;return()=>{Ue&&De&&(De.content=Ue),at&&(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="")}},[J,t==null?void 0:t.mobileDisplayMode]),W.useEffect(()=>{if(J&&window.matchMedia("(max-width: 768px)").matches&&(t==null?void 0:t.mobileDisplayMode)==="full-screen"){const X=Ue=>{let it=Ue.target,at=!1;const De=he.current;if(De){for(;it&&it!==document.body;){if(it===De){at=!0;break}if(it.parentNode)it=it.parentNode;else break}if(!at)Ue.preventDefault();else{const St=De.scrollTop<=0,Mt=De.scrollTop+De.clientHeight>=De.scrollHeight-5;if(St&&Ue.touches[0].clientY>0||Mt&&Ue.touches[0].clientY<0)return}}};return document.addEventListener("touchmove",X,{passive:!1}),()=>{document.removeEventListener("touchmove",X)}}return()=>{}},[J,t==null?void 0:t.mobileDisplayMode,he]),W.useEffect(()=>{const X=setTimeout(()=>{Qe(!0)},1e3);return()=>clearTimeout(X)},[]),W.useEffect(()=>{i||setTimeout(()=>jp(he),100)},[c.length,i]),W.useEffect(()=>{k!=null&&k.itemCount&&k.itemCount===0&&!i&&setTimeout(()=>jp(he),100)},[k==null?void 0:k.itemCount,i]),W.useEffect(()=>{s&&sessionStorage.setItem(bi(e,mi.LAST_SHOWN_MESSAGE_ID),s)},[s,e]);const de=W.useRef(Date.now()),He=W.useRef(0),qe=W.useRef(window.location.pathname),tt=W.useRef(x),zt=W.useRef(!1),on=$S("acquisition_agent");W.useEffect(()=>{tt.current=x},[x]);const Pt=W.useCallback(async()=>{const X=Date.now();if(X-de.current>=6e3&&X-He.current>=6e4&&!zt.current)try{zt.current=!0,console.log("fetching acquisition data");const at=await fetch(`${po}/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(at.ok){const De=await at.json(),Mt=[...tt.current.filter(Vn=>Vn.path!==qe.current),{question:De.Popup_Message,answer:"",path:qe.current,nameSpace:e,type:"dynamic",Follow_up_Question:De.Follow_up_Question}];w(Mt)}He.current=X}catch(at){console.error("Error fetching acquisition data:",at)}finally{zt.current=!1}},[e]);W.useEffect(()=>{if(!on||(t==null?void 0:t.show_bot)===!1)return;const X=()=>{de.current=Date.now()};document.addEventListener("mousemove",X),document.addEventListener("mousedown",X),document.addEventListener("keypress",X),document.addEventListener("scroll",X),document.addEventListener("touchstart",X),document.addEventListener("touchmove",X);const Ue=setInterval(Pt,1e3),it=()=>{const De=window.location.pathname.split("?")[0],St=qe.current.split("?")[0];(()=>{const Vn=St.split("/").filter(Boolean),ii=De.split("/").filter(Boolean);return Vn.length!==ii.length?!0:Vn.length===0&&ii.length===0?!1:De!==St})()&&(qe.current=De,de.current=Date.now())};return window.addEventListener("popstate",it),()=>{document.removeEventListener("mousemove",X),document.removeEventListener("mousedown",X),document.removeEventListener("keypress",X),document.removeEventListener("scroll",X),document.removeEventListener("touchstart",X),document.removeEventListener("touchmove",X),window.removeEventListener("popstate",it),clearInterval(Ue)}},[on,Pt,t==null?void 0:t.show_bot]);const[mn,rt]=W.useState(!1),[At,je]=W.useState(!1),[_t,Xi]=W.useState(null),So=async X=>{const Ue=ur();if(fe(!1),X&&c.length>1)try{(await fetch(`${po}/api/wordpress/userRating`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:Ue,userRating:X,nameSpace:e})})).ok||console.error("Error submitting rating")}catch(it){console.error("Error submitting rating:",it)}setTimeout(()=>{je(!1),we(!1,"close_button_clicked")},1e3)},Ri=X=>{p(!0),$e.forEach(it=>{O(it.id,it.quantity)}),window.DebalesChat.track(un.ADD_BULK_ITEM,{products:$e,message:X});const Ue=[...c,{text:"🎉 Bulk items added to cart successfully.",leading_queries:["Get GST Invoice for the order","Explore more products"],conversationId:X,isBot:!0}];h(Ue),m(Ue),u(X),Ke([]),p(!1)},Yr=()=>{var X;switch(e){case"minature":case"bodytales":case"imemyselfcare-com":if(window.triggerGokwikCustomCheckout)return window.triggerGokwikCustomCheckout(),!0;break;case"athflex":if((X=window.shiprocketCheckoutEvents)!=null&&X.buyCart)return window.shiprocketCheckoutEvents.buyCart(),!0;break;case"www":if(window.openRzpCheckout)return window.openRzpCheckout(),!0;break;default:return window.location.href=T((t==null?void 0:t.shopifyShopDomain)??""),!1}return window.location.href=T((t==null?void 0:t.shopifyShopDomain)??""),!1},Ja=async X=>{X.preventDefault(),window.DebalesChat.track(un.CHECKOUT_CLICKED,{chatId:ur()+e,cartValue:Number(k==null?void 0:k.total),cart:k}),L({dbls_method:"checkout_clicked"}),Yr()&&we(!1,"checkout_clicked")},[wo,Jo]=W.useState([]);W.useEffect(()=>{const X=hZ(lZ(x));Jo(X)},[x]);const Pr=W.useMemo(()=>wo.map(X=>{if(Array.isArray(X)){const Ue=X.filter(at=>!ie.has(at.question));if(Ue.length===0)return null;const it={isHighlighted:X[0].isHighlighted,enable:X[0].enable,type:X[0].type};return Ue.map(at=>({...at,...it}))}else return ie.has(X.question)?null:X}).filter(Boolean),[wo,ie]);W.useEffect(()=>{const X=at=>{const De=at.detail.formId;switch(at.detail.type){case"open":case"embedOpen":setTimeout(()=>{const Mt=Ue(De);Mt&&A(Mt)},800);break;case"close":be&&(t==null?void 0:t.KlaviyoFormIntegration)===!0&&setTimeout(()=>{we(!0,"klaviyo_form_closed"),ce(De),r(be,void 0,void 0,!0)},1e4);break}},Ue=at=>{const De=document.querySelector(`[data-testid="klaviyo-form-${at}"]`);if(console.log(`formElement text ${at} =>`,De==null?void 0:De.innerText,De==null?void 0:De.textContent),De instanceof HTMLElement){const St=De.innerText||De.textContent;if(St)return console.log("Found form text:",St),`=> Klaviyo form content:
2320
2320
 
2321
2321
  `+St+`
2322
2322
 
2323
- => User Action: Klaviyo form closed`}return""},it=at=>{at instanceof CustomEvent&&X(at)};return window.addEventListener("klaviyoForms",it),()=>{window.removeEventListener("klaviyoForms",it)}},[be,t,r]),W.useEffect(()=>{const X=he.current;return X?(X.addEventListener("scroll",K),()=>X.removeEventListener("scroll",K)):()=>{}},[K]);const[ea,tl]=W.useState(!1),ta=Q==="Highest"?"120px":Q==="Higher"?"60px":"15px",Oi=async()=>{try{const X=await fetch(`${po}/api/wordpress/support`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({chatid:ur()+e,nameSpace:e,userName:ut.name,userEmail:ut.email,userMessage:ut.message,tag:"support"})});if(X.ok)h(Ue=>[...Ue,{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,hideConfirmation:!0}]),console.log("Connected to support with existing user info:",Vi());else{const Ue=await X.json();console.error("Failed to connect to support:",Ue),h(it=>[...it,{text:"Sorry, we couldn't connect you to support at the moment.<br>Please try again later.",isBot:!0,hideConfirmation:!0}])}}catch{h(Ue=>[...Ue,{text:"Sorry, we couldn't connect you to support at the moment.<br>Please try again later.",isBot:!0,hideConfirmation:!0}])}},Gn=()=>{const X=Vi();X&&X.name&&X.email&&P({name:X==null?void 0:X.name,email:X==null?void 0:X.email,message:""}),h(Ue=>[...Ue,{text:"Please provide your name, email and message to connect with support.",isBot:!0,hideConfirmation:!1}]),yt(!0)},rr=async X=>{X.preventDefault(),qp({name:ut.name,email:ut.email}),yt(!1),h(Ue=>Ue.slice(0,-1)),await Oi()};return!t||t.show_bot===!1||o?null:D.jsxs(Iz,{theme:oZ(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(See,{}),!J&&(Pr==null?void 0:Pr.length)!==0&&D.jsx(bee,{className:We?"visible":"",$botId:e,$iconSize:B,$removeLogoBackground:t.removeLogoBackground,topOffset:ta,style:{right:N?"auto":"24px",left:N?"24px":"auto",display:"flex",flexDirection:"column",alignItems:N?"flex-start":"flex-end"},children:Pr.map((X,Ue)=>{if(Array.isArray(X)){const it=X.map(at=>({question:at.question,isHighlighted:at.isHighlighted??!1})).filter(at=>!ie.has(at.question));return D.jsx(n$,{$index:Ue,$totalCount:Pr.length,children:D.jsx(XK,{messages:it,botId:e,uiData:t,onClick:at=>{const De=X.find(St=>St.question===at);we(!0,"suggested_question_clicked"),Fe(St=>{const Mt=new Set(St);return Mt.add(at),Mt}),window.DebalesChat.track(un.SUGGESTED_QUESTION_CLICKED,{suggested_question:De}),!E&&De?r((De==null?void 0:De.Follow_up_Question)??De.question,De==null?void 0:De.answer,De==null?void 0:De.products,!1,De==null?void 0:De.leading_queries):(C(!0),Se(De))}})},Ue)}else return D.jsx(n$,{$index:Ue,$totalCount:Pr.length,children:D.jsx(KK,{value:`${X.question}`,index:Ue,botId:e,uiData:t,onClose:()=>{Fe(it=>{const at=new Set(it);return at.add(X.question),at})},onClick:()=>{we(!0,"suggested_question_clicked"),Fe(it=>{const at=new Set(it);return at.add(X.question),at}),window.DebalesChat.track(un.SUGGESTED_QUESTION_CLICKED,{suggested_question:X}),E?(C(!0),Se(X)):r(X.Follow_up_Question??X.question,X.answer,X.products,!1,X.leading_queries)},isHighlighted:X.isHighlighted??!1})},Ue)})}),D.jsxs(tee,{$topOffset:ta,$removeLogoBackground:t.removeLogoBackground,style:{display:J?"none":"inline-flex",right:N?"auto":"24px",left:N?"24px":"auto"},children:[D.jsx(nee,{$showAnimation:t.enableChatButtonBackgroundAnimation??!1,$animationType:"Ping",$animationColor:t.chatButtonBackgroundAnimationColor||"#f48722",$backgroundColor:t.backgroundColor||"#fff",$removeLogoBackground:t.removeLogoBackground,$topOffset:ta,$iconSize:B}),D.jsx(ree,{$backgroundColor:t.removeLogoBackground?"transparent":t.backgroundColor||"#fff",$botId:e,$iconSize:B,$removeLogoBackground:t.removeLogoBackground,topOffset:ta,$showAnimation:t.enableChatButtonBackgroundAnimation,$animationType:"Ping",$animationColor:t.chatButtonBackgroundAnimationColor||"#f48722",id:"debales-chat-button",onClick:()=>{if(window.DebalesChat.track(un.CHAT_BUTTON_CLICKED),we(!J,"chat_button_clicked"),!J){const X=_();X.length>0&&h(X)}},"aria-label":"Chat",style:{display:J?"none":"inline-flex",right:N?"auto":"24px",left:N?"24px":"auto"},children:D.jsx(iee,{$botId:e,$removeLogoBackground:t.removeLogoBackground,"aria-hidden":"true",src:t.bot_logo,alt:"Chat Bot Icon"})})]}),J&&d5.createPortal(D.jsx(D.Fragment,{children:D.jsxs(cee,{$backgroundColor:t.backgroundColor||"#fff",$fullScreenOnMobile:t.fullScreenOnMobile,$headerFontColor:t.headerFontColor||"#1C1C1C",$isLeft:N,$topOffset:ta,$mobileDisplayMode:t.mobileDisplayMode,$isVisible:V,children:[D.jsxs(fee,{$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(oee,{"aria-hidden":"true",src:t.bot_logo,alt:"Chat Bot Icon"}),D.jsxs(aee,{$botNameColor:t.headerFontColor,children:[D.jsxs("div",{style:{fontWeight:"700",wordBreak:"break-word"},children:[t.chatbotName,e==="catch-org-ai"&&D.jsx(lee,{$backgroundColor:t.callToActionBackgroundColor,$fontColor:t.callToActionFontColor,children:"Beta"})]}),D.jsx(see,{children:D.jsx(AK,{})})]})]}),D.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[D.jsxs(wee,{children:[D.jsxs(xee,{onClick:Gn,children:[D.jsx(RK,{color:t.headerFontColor}),D.jsx(Cee,{children:"Support"})]}),D.jsx(r$,{children:"Need more help? I'll connect you with a support agent."})]}),(t.mobileDisplayMode==="half-screen"||t.mobileDisplayMode==="full-screen")&&se&&D.jsx("button",{onClick:()=>{const X=t.mobileDisplayMode==="full-screen"?"half-screen":"full-screen";v(X)},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(uee,{onClick:()=>{F?je(!0):we(!1,"close_button_clicked")},id:"debales-minimize-button","aria-label":"Minimize",children:D.jsx(qS,{botNameColor:t.headerFontColor})})]})]}),D.jsxs(hee,{$backgroundColor:t.botBackgroundColor||"#fff",$mobileDisplayMode:t.mobileDisplayMode,children:[ea&&((na=(Ji=t.pluginConfig)==null?void 0:Ji.collectedUserInfo)==null?void 0:na.discount)&&D.jsx(WK,{discount:t.pluginConfig.collectedUserInfo.discount,uiData:t,onClose:()=>{tl(!1),window.DebalesChat.track(un.DISCOUNT_VIEWED,{discount:t.pluginConfig.collectedUserInfo.discount})}}),D.jsx(ZJ,{uidata:t,product:_t,showModel:mn,setShowModel:rt,onVariantSelect:X=>{O(X.id,1),window.DebalesChat.track(un.ADD_TO_CART_CLICKED,{product:X.title,price:Number(X.price),link:`https://${t.shopifyShopDomain}/variants/${X.id}`,message:s,chatId:ur()+e})}}),At&&D.jsx(dQ,{setShowExitModal:je,handleCloseChatbot:So,chatId:ur()+e}),D.jsxs(dee,{id:"debales-conversation-group",$botBackgroundColor:t.botBackgroundColor||"#fff",ref:he,$mobileDisplayMode:t.mobileDisplayMode,children:[c.map((X,Ue)=>{const it=X.isBot,at=dZ(X.text);return X.hideConfirmation?null:D.jsxs(W.Fragment,{children:[it&&D.jsxs(J4,{$fontColor:t.botFontColor||"#000",$botMessageColor:t.botBackgroundColor||"#fff",children:[D.jsx("img",{src:it?t.bot_logo:t.userMessage_logo,alt:"Chat User Icon"}),D.jsxs(t$,{children:[at.map(De=>D.jsx("div",{children:D.jsx(nd,{$botMessageColor:it?t.botMessageColor||"#fff":t.userMessageColor||"#fff",style:{color:t.botFontColor},children:D.jsx(YE,{remarkPlugins:[EU,PW],children:De})})})),X.collections&&s===X.conversationId&&Y.collections&&D.jsx(UK,{message:X,botId:e,uidata:t,onSendMessage:r,loading:d}),X.products&&s===X.conversationId&&Y.products&&D.jsx(TQ,{message:X,botId:e,uidata:t,onSendMessage:r,loading:d,storeMetaData:n,platform:z,setShowVariantModel:rt,setSelectedProduct:Xi,setCartVersion:$}),i&&D.jsx(YS,{children:D.jsx(J3,{onClick:()=>{window._klOnsite&&(window._klOnsite.push(["openForm",ne]),we(!1,"klaviyo_grab_deal_button"))},children:"🚀 Grab Deal Now!"})}),c.length==1&&Ue==0&&!b&&D.jsx(YS,{children:wo.map(De=>Array.isArray(De)?De[0]:De).map((De,St)=>D.jsx(e$,{style:{backgroundColor:t.callToActionBackgroundColor,color:t.callToActionFontColor},onClick:()=>{r(De.question,De.answer,De.products),Fe(Mt=>{const Vn=new Set(Mt);return Vn.add(De.question),Vn}),window.DebalesChat.track(un.INITIAL_LEADING_QUERY_SUGGESTED_QUESTION_CLICKED,{question:De.question})},disabled:d,$disabled:d,children:De.question},St))}),X.leading_queries&&X.leading_queries.length>0&&s===X.conversationId&&Y.leadingQueries&&!i&&!b&&D.jsx(YS,{children:X.leading_queries.map((De,St)=>D.jsx(e$,{style:{backgroundColor:t.callToActionBackgroundColor,color:t.callToActionFontColor},onClick:()=>{r(De),window.DebalesChat.track(un.LEADING_QUERY_CLICKED,{query:De})},disabled:d,$disabled:d,children:De},St))}),k&&k.itemCount>0&&s===X.conversationId&&Y.cartSummary&&D.jsxs(vee,{children:[D.jsx(nd,{$botMessageColor:t.botMessageColor,style:{width:"max-content",color:t.botFontColor},dangerouslySetInnerHTML:{__html:`<span style="display: flex; align-items: center; justify-content: center;">Total Price: ${jW((k==null?void 0:k.total)??0,(k==null?void 0:k.currency)??"USD")} </span>`}}),D.jsxs(UW,{href:T(t.shopifyShopDomain??""),onClick:Ja,children:[D.jsx("span",{children:"Checkout"}),D.jsx(EK,{style:{width:"20px",fill:t.callToActionFontColor}})]})]}),$e&&$e.length>0&&s===X.conversationId&&Y.bulkItems&&D.jsx(FW,{onClick:()=>Ri(X.conversationId),children:"Add Bulk Items to Cart"}),b&&c.indexOf(X)===c.length-1&&D.jsx(D.Fragment,{children:D.jsx($J,{uidata:t,botName:t.chatbotName,botId:e,showModel:b,setShowModel:De=>{var Mt,Vn;const St=typeof De=="function"?De(b):De;C(St),!St&&((Vn=(Mt=t.pluginConfig)==null?void 0:Mt.collectedUserInfo)!=null&&Vn.discount)&&tl(!0)},selectedSuggestedQuestionAnswer:Pe,sendMessage:r,botNameColor:t.headerFontColor,inChat:!0,showFormInstructions:!1})}),nt&&c.indexOf(X)===c.length-1&&D.jsxs(Eee,{onSubmit:rr,children:[D.jsxs(WS,{children:[D.jsxs(KS,{children:["Name",D.jsx("span",{children:"*"})]}),D.jsx(i$,{type:"text",required:!0,value:ut.name,onChange:De=>P(St=>({...St,name:De.target.value})),placeholder:"John"})]}),D.jsxs(WS,{children:[D.jsxs(KS,{children:["Email",D.jsx("span",{children:"*"})]}),D.jsx(i$,{type:"email",required:!0,value:ut.email,onChange:De=>P(St=>({...St,email:De.target.value})),placeholder:"olivia@untitledui.com"})]}),D.jsxs(WS,{children:[D.jsxs(KS,{children:["Message",D.jsx("span",{children:"*"})]}),D.jsx(kee,{required:!0,value:ut.message,onChange:De=>P(St=>({...St,message:De.target.value})),placeholder:"I need help with..."})]}),D.jsx(Iee,{children:D.jsx(Aee,{type:"submit",children:"Submit"})})]}),_e&&!d&&s===X.conversationId&&D.jsx(nd,{$botMessageColor:t.botMessageColor,style:{color:t.botFontColor},children:D.jsx(vD,{loading:_e,loadingPhrases:["🎨 Loading","✨ Almost","🚀 Ready"]})})]})]}),!it&&D.jsx(yee,{$fontColor:t.userFontColor||"#000",$botMessageColor:t.botBackgroundColor||"#fff",children:D.jsx(nd,{$botMessageColor:it?t.botMessageColor||"#fff":t.userMessageColor||"#fff",children:D.jsx(YE,{children:X.text})})})]},Ue)}),d&&D.jsxs(J4,{$fontColor:t.botFontColor||"#000",$botMessageColor:t.botBackgroundColor||"#fff",children:[D.jsx("img",{src:t.bot_logo,alt:"Chat User Icon"}),D.jsx(t$,{children:D.jsx(nd,{$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(vD,{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(mee,{children:D.jsx("span",{children:'"Catch org AI" can make mistakes.'})}),D.jsx("div",{children:D.jsx(XJ,{uiData:t,onSendMessage:r,disabled:d,inputState:!1})}),(t.debales_branding??!0)&&D.jsxs(pee,{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(gee,{children:[D.jsx("img",{src:`${po}/images/debales_logo_d.png`,alt:"Debales logo"}),D.jsx("p",{children:"DEBALES"})]})]})]})]})]})}),G.shadowRoot)]})},o$="debales-ai-assistant",a$="debales-chatbot-container",Oee=W.forwardRef(({children:e,globalStyles:t="",containerStyles:n={},onReady:r},i)=>{const o=W.useRef(null),[s,u]=W.useState(null),c=W.useRef(null),d=W.useRef(null),p=W.useRef({get shadowRoot(){return c.current},get container(){return s},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 W.useImperativeHandle(i,()=>p.current,[]),W.useEffect(()=>{const h=document.getElementById(o$);if(h?o.current=h:o.current&&(o.current.id=o$),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(`#${a$}`);_&&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=a$,v.style.cssText="position: absolute; top: 0; left: 0; width: 0; height: 0;",m.appendChild(v),u(v),r&&r(m,v)}},[t,r]),W.useEffect(()=>(s&&!d.current&&(d.current=AC.createRoot(s)),d.current&&s&&d.current.render(D.jsx(xz,{target:s,children:D.jsx(tD,{value:p.current,children:e})})),()=>{d.current&&d.current.unmount()}),[s,e]),D.jsx("div",{ref:o,style:n})});class QS{isSupported(){return Yf.detect()===this.platform}createSuccessResult(t,n){return{success:!0,data:t,message:n}}createErrorResult(t){return{success:!1,error:t}}}class Tee extends QS{constructor(){super(...arguments);er(this,"platform",hr.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 Mee extends QS{constructor(){var n,r;super();er(this,"platform",hr.SHOPIFY);er(this,"cartEndpoint");er(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=xv(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=ur()}){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:ur(),dbls_method:"add_to_cart"}})}),s=await o.json();if(!o.ok){const u=s;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:ur(),...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=xv(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]",ur()),i.searchParams.append("timestamp",Date.now().toString()),Xs(i.toString())}}class Dee extends QS{constructor(){var n,r;super();er(this,"platform",hr.MAGENTO);er(this,"checkoutEndpoint");er(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 s=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(!s.ok)return this.createErrorResult(`Failed to add item to cart: ${s.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=xv(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(){er(this,"adapterCache");this.adapterCache=new Map}static getInstance(){return Js.instance||(Js.instance=new Js),Js.instance}getAdapter(t){const n=t||Yf.detect(),r=this.adapterCache.get(n);if(r)return r;let i;switch(n){case hr.SHOPIFY:i=new Mee;break;case hr.MAGENTO:i=new Dee;break;default:console.warn(`No specific adapter found for platform ${n}, using default adapter`),i=new Tee}return this.adapterCache.set(n,i),i}clearCache(){this.adapterCache.clear()}};er(Js,"instance");let XS=Js;const $ee=({adapter:e,children:t,autoFetch:n=!0})=>{const[r,i]=W.useState(!1),[o,s]=W.useState(null),[u,c]=W.useState(null),d=W.useCallback(async()=>{try{i(!0),s(null);const C=await e.fetchCart();C.success?c(C.data):s(C.error)}catch(C){s(C instanceof Error?C.message:"Failed to fetch cart")}finally{i(!1)}},[e]),p=async(C,E,k)=>{try{s(null);const O=await e.addToCart(C,E,k);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{s(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{s(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{s(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),w=async C=>e.addCartAttributes(C);W.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:w};return D.jsx(lT.Provider,{value:b,children:t})},yo=Object.create(null);yo.open="0",yo.close="1",yo.ping="2",yo.pong="3",yo.message="4",yo.upgrade="5",yo.noop="6";const Cv=Object.create(null);Object.keys(yo).forEach(e=>{Cv[yo[e]]=e});const JS={type:"error",data:"parser error"},s$=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",l$=typeof ArrayBuffer=="function",u$=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,ew=({type:e,data:t},n,r)=>s$&&t instanceof Blob?n?r(t):c$(t,r):l$&&(t instanceof ArrayBuffer||u$(t))?n?r(t):c$(new Blob([t]),r):r(yo[e]+(t||"")),c$=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function f$(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let tw;function Lee(e,t){if(s$&&e.data instanceof Blob)return e.data.arrayBuffer().then(f$).then(t);if(l$&&(e.data instanceof ArrayBuffer||u$(e.data)))return t(f$(e.data));ew(e,!1,n=>{tw||(tw=new TextEncoder),t(tw.encode(n))})}const d$="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",rd=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<d$.length;e++)rd[d$.charCodeAt(e)]=e;const Nee=e=>{let t=e.length*.75,n=e.length,r,i=0,o,s,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)],s=rd[e.charCodeAt(r+1)],u=rd[e.charCodeAt(r+2)],c=rd[e.charCodeAt(r+3)],p[i++]=o<<2|s>>4,p[i++]=(s&15)<<4|u>>2,p[i++]=(u&3)<<6|c&63;return d},Pee=typeof ArrayBuffer=="function",nw=(e,t)=>{if(typeof e!="string")return{type:"message",data:h$(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:Bee(e.substring(1),t)}:Cv[n]?e.length>1?{type:Cv[n],data:e.substring(1)}:{type:Cv[n]}:JS},Bee=(e,t)=>{if(Pee){const n=Nee(e);return h$(n,t)}else return{base64:!0,data:e}},h$=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},p$="",Fee=(e,t)=>{const n=e.length,r=new Array(n);let i=0;e.forEach((o,s)=>{ew(o,!1,u=>{r[s]=u,++i===n&&t(r.join(p$))})})},Uee=(e,t)=>{const n=e.split(p$),r=[];for(let i=0;i<n.length;i++){const o=nw(n[i],t);if(r.push(o),o.type==="error")break}return r};function zee(){return new TransformStream({transform(e,t){Lee(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 rw;function Ev(e){return e.reduce((t,n)=>t+n.length,0)}function kv(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 qee(e,t){rw||(rw=new TextDecoder);const n=[];let r=0,i=-1,o=!1;return new TransformStream({transform(s,u){for(n.push(s);;){if(r===0){if(Ev(n)<1)break;const c=kv(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(Ev(n)<2)break;const c=kv(n,2);i=new DataView(c.buffer,c.byteOffset,c.length).getUint16(0),r=3}else if(r===2){if(Ev(n)<8)break;const c=kv(n,8),d=new DataView(c.buffer,c.byteOffset,c.length),p=d.getUint32(0);if(p>Math.pow(2,21)-1){u.enqueue(JS);break}i=p*Math.pow(2,32)+d.getUint32(4),r=3}else{if(Ev(n)<i)break;const c=kv(n,i);u.enqueue(nw(o?c:rw.decode(c),t)),r=0}if(i===0||i>e){u.enqueue(JS);break}}}})}const g$=4;function Hn(e){if(e)return jee(e)}function jee(e){for(var t in Hn.prototype)e[t]=Hn.prototype[t];return e}Hn.prototype.on=Hn.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},Hn.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},Hn.prototype.off=Hn.prototype.removeListener=Hn.prototype.removeAllListeners=Hn.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},Hn.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},Hn.prototype.emitReserved=Hn.prototype.emit,Hn.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},Hn.prototype.hasListeners=function(e){return!!this.listeners(e).length};const Av=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0),Ai=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Hee="arraybuffer";function Jre(){}function m$(e,...t){return t.reduce((n,r)=>(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const Gee=Ai.setTimeout,Vee=Ai.clearTimeout;function Iv(e,t){t.useNativeTimers?(e.setTimeoutFn=Gee.bind(Ai),e.clearTimeoutFn=Vee.bind(Ai)):(e.setTimeoutFn=Ai.setTimeout.bind(Ai),e.clearTimeoutFn=Ai.clearTimeout.bind(Ai))}const Zee=1.33;function Yee(e){return typeof e=="string"?Wee(e):Math.ceil((e.byteLength||e.size)*Zee)}function Wee(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 v$(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Kee(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function Qee(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 Xee extends Error{constructor(t,n,r){super(t),this.description=n,this.context=r,this.type="TransportError"}}class iw extends Hn{constructor(t){super(),this.writable=!1,Iv(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 Xee(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=nw(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=Kee(t);return n.length?"?"+n:""}}class Jee extends iw{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)};Uee(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,Fee(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]=v$()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}}let y$=!1;try{y$=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const ete=y$;function tte(){}class nte extends Jee{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 _o extends Hn{constructor(t,n,r){super(),this.createRequest=t,Iv(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=m$(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=_o.requestsCount++,_o.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=tte,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete _o.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(_o.requestsCount=0,_o.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",_$);else if(typeof addEventListener=="function"){const e="onpagehide"in Ai?"pagehide":"unload";addEventListener(e,_$,!1)}}function _$(){for(let e in _o.requests)_o.requests.hasOwnProperty(e)&&_o.requests[e].abort()}const rte=function(){const e=b$({xdomain:!1});return e&&e.responseType!==null}();class ite extends nte{constructor(t){super(t);const n=t&&t.forceBase64;this.supportsBinary=rte&&!n}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new _o(b$,this.uri(),t)}}function b$(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||ete))return new XMLHttpRequest}catch{}if(!t)try{return new Ai[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const S$=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class ote extends iw{get name(){return"websocket"}doOpen(){const t=this.uri(),n=this.opts.protocols,r=S$?{}:m$(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;ew(r,this.supportsBinary,o=>{try{this.doWrite(r,o)}catch{}i&&Av(()=>{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]=v$()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}}const ow=Ai.WebSocket||Ai.MozWebSocket;class ate extends ote{createSocket(t,n,r){return S$?new ow(t,n,r):n?new ow(t,n):new ow(t)}doWrite(t,n){this.ws.send(n)}}class ste extends iw{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=qee(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(n).getReader(),i=zee();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 s={type:"open"};this.query.sid&&(s.data=`{"sid":"${this.query.sid}"}`),this._writer.write(s).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&&Av(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const lte={websocket:ate,webtransport:ste,polling:ite},ute=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,cte=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function aw(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=ute.exec(e||""),o={},s=14;for(;s--;)o[cte[s]]=i[s]||"";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=fte(o,o.path),o.queryKey=dte(o,o.query),o}function fte(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 dte(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,o){i&&(n[i]=o)}),n}const sw=typeof addEventListener=="function"&&typeof removeEventListener=="function",Rv=[];sw&&addEventListener("offline",()=>{Rv.forEach(e=>e())},!1);class Xa extends Hn{constructor(t,n){if(super(),this.binaryType=Hee,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=aw(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=aw(n.host).host);Iv(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=Qee(this.opts.query)),sw&&(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"})},Rv.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=g$,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&&Xa.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",Xa.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+=Yee(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,Av(()=>{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(Xa.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(),sw&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=Rv.indexOf(this._offlineEventListener);r!==-1&&Rv.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this._prevBufferLen=0}}}Xa.protocol=g$;class hte extends Xa{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;Xa.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;Xa.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 s=h=>{const m=new Error("probe error: "+h);m.transport=n.name,o(),this.emitReserved("upgradeError",m)};function u(){s("transport closed")}function c(){s("socket closed")}function d(h){n&&h.name!==n.name&&o()}const p=()=>{n.removeListener("open",i),n.removeListener("error",s),n.removeListener("close",u),this.off("close",c),this.off("upgrading",d)};n.once("open",i),n.once("error",s),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 pte=class extends hte{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=>lte[i]).filter(i=>!!i)),super(t,r)}};function gte(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=aw(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 mte=typeof ArrayBuffer=="function",vte=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,w$=Object.prototype.toString,yte=typeof Blob=="function"||typeof Blob<"u"&&w$.call(Blob)==="[object BlobConstructor]",_te=typeof File=="function"||typeof File<"u"&&w$.call(File)==="[object FileConstructor]";function lw(e){return mte&&(e instanceof ArrayBuffer||vte(e))||yte&&e instanceof Blob||_te&&e instanceof File}function Ov(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n<r;n++)if(Ov(e[n]))return!0;return!1}if(lw(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return Ov(e.toJSON(),!0);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&Ov(e[n]))return!0;return!1}function bte(e){const t=[],n=e.data,r=e;return r.data=uw(n,t),r.attachments=t.length,{packet:r,buffers:t}}function uw(e,t){if(!e)return e;if(lw(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]=uw(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]=uw(e[r],t));return n}return e}function Ste(e,t){return e.data=cw(e.data,t),delete e.attachments,e}function cw(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]=cw(e[n],t);else if(typeof e=="object")for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=cw(e[n],t));return e}const wte=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],xte=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 Cte{constructor(t){this.replacer=t}encode(t){return(t.type===$t.EVENT||t.type===$t.ACK)&&Ov(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=bte(t),r=this.encodeAsString(n.packet),i=n.buffers;return i.unshift(r),i}}function x$(e){return Object.prototype.toString.call(e)==="[object Object]"}class fw extends Hn{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 Ete(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(lw(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 s=t.substring(o,n);if(s!=Number(s)||t.charAt(n)!=="-")throw new Error("Illegal attachments");r.attachments=Number(s)}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 s=t.charAt(n);if(s==null||Number(s)!=s){--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(fw.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 x$(n);case $t.DISCONNECT:return n===void 0;case $t.CONNECT_ERROR:return typeof n=="string"||x$(n);case $t.EVENT:case $t.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&wte.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 Ete{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=Ste(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const kte=Object.freeze(Object.defineProperty({__proto__:null,Decoder:fw,Encoder:Cte,get PacketType(){return $t},protocol:xte},Symbol.toStringTag,{value:"Module"}));function Qi(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const Ate=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class C$ extends Hn{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=[Qi(t,"open",this.onopen.bind(this)),Qi(t,"packet",this.onpacket.bind(this)),Qi(t,"error",this.onerror.bind(this)),Qi(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(Ate.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 s={type:$t.EVENT,data:n};if(s.options={},s.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const p=this.ids++,h=n.pop();this._registerAckCallback(p,h),s.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(s),this.packet(s)):this.sendBuffer.push(s)),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),s=(...u)=>{this.io.clearTimeoutFn(o),n.apply(this,u)};s.withError=!0,this.acks[t]=s}emitWithAck(t,...n){return new Promise((r,i)=>{const o=(s,u)=>s?i(s):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 dw extends Hn{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,Iv(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||kte;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 pte(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=Qi(n,"open",function(){r.onopen(),t&&t()}),o=u=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",u),t?t(u):this.maybeReconnectOnOpen()},s=Qi(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(s),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Qi(t,"ping",this.onping.bind(this)),Qi(t,"data",this.ondata.bind(this)),Qi(t,"error",this.onerror.bind(this)),Qi(t,"close",this.onclose.bind(this)),Qi(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){Av(()=>{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 C$(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 Tv(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=gte(e,t.path||"/socket.io"),r=n.source,i=n.id,o=n.path,s=id[i]&&o in id[i].nsps,u=t.forceNew||t["force new connection"]||t.multiplex===!1||s;let c;return u?c=new dw(r,t):(id[i]||(id[i]=new dw(r,t)),c=id[i]),n.query&&!t.query&&(t.query=n.queryKey),c.socket(n.path,t)}Object.assign(Tv,{Manager:dw,Socket:C$,io:Tv,connect:Tv});const el=class el{constructor(){er(this,"socket",null);er(this,"isConnected",!1);er(this,"eventListeners",new Map)}static getInstance(){return el.instance||(el.instance=new el),el.instance}connect(t){return this.socket?this.socket:(this.socket=Tv(`${rZ}${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))}};er(el,"instance");let hw=el;const bo=hw.getInstance();var Ite={MESSAGE:"MESSAGE"},Rte={USER:"USER"};const Ote=({children:e,nameSpace:t})=>{const[n,r]=W.useState([]),[i,o]=W.useState(!1),[s,u]=W.useState(!1),[c,d]=W.useState([]),[p,h]=W.useState(!1),[m,v]=W.useState(!1),[_,x]=W.useState([]),[w,b]=W.useState(!1),C=$S("web-socket"),[E,k]=Tn.useState([]),[O,T]=W.useState(null),[L,B]=W.useState(!1),[z,N]=W.useState(null),G=fZ(),Q=ur(),[se,H]=W.useState(!1),[J,q]=Tn.useState(null),[V,fe]=W.useState(null);W.useEffect(()=>{if(C){const ie=bo.connect("/api/v1/chat");T(ie);const Fe=()=>{console.debug("connected to websocket"),B(!0)},we=()=>{console.debug("disconnected from websocket"),B(!1)},We=Pe=>{console.debug("response from websocket",Pe);const Se=Pe.conversationId??crypto.randomUUID();N(Se),Pe.Variants_quantity&&x(Ke=>[...Ke,...Pe.Variants_quantity]);const $e=[...n,{text:Pe.response,products:Pe.products,conversationId:Se,rating:"neutral",leading_queries:Pe.leading_queries,collections:Pe.collections,variants:Pe.variants,shop:Pe.shop,Variants_quantity:Pe.Variants_quantity,monthlyChatLimitReached:Pe.monthlyChatLimitReached,isBot:!0}];r($e),be($e),d(Ke=>[...Ke,[n[n.length-1].text,Pe.response]]),u(!1)},Qe=Pe=>{if(Pe.event==="error"){const Se={text:"I am facing some network issues. Can you please check your network and try again?",isBot:!0},$e=[...n,Se];r($e),be($e),u(!1)}};return bo.on("connect",Fe),bo.on("disconnect",we),bo.on("response",We),bo.on("system",Qe),()=>{bo.off("connect",Fe),bo.off("disconnect",we),bo.off("response",We),bo.off("system",Qe)}}},[C,n]);const be=ie=>{sessionStorage.setItem(bi(window.DebalesChat.projectId,mi.CHAT_HISTORY),JSON.stringify(ie))},A=()=>{const ie=sessionStorage.getItem(bi(window.DebalesChat.projectId,mi.CHAT_HISTORY));return ie?JSON.parse(ie):[]},ne=W.useCallback(async()=>{var ie;if(t)try{o(!0);const Fe=await fetch(`${po}/api/wordpress/UiData?value=${t}`),we=await Fe.json();if(!Fe.ok)throw new Error("failed to fetch data"+we.error);const We=document.getElementById("debales-ai-assistant");We&&(We.style.zIndex=String(we.zIndex??2031483602)),fe(we),we!=null&&we.shopifyShopDomain&&qW(we.shopifyShopDomain).then($e=>{q($e)}),k(we.suggestedQuestions);const Qe=A(),Pe=Vi(),Se=!se&&((ie=we.pluginConfig)==null?void 0:ie.collectedUserInfo)&&(we.pluginConfig.collectedUserInfo.name||we.pluginConfig.collectedUserInfo.email||we.pluginConfig.collectedUserInfo.phone)&&!Pe;if(b(!!Se),Qe.length>0)r(Qe);else{const $e={text:we.initialMessage||"Hi, I am an AI Assistant. How can I help you?",isBot:!0};r([$e])}}catch(Fe){console.error(Fe)}finally{o(!1)}},[t,se]);W.useEffect(()=>{ne()},[ne]);const ce=W.useCallback(async(ie,Fe,we,We,Qe)=>{if(!ie||ie.trim()===""||s&&!we)return;if(w&&n.length<=1){v(!0);return}const Pe=Vi();let Se=[...n];We?We&&n.length<=2?(h(!0),Se=[]):h(!1):(Se.push({text:ie,isBot:!1}),h(!1));const $e=ur();u(!0);try{r(Se),be(Se);const Ke=await fetch(`${po}/api/wordpress/ChatWithBot`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:$e,userMessage:ie,nameSpace:t,chat_history:c,leading_queries:Qe,answer:Fe,products:we,userInfo:JSON.stringify(Pe),anonymousUserId:G,distinctId:Fs.getDistinctId(),timestamp:new Date().toISOString(),timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone})});if(!Ke.ok)throw new Error("Network response was not ok");const nt=await Ke.json(),yt=nt.conversationId??crypto.randomUUID();N(yt),nt.Variants_quantity&&x(P=>[...P,...nt.Variants_quantity]);const ut=[...Se,{text:nt.response,products:nt.products,conversationId:yt,rating:"neutral",leading_queries:nt.leading_queries,collections:nt.collections,variants:nt.variants,shop:nt.shop,Variants_quantity:nt.Variants_quantity,monthlyChatLimitReached:nt.monthlyChatLimitReached,isBot:!0}];r(ut),be(ut),d(P=>[...P,[ie,nt.response]])}catch(Ke){console.error(Ke);const nt={text:"I am facing some network issues. Can you please check your network and try again?",isBot:!0},yt=[...Se,nt];We||(r(yt),be(yt))}finally{u(!1)}},[n,s,c,t,G,w]),$=W.useCallback(ie=>{V&&fe(Fe=>Fe?{...Fe,mobileDisplayMode:ie}:null)},[V]),he=W.useCallback(async(ie,Fe,we,We,Qe)=>{if(!ie||ie.trim()===""||s&&!we)return;if(w&&n.length<=1){v(!0);return}const Pe=Vi();let Se=[...n];if(We?We&&n.length<=2?(h(!0),Se=[]):h(!1):(Se.push({text:ie,isBot:!1}),h(!1)),u(!0),r(Se),be(Se),O&&L){const $e={type:Ite.MESSAGE,role:Rte.USER,query:ie,nameSpace:t,leadingQueries:Qe,answer:Fe,products:we,userInfo:Pe,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,timestamp:new Date().toISOString(),sessionId:Q,anonymousUserId:G,distinctId:Fs.getDistinctId()};bo.emit("chat",$e)}else ce(ie,Fe,we,We,Qe)},[n,s,t,G,w,O,L,Q,ce]),Ne={sessionId:Q,messages:n,isLoading:i,isMessageLoading:s,isKlaviyoMessage:p,showUserInfoModel:m,pendingBulkItems:_,lastedBotmessageId:z,isFormClosedByUser:se,uiData:V,storeMetaData:J,suggestedQuestions:E,needUserInfo:w,onSendMessage:C?he:ce,setMessages:r,setIsLoading:o,setIsMessageLoading:u,setIsKlaviyoMessage:h,setShowUserInfoModel:v,setPendingBulkItems:x,setLastedBotmessageId:N,setIsFormClosedByUser:H,fetchUiInfo:ne,changeDisplayModel:$,saveConversation:be,loadConversation:A,setSuggestedQuestions:k,setNeedUserInfo:b};return D.jsx(nD.Provider,{value:Ne,children:e})};function Tte(e){const t=XS.getInstance().getAdapter();return D.jsx(Ote,{nameSpace:e.botId,children:D.jsx(DW,{apiKey:iZ,options:{capture_pageview:e.botId!=="burgerbaeclothing",capture_pageleave:e.botId!=="burgerbaeclothing",api_host:po+"/ingest",ui_host:"https://us.posthog.com",loaded:n=>{n.register({platform:Yf.detect(),project:e.botId,sessionId:ur()}),n.group("project",e.botId,{platform:Yf.detect()});const r=Vi();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($ee,{adapter:t,children:e.children})})})}function Mte(e){return D.jsx(Oee,{children:D.jsx(Tte,{botId:e.botId,children:D.jsx(Ree,{...e})})})}const Xo=new Map;function Mv(e){const{botId:t}=e;if(Xo.has(t))return console.warn(`Chatbot with botId "${t}" is already initialized. Skipping duplicate initialization.`),Xo.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=AC.createRoot(r);i.render(Tn.createElement(Mte,{botId:e.botId}));const o={container:r,unmount:()=>{if(i.unmount(),Xo.delete(t),r&&r.parentNode&&document.body.contains(r))try{r.parentNode.removeChild(r)}catch(s){console.warn("Error removing chatbot container:",s)}}};return Xo.set(t,o),o}typeof window<"u"&&(window.DebalesChatbotBrowser={init:Mv,destroy:e=>{const t=Xo.get(e);return t?(t.unmount(),!0):!1},isInitialized:e=>Xo.has(e),getInitializedBots:()=>Array.from(Xo.keys())});function E$(){document.querySelectorAll('[id="debales-ai-assistant"][data-bot-id]').forEach(n=>{const r=n.getAttribute("data-bot-id");r&&!Xo.has(r)&&Mv({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&&!Xo.has(r)&&Mv({botId:r})})}return typeof document<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",E$):E$()),Oo.initDebalesChatbot=Mv,Object.defineProperty(Oo,Symbol.toStringTag,{value:"Module"}),Oo}({});
2323
+ => User Action: Klaviyo form closed`}return""},it=at=>{at instanceof CustomEvent&&X(at)};return window.addEventListener("klaviyoForms",it),()=>{window.removeEventListener("klaviyoForms",it)}},[be,t,r]),W.useEffect(()=>{const X=he.current;return X?(X.addEventListener("scroll",K),()=>X.removeEventListener("scroll",K)):()=>{}},[K]);const[ea,tl]=W.useState(!1),ta=Q==="Highest"?"120px":Q==="Higher"?"60px":"15px",Oi=async()=>{try{const X=await fetch(`${po}/api/wordpress/support`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({chatid:ur()+e,nameSpace:e,userName:ut.name,userEmail:ut.email,userMessage:ut.message,tag:"support"})});if(X.ok)h(Ue=>[...Ue,{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,hideConfirmation:!0}]),console.log("Connected to support with existing user info:",Vi());else{const Ue=await X.json();console.error("Failed to connect to support:",Ue),h(it=>[...it,{text:"Sorry, we couldn't connect you to support at the moment.<br>Please try again later.",isBot:!0,hideConfirmation:!0}])}}catch{h(Ue=>[...Ue,{text:"Sorry, we couldn't connect you to support at the moment.<br>Please try again later.",isBot:!0,hideConfirmation:!0}])}},Gn=()=>{const X=Vi();X&&X.name&&X.email&&P({name:X==null?void 0:X.name,email:X==null?void 0:X.email,message:""}),h(Ue=>[...Ue,{text:"Please provide your name, email and message to connect with support.",isBot:!0,hideConfirmation:!1}]),yt(!0)},rr=async X=>{X.preventDefault(),qp({name:ut.name,email:ut.email}),yt(!1),h(Ue=>Ue.slice(0,-1)),await Oi()};return!t||t.show_bot===!1||o?null:D.jsxs(Iz,{theme:oZ(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(See,{}),!J&&(Pr==null?void 0:Pr.length)!==0&&D.jsx(bee,{className:We?"visible":"",$botId:e,$iconSize:B,$removeLogoBackground:t.removeLogoBackground,topOffset:ta,style:{right:N?"auto":"24px",left:N?"24px":"auto",display:"flex",flexDirection:"column",alignItems:N?"flex-start":"flex-end"},children:Pr.map((X,Ue)=>{if(Array.isArray(X)){const it=X.map(at=>({question:at.question,isHighlighted:at.isHighlighted??!1})).filter(at=>!ie.has(at.question));return D.jsx(n$,{$index:Ue,$totalCount:Pr.length,children:D.jsx(XK,{messages:it,botId:e,uiData:t,onClick:at=>{const De=X.find(St=>St.question===at);we(!0,"suggested_question_clicked"),Fe(St=>{const Mt=new Set(St);return Mt.add(at),Mt}),window.DebalesChat.track(un.SUGGESTED_QUESTION_CLICKED,{suggested_question:De}),!E&&De?r((De==null?void 0:De.Follow_up_Question)??De.question,De==null?void 0:De.answer,De==null?void 0:De.products,!1,De==null?void 0:De.leading_queries):(C(!0),Se(De))}})},Ue)}else return D.jsx(n$,{$index:Ue,$totalCount:Pr.length,children:D.jsx(KK,{value:`${X.question}`,index:Ue,botId:e,uiData:t,onClose:()=>{Fe(it=>{const at=new Set(it);return at.add(X.question),at})},onClick:()=>{we(!0,"suggested_question_clicked"),Fe(it=>{const at=new Set(it);return at.add(X.question),at}),window.DebalesChat.track(un.SUGGESTED_QUESTION_CLICKED,{suggested_question:X}),E?(C(!0),Se(X)):r(X.Follow_up_Question??X.question,X.answer,X.products,!1,X.leading_queries)},isHighlighted:X.isHighlighted??!1})},Ue)})}),D.jsxs(tee,{$topOffset:ta,$removeLogoBackground:t.removeLogoBackground,style:{display:J?"none":"inline-flex",right:N?"auto":"24px",left:N?"24px":"auto"},children:[D.jsx(nee,{$showAnimation:t.enableChatButtonBackgroundAnimation??!1,$animationType:"Ping",$animationColor:t.chatButtonBackgroundAnimationColor||"#f48722",$backgroundColor:t.backgroundColor||"#fff",$removeLogoBackground:t.removeLogoBackground,$topOffset:ta,$iconSize:B}),D.jsx(ree,{$backgroundColor:t.removeLogoBackground?"transparent":t.backgroundColor||"#fff",$botId:e,$iconSize:B,$removeLogoBackground:t.removeLogoBackground,topOffset:ta,$showAnimation:t.enableChatButtonBackgroundAnimation,$animationType:"Ping",$animationColor:t.chatButtonBackgroundAnimationColor||"#f48722",id:"debales-chat-button",onClick:()=>{if(window.DebalesChat.track(un.CHAT_BUTTON_CLICKED),we(!J,"chat_button_clicked"),!J){const X=_();X.length>0&&h(X)}},"aria-label":"Chat",style:{display:J?"none":"inline-flex",right:N?"auto":"24px",left:N?"24px":"auto"},children:D.jsx(iee,{$botId:e,$removeLogoBackground:t.removeLogoBackground,"aria-hidden":"true",src:t.bot_logo,alt:"Chat Bot Icon"})})]}),J&&d5.createPortal(D.jsx(D.Fragment,{children:D.jsxs(cee,{$backgroundColor:t.backgroundColor||"#fff",$fullScreenOnMobile:t.fullScreenOnMobile,$headerFontColor:t.headerFontColor||"#1C1C1C",$isLeft:N,$topOffset:ta,$mobileDisplayMode:t.mobileDisplayMode,$isVisible:V,children:[D.jsxs(fee,{$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(oee,{"aria-hidden":"true",src:t.bot_logo,alt:"Chat Bot Icon"}),D.jsxs(aee,{$botNameColor:t.headerFontColor,children:[D.jsxs("div",{style:{fontWeight:"700",wordBreak:"break-word"},children:[t.chatbotName,e==="catch-org-ai"&&D.jsx(lee,{$backgroundColor:t.callToActionBackgroundColor,$fontColor:t.callToActionFontColor,children:"Beta"})]}),D.jsx(see,{children:D.jsx(AK,{})})]})]}),D.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[D.jsxs(wee,{children:[D.jsxs(xee,{onClick:Gn,children:[D.jsx(RK,{color:t.headerFontColor}),D.jsx(Cee,{children:"Support"})]}),D.jsx(r$,{children:"Need more help? I'll connect you with a support agent."})]}),(t.mobileDisplayMode==="half-screen"||t.mobileDisplayMode==="full-screen")&&se&&D.jsx("button",{onClick:()=>{const X=t.mobileDisplayMode==="full-screen"?"half-screen":"full-screen";v(X)},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(uee,{onClick:()=>{F?je(!0):we(!1,"close_button_clicked")},id:"debales-minimize-button","aria-label":"Minimize",children:D.jsx(qS,{botNameColor:t.headerFontColor})})]})]}),D.jsxs(hee,{$backgroundColor:t.botBackgroundColor||"#fff",$mobileDisplayMode:t.mobileDisplayMode,children:[ea&&((na=(Ji=t.pluginConfig)==null?void 0:Ji.collectedUserInfo)==null?void 0:na.discount)&&D.jsx(WK,{discount:t.pluginConfig.collectedUserInfo.discount,uiData:t,onClose:()=>{tl(!1),window.DebalesChat.track(un.DISCOUNT_VIEWED,{discount:t.pluginConfig.collectedUserInfo.discount})}}),D.jsx(ZJ,{uidata:t,product:_t,showModel:mn,setShowModel:rt,onVariantSelect:X=>{O(X.id,1),window.DebalesChat.track(un.ADD_TO_CART_CLICKED,{product:X.title,price:Number(X.price),link:`https://${t.shopifyShopDomain}/variants/${X.id}`,message:s,chatId:ur()+e})}}),At&&D.jsx(dQ,{setShowExitModal:je,handleCloseChatbot:So,chatId:ur()+e}),D.jsxs(dee,{id:"debales-conversation-group",$botBackgroundColor:t.botBackgroundColor||"#fff",ref:he,$mobileDisplayMode:t.mobileDisplayMode,children:[c.map((X,Ue)=>{const it=X.isBot,at=dZ(X.text);return X.hideConfirmation?null:D.jsxs(W.Fragment,{children:[it&&D.jsxs(J4,{$fontColor:t.botFontColor||"#000",$botMessageColor:t.botBackgroundColor||"#fff",children:[D.jsx("img",{src:it?t.bot_logo:t.userMessage_logo,alt:"Chat User Icon"}),D.jsxs(t$,{children:[at.map(De=>D.jsx("div",{children:D.jsx(nd,{$botMessageColor:it?t.botMessageColor||"#fff":t.userMessageColor||"#fff",style:{color:t.botFontColor},children:D.jsx(YE,{remarkPlugins:[EU,PW],children:De})})})),X.collections&&s===X.conversationId&&Y.collections&&D.jsx(UK,{message:X,botId:e,uidata:t,onSendMessage:r,loading:d}),X.products&&s===X.conversationId&&Y.products&&D.jsx(TQ,{message:X,botId:e,uidata:t,onSendMessage:r,loading:d,storeMetaData:n,platform:z,setShowVariantModel:rt,setSelectedProduct:Xi,setCartVersion:$}),i&&D.jsx(YS,{children:D.jsx(J3,{onClick:()=>{window._klOnsite&&(window._klOnsite.push(["openForm",ne]),we(!1,"klaviyo_grab_deal_button"))},children:"🚀 Grab Deal Now!"})}),c.length==1&&Ue==0&&!b&&D.jsx(YS,{children:wo.map(De=>Array.isArray(De)?De[0]:De).map((De,St)=>D.jsx(e$,{style:{backgroundColor:t.callToActionBackgroundColor,color:t.callToActionFontColor},onClick:()=>{r(De.question,De.answer,De.products),Fe(Mt=>{const Vn=new Set(Mt);return Vn.add(De.question),Vn}),window.DebalesChat.track(un.INITIAL_LEADING_QUERY_SUGGESTED_QUESTION_CLICKED,{question:De.question})},disabled:d,$disabled:d,children:De.question},St))}),X.leading_queries&&X.leading_queries.length>0&&s===X.conversationId&&Y.leadingQueries&&!i&&!b&&D.jsx(YS,{children:X.leading_queries.map((De,St)=>D.jsx(e$,{style:{backgroundColor:t.callToActionBackgroundColor,color:t.callToActionFontColor},onClick:()=>{r(De),window.DebalesChat.track(un.LEADING_QUERY_CLICKED,{query:De})},disabled:d,$disabled:d,children:De},St))}),k&&k.itemCount>0&&s===X.conversationId&&Y.cartSummary&&D.jsxs(vee,{children:[D.jsx(nd,{$botMessageColor:t.botMessageColor,style:{width:"max-content",color:t.botFontColor},dangerouslySetInnerHTML:{__html:`<span style="display: flex; align-items: center; justify-content: center;">Total Price: ${jW((k==null?void 0:k.total)??0,(k==null?void 0:k.currency)??"USD")} </span>`}}),D.jsxs(UW,{href:T(t.shopifyShopDomain??""),onClick:Ja,children:[D.jsx("span",{children:"Checkout"}),D.jsx(EK,{style:{width:"20px",fill:t.callToActionFontColor}})]})]}),$e&&$e.length>0&&s===X.conversationId&&Y.bulkItems&&D.jsx(FW,{onClick:()=>Ri(X.conversationId),children:"Add Bulk Items to Cart"}),b&&c.indexOf(X)===c.length-1&&D.jsx(D.Fragment,{children:D.jsx($J,{uidata:t,botName:t.chatbotName,botId:e,showModel:b,setShowModel:De=>{var Mt,Vn;const St=typeof De=="function"?De(b):De;C(St),!St&&((Vn=(Mt=t.pluginConfig)==null?void 0:Mt.collectedUserInfo)!=null&&Vn.discount)&&tl(!0)},selectedSuggestedQuestionAnswer:Pe,sendMessage:r,botNameColor:t.headerFontColor,inChat:!0,showFormInstructions:!1})}),nt&&c.indexOf(X)===c.length-1&&D.jsxs(Eee,{onSubmit:rr,children:[D.jsxs(WS,{children:[D.jsxs(KS,{children:["Name",D.jsx("span",{children:"*"})]}),D.jsx(i$,{type:"text",required:!0,value:ut.name,onChange:De=>P(St=>({...St,name:De.target.value})),placeholder:"John"})]}),D.jsxs(WS,{children:[D.jsxs(KS,{children:["Email",D.jsx("span",{children:"*"})]}),D.jsx(i$,{type:"email",required:!0,value:ut.email,onChange:De=>P(St=>({...St,email:De.target.value})),placeholder:"olivia@untitledui.com"})]}),D.jsxs(WS,{children:[D.jsxs(KS,{children:["Message",D.jsx("span",{children:"*"})]}),D.jsx(kee,{required:!0,value:ut.message,onChange:De=>P(St=>({...St,message:De.target.value})),placeholder:"I need help with..."})]}),D.jsx(Iee,{children:D.jsx(Aee,{type:"submit",children:"Submit"})})]}),_e&&!d&&s===X.conversationId&&D.jsx(nd,{$botMessageColor:t.botMessageColor,style:{color:t.botFontColor},children:D.jsx(vD,{loading:_e,loadingPhrases:["🎨 Loading","✨ Almost","🚀 Ready"]})})]})]}),!it&&D.jsx(yee,{$fontColor:t.userFontColor||"#000",$botMessageColor:t.botBackgroundColor||"#fff",children:D.jsx(nd,{$botMessageColor:it?t.botMessageColor||"#fff":t.userMessageColor||"#fff",children:D.jsx(YE,{children:X.text})})})]},Ue)}),d&&D.jsxs(J4,{$fontColor:t.botFontColor||"#000",$botMessageColor:t.botBackgroundColor||"#fff",children:[D.jsx("img",{src:t.bot_logo,alt:"Chat User Icon"}),D.jsx(t$,{children:D.jsx(nd,{$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(vD,{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(mee,{children:D.jsx("span",{children:'"Catch org AI" can make mistakes.'})}),D.jsx("div",{children:D.jsx(XJ,{uiData:t,onSendMessage:r,disabled:d,inputState:!1})}),(t.debales_branding??!0)&&D.jsxs(pee,{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(gee,{children:[D.jsx("img",{src:`${po}/images/debales_logo_d.png`,alt:"Debales logo"}),D.jsx("p",{children:"DEBALES"})]})]})]})]})]})}),G.shadowRoot)]})},o$="debales-ai-assistant",a$="debales-chatbot-container",Oee=W.forwardRef(({children:e,globalStyles:t="",containerStyles:n={},onReady:r},i)=>{const o=W.useRef(null),[s,u]=W.useState(null),c=W.useRef(null),d=W.useRef(null),p=W.useRef({get shadowRoot(){return c.current},get container(){return s},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 W.useImperativeHandle(i,()=>p.current,[]),W.useEffect(()=>{const h=document.getElementById(o$);if(h?o.current=h:o.current&&(o.current.id=o$),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(`#${a$}`);_&&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=a$,v.style.cssText="position: absolute; top: 0; left: 0; width: 0; height: 0;",m.appendChild(v),u(v),r&&r(m,v)}},[t,r]),W.useEffect(()=>(s&&!d.current&&(d.current=AC.createRoot(s)),d.current&&s&&d.current.render(D.jsx(xz,{target:s,children:D.jsx(tD,{value:p.current,children:e})})),()=>{d.current&&d.current.unmount()}),[s,e]),D.jsx("div",{ref:o,style:n})});class QS{isSupported(){return Yf.detect()===this.platform}createSuccessResult(t,n){return{success:!0,data:t,message:n}}createErrorResult(t){return{success:!1,error:t}}}class Tee extends QS{constructor(){super(...arguments);er(this,"platform",hr.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 Mee extends QS{constructor(){var n,r;super();er(this,"platform",hr.SHOPIFY);er(this,"cartEndpoint");er(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=xv(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=ur()}){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:ur(),dbls_method:"add_to_cart"}})}),s=await o.json();if(!o.ok){const u=s;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:ur(),...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=xv(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]",ur()),i.searchParams.append("timestamp",Date.now().toString()),Xs(i.toString())}}class Dee extends QS{constructor(){var n,r;super();er(this,"platform",hr.MAGENTO);er(this,"checkoutEndpoint");er(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 s=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(!s.ok)return this.createErrorResult(`Failed to add item to cart: ${s.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=xv(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(){er(this,"adapterCache");this.adapterCache=new Map}static getInstance(){return Js.instance||(Js.instance=new Js),Js.instance}getAdapter(t){const n=t||Yf.detect(),r=this.adapterCache.get(n);if(r)return r;let i;switch(n){case hr.SHOPIFY:i=new Mee;break;case hr.MAGENTO:i=new Dee;break;default:console.warn(`No specific adapter found for platform ${n}, using default adapter`),i=new Tee}return this.adapterCache.set(n,i),i}clearCache(){this.adapterCache.clear()}};er(Js,"instance");let XS=Js;const $ee=({adapter:e,children:t,autoFetch:n=!0})=>{const[r,i]=W.useState(!1),[o,s]=W.useState(null),[u,c]=W.useState(null),d=W.useCallback(async()=>{try{i(!0),s(null);const C=await e.fetchCart();C.success?c(C.data):s(C.error)}catch(C){s(C instanceof Error?C.message:"Failed to fetch cart")}finally{i(!1)}},[e]),p=async(C,E,k)=>{try{s(null);const O=await e.addToCart(C,E,k);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{s(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{s(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{s(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),w=async C=>e.addCartAttributes(C);W.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:w};return D.jsx(lT.Provider,{value:b,children:t})},yo=Object.create(null);yo.open="0",yo.close="1",yo.ping="2",yo.pong="3",yo.message="4",yo.upgrade="5",yo.noop="6";const Cv=Object.create(null);Object.keys(yo).forEach(e=>{Cv[yo[e]]=e});const JS={type:"error",data:"parser error"},s$=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",l$=typeof ArrayBuffer=="function",u$=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,ew=({type:e,data:t},n,r)=>s$&&t instanceof Blob?n?r(t):c$(t,r):l$&&(t instanceof ArrayBuffer||u$(t))?n?r(t):c$(new Blob([t]),r):r(yo[e]+(t||"")),c$=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function f$(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let tw;function Lee(e,t){if(s$&&e.data instanceof Blob)return e.data.arrayBuffer().then(f$).then(t);if(l$&&(e.data instanceof ArrayBuffer||u$(e.data)))return t(f$(e.data));ew(e,!1,n=>{tw||(tw=new TextEncoder),t(tw.encode(n))})}const d$="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",rd=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<d$.length;e++)rd[d$.charCodeAt(e)]=e;const Nee=e=>{let t=e.length*.75,n=e.length,r,i=0,o,s,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)],s=rd[e.charCodeAt(r+1)],u=rd[e.charCodeAt(r+2)],c=rd[e.charCodeAt(r+3)],p[i++]=o<<2|s>>4,p[i++]=(s&15)<<4|u>>2,p[i++]=(u&3)<<6|c&63;return d},Pee=typeof ArrayBuffer=="function",nw=(e,t)=>{if(typeof e!="string")return{type:"message",data:h$(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:Bee(e.substring(1),t)}:Cv[n]?e.length>1?{type:Cv[n],data:e.substring(1)}:{type:Cv[n]}:JS},Bee=(e,t)=>{if(Pee){const n=Nee(e);return h$(n,t)}else return{base64:!0,data:e}},h$=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},p$="",Fee=(e,t)=>{const n=e.length,r=new Array(n);let i=0;e.forEach((o,s)=>{ew(o,!1,u=>{r[s]=u,++i===n&&t(r.join(p$))})})},Uee=(e,t)=>{const n=e.split(p$),r=[];for(let i=0;i<n.length;i++){const o=nw(n[i],t);if(r.push(o),o.type==="error")break}return r};function zee(){return new TransformStream({transform(e,t){Lee(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 rw;function Ev(e){return e.reduce((t,n)=>t+n.length,0)}function kv(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 qee(e,t){rw||(rw=new TextDecoder);const n=[];let r=0,i=-1,o=!1;return new TransformStream({transform(s,u){for(n.push(s);;){if(r===0){if(Ev(n)<1)break;const c=kv(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(Ev(n)<2)break;const c=kv(n,2);i=new DataView(c.buffer,c.byteOffset,c.length).getUint16(0),r=3}else if(r===2){if(Ev(n)<8)break;const c=kv(n,8),d=new DataView(c.buffer,c.byteOffset,c.length),p=d.getUint32(0);if(p>Math.pow(2,21)-1){u.enqueue(JS);break}i=p*Math.pow(2,32)+d.getUint32(4),r=3}else{if(Ev(n)<i)break;const c=kv(n,i);u.enqueue(nw(o?c:rw.decode(c),t)),r=0}if(i===0||i>e){u.enqueue(JS);break}}}})}const g$=4;function Hn(e){if(e)return jee(e)}function jee(e){for(var t in Hn.prototype)e[t]=Hn.prototype[t];return e}Hn.prototype.on=Hn.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},Hn.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},Hn.prototype.off=Hn.prototype.removeListener=Hn.prototype.removeAllListeners=Hn.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},Hn.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},Hn.prototype.emitReserved=Hn.prototype.emit,Hn.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},Hn.prototype.hasListeners=function(e){return!!this.listeners(e).length};const Av=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0),Ai=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Hee="arraybuffer";function Jre(){}function m$(e,...t){return t.reduce((n,r)=>(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const Gee=Ai.setTimeout,Vee=Ai.clearTimeout;function Iv(e,t){t.useNativeTimers?(e.setTimeoutFn=Gee.bind(Ai),e.clearTimeoutFn=Vee.bind(Ai)):(e.setTimeoutFn=Ai.setTimeout.bind(Ai),e.clearTimeoutFn=Ai.clearTimeout.bind(Ai))}const Zee=1.33;function Yee(e){return typeof e=="string"?Wee(e):Math.ceil((e.byteLength||e.size)*Zee)}function Wee(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 v$(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Kee(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function Qee(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 Xee extends Error{constructor(t,n,r){super(t),this.description=n,this.context=r,this.type="TransportError"}}class iw extends Hn{constructor(t){super(),this.writable=!1,Iv(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 Xee(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=nw(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=Kee(t);return n.length?"?"+n:""}}class Jee extends iw{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)};Uee(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,Fee(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]=v$()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}}let y$=!1;try{y$=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const ete=y$;function tte(){}class nte extends Jee{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 _o extends Hn{constructor(t,n,r){super(),this.createRequest=t,Iv(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=m$(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=_o.requestsCount++,_o.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=tte,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete _o.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(_o.requestsCount=0,_o.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",_$);else if(typeof addEventListener=="function"){const e="onpagehide"in Ai?"pagehide":"unload";addEventListener(e,_$,!1)}}function _$(){for(let e in _o.requests)_o.requests.hasOwnProperty(e)&&_o.requests[e].abort()}const rte=function(){const e=b$({xdomain:!1});return e&&e.responseType!==null}();class ite extends nte{constructor(t){super(t);const n=t&&t.forceBase64;this.supportsBinary=rte&&!n}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new _o(b$,this.uri(),t)}}function b$(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||ete))return new XMLHttpRequest}catch{}if(!t)try{return new Ai[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const S$=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class ote extends iw{get name(){return"websocket"}doOpen(){const t=this.uri(),n=this.opts.protocols,r=S$?{}:m$(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;ew(r,this.supportsBinary,o=>{try{this.doWrite(r,o)}catch{}i&&Av(()=>{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]=v$()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}}const ow=Ai.WebSocket||Ai.MozWebSocket;class ate extends ote{createSocket(t,n,r){return S$?new ow(t,n,r):n?new ow(t,n):new ow(t)}doWrite(t,n){this.ws.send(n)}}class ste extends iw{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=qee(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(n).getReader(),i=zee();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 s={type:"open"};this.query.sid&&(s.data=`{"sid":"${this.query.sid}"}`),this._writer.write(s).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&&Av(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const lte={websocket:ate,webtransport:ste,polling:ite},ute=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,cte=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function aw(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=ute.exec(e||""),o={},s=14;for(;s--;)o[cte[s]]=i[s]||"";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=fte(o,o.path),o.queryKey=dte(o,o.query),o}function fte(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 dte(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,o){i&&(n[i]=o)}),n}const sw=typeof addEventListener=="function"&&typeof removeEventListener=="function",Rv=[];sw&&addEventListener("offline",()=>{Rv.forEach(e=>e())},!1);class Xa extends Hn{constructor(t,n){if(super(),this.binaryType=Hee,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=aw(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=aw(n.host).host);Iv(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=Qee(this.opts.query)),sw&&(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"})},Rv.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=g$,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&&Xa.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",Xa.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+=Yee(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,Av(()=>{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(Xa.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(),sw&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=Rv.indexOf(this._offlineEventListener);r!==-1&&Rv.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this._prevBufferLen=0}}}Xa.protocol=g$;class hte extends Xa{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;Xa.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;Xa.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 s=h=>{const m=new Error("probe error: "+h);m.transport=n.name,o(),this.emitReserved("upgradeError",m)};function u(){s("transport closed")}function c(){s("socket closed")}function d(h){n&&h.name!==n.name&&o()}const p=()=>{n.removeListener("open",i),n.removeListener("error",s),n.removeListener("close",u),this.off("close",c),this.off("upgrading",d)};n.once("open",i),n.once("error",s),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 pte=class extends hte{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=>lte[i]).filter(i=>!!i)),super(t,r)}};function gte(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=aw(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 mte=typeof ArrayBuffer=="function",vte=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,w$=Object.prototype.toString,yte=typeof Blob=="function"||typeof Blob<"u"&&w$.call(Blob)==="[object BlobConstructor]",_te=typeof File=="function"||typeof File<"u"&&w$.call(File)==="[object FileConstructor]";function lw(e){return mte&&(e instanceof ArrayBuffer||vte(e))||yte&&e instanceof Blob||_te&&e instanceof File}function Ov(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n<r;n++)if(Ov(e[n]))return!0;return!1}if(lw(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return Ov(e.toJSON(),!0);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&Ov(e[n]))return!0;return!1}function bte(e){const t=[],n=e.data,r=e;return r.data=uw(n,t),r.attachments=t.length,{packet:r,buffers:t}}function uw(e,t){if(!e)return e;if(lw(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]=uw(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]=uw(e[r],t));return n}return e}function Ste(e,t){return e.data=cw(e.data,t),delete e.attachments,e}function cw(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]=cw(e[n],t);else if(typeof e=="object")for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=cw(e[n],t));return e}const wte=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],xte=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 Cte{constructor(t){this.replacer=t}encode(t){return(t.type===$t.EVENT||t.type===$t.ACK)&&Ov(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=bte(t),r=this.encodeAsString(n.packet),i=n.buffers;return i.unshift(r),i}}function x$(e){return Object.prototype.toString.call(e)==="[object Object]"}class fw extends Hn{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 Ete(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(lw(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 s=t.substring(o,n);if(s!=Number(s)||t.charAt(n)!=="-")throw new Error("Illegal attachments");r.attachments=Number(s)}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 s=t.charAt(n);if(s==null||Number(s)!=s){--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(fw.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 x$(n);case $t.DISCONNECT:return n===void 0;case $t.CONNECT_ERROR:return typeof n=="string"||x$(n);case $t.EVENT:case $t.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&wte.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 Ete{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=Ste(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const kte=Object.freeze(Object.defineProperty({__proto__:null,Decoder:fw,Encoder:Cte,get PacketType(){return $t},protocol:xte},Symbol.toStringTag,{value:"Module"}));function Qi(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const Ate=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class C$ extends Hn{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=[Qi(t,"open",this.onopen.bind(this)),Qi(t,"packet",this.onpacket.bind(this)),Qi(t,"error",this.onerror.bind(this)),Qi(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(Ate.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 s={type:$t.EVENT,data:n};if(s.options={},s.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const p=this.ids++,h=n.pop();this._registerAckCallback(p,h),s.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(s),this.packet(s)):this.sendBuffer.push(s)),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),s=(...u)=>{this.io.clearTimeoutFn(o),n.apply(this,u)};s.withError=!0,this.acks[t]=s}emitWithAck(t,...n){return new Promise((r,i)=>{const o=(s,u)=>s?i(s):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 dw extends Hn{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,Iv(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||kte;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 pte(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=Qi(n,"open",function(){r.onopen(),t&&t()}),o=u=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",u),t?t(u):this.maybeReconnectOnOpen()},s=Qi(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(s),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Qi(t,"ping",this.onping.bind(this)),Qi(t,"data",this.ondata.bind(this)),Qi(t,"error",this.onerror.bind(this)),Qi(t,"close",this.onclose.bind(this)),Qi(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){Av(()=>{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 C$(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 Tv(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=gte(e,t.path||"/socket.io"),r=n.source,i=n.id,o=n.path,s=id[i]&&o in id[i].nsps,u=t.forceNew||t["force new connection"]||t.multiplex===!1||s;let c;return u?c=new dw(r,t):(id[i]||(id[i]=new dw(r,t)),c=id[i]),n.query&&!t.query&&(t.query=n.queryKey),c.socket(n.path,t)}Object.assign(Tv,{Manager:dw,Socket:C$,io:Tv,connect:Tv});const el=class el{constructor(){er(this,"socket",null);er(this,"isConnected",!1);er(this,"eventListeners",new Map)}static getInstance(){return el.instance||(el.instance=new el),el.instance}connect(t){return this.socket?this.socket:(this.socket=Tv(`${rZ}${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))}};er(el,"instance");let hw=el;const bo=hw.getInstance();var Ite={MESSAGE:"MESSAGE"},Rte={USER:"USER"};const Ote=({children:e,nameSpace:t})=>{const[n,r]=W.useState([]),[i,o]=W.useState(!1),[s,u]=W.useState(!1),[c,d]=W.useState([]),[p,h]=W.useState(!1),[m,v]=W.useState(!1),[_,x]=W.useState([]),[w,b]=W.useState(!1),C=$S("web-socket"),[E,k]=Tn.useState([]),[O,T]=W.useState(null),[L,B]=W.useState(!1),[z,N]=W.useState(null),G=fZ(),Q=ur(),[se,H]=W.useState(!1),[J,q]=Tn.useState(null),[V,fe]=W.useState(null);W.useEffect(()=>{if(C){const ie=bo.connect("/api/v1/chat");T(ie);const Fe=()=>{console.debug("connected to websocket"),B(!0)},we=()=>{console.debug("disconnected from websocket"),B(!1)},We=Pe=>{console.debug("response from websocket",Pe);const Se=Pe.conversationId??crypto.randomUUID();N(Se),Pe.Variants_quantity&&x(Ke=>[...Ke,...Pe.Variants_quantity]);const $e=[...n,{text:Pe.response,products:Pe.products,conversationId:Se,rating:"neutral",leading_queries:Pe.leading_queries,collections:Pe.collections,variants:Pe.variants,shop:Pe.shop,Variants_quantity:Pe.Variants_quantity,monthlyChatLimitReached:Pe.monthlyChatLimitReached,isBot:!0}];r($e),be($e),d(Ke=>[...Ke,[n[n.length-1].text,Pe.response]]),u(!1)},Qe=Pe=>{if(Pe.event==="error"){const Se={text:"I am facing some network issues. Can you please check your network and try again?",isBot:!0},$e=[...n,Se];r($e),be($e),u(!1)}};return bo.on("connect",Fe),bo.on("disconnect",we),bo.on("response",We),bo.on("system",Qe),()=>{bo.off("connect",Fe),bo.off("disconnect",we),bo.off("response",We),bo.off("system",Qe)}}},[C,n]);const be=ie=>{sessionStorage.setItem(bi(window.DebalesChat.projectId,mi.CHAT_HISTORY),JSON.stringify(ie))},A=()=>{const ie=sessionStorage.getItem(bi(window.DebalesChat.projectId,mi.CHAT_HISTORY));return ie?JSON.parse(ie):[]},ne=W.useCallback(async()=>{var ie;if(t)try{o(!0);const Fe=await fetch(`${po}/api/wordpress/UiData?value=${t}`),we=await Fe.json();if(!Fe.ok)throw new Error("failed to fetch data"+we.error);const We=document.getElementById("debales-ai-assistant");We&&(We.style.zIndex=String(we.zIndex??2031483602)),fe(we),we!=null&&we.shopifyShopDomain&&qW(we.shopifyShopDomain).then($e=>{q($e)}),k(we.suggestedQuestions);const Qe=A(),Pe=Vi(),Se=!se&&((ie=we.pluginConfig)==null?void 0:ie.collectedUserInfo)&&(we.pluginConfig.collectedUserInfo.name||we.pluginConfig.collectedUserInfo.email||we.pluginConfig.collectedUserInfo.phone)&&!Pe;if(b(!!Se),Qe.length>0)r(Qe);else{const $e={text:we.initialMessage||"Hi, I am an AI Assistant. How can I help you?",isBot:!0};r([$e])}}catch(Fe){console.error(Fe)}finally{o(!1)}},[t,se]);W.useEffect(()=>{ne()},[ne]);const ce=W.useCallback(async(ie,Fe,we,We,Qe)=>{if(!ie||ie.trim()===""||s&&!we)return;if(w&&n.length<=1){v(!0);return}const Pe=Vi();let Se=[...n];We?We&&n.length<=2?(h(!0),Se=[]):h(!1):(Se.push({text:ie,isBot:!1}),h(!1));const $e=ur();u(!0);try{r(Se),be(Se);const Ke=await fetch(`${po}/api/wordpress/ChatWithBot`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:$e,userMessage:ie,nameSpace:t,chat_history:c,leading_queries:Qe,answer:Fe,products:we,userInfo:JSON.stringify(Pe),anonymousUserId:G,distinctId:Fs.getDistinctId(),timestamp:new Date().toISOString(),timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone})});if(!Ke.ok)throw new Error("Network response was not ok");const nt=await Ke.json(),yt=nt.conversationId??crypto.randomUUID();N(yt),nt.Variants_quantity&&x(P=>[...P,...nt.Variants_quantity]);const ut=[...Se,{text:nt.response,products:nt.products,conversationId:yt,rating:"neutral",leading_queries:nt.leading_queries,collections:nt.collections,variants:nt.variants,shop:nt.shop,Variants_quantity:nt.Variants_quantity,monthlyChatLimitReached:nt.monthlyChatLimitReached,isBot:!0}];r(ut),be(ut),d(P=>[...P,[ie,nt.response]])}catch(Ke){console.error(Ke);const nt={text:"I am facing some network issues. Can you please check your network and try again?",isBot:!0},yt=[...Se,nt];We||(r(yt),be(yt))}finally{u(!1)}},[n,s,c,t,G,w]),$=W.useCallback(ie=>{V&&fe(Fe=>Fe?{...Fe,mobileDisplayMode:ie}:null)},[V]),he=W.useCallback(async(ie,Fe,we,We,Qe)=>{if(!ie||ie.trim()===""||s&&!we)return;if(w&&n.length<=1){v(!0);return}const Pe=Vi();let Se=[...n];if(We?We&&n.length<=2?(h(!0),Se=[]):h(!1):(Se.push({text:ie,isBot:!1}),h(!1)),u(!0),r(Se),be(Se),O&&L){const $e={type:Ite.MESSAGE,role:Rte.USER,query:ie,nameSpace:t,leadingQueries:Qe,answer:Fe,products:we,userInfo:Pe,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,timestamp:new Date().toISOString(),sessionId:Q,anonymousUserId:G,distinctId:Fs.getDistinctId()};bo.emit("chat",$e)}else ce(ie,Fe,we,We,Qe)},[n,s,t,G,w,O,L,Q,ce]),Ne={sessionId:Q,messages:n,isLoading:i,isMessageLoading:s,isKlaviyoMessage:p,showUserInfoModel:m,pendingBulkItems:_,lastedBotmessageId:z,isFormClosedByUser:se,uiData:V,storeMetaData:J,suggestedQuestions:E,needUserInfo:w,onSendMessage:C?he:ce,setMessages:r,setIsLoading:o,setIsMessageLoading:u,setIsKlaviyoMessage:h,setShowUserInfoModel:v,setPendingBulkItems:x,setLastedBotmessageId:N,setIsFormClosedByUser:H,fetchUiInfo:ne,changeDisplayModel:$,saveConversation:be,loadConversation:A,setSuggestedQuestions:k,setNeedUserInfo:b};return D.jsx(nD.Provider,{value:Ne,children:e})};function Tte(e){const t=XS.getInstance().getAdapter();return D.jsx(Ote,{nameSpace:e.botId,children:D.jsx(DW,{apiKey:iZ,options:{capture_pageview:e.botId!=="burgerbaeclothing",capture_pageleave:e.botId!=="burgerbaeclothing",api_host:po+"/ingest",ui_host:"https://us.posthog.com",loaded:n=>{n.register({platform:Yf.detect(),project:e.botId,sessionId:ur()}),n.group("project",e.botId,{platform:Yf.detect()});const r=Vi();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($ee,{adapter:t,children:e.children})})})}function Mte(e){return D.jsx(Oee,{children:D.jsx(Tte,{botId:e.botId,children:D.jsx(Ree,{...e})})})}const Xo=new Map;function Mv(e){const{botId:t}=e;if(Xo.has(t))return console.warn(`Chatbot with botId "${t}" is already initialized. Skipping duplicate initialization.`),Xo.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=AC.createRoot(r);i.render(Tn.createElement(Mte,{botId:e.botId}));const o={container:r,unmount:()=>{if(i.unmount(),Xo.delete(t),r&&r.parentNode&&document.body.contains(r))try{r.parentNode.removeChild(r)}catch(s){console.warn("Error removing chatbot container:",s)}}};return Xo.set(t,o),o}typeof window<"u"&&(window.DebalesChatbotBrowser={init:Mv,destroy:e=>{const t=Xo.get(e);return t?(t.unmount(),!0):!1},isInitialized:e=>Xo.has(e),getInitializedBots:()=>Array.from(Xo.keys())});function E$(){document.querySelectorAll('[id="debales-ai-assistant"][data-bot-id]').forEach(n=>{const r=n.getAttribute("data-bot-id");r&&!Xo.has(r)&&Mv({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&&!Xo.has(r)&&Mv({botId:r})})}return typeof document<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",E$):E$()),Oo.initDebalesChatbot=Mv,Object.defineProperty(Oo,Symbol.toStringTag,{value:"Module"}),Oo}({});