humanbehavior-js 0.7.0 β†’ 0.8.0-beta.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.
Files changed (39) hide show
  1. package/package.json +1 -1
  2. package/packages/browser/dist/cjs/index.js +6 -6
  3. package/packages/browser/dist/cjs/index.js.map +1 -1
  4. package/packages/browser/dist/esm/index.js +4 -4
  5. package/packages/browser/dist/esm/index.js.map +1 -1
  6. package/packages/browser/dist/index.min.js +1 -1
  7. package/packages/browser/dist/index.min.js.map +1 -1
  8. package/packages/core/dist/index.js +1 -1
  9. package/packages/core/dist/index.js.map +1 -1
  10. package/packages/core/dist/index.mjs +1 -1
  11. package/packages/core/dist/index.mjs.map +1 -1
  12. package/packages/core/dist/tracker.d.ts +12 -0
  13. package/packages/core/dist/tracker.d.ts.map +1 -1
  14. package/packages/react/dist/index.js +1 -1
  15. package/packages/react/dist/index.js.map +1 -1
  16. package/packages/react/dist/index.mjs +1 -1
  17. package/packages/react/dist/index.mjs.map +1 -1
  18. package/packages/wizard/dist/agent/claude-agent-installer.d.ts +17 -0
  19. package/packages/wizard/dist/agent/claude-agent-installer.d.ts.map +1 -0
  20. package/packages/wizard/dist/ai/ai-install-wizard.d.ts +2 -2
  21. package/packages/wizard/dist/ai/ai-install-wizard.d.ts.map +1 -1
  22. package/packages/wizard/dist/ai/manual-framework-wizard.d.ts +2 -2
  23. package/packages/wizard/dist/ai/manual-framework-wizard.d.ts.map +1 -1
  24. package/packages/wizard/dist/cli/ai-auto-install.d.ts +6 -0
  25. package/packages/wizard/dist/cli/ai-auto-install.d.ts.map +1 -1
  26. package/packages/wizard/dist/cli/ai-auto-install.js +641 -81
  27. package/packages/wizard/dist/cli/ai-auto-install.js.map +1 -1
  28. package/packages/wizard/dist/cli/auto-install.d.ts +4 -0
  29. package/packages/wizard/dist/cli/auto-install.d.ts.map +1 -1
  30. package/packages/wizard/dist/cli/auto-install.js +314 -56
  31. package/packages/wizard/dist/cli/auto-install.js.map +1 -1
  32. package/packages/wizard/dist/core/install-wizard.d.ts +51 -3
  33. package/packages/wizard/dist/core/install-wizard.d.ts.map +1 -1
  34. package/packages/wizard/dist/index.d.ts +2 -0
  35. package/packages/wizard/dist/index.d.ts.map +1 -1
  36. package/packages/wizard/dist/index.js +1 -1
  37. package/packages/wizard/dist/index.js.map +1 -1
  38. package/packages/wizard/dist/index.mjs +1 -1
  39. package/packages/wizard/dist/index.mjs.map +1 -1
@@ -1,2 +1,2 @@
1
- "undefined"!=typeof window&&(window.HumanBehaviorTracker=window.HumanBehaviorTracker||{},window.humanbehavior=window.humanbehavior||{},window.humanbehavior.init=window.HumanBehaviorTracker.init),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).HumanBehaviorTracker={})}(this,function(e){"use strict";var t,s=Object.defineProperty,r=(e,t,r)=>((e,t,r)=>t in e?s(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r),i=Object.defineProperty,n=(e,t,s)=>((e,t,s)=>t in e?i(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s)(e,"symbol"!=typeof t?t+"":t,s),o=(e=>(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))(o||{});const a={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},l={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},c={};function h(e){if(c[e])return c[e];const t=globalThis[e],s=t.prototype,r=e in a?a[e]:void 0,i=Boolean(r&&r.every(e=>{var t,r;return Boolean(null==(r=null==(t=Object.getOwnPropertyDescriptor(s,e))?void 0:t.get)?void 0:r.toString().includes("[native code]"))})),n=e in l?l[e]:void 0,o=Boolean(n&&n.every(e=>{var t;return"function"==typeof s[e]&&(null==(t=s[e])?void 0:t.toString().includes("[native code]"))}));if(i&&o&&!globalThis.Zone)return c[e]=t.prototype,t.prototype;try{const r=document.createElement("iframe");document.body.appendChild(r);const i=r.contentWindow;if(!i)return t.prototype;const n=i[e].prototype;return document.body.removeChild(r),n?c[e]=n:s}catch{return s}}const u={};function d(e,t,s){var r;const i=`${e}.${String(s)}`;if(u[i])return u[i].call(t);const n=h(e),o=null==(r=Object.getOwnPropertyDescriptor(n,s))?void 0:r.get;return o?(u[i]=o,o.call(t)):t[s]}const p={};function m(e,t,s){const r=`${e}.${String(s)}`;if(p[r])return p[r].bind(t);const i=h(e)[s];return"function"!=typeof i?t[s]:(p[r]=i,i.bind(t))}const f={ownerDocument:function(e){return d("Node",e,"ownerDocument")},childNodes:function(e){return d("Node",e,"childNodes")},parentNode:function(e){return d("Node",e,"parentNode")},parentElement:function(e){return d("Node",e,"parentElement")},textContent:function(e){return d("Node",e,"textContent")},contains:function(e,t){return m("Node",e,"contains")(t)},getRootNode:function(e){return m("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?d("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?d("Element",e,"shadowRoot"):null},querySelector:function(e,t){return d("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return d("Element",e,"querySelectorAll")(t)},mutationObserver:function(){return h("MutationObserver").constructor},patch:function(e,t,s){try{if(!(t in e))return()=>{};const r=e[t],i=s(r);return"function"==typeof i&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=i,()=>{e[t]=r}}catch{return()=>{}}}};function g(e){return e.nodeType===e.ELEMENT_NODE}function y(e){const t=e&&"host"in e&&"mode"in e&&f.host(e)||null;return Boolean(t&&"shadowRoot"in t&&f.shadowRoot(t)===e)}function w(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function v(e){try{const s=e.rules||e.cssRules;if(!s)return null;let r=e.href;!r&&e.ownerNode&&(r=e.ownerNode.baseURI);const i=Array.from(s,e=>S(e,r)).join("");return(t=i).includes(" background-clip: text;")&&!t.includes(" -webkit-background-clip: text;")&&(t=t.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),t}catch(e){return null}var t}function S(e,t){if(function(e){return"styleSheet"in e}(e)){let t;try{t=v(e.styleSheet)||function(e){const{cssText:t}=e;if(t.split('"').length<3)return t;const s=["@import",`url(${JSON.stringify(e.href)})`];return""===e.layerName?s.push("layer"):e.layerName&&s.push(`layer(${e.layerName})`),e.supportsText&&s.push(`supports(${e.supportsText})`),e.media.length&&s.push(e.media.mediaText),s.join(" ")+";"}(e)}catch(s){t=e.cssText}return e.styleSheet.href?A(t,e.styleSheet.href):t}{let s=e.cssText;return function(e){return"selectorText"in e}(e)&&e.selectorText.includes(":")&&(s=function(e){const t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}(s)),t?A(s,t):s}}class b{constructor(){n(this,"idNodeMap",new Map),n(this,"nodeMetaMap",new WeakMap)}getId(e){var t;if(!e)return-1;return(null==(t=this.getMeta(e))?void 0:t.id)??-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach(e=>this.removeNodeFromMap(e))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const s=t.id;this.idNodeMap.set(s,e),this.nodeMetaMap.set(e,t)}replace(e,t){const s=this.getNode(e);if(s){const e=this.nodeMetaMap.get(s);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function C({element:e,maskInputOptions:t,tagName:s,type:r,value:i,maskInputFn:n}){let o=i||"";const a=r&&k(r);return(t[s.toLowerCase()]||a&&t[a])&&(o=n?n(o,e):"*".repeat(o.length)),o}function k(e){return e.toLowerCase()}const I="__rrweb_original__";function E(e){const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?k(t):null}function T(e,t){let s;try{s=new URL(e,t??window.location.href)}catch(e){return null}const r=s.pathname.match(/\.([0-9a-z]+)(?:$)/i);return(null==r?void 0:r[1])??null}const x=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,_=/^(?:[a-z+]+:)?\/\//i,M=/^www\..*/i,O=/^(data:)([^,]*),(.*)/i;function A(e,t){return(e||"").replace(x,(e,s,r,i,n,o)=>{const a=r||n||o,l=s||i||"";if(!a)return e;if(_.test(a)||M.test(a))return`url(${l}${a}${l})`;if(O.test(a))return`url(${l}${a}${l})`;if("/"===a[0])return`url(${l}${function(e){let t="";return t=e.indexOf("//")>-1?e.split("/").slice(0,3).join("/"):e.split("/")[0],t=t.split("?")[0],t}(t)+a}${l})`;const c=t.split("/"),h=a.split("/");c.pop();for(const e of h)"."!==e&&(".."===e?c.pop():c.push(e));return`url(${l}${c.join("/")}${l})`})}function R(e,t=!1){return t?e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,""):e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"").replace(/0px/g,"0")}function D(e,t){return function(e,t,s=!1){const r=Array.from(t.childNodes),i=[];let n=0;if(r.length>1&&e&&"string"==typeof e){let t=R(e,s);const o=t.length/e.length;for(let a=1;a<r.length;a++)if(r[a].textContent&&"string"==typeof r[a].textContent){const l=R(r[a].textContent,s),c=100;let h=3;for(;h<l.length&&(l[h].match(/[a-zA-Z0-9]/)||-1!==l.indexOf(l.substring(0,h),1));h++);for(;h<l.length;h++){let u=l.substring(0,h),d=t.split(u),p=-1;if(2===d.length)p=d[0].length;else if(d.length>2&&""===d[0]&&""!==r[a-1].textContent)p=t.indexOf(u,1);else if(1===d.length){if(u=u.substring(0,u.length-1),d=t.split(u),d.length<=1)return i.push(e),i;h=c+1}else h===l.length-1&&(p=t.indexOf(u));if(d.length>=2&&h>c){const e=r[a-1].textContent;if(e&&"string"==typeof e){const s=R(e).length;p=t.indexOf(u,s)}-1===p&&(p=d[0].length)}if(-1!==p){let a=Math.floor(p/o);for(;a>0&&a<e.length;){if(n+=1,n>50*r.length)return i.push(e),i;const l=R(e.substring(0,a),s);if(l.length===p){i.push(e.substring(0,a)),e=e.substring(a),t=t.substring(p);break}l.length<p?a+=Math.max(1,Math.floor((p-l.length)/o)):a-=Math.max(1,Math.floor((l.length-p)*o))}break}}}}return i.push(e),i}(e,t).join("/* rr_split */")}let P=1;const L=new RegExp("[^a-z0-9-_:]");function N(){return P++}let F,U;const B=/^[^ \t\n\r\u000c]+/,$=/^[, \t\n\r\u000c]+/;const z=new WeakMap;function j(e,t){return t&&""!==t.trim()?K(e,t):t}function W(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function K(e,t){let s=z.get(e);if(s||(s=e.createElement("a"),z.set(e,s)),t){if(t.startsWith("blob:")||t.startsWith("data:"))return t}else t="";return s.setAttribute("href",t),s.href}function G(e,t,s,r){return r?"src"===s||"href"===s&&("use"!==t||"#"!==r[0])||"xlink:href"===s&&"#"!==r[0]||"background"===s&&["table","td","th"].includes(t)?j(e,r):"srcset"===s?function(e,t){if(""===t.trim())return t;let s=0;function r(e){let r;const i=e.exec(t.substring(s));return i?(r=i[0],s+=r.length,r):""}const i=[];for(;r($),!(s>=t.length);){let n=r(B);if(","===n.slice(-1))n=j(e,n.substring(0,n.length-1)),i.push(n);else{let r="";n=j(e,n);let o=!1;for(;;){const e=t.charAt(s);if(""===e){i.push((n+r).trim());break}if(o)")"===e&&(o=!1);else{if(","===e){s+=1,i.push((n+r).trim());break}"("===e&&(o=!0)}r+=e,s+=1}}}return i.join(", ")}(e,r):"style"===s?A(r,K(e)):"object"===t&&"data"===s?j(e,r):r:r}function V(e,t,s){return["video","audio"].includes(e)&&"autoplay"===t}function H(e,t,s){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!s&&H(f.parentNode(e),t,s);for(let s=e.classList.length;s--;){const r=e.classList[s];if(t.test(r))return!0}return!!s&&H(f.parentNode(e),t,s)}function Y(e,t,s,r){let i;if(g(e)){if(i=e,!f.childNodes(i).length)return!1}else{if(null===f.parentElement(e))return!1;i=f.parentElement(e)}try{if("string"==typeof t){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(s)if(r){if(i.closest(s))return!0}else if(i.matches(s))return!0}catch(e){}return!1}function Z(e,t){const{doc:s,mirror:r,blockClass:i,blockSelector:n,needsMask:a,inlineStylesheet:l,maskInputOptions:c={},maskTextFn:h,maskInputFn:u,dataURLOptions:d={},inlineImages:p,recordCanvas:m,keepIframeSrcFn:g,newlyAddedElement:y=!1,cssCaptured:w=!1}=t,S=function(e,t){if(!t.hasNode(e))return;const s=t.getId(e);return 1===s?void 0:s}(s,r);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:o.Document,childNodes:[],compatMode:e.compatMode}:{type:o.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:o.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:S};case e.ELEMENT_NODE:return function(e,t){const{doc:s,blockClass:r,blockSelector:i,inlineStylesheet:n,maskInputOptions:a={},maskInputFn:l,dataURLOptions:c={},inlineImages:h,recordCanvas:u,keepIframeSrcFn:d,newlyAddedElement:p=!1,rootId:m}=t,f=function(e,t,s){try{if("string"==typeof t){if(e.classList.contains(t))return!0}else for(let s=e.classList.length;s--;){const r=e.classList[s];if(t.test(r))return!0}if(s)return e.matches(s)}catch(e){}return!1}(e,r,i),g=function(e){if(e instanceof HTMLFormElement)return"form";const t=k(e.tagName);return L.test(t)?"div":t}(e);let y={};const w=e.attributes.length;for(let t=0;t<w;t++){const r=e.attributes[t];V(g,r.name,r.value)||(y[r.name]=G(s,g,k(r.name),r.value))}if("link"===g&&n){const t=Array.from(s.styleSheets).find(t=>t.href===e.href);let r=null;t&&(r=v(t)),r&&(delete y.rel,delete y.href,y._cssText=r)}if("style"===g&&e.sheet){let t=v(e.sheet);t&&(e.childNodes.length>1&&(t=D(t,e)),y._cssText=t)}if(["input","textarea","select"].includes(g)){const t=e.value,s=e.checked;"radio"!==y.type&&"checkbox"!==y.type&&"submit"!==y.type&&"button"!==y.type&&t?y.value=C({element:e,type:E(e),tagName:g,value:t,maskInputOptions:a,maskInputFn:l}):s&&(y.checked=s)}"option"===g&&(e.selected&&!a.select?y.selected=!0:delete y.selected);"dialog"===g&&e.open&&(y.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal");if("canvas"===g&&u)if("2d"===e.__context)(function(e){const t=e.getContext("2d");if(!t)return!0;for(let s=0;s<e.width;s+=50)for(let r=0;r<e.height;r+=50){const i=t.getImageData,n=I in i?i[I]:i;if(new Uint32Array(n.call(t,s,r,Math.min(50,e.width-s),Math.min(50,e.height-r)).data.buffer).some(e=>0!==e))return!1}return!0})(e)||(y.rr_dataURL=e.toDataURL(c.type,c.quality));else if(!("__context"in e)){const t=e.toDataURL(c.type,c.quality),r=s.createElement("canvas");r.width=e.width,r.height=e.height;t!==r.toDataURL(c.type,c.quality)&&(y.rr_dataURL=t)}if("img"===g&&h){F||(F=s.createElement("canvas"),U=F.getContext("2d"));const t=e,r=t.currentSrc||t.getAttribute("src")||"<unknown-src>",i=t.crossOrigin,n=()=>{t.removeEventListener("load",n);try{F.width=t.naturalWidth,F.height=t.naturalHeight,U.drawImage(t,0,0),y.rr_dataURL=F.toDataURL(c.type,c.quality)}catch(e){if("anonymous"!==t.crossOrigin)return t.crossOrigin="anonymous",void(t.complete&&0!==t.naturalWidth?n():t.addEventListener("load",n));console.warn(`Cannot inline img src=${r}! Error: ${e}`)}"anonymous"===t.crossOrigin&&(i?y.crossOrigin=i:t.removeAttribute("crossorigin"))};t.complete&&0!==t.naturalWidth?n():t.addEventListener("load",n)}if(["audio","video"].includes(g)){const t=y;t.rr_mediaState=e.paused?"paused":"played",t.rr_mediaCurrentTime=e.currentTime,t.rr_mediaPlaybackRate=e.playbackRate,t.rr_mediaMuted=e.muted,t.rr_mediaLoop=e.loop,t.rr_mediaVolume=e.volume}p||(e.scrollLeft&&(y.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(y.rr_scrollTop=e.scrollTop));if(f){const{width:t,height:s}=e.getBoundingClientRect();y={class:y.class,rr_width:`${t}px`,rr_height:`${s}px`}}"iframe"!==g||d(y.src)||(e.contentDocument||(y.rr_src=y.src),delete y.src);let S;try{customElements.get(g)&&(S=!0)}catch(e){}return{type:o.Element,tagName:g,attributes:y,childNodes:[],isSVG:W(e)||void 0,needBlock:f,rootId:m,isCustom:S}}(e,{doc:s,blockClass:i,blockSelector:n,inlineStylesheet:l,maskInputOptions:c,maskInputFn:u,dataURLOptions:d,inlineImages:p,recordCanvas:m,keepIframeSrcFn:g,newlyAddedElement:y,rootId:S});case e.TEXT_NODE:return function(e,t){const{needsMask:s,maskTextFn:r,rootId:i,cssCaptured:n}=t,a=f.parentNode(e),l=a&&a.tagName;let c="";const h="STYLE"===l||void 0,u="SCRIPT"===l||void 0;u?c="SCRIPT_PLACEHOLDER":n||(c=f.textContent(e),h&&c&&(c=A(c,K(t.doc))));!h&&!u&&c&&s&&(c=r?r(c,f.parentElement(e)):c.replace(/[\S]/g,"*"));return{type:o.Text,textContent:c||"",rootId:i}}(e,{doc:s,needsMask:a,maskTextFn:h,rootId:S,cssCaptured:w});case e.CDATA_SECTION_NODE:return{type:o.CDATA,textContent:"",rootId:S};case e.COMMENT_NODE:return{type:o.Comment,textContent:f.textContent(e)||"",rootId:S};default:return!1}}function q(e){return null==e?"":e.toLowerCase()}function J(e){return!0===e||"all"===e?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===e,headMetaDescKeywords:"all"===e,headTitleMutations:"all"===e}:e||{}}function X(e,t){const{doc:s,mirror:r,blockClass:i,blockSelector:n,maskTextClass:a,maskTextSelector:l,skipChild:c=!1,inlineStylesheet:h=!0,maskInputOptions:u={},maskTextFn:d,maskInputFn:p,slimDOMOptions:m,dataURLOptions:v={},inlineImages:S=!1,recordCanvas:b=!1,onSerialize:C,onIframeLoad:k,iframeLoadTimeout:I=5e3,onStylesheetLoad:E,stylesheetLoadTimeout:x=5e3,keepIframeSrcFn:_=()=>!1,newlyAddedElement:M=!1,cssCaptured:O=!1}=t;let{needsMask:A}=t,{preserveWhiteSpace:R=!0}=t;if(!A){A=Y(e,a,l,void 0===A)}const D=Z(e,{doc:s,mirror:r,blockClass:i,blockSelector:n,needsMask:A,inlineStylesheet:h,maskInputOptions:u,maskTextFn:d,maskInputFn:p,dataURLOptions:v,inlineImages:S,recordCanvas:b,keepIframeSrcFn:_,newlyAddedElement:M,cssCaptured:O});if(!D)return console.warn(e,"not serialized"),null;let P;P=r.hasNode(e)?r.getId(e):function(e,t){if(t.comment&&e.type===o.Comment)return!0;if(e.type===o.Element){if(t.script&&("script"===e.tagName||"link"===e.tagName&&("preload"===e.attributes.rel&&"script"===e.attributes.as||"modulepreload"===e.attributes.rel)||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&"js"===T(e.attributes.href)))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(q(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===q(e.attributes.name)||"icon"===q(e.attributes.rel)||"apple-touch-icon"===q(e.attributes.rel)||"shortcut icon"===q(e.attributes.rel))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&q(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(q(e.attributes.property).match(/^(og|twitter|fb):/)||q(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===q(e.attributes.name)))return!0;if(t.headMetaRobots&&("robots"===q(e.attributes.name)||"googlebot"===q(e.attributes.name)||"bingbot"===q(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&("author"===q(e.attributes.name)||"generator"===q(e.attributes.name)||"framework"===q(e.attributes.name)||"publisher"===q(e.attributes.name)||"progid"===q(e.attributes.name)||q(e.attributes.property).match(/^article:/)||q(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&("google-site-verification"===q(e.attributes.name)||"yandex-verification"===q(e.attributes.name)||"csrf-token"===q(e.attributes.name)||"p:domain_verify"===q(e.attributes.name)||"verify-v1"===q(e.attributes.name)||"verification"===q(e.attributes.name)||"shopify-checkout-api-token"===q(e.attributes.name)))return!0}}return!1}(D,m)||!R&&D.type===o.Text&&!D.textContent.replace(/^\s+|\s+$/gm,"").length?-2:N();const L=Object.assign(D,{id:P});if(r.add(e,L),-2===P)return null;C&&C(e);let F=!c;if(L.type===o.Element){F=F&&!L.needBlock,delete L.needBlock;const t=f.shadowRoot(e);t&&w(t)&&(L.isShadowHost=!0)}if((L.type===o.Document||L.type===o.Element)&&F){m.headWhitespace&&L.type===o.Element&&"head"===L.tagName&&(R=!1);const t={doc:s,mirror:r,blockClass:i,blockSelector:n,needsMask:A,maskTextClass:a,maskTextSelector:l,skipChild:c,inlineStylesheet:h,maskInputOptions:u,maskTextFn:d,maskInputFn:p,slimDOMOptions:m,dataURLOptions:v,inlineImages:S,recordCanvas:b,preserveWhiteSpace:R,onSerialize:C,onIframeLoad:k,iframeLoadTimeout:I,onStylesheetLoad:E,stylesheetLoadTimeout:x,keepIframeSrcFn:_,cssCaptured:!1};if(L.type===o.Element&&"textarea"===L.tagName&&void 0!==L.attributes.value);else{L.type===o.Element&&void 0!==L.attributes._cssText&&"string"==typeof L.attributes._cssText&&(t.cssCaptured=!0);for(const s of Array.from(f.childNodes(e))){const e=X(s,t);e&&L.childNodes.push(e)}}let y=null;if(g(e)&&(y=f.shadowRoot(e)))for(const e of Array.from(f.childNodes(y))){const s=X(e,t);s&&(w(y)&&(s.isShadow=!0),L.childNodes.push(s))}}const U=f.parentNode(e);return U&&y(U)&&w(U)&&(L.isShadow=!0),L.type===o.Element&&"iframe"===L.tagName&&function(e,t,s){const r=e.contentWindow;if(!r)return;let i,n=!1;try{i=r.document.readyState}catch(e){return}if("complete"!==i){const r=setTimeout(()=>{n||(t(),n=!0)},s);return void e.addEventListener("load",()=>{clearTimeout(r),n=!0,t()})}const o="about:blank";if(r.location.href!==o||e.src===o||""===e.src)return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}(e,()=>{const t=e.contentDocument;if(t&&k){const s=X(t,{doc:t,mirror:r,blockClass:i,blockSelector:n,needsMask:A,maskTextClass:a,maskTextSelector:l,skipChild:!1,inlineStylesheet:h,maskInputOptions:u,maskTextFn:d,maskInputFn:p,slimDOMOptions:m,dataURLOptions:v,inlineImages:S,recordCanvas:b,preserveWhiteSpace:R,onSerialize:C,onIframeLoad:k,iframeLoadTimeout:I,onStylesheetLoad:E,stylesheetLoadTimeout:x,keepIframeSrcFn:_});s&&k(e,s)}},I),L.type===o.Element&&"link"===L.tagName&&"string"==typeof L.attributes.rel&&("stylesheet"===L.attributes.rel||"preload"===L.attributes.rel&&"string"==typeof L.attributes.href&&"css"===T(L.attributes.href))&&function(e,t,s){let r,i=!1;try{r=e.sheet}catch(e){return}if(r)return;const n=setTimeout(()=>{i||(t(),i=!0)},s);e.addEventListener("load",()=>{clearTimeout(n),i=!0,t()})}(e,()=>{if(E){const t=X(e,{doc:s,mirror:r,blockClass:i,blockSelector:n,needsMask:A,maskTextClass:a,maskTextSelector:l,skipChild:!1,inlineStylesheet:h,maskInputOptions:u,maskTextFn:d,maskInputFn:p,slimDOMOptions:m,dataURLOptions:v,inlineImages:S,recordCanvas:b,preserveWhiteSpace:R,onSerialize:C,onIframeLoad:k,iframeLoadTimeout:I,onStylesheetLoad:E,stylesheetLoadTimeout:x,keepIframeSrcFn:_});t&&E(e,t)}},x),L}function Q(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function ee(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var s=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};s.prototype=t.prototype}else s={};return Object.defineProperty(s,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(s,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),s}var te={exports:{}},se=String,re=function(){return{isColorSupported:!1,reset:se,bold:se,dim:se,italic:se,underline:se,inverse:se,hidden:se,strikethrough:se,black:se,red:se,green:se,yellow:se,blue:se,magenta:se,cyan:se,white:se,gray:se,bgBlack:se,bgRed:se,bgGreen:se,bgYellow:se,bgBlue:se,bgMagenta:se,bgCyan:se,bgWhite:se}};te.exports=re(),te.exports.createColors=re;var ie=te.exports;const ne=ee(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));let oe=ie,ae=ne,le=class e extends Error{constructor(t,s,r,i,n,o){super(t),this.name="CssSyntaxError",this.reason=t,n&&(this.file=n),i&&(this.source=i),o&&(this.plugin=o),void 0!==s&&void 0!==r&&("number"==typeof s?(this.line=s,this.column=r):(this.line=s.line,this.column=s.column,this.endLine=r.line,this.endColumn=r.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,e)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",void 0!==this.line&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(e){if(!this.source)return"";let t=this.source;null==e&&(e=oe.isColorSupported),ae&&e&&(t=ae(t));let s,r,i=t.split(/\r?\n/),n=Math.max(this.line-3,0),o=Math.min(this.line+2,i.length),a=String(o).length;if(e){let{bold:e,gray:t,red:i}=oe.createColors(!0);s=t=>e(i(t)),r=e=>t(e)}else s=r=e=>e;return i.slice(n,o).map((e,t)=>{let i=n+1+t,o=" "+(" "+i).slice(-a)+" | ";if(i===this.line){let t=r(o.replace(/\d/g," "))+e.slice(0,this.column-1).replace(/[^\t]/g," ");return s(">")+r(o)+e+"\n "+t+s("^")}return" "+r(o)+e}).join("\n")}toString(){let e=this.showSourceCode();return e&&(e="\n\n"+e+"\n"),this.name+": "+this.message+e}};var ce=le;le.default=le;var he={};he.isClean=Symbol("isClean"),he.my=Symbol("my");const ue={after:"\n",beforeClose:"\n",beforeComment:"\n",beforeDecl:"\n",beforeOpen:" ",beforeRule:"\n",colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};let de=class{constructor(e){this.builder=e}atrule(e,t){let s="@"+e.name,r=e.params?this.rawValue(e,"params"):"";if(void 0!==e.raws.afterName?s+=e.raws.afterName:r&&(s+=" "),e.nodes)this.block(e,s+r);else{let i=(e.raws.between||"")+(t?";":"");this.builder(s+r+i,e)}}beforeAfter(e,t){let s;s="decl"===e.type?this.raw(e,null,"beforeDecl"):"comment"===e.type?this.raw(e,null,"beforeComment"):"before"===t?this.raw(e,null,"beforeRule"):this.raw(e,null,"beforeClose");let r=e.parent,i=0;for(;r&&"root"!==r.type;)i+=1,r=r.parent;if(s.includes("\n")){let t=this.raw(e,null,"indent");if(t.length)for(let e=0;e<i;e++)s+=t}return s}block(e,t){let s,r=this.raw(e,"between","beforeOpen");this.builder(t+r+"{",e,"start"),e.nodes&&e.nodes.length?(this.body(e),s=this.raw(e,"after")):s=this.raw(e,"after","emptyBody"),s&&this.builder(s),this.builder("}",e,"end")}body(e){let t=e.nodes.length-1;for(;t>0&&"comment"===e.nodes[t].type;)t-=1;let s=this.raw(e,"semicolon");for(let r=0;r<e.nodes.length;r++){let i=e.nodes[r],n=this.raw(i,"before");n&&this.builder(n),this.stringify(i,t!==r||s)}}comment(e){let t=this.raw(e,"left","commentLeft"),s=this.raw(e,"right","commentRight");this.builder("/*"+t+e.text+s+"*/",e)}decl(e,t){let s=this.raw(e,"between","colon"),r=e.prop+s+this.rawValue(e,"value");e.important&&(r+=e.raws.important||" !important"),t&&(r+=";"),this.builder(r,e)}document(e){this.body(e)}raw(e,t,s){let r;if(s||(s=t),t&&(r=e.raws[t],void 0!==r))return r;let i=e.parent;if("before"===s){if(!i||"root"===i.type&&i.first===e)return"";if(i&&"document"===i.type)return""}if(!i)return ue[s];let n=e.root();if(n.rawCache||(n.rawCache={}),void 0!==n.rawCache[s])return n.rawCache[s];if("before"===s||"after"===s)return this.beforeAfter(e,s);{let i="raw"+((o=s)[0].toUpperCase()+o.slice(1));this[i]?r=this[i](n,e):n.walk(e=>{if(r=e.raws[t],void 0!==r)return!1})}var o;return void 0===r&&(r=ue[s]),n.rawCache[s]=r,r}rawBeforeClose(e){let t;return e.walk(e=>{if(e.nodes&&e.nodes.length>0&&void 0!==e.raws.after)return t=e.raws.after,t.includes("\n")&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawBeforeComment(e,t){let s;return e.walkComments(e=>{if(void 0!==e.raws.before)return s=e.raws.before,s.includes("\n")&&(s=s.replace(/[^\n]+$/,"")),!1}),void 0===s?s=this.raw(t,null,"beforeDecl"):s&&(s=s.replace(/\S/g,"")),s}rawBeforeDecl(e,t){let s;return e.walkDecls(e=>{if(void 0!==e.raws.before)return s=e.raws.before,s.includes("\n")&&(s=s.replace(/[^\n]+$/,"")),!1}),void 0===s?s=this.raw(t,null,"beforeRule"):s&&(s=s.replace(/\S/g,"")),s}rawBeforeOpen(e){let t;return e.walk(e=>{if("decl"!==e.type&&(t=e.raws.between,void 0!==t))return!1}),t}rawBeforeRule(e){let t;return e.walk(s=>{if(s.nodes&&(s.parent!==e||e.first!==s)&&void 0!==s.raws.before)return t=s.raws.before,t.includes("\n")&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawColon(e){let t;return e.walkDecls(e=>{if(void 0!==e.raws.between)return t=e.raws.between.replace(/[^\s:]/g,""),!1}),t}rawEmptyBody(e){let t;return e.walk(e=>{if(e.nodes&&0===e.nodes.length&&(t=e.raws.after,void 0!==t))return!1}),t}rawIndent(e){if(e.raws.indent)return e.raws.indent;let t;return e.walk(s=>{let r=s.parent;if(r&&r!==e&&r.parent&&r.parent===e&&void 0!==s.raws.before){let e=s.raws.before.split("\n");return t=e[e.length-1],t=t.replace(/\S/g,""),!1}}),t}rawSemicolon(e){let t;return e.walk(e=>{if(e.nodes&&e.nodes.length&&"decl"===e.last.type&&(t=e.raws.semicolon,void 0!==t))return!1}),t}rawValue(e,t){let s=e[t],r=e.raws[t];return r&&r.value===s?r.raw:s}root(e){this.body(e),e.raws.after&&this.builder(e.raws.after)}rule(e){this.block(e,this.rawValue(e,"selector")),e.raws.ownSemicolon&&this.builder(e.raws.ownSemicolon,e,"end")}stringify(e,t){if(!this[e.type])throw new Error("Unknown AST node type "+e.type+". Maybe you need to change PostCSS stringifier.");this[e.type](e,t)}};var pe=de;de.default=de;let me=pe;function fe(e,t){new me(t).stringify(e)}var ge=fe;fe.default=fe;let{isClean:ye,my:we}=he,ve=ce,Se=pe,be=ge;function Ce(e,t){let s=new e.constructor;for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;if("proxyCache"===r)continue;let i=e[r],n=typeof i;"parent"===r&&"object"===n?t&&(s[r]=t):"source"===r?s[r]=i:Array.isArray(i)?s[r]=i.map(e=>Ce(e,s)):("object"===n&&null!==i&&(i=Ce(i)),s[r]=i)}return s}let ke=class{constructor(e={}){this.raws={},this[ye]=!1,this[we]=!0;for(let t in e)if("nodes"===t){this.nodes=[];for(let s of e[t])"function"==typeof s.clone?this.append(s.clone()):this.append(s)}else this[t]=e[t]}addToError(e){if(e.postcssNode=this,e.stack&&this.source&&/\n\s{4}at /.test(e.stack)){let t=this.source;e.stack=e.stack.replace(/\n\s{4}at /,`$&${t.input.from}:${t.start.line}:${t.start.column}$&`)}return e}after(e){return this.parent.insertAfter(this,e),this}assign(e={}){for(let t in e)this[t]=e[t];return this}before(e){return this.parent.insertBefore(this,e),this}cleanRaws(e){delete this.raws.before,delete this.raws.after,e||delete this.raws.between}clone(e={}){let t=Ce(this);for(let s in e)t[s]=e[s];return t}cloneAfter(e={}){let t=this.clone(e);return this.parent.insertAfter(this,t),t}cloneBefore(e={}){let t=this.clone(e);return this.parent.insertBefore(this,t),t}error(e,t={}){if(this.source){let{end:s,start:r}=this.rangeBy(t);return this.source.input.error(e,{column:r.column,line:r.line},{column:s.column,line:s.line},t)}return new ve(e)}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:"root"===t?()=>e.root().toProxy():e[t],set:(e,t,s)=>(e[t]===s||(e[t]=s,"prop"!==t&&"value"!==t&&"name"!==t&&"params"!==t&&"important"!==t&&"text"!==t||e.markDirty()),!0)}}markDirty(){if(this[ye]){this[ye]=!1;let e=this;for(;e=e.parent;)e[ye]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e,t){let s=this.source.start;if(e.index)s=this.positionInside(e.index,t);else if(e.word){let r=(t=this.toString()).indexOf(e.word);-1!==r&&(s=this.positionInside(r,t))}return s}positionInside(e,t){let s=t||this.toString(),r=this.source.start.column,i=this.source.start.line;for(let t=0;t<e;t++)"\n"===s[t]?(r=1,i+=1):r+=1;return{column:r,line:i}}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}rangeBy(e){let t={column:this.source.start.column,line:this.source.start.line},s=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:t.column+1,line:t.line};if(e.word){let r=this.toString(),i=r.indexOf(e.word);-1!==i&&(t=this.positionInside(i,r),s=this.positionInside(i+e.word.length,r))}else e.start?t={column:e.start.column,line:e.start.line}:e.index&&(t=this.positionInside(e.index)),e.end?s={column:e.end.column,line:e.end.line}:"number"==typeof e.endIndex?s=this.positionInside(e.endIndex):e.index&&(s=this.positionInside(e.index+1));return(s.line<t.line||s.line===t.line&&s.column<=t.column)&&(s={column:t.column+1,line:t.line}),{end:s,start:t}}raw(e,t){return(new Se).raw(this,e,t)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...e){if(this.parent){let t=this,s=!1;for(let r of e)r===this?s=!0:s?(this.parent.insertAfter(t,r),t=r):this.parent.insertBefore(t,r);s||this.remove()}return this}root(){let e=this;for(;e.parent&&"document"!==e.parent.type;)e=e.parent;return e}toJSON(e,t){let s={},r=null==t;t=t||new Map;let i=0;for(let e in this){if(!Object.prototype.hasOwnProperty.call(this,e))continue;if("parent"===e||"proxyCache"===e)continue;let r=this[e];if(Array.isArray(r))s[e]=r.map(e=>"object"==typeof e&&e.toJSON?e.toJSON(null,t):e);else if("object"==typeof r&&r.toJSON)s[e]=r.toJSON(null,t);else if("source"===e){let n=t.get(r.input);null==n&&(n=i,t.set(r.input,i),i++),s[e]={end:r.end,inputId:n,start:r.start}}else s[e]=r}return r&&(s.inputs=[...t.keys()].map(e=>e.toJSON())),s}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(e=be){e.stringify&&(e=e.stringify);let t="";return e(this,e=>{t+=e}),t}warn(e,t,s){let r={node:this};for(let e in s)r[e]=s[e];return e.warn(t,r)}get proxyOf(){return this}};var Ie=ke;ke.default=ke;let Ee=Ie,Te=class extends Ee{constructor(e){e&&void 0!==e.value&&"string"!=typeof e.value&&(e={...e,value:String(e.value)}),super(e),this.type="decl"}get variable(){return this.prop.startsWith("--")||"$"===this.prop[0]}};var xe=Te;Te.default=Te;var _e={nanoid:(e=21)=>{let t="",s=e;for(;s--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t}};let{SourceMapConsumer:Me,SourceMapGenerator:Oe}=ne,{existsSync:Ae,readFileSync:Re}=ne,{dirname:De,join:Pe}=ne;let Le=class{constructor(e,t){if(!1===t.map)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");let s=t.map?t.map.prev:void 0,r=this.loadMap(t.from,s);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=De(this.mapFile)),r&&(this.text=r)}consumer(){return this.consumerCache||(this.consumerCache=new Me(this.text)),this.consumerCache}decodeInline(e){if(/^data:application\/json;charset=utf-?8,/.test(e)||/^data:application\/json,/.test(e))return decodeURIComponent(e.substr(RegExp.lastMatch.length));if(/^data:application\/json;charset=utf-?8;base64,/.test(e)||/^data:application\/json;base64,/.test(e))return t=e.substr(RegExp.lastMatch.length),Buffer?Buffer.from(t,"base64").toString():window.atob(t);var t;let s=e.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+s)}getAnnotationURL(e){return e.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(e){return"object"==typeof e&&("string"==typeof e.mappings||"string"==typeof e._mappings||Array.isArray(e.sections))}loadAnnotation(e){let t=e.match(/\/\*\s*# sourceMappingURL=/gm);if(!t)return;let s=e.lastIndexOf(t.pop()),r=e.indexOf("*/",s);s>-1&&r>-1&&(this.annotation=this.getAnnotationURL(e.substring(s,r)))}loadFile(e){if(this.root=De(e),Ae(e))return this.mapFile=e,Re(e,"utf-8").toString().trim()}loadMap(e,t){if(!1===t)return!1;if(t){if("string"==typeof t)return t;if("function"!=typeof t){if(t instanceof Me)return Oe.fromSourceMap(t).toString();if(t instanceof Oe)return t.toString();if(this.isMap(t))return JSON.stringify(t);throw new Error("Unsupported previous source map format: "+t.toString())}{let s=t(e);if(s){let e=this.loadFile(s);if(!e)throw new Error("Unable to load previous source map: "+s.toString());return e}}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let t=this.annotation;return e&&(t=Pe(De(e),t)),this.loadFile(t)}}}startWith(e,t){return!!e&&e.substr(0,t.length)===t}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}};var Ne=Le;Le.default=Le;let{SourceMapConsumer:Fe,SourceMapGenerator:Ue}=ne,{fileURLToPath:Be,pathToFileURL:$e}=ne,{isAbsolute:ze,resolve:je}=ne,{nanoid:We}=_e,Ke=ne,Ge=ce,Ve=Ne,He=Symbol("fromOffsetCache"),Ye=Boolean(Fe&&Ue),Ze=Boolean(je&&ze),qe=class{constructor(e,t={}){if(null==e||"object"==typeof e&&!e.toString)throw new Error(`PostCSS received ${e} instead of CSS string`);if(this.css=e.toString(),"\ufeff"===this.css[0]||"οΏΎ"===this.css[0]?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,t.from&&(!Ze||/^\w+:\/\//.test(t.from)||ze(t.from)?this.file=t.from:this.file=je(t.from)),Ze&&Ye){let e=new Ve(this.css,t);if(e.text){this.map=e;let t=e.consumer().file;!this.file&&t&&(this.file=this.mapResolve(t))}}this.file||(this.id="<input css "+We(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,s,r={}){let i,n,o;if(t&&"object"==typeof t){let e=t,r=s;if("number"==typeof e.offset){let r=this.fromOffset(e.offset);t=r.line,s=r.col}else t=e.line,s=e.column;if("number"==typeof r.offset){let e=this.fromOffset(r.offset);n=e.line,o=e.col}else n=r.line,o=r.column}else if(!s){let e=this.fromOffset(t);t=e.line,s=e.col}let a=this.origin(t,s,n,o);return i=a?new Ge(e,void 0===a.endLine?a.line:{column:a.column,line:a.line},void 0===a.endLine?a.column:{column:a.endColumn,line:a.endLine},a.source,a.file,r.plugin):new Ge(e,void 0===n?t:{column:s,line:t},void 0===n?s:{column:o,line:n},this.css,this.file,r.plugin),i.input={column:s,endColumn:o,endLine:n,line:t,source:this.css},this.file&&($e&&(i.input.url=$e(this.file).toString()),i.input.file=this.file),i}fromOffset(e){let t,s;if(this[He])s=this[He];else{let e=this.css.split("\n");s=new Array(e.length);let t=0;for(let r=0,i=e.length;r<i;r++)s[r]=t,t+=e[r].length+1;this[He]=s}t=s[s.length-1];let r=0;if(e>=t)r=s.length-1;else{let t,i=s.length-2;for(;r<i;)if(t=r+(i-r>>1),e<s[t])i=t-1;else{if(!(e>=s[t+1])){r=t;break}r=t+1}}return{col:e-s[r]+1,line:r+1}}mapResolve(e){return/^\w+:\/\//.test(e)?e:je(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,s,r){if(!this.map)return!1;let i,n,o=this.map.consumer(),a=o.originalPositionFor({column:t,line:e});if(!a.source)return!1;"number"==typeof s&&(i=o.originalPositionFor({column:r,line:s})),n=ze(a.source)?$e(a.source):new URL(a.source,this.map.consumer().sourceRoot||$e(this.map.mapFile));let l={column:a.column,endColumn:i&&i.column,endLine:i&&i.line,line:a.line,url:n.toString()};if("file:"===n.protocol){if(!Be)throw new Error("file: protocol is not available in this PostCSS build");l.file=Be(n)}let c=o.sourceContentFor(a.source);return c&&(l.source=c),l}toJSON(){let e={};for(let t of["hasBOM","css","file","id"])null!=this[t]&&(e[t]=this[t]);return this.map&&(e.map={...this.map},e.map.consumerCache&&(e.map.consumerCache=void 0)),e}get from(){return this.file||this.id}};var Je=qe;qe.default=qe,Ke&&Ke.registerInput&&Ke.registerInput(qe);let{SourceMapConsumer:Xe,SourceMapGenerator:Qe}=ne,{dirname:et,relative:tt,resolve:st,sep:rt}=ne,{pathToFileURL:it}=ne,nt=Je,ot=Boolean(Xe&&Qe),at=Boolean(et&&st&&tt&&rt);var lt=class{constructor(e,t,s,r){this.stringify=e,this.mapOpts=s.map||{},this.root=t,this.opts=s,this.css=r,this.originalCSS=r,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let e;e=this.isInline()?"data:application/json;base64,"+this.toBase64(this.map.toString()):"string"==typeof this.mapOpts.annotation?this.mapOpts.annotation:"function"==typeof this.mapOpts.annotation?this.mapOpts.annotation(this.opts.to,this.root):this.outputFile()+".map";let t="\n";this.css.includes("\r\n")&&(t="\r\n"),this.css+=t+"/*# sourceMappingURL="+e+" */"}applyPrevMaps(){for(let e of this.previous()){let t,s=this.toUrl(this.path(e.file)),r=e.root||et(e.file);!1===this.mapOpts.sourcesContent?(t=new Xe(e.text),t.sourcesContent&&(t.sourcesContent=null)):t=e.consumer(),this.map.applySourceMap(t,s,this.toUrl(this.path(r)))}}clearAnnotation(){if(!1!==this.mapOpts.annotation)if(this.root){let e;for(let t=this.root.nodes.length-1;t>=0;t--)e=this.root.nodes[t],"comment"===e.type&&0===e.text.indexOf("# sourceMappingURL=")&&this.root.removeChild(t)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),at&&ot&&this.isMap())return this.generateMap();{let e="";return this.stringify(this.root,t=>{e+=t}),[e]}}generateMap(){if(this.root)this.generateString();else if(1===this.previous().length){let e=this.previous()[0].consumer();e.file=this.outputFile(),this.map=Qe.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new Qe({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new Qe({file:this.outputFile(),ignoreInvalidMapping:!0});let e,t,s=1,r=1,i="<no source>",n={generated:{column:0,line:0},original:{column:0,line:0},source:""};this.stringify(this.root,(o,a,l)=>{if(this.css+=o,a&&"end"!==l&&(n.generated.line=s,n.generated.column=r-1,a.source&&a.source.start?(n.source=this.sourcePath(a),n.original.line=a.source.start.line,n.original.column=a.source.start.column-1,this.map.addMapping(n)):(n.source=i,n.original.line=1,n.original.column=0,this.map.addMapping(n))),e=o.match(/\n/g),e?(s+=e.length,t=o.lastIndexOf("\n"),r=o.length-t):r+=o.length,a&&"start"!==l){let e=a.parent||{raws:{}};("decl"===a.type||"atrule"===a.type&&!a.nodes)&&a===e.last&&!e.raws.semicolon||(a.source&&a.source.end?(n.source=this.sourcePath(a),n.original.line=a.source.end.line,n.original.column=a.source.end.column-1,n.generated.line=s,n.generated.column=r-2,this.map.addMapping(n)):(n.source=i,n.original.line=1,n.original.column=0,n.generated.line=s,n.generated.column=r-1,this.map.addMapping(n)))}})}isAnnotation(){return!!this.isInline()||(void 0!==this.mapOpts.annotation?this.mapOpts.annotation:!this.previous().length||this.previous().some(e=>e.annotation))}isInline(){if(void 0!==this.mapOpts.inline)return this.mapOpts.inline;let e=this.mapOpts.annotation;return(void 0===e||!0===e)&&(!this.previous().length||this.previous().some(e=>e.inline))}isMap(){return void 0!==this.opts.map?!!this.opts.map:this.previous().length>0}isSourcesContent(){return void 0!==this.mapOpts.sourcesContent?this.mapOpts.sourcesContent:!this.previous().length||this.previous().some(e=>e.withContent())}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(e){if(this.mapOpts.absolute)return e;if(60===e.charCodeAt(0))return e;if(/^\w+:\/\//.test(e))return e;let t=this.memoizedPaths.get(e);if(t)return t;let s=this.opts.to?et(this.opts.to):".";"string"==typeof this.mapOpts.annotation&&(s=et(st(s,this.mapOpts.annotation)));let r=tt(s,e);return this.memoizedPaths.set(e,r),r}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(e=>{if(e.source&&e.source.input.map){let t=e.source.input.map;this.previousMaps.includes(t)||this.previousMaps.push(t)}});else{let e=new nt(this.originalCSS,this.opts);e.map&&this.previousMaps.push(e.map)}return this.previousMaps}setSourcesContent(){let e={};if(this.root)this.root.walk(t=>{if(t.source){let s=t.source.input.from;if(s&&!e[s]){e[s]=!0;let r=this.usesFileUrls?this.toFileUrl(s):this.toUrl(this.path(s));this.map.setSourceContent(r,t.source.input.css)}}});else if(this.css){let e=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(e,this.css)}}sourcePath(e){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(e.source.input.from):this.toUrl(this.path(e.source.input.from))}toBase64(e){return Buffer?Buffer.from(e).toString("base64"):window.btoa(unescape(encodeURIComponent(e)))}toFileUrl(e){let t=this.memoizedFileURLs.get(e);if(t)return t;if(it){let t=it(e).toString();return this.memoizedFileURLs.set(e,t),t}throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(e){let t=this.memoizedURLs.get(e);if(t)return t;"\\"===rt&&(e=e.replace(/\\/g,"/"));let s=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,s),s}};let ct=Ie,ht=class extends ct{constructor(e){super(e),this.type="comment"}};var ut=ht;ht.default=ht;let dt,pt,mt,ft,{isClean:gt,my:yt}=he,wt=xe,vt=ut,St=Ie;function bt(e){return e.map(e=>(e.nodes&&(e.nodes=bt(e.nodes)),delete e.source,e))}function Ct(e){if(e[gt]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)Ct(t)}let kt=class e extends St{append(...e){for(let t of e){let e=this.normalize(t,this.last);for(let t of e)this.proxyOf.nodes.push(t)}return this.markDirty(),this}cleanRaws(e){if(super.cleanRaws(e),this.nodes)for(let t of this.nodes)t.cleanRaws(e)}each(e){if(!this.proxyOf.nodes)return;let t,s,r=this.getIterator();for(;this.indexes[r]<this.proxyOf.nodes.length&&(t=this.indexes[r],s=e(this.proxyOf.nodes[t],t),!1!==s);)this.indexes[r]+=1;return delete this.indexes[r],s}every(e){return this.nodes.every(e)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let e=this.lastEach;return this.indexes[e]=0,e}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:e[t]?"each"===t||"string"==typeof t&&t.startsWith("walk")?(...s)=>e[t](...s.map(e=>"function"==typeof e?(t,s)=>e(t.toProxy(),s):e)):"every"===t||"some"===t?s=>e[t]((e,...t)=>s(e.toProxy(),...t)):"root"===t?()=>e.root().toProxy():"nodes"===t?e.nodes.map(e=>e.toProxy()):"first"===t||"last"===t?e[t].toProxy():e[t]:e[t],set:(e,t,s)=>(e[t]===s||(e[t]=s,"name"!==t&&"params"!==t&&"selector"!==t||e.markDirty()),!0)}}index(e){return"number"==typeof e?e:(e.proxyOf&&(e=e.proxyOf),this.proxyOf.nodes.indexOf(e))}insertAfter(e,t){let s,r=this.index(e),i=this.normalize(t,this.proxyOf.nodes[r]).reverse();r=this.index(e);for(let e of i)this.proxyOf.nodes.splice(r+1,0,e);for(let e in this.indexes)s=this.indexes[e],r<s&&(this.indexes[e]=s+i.length);return this.markDirty(),this}insertBefore(e,t){let s,r=this.index(e),i=0===r&&"prepend",n=this.normalize(t,this.proxyOf.nodes[r],i).reverse();r=this.index(e);for(let e of n)this.proxyOf.nodes.splice(r,0,e);for(let e in this.indexes)s=this.indexes[e],r<=s&&(this.indexes[e]=s+n.length);return this.markDirty(),this}normalize(t,s){if("string"==typeof t)t=bt(dt(t).nodes);else if(void 0===t)t=[];else if(Array.isArray(t)){t=t.slice(0);for(let e of t)e.parent&&e.parent.removeChild(e,"ignore")}else if("root"===t.type&&"document"!==this.type){t=t.nodes.slice(0);for(let e of t)e.parent&&e.parent.removeChild(e,"ignore")}else if(t.type)t=[t];else if(t.prop){if(void 0===t.value)throw new Error("Value field is missed in node creation");"string"!=typeof t.value&&(t.value=String(t.value)),t=[new wt(t)]}else if(t.selector)t=[new pt(t)];else if(t.name)t=[new mt(t)];else{if(!t.text)throw new Error("Unknown node type in node creation");t=[new vt(t)]}return t.map(t=>(t[yt]||e.rebuild(t),(t=t.proxyOf).parent&&t.parent.removeChild(t),t[gt]&&Ct(t),void 0===t.raws.before&&s&&void 0!==s.raws.before&&(t.raws.before=s.raws.before.replace(/\S/g,"")),t.parent=this.proxyOf,t))}prepend(...e){e=e.reverse();for(let t of e){let e=this.normalize(t,this.first,"prepend").reverse();for(let t of e)this.proxyOf.nodes.unshift(t);for(let t in this.indexes)this.indexes[t]=this.indexes[t]+e.length}return this.markDirty(),this}push(e){return e.parent=this,this.proxyOf.nodes.push(e),this}removeAll(){for(let e of this.proxyOf.nodes)e.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(e){let t;e=this.index(e),this.proxyOf.nodes[e].parent=void 0,this.proxyOf.nodes.splice(e,1);for(let s in this.indexes)t=this.indexes[s],t>=e&&(this.indexes[s]=t-1);return this.markDirty(),this}replaceValues(e,t,s){return s||(s=t,t={}),this.walkDecls(r=>{t.props&&!t.props.includes(r.prop)||t.fast&&!r.value.includes(t.fast)||(r.value=r.value.replace(e,s))}),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each((t,s)=>{let r;try{r=e(t,s)}catch(e){throw t.addToError(e)}return!1!==r&&t.walk&&(r=t.walk(e)),r})}walkAtRules(e,t){return t?e instanceof RegExp?this.walk((s,r)=>{if("atrule"===s.type&&e.test(s.name))return t(s,r)}):this.walk((s,r)=>{if("atrule"===s.type&&s.name===e)return t(s,r)}):(t=e,this.walk((e,s)=>{if("atrule"===e.type)return t(e,s)}))}walkComments(e){return this.walk((t,s)=>{if("comment"===t.type)return e(t,s)})}walkDecls(e,t){return t?e instanceof RegExp?this.walk((s,r)=>{if("decl"===s.type&&e.test(s.prop))return t(s,r)}):this.walk((s,r)=>{if("decl"===s.type&&s.prop===e)return t(s,r)}):(t=e,this.walk((e,s)=>{if("decl"===e.type)return t(e,s)}))}walkRules(e,t){return t?e instanceof RegExp?this.walk((s,r)=>{if("rule"===s.type&&e.test(s.selector))return t(s,r)}):this.walk((s,r)=>{if("rule"===s.type&&s.selector===e)return t(s,r)}):(t=e,this.walk((e,s)=>{if("rule"===e.type)return t(e,s)}))}get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}};kt.registerParse=e=>{dt=e},kt.registerRule=e=>{pt=e},kt.registerAtRule=e=>{mt=e},kt.registerRoot=e=>{ft=e};var It=kt;kt.default=kt,kt.rebuild=e=>{"atrule"===e.type?Object.setPrototypeOf(e,mt.prototype):"rule"===e.type?Object.setPrototypeOf(e,pt.prototype):"decl"===e.type?Object.setPrototypeOf(e,wt.prototype):"comment"===e.type?Object.setPrototypeOf(e,vt.prototype):"root"===e.type&&Object.setPrototypeOf(e,ft.prototype),e[yt]=!0,e.nodes&&e.nodes.forEach(e=>{kt.rebuild(e)})};let Et,Tt,xt=It,_t=class extends xt{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(e={}){return new Et(new Tt,this,e).stringify()}};_t.registerLazyResult=e=>{Et=e},_t.registerProcessor=e=>{Tt=e};var Mt=_t;_t.default=_t;let Ot={};var At=function(e){Ot[e]||(Ot[e]=!0,"undefined"!=typeof console&&console.warn&&console.warn(e))};let Rt=class{constructor(e,t={}){if(this.type="warning",this.text=e,t.node&&t.node.source){let e=t.node.rangeBy(t);this.line=e.start.line,this.column=e.start.column,this.endLine=e.end.line,this.endColumn=e.end.column}for(let e in t)this[e]=t[e]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}};var Dt=Rt;Rt.default=Rt;let Pt=Dt,Lt=class{constructor(e,t,s){this.processor=e,this.messages=[],this.root=t,this.opts=s,this.css=void 0,this.map=void 0}toString(){return this.css}warn(e,t={}){t.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(t.plugin=this.lastPlugin.postcssPlugin);let s=new Pt(e,t);return this.messages.push(s),s}warnings(){return this.messages.filter(e=>"warning"===e.type)}get content(){return this.css}};var Nt=Lt;Lt.default=Lt;const Ft="'".charCodeAt(0),Ut='"'.charCodeAt(0),Bt="\\".charCodeAt(0),$t="/".charCodeAt(0),zt="\n".charCodeAt(0),jt=" ".charCodeAt(0),Wt="\f".charCodeAt(0),Kt="\t".charCodeAt(0),Gt="\r".charCodeAt(0),Vt="[".charCodeAt(0),Ht="]".charCodeAt(0),Yt="(".charCodeAt(0),Zt=")".charCodeAt(0),qt="{".charCodeAt(0),Jt="}".charCodeAt(0),Xt=";".charCodeAt(0),Qt="*".charCodeAt(0),es=":".charCodeAt(0),ts="@".charCodeAt(0),ss=/[\t\n\f\r "#'()/;[\\\]{}]/g,rs=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,is=/.[\r\n"'(/\\]/,ns=/[\da-f]/i;let os=It,as=class extends os{constructor(e){super(e),this.type="atrule"}append(...e){return this.proxyOf.nodes||(this.nodes=[]),super.append(...e)}prepend(...e){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...e)}};var ls=as;as.default=as,os.registerAtRule(as);let cs,hs,us=It,ds=class extends us{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}normalize(e,t,s){let r=super.normalize(e);if(t)if("prepend"===s)this.nodes.length>1?t.raws.before=this.nodes[1].raws.before:delete t.raws.before;else if(this.first!==t)for(let e of r)e.raws.before=t.raws.before;return r}removeChild(e,t){let s=this.index(e);return!t&&0===s&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[s].raws.before),super.removeChild(e)}toResult(e={}){return new cs(new hs,this,e).stringify()}};ds.registerLazyResult=e=>{cs=e},ds.registerProcessor=e=>{hs=e};var ps=ds;ds.default=ds,us.registerRoot(ds);let ms={comma:e=>ms.split(e,[","],!0),space:e=>ms.split(e,[" ","\n","\t"]),split(e,t,s){let r=[],i="",n=!1,o=0,a=!1,l="",c=!1;for(let s of e)c?c=!1:"\\"===s?c=!0:a?s===l&&(a=!1):'"'===s||"'"===s?(a=!0,l=s):"("===s?o+=1:")"===s?o>0&&(o-=1):0===o&&t.includes(s)&&(n=!0),n?(""!==i&&r.push(i.trim()),i="",n=!1):i+=s;return(s||""!==i)&&r.push(i.trim()),r}};var fs=ms;ms.default=ms;let gs=It,ys=fs,ws=class extends gs{constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return ys.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\s*/):null,s=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(s)}};var vs=ws;ws.default=ws,gs.registerRule(ws);let Ss=xe,bs=function(e,t={}){let s,r,i,n,o,a,l,c,h,u,d=e.css.valueOf(),p=t.ignoreErrors,m=d.length,f=0,g=[],y=[];function w(t){throw e.error("Unclosed "+t,f)}return{back:function(e){y.push(e)},endOfFile:function(){return 0===y.length&&f>=m},nextToken:function(e){if(y.length)return y.pop();if(f>=m)return;let t=!!e&&e.ignoreUnclosed;switch(s=d.charCodeAt(f),s){case zt:case jt:case Kt:case Gt:case Wt:r=f;do{r+=1,s=d.charCodeAt(r)}while(s===jt||s===zt||s===Kt||s===Gt||s===Wt);u=["space",d.slice(f,r)],f=r-1;break;case Vt:case Ht:case qt:case Jt:case es:case Xt:case Zt:{let e=String.fromCharCode(s);u=[e,e,f];break}case Yt:if(c=g.length?g.pop()[1]:"",h=d.charCodeAt(f+1),"url"===c&&h!==Ft&&h!==Ut&&h!==jt&&h!==zt&&h!==Kt&&h!==Wt&&h!==Gt){r=f;do{if(a=!1,r=d.indexOf(")",r+1),-1===r){if(p||t){r=f;break}w("bracket")}for(l=r;d.charCodeAt(l-1)===Bt;)l-=1,a=!a}while(a);u=["brackets",d.slice(f,r+1),f,r],f=r}else r=d.indexOf(")",f+1),n=d.slice(f,r+1),-1===r||is.test(n)?u=["(","(",f]:(u=["brackets",n,f,r],f=r);break;case Ft:case Ut:i=s===Ft?"'":'"',r=f;do{if(a=!1,r=d.indexOf(i,r+1),-1===r){if(p||t){r=f+1;break}w("string")}for(l=r;d.charCodeAt(l-1)===Bt;)l-=1,a=!a}while(a);u=["string",d.slice(f,r+1),f,r],f=r;break;case ts:ss.lastIndex=f+1,ss.test(d),r=0===ss.lastIndex?d.length-1:ss.lastIndex-2,u=["at-word",d.slice(f,r+1),f,r],f=r;break;case Bt:for(r=f,o=!0;d.charCodeAt(r+1)===Bt;)r+=1,o=!o;if(s=d.charCodeAt(r+1),o&&s!==$t&&s!==jt&&s!==zt&&s!==Kt&&s!==Gt&&s!==Wt&&(r+=1,ns.test(d.charAt(r)))){for(;ns.test(d.charAt(r+1));)r+=1;d.charCodeAt(r+1)===jt&&(r+=1)}u=["word",d.slice(f,r+1),f,r],f=r;break;default:s===$t&&d.charCodeAt(f+1)===Qt?(r=d.indexOf("*/",f+2)+1,0===r&&(p||t?r=d.length:w("comment")),u=["comment",d.slice(f,r+1),f,r],f=r):(rs.lastIndex=f+1,rs.test(d),r=0===rs.lastIndex?d.length-1:rs.lastIndex-2,u=["word",d.slice(f,r+1),f,r],g.push(u),f=r)}return f++,u},position:function(){return f}}},Cs=ut,ks=ls,Is=ps,Es=vs;const Ts={empty:!0,space:!0};let xs=It,_s=class{constructor(e){this.input=e,this.root=new Is,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}atrule(e){let t,s,r,i=new ks;i.name=e[1].slice(1),""===i.name&&this.unnamedAtrule(i,e),this.init(i,e[2]);let n=!1,o=!1,a=[],l=[];for(;!this.tokenizer.endOfFile();){if(t=(e=this.tokenizer.nextToken())[0],"("===t||"["===t?l.push("("===t?")":"]"):"{"===t&&l.length>0?l.push("}"):t===l[l.length-1]&&l.pop(),0===l.length){if(";"===t){i.source.end=this.getPosition(e[2]),i.source.end.offset++,this.semicolon=!0;break}if("{"===t){o=!0;break}if("}"===t){if(a.length>0){for(r=a.length-1,s=a[r];s&&"space"===s[0];)s=a[--r];s&&(i.source.end=this.getPosition(s[3]||s[2]),i.source.end.offset++)}this.end(e);break}a.push(e)}else a.push(e);if(this.tokenizer.endOfFile()){n=!0;break}}i.raws.between=this.spacesAndCommentsFromEnd(a),a.length?(i.raws.afterName=this.spacesAndCommentsFromStart(a),this.raw(i,"params",a),n&&(e=a[a.length-1],i.source.end=this.getPosition(e[3]||e[2]),i.source.end.offset++,this.spaces=i.raws.between,i.raws.between="")):(i.raws.afterName="",i.params=""),o&&(i.nodes=[],this.current=i)}checkMissedSemicolon(e){let t=this.colon(e);if(!1===t)return;let s,r=0;for(let i=t-1;i>=0&&(s=e[i],"space"===s[0]||(r+=1,2!==r));i--);throw this.input.error("Missed semicolon","word"===s[0]?s[3]+1:s[2])}colon(e){let t,s,r,i=0;for(let[n,o]of e.entries()){if(t=o,s=t[0],"("===s&&(i+=1),")"===s&&(i-=1),0===i&&":"===s){if(r){if("word"===r[0]&&"progid"===r[1])continue;return n}this.doubleColon(t)}r=t}return!1}comment(e){let t=new Cs;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;let s=e[1].slice(2,-2);if(/^\s*$/.test(s))t.text="",t.raws.left=s,t.raws.right="";else{let e=s.match(/^(\s*)([^]*\S)(\s*)$/);t.text=e[2],t.raws.left=e[1],t.raws.right=e[3]}}createTokenizer(){this.tokenizer=bs(this.input)}decl(e,t){let s=new Ss;this.init(s,e[0][2]);let r,i=e[e.length-1];for(";"===i[0]&&(this.semicolon=!0,e.pop()),s.source.end=this.getPosition(i[3]||i[2]||function(e){for(let t=e.length-1;t>=0;t--){let s=e[t],r=s[3]||s[2];if(r)return r}}(e)),s.source.end.offset++;"word"!==e[0][0];)1===e.length&&this.unknownWord(e),s.raws.before+=e.shift()[1];for(s.source.start=this.getPosition(e[0][2]),s.prop="";e.length;){let t=e[0][0];if(":"===t||"space"===t||"comment"===t)break;s.prop+=e.shift()[1]}for(s.raws.between="";e.length;){if(r=e.shift(),":"===r[0]){s.raws.between+=r[1];break}"word"===r[0]&&/\w/.test(r[1])&&this.unknownWord([r]),s.raws.between+=r[1]}"_"!==s.prop[0]&&"*"!==s.prop[0]||(s.raws.before+=s.prop[0],s.prop=s.prop.slice(1));let n,o=[];for(;e.length&&(n=e[0][0],"space"===n||"comment"===n);)o.push(e.shift());this.precheckMissedSemicolon(e);for(let t=e.length-1;t>=0;t--){if(r=e[t],"!important"===r[1].toLowerCase()){s.important=!0;let r=this.stringFrom(e,t);r=this.spacesFromEnd(e)+r," !important"!==r&&(s.raws.important=r);break}if("important"===r[1].toLowerCase()){let r=e.slice(0),i="";for(let e=t;e>0;e--){let t=r[e][0];if(0===i.trim().indexOf("!")&&"space"!==t)break;i=r.pop()[1]+i}0===i.trim().indexOf("!")&&(s.important=!0,s.raws.important=i,e=r)}if("space"!==r[0]&&"comment"!==r[0])break}e.some(e=>"space"!==e[0]&&"comment"!==e[0])&&(s.raws.between+=o.map(e=>e[1]).join(""),o=[]),this.raw(s,"value",o.concat(e),t),s.value.includes(":")&&!t&&this.checkMissedSemicolon(e)}doubleColon(e){throw this.input.error("Double colon",{offset:e[2]},{offset:e[2]+e[1].length})}emptyRule(e){let t=new Es;this.init(t,e[2]),t.selector="",t.raws.between="",this.current=t}end(e){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(e[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(e)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(e){if(this.spaces+=e[1],this.current.nodes){let e=this.current.nodes[this.current.nodes.length-1];e&&"rule"===e.type&&!e.raws.ownSemicolon&&(e.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(e){let t=this.input.fromOffset(e);return{column:t.col,line:t.line,offset:e}}init(e,t){this.current.push(e),e.source={input:this.input,start:this.getPosition(t)},e.raws.before=this.spaces,this.spaces="","comment"!==e.type&&(this.semicolon=!1)}other(e){let t=!1,s=null,r=!1,i=null,n=[],o=e[1].startsWith("--"),a=[],l=e;for(;l;){if(s=l[0],a.push(l),"("===s||"["===s)i||(i=l),n.push("("===s?")":"]");else if(o&&r&&"{"===s)i||(i=l),n.push("}");else if(0===n.length){if(";"===s){if(r)return void this.decl(a,o);break}if("{"===s)return void this.rule(a);if("}"===s){this.tokenizer.back(a.pop()),t=!0;break}":"===s&&(r=!0)}else s===n[n.length-1]&&(n.pop(),0===n.length&&(i=null));l=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),n.length>0&&this.unclosedBracket(i),t&&r){if(!o)for(;a.length&&(l=a[a.length-1][0],"space"===l||"comment"===l);)this.tokenizer.back(a.pop());this.decl(a,o)}else this.unknownWord(a)}parse(){let e;for(;!this.tokenizer.endOfFile();)switch(e=this.tokenizer.nextToken(),e[0]){case"space":this.spaces+=e[1];break;case";":this.freeSemicolon(e);break;case"}":this.end(e);break;case"comment":this.comment(e);break;case"at-word":this.atrule(e);break;case"{":this.emptyRule(e);break;default:this.other(e)}this.endFile()}precheckMissedSemicolon(){}raw(e,t,s,r){let i,n,o,a,l=s.length,c="",h=!0;for(let e=0;e<l;e+=1)i=s[e],n=i[0],"space"!==n||e!==l-1||r?"comment"===n?(a=s[e-1]?s[e-1][0]:"empty",o=s[e+1]?s[e+1][0]:"empty",Ts[a]||Ts[o]||","===c.slice(-1)?h=!1:c+=i[1]):c+=i[1]:h=!1;if(!h){let r=s.reduce((e,t)=>e+t[1],"");e.raws[t]={raw:r,value:c}}e[t]=c}rule(e){e.pop();let t=new Es;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t}spacesAndCommentsFromEnd(e){let t,s="";for(;e.length&&(t=e[e.length-1][0],"space"===t||"comment"===t);)s=e.pop()[1]+s;return s}spacesAndCommentsFromStart(e){let t,s="";for(;e.length&&(t=e[0][0],"space"===t||"comment"===t);)s+=e.shift()[1];return s}spacesFromEnd(e){let t,s="";for(;e.length&&(t=e[e.length-1][0],"space"===t);)s=e.pop()[1]+s;return s}stringFrom(e,t){let s="";for(let r=t;r<e.length;r++)s+=e[r][1];return e.splice(t,e.length-t),s}unclosedBlock(){let e=this.current.source.start;throw this.input.error("Unclosed block",e.line,e.column)}unclosedBracket(e){throw this.input.error("Unclosed bracket",{offset:e[2]},{offset:e[2]+1})}unexpectedClose(e){throw this.input.error("Unexpected }",{offset:e[2]},{offset:e[2]+1})}unknownWord(e){throw this.input.error("Unknown word",{offset:e[0][2]},{offset:e[0][2]+e[0][1].length})}unnamedAtrule(e,t){throw this.input.error("At-rule without name",{offset:t[2]},{offset:t[2]+t[1].length})}},Ms=Je;function Os(e,t){let s=new Ms(e,t),r=new _s(s);try{r.parse()}catch(e){throw"production"!==process.env.NODE_ENV&&"CssSyntaxError"===e.name&&t&&t.from&&(/\.scss$/i.test(t.from)?e.message+="\nYou tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser":/\.sass/i.test(t.from)?e.message+="\nYou tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser":/\.less$/i.test(t.from)&&(e.message+="\nYou tried to parse Less with the standard CSS parser; try again with the postcss-less parser")),e}return r.root}var As=Os;Os.default=Os,xs.registerParse(Os);let{isClean:Rs,my:Ds}=he,Ps=lt,Ls=ge,Ns=It,Fs=Mt,Us=At,Bs=Nt,$s=As,zs=ps;const js={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},Ws={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},Ks={Once:!0,postcssPlugin:!0,prepare:!0};function Gs(e){return"object"==typeof e&&"function"==typeof e.then}function Vs(e){let t=!1,s=js[e.type];return"decl"===e.type?t=e.prop.toLowerCase():"atrule"===e.type&&(t=e.name.toLowerCase()),t&&e.append?[s,s+"-"+t,0,s+"Exit",s+"Exit-"+t]:t?[s,s+"-"+t,s+"Exit",s+"Exit-"+t]:e.append?[s,0,s+"Exit"]:[s,s+"Exit"]}function Hs(e){let t;return t="document"===e.type?["Document",0,"DocumentExit"]:"root"===e.type?["Root",0,"RootExit"]:Vs(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function Ys(e){return e[Rs]=!1,e.nodes&&e.nodes.forEach(e=>Ys(e)),e}let Zs={},qs=class e{constructor(t,s,r){let i;if(this.stringified=!1,this.processed=!1,"object"!=typeof s||null===s||"root"!==s.type&&"document"!==s.type)if(s instanceof e||s instanceof Bs)i=Ys(s.root),s.map&&(void 0===r.map&&(r.map={}),r.map.inline||(r.map.inline=!1),r.map.prev=s.map);else{let e=$s;r.syntax&&(e=r.syntax.parse),r.parser&&(e=r.parser),e.parse&&(e=e.parse);try{i=e(s,r)}catch(e){this.processed=!0,this.error=e}i&&!i[Ds]&&Ns.rebuild(i)}else i=Ys(s);this.result=new Bs(t,i,r),this.helpers={...Zs,postcss:Zs,result:this.result},this.plugins=this.processor.plugins.map(e=>"object"==typeof e&&e.prepare?{...e,...e.prepare(this.result)}:e)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(e,t){let s=this.result.lastPlugin;try{if(t&&t.addToError(e),this.error=e,"CssSyntaxError"!==e.name||e.plugin){if(s.postcssVersion&&"production"!==process.env.NODE_ENV){let e=s.postcssPlugin,t=s.postcssVersion,r=this.result.processor.version,i=t.split("."),n=r.split(".");(i[0]!==n[0]||parseInt(i[1])>parseInt(n[1]))&&console.error("Unknown error from PostCSS plugin. Your current PostCSS version is "+r+", but "+e+" uses "+t+". Perhaps this is the source of the error below.")}}else e.plugin=s.postcssPlugin,e.setMessage()}catch(e){console&&console.error&&console.error(e)}return e}prepareVisitors(){this.listeners={};let e=(e,t,s)=>{this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push([e,s])};for(let t of this.plugins)if("object"==typeof t)for(let s in t){if(!Ws[s]&&/^[A-Z]/.test(s))throw new Error(`Unknown event ${s} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!Ks[s])if("object"==typeof t[s])for(let r in t[s])e(t,"*"===r?s:s+"-"+r.toLowerCase(),t[s][r]);else"function"==typeof t[s]&&e(t,s,t[s])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let e=0;e<this.plugins.length;e++){let t=this.plugins[e],s=this.runOnRoot(t);if(Gs(s))try{await s}catch(e){throw this.handleError(e)}}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[Rs];){e[Rs]=!0;let t=[Hs(e)];for(;t.length>0;){let e=this.visitTick(t);if(Gs(e))try{await e}catch(e){let s=t[t.length-1].node;throw this.handleError(e,s)}}}if(this.listeners.OnceExit)for(let[t,s]of this.listeners.OnceExit){this.result.lastPlugin=t;try{if("document"===e.type){let t=e.nodes.map(e=>s(e,this.helpers));await Promise.all(t)}else await s(e,this.helpers)}catch(e){throw this.handleError(e)}}}return this.processed=!0,this.stringify()}runOnRoot(e){this.result.lastPlugin=e;try{if("object"==typeof e&&e.Once){if("document"===this.result.root.type){let t=this.result.root.nodes.map(t=>e.Once(t,this.helpers));return Gs(t[0])?Promise.all(t):t}return e.Once(this.result.root,this.helpers)}if("function"==typeof e)return e(this.result.root,this.result)}catch(e){throw this.handleError(e)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let e=this.result.opts,t=Ls;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let s=new Ps(t,this.result.root,this.result.opts).generate();return this.result.css=s[0],this.result.map=s[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let e of this.plugins){if(Gs(this.runOnRoot(e)))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[Rs];)e[Rs]=!0,this.walkSync(e);if(this.listeners.OnceExit)if("document"===e.type)for(let t of e.nodes)this.visitSync(this.listeners.OnceExit,t);else this.visitSync(this.listeners.OnceExit,e)}return this.result}then(e,t){return"production"!==process.env.NODE_ENV&&("from"in this.opts||Us("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(e,t)}toString(){return this.css}visitSync(e,t){for(let[s,r]of e){let e;this.result.lastPlugin=s;try{e=r(t,this.helpers)}catch(e){throw this.handleError(e,t.proxyOf)}if("root"!==t.type&&"document"!==t.type&&!t.parent)return!0;if(Gs(e))throw this.getAsyncError()}}visitTick(e){let t=e[e.length-1],{node:s,visitors:r}=t;if("root"!==s.type&&"document"!==s.type&&!s.parent)return void e.pop();if(r.length>0&&t.visitorIndex<r.length){let[e,i]=r[t.visitorIndex];t.visitorIndex+=1,t.visitorIndex===r.length&&(t.visitors=[],t.visitorIndex=0),this.result.lastPlugin=e;try{return i(s.toProxy(),this.helpers)}catch(e){throw this.handleError(e,s)}}if(0!==t.iterator){let r,i=t.iterator;for(;r=s.nodes[s.indexes[i]];)if(s.indexes[i]+=1,!r[Rs])return r[Rs]=!0,void e.push(Hs(r));t.iterator=0,delete s.indexes[i]}let i=t.events;for(;t.eventIndex<i.length;){let e=i[t.eventIndex];if(t.eventIndex+=1,0===e)return void(s.nodes&&s.nodes.length&&(s[Rs]=!0,t.iterator=s.getIterator()));if(this.listeners[e])return void(t.visitors=this.listeners[e])}e.pop()}walkSync(e){e[Rs]=!0;let t=Vs(e);for(let s of t)if(0===s)e.nodes&&e.each(e=>{e[Rs]||this.walkSync(e)});else{let t=this.listeners[s];if(t&&this.visitSync(t,e.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}};qs.registerPostcss=e=>{Zs=e};var Js=qs;qs.default=qs,zs.registerLazyResult(qs),Fs.registerLazyResult(qs);let Xs=lt,Qs=ge,er=At,tr=As;const sr=Nt;let rr=class{constructor(e,t,s){let r;t=t.toString(),this.stringified=!1,this._processor=e,this._css=t,this._opts=s,this._map=void 0;let i=Qs;this.result=new sr(this._processor,r,this._opts),this.result.css=t;let n=this;Object.defineProperty(this.result,"root",{get:()=>n.root});let o=new Xs(i,r,this._opts,t);if(o.isMap()){let[e,t]=o.generate();e&&(this.result.css=e),t&&(this.result.map=t)}else o.clearAnnotation(),this.result.css=o.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}sync(){if(this.error)throw this.error;return this.result}then(e,t){return"production"!==process.env.NODE_ENV&&("from"in this._opts||er("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(e,t)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let e,t=tr;try{e=t(this._css,this._opts)}catch(e){this.error=e}if(this.error)throw this.error;return this._root=e,e}get[Symbol.toStringTag](){return"NoWorkResult"}};var ir=rr;rr.default=rr;let nr=ir,or=Js,ar=Mt,lr=ps,cr=class{constructor(e=[]){this.version="8.4.38",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let s of e)if(!0===s.postcss?s=s():s.postcss&&(s=s.postcss),"object"==typeof s&&Array.isArray(s.plugins))t=t.concat(s.plugins);else if("object"==typeof s&&s.postcssPlugin)t.push(s);else if("function"==typeof s)t.push(s);else{if("object"!=typeof s||!s.parse&&!s.stringify)throw new Error(s+" is not a PostCSS plugin");if("production"!==process.env.NODE_ENV)throw new Error("PostCSS syntaxes cannot be used as plugins. Instead, please use one of the syntax/parser/stringifier options as outlined in your PostCSS runner documentation.")}return t}process(e,t={}){return this.plugins.length||t.parser||t.stringifier||t.syntax?new or(this,e,t):new nr(this,e,t)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}};var hr=cr;cr.default=cr,lr.registerProcessor(cr),ar.registerProcessor(cr);let ur=xe,dr=Ne,pr=ut,mr=ls,fr=Je,gr=ps,yr=vs;function wr(e,t){if(Array.isArray(e))return e.map(e=>wr(e));let{inputs:s,...r}=e;if(s){t=[];for(let e of s){let s={...e,__proto__:fr.prototype};s.map&&(s.map={...s.map,__proto__:dr.prototype}),t.push(s)}}if(r.nodes&&(r.nodes=e.nodes.map(e=>wr(e,t))),r.source){let{inputId:e,...s}=r.source;r.source=s,null!=e&&(r.source.input=t[e])}if("root"===r.type)return new gr(r);if("decl"===r.type)return new ur(r);if("rule"===r.type)return new yr(r);if("comment"===r.type)return new pr(r);if("atrule"===r.type)return new mr(r);throw new Error("Unknown node type: "+e.type)}var vr=wr;wr.default=wr;let Sr=ce,br=xe,Cr=Js,kr=It,Ir=hr,Er=ge,Tr=vr,xr=Mt,_r=Dt,Mr=ut,Or=ls,Ar=Nt,Rr=Je,Dr=As,Pr=fs,Lr=vs,Nr=ps,Fr=Ie;function Ur(...e){return 1===e.length&&Array.isArray(e[0])&&(e=e[0]),new Ir(e)}Ur.plugin=function(e,t){let s,r=!1;function i(...s){console&&console.warn&&!r&&(r=!0,console.warn(e+": postcss.plugin was deprecated. Migration guide:\nhttps://evilmartians.com/chronicles/postcss-8-plugin-migration"),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(e+": ι‡Œι’ postcss.plugin 蒫弃用. θΏη§»ζŒ‡ε—:\nhttps://www.w3ctech.com/topic/2226"));let i=t(...s);return i.postcssPlugin=e,i.postcssVersion=(new Ir).version,i}return Object.defineProperty(i,"postcss",{get:()=>(s||(s=i()),s)}),i.process=function(e,t,s){return Ur([i(s)]).process(e,t)},i},Ur.stringify=Er,Ur.parse=Dr,Ur.fromJSON=Tr,Ur.list=Pr,Ur.comment=e=>new Mr(e),Ur.atRule=e=>new Or(e),Ur.decl=e=>new br(e),Ur.rule=e=>new Lr(e),Ur.root=e=>new Nr(e),Ur.document=e=>new xr(e),Ur.CssSyntaxError=Sr,Ur.Declaration=br,Ur.Container=kr,Ur.Processor=Ir,Ur.Document=xr,Ur.Comment=Mr,Ur.Warning=_r,Ur.AtRule=Or,Ur.Result=Ar,Ur.Input=Rr,Ur.Rule=Lr,Ur.Root=Nr,Ur.Node=Fr,Cr.registerPostcss(Ur);var Br=Ur;Ur.default=Ur;const $r=Q(Br);$r.stringify,$r.fromJSON,$r.plugin,$r.parse,$r.list,$r.document,$r.comment,$r.atRule,$r.rule,$r.decl,$r.root,$r.CssSyntaxError,$r.Declaration,$r.Container,$r.Processor,$r.Document,$r.Comment,$r.Warning,$r.AtRule,$r.Result,$r.Input,$r.Rule,$r.Root,$r.Node;var zr=Object.defineProperty,jr=(e,t,s)=>((e,t,s)=>t in e?zr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s)(e,"symbol"!=typeof t?t+"":t,s);function Wr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Kr(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var s=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};s.prototype=t.prototype}else s={};return Object.defineProperty(s,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(s,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),s}var Gr={exports:{}},Vr=String,Hr=function(){return{isColorSupported:!1,reset:Vr,bold:Vr,dim:Vr,italic:Vr,underline:Vr,inverse:Vr,hidden:Vr,strikethrough:Vr,black:Vr,red:Vr,green:Vr,yellow:Vr,blue:Vr,magenta:Vr,cyan:Vr,white:Vr,gray:Vr,bgBlack:Vr,bgRed:Vr,bgGreen:Vr,bgYellow:Vr,bgBlue:Vr,bgMagenta:Vr,bgCyan:Vr,bgWhite:Vr}};Gr.exports=Hr(),Gr.exports.createColors=Hr;var Yr=Gr.exports;const Zr=Kr(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));let qr=Yr,Jr=Zr,Xr=class e extends Error{constructor(t,s,r,i,n,o){super(t),this.name="CssSyntaxError",this.reason=t,n&&(this.file=n),i&&(this.source=i),o&&(this.plugin=o),void 0!==s&&void 0!==r&&("number"==typeof s?(this.line=s,this.column=r):(this.line=s.line,this.column=s.column,this.endLine=r.line,this.endColumn=r.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,e)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",void 0!==this.line&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(e){if(!this.source)return"";let t=this.source;null==e&&(e=qr.isColorSupported),Jr&&e&&(t=Jr(t));let s,r,i=t.split(/\r?\n/),n=Math.max(this.line-3,0),o=Math.min(this.line+2,i.length),a=String(o).length;if(e){let{bold:e,gray:t,red:i}=qr.createColors(!0);s=t=>e(i(t)),r=e=>t(e)}else s=r=e=>e;return i.slice(n,o).map((e,t)=>{let i=n+1+t,o=" "+(" "+i).slice(-a)+" | ";if(i===this.line){let t=r(o.replace(/\d/g," "))+e.slice(0,this.column-1).replace(/[^\t]/g," ");return s(">")+r(o)+e+"\n "+t+s("^")}return" "+r(o)+e}).join("\n")}toString(){let e=this.showSourceCode();return e&&(e="\n\n"+e+"\n"),this.name+": "+this.message+e}};var Qr=Xr;Xr.default=Xr;var ei={};ei.isClean=Symbol("isClean"),ei.my=Symbol("my");const ti={after:"\n",beforeClose:"\n",beforeComment:"\n",beforeDecl:"\n",beforeOpen:" ",beforeRule:"\n",colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};let si=class{constructor(e){this.builder=e}atrule(e,t){let s="@"+e.name,r=e.params?this.rawValue(e,"params"):"";if(void 0!==e.raws.afterName?s+=e.raws.afterName:r&&(s+=" "),e.nodes)this.block(e,s+r);else{let i=(e.raws.between||"")+(t?";":"");this.builder(s+r+i,e)}}beforeAfter(e,t){let s;s="decl"===e.type?this.raw(e,null,"beforeDecl"):"comment"===e.type?this.raw(e,null,"beforeComment"):"before"===t?this.raw(e,null,"beforeRule"):this.raw(e,null,"beforeClose");let r=e.parent,i=0;for(;r&&"root"!==r.type;)i+=1,r=r.parent;if(s.includes("\n")){let t=this.raw(e,null,"indent");if(t.length)for(let e=0;e<i;e++)s+=t}return s}block(e,t){let s,r=this.raw(e,"between","beforeOpen");this.builder(t+r+"{",e,"start"),e.nodes&&e.nodes.length?(this.body(e),s=this.raw(e,"after")):s=this.raw(e,"after","emptyBody"),s&&this.builder(s),this.builder("}",e,"end")}body(e){let t=e.nodes.length-1;for(;t>0&&"comment"===e.nodes[t].type;)t-=1;let s=this.raw(e,"semicolon");for(let r=0;r<e.nodes.length;r++){let i=e.nodes[r],n=this.raw(i,"before");n&&this.builder(n),this.stringify(i,t!==r||s)}}comment(e){let t=this.raw(e,"left","commentLeft"),s=this.raw(e,"right","commentRight");this.builder("/*"+t+e.text+s+"*/",e)}decl(e,t){let s=this.raw(e,"between","colon"),r=e.prop+s+this.rawValue(e,"value");e.important&&(r+=e.raws.important||" !important"),t&&(r+=";"),this.builder(r,e)}document(e){this.body(e)}raw(e,t,s){let r;if(s||(s=t),t&&(r=e.raws[t],void 0!==r))return r;let i=e.parent;if("before"===s){if(!i||"root"===i.type&&i.first===e)return"";if(i&&"document"===i.type)return""}if(!i)return ti[s];let n=e.root();if(n.rawCache||(n.rawCache={}),void 0!==n.rawCache[s])return n.rawCache[s];if("before"===s||"after"===s)return this.beforeAfter(e,s);{let i="raw"+((o=s)[0].toUpperCase()+o.slice(1));this[i]?r=this[i](n,e):n.walk(e=>{if(r=e.raws[t],void 0!==r)return!1})}var o;return void 0===r&&(r=ti[s]),n.rawCache[s]=r,r}rawBeforeClose(e){let t;return e.walk(e=>{if(e.nodes&&e.nodes.length>0&&void 0!==e.raws.after)return t=e.raws.after,t.includes("\n")&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawBeforeComment(e,t){let s;return e.walkComments(e=>{if(void 0!==e.raws.before)return s=e.raws.before,s.includes("\n")&&(s=s.replace(/[^\n]+$/,"")),!1}),void 0===s?s=this.raw(t,null,"beforeDecl"):s&&(s=s.replace(/\S/g,"")),s}rawBeforeDecl(e,t){let s;return e.walkDecls(e=>{if(void 0!==e.raws.before)return s=e.raws.before,s.includes("\n")&&(s=s.replace(/[^\n]+$/,"")),!1}),void 0===s?s=this.raw(t,null,"beforeRule"):s&&(s=s.replace(/\S/g,"")),s}rawBeforeOpen(e){let t;return e.walk(e=>{if("decl"!==e.type&&(t=e.raws.between,void 0!==t))return!1}),t}rawBeforeRule(e){let t;return e.walk(s=>{if(s.nodes&&(s.parent!==e||e.first!==s)&&void 0!==s.raws.before)return t=s.raws.before,t.includes("\n")&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawColon(e){let t;return e.walkDecls(e=>{if(void 0!==e.raws.between)return t=e.raws.between.replace(/[^\s:]/g,""),!1}),t}rawEmptyBody(e){let t;return e.walk(e=>{if(e.nodes&&0===e.nodes.length&&(t=e.raws.after,void 0!==t))return!1}),t}rawIndent(e){if(e.raws.indent)return e.raws.indent;let t;return e.walk(s=>{let r=s.parent;if(r&&r!==e&&r.parent&&r.parent===e&&void 0!==s.raws.before){let e=s.raws.before.split("\n");return t=e[e.length-1],t=t.replace(/\S/g,""),!1}}),t}rawSemicolon(e){let t;return e.walk(e=>{if(e.nodes&&e.nodes.length&&"decl"===e.last.type&&(t=e.raws.semicolon,void 0!==t))return!1}),t}rawValue(e,t){let s=e[t],r=e.raws[t];return r&&r.value===s?r.raw:s}root(e){this.body(e),e.raws.after&&this.builder(e.raws.after)}rule(e){this.block(e,this.rawValue(e,"selector")),e.raws.ownSemicolon&&this.builder(e.raws.ownSemicolon,e,"end")}stringify(e,t){if(!this[e.type])throw new Error("Unknown AST node type "+e.type+". Maybe you need to change PostCSS stringifier.");this[e.type](e,t)}};var ri=si;si.default=si;let ii=ri;function ni(e,t){new ii(t).stringify(e)}var oi=ni;ni.default=ni;let{isClean:ai,my:li}=ei,ci=Qr,hi=ri,ui=oi;function di(e,t){let s=new e.constructor;for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;if("proxyCache"===r)continue;let i=e[r],n=typeof i;"parent"===r&&"object"===n?t&&(s[r]=t):"source"===r?s[r]=i:Array.isArray(i)?s[r]=i.map(e=>di(e,s)):("object"===n&&null!==i&&(i=di(i)),s[r]=i)}return s}let pi=class{constructor(e={}){this.raws={},this[ai]=!1,this[li]=!0;for(let t in e)if("nodes"===t){this.nodes=[];for(let s of e[t])"function"==typeof s.clone?this.append(s.clone()):this.append(s)}else this[t]=e[t]}addToError(e){if(e.postcssNode=this,e.stack&&this.source&&/\n\s{4}at /.test(e.stack)){let t=this.source;e.stack=e.stack.replace(/\n\s{4}at /,`$&${t.input.from}:${t.start.line}:${t.start.column}$&`)}return e}after(e){return this.parent.insertAfter(this,e),this}assign(e={}){for(let t in e)this[t]=e[t];return this}before(e){return this.parent.insertBefore(this,e),this}cleanRaws(e){delete this.raws.before,delete this.raws.after,e||delete this.raws.between}clone(e={}){let t=di(this);for(let s in e)t[s]=e[s];return t}cloneAfter(e={}){let t=this.clone(e);return this.parent.insertAfter(this,t),t}cloneBefore(e={}){let t=this.clone(e);return this.parent.insertBefore(this,t),t}error(e,t={}){if(this.source){let{end:s,start:r}=this.rangeBy(t);return this.source.input.error(e,{column:r.column,line:r.line},{column:s.column,line:s.line},t)}return new ci(e)}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:"root"===t?()=>e.root().toProxy():e[t],set:(e,t,s)=>(e[t]===s||(e[t]=s,"prop"!==t&&"value"!==t&&"name"!==t&&"params"!==t&&"important"!==t&&"text"!==t||e.markDirty()),!0)}}markDirty(){if(this[ai]){this[ai]=!1;let e=this;for(;e=e.parent;)e[ai]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e,t){let s=this.source.start;if(e.index)s=this.positionInside(e.index,t);else if(e.word){let r=(t=this.toString()).indexOf(e.word);-1!==r&&(s=this.positionInside(r,t))}return s}positionInside(e,t){let s=t||this.toString(),r=this.source.start.column,i=this.source.start.line;for(let t=0;t<e;t++)"\n"===s[t]?(r=1,i+=1):r+=1;return{column:r,line:i}}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}rangeBy(e){let t={column:this.source.start.column,line:this.source.start.line},s=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:t.column+1,line:t.line};if(e.word){let r=this.toString(),i=r.indexOf(e.word);-1!==i&&(t=this.positionInside(i,r),s=this.positionInside(i+e.word.length,r))}else e.start?t={column:e.start.column,line:e.start.line}:e.index&&(t=this.positionInside(e.index)),e.end?s={column:e.end.column,line:e.end.line}:"number"==typeof e.endIndex?s=this.positionInside(e.endIndex):e.index&&(s=this.positionInside(e.index+1));return(s.line<t.line||s.line===t.line&&s.column<=t.column)&&(s={column:t.column+1,line:t.line}),{end:s,start:t}}raw(e,t){return(new hi).raw(this,e,t)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...e){if(this.parent){let t=this,s=!1;for(let r of e)r===this?s=!0:s?(this.parent.insertAfter(t,r),t=r):this.parent.insertBefore(t,r);s||this.remove()}return this}root(){let e=this;for(;e.parent&&"document"!==e.parent.type;)e=e.parent;return e}toJSON(e,t){let s={},r=null==t;t=t||new Map;let i=0;for(let e in this){if(!Object.prototype.hasOwnProperty.call(this,e))continue;if("parent"===e||"proxyCache"===e)continue;let r=this[e];if(Array.isArray(r))s[e]=r.map(e=>"object"==typeof e&&e.toJSON?e.toJSON(null,t):e);else if("object"==typeof r&&r.toJSON)s[e]=r.toJSON(null,t);else if("source"===e){let n=t.get(r.input);null==n&&(n=i,t.set(r.input,i),i++),s[e]={end:r.end,inputId:n,start:r.start}}else s[e]=r}return r&&(s.inputs=[...t.keys()].map(e=>e.toJSON())),s}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(e=ui){e.stringify&&(e=e.stringify);let t="";return e(this,e=>{t+=e}),t}warn(e,t,s){let r={node:this};for(let e in s)r[e]=s[e];return e.warn(t,r)}get proxyOf(){return this}};var mi=pi;pi.default=pi;let fi=mi,gi=class extends fi{constructor(e){e&&void 0!==e.value&&"string"!=typeof e.value&&(e={...e,value:String(e.value)}),super(e),this.type="decl"}get variable(){return this.prop.startsWith("--")||"$"===this.prop[0]}};var yi=gi;gi.default=gi;var wi={nanoid:(e=21)=>{let t="",s=e;for(;s--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t}};let{SourceMapConsumer:vi,SourceMapGenerator:Si}=Zr,{existsSync:bi,readFileSync:Ci}=Zr,{dirname:ki,join:Ii}=Zr;let Ei=class{constructor(e,t){if(!1===t.map)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");let s=t.map?t.map.prev:void 0,r=this.loadMap(t.from,s);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=ki(this.mapFile)),r&&(this.text=r)}consumer(){return this.consumerCache||(this.consumerCache=new vi(this.text)),this.consumerCache}decodeInline(e){if(/^data:application\/json;charset=utf-?8,/.test(e)||/^data:application\/json,/.test(e))return decodeURIComponent(e.substr(RegExp.lastMatch.length));if(/^data:application\/json;charset=utf-?8;base64,/.test(e)||/^data:application\/json;base64,/.test(e))return t=e.substr(RegExp.lastMatch.length),Buffer?Buffer.from(t,"base64").toString():window.atob(t);var t;let s=e.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+s)}getAnnotationURL(e){return e.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(e){return"object"==typeof e&&("string"==typeof e.mappings||"string"==typeof e._mappings||Array.isArray(e.sections))}loadAnnotation(e){let t=e.match(/\/\*\s*# sourceMappingURL=/gm);if(!t)return;let s=e.lastIndexOf(t.pop()),r=e.indexOf("*/",s);s>-1&&r>-1&&(this.annotation=this.getAnnotationURL(e.substring(s,r)))}loadFile(e){if(this.root=ki(e),bi(e))return this.mapFile=e,Ci(e,"utf-8").toString().trim()}loadMap(e,t){if(!1===t)return!1;if(t){if("string"==typeof t)return t;if("function"!=typeof t){if(t instanceof vi)return Si.fromSourceMap(t).toString();if(t instanceof Si)return t.toString();if(this.isMap(t))return JSON.stringify(t);throw new Error("Unsupported previous source map format: "+t.toString())}{let s=t(e);if(s){let e=this.loadFile(s);if(!e)throw new Error("Unable to load previous source map: "+s.toString());return e}}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let t=this.annotation;return e&&(t=Ii(ki(e),t)),this.loadFile(t)}}}startWith(e,t){return!!e&&e.substr(0,t.length)===t}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}};var Ti=Ei;Ei.default=Ei;let{SourceMapConsumer:xi,SourceMapGenerator:_i}=Zr,{fileURLToPath:Mi,pathToFileURL:Oi}=Zr,{isAbsolute:Ai,resolve:Ri}=Zr,{nanoid:Di}=wi,Pi=Zr,Li=Qr,Ni=Ti,Fi=Symbol("fromOffsetCache"),Ui=Boolean(xi&&_i),Bi=Boolean(Ri&&Ai),$i=class{constructor(e,t={}){if(null==e||"object"==typeof e&&!e.toString)throw new Error(`PostCSS received ${e} instead of CSS string`);if(this.css=e.toString(),"\ufeff"===this.css[0]||"οΏΎ"===this.css[0]?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,t.from&&(!Bi||/^\w+:\/\//.test(t.from)||Ai(t.from)?this.file=t.from:this.file=Ri(t.from)),Bi&&Ui){let e=new Ni(this.css,t);if(e.text){this.map=e;let t=e.consumer().file;!this.file&&t&&(this.file=this.mapResolve(t))}}this.file||(this.id="<input css "+Di(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,s,r={}){let i,n,o;if(t&&"object"==typeof t){let e=t,r=s;if("number"==typeof e.offset){let r=this.fromOffset(e.offset);t=r.line,s=r.col}else t=e.line,s=e.column;if("number"==typeof r.offset){let e=this.fromOffset(r.offset);n=e.line,o=e.col}else n=r.line,o=r.column}else if(!s){let e=this.fromOffset(t);t=e.line,s=e.col}let a=this.origin(t,s,n,o);return i=a?new Li(e,void 0===a.endLine?a.line:{column:a.column,line:a.line},void 0===a.endLine?a.column:{column:a.endColumn,line:a.endLine},a.source,a.file,r.plugin):new Li(e,void 0===n?t:{column:s,line:t},void 0===n?s:{column:o,line:n},this.css,this.file,r.plugin),i.input={column:s,endColumn:o,endLine:n,line:t,source:this.css},this.file&&(Oi&&(i.input.url=Oi(this.file).toString()),i.input.file=this.file),i}fromOffset(e){let t,s;if(this[Fi])s=this[Fi];else{let e=this.css.split("\n");s=new Array(e.length);let t=0;for(let r=0,i=e.length;r<i;r++)s[r]=t,t+=e[r].length+1;this[Fi]=s}t=s[s.length-1];let r=0;if(e>=t)r=s.length-1;else{let t,i=s.length-2;for(;r<i;)if(t=r+(i-r>>1),e<s[t])i=t-1;else{if(!(e>=s[t+1])){r=t;break}r=t+1}}return{col:e-s[r]+1,line:r+1}}mapResolve(e){return/^\w+:\/\//.test(e)?e:Ri(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,s,r){if(!this.map)return!1;let i,n,o=this.map.consumer(),a=o.originalPositionFor({column:t,line:e});if(!a.source)return!1;"number"==typeof s&&(i=o.originalPositionFor({column:r,line:s})),n=Ai(a.source)?Oi(a.source):new URL(a.source,this.map.consumer().sourceRoot||Oi(this.map.mapFile));let l={column:a.column,endColumn:i&&i.column,endLine:i&&i.line,line:a.line,url:n.toString()};if("file:"===n.protocol){if(!Mi)throw new Error("file: protocol is not available in this PostCSS build");l.file=Mi(n)}let c=o.sourceContentFor(a.source);return c&&(l.source=c),l}toJSON(){let e={};for(let t of["hasBOM","css","file","id"])null!=this[t]&&(e[t]=this[t]);return this.map&&(e.map={...this.map},e.map.consumerCache&&(e.map.consumerCache=void 0)),e}get from(){return this.file||this.id}};var zi=$i;$i.default=$i,Pi&&Pi.registerInput&&Pi.registerInput($i);let{SourceMapConsumer:ji,SourceMapGenerator:Wi}=Zr,{dirname:Ki,relative:Gi,resolve:Vi,sep:Hi}=Zr,{pathToFileURL:Yi}=Zr,Zi=zi,qi=Boolean(ji&&Wi),Ji=Boolean(Ki&&Vi&&Gi&&Hi);var Xi=class{constructor(e,t,s,r){this.stringify=e,this.mapOpts=s.map||{},this.root=t,this.opts=s,this.css=r,this.originalCSS=r,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let e;e=this.isInline()?"data:application/json;base64,"+this.toBase64(this.map.toString()):"string"==typeof this.mapOpts.annotation?this.mapOpts.annotation:"function"==typeof this.mapOpts.annotation?this.mapOpts.annotation(this.opts.to,this.root):this.outputFile()+".map";let t="\n";this.css.includes("\r\n")&&(t="\r\n"),this.css+=t+"/*# sourceMappingURL="+e+" */"}applyPrevMaps(){for(let e of this.previous()){let t,s=this.toUrl(this.path(e.file)),r=e.root||Ki(e.file);!1===this.mapOpts.sourcesContent?(t=new ji(e.text),t.sourcesContent&&(t.sourcesContent=null)):t=e.consumer(),this.map.applySourceMap(t,s,this.toUrl(this.path(r)))}}clearAnnotation(){if(!1!==this.mapOpts.annotation)if(this.root){let e;for(let t=this.root.nodes.length-1;t>=0;t--)e=this.root.nodes[t],"comment"===e.type&&0===e.text.indexOf("# sourceMappingURL=")&&this.root.removeChild(t)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),Ji&&qi&&this.isMap())return this.generateMap();{let e="";return this.stringify(this.root,t=>{e+=t}),[e]}}generateMap(){if(this.root)this.generateString();else if(1===this.previous().length){let e=this.previous()[0].consumer();e.file=this.outputFile(),this.map=Wi.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new Wi({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new Wi({file:this.outputFile(),ignoreInvalidMapping:!0});let e,t,s=1,r=1,i="<no source>",n={generated:{column:0,line:0},original:{column:0,line:0},source:""};this.stringify(this.root,(o,a,l)=>{if(this.css+=o,a&&"end"!==l&&(n.generated.line=s,n.generated.column=r-1,a.source&&a.source.start?(n.source=this.sourcePath(a),n.original.line=a.source.start.line,n.original.column=a.source.start.column-1,this.map.addMapping(n)):(n.source=i,n.original.line=1,n.original.column=0,this.map.addMapping(n))),e=o.match(/\n/g),e?(s+=e.length,t=o.lastIndexOf("\n"),r=o.length-t):r+=o.length,a&&"start"!==l){let e=a.parent||{raws:{}};("decl"===a.type||"atrule"===a.type&&!a.nodes)&&a===e.last&&!e.raws.semicolon||(a.source&&a.source.end?(n.source=this.sourcePath(a),n.original.line=a.source.end.line,n.original.column=a.source.end.column-1,n.generated.line=s,n.generated.column=r-2,this.map.addMapping(n)):(n.source=i,n.original.line=1,n.original.column=0,n.generated.line=s,n.generated.column=r-1,this.map.addMapping(n)))}})}isAnnotation(){return!!this.isInline()||(void 0!==this.mapOpts.annotation?this.mapOpts.annotation:!this.previous().length||this.previous().some(e=>e.annotation))}isInline(){if(void 0!==this.mapOpts.inline)return this.mapOpts.inline;let e=this.mapOpts.annotation;return(void 0===e||!0===e)&&(!this.previous().length||this.previous().some(e=>e.inline))}isMap(){return void 0!==this.opts.map?!!this.opts.map:this.previous().length>0}isSourcesContent(){return void 0!==this.mapOpts.sourcesContent?this.mapOpts.sourcesContent:!this.previous().length||this.previous().some(e=>e.withContent())}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(e){if(this.mapOpts.absolute)return e;if(60===e.charCodeAt(0))return e;if(/^\w+:\/\//.test(e))return e;let t=this.memoizedPaths.get(e);if(t)return t;let s=this.opts.to?Ki(this.opts.to):".";"string"==typeof this.mapOpts.annotation&&(s=Ki(Vi(s,this.mapOpts.annotation)));let r=Gi(s,e);return this.memoizedPaths.set(e,r),r}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(e=>{if(e.source&&e.source.input.map){let t=e.source.input.map;this.previousMaps.includes(t)||this.previousMaps.push(t)}});else{let e=new Zi(this.originalCSS,this.opts);e.map&&this.previousMaps.push(e.map)}return this.previousMaps}setSourcesContent(){let e={};if(this.root)this.root.walk(t=>{if(t.source){let s=t.source.input.from;if(s&&!e[s]){e[s]=!0;let r=this.usesFileUrls?this.toFileUrl(s):this.toUrl(this.path(s));this.map.setSourceContent(r,t.source.input.css)}}});else if(this.css){let e=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(e,this.css)}}sourcePath(e){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(e.source.input.from):this.toUrl(this.path(e.source.input.from))}toBase64(e){return Buffer?Buffer.from(e).toString("base64"):window.btoa(unescape(encodeURIComponent(e)))}toFileUrl(e){let t=this.memoizedFileURLs.get(e);if(t)return t;if(Yi){let t=Yi(e).toString();return this.memoizedFileURLs.set(e,t),t}throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(e){let t=this.memoizedURLs.get(e);if(t)return t;"\\"===Hi&&(e=e.replace(/\\/g,"/"));let s=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,s),s}};let Qi=mi,en=class extends Qi{constructor(e){super(e),this.type="comment"}};var tn=en;en.default=en;let sn,rn,nn,on,{isClean:an,my:ln}=ei,cn=yi,hn=tn,un=mi;function dn(e){return e.map(e=>(e.nodes&&(e.nodes=dn(e.nodes)),delete e.source,e))}function pn(e){if(e[an]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)pn(t)}let mn=class e extends un{append(...e){for(let t of e){let e=this.normalize(t,this.last);for(let t of e)this.proxyOf.nodes.push(t)}return this.markDirty(),this}cleanRaws(e){if(super.cleanRaws(e),this.nodes)for(let t of this.nodes)t.cleanRaws(e)}each(e){if(!this.proxyOf.nodes)return;let t,s,r=this.getIterator();for(;this.indexes[r]<this.proxyOf.nodes.length&&(t=this.indexes[r],s=e(this.proxyOf.nodes[t],t),!1!==s);)this.indexes[r]+=1;return delete this.indexes[r],s}every(e){return this.nodes.every(e)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let e=this.lastEach;return this.indexes[e]=0,e}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:e[t]?"each"===t||"string"==typeof t&&t.startsWith("walk")?(...s)=>e[t](...s.map(e=>"function"==typeof e?(t,s)=>e(t.toProxy(),s):e)):"every"===t||"some"===t?s=>e[t]((e,...t)=>s(e.toProxy(),...t)):"root"===t?()=>e.root().toProxy():"nodes"===t?e.nodes.map(e=>e.toProxy()):"first"===t||"last"===t?e[t].toProxy():e[t]:e[t],set:(e,t,s)=>(e[t]===s||(e[t]=s,"name"!==t&&"params"!==t&&"selector"!==t||e.markDirty()),!0)}}index(e){return"number"==typeof e?e:(e.proxyOf&&(e=e.proxyOf),this.proxyOf.nodes.indexOf(e))}insertAfter(e,t){let s,r=this.index(e),i=this.normalize(t,this.proxyOf.nodes[r]).reverse();r=this.index(e);for(let e of i)this.proxyOf.nodes.splice(r+1,0,e);for(let e in this.indexes)s=this.indexes[e],r<s&&(this.indexes[e]=s+i.length);return this.markDirty(),this}insertBefore(e,t){let s,r=this.index(e),i=0===r&&"prepend",n=this.normalize(t,this.proxyOf.nodes[r],i).reverse();r=this.index(e);for(let e of n)this.proxyOf.nodes.splice(r,0,e);for(let e in this.indexes)s=this.indexes[e],r<=s&&(this.indexes[e]=s+n.length);return this.markDirty(),this}normalize(t,s){if("string"==typeof t)t=dn(sn(t).nodes);else if(void 0===t)t=[];else if(Array.isArray(t)){t=t.slice(0);for(let e of t)e.parent&&e.parent.removeChild(e,"ignore")}else if("root"===t.type&&"document"!==this.type){t=t.nodes.slice(0);for(let e of t)e.parent&&e.parent.removeChild(e,"ignore")}else if(t.type)t=[t];else if(t.prop){if(void 0===t.value)throw new Error("Value field is missed in node creation");"string"!=typeof t.value&&(t.value=String(t.value)),t=[new cn(t)]}else if(t.selector)t=[new rn(t)];else if(t.name)t=[new nn(t)];else{if(!t.text)throw new Error("Unknown node type in node creation");t=[new hn(t)]}return t.map(t=>(t[ln]||e.rebuild(t),(t=t.proxyOf).parent&&t.parent.removeChild(t),t[an]&&pn(t),void 0===t.raws.before&&s&&void 0!==s.raws.before&&(t.raws.before=s.raws.before.replace(/\S/g,"")),t.parent=this.proxyOf,t))}prepend(...e){e=e.reverse();for(let t of e){let e=this.normalize(t,this.first,"prepend").reverse();for(let t of e)this.proxyOf.nodes.unshift(t);for(let t in this.indexes)this.indexes[t]=this.indexes[t]+e.length}return this.markDirty(),this}push(e){return e.parent=this,this.proxyOf.nodes.push(e),this}removeAll(){for(let e of this.proxyOf.nodes)e.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(e){let t;e=this.index(e),this.proxyOf.nodes[e].parent=void 0,this.proxyOf.nodes.splice(e,1);for(let s in this.indexes)t=this.indexes[s],t>=e&&(this.indexes[s]=t-1);return this.markDirty(),this}replaceValues(e,t,s){return s||(s=t,t={}),this.walkDecls(r=>{t.props&&!t.props.includes(r.prop)||t.fast&&!r.value.includes(t.fast)||(r.value=r.value.replace(e,s))}),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each((t,s)=>{let r;try{r=e(t,s)}catch(e){throw t.addToError(e)}return!1!==r&&t.walk&&(r=t.walk(e)),r})}walkAtRules(e,t){return t?e instanceof RegExp?this.walk((s,r)=>{if("atrule"===s.type&&e.test(s.name))return t(s,r)}):this.walk((s,r)=>{if("atrule"===s.type&&s.name===e)return t(s,r)}):(t=e,this.walk((e,s)=>{if("atrule"===e.type)return t(e,s)}))}walkComments(e){return this.walk((t,s)=>{if("comment"===t.type)return e(t,s)})}walkDecls(e,t){return t?e instanceof RegExp?this.walk((s,r)=>{if("decl"===s.type&&e.test(s.prop))return t(s,r)}):this.walk((s,r)=>{if("decl"===s.type&&s.prop===e)return t(s,r)}):(t=e,this.walk((e,s)=>{if("decl"===e.type)return t(e,s)}))}walkRules(e,t){return t?e instanceof RegExp?this.walk((s,r)=>{if("rule"===s.type&&e.test(s.selector))return t(s,r)}):this.walk((s,r)=>{if("rule"===s.type&&s.selector===e)return t(s,r)}):(t=e,this.walk((e,s)=>{if("rule"===e.type)return t(e,s)}))}get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}};mn.registerParse=e=>{sn=e},mn.registerRule=e=>{rn=e},mn.registerAtRule=e=>{nn=e},mn.registerRoot=e=>{on=e};var fn=mn;mn.default=mn,mn.rebuild=e=>{"atrule"===e.type?Object.setPrototypeOf(e,nn.prototype):"rule"===e.type?Object.setPrototypeOf(e,rn.prototype):"decl"===e.type?Object.setPrototypeOf(e,cn.prototype):"comment"===e.type?Object.setPrototypeOf(e,hn.prototype):"root"===e.type&&Object.setPrototypeOf(e,on.prototype),e[ln]=!0,e.nodes&&e.nodes.forEach(e=>{mn.rebuild(e)})};let gn,yn,wn=fn,vn=class extends wn{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(e={}){return new gn(new yn,this,e).stringify()}};vn.registerLazyResult=e=>{gn=e},vn.registerProcessor=e=>{yn=e};var Sn=vn;vn.default=vn;let bn={};var Cn=function(e){bn[e]||(bn[e]=!0,"undefined"!=typeof console&&console.warn&&console.warn(e))};let kn=class{constructor(e,t={}){if(this.type="warning",this.text=e,t.node&&t.node.source){let e=t.node.rangeBy(t);this.line=e.start.line,this.column=e.start.column,this.endLine=e.end.line,this.endColumn=e.end.column}for(let e in t)this[e]=t[e]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}};var In=kn;kn.default=kn;let En=In,Tn=class{constructor(e,t,s){this.processor=e,this.messages=[],this.root=t,this.opts=s,this.css=void 0,this.map=void 0}toString(){return this.css}warn(e,t={}){t.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(t.plugin=this.lastPlugin.postcssPlugin);let s=new En(e,t);return this.messages.push(s),s}warnings(){return this.messages.filter(e=>"warning"===e.type)}get content(){return this.css}};var xn=Tn;Tn.default=Tn;const _n="'".charCodeAt(0),Mn='"'.charCodeAt(0),On="\\".charCodeAt(0),An="/".charCodeAt(0),Rn="\n".charCodeAt(0),Dn=" ".charCodeAt(0),Pn="\f".charCodeAt(0),Ln="\t".charCodeAt(0),Nn="\r".charCodeAt(0),Fn="[".charCodeAt(0),Un="]".charCodeAt(0),Bn="(".charCodeAt(0),$n=")".charCodeAt(0),zn="{".charCodeAt(0),jn="}".charCodeAt(0),Wn=";".charCodeAt(0),Kn="*".charCodeAt(0),Gn=":".charCodeAt(0),Vn="@".charCodeAt(0),Hn=/[\t\n\f\r "#'()/;[\\\]{}]/g,Yn=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,Zn=/.[\r\n"'(/\\]/,qn=/[\da-f]/i;let Jn=fn,Xn=class extends Jn{constructor(e){super(e),this.type="atrule"}append(...e){return this.proxyOf.nodes||(this.nodes=[]),super.append(...e)}prepend(...e){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...e)}};var Qn=Xn;Xn.default=Xn,Jn.registerAtRule(Xn);let eo,to,so=fn,ro=class extends so{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}normalize(e,t,s){let r=super.normalize(e);if(t)if("prepend"===s)this.nodes.length>1?t.raws.before=this.nodes[1].raws.before:delete t.raws.before;else if(this.first!==t)for(let e of r)e.raws.before=t.raws.before;return r}removeChild(e,t){let s=this.index(e);return!t&&0===s&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[s].raws.before),super.removeChild(e)}toResult(e={}){return new eo(new to,this,e).stringify()}};ro.registerLazyResult=e=>{eo=e},ro.registerProcessor=e=>{to=e};var io=ro;ro.default=ro,so.registerRoot(ro);let no={comma:e=>no.split(e,[","],!0),space:e=>no.split(e,[" ","\n","\t"]),split(e,t,s){let r=[],i="",n=!1,o=0,a=!1,l="",c=!1;for(let s of e)c?c=!1:"\\"===s?c=!0:a?s===l&&(a=!1):'"'===s||"'"===s?(a=!0,l=s):"("===s?o+=1:")"===s?o>0&&(o-=1):0===o&&t.includes(s)&&(n=!0),n?(""!==i&&r.push(i.trim()),i="",n=!1):i+=s;return(s||""!==i)&&r.push(i.trim()),r}};var oo=no;no.default=no;let ao=fn,lo=oo,co=class extends ao{constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return lo.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\s*/):null,s=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(s)}};var ho=co;co.default=co,ao.registerRule(co);let uo=yi,po=function(e,t={}){let s,r,i,n,o,a,l,c,h,u,d=e.css.valueOf(),p=t.ignoreErrors,m=d.length,f=0,g=[],y=[];function w(t){throw e.error("Unclosed "+t,f)}return{back:function(e){y.push(e)},endOfFile:function(){return 0===y.length&&f>=m},nextToken:function(e){if(y.length)return y.pop();if(f>=m)return;let t=!!e&&e.ignoreUnclosed;switch(s=d.charCodeAt(f),s){case Rn:case Dn:case Ln:case Nn:case Pn:r=f;do{r+=1,s=d.charCodeAt(r)}while(s===Dn||s===Rn||s===Ln||s===Nn||s===Pn);u=["space",d.slice(f,r)],f=r-1;break;case Fn:case Un:case zn:case jn:case Gn:case Wn:case $n:{let e=String.fromCharCode(s);u=[e,e,f];break}case Bn:if(c=g.length?g.pop()[1]:"",h=d.charCodeAt(f+1),"url"===c&&h!==_n&&h!==Mn&&h!==Dn&&h!==Rn&&h!==Ln&&h!==Pn&&h!==Nn){r=f;do{if(a=!1,r=d.indexOf(")",r+1),-1===r){if(p||t){r=f;break}w("bracket")}for(l=r;d.charCodeAt(l-1)===On;)l-=1,a=!a}while(a);u=["brackets",d.slice(f,r+1),f,r],f=r}else r=d.indexOf(")",f+1),n=d.slice(f,r+1),-1===r||Zn.test(n)?u=["(","(",f]:(u=["brackets",n,f,r],f=r);break;case _n:case Mn:i=s===_n?"'":'"',r=f;do{if(a=!1,r=d.indexOf(i,r+1),-1===r){if(p||t){r=f+1;break}w("string")}for(l=r;d.charCodeAt(l-1)===On;)l-=1,a=!a}while(a);u=["string",d.slice(f,r+1),f,r],f=r;break;case Vn:Hn.lastIndex=f+1,Hn.test(d),r=0===Hn.lastIndex?d.length-1:Hn.lastIndex-2,u=["at-word",d.slice(f,r+1),f,r],f=r;break;case On:for(r=f,o=!0;d.charCodeAt(r+1)===On;)r+=1,o=!o;if(s=d.charCodeAt(r+1),o&&s!==An&&s!==Dn&&s!==Rn&&s!==Ln&&s!==Nn&&s!==Pn&&(r+=1,qn.test(d.charAt(r)))){for(;qn.test(d.charAt(r+1));)r+=1;d.charCodeAt(r+1)===Dn&&(r+=1)}u=["word",d.slice(f,r+1),f,r],f=r;break;default:s===An&&d.charCodeAt(f+1)===Kn?(r=d.indexOf("*/",f+2)+1,0===r&&(p||t?r=d.length:w("comment")),u=["comment",d.slice(f,r+1),f,r],f=r):(Yn.lastIndex=f+1,Yn.test(d),r=0===Yn.lastIndex?d.length-1:Yn.lastIndex-2,u=["word",d.slice(f,r+1),f,r],g.push(u),f=r)}return f++,u},position:function(){return f}}},mo=tn,fo=Qn,go=io,yo=ho;const wo={empty:!0,space:!0};let vo=fn,So=class{constructor(e){this.input=e,this.root=new go,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}atrule(e){let t,s,r,i=new fo;i.name=e[1].slice(1),""===i.name&&this.unnamedAtrule(i,e),this.init(i,e[2]);let n=!1,o=!1,a=[],l=[];for(;!this.tokenizer.endOfFile();){if(t=(e=this.tokenizer.nextToken())[0],"("===t||"["===t?l.push("("===t?")":"]"):"{"===t&&l.length>0?l.push("}"):t===l[l.length-1]&&l.pop(),0===l.length){if(";"===t){i.source.end=this.getPosition(e[2]),i.source.end.offset++,this.semicolon=!0;break}if("{"===t){o=!0;break}if("}"===t){if(a.length>0){for(r=a.length-1,s=a[r];s&&"space"===s[0];)s=a[--r];s&&(i.source.end=this.getPosition(s[3]||s[2]),i.source.end.offset++)}this.end(e);break}a.push(e)}else a.push(e);if(this.tokenizer.endOfFile()){n=!0;break}}i.raws.between=this.spacesAndCommentsFromEnd(a),a.length?(i.raws.afterName=this.spacesAndCommentsFromStart(a),this.raw(i,"params",a),n&&(e=a[a.length-1],i.source.end=this.getPosition(e[3]||e[2]),i.source.end.offset++,this.spaces=i.raws.between,i.raws.between="")):(i.raws.afterName="",i.params=""),o&&(i.nodes=[],this.current=i)}checkMissedSemicolon(e){let t=this.colon(e);if(!1===t)return;let s,r=0;for(let i=t-1;i>=0&&(s=e[i],"space"===s[0]||(r+=1,2!==r));i--);throw this.input.error("Missed semicolon","word"===s[0]?s[3]+1:s[2])}colon(e){let t,s,r,i=0;for(let[n,o]of e.entries()){if(t=o,s=t[0],"("===s&&(i+=1),")"===s&&(i-=1),0===i&&":"===s){if(r){if("word"===r[0]&&"progid"===r[1])continue;return n}this.doubleColon(t)}r=t}return!1}comment(e){let t=new mo;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;let s=e[1].slice(2,-2);if(/^\s*$/.test(s))t.text="",t.raws.left=s,t.raws.right="";else{let e=s.match(/^(\s*)([^]*\S)(\s*)$/);t.text=e[2],t.raws.left=e[1],t.raws.right=e[3]}}createTokenizer(){this.tokenizer=po(this.input)}decl(e,t){let s=new uo;this.init(s,e[0][2]);let r,i=e[e.length-1];for(";"===i[0]&&(this.semicolon=!0,e.pop()),s.source.end=this.getPosition(i[3]||i[2]||function(e){for(let t=e.length-1;t>=0;t--){let s=e[t],r=s[3]||s[2];if(r)return r}}(e)),s.source.end.offset++;"word"!==e[0][0];)1===e.length&&this.unknownWord(e),s.raws.before+=e.shift()[1];for(s.source.start=this.getPosition(e[0][2]),s.prop="";e.length;){let t=e[0][0];if(":"===t||"space"===t||"comment"===t)break;s.prop+=e.shift()[1]}for(s.raws.between="";e.length;){if(r=e.shift(),":"===r[0]){s.raws.between+=r[1];break}"word"===r[0]&&/\w/.test(r[1])&&this.unknownWord([r]),s.raws.between+=r[1]}"_"!==s.prop[0]&&"*"!==s.prop[0]||(s.raws.before+=s.prop[0],s.prop=s.prop.slice(1));let n,o=[];for(;e.length&&(n=e[0][0],"space"===n||"comment"===n);)o.push(e.shift());this.precheckMissedSemicolon(e);for(let t=e.length-1;t>=0;t--){if(r=e[t],"!important"===r[1].toLowerCase()){s.important=!0;let r=this.stringFrom(e,t);r=this.spacesFromEnd(e)+r," !important"!==r&&(s.raws.important=r);break}if("important"===r[1].toLowerCase()){let r=e.slice(0),i="";for(let e=t;e>0;e--){let t=r[e][0];if(0===i.trim().indexOf("!")&&"space"!==t)break;i=r.pop()[1]+i}0===i.trim().indexOf("!")&&(s.important=!0,s.raws.important=i,e=r)}if("space"!==r[0]&&"comment"!==r[0])break}e.some(e=>"space"!==e[0]&&"comment"!==e[0])&&(s.raws.between+=o.map(e=>e[1]).join(""),o=[]),this.raw(s,"value",o.concat(e),t),s.value.includes(":")&&!t&&this.checkMissedSemicolon(e)}doubleColon(e){throw this.input.error("Double colon",{offset:e[2]},{offset:e[2]+e[1].length})}emptyRule(e){let t=new yo;this.init(t,e[2]),t.selector="",t.raws.between="",this.current=t}end(e){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(e[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(e)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(e){if(this.spaces+=e[1],this.current.nodes){let e=this.current.nodes[this.current.nodes.length-1];e&&"rule"===e.type&&!e.raws.ownSemicolon&&(e.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(e){let t=this.input.fromOffset(e);return{column:t.col,line:t.line,offset:e}}init(e,t){this.current.push(e),e.source={input:this.input,start:this.getPosition(t)},e.raws.before=this.spaces,this.spaces="","comment"!==e.type&&(this.semicolon=!1)}other(e){let t=!1,s=null,r=!1,i=null,n=[],o=e[1].startsWith("--"),a=[],l=e;for(;l;){if(s=l[0],a.push(l),"("===s||"["===s)i||(i=l),n.push("("===s?")":"]");else if(o&&r&&"{"===s)i||(i=l),n.push("}");else if(0===n.length){if(";"===s){if(r)return void this.decl(a,o);break}if("{"===s)return void this.rule(a);if("}"===s){this.tokenizer.back(a.pop()),t=!0;break}":"===s&&(r=!0)}else s===n[n.length-1]&&(n.pop(),0===n.length&&(i=null));l=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),n.length>0&&this.unclosedBracket(i),t&&r){if(!o)for(;a.length&&(l=a[a.length-1][0],"space"===l||"comment"===l);)this.tokenizer.back(a.pop());this.decl(a,o)}else this.unknownWord(a)}parse(){let e;for(;!this.tokenizer.endOfFile();)switch(e=this.tokenizer.nextToken(),e[0]){case"space":this.spaces+=e[1];break;case";":this.freeSemicolon(e);break;case"}":this.end(e);break;case"comment":this.comment(e);break;case"at-word":this.atrule(e);break;case"{":this.emptyRule(e);break;default:this.other(e)}this.endFile()}precheckMissedSemicolon(){}raw(e,t,s,r){let i,n,o,a,l=s.length,c="",h=!0;for(let e=0;e<l;e+=1)i=s[e],n=i[0],"space"!==n||e!==l-1||r?"comment"===n?(a=s[e-1]?s[e-1][0]:"empty",o=s[e+1]?s[e+1][0]:"empty",wo[a]||wo[o]||","===c.slice(-1)?h=!1:c+=i[1]):c+=i[1]:h=!1;if(!h){let r=s.reduce((e,t)=>e+t[1],"");e.raws[t]={raw:r,value:c}}e[t]=c}rule(e){e.pop();let t=new yo;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t}spacesAndCommentsFromEnd(e){let t,s="";for(;e.length&&(t=e[e.length-1][0],"space"===t||"comment"===t);)s=e.pop()[1]+s;return s}spacesAndCommentsFromStart(e){let t,s="";for(;e.length&&(t=e[0][0],"space"===t||"comment"===t);)s+=e.shift()[1];return s}spacesFromEnd(e){let t,s="";for(;e.length&&(t=e[e.length-1][0],"space"===t);)s=e.pop()[1]+s;return s}stringFrom(e,t){let s="";for(let r=t;r<e.length;r++)s+=e[r][1];return e.splice(t,e.length-t),s}unclosedBlock(){let e=this.current.source.start;throw this.input.error("Unclosed block",e.line,e.column)}unclosedBracket(e){throw this.input.error("Unclosed bracket",{offset:e[2]},{offset:e[2]+1})}unexpectedClose(e){throw this.input.error("Unexpected }",{offset:e[2]},{offset:e[2]+1})}unknownWord(e){throw this.input.error("Unknown word",{offset:e[0][2]},{offset:e[0][2]+e[0][1].length})}unnamedAtrule(e,t){throw this.input.error("At-rule without name",{offset:t[2]},{offset:t[2]+t[1].length})}},bo=zi;function Co(e,t){let s=new bo(e,t),r=new So(s);try{r.parse()}catch(e){throw"production"!==process.env.NODE_ENV&&"CssSyntaxError"===e.name&&t&&t.from&&(/\.scss$/i.test(t.from)?e.message+="\nYou tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser":/\.sass/i.test(t.from)?e.message+="\nYou tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser":/\.less$/i.test(t.from)&&(e.message+="\nYou tried to parse Less with the standard CSS parser; try again with the postcss-less parser")),e}return r.root}var ko=Co;Co.default=Co,vo.registerParse(Co);let{isClean:Io,my:Eo}=ei,To=Xi,xo=oi,_o=fn,Mo=Sn,Oo=Cn,Ao=xn,Ro=ko,Do=io;const Po={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},Lo={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},No={Once:!0,postcssPlugin:!0,prepare:!0};function Fo(e){return"object"==typeof e&&"function"==typeof e.then}function Uo(e){let t=!1,s=Po[e.type];return"decl"===e.type?t=e.prop.toLowerCase():"atrule"===e.type&&(t=e.name.toLowerCase()),t&&e.append?[s,s+"-"+t,0,s+"Exit",s+"Exit-"+t]:t?[s,s+"-"+t,s+"Exit",s+"Exit-"+t]:e.append?[s,0,s+"Exit"]:[s,s+"Exit"]}function Bo(e){let t;return t="document"===e.type?["Document",0,"DocumentExit"]:"root"===e.type?["Root",0,"RootExit"]:Uo(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function $o(e){return e[Io]=!1,e.nodes&&e.nodes.forEach(e=>$o(e)),e}let zo={},jo=class e{constructor(t,s,r){let i;if(this.stringified=!1,this.processed=!1,"object"!=typeof s||null===s||"root"!==s.type&&"document"!==s.type)if(s instanceof e||s instanceof Ao)i=$o(s.root),s.map&&(void 0===r.map&&(r.map={}),r.map.inline||(r.map.inline=!1),r.map.prev=s.map);else{let e=Ro;r.syntax&&(e=r.syntax.parse),r.parser&&(e=r.parser),e.parse&&(e=e.parse);try{i=e(s,r)}catch(e){this.processed=!0,this.error=e}i&&!i[Eo]&&_o.rebuild(i)}else i=$o(s);this.result=new Ao(t,i,r),this.helpers={...zo,postcss:zo,result:this.result},this.plugins=this.processor.plugins.map(e=>"object"==typeof e&&e.prepare?{...e,...e.prepare(this.result)}:e)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(e,t){let s=this.result.lastPlugin;try{if(t&&t.addToError(e),this.error=e,"CssSyntaxError"!==e.name||e.plugin){if(s.postcssVersion&&"production"!==process.env.NODE_ENV){let e=s.postcssPlugin,t=s.postcssVersion,r=this.result.processor.version,i=t.split("."),n=r.split(".");(i[0]!==n[0]||parseInt(i[1])>parseInt(n[1]))&&console.error("Unknown error from PostCSS plugin. Your current PostCSS version is "+r+", but "+e+" uses "+t+". Perhaps this is the source of the error below.")}}else e.plugin=s.postcssPlugin,e.setMessage()}catch(e){console&&console.error&&console.error(e)}return e}prepareVisitors(){this.listeners={};let e=(e,t,s)=>{this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push([e,s])};for(let t of this.plugins)if("object"==typeof t)for(let s in t){if(!Lo[s]&&/^[A-Z]/.test(s))throw new Error(`Unknown event ${s} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!No[s])if("object"==typeof t[s])for(let r in t[s])e(t,"*"===r?s:s+"-"+r.toLowerCase(),t[s][r]);else"function"==typeof t[s]&&e(t,s,t[s])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let e=0;e<this.plugins.length;e++){let t=this.plugins[e],s=this.runOnRoot(t);if(Fo(s))try{await s}catch(e){throw this.handleError(e)}}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[Io];){e[Io]=!0;let t=[Bo(e)];for(;t.length>0;){let e=this.visitTick(t);if(Fo(e))try{await e}catch(e){let s=t[t.length-1].node;throw this.handleError(e,s)}}}if(this.listeners.OnceExit)for(let[t,s]of this.listeners.OnceExit){this.result.lastPlugin=t;try{if("document"===e.type){let t=e.nodes.map(e=>s(e,this.helpers));await Promise.all(t)}else await s(e,this.helpers)}catch(e){throw this.handleError(e)}}}return this.processed=!0,this.stringify()}runOnRoot(e){this.result.lastPlugin=e;try{if("object"==typeof e&&e.Once){if("document"===this.result.root.type){let t=this.result.root.nodes.map(t=>e.Once(t,this.helpers));return Fo(t[0])?Promise.all(t):t}return e.Once(this.result.root,this.helpers)}if("function"==typeof e)return e(this.result.root,this.result)}catch(e){throw this.handleError(e)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let e=this.result.opts,t=xo;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let s=new To(t,this.result.root,this.result.opts).generate();return this.result.css=s[0],this.result.map=s[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let e of this.plugins){if(Fo(this.runOnRoot(e)))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[Io];)e[Io]=!0,this.walkSync(e);if(this.listeners.OnceExit)if("document"===e.type)for(let t of e.nodes)this.visitSync(this.listeners.OnceExit,t);else this.visitSync(this.listeners.OnceExit,e)}return this.result}then(e,t){return"production"!==process.env.NODE_ENV&&("from"in this.opts||Oo("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(e,t)}toString(){return this.css}visitSync(e,t){for(let[s,r]of e){let e;this.result.lastPlugin=s;try{e=r(t,this.helpers)}catch(e){throw this.handleError(e,t.proxyOf)}if("root"!==t.type&&"document"!==t.type&&!t.parent)return!0;if(Fo(e))throw this.getAsyncError()}}visitTick(e){let t=e[e.length-1],{node:s,visitors:r}=t;if("root"!==s.type&&"document"!==s.type&&!s.parent)return void e.pop();if(r.length>0&&t.visitorIndex<r.length){let[e,i]=r[t.visitorIndex];t.visitorIndex+=1,t.visitorIndex===r.length&&(t.visitors=[],t.visitorIndex=0),this.result.lastPlugin=e;try{return i(s.toProxy(),this.helpers)}catch(e){throw this.handleError(e,s)}}if(0!==t.iterator){let r,i=t.iterator;for(;r=s.nodes[s.indexes[i]];)if(s.indexes[i]+=1,!r[Io])return r[Io]=!0,void e.push(Bo(r));t.iterator=0,delete s.indexes[i]}let i=t.events;for(;t.eventIndex<i.length;){let e=i[t.eventIndex];if(t.eventIndex+=1,0===e)return void(s.nodes&&s.nodes.length&&(s[Io]=!0,t.iterator=s.getIterator()));if(this.listeners[e])return void(t.visitors=this.listeners[e])}e.pop()}walkSync(e){e[Io]=!0;let t=Uo(e);for(let s of t)if(0===s)e.nodes&&e.each(e=>{e[Io]||this.walkSync(e)});else{let t=this.listeners[s];if(t&&this.visitSync(t,e.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}};jo.registerPostcss=e=>{zo=e};var Wo=jo;jo.default=jo,Do.registerLazyResult(jo),Mo.registerLazyResult(jo);let Ko=Xi,Go=oi,Vo=Cn,Ho=ko;const Yo=xn;let Zo=class{constructor(e,t,s){let r;t=t.toString(),this.stringified=!1,this._processor=e,this._css=t,this._opts=s,this._map=void 0;let i=Go;this.result=new Yo(this._processor,r,this._opts),this.result.css=t;let n=this;Object.defineProperty(this.result,"root",{get:()=>n.root});let o=new Ko(i,r,this._opts,t);if(o.isMap()){let[e,t]=o.generate();e&&(this.result.css=e),t&&(this.result.map=t)}else o.clearAnnotation(),this.result.css=o.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}sync(){if(this.error)throw this.error;return this.result}then(e,t){return"production"!==process.env.NODE_ENV&&("from"in this._opts||Vo("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(e,t)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let e,t=Ho;try{e=t(this._css,this._opts)}catch(e){this.error=e}if(this.error)throw this.error;return this._root=e,e}get[Symbol.toStringTag](){return"NoWorkResult"}};var qo=Zo;Zo.default=Zo;let Jo=qo,Xo=Wo,Qo=Sn,ea=io,ta=class{constructor(e=[]){this.version="8.4.38",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let s of e)if(!0===s.postcss?s=s():s.postcss&&(s=s.postcss),"object"==typeof s&&Array.isArray(s.plugins))t=t.concat(s.plugins);else if("object"==typeof s&&s.postcssPlugin)t.push(s);else if("function"==typeof s)t.push(s);else{if("object"!=typeof s||!s.parse&&!s.stringify)throw new Error(s+" is not a PostCSS plugin");if("production"!==process.env.NODE_ENV)throw new Error("PostCSS syntaxes cannot be used as plugins. Instead, please use one of the syntax/parser/stringifier options as outlined in your PostCSS runner documentation.")}return t}process(e,t={}){return this.plugins.length||t.parser||t.stringifier||t.syntax?new Xo(this,e,t):new Jo(this,e,t)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}};var sa=ta;ta.default=ta,ea.registerProcessor(ta),Qo.registerProcessor(ta);let ra=yi,ia=Ti,na=tn,oa=Qn,aa=zi,la=io,ca=ho;function ha(e,t){if(Array.isArray(e))return e.map(e=>ha(e));let{inputs:s,...r}=e;if(s){t=[];for(let e of s){let s={...e,__proto__:aa.prototype};s.map&&(s.map={...s.map,__proto__:ia.prototype}),t.push(s)}}if(r.nodes&&(r.nodes=e.nodes.map(e=>ha(e,t))),r.source){let{inputId:e,...s}=r.source;r.source=s,null!=e&&(r.source.input=t[e])}if("root"===r.type)return new la(r);if("decl"===r.type)return new ra(r);if("rule"===r.type)return new ca(r);if("comment"===r.type)return new na(r);if("atrule"===r.type)return new oa(r);throw new Error("Unknown node type: "+e.type)}var ua=ha;ha.default=ha;let da=Qr,pa=yi,ma=Wo,fa=fn,ga=sa,ya=oi,wa=ua,va=Sn,Sa=In,ba=tn,Ca=Qn,ka=xn,Ia=zi,Ea=ko,Ta=oo,xa=ho,_a=io,Ma=mi;function Oa(...e){return 1===e.length&&Array.isArray(e[0])&&(e=e[0]),new ga(e)}Oa.plugin=function(e,t){let s,r=!1;function i(...s){console&&console.warn&&!r&&(r=!0,console.warn(e+": postcss.plugin was deprecated. Migration guide:\nhttps://evilmartians.com/chronicles/postcss-8-plugin-migration"),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(e+": ι‡Œι’ postcss.plugin 蒫弃用. θΏη§»ζŒ‡ε—:\nhttps://www.w3ctech.com/topic/2226"));let i=t(...s);return i.postcssPlugin=e,i.postcssVersion=(new ga).version,i}return Object.defineProperty(i,"postcss",{get:()=>(s||(s=i()),s)}),i.process=function(e,t,s){return Oa([i(s)]).process(e,t)},i},Oa.stringify=ya,Oa.parse=Ea,Oa.fromJSON=wa,Oa.list=Ta,Oa.comment=e=>new ba(e),Oa.atRule=e=>new Ca(e),Oa.decl=e=>new pa(e),Oa.rule=e=>new xa(e),Oa.root=e=>new _a(e),Oa.document=e=>new va(e),Oa.CssSyntaxError=da,Oa.Declaration=pa,Oa.Container=fa,Oa.Processor=ga,Oa.Document=va,Oa.Comment=ba,Oa.Warning=Sa,Oa.AtRule=Ca,Oa.Result=ka,Oa.Input=Ia,Oa.Rule=xa,Oa.Root=_a,Oa.Node=Ma,ma.registerPostcss(Oa);var Aa=Oa;Oa.default=Oa;const Ra=Wr(Aa);Ra.stringify,Ra.fromJSON,Ra.plugin,Ra.parse,Ra.list,Ra.document,Ra.comment,Ra.atRule,Ra.rule,Ra.decl,Ra.root,Ra.CssSyntaxError,Ra.Declaration,Ra.Container,Ra.Processor,Ra.Document,Ra.Comment,Ra.Warning,Ra.AtRule,Ra.Result,Ra.Input,Ra.Rule,Ra.Root,Ra.Node;class Da{constructor(...e){jr(this,"parentElement",null),jr(this,"parentNode",null),jr(this,"ownerDocument"),jr(this,"firstChild",null),jr(this,"lastChild",null),jr(this,"previousSibling",null),jr(this,"nextSibling",null),jr(this,"ELEMENT_NODE",1),jr(this,"TEXT_NODE",3),jr(this,"nodeType"),jr(this,"nodeName"),jr(this,"RRNodeType")}get childNodes(){const e=[];let t=this.firstChild;for(;t;)e.push(t),t=t.nextSibling;return e}contains(e){if(!(e instanceof Da))return!1;if(e.ownerDocument!==this.ownerDocument)return!1;if(e===this)return!0;for(;e.parentNode;){if(e.parentNode===this)return!0;e=e.parentNode}return!1}appendChild(e){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(e,t){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}}const Pa={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},La={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Na={};function Fa(e){if(Na[e])return Na[e];const t=globalThis[e],s=t.prototype,r=e in Pa?Pa[e]:void 0,i=Boolean(r&&r.every(e=>{var t,r;return Boolean(null==(r=null==(t=Object.getOwnPropertyDescriptor(s,e))?void 0:t.get)?void 0:r.toString().includes("[native code]"))})),n=e in La?La[e]:void 0,o=Boolean(n&&n.every(e=>{var t;return"function"==typeof s[e]&&(null==(t=s[e])?void 0:t.toString().includes("[native code]"))}));if(i&&o&&!globalThis.Zone)return Na[e]=t.prototype,t.prototype;try{const r=document.createElement("iframe");document.body.appendChild(r);const i=r.contentWindow;if(!i)return t.prototype;const n=i[e].prototype;return document.body.removeChild(r),n?Na[e]=n:s}catch{return s}}const Ua={};function Ba(e,t,s){var r;const i=`${e}.${String(s)}`;if(Ua[i])return Ua[i].call(t);const n=Fa(e),o=null==(r=Object.getOwnPropertyDescriptor(n,s))?void 0:r.get;return o?(Ua[i]=o,o.call(t)):t[s]}const $a={};function za(e,t,s){const r=`${e}.${String(s)}`;if($a[r])return $a[r].bind(t);const i=Fa(e)[s];return"function"!=typeof i?t[s]:($a[r]=i,i.bind(t))}function ja(){return Fa("MutationObserver").constructor}function Wa(e,t,s){try{if(!(t in e))return()=>{};const r=e[t],i=s(r);return"function"==typeof i&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=i,()=>{e[t]=r}}catch{return()=>{}}}const Ka={ownerDocument:function(e){return Ba("Node",e,"ownerDocument")},childNodes:function(e){return Ba("Node",e,"childNodes")},parentNode:function(e){return Ba("Node",e,"parentNode")},parentElement:function(e){return Ba("Node",e,"parentElement")},textContent:function(e){return Ba("Node",e,"textContent")},contains:function(e,t){return za("Node",e,"contains")(t)},getRootNode:function(e){return za("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?Ba("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?Ba("Element",e,"shadowRoot"):null},querySelector:function(e,t){return Ba("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return Ba("Element",e,"querySelectorAll")(t)},mutationObserver:ja,patch:Wa};function Ga(e,t,s=document){const r={capture:!0,passive:!0};return s.addEventListener(e,t,r),()=>s.removeEventListener(e,t,r)}const Va="Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.";let Ha={map:{},getId:()=>(console.error(Va),-1),getNode:()=>(console.error(Va),null),removeNodeFromMap(){console.error(Va)},has:()=>(console.error(Va),!1),reset(){console.error(Va)}};function Ya(e,t,s={}){let r=null,i=0;return function(...n){const o=Date.now();i||!1!==s.leading||(i=o);const a=t-(o-i),l=this;a<=0||a>t?(r&&(clearTimeout(r),r=null),i=o,e.apply(l,n)):r||!1===s.trailing||(r=setTimeout(()=>{i=!1===s.leading?0:Date.now(),r=null,e.apply(l,n)},a))}}function Za(e,t,s,r,i=window){const n=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,r?s:{set(e){setTimeout(()=>{s.set.call(this,e)},0),n&&n.set&&n.set.call(this,e)}}),()=>Za(e,t,n||{},!0)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(Ha=new Proxy(Ha,{get:(e,t,s)=>("map"===t&&console.error(Va),Reflect.get(e,t,s))}));let qa=Date.now;function Ja(e){var t,s,r,i;const n=e.document;return{left:n.scrollingElement?n.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:n.documentElement.scrollLeft||(null==n?void 0:n.body)&&(null==(t=Ka.parentElement(n.body))?void 0:t.scrollLeft)||(null==(s=null==n?void 0:n.body)?void 0:s.scrollLeft)||0,top:n.scrollingElement?n.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==n?void 0:n.documentElement.scrollTop)||(null==n?void 0:n.body)&&(null==(r=Ka.parentElement(n.body))?void 0:r.scrollTop)||(null==(i=null==n?void 0:n.body)?void 0:i.scrollTop)||0}}function Xa(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Qa(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function el(e){if(!e)return null;return e.nodeType===e.ELEMENT_NODE?e:Ka.parentElement(e)}function tl(e,t,s,r){if(!e)return!1;const i=el(e);if(!i)return!1;try{if("string"==typeof t){if(i.classList.contains(t))return!0;if(r&&null!==i.closest("."+t))return!0}else if(H(i,t,r))return!0}catch(e){}if(s){if(i.matches(s))return!0;if(r&&null!==i.closest(s))return!0}return!1}function sl(e,t,s){return!("TITLE"!==e.tagName||!s.headTitleMutations)||-2===t.getId(e)}function rl(e,t){if(y(e))return!1;const s=t.getId(e);if(!t.has(s))return!0;const r=Ka.parentNode(e);return(!r||r.nodeType!==e.DOCUMENT_NODE)&&(!r||rl(r,t))}function il(e){return Boolean(e.changedTouches)}function nl(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function ol(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function al(e){return!!e&&(e instanceof Da&&"shadowRoot"in e?Boolean(e.shadowRoot):Boolean(Ka.shadowRoot(e)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(qa=()=>(new Date).getTime());class ll{constructor(){r(this,"id",1),r(this,"styleIDMap",new WeakMap),r(this,"idStyleMap",new Map)}getId(e){return this.styleIDMap.get(e)??-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let s;return s=void 0===t?this.id++:t,this.styleIDMap.set(e,s),this.idStyleMap.set(s,e),s}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function cl(e){var t;let s=null;return"getRootNode"in e&&(null==(t=Ka.getRootNode(e))?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&Ka.host(Ka.getRootNode(e))&&(s=Ka.host(Ka.getRootNode(e))),s}function hl(e){const t=Ka.ownerDocument(e);if(!t)return!1;const s=function(e){let t,s=e;for(;t=cl(s);)s=t;return s}(e);return Ka.contains(t,s)}function ul(e){const t=Ka.ownerDocument(e);return!!t&&(Ka.contains(t,e)||hl(e))}var dl=(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))(dl||{}),pl=(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))(pl||{}),ml=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(ml||{}),fl=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(fl||{}),gl=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(gl||{}),yl=(e=>(e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e))(yl||{}),wl=(e=>(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))(wl||{});function vl(e){return"__ln"in e}class Sl{constructor(){r(this,"length",0),r(this,"head",null),r(this,"tail",null)}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let s=0;s<e;s++)t=(null==t?void 0:t.next)||null;return t}addNode(e){const t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&vl(e.previousSibling)){const s=e.previousSibling.__ln.next;t.next=s,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,s&&(s.previous=t)}else if(e.nextSibling&&vl(e.nextSibling)&&e.nextSibling.__ln.previous){const s=e.nextSibling.__ln.previous;t.previous=s,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,s&&(s.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;null===t.next&&(this.tail=t),this.length++}removeNode(e){const t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}}const bl=(e,t)=>`${e}@${t}`;class Cl{constructor(){r(this,"frozen",!1),r(this,"locked",!1),r(this,"texts",[]),r(this,"attributes",[]),r(this,"attributeMap",new WeakMap),r(this,"removes",[]),r(this,"mapRemoves",[]),r(this,"movedMap",{}),r(this,"addedSet",new Set),r(this,"movedSet",new Set),r(this,"droppedSet",new Set),r(this,"removesSubTreeCache",new Set),r(this,"mutationCb"),r(this,"blockClass"),r(this,"blockSelector"),r(this,"maskTextClass"),r(this,"maskTextSelector"),r(this,"inlineStylesheet"),r(this,"maskInputOptions"),r(this,"maskTextFn"),r(this,"maskInputFn"),r(this,"keepIframeSrcFn"),r(this,"recordCanvas"),r(this,"inlineImages"),r(this,"slimDOMOptions"),r(this,"dataURLOptions"),r(this,"doc"),r(this,"mirror"),r(this,"iframeManager"),r(this,"stylesheetManager"),r(this,"shadowDomManager"),r(this,"canvasManager"),r(this,"processedNodeManager"),r(this,"unattachedDoc"),r(this,"processMutations",e=>{e.forEach(this.processMutation),this.emit()}),r(this,"emit",()=>{if(this.frozen||this.locked)return;const e=[],t=new Set,s=new Sl,r=e=>{let t=e,s=-2;for(;-2===s;)t=t&&t.nextSibling,s=t&&this.mirror.getId(t);return s},i=i=>{const n=Ka.parentNode(i);if(!n||!ul(i))return;let o=!1;if(i.nodeType===Node.TEXT_NODE){const e=n.tagName;if("TEXTAREA"===e)return;"STYLE"===e&&this.addedSet.has(n)&&(o=!0)}const a=y(n)?this.mirror.getId(cl(i)):this.mirror.getId(n),l=r(i);if(-1===a||-1===l)return s.addNode(i);const c=X(i,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:e=>{nl(e,this.mirror)&&this.iframeManager.addIframe(e),ol(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),al(i)&&this.shadowDomManager.addShadowRoot(Ka.shadowRoot(i),this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)},cssCaptured:o});c&&(e.push({parentId:a,nextId:l,node:c}),t.add(c.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const e of this.movedSet)Il(this.removesSubTreeCache,e,this.mirror)&&!this.movedSet.has(Ka.parentNode(e))||i(e);for(const e of this.addedSet)El(this.droppedSet,e)||Il(this.removesSubTreeCache,e,this.mirror)?El(this.movedSet,e)?i(e):this.droppedSet.add(e):i(e);let n=null;for(;s.length;){let e=null;if(n){const t=this.mirror.getId(Ka.parentNode(n.value)),s=r(n.value);-1!==t&&-1!==s&&(e=n)}if(!e){let t=s.tail;for(;t;){const s=t;if(t=t.previous,s){const t=this.mirror.getId(Ka.parentNode(s.value));if(-1===r(s.value))continue;if(-1!==t){e=s;break}{const t=s.value,r=Ka.parentNode(t);if(r&&r.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const t=Ka.host(r);if(-1!==this.mirror.getId(t)){e=s;break}}}}}}if(!e){for(;s.head;)s.removeNode(s.head.value);break}n=e.previous,s.removeNode(e.value),i(e.value)}const o={texts:this.texts.map(e=>{const t=e.node,s=Ka.parentNode(t);return s&&"TEXTAREA"===s.tagName&&this.genTextAreaValueMutation(s),{id:this.mirror.getId(t),value:e.value}}).filter(e=>!t.has(e.id)).filter(e=>this.mirror.has(e.id)),attributes:this.attributes.map(e=>{const{attributes:t}=e;if("string"==typeof t.style){const s=JSON.stringify(e.styleDiff),r=JSON.stringify(e._unchangedStyles);s.length<t.style.length&&(s+r).split("var(").length===t.style.split("var(").length&&(t.style=e.styleDiff)}return{id:this.mirror.getId(e.node),attributes:t}}).filter(e=>!t.has(e.id)).filter(e=>this.mirror.has(e.id)),removes:this.removes,adds:e};(o.texts.length||o.attributes.length||o.removes.length||o.adds.length)&&(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},this.mutationCb(o))}),r(this,"genTextAreaValueMutation",e=>{let t=this.attributeMap.get(e);t||(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(t),this.attributeMap.set(e,t));const s=Array.from(Ka.childNodes(e),e=>Ka.textContent(e)||"").join("");t.attributes.value=C({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:E(e),value:s,maskInputFn:this.maskInputFn})}),r(this,"processMutation",e=>{if(!sl(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":{const t=Ka.textContent(e.target);tl(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:Y(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,el(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const t=e.target;let s=e.attributeName,r=e.target.getAttribute(s);if("value"===s){const e=E(t);r=C({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:e,value:r,maskInputFn:this.maskInputFn})}if(tl(e.target,this.blockClass,this.blockSelector,!1)||r===e.oldValue)return;let i=this.attributeMap.get(e.target);if("IFRAME"===t.tagName&&"src"===s&&!this.keepIframeSrcFn(r)){if(t.contentDocument)return;s="rr_src"}if(i||(i={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(i),this.attributeMap.set(e.target,i)),"type"===s&&"INPUT"===t.tagName&&"password"===(e.oldValue||"").toLowerCase()&&t.setAttribute("data-rr-is-password","true"),!V(t.tagName,s))if(i.attributes[s]=G(this.doc,k(t.tagName),k(s),r),"style"===s){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(e){this.unattachedDoc=this.doc}const s=this.unattachedDoc.createElement("span");e.oldValue&&s.setAttribute("style",e.oldValue);for(const e of Array.from(t.style)){const r=t.style.getPropertyValue(e),n=t.style.getPropertyPriority(e);r!==s.style.getPropertyValue(e)||n!==s.style.getPropertyPriority(e)?i.styleDiff[e]=""===n?r:[r,n]:i._unchangedStyles[e]=[r,n]}for(const e of Array.from(s.style))""===t.style.getPropertyValue(e)&&(i.styleDiff[e]=!1)}else"open"===s&&"DIALOG"===t.tagName&&(t.matches("dialog:modal")?i.attributes.rr_open_mode="modal":i.attributes.rr_open_mode="non-modal");break}case"childList":if(tl(e.target,this.blockClass,this.blockSelector,!0))return;if("TEXTAREA"===e.target.tagName)return void this.genTextAreaValueMutation(e.target);e.addedNodes.forEach(t=>this.genAdds(t,e.target)),e.removedNodes.forEach(t=>{const s=this.mirror.getId(t),r=y(e.target)?this.mirror.getId(Ka.host(e.target)):this.mirror.getId(e.target);tl(e.target,this.blockClass,this.blockSelector,!1)||sl(t,this.mirror,this.slimDOMOptions)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(kl(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===s||rl(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[bl(s,r)]?kl(this.movedSet,t):(this.removes.push({parentId:r,id:s,isShadow:!(!y(e.target)||!w(e.target))||void 0}),function(e,t){const s=[e];for(;s.length;){const e=s.pop();t.has(e)||(t.add(e),Ka.childNodes(e).forEach(e=>s.push(e)))}}(t,this.removesSubTreeCache))),this.mapRemoves.push(t))})}}),r(this,"genAdds",(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!this.addedSet.has(e)&&!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(sl(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);let s=null;t&&this.mirror.hasNode(t)&&(s=this.mirror.getId(t)),s&&-1!==s&&(this.movedMap[bl(this.mirror.getId(e),s)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);tl(e,this.blockClass,this.blockSelector,!1)||(Ka.childNodes(e).forEach(e=>this.genAdds(e)),al(e)&&Ka.childNodes(Ka.shadowRoot(e)).forEach(t=>{this.processedNodeManager.add(t,this),this.genAdds(t,e)}))}})}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(t=>{this[t]=e[t]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function kl(e,t){e.delete(t),Ka.childNodes(t).forEach(t=>kl(e,t))}function Il(e,t,s){return 0!==e.size&&function(e,t){const s=Ka.parentNode(t);return!!s&&e.has(s)}(e,t)}function El(e,t){return 0!==e.size&&Tl(e,t)}function Tl(e,t){const s=Ka.parentNode(t);return!!s&&(!!e.has(s)||Tl(e,s))}let xl;const _l=e=>{if(!xl)return e;return(...t)=>{try{return e(...t)}catch(e){if(xl&&!0===xl(e))return;throw e}}},Ml=[];function Ol(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch{}return e&&e.target}function Al(e,t){const s=new Cl;Ml.push(s),s.init(e);const r=new(ja())(_l(s.processMutations.bind(s)));return r.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),r}function Rl({mouseInteractionCb:e,doc:t,mirror:s,blockClass:r,blockSelector:i,sampling:n}){if(!1===n.mouseInteraction)return()=>{};const o=!0===n.mouseInteraction||void 0===n.mouseInteraction?{}:n.mouseInteraction,a=[];let l=null;return Object.keys(ml).filter(e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==o[e]).forEach(n=>{let o=k(n);const c=(t=>n=>{const o=Ol(n);if(tl(o,r,i,!0))return;let a=null,c=t;if("pointerType"in n){switch(n.pointerType){case"mouse":a=fl.Mouse;break;case"touch":a=fl.Touch;break;case"pen":a=fl.Pen}a===fl.Touch?ml[t]===ml.MouseDown?c="TouchStart":ml[t]===ml.MouseUp&&(c="TouchEnd"):fl.Pen}else il(n)&&(a=fl.Touch);null!==a?(l=a,(c.startsWith("Touch")&&a===fl.Touch||c.startsWith("Mouse")&&a===fl.Mouse)&&(a=null)):ml[t]===ml.Click&&(a=l,l=null);const h=il(n)?n.changedTouches[0]:n;if(!h)return;const u=s.getId(o),{clientX:d,clientY:p}=h;_l(e)({type:ml[c],id:u,x:d,y:p,...null!==a&&{pointerType:a}})})(n);if(window.PointerEvent)switch(ml[n]){case ml.MouseDown:case ml.MouseUp:o=o.replace("mouse","pointer");break;case ml.TouchStart:case ml.TouchEnd:return}a.push(Ga(o,c,t))}),_l(()=>{a.forEach(e=>e())})}function Dl({scrollCb:e,doc:t,mirror:s,blockClass:r,blockSelector:i,sampling:n}){return Ga("scroll",_l(Ya(_l(n=>{const o=Ol(n);if(!o||tl(o,r,i,!0))return;const a=s.getId(o);if(o===t&&t.defaultView){const s=Ja(t.defaultView);e({id:a,x:s.left,y:s.top})}else e({id:a,x:o.scrollLeft,y:o.scrollTop})}),n.scroll||100)),t)}const Pl=["INPUT","TEXTAREA","SELECT"],Ll=new WeakMap;function Nl(e){return function(e,t){if($l("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||$l("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||$l("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||$l("CSSConditionRule")&&e.parentRule instanceof CSSConditionRule){const s=Array.from(e.parentRule.cssRules).indexOf(e);t.unshift(s)}else if(e.parentStyleSheet){const s=Array.from(e.parentStyleSheet.cssRules).indexOf(e);t.unshift(s)}return t}(e,[])}function Fl(e,t,s){let r,i;return e?(e.ownerNode?r=t.getId(e.ownerNode):i=s.getId(e),{styleId:i,id:r}):{}}function Ul({mirror:e,stylesheetManager:t},s){var r,i,n;let o=null;o="#document"===s.nodeName?e.getId(s):e.getId(Ka.host(s));const a="#document"===s.nodeName?null==(r=s.defaultView)?void 0:r.Document:null==(n=null==(i=s.ownerDocument)?void 0:i.defaultView)?void 0:n.ShadowRoot,l=(null==a?void 0:a.prototype)?Object.getOwnPropertyDescriptor(null==a?void 0:a.prototype,"adoptedStyleSheets"):void 0;return null!==o&&-1!==o&&a&&l?(Object.defineProperty(s,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get(){var e;return null==(e=l.get)?void 0:e.call(this)},set(e){var s;const r=null==(s=l.set)?void 0:s.call(this,e);if(null!==o&&-1!==o)try{t.adoptStyleSheets(e,o)}catch(e){}return r}}),_l(()=>{Object.defineProperty(s,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})})):()=>{}}function Bl(e,t={}){const s=e.doc.defaultView;if(!s)return()=>{};let r;!function(e,t){const{mutationCb:s,mousemoveCb:r,mouseInteractionCb:i,scrollCb:n,viewportResizeCb:o,inputCb:a,mediaInteractionCb:l,styleSheetRuleCb:c,styleDeclarationCb:h,canvasMutationCb:u,fontCb:d,selectionCb:p,customElementCb:m}=e;e.mutationCb=(...e)=>{t.mutation&&t.mutation(...e),s(...e)},e.mousemoveCb=(...e)=>{t.mousemove&&t.mousemove(...e),r(...e)},e.mouseInteractionCb=(...e)=>{t.mouseInteraction&&t.mouseInteraction(...e),i(...e)},e.scrollCb=(...e)=>{t.scroll&&t.scroll(...e),n(...e)},e.viewportResizeCb=(...e)=>{t.viewportResize&&t.viewportResize(...e),o(...e)},e.inputCb=(...e)=>{t.input&&t.input(...e),a(...e)},e.mediaInteractionCb=(...e)=>{t.mediaInteaction&&t.mediaInteaction(...e),l(...e)},e.styleSheetRuleCb=(...e)=>{t.styleSheetRule&&t.styleSheetRule(...e),c(...e)},e.styleDeclarationCb=(...e)=>{t.styleDeclaration&&t.styleDeclaration(...e),h(...e)},e.canvasMutationCb=(...e)=>{t.canvasMutation&&t.canvasMutation(...e),u(...e)},e.fontCb=(...e)=>{t.font&&t.font(...e),d(...e)},e.selectionCb=(...e)=>{t.selection&&t.selection(...e),p(...e)},e.customElementCb=(...e)=>{t.customElement&&t.customElement(...e),m(...e)}}(e,t),e.recordDOM&&(r=Al(e,e.doc));const i=function({mousemoveCb:e,sampling:t,doc:s,mirror:r}){if(!1===t.mousemove)return()=>{};const i="number"==typeof t.mousemove?t.mousemove:50,n="number"==typeof t.mousemoveCallback?t.mousemoveCallback:500;let o,a=[];const l=Ya(_l(t=>{const s=Date.now()-o;e(a.map(e=>(e.timeOffset-=s,e)),t),a=[],o=null}),n),c=_l(Ya(_l(e=>{const t=Ol(e),{clientX:s,clientY:i}=il(e)?e.changedTouches[0]:e;o||(o=qa()),a.push({x:s,y:i,id:r.getId(t),timeOffset:qa()-o}),l("undefined"!=typeof DragEvent&&e instanceof DragEvent?pl.Drag:e instanceof MouseEvent?pl.MouseMove:pl.TouchMove)}),i,{trailing:!1})),h=[Ga("mousemove",c,s),Ga("touchmove",c,s),Ga("drag",c,s)];return _l(()=>{h.forEach(e=>e())})}(e),n=Rl(e),o=Dl(e),a=function({viewportResizeCb:e},{win:t}){let s=-1,r=-1;return Ga("resize",_l(Ya(_l(()=>{const t=Xa(),i=Qa();s===t&&r===i||(e({width:Number(i),height:Number(t)}),s=t,r=i)}),200)),t)}(e,{win:s}),l=function({inputCb:e,doc:t,mirror:s,blockClass:r,blockSelector:i,ignoreClass:n,ignoreSelector:o,maskInputOptions:a,maskInputFn:l,sampling:c,userTriggeredOnInput:h}){function u(e){let s=Ol(e);const c=e.isTrusted,u=s&&s.tagName;if(s&&"OPTION"===u&&(s=Ka.parentElement(s)),!s||!u||Pl.indexOf(u)<0||tl(s,r,i,!0))return;if(s.classList.contains(n)||o&&s.matches(o))return;let p=s.value,m=!1;const f=E(s)||"";"radio"===f||"checkbox"===f?m=s.checked:(a[u.toLowerCase()]||a[f])&&(p=C({element:s,maskInputOptions:a,tagName:u,type:f,value:p,maskInputFn:l})),d(s,h?{text:p,isChecked:m,userTriggered:c}:{text:p,isChecked:m});const g=s.name;"radio"===f&&g&&m&&t.querySelectorAll(`input[type="radio"][name="${g}"]`).forEach(e=>{if(e!==s){const t=e.value;d(e,h?{text:t,isChecked:!m,userTriggered:!1}:{text:t,isChecked:!m})}})}function d(t,r){const i=Ll.get(t);if(!i||i.text!==r.text||i.isChecked!==r.isChecked){Ll.set(t,r);const i=s.getId(t);_l(e)({...r,id:i})}}const p=("last"===c.input?["change"]:["input","change"]).map(e=>Ga(e,_l(u),t)),m=t.defaultView;if(!m)return()=>{p.forEach(e=>e())};const f=m.Object.getOwnPropertyDescriptor(m.HTMLInputElement.prototype,"value"),g=[[m.HTMLInputElement.prototype,"value"],[m.HTMLInputElement.prototype,"checked"],[m.HTMLSelectElement.prototype,"value"],[m.HTMLTextAreaElement.prototype,"value"],[m.HTMLSelectElement.prototype,"selectedIndex"],[m.HTMLOptionElement.prototype,"selected"]];return f&&f.set&&p.push(...g.map(e=>Za(e[0],e[1],{set(){_l(u)({target:this,isTrusted:!1})}},!1,m))),_l(()=>{p.forEach(e=>e())})}(e),c=function({mediaInteractionCb:e,blockClass:t,blockSelector:s,mirror:r,sampling:i,doc:n}){const o=_l(n=>Ya(_l(i=>{const o=Ol(i);if(!o||tl(o,t,s,!0))return;const{currentTime:a,volume:l,muted:c,playbackRate:h,loop:u}=o;e({type:n,id:r.getId(o),currentTime:a,volume:l,muted:c,playbackRate:h,loop:u})}),i.media||500)),a=[Ga("play",o(yl.Play),n),Ga("pause",o(yl.Pause),n),Ga("seeked",o(yl.Seeked),n),Ga("volumechange",o(yl.VolumeChange),n),Ga("ratechange",o(yl.RateChange),n)];return _l(()=>{a.forEach(e=>e())})}(e);let h=()=>{},u=()=>{},d=()=>{},p=()=>{};e.recordDOM&&(h=function({styleSheetRuleCb:e,mirror:t,stylesheetManager:s},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};const i=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:_l((r,i,n)=>{const[o,a]=n,{id:l,styleId:c}=Fl(i,t,s.styleMirror);return(l&&-1!==l||c&&-1!==c)&&e({id:l,styleId:c,adds:[{rule:o,index:a}]}),r.apply(i,n)})}),r.CSSStyleSheet.prototype.addRule=function(e,t,s=this.cssRules.length){const i=`${e} { ${t} }`;return r.CSSStyleSheet.prototype.insertRule.apply(this,[i,s])};const n=r.CSSStyleSheet.prototype.deleteRule;let o,a;r.CSSStyleSheet.prototype.deleteRule=new Proxy(n,{apply:_l((r,i,n)=>{const[o]=n,{id:a,styleId:l}=Fl(i,t,s.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,removes:[{index:o}]}),r.apply(i,n)})}),r.CSSStyleSheet.prototype.removeRule=function(e){return r.CSSStyleSheet.prototype.deleteRule.apply(this,[e])},r.CSSStyleSheet.prototype.replace&&(o=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(o,{apply:_l((r,i,n)=>{const[o]=n,{id:a,styleId:l}=Fl(i,t,s.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,replace:o}),r.apply(i,n)})})),r.CSSStyleSheet.prototype.replaceSync&&(a=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:_l((r,i,n)=>{const[o]=n,{id:a,styleId:l}=Fl(i,t,s.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,replaceSync:o}),r.apply(i,n)})}));const l={};zl("CSSGroupingRule")?l.CSSGroupingRule=r.CSSGroupingRule:(zl("CSSMediaRule")&&(l.CSSMediaRule=r.CSSMediaRule),zl("CSSConditionRule")&&(l.CSSConditionRule=r.CSSConditionRule),zl("CSSSupportsRule")&&(l.CSSSupportsRule=r.CSSSupportsRule));const c={};return Object.entries(l).forEach(([r,i])=>{c[r]={insertRule:i.prototype.insertRule,deleteRule:i.prototype.deleteRule},i.prototype.insertRule=new Proxy(c[r].insertRule,{apply:_l((r,i,n)=>{const[o,a]=n,{id:l,styleId:c}=Fl(i.parentStyleSheet,t,s.styleMirror);return(l&&-1!==l||c&&-1!==c)&&e({id:l,styleId:c,adds:[{rule:o,index:[...Nl(i),a||0]}]}),r.apply(i,n)})}),i.prototype.deleteRule=new Proxy(c[r].deleteRule,{apply:_l((r,i,n)=>{const[o]=n,{id:a,styleId:l}=Fl(i.parentStyleSheet,t,s.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,removes:[{index:[...Nl(i),o]}]}),r.apply(i,n)})})}),_l(()=>{r.CSSStyleSheet.prototype.insertRule=i,r.CSSStyleSheet.prototype.deleteRule=n,o&&(r.CSSStyleSheet.prototype.replace=o),a&&(r.CSSStyleSheet.prototype.replaceSync=a),Object.entries(l).forEach(([e,t])=>{t.prototype.insertRule=c[e].insertRule,t.prototype.deleteRule=c[e].deleteRule})})}(e,{win:s}),u=Ul(e,e.doc),d=function({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:s,stylesheetManager:r},{win:i}){const n=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(n,{apply:_l((i,o,a)=>{var l;const[c,h,u]=a;if(s.has(c))return n.apply(o,[c,h,u]);const{id:d,styleId:p}=Fl(null==(l=o.parentRule)?void 0:l.parentStyleSheet,t,r.styleMirror);return(d&&-1!==d||p&&-1!==p)&&e({id:d,styleId:p,set:{property:c,value:h,priority:u},index:Nl(o.parentRule)}),i.apply(o,a)})});const o=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(o,{apply:_l((i,n,a)=>{var l;const[c]=a;if(s.has(c))return o.apply(n,[c]);const{id:h,styleId:u}=Fl(null==(l=n.parentRule)?void 0:l.parentStyleSheet,t,r.styleMirror);return(h&&-1!==h||u&&-1!==u)&&e({id:h,styleId:u,remove:{property:c},index:Nl(n.parentRule)}),i.apply(n,a)})}),_l(()=>{i.CSSStyleDeclaration.prototype.setProperty=n,i.CSSStyleDeclaration.prototype.removeProperty=o})}(e,{win:s}),e.collectFonts&&(p=function({fontCb:e,doc:t}){const s=t.defaultView;if(!s)return()=>{};const r=[],i=new WeakMap,n=s.FontFace;s.FontFace=function(e,t,s){const r=new n(e,t,s);return i.set(r,{family:e,buffer:"string"!=typeof t,descriptors:s,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),r};const o=Wa(t.fonts,"add",function(t){return function(s){return setTimeout(_l(()=>{const t=i.get(s);t&&(e(t),i.delete(s))}),0),t.apply(this,[s])}});return r.push(()=>{s.FontFace=n}),r.push(o),_l(()=>{r.forEach(e=>e())})}(e)));const m=function(e){const{doc:t,mirror:s,blockClass:r,blockSelector:i,selectionCb:n}=e;let o=!0;const a=_l(()=>{const e=t.getSelection();if(!e||o&&(null==e?void 0:e.isCollapsed))return;o=e.isCollapsed||!1;const a=[],l=e.rangeCount||0;for(let t=0;t<l;t++){const n=e.getRangeAt(t),{startContainer:o,startOffset:l,endContainer:c,endOffset:h}=n;tl(o,r,i,!0)||tl(c,r,i,!0)||a.push({start:s.getId(o),startOffset:l,end:s.getId(c),endOffset:h})}n({ranges:a})});return a(),Ga("selectionchange",a)}(e),f=function({doc:e,customElementCb:t}){const s=e.defaultView;return s&&s.customElements?Wa(s.customElements,"define",function(e){return function(s,r,i){try{t({define:{name:s}})}catch(e){console.warn(`Custom element callback failed for ${s}`)}return e.apply(this,[s,r,i])}}):()=>{}}(e),g=[];for(const t of e.plugins)g.push(t.observer(t.callback,s,t.options));return _l(()=>{Ml.forEach(e=>e.reset()),null==r||r.disconnect(),i(),n(),o(),a(),l(),c(),h(),u(),d(),p(),m(),f(),g.forEach(e=>e())})}function $l(e){return void 0!==window[e]}function zl(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class jl{constructor(e){r(this,"iframeIdToRemoteIdMap",new WeakMap),r(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,s,r){const i=s||this.getIdToRemoteIdMap(e),n=r||this.getRemoteIdToIdMap(e);let o=i.get(t);return o||(o=this.generateIdFn(),i.set(t,o),n.set(o,t)),o}getIds(e,t){const s=this.getIdToRemoteIdMap(e),r=this.getRemoteIdToIdMap(e);return t.map(t=>this.getId(e,t,s,r))}getRemoteId(e,t,s){const r=s||this.getRemoteIdToIdMap(e);if("number"!=typeof t)return t;const i=r.get(t);return i||-1}getRemoteIds(e,t){const s=this.getRemoteIdToIdMap(e);return t.map(t=>this.getRemoteId(e,t,s))}reset(e){if(!e)return this.iframeIdToRemoteIdMap=new WeakMap,void(this.iframeRemoteIdToIdMap=new WeakMap);this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}}class Wl{constructor(e){r(this,"iframes",new WeakMap),r(this,"crossOriginIframeMap",new WeakMap),r(this,"crossOriginIframeMirror",new jl(N)),r(this,"crossOriginIframeStyleMirror"),r(this,"crossOriginIframeRootIdMap",new WeakMap),r(this,"mirror"),r(this,"mutationCb"),r(this,"wrappedEmit"),r(this,"loadListener"),r(this,"stylesheetManager"),r(this,"recordCrossOriginIframes"),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new jl(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var s,r;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&(null==(s=e.contentWindow)||s.addEventListener("message",this.handleMessage.bind(this))),null==(r=this.loadListener)||r.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){const t=e;if("rrweb"!==t.data.type||t.origin!==t.data.origin)return;if(!e.source)return;const s=this.crossOriginIframeMap.get(e.source);if(!s)return;const r=this.transformCrossOriginEvent(s,t.data.event);r&&this.wrappedEmit(r,t.data.isCheckout)}transformCrossOriginEvent(e,t){var s;switch(t.type){case dl.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);const s=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,s),this.patchRootIdOnNode(t.data.node,s),{timestamp:t.timestamp,type:dl.IncrementalSnapshot,data:{source:pl.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case dl.Meta:case dl.Load:case dl.DomContentLoaded:return!1;case dl.Plugin:return t;case dl.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case dl.IncrementalSnapshot:switch(t.data.source){case pl.Mutation:return t.data.adds.forEach(t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e);const s=this.crossOriginIframeRootIdMap.get(e);s&&this.patchRootIdOnNode(t.node,s)}),t.data.removes.forEach(t=>{this.replaceIds(t,e,["parentId","id"])}),t.data.attributes.forEach(t=>{this.replaceIds(t,e,["id"])}),t.data.texts.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case pl.Drag:case pl.TouchMove:case pl.MouseMove:return t.data.positions.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case pl.ViewportResize:return!1;case pl.MediaInteraction:case pl.MouseInteraction:case pl.Scroll:case pl.CanvasMutation:case pl.Input:return this.replaceIds(t.data,e,["id"]),t;case pl.StyleSheetRule:case pl.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case pl.Font:return t;case pl.Selection:return t.data.ranges.forEach(t=>{this.replaceIds(t,e,["start","end"])}),t;case pl.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null==(s=t.data.styles)||s.forEach(t=>{this.replaceStyleIds(t,e,["styleId"])}),t}}return!1}replace(e,t,s,r){for(const i of r)(Array.isArray(t[i])||"number"==typeof t[i])&&(Array.isArray(t[i])?t[i]=e.getIds(s,t[i]):t[i]=e.getId(s,t[i]));return t}replaceIds(e,t,s){return this.replace(this.crossOriginIframeMirror,e,t,s)}replaceStyleIds(e,t,s){return this.replace(this.crossOriginIframeStyleMirror,e,t,s)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(e=>{this.replaceIdOnNode(e,t)})}patchRootIdOnNode(e,t){e.type===wl.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(e=>{this.patchRootIdOnNode(e,t)})}}class Kl{constructor(e){r(this,"shadowDoms",new WeakSet),r(this,"mutationCb"),r(this,"scrollCb"),r(this,"bypassOptions"),r(this,"mirror"),r(this,"restoreHandlers",[]),this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){if(!w(e))return;if(this.shadowDoms.has(e))return;this.shadowDoms.add(e);const s=Al({...this.bypassOptions,doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},e);this.restoreHandlers.push(()=>s.disconnect()),this.restoreHandlers.push(Dl({...this.bypassOptions,scrollCb:this.scrollCb,doc:e,mirror:this.mirror})),setTimeout(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(Ka.host(e))),this.restoreHandlers.push(Ul({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))},0)}observeAttachShadow(e){e.contentWindow&&e.contentDocument&&this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){const s=this;this.restoreHandlers.push(Wa(e.prototype,"attachShadow",function(e){return function(r){const i=e.call(this,r),n=Ka.shadowRoot(this);return n&&ul(this)&&s.addShadowRoot(n,t),i}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch(e){}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}for(var Gl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Vl="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Hl=0;Hl<64;Hl++)Vl[Gl.charCodeAt(Hl)]=Hl;const Yl=new Map;const Zl=(e,t,s)=>{if(!e||!Xl(e,t)&&"object"!=typeof e)return;const r=function(e,t){let s=Yl.get(e);return s||(s=new Map,Yl.set(e,s)),s.has(t)||s.set(t,[]),s.get(t)}(s,e.constructor.name);let i=r.indexOf(e);return-1===i&&(i=r.length,r.push(e)),i};function ql(e,t,s){if(e instanceof Array)return e.map(e=>ql(e,t,s));if(null===e)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray){return{rr_type:e.constructor.name,args:[Object.values(e)]}}if(e instanceof ArrayBuffer){return{rr_type:e.constructor.name,base64:function(e){var t,s=new Uint8Array(e),r=s.length,i="";for(t=0;t<r;t+=3)i+=Gl[s[t]>>2],i+=Gl[(3&s[t])<<4|s[t+1]>>4],i+=Gl[(15&s[t+1])<<2|s[t+2]>>6],i+=Gl[63&s[t+2]];return r%3==2?i=i.substring(0,i.length-1)+"=":r%3==1&&(i=i.substring(0,i.length-2)+"=="),i}(e)}}if(e instanceof DataView){return{rr_type:e.constructor.name,args:[ql(e.buffer,t,s),e.byteOffset,e.byteLength]}}if(e instanceof HTMLImageElement){const t=e.constructor.name,{src:s}=e;return{rr_type:t,src:s}}if(e instanceof HTMLCanvasElement){return{rr_type:"HTMLImageElement",src:e.toDataURL()}}if(e instanceof ImageData){return{rr_type:e.constructor.name,args:[ql(e.data,t,s),e.width,e.height]}}if(Xl(e,t)||"object"==typeof e){return{rr_type:e.constructor.name,index:Zl(e,t,s)}}return e}const Jl=(e,t,s)=>e.map(e=>ql(e,t,s)),Xl=(e,t)=>{const s=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(e=>"function"==typeof t[e]);return Boolean(s.find(s=>e instanceof t[s]))};function Ql(e,t,s,r){const i=[];try{const n=Wa(e.HTMLCanvasElement.prototype,"getContext",function(e){return function(i,...n){if(!tl(this,t,s,!0)){const e=function(e){return"experimental-webgl"===e?"webgl":e}(i);if("__context"in this||(this.__context=e),r&&["webgl","webgl2"].includes(e))if(n[0]&&"object"==typeof n[0]){const e=n[0];e.preserveDrawingBuffer||(e.preserveDrawingBuffer=!0)}else n.splice(0,1,{preserveDrawingBuffer:!0})}return e.apply(this,[i,...n])}});i.push(n)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{i.forEach(e=>e())}}function ec(e,t,s,r,i,n){const o=[],a=Object.getOwnPropertyNames(e);for(const l of a)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(l))try{if("function"!=typeof e[l])continue;const a=Wa(e,l,function(e){return function(...o){const a=e.apply(this,o);if(Zl(a,n,this),"tagName"in this.canvas&&!tl(this.canvas,r,i,!0)){const e=Jl(o,n,this),r={type:t,property:l,args:e};s(this.canvas,r)}return a}});o.push(a)}catch{const r=Za(e,l,{set(e){s(this.canvas,{type:t,property:l,args:[e],setter:!0})}});o.push(r)}return o}const tc="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",sc="undefined"!=typeof window&&window.Blob&&new Blob([(rc=tc,Uint8Array.from(atob(rc),e=>e.charCodeAt(0)))],{type:"text/javascript;charset=utf-8"});var rc;function ic(e){let t;try{if(t=sc&&(window.URL||window.webkitURL).createObjectURL(sc),!t)throw"";const s=new Worker(t,{name:null==e?void 0:e.name});return s.addEventListener("error",()=>{(window.URL||window.webkitURL).revokeObjectURL(t)}),s}catch(t){return new Worker("data:text/javascript;base64,"+tc,{name:null==e?void 0:e.name})}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}class nc{constructor(e){r(this,"pendingCanvasMutations",new Map),r(this,"rafStamps",{latestId:0,invokeId:null}),r(this,"mirror"),r(this,"mutationCb"),r(this,"resetObservers"),r(this,"frozen",!1),r(this,"locked",!1),r(this,"processMutation",(e,t)=>{!(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId)&&this.rafStamps.invokeId||(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(t)});const{sampling:t="all",win:s,blockClass:i,blockSelector:n,recordCanvas:o,dataURLOptions:a}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,o&&"all"===t&&this.initCanvasMutationObserver(s,i,n),o&&"number"==typeof t&&this.initCanvasFPSObserver(t,s,i,n,{dataURLOptions:a})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(e,t,s,r,i){const n=Ql(t,s,r,!0),o=new Map,a=new ic;a.onmessage=e=>{const{id:t}=e.data;if(o.set(t,!1),!("base64"in e.data))return;const{base64:s,type:r,width:i,height:n}=e.data;this.mutationCb({id:t,type:gl["2D"],commands:[{property:"clearRect",args:[0,0,i,n]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:s}],type:r}]},0,0]}]})};const l=1e3/e;let c,h=0;const u=e=>{h&&e-h<l||(h=e,(()=>{const e=[];return t.document.querySelectorAll("canvas").forEach(t=>{tl(t,s,r,!0)||e.push(t)}),e})().forEach(async e=>{var t;const s=this.mirror.getId(e);if(o.get(s))return;if(0===e.width||0===e.height)return;if(o.set(s,!0),["webgl","webgl2"].includes(e.__context)){const s=e.getContext(e.__context);!1===(null==(t=null==s?void 0:s.getContextAttributes())?void 0:t.preserveDrawingBuffer)&&s.clear(s.COLOR_BUFFER_BIT)}const r=await createImageBitmap(e);a.postMessage({id:s,bitmap:r,width:e.width,height:e.height,dataURLOptions:i.dataURLOptions},[r])})),c=requestAnimationFrame(u)};c=requestAnimationFrame(u),this.resetObservers=()=>{n(),cancelAnimationFrame(c)}}initCanvasMutationObserver(e,t,s){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const r=Ql(e,t,s,!1),i=function(e,t,s,r){const i=[],n=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const o of n)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[o])continue;const n=Wa(t.CanvasRenderingContext2D.prototype,o,function(i){return function(...n){return tl(this.canvas,s,r,!0)||setTimeout(()=>{const s=Jl(n,t,this);e(this.canvas,{type:gl["2D"],property:o,args:s})},0),i.apply(this,n)}});i.push(n)}catch{const s=Za(t.CanvasRenderingContext2D.prototype,o,{set(t){e(this.canvas,{type:gl["2D"],property:o,args:[t],setter:!0})}});i.push(s)}return()=>{i.forEach(e=>e())}}(this.processMutation.bind(this),e,t,s),n=function(e,t,s,r){const i=[];return i.push(...ec(t.WebGLRenderingContext.prototype,gl.WebGL,e,s,r,t)),void 0!==t.WebGL2RenderingContext&&i.push(...ec(t.WebGL2RenderingContext.prototype,gl.WebGL2,e,s,r,t)),()=>{i.forEach(e=>e())}}(this.processMutation.bind(this),e,t,s);this.resetObservers=()=>{r(),i(),n()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{const s=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,s)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const s=this.pendingCanvasMutations.get(e);if(!s||-1===t)return;const r=s.map(e=>{const{type:t,...s}=e;return s}),{type:i}=s[0];this.mutationCb({id:t,type:i,commands:r}),this.pendingCanvasMutations.delete(e)}}class oc{constructor(e){r(this,"trackedLinkElements",new WeakSet),r(this,"mutationCb"),r(this,"adoptedStyleSheetCb"),r(this,"styleMirror",new ll),this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(0===e.length)return;const s={id:t,styleIds:[]},r=[];for(const t of e){let e;this.styleMirror.has(t)?e=this.styleMirror.getId(t):(e=this.styleMirror.add(t),r.push({styleId:e,rules:Array.from(t.rules||CSSRule,(e,s)=>({rule:S(e,t.href),index:s}))})),s.styleIds.push(e)}r.length>0&&(s.styles=r),this.adoptedStyleSheetCb(s)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class ac{constructor(){r(this,"nodeMap",new WeakMap),r(this,"active",!1)}inOtherBuffer(e,t){const s=this.nodeMap.get(e);return s&&Array.from(s).some(e=>e!==t)}add(e,t){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}destroy(){}}let lc,cc,hc,uc=!1;try{if(2!==Array.from([1],e=>2*e)[0]){const e=document.createElement("iframe");document.body.appendChild(e),Array.from=(null==(t=e.contentWindow)?void 0:t.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}const dc=new b;function pc(e={}){const{emit:t,checkoutEveryNms:s,checkoutEveryNth:r,blockClass:i="rr-block",blockSelector:n=null,ignoreClass:o="rr-ignore",ignoreSelector:a=null,maskTextClass:l="rr-mask",maskTextSelector:c=null,inlineStylesheet:h=!0,maskAllInputs:u,maskInputOptions:d,slimDOMOptions:p,maskInputFn:m,maskTextFn:f,hooks:g,packFn:y,sampling:w={},dataURLOptions:v={},mousemoveWait:S,recordDOM:C=!0,recordCanvas:k=!1,recordCrossOriginIframes:I=!1,recordAfter:E=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:T=!1,collectFonts:x=!1,inlineImages:_=!1,plugins:M,keepIframeSrcFn:O=()=>!1,ignoreCSSAttributes:A=new Set([]),errorHandler:R}=e;xl=R;const D=!I||window.parent===window;let P=!1;if(!D)try{window.parent.document&&(P=!1)}catch(e){P=!0}if(D&&!t)throw new Error("emit function is required");if(!D&&!P)return()=>{};void 0!==S&&void 0===w.mousemove&&(w.mousemove=S),dc.reset();const L=!0===u?{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}:void 0!==d?d:{password:!0},N=J(p);let F;!function(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach)}();let U=0;const B=e=>{for(const t of M||[])t.eventProcessor&&(e=t.eventProcessor(e));return y&&!P&&(e=y(e)),e};lc=(e,i)=>{var n;const o=e;if(o.timestamp=qa(),!(null==(n=Ml[0])?void 0:n.isFrozen())||o.type===dl.FullSnapshot||o.type===dl.IncrementalSnapshot&&o.data.source===pl.Mutation||Ml.forEach(e=>e.unfreeze()),D)null==t||t(B(o),i);else if(P){const e={type:"rrweb",event:B(o),origin:window.location.origin,isCheckout:i};window.parent.postMessage(e,"*")}if(o.type===dl.FullSnapshot)F=o,U=0;else if(o.type===dl.IncrementalSnapshot){if(o.data.source===pl.Mutation&&o.data.isAttachIframe)return;U++;const e=r&&U>=r,t=s&&o.timestamp-F.timestamp>s;(e||t)&&cc(!0)}};const $=e=>{lc({type:dl.IncrementalSnapshot,data:{source:pl.Mutation,...e}})},z=e=>lc({type:dl.IncrementalSnapshot,data:{source:pl.Scroll,...e}}),j=e=>lc({type:dl.IncrementalSnapshot,data:{source:pl.CanvasMutation,...e}}),W=new oc({mutationCb:$,adoptedStyleSheetCb:e=>lc({type:dl.IncrementalSnapshot,data:{source:pl.AdoptedStyleSheet,...e}})}),K=new Wl({mirror:dc,mutationCb:$,stylesheetManager:W,recordCrossOriginIframes:I,wrappedEmit:lc});for(const e of M||[])e.getMirror&&e.getMirror({nodeMirror:dc,crossOriginIframeMirror:K.crossOriginIframeMirror,crossOriginIframeStyleMirror:K.crossOriginIframeStyleMirror});const G=new ac;hc=new nc({recordCanvas:k,mutationCb:j,win:window,blockClass:i,blockSelector:n,mirror:dc,sampling:w.canvas,dataURLOptions:v});const V=new Kl({mutationCb:$,scrollCb:z,bypassOptions:{blockClass:i,blockSelector:n,maskTextClass:l,maskTextSelector:c,inlineStylesheet:h,maskInputOptions:L,dataURLOptions:v,maskTextFn:f,maskInputFn:m,recordCanvas:k,inlineImages:_,sampling:w,slimDOMOptions:N,iframeManager:K,stylesheetManager:W,canvasManager:hc,keepIframeSrcFn:O,processedNodeManager:G},mirror:dc});cc=(e=!1)=>{if(!C)return;lc({type:dl.Meta,data:{href:window.location.href,width:Qa(),height:Xa()}},e),W.reset(),V.init(),Ml.forEach(e=>e.lock());const t=function(e,t){const{mirror:s=new b,blockClass:r="rr-block",blockSelector:i=null,maskTextClass:n="rr-mask",maskTextSelector:o=null,inlineStylesheet:a=!0,inlineImages:l=!1,recordCanvas:c=!1,maskAllInputs:h=!1,maskTextFn:u,maskInputFn:d,slimDOM:p=!1,dataURLOptions:m,preserveWhiteSpace:f,onSerialize:g,onIframeLoad:y,iframeLoadTimeout:w,onStylesheetLoad:v,stylesheetLoadTimeout:S,keepIframeSrcFn:C=()=>!1}=t||{};return X(e,{doc:e,mirror:s,blockClass:r,blockSelector:i,maskTextClass:n,maskTextSelector:o,skipChild:!1,inlineStylesheet:a,maskInputOptions:!0===h?{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}:!1===h?{password:!0}:h,maskTextFn:u,maskInputFn:d,slimDOMOptions:J(p),dataURLOptions:m,inlineImages:l,recordCanvas:c,preserveWhiteSpace:f,onSerialize:g,onIframeLoad:y,iframeLoadTimeout:w,onStylesheetLoad:v,stylesheetLoadTimeout:S,keepIframeSrcFn:C,newlyAddedElement:!1})}(document,{mirror:dc,blockClass:i,blockSelector:n,maskTextClass:l,maskTextSelector:c,inlineStylesheet:h,maskAllInputs:L,maskTextFn:f,maskInputFn:m,slimDOM:N,dataURLOptions:v,recordCanvas:k,inlineImages:_,onSerialize:e=>{nl(e,dc)&&K.addIframe(e),ol(e,dc)&&W.trackLinkElement(e),al(e)&&V.addShadowRoot(Ka.shadowRoot(e),document)},onIframeLoad:(e,t)=>{K.attachIframe(e,t),V.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{W.attachLinkElement(e,t)},keepIframeSrcFn:O});if(!t)return console.warn("Failed to snapshot the document");lc({type:dl.FullSnapshot,data:{node:t,initialOffset:Ja(window)}},e),Ml.forEach(e=>e.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&W.adoptStyleSheets(document.adoptedStyleSheets,dc.getId(document))};try{const e=[],t=e=>{var t;return _l(Bl)({mutationCb:$,mousemoveCb:(e,t)=>lc({type:dl.IncrementalSnapshot,data:{source:t,positions:e}}),mouseInteractionCb:e=>lc({type:dl.IncrementalSnapshot,data:{source:pl.MouseInteraction,...e}}),scrollCb:z,viewportResizeCb:e=>lc({type:dl.IncrementalSnapshot,data:{source:pl.ViewportResize,...e}}),inputCb:e=>lc({type:dl.IncrementalSnapshot,data:{source:pl.Input,...e}}),mediaInteractionCb:e=>lc({type:dl.IncrementalSnapshot,data:{source:pl.MediaInteraction,...e}}),styleSheetRuleCb:e=>lc({type:dl.IncrementalSnapshot,data:{source:pl.StyleSheetRule,...e}}),styleDeclarationCb:e=>lc({type:dl.IncrementalSnapshot,data:{source:pl.StyleDeclaration,...e}}),canvasMutationCb:j,fontCb:e=>lc({type:dl.IncrementalSnapshot,data:{source:pl.Font,...e}}),selectionCb:e=>{lc({type:dl.IncrementalSnapshot,data:{source:pl.Selection,...e}})},customElementCb:e=>{lc({type:dl.IncrementalSnapshot,data:{source:pl.CustomElement,...e}})},blockClass:i,ignoreClass:o,ignoreSelector:a,maskTextClass:l,maskTextSelector:c,maskInputOptions:L,inlineStylesheet:h,sampling:w,recordDOM:C,recordCanvas:k,inlineImages:_,userTriggeredOnInput:T,collectFonts:x,doc:e,maskInputFn:m,maskTextFn:f,keepIframeSrcFn:O,blockSelector:n,slimDOMOptions:N,dataURLOptions:v,mirror:dc,iframeManager:K,stylesheetManager:W,shadowDomManager:V,processedNodeManager:G,canvasManager:hc,ignoreCSSAttributes:A,plugins:(null==(t=null==M?void 0:M.filter(e=>e.observer))?void 0:t.map(e=>({observer:e.observer,options:e.options,callback:t=>lc({type:dl.Plugin,data:{plugin:e.name,payload:t}})})))||[]},g)};K.addLoadListener(s=>{try{e.push(t(s.contentDocument))}catch(e){console.warn(e)}});const s=()=>{cc(),e.push(t(document)),uc=!0};return["interactive","complete"].includes(document.readyState)?s():(e.push(Ga("DOMContentLoaded",()=>{lc({type:dl.DomContentLoaded,data:{}}),"DOMContentLoaded"===E&&s()})),e.push(Ga("load",()=>{lc({type:dl.Load,data:{}}),"load"===E&&s()},window))),()=>{e.forEach(e=>{try{e()}catch(e){String(e).toLowerCase().includes("cross-origin")||console.warn(e)}}),G.destroy(),uc=!1,xl=void 0}}catch(e){console.warn(e)}}var mc,fc;pc.addCustomEvent=(e,t)=>{if(!uc)throw new Error("please add custom event after start recording");lc({type:dl.Custom,data:{tag:e,payload:t}})},pc.freezePage=()=>{Ml.forEach(e=>e.freeze())},pc.takeFullSnapshot=e=>{if(!uc)throw new Error("please take full snapshot after start recording");cc(e)},pc.mirror=dc,(fc=mc||(mc={}))[fc.NotStarted=0]="NotStarted",fc[fc.Running=1]="Running",fc[fc.Stopped=2]="Stopped";const gc=[];for(let e=0;e<256;++e)gc.push((e+256).toString(16).slice(1));let yc;const wc=new Uint8Array(16);const vc={};function Sc(e,t,s){let r;{const e=Date.now(),i=function(){if(!yc){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");yc=crypto.getRandomValues.bind(crypto)}return yc(wc)}();!function(e,t,s){e.msecs??=-1/0,e.nsecs??=0,t===e.msecs?(e.nsecs++,e.nsecs>=1e4&&(e.node=void 0,e.nsecs=0)):t>e.msecs?e.nsecs=0:t<e.msecs&&(e.node=void 0);e.node||(e.node=s.slice(10,16),e.node[0]|=1,e.clockseq=16383&(s[8]<<8|s[9]));e.msecs=t}(vc,e,i),r=function(e,t,s,r,i,n,o=0){if(e.length<16)throw new Error("Random bytes length must be >= 16");if(n){if(o<0||o+16>n.length)throw new RangeError(`UUID byte range ${o}:${o+15} is out of buffer bounds`)}else n=new Uint8Array(16),o=0;t??=Date.now(),s??=0,r??=16383&(e[8]<<8|e[9]),i??=e.slice(10,16);const a=(1e4*(268435455&(t+=122192928e5))+s)%4294967296;n[o++]=a>>>24&255,n[o++]=a>>>16&255,n[o++]=a>>>8&255,n[o++]=255&a;const l=t/4294967296*1e4&268435455;n[o++]=l>>>8&255,n[o++]=255&l,n[o++]=l>>>24&15|16,n[o++]=l>>>16&255,n[o++]=r>>>8|128,n[o++]=255&r;for(let e=0;e<6;++e)n[o++]=i[e];return n}(i,vc.msecs,vc.nsecs,vc.clockseq,vc.node,t,s)}return t??function(e,t=0){return(gc[e[t+0]]+gc[e[t+1]]+gc[e[t+2]]+gc[e[t+3]]+"-"+gc[e[t+4]]+gc[e[t+5]]+"-"+gc[e[t+6]]+gc[e[t+7]]+"-"+gc[e[t+8]]+gc[e[t+9]]+"-"+gc[e[t+10]]+gc[e[t+11]]+gc[e[t+12]]+gc[e[t+13]]+gc[e[t+14]]+gc[e[t+15]]).toLowerCase()}(r)}var bc;e.LogLevel=void 0,(bc=e.LogLevel||(e.LogLevel={}))[bc.NONE=0]="NONE",bc[bc.ERROR=1]="ERROR",bc[bc.WARN=2]="WARN",bc[bc.INFO=3]="INFO",bc[bc.DEBUG=4]="DEBUG";const Cc=new class{constructor(t){this.config={level:e.LogLevel.ERROR,enableConsole:!0,enableStorage:!1},this.isBrowser="undefined"!=typeof window,t&&(this.config={...this.config,...t})}setConfig(e){this.config={...this.config,...e}}shouldLog(e){return e<=this.config.level}formatMessage(e,t,...s){return`[HumanBehavior ${e}] ${(new Date).toISOString()}: ${t}`}error(t,...s){if(!this.shouldLog(e.LogLevel.ERROR))return;const r=this.formatMessage("ERROR",t);this.config.enableConsole&&console.error(r,...s),this.config.enableStorage&&this.isBrowser&&this.logToStorage(r,s)}warn(t,...s){if(!this.shouldLog(e.LogLevel.WARN))return;const r=this.formatMessage("WARN",t);this.config.enableConsole&&console.warn(r,...s),this.config.enableStorage&&this.isBrowser&&this.logToStorage(r,s)}info(t,...s){if(!this.shouldLog(e.LogLevel.INFO))return;const r=this.formatMessage("INFO",t);this.config.enableConsole&&console.log(r,...s),this.config.enableStorage&&this.isBrowser&&this.logToStorage(r,s)}debug(t,...s){if(!this.shouldLog(e.LogLevel.DEBUG))return;const r=this.formatMessage("DEBUG",t);this.config.enableConsole&&console.log(r,...s),this.config.enableStorage&&this.isBrowser&&this.logToStorage(r,s)}logToStorage(e,t){try{const s=JSON.parse(localStorage.getItem("human_behavior_logs")||"[]"),r={message:e,args:t.length>0?t:void 0,timestamp:Date.now()};s.push(r),s.length>1e3&&s.splice(0,s.length-1e3),localStorage.setItem("human_behavior_logs",JSON.stringify(s))}catch(e){}}getLogs(){if(!this.isBrowser)return[];try{return JSON.parse(localStorage.getItem("human_behavior_logs")||"[]")}catch(e){return[]}}clearLogs(){this.isBrowser&&localStorage.removeItem("human_behavior_logs")}};let kc=!1;const Ic=()=>kc,Ec=(e,...t)=>{kc=!0;try{Cc.error(e,...t)}finally{kc=!1}},Tc=(e,...t)=>{kc=!0;try{Cc.warn(e,...t)}finally{kc=!1}},xc=(e,...t)=>{kc=!0;try{Cc.info(e,...t)}finally{kc=!1}},_c=(e,...t)=>{kc=!0;try{Cc.debug(e,...t)}finally{kc=!1}};class Mc{constructor(e){this._isPolling=!1,this._pollIntervalMs=3e3,this._queue=[],this._queue=[],this._areWeOnline=!0,this._sendRequest=e,"undefined"!=typeof window&&"onLine"in window.navigator&&(this._areWeOnline=window.navigator.onLine,window.addEventListener("online",()=>{this._areWeOnline=!0,this._flush()}),window.addEventListener("offline",()=>{this._areWeOnline=!1}))}get length(){return this._queue.length}async retriableRequest(e){const t=e.retriesPerformedSoFar||0;if(t>0){const s=new URL(e.url);s.searchParams.set("retry_count",t.toString()),e.url=s.toString()}try{await this._sendRequest(e)}catch(s){if(this._shouldRetry(s,t)&&t<10)return void this._enqueue(e);e.callback&&e.callback({statusCode:s.status||0,text:s.message||"Request failed"})}}_shouldRetry(e,t){return e.status>=400&&e.status<500?408===e.status||429===e.status:e.status>=500||!e.status}_enqueue(e){const t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;const s=function(e){const t=3e3*2**e,s=t/2,r=Math.min(18e5,t),i=(Math.random()-.5)*(r-s);return Math.ceil(r+i)}(t),r=Date.now()+s;this._queue.push({retryAt:r,requestOptions:e});let i=`Enqueued failed request for retry in ${Math.round(s/1e3)}s`;"undefined"==typeof navigator||navigator.onLine||(i+=" (Browser is offline)"),Tc(i),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(){const e=Date.now(),t=[],s=this._queue.filter(s=>s.retryAt<e||(t.push(s),!1));if(this._queue=t,s.length>0)for(const{requestOptions:e}of s)this.retriableRequest(e).catch(e=>{Ec("Failed to retry request:",e)})}unload(){this._poller&&(clearTimeout(this._poller),this._poller=void 0);for(const{requestOptions:e}of this._queue)try{this._sendBeaconRequest(e)}catch(e){Ec("Failed to send request via sendBeacon on unload:",e)}this._queue=[]}_sendBeaconRequest(e){if("undefined"!=typeof navigator&&navigator.sendBeacon)try{const t=new URL(e.url);t.searchParams.set("beacon","1");let s=null;e.body&&("string"==typeof e.body?s=new Blob([e.body],{type:"application/json"}):e.body instanceof Blob&&(s=e.body)),navigator.sendBeacon(t.toString(),s)||Tc("sendBeacon returned false for unload request")}catch(e){Ec("Error sending beacon request:",e)}}}class Oc{constructor(e,t=1e3){this.storageKey="human_behavior_queue",this.maxQueueSize=t}getQueue(){if("undefined"==typeof window||!window.localStorage)return[];try{const e=window.localStorage.getItem(this.storageKey);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch(e){return Tc("Failed to read persisted queue:",e),[]}}setQueue(e){if("undefined"!=typeof window&&window.localStorage)try{const t=e.slice(-this.maxQueueSize);window.localStorage.setItem(this.storageKey,JSON.stringify(t)),_c(`Persisted ${t.length} events to storage`)}catch(t){if("QuotaExceededError"===t.name||22===t.code){Tc("Storage quota exceeded, clearing old events");try{const t=e.slice(-Math.floor(this.maxQueueSize/2));window.localStorage.setItem(this.storageKey,JSON.stringify(t))}catch(e){Tc("Failed to save smaller queue, clearing storage"),this.clearQueue()}}else Tc("Failed to persist queue:",t)}}addToQueue(e){const t=this.getQueue();t.push(e),t.length>this.maxQueueSize&&(t.shift(),_c("Queue is full, the oldest event is dropped.")),this.setQueue(t)}removeFromQueue(e){const t=this.getQueue();t.splice(0,e),this.setQueue(t)}clearQueue(){if("undefined"!=typeof window&&window.localStorage)try{window.localStorage.removeItem(this.storageKey)}catch(e){Tc("Failed to clear persisted queue:",e)}}getQueueLength(){return this.getQueue().length}}const Ac="0.7.0",Rc=1048576,Dc=52428.8;function Pc(e,t,s){return(new TextEncoder).encode(Lc({sessionId:s,events:[...e,t]})).length>Rc}function Lc(e){return JSON.stringify(e,(e,t)=>"bigint"==typeof t?t.toString():t)}function Nc(e,t){if(!e||"object"!=typeof e)return[];if((new TextEncoder).encode(Lc({sessionId:t,events:[e]})).length<=Rc)return[e];const s={...e},r=["screenshot","html","dom","fullText","innerHTML","outerHTML"];return r.forEach(e=>{s[e]&&delete s[e]}),(new TextEncoder).encode(Lc({sessionId:t,events:[s]})).length<=Rc?[s]:[{type:e.type,timestamp:e.timestamp,url:e.url,pathname:e.pathname,...Object.fromEntries(Object.entries(e).filter(([e,t])=>!r.includes(e)&&"object"!=typeof t&&"string"!=typeof t||"string"==typeof t&&t.length<1e3))}]}class Fc{constructor({apiKey:e,ingestionUrl:t}){this.monthlyLimitReached=!1,this.sessionId="",this.endUserId=null,this.cspBlocked=!1,this.requestTimeout=1e4,this.currentBatchSize=100,this.apiKey=e,this.baseUrl=t,this.persistence=new Oc(e),this.retryQueue=new Mc(e=>this._sendRequestInternal(e)),this._loadPersistedEvents()}setTrackingContext(e,t){this.sessionId=e,this.endUserId=t}async _loadPersistedEvents(){const e=this.persistence.getQueue();if(0!==e.length){_c(`Loading ${e.length} persisted events from storage`);for(const t of e)try{await this.sendEventsChunked(t.events,t.sessionId,t.endUserId||void 0,t.windowId,t.automaticProperties),this.persistence.removeFromQueue(1)}catch(e){Tc("Failed to send persisted event, will retry later:",e)}}}async _sendRequestInternal(e){const t="undefined"!=typeof AbortController?new AbortController:null;let s=null;t&&(s=setTimeout(()=>{t.abort()},this.requestTimeout));try{const r=e.estimatedSize||0,i="POST"===e.method&&r<Dc,n=await fetch(e.url,{method:e.method||"GET",headers:e.headers||{},body:e.body,signal:t?.signal,keepalive:i});s&&clearTimeout(s);const o=await n.text();let a=null;try{a=JSON.parse(o)}catch{}if(e.callback&&e.callback({statusCode:n.status,text:o,json:a}),!n.ok)throw{status:n.status,message:o}}catch(e){if(s&&clearTimeout(s),"AbortError"===e.name)throw{status:0,message:"Request timeout"};throw e}}unload(){this.retryQueue.unload()}checkMonthlyLimit(){return!this.monthlyLimitReached}async init(e,t){if(!this.checkMonthlyLimit())return{sessionId:e,endUserId:t};let s=null,r=null;"undefined"!=typeof window&&(s=window.location.href,r=document.referrer),xc("API init called with:",{sessionId:e,userId:t,entryURL:s,referrer:r,baseUrl:this.baseUrl});try{const i=await this.trackedFetch(`${this.baseUrl}/api/ingestion/init`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`,Referer:r||""},body:Lc({sessionId:e,endUserId:t,entryURL:s,referrer:r,sdkVersion:Ac})});if(xc("API init response status:",i.status),!i.ok){if(429===i.status)return this.monthlyLimitReached=!0,{sessionId:e,endUserId:t};const s=await i.text();throw Ec("API init failed:",i.status,s),new Error(`Failed to initialize ingestion: ${i.statusText} - ${s}`)}const n=await i.json();return!0===n.monthlyLimitReached&&(this.monthlyLimitReached=!0,xc("Monthly limit reached detected from server response")),xc("API init success:",n),{sessionId:n.sessionId,endUserId:n.endUserId}}catch(e){throw Ec("API init error:",e),e}}async sendEvents(e,t,s){const r=e.filter(e=>e&&"object"==typeof e),i=await this.trackedFetch(`${this.baseUrl}/api/ingestion/events`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:Lc({sessionId:t,events:r,endUserId:s,sdkVersion:Ac})});if(!i.ok){if(429===i.status)throw this.monthlyLimitReached=!0,new Error("429: Monthly video processing limit reached");throw new Error(`Failed to send events: ${i.statusText}`)}!0===(await i.json()).monthlyLimitReached&&(this.monthlyLimitReached=!0,xc("Monthly limit reached detected from events response"))}async sendEventsChunked(e,t,s,r,i){if(!this.checkMonthlyLimit())return[];try{const n=[];let o=[];for(const a of e)if(a&&"object"==typeof a)if(Pc(o,a,t)){if(o.length>0){_c(`[SDK] Sending chunk with ${o.length} events`);const e=await this.trackedFetch(`${this.baseUrl}/api/ingestion/events`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:Lc({sessionId:t,events:o,endUserId:s,windowId:r,automaticProperties:i,sdkVersion:Ac})});if(!e.ok){if(429===e.status)return this.monthlyLimitReached=!0,n.flat();throw new Error(`Failed to send events: ${e.statusText}`)}const a=await e.json();!0===a.monthlyLimitReached&&(this.monthlyLimitReached=!0,xc("Monthly limit reached detected from chunked events response")),n.push(a),o=[]}o=Nc(a,t)}else o.push(a);if(o.length>0){const e=await this._sendChunkWithRetry(o,t,s,r,i||o[0]?.automaticProperties);e&&n.push(e)}return n.flat()}catch(n){throw Ec("Error sending events:",n),this._persistEvents(e,t,s,r,i),n}}async _sendChunkWithRetry(e,t,s,r,i){let n=Math.min(this.currentBatchSize,e.length),o=0;for(;o<e.length;){const a=Lc({sessionId:t,events:e.slice(o,o+n),endUserId:s,windowId:r,automaticProperties:i,sdkVersion:Ac}),l=(new TextEncoder).encode(a).length;try{const c=await this.trackedFetch(`${this.baseUrl}/api/ingestion/events`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:a},l);if(!c.ok){if(429===c.status)return this.monthlyLimitReached=!0,this._persistEvents(e.slice(o),t,s,r,i),null;if(413===c.status){Tc(`413 error: reducing batch size from ${n} to ${Math.max(1,Math.floor(n/2))}`),this.currentBatchSize=Math.max(1,Math.floor(n/2)),n=this.currentBatchSize;continue}return await this.retryQueue.retriableRequest({url:`${this.baseUrl}/api/ingestion/events`,method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:a,estimatedSize:l,callback:e=>{200===e.statusCode&&e.json&&!0===e.json.monthlyLimitReached&&(this.monthlyLimitReached=!0)}}),this._persistEvents(e.slice(o),t,s,r,i),null}const h=await c.json();if(!0===h.monthlyLimitReached&&(this.monthlyLimitReached=!0,xc("Monthly limit reached detected from chunked events response")),o+=n,o>=e.length)return h}catch(n){return Tc("Network error sending chunk, adding to retry queue:",n),await this.retryQueue.retriableRequest({url:`${this.baseUrl}/api/ingestion/events`,method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:a,estimatedSize:l,callback:e=>{200===e.statusCode&&e.json&&!0===e.json.monthlyLimitReached&&(this.monthlyLimitReached=!0)}}),this._persistEvents(e.slice(o),t,s,r,i),null}}return null}_persistEvents(e,t,s,r,i){0!==e.length&&this.persistence.addToQueue({sessionId:t,events:e,endUserId:s,windowId:r,automaticProperties:i,timestamp:Date.now()})}async sendUserData(e,t,s){try{const r={userId:e,userAttributes:t,sessionId:s,posthogName:t.email||t.name||null};_c("Sending user data to server:",r);const i=await this.trackedFetch(`${this.baseUrl}/api/ingestion/user`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:Lc(r)});if(!i.ok)throw new Error(`Failed to send user data: ${i.statusText} with API key: ${this.apiKey}`);const n=await i.json();return _c("Server response:",n),n}catch(e){throw Ec("Error sending user data:",e),e}}async sendUserAuth(e,t,s,r){try{const i=await this.trackedFetch(`${this.baseUrl}/api/ingestion/user/auth`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:Lc({userId:e,userAttributes:t,sessionId:s,authFields:r})});if(!i.ok)throw new Error(`Failed to authenticate user: ${i.statusText} with API key: ${this.apiKey}`);return await i.json()}catch(e){throw Ec("Error authenticating user:",e),e}}sendSessionEndBeacon(e,t){if("undefined"==typeof navigator||"function"!=typeof navigator.sendBeacon)return!1;try{const s={sessionId:e,endUserId:t||null,apiKey:this.apiKey},r=new Blob([Lc(s)],{type:"application/json"});return navigator.sendBeacon(`${this.baseUrl}/api/ingestion/session-end`,r)}catch{return!1}}sendHeartbeatBeacon(e,t){if("undefined"==typeof navigator||"function"!=typeof navigator.sendBeacon)return!1;try{const s={sessionId:e,endUserId:t||null,apiKey:this.apiKey},r=new Blob([Lc(s)],{type:"application/json"});return navigator.sendBeacon(`${this.baseUrl}/api/ingestion/heartbeat`,r)}catch{return!1}}sendBeaconEvents(e,t,s,r,i,n){const o={sessionId:t,events:e,endUserId:s||null,windowId:r,automaticProperties:i,sdkVersion:Ac,apiKey:this.apiKey},a=new Blob([Lc(o)],{type:"application/json"});return navigator.sendBeacon(`${this.baseUrl}/api/ingestion/events`,a)}async sendCustomEvent(e,t,s,r){xc("[SDK] Sending custom event",{sessionId:e,eventName:t,eventProperties:s,endUserId:r});try{const i=await this.trackedFetch(`${this.baseUrl}/api/ingestion/customEvent`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:Lc({sessionId:e,eventName:t,eventProperties:s||{},endUserId:r||null})});if(xc("[SDK] Custom event response",{status:i.status,statusText:i.statusText}),!i.ok){const e=await i.text();throw Ec("[SDK] Failed to send custom event",{status:i.status,statusText:i.statusText,errorText:e}),new Error(`Failed to send custom event: ${i.status} ${i.statusText} - ${e}`)}const n=await i.json();return _c("[SDK] Custom event success",n),n}catch(r){throw Ec("[SDK] Error sending custom event",r,{sessionId:e,eventName:t,eventProperties:s}),r}}async sendCustomEventBatch(e,t,s){try{const r=await this.trackedFetch(`${this.baseUrl}/api/ingestion/customEvent/batch`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:Lc({sessionId:e,events:t,endUserId:s||null})});if(!r.ok)throw new Error(`Failed to send custom event batch: ${r.statusText}`);return await r.json()}catch(e){throw Ec("Error sending custom event batch:",e),e}}sendCustomEventBatchBeacon(e,t,s){if("undefined"==typeof navigator||"function"!=typeof navigator.sendBeacon)return!1;try{const r={sessionId:e,events:t,endUserId:s||null,apiKey:this.apiKey},i=new Blob([Lc(r)],{type:"application/json"});return navigator.sendBeacon(`${this.baseUrl}/api/ingestion/customEvent/batch`,i)}catch{return!1}}async sendLog(e){try{if(_c("[SDK] Sending log to server:",{level:e.level,message:e.message.substring(0,50),sessionId:e.sessionId}),!this.baseUrl)return;if(!e.sessionId)return;const t=await fetch(`${this.baseUrl}/api/ingestion/logs`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:Lc(e)});t.ok?_c("[SDK] Log sent successfully"):Tc("[SDK] Failed to send log to server:",t.status,t.statusText)}catch(e){Tc("[SDK] Failed to send log to server:",e)}}async sendNetworkError(e){try{if(_c("[SDK] Sending network error to server:",{errorType:e.errorType,url:e.url.substring(0,50),sessionId:e.sessionId}),!this.baseUrl)return;if(!e.sessionId)return;const t=await fetch(`${this.baseUrl}/api/ingestion/network`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:Lc(e)});t.ok?_c("[SDK] Network error sent successfully"):Tc("[SDK] Failed to send network error to server:",t.status,t.statusText)}catch(e){Tc("[SDK] Failed to send network error to server:",e)}}async sendIpInfo(e,t){try{if(!this.baseUrl||!e||!t)return;const s=await fetch(`${this.baseUrl}/api/ingestion/ip-info`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:Lc({sessionId:e,endUserId:t,ipDetectionMethod:"server_header"})});s.ok||Tc("[SDK] Failed to send ip-info:",s.status,s.statusText)}catch(e){Tc("[SDK] Failed to send ip-info:",e)}}async trackedFetch(e,t,s){const r=Date.now(),i=Sc(),n=this.shouldSkipNetworkTracking(e);if(this.cspBlocked&&"POST"===t.method&&"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon)return this.trackedFetchWithBeaconFallback(e,t,n);try{const o="undefined"!=typeof AbortController?new AbortController:null;let a=null;o&&(a=setTimeout(()=>{o.abort()},this.requestTimeout));const l="POST"===t.method&&void 0!==s&&s<Dc,c=await fetch(e,{...t,signal:o?.signal,keepalive:l});a&&clearTimeout(a);const h=Date.now()-r;return c.ok||n||await this.sendNetworkError({requestId:i,url:e,method:t.method||"GET",status:c.status,statusText:c.statusText,duration:h,timestampMs:Date.now(),sessionId:this.sessionId,endUserId:this.endUserId,errorType:this.classifyHttpError(c.status),errorMessage:c.statusText,startTimeMs:r,spanName:`${t.method||"GET"} ${e}`,spanStatus:"error",attributes:{"http.status_code":c.status,"http.status_text":c.statusText}}).catch(()=>{}),c}catch(s){const o=Date.now()-r;if("AbortError"===s.name){const e=new Error("Request timeout");e.name="TimeoutError",s=e}if(this.isCSPViolation(s)&&"POST"===t.method&&"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon)return this.cspBlocked=!0,Tc("[SDK] CSP violation detected, falling back to sendBeacon for future requests"),this.trackedFetchWithBeaconFallback(e,t,n);throw n||await this.sendNetworkError({requestId:i,url:e,method:t.method||"GET",status:null,statusText:null,duration:o,timestampMs:Date.now(),sessionId:this.sessionId,endUserId:this.endUserId,errorType:this.classifyNetworkError(s),errorMessage:s.message,errorName:s.name,startTimeMs:r,spanName:`${t.method||"GET"} ${e}`,spanStatus:"error",attributes:{"error.name":s.name,"error.message":s.message}}).catch(()=>{}),s}}async trackedFetchWithBeaconFallback(e,t,s){try{let s=null,r="";if(t.body)if("string"==typeof t.body)try{s=JSON.parse(t.body),r=t.body}catch{r=t.body}else{if(t.body instanceof Blob)return Tc("[SDK] Cannot extract apiKey from Blob body for sendBeacon, using URL param"),e=`${e}${e.includes("?")?"&":"?"}apiKey=${encodeURIComponent(this.apiKey)}`,navigator.sendBeacon(e,t.body)?new Response(null,{status:200,statusText:"OK",headers:new Headers}):new Response(null,{status:500,statusText:"sendBeacon failed",headers:new Headers});r=Lc(t.body),s=t.body}if(e.includes("/api/ingestion/"))if(s&&"object"==typeof s)s.apiKey=this.apiKey,r=Lc(s);else if(r)try{const e=JSON.parse(r);e.apiKey=this.apiKey,r=Lc(e)}catch{e=`${e}${e.includes("?")?"&":"?"}apiKey=${encodeURIComponent(this.apiKey)}`}else e=`${e}${e.includes("?")?"&":"?"}apiKey=${encodeURIComponent(this.apiKey)}`;else e=`${e}${e.includes("?")?"&":"?"}apiKey=${encodeURIComponent(this.apiKey)}`;const i=r?new Blob([r],{type:"application/json"}):null;return navigator.sendBeacon(e,i)?(_c("[SDK] Successfully sent request via sendBeacon (CSP fallback)"),new Response(null,{status:200,statusText:"OK",headers:new Headers})):(Tc("[SDK] sendBeacon returned false - browser may be throttling"),new Response(null,{status:200,statusText:"OK (sendBeacon best-effort)",headers:new Headers}))}catch(e){return Ec("[SDK] sendBeacon fallback failed:",e),new Response(null,{status:500,statusText:"Failed to send via sendBeacon",headers:new Headers})}}isCSPViolation(e){const t=(e?.message||"").toLowerCase();return"typeerror"===(e?.name||"").toLowerCase()&&t.includes("failed to fetch")||t.includes("content security policy")||t.includes("csp")||t.includes("violates")||t.includes("refused to connect")&&t.includes("violates")}shouldSkipNetworkTracking(e){if(!e||!this.baseUrl)return!1;try{const t=new URL(e),s=new URL(this.baseUrl);return!(t.origin!==s.origin||!t.pathname.startsWith("/api/ingestion/"))||!!e.includes(this.baseUrl)}catch(t){return e.includes(this.baseUrl)}}classifyHttpError(e){return e>=400&&e<500?"client_error":e>=500?"server_error":"unknown_error"}classifyNetworkError(e){const t=e.message||"",s=e.name||"";return this.isCSPViolation(e)?"csp_violation":t.includes("ERR_BLOCKED_BY_CLIENT")||t.includes("ERR_BLOCKED_BY_RESPONSE")||t.includes("blocked:other")||t.includes("net::ERR_BLOCKED_BY_CLIENT")||t.includes("net::ERR_BLOCKED_BY_RESPONSE")||"TypeError"===s&&t.includes("Failed to fetch")&&(t.includes("blocked")||t.includes("ERR_BLOCKED"))?"blocked_by_client":t.includes("CORS")||t.includes("Access-Control")?"cors_error":t.includes("timeout")||"TimeoutError"===s?"timeout_error":t.includes("Failed to fetch")||t.includes("NetworkError")?"network_error":"unknown_error"}}class Uc{constructor(e){if(this.redactedText="[REDACTED]",this.unredactedFields=new Set,this.redactedFields=new Set,this.redactionMode="privacy-first",this.excludeSelectors=['[data-no-redact="true"]',".human-behavior-no-redact"],e?.redactedText&&(this.redactedText=e.redactedText),e?.excludeSelectors&&(this.excludeSelectors=[...this.excludeSelectors,...e.excludeSelectors]),e?.redactionStrategy)if(this.redactionMode=e.redactionStrategy.mode,"privacy-first"===this.redactionMode)e.redactionStrategy.unredactFields&&this.setFieldsToUnredact(e.redactionStrategy.unredactFields);else{const t=['input[type="password"]','[data-hb-redact="true"]'],s=e.redactionStrategy.redactFields&&e.redactionStrategy.redactFields.length>0?e.redactionStrategy.redactFields:t;this.setFieldsToRedact(s)}e?.legacyRedactFields&&this.setFieldsToUnredact(e.legacyRedactFields),e?.userFields&&this.setFieldsToUnredact(e.userFields)}setFieldsToRedact(e){this.redactedFields.clear(),['input[type="password"]','input[type="password" i]','[type="password"]','[type="password" i]',...e].forEach(e=>{this.redactedFields.add(e)}),this.redactedFields.size>0?_c(`Redaction: Active for ${this.redactedFields.size} field(s):`,Array.from(this.redactedFields)):_c("Redaction: No fields to redact"),this.applyRedactionClasses()}setFieldsToUnredact(e){this.unredactedFields.clear();const t=e.filter(e=>!this.isPasswordSelector(e)||(Tc(`Cannot unredact password field: ${e} - Password fields are always protected`),!1));t.forEach(e=>this.unredactedFields.add(e)),t.length>0?_c(`Unredaction: Active for ${t.length} field(s):`,t):_c("Unredaction: No valid fields to unredact"),this.applyUnredactionClasses()}redactFields(e){e.forEach(e=>{this.unredactedFields.delete(e)}),this.unredactedFields.size>0?_c(`Unredaction: Removed ${e.length} field(s), ${this.unredactedFields.size} remaining:`,Array.from(this.unredactedFields)):_c("Unredaction: All fields redacted"),this.applyUnredactionClasses()}clearUnredactedFields(){this.unredactedFields.clear(),_c("Unredaction: All fields cleared, everything redacted"),this.removeUnredactionClasses()}hasUnredactedFields(){return this.unredactedFields.size>0}getRedactionMode(){return this.redactionMode}getUnredactedFields(){return Array.from(this.unredactedFields)}getMaskTextSelector(){return"privacy-first"===this.redactionMode?0===this.unredactedFields.size?null:Array.from(this.unredactedFields).join(","):0===this.redactedFields.size?null:Array.from(this.redactedFields).join(",")}applyRedactionClasses(){0!==this.redactedFields.size&&("undefined"!=typeof document&&"loading"!==document.readyState?this.redactedFields.forEach(e=>{try{const t=document.querySelectorAll(e);t.forEach(e=>{e&&e.classList&&e.classList.add("rr-mask")}),_c(`Added rr-mask class to ${t.length} element(s) for selector: ${e}`)}catch(t){Tc(`Invalid selector: ${e}`)}}):_c("DOM not ready, deferring redaction class application"))}applyUnredactionClasses(){0!==this.unredactedFields.size&&("undefined"!=typeof document&&"loading"!==document.readyState?this.unredactedFields.forEach(e=>{try{const t=document.querySelectorAll(e);t.forEach(e=>{e&&e.classList&&e.classList.remove("rr-mask")}),_c(`Removed rr-mask class from ${t.length} element(s) for selector: ${e}`)}catch(t){Tc(`Invalid selector: ${e}`)}}):_c("DOM not ready, deferring unredaction class application"))}removeUnredactionClasses(){_c("Unredaction classes removed")}isPasswordSelector(e){return['input[type="password"]','input[type="password" i]','[type="password"]','[type="password" i]'].some(t=>e.toLowerCase().includes(t.toLowerCase().replace(/[\[\]]/g,"")))}getOriginalValue(e){if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)return e.value}isElementUnredacted(e){return this.shouldUnredactElement(e)}shouldUnredactElement(e){if("privacy-first"===this.redactionMode){if(0===this.unredactedFields.size)return!1;for(const t of this.unredactedFields)try{if(e.matches(t))return!0}catch(e){Tc(`Invalid selector: ${t}`)}return!1}if(0===this.redactedFields.size)return!0;for(const t of this.redactedFields)try{if(e.matches(t))return!1}catch(e){Tc(`Invalid selector: ${t}`)}return!0}}new Uc;const Bc="undefined"!=typeof window;function $c(){if(!Bc)return"unknown";const e=navigator.userAgent.toLowerCase(),t=window.screen.width,s=window.screen.height;return/mobile|android|iphone|ipad|ipod|blackberry|windows phone/i.test(e)?/ipad/i.test(e)||t>=768&&s>=1024?"tablet":"mobile":/windows|macintosh|linux/i.test(e)?"desktop":"unknown"}function zc(e){try{return new URL(e).hostname}catch{return""}}function jc(){if(!Bc)return{device_type:"unknown",browser:"unknown",browser_version:"unknown",os:"unknown",os_version:"unknown",screen_resolution:"unknown",viewport_size:"unknown",color_depth:0,timezone:"unknown",language:"unknown",languages:[]};const{browser:e,browser_version:t}=function(){if(!Bc)return{browser:"unknown",browser_version:"unknown"};const e=navigator.userAgent;if(/chrome/i.test(e)&&!/edge/i.test(e)){const t=e.match(/chrome\/(\d+)/i);return{browser:"chrome",browser_version:t?t[1]:"unknown"}}if(/firefox/i.test(e)){const t=e.match(/firefox\/(\d+)/i);return{browser:"firefox",browser_version:t?t[1]:"unknown"}}if(/safari/i.test(e)&&!/chrome/i.test(e)){const t=e.match(/version\/(\d+)/i);return{browser:"safari",browser_version:t?t[1]:"unknown"}}if(/edge/i.test(e)){const t=e.match(/edge\/(\d+)/i);return{browser:"edge",browser_version:t?t[1]:"unknown"}}if(/msie|trident/i.test(e)){const t=e.match(/msie (\d+)/i)||e.match(/rv:(\d+)/i);return{browser:"ie",browser_version:t?t[1]:"unknown"}}return{browser:"unknown",browser_version:"unknown"}}(),{os:s,os_version:r}=function(){if(!Bc)return{os:"unknown",os_version:"unknown"};const e=navigator.userAgent;if(/windows/i.test(e)){const t=e.match(/windows nt (\d+\.\d+)/i);let s="unknown";if(t){const e=parseFloat(t[1]);s=10===e?"10":6.3===e?"8.1":6.2===e?"8":6.1===e?"7":t[1]}return{os:"windows",os_version:s}}if(/macintosh|mac os x/i.test(e)){const t=e.match(/mac os x (\d+[._]\d+)/i);return{os:"macos",os_version:t?t[1].replace("_","."):"unknown"}}if(/iphone|ipad|ipod/i.test(e)){const t=e.match(/os (\d+[._]\d+)/i);return{os:"ios",os_version:t?t[1].replace("_","."):"unknown"}}if(/android/i.test(e)){const t=e.match(/android (\d+\.\d+)/i);return{os:"android",os_version:t?t[1]:"unknown"}}return/linux/i.test(e)?{os:"linux",os_version:"unknown"}:{os:"unknown",os_version:"unknown"}}();return{device_type:$c(),browser:e,browser_version:t,os:s,os_version:r,screen_resolution:`${window.screen.width}x${window.screen.height}`,viewport_size:`${window.innerWidth}x${window.innerHeight}`,color_depth:window.screen.colorDepth,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,language:navigator.language,languages:[...navigator.languages||[navigator.language]],raw_user_agent:navigator.userAgent}}function Wc(){if(!Bc)return{current_url:"",pathname:"",search:"",hash:"",title:"",referrer:"",referrer_domain:"",initial_referrer:"",initial_referrer_domain:""};const e=window.location.href,t=document.referrer,s=function(e){const t=new URL(e),s={};return["utm_source","utm_medium","utm_campaign","utm_term","utm_content"].forEach(e=>{const r=t.searchParams.get(e);r&&(s[e]=r)}),s}(e);return{current_url:e,pathname:window.location.pathname,search:window.location.search,hash:window.location.hash,title:document.title,referrer:t,referrer_domain:zc(t),initial_referrer:t,initial_referrer_domain:zc(t),initial_host:window.location.hostname,...s}}function Kc(){return{...jc(),...Wc()}}function Gc(){if(!Bc)return{};const e=Wc();return{initial_referrer:e.initial_referrer,initial_referrer_domain:e.initial_referrer_domain,initial_url:e.current_url,initial_pathname:e.pathname,initial_utm_source:e.utm_source,initial_utm_medium:e.utm_medium,initial_utm_campaign:e.utm_campaign,initial_utm_term:e.utm_term,initial_utm_content:e.utm_content}}function Vc(){if(!Bc)return{};const e=Wc();return{current_url:e.current_url,pathname:e.pathname,search:e.search,hash:e.hash,title:e.title,referrer:e.referrer,referrer_domain:e.referrer_domain,utm_source:e.utm_source,utm_medium:e.utm_medium,utm_campaign:e.utm_campaign,utm_term:e.utm_term,utm_content:e.utm_content}}class Hc{constructor(e={}){this.sessionProperties={},this.userProperties={},this.initialProperties={},this.isInitialized=!1,this.config={enableAutomaticProperties:!0,enableSessionProperties:!0,enableUserProperties:!0,propertyDenylist:[],...e},this.automaticProperties=Kc(),this.initialize()}initialize(){this.isInitialized||(this.initialProperties=Gc(),this.loadSessionProperties(),this.isInitialized=!0)}getEventProperties(e={}){const t={};return this.config.enableAutomaticProperties&&(Object.assign(t,this.getAutomaticProperties()),this.config.enableSessionProperties&&Object.assign(t,this.sessionProperties),this.config.enableUserProperties&&Object.assign(t,this.userProperties),this.sessionProperties.$initial_properties_captured||(Object.assign(t,this.initialProperties),this.setSessionProperty("$initial_properties_captured",!0))),Object.assign(t,e),this.applyDenylist(t),t}getAutomaticProperties(){return{...this.automaticProperties,...Vc()}}getAutomaticPropertiesWithGeoIP(e={}){return{...this.automaticProperties,...Vc(),...e}}setSessionProperty(e,t){this.sessionProperties[e]=t,this.saveSessionProperties()}setSessionProperties(e){Object.assign(this.sessionProperties,e),this.saveSessionProperties()}getSessionProperty(e){return this.sessionProperties[e]}removeSessionProperty(e){delete this.sessionProperties[e],this.saveSessionProperties()}setUserProperty(e,t){this.userProperties[e]=t}setUserProperties(e){Object.assign(this.userProperties,e)}getUserProperty(e){return this.userProperties[e]}removeUserProperty(e){delete this.userProperties[e]}setOnce(e,t,s="user"){"session"===s?e in this.sessionProperties||this.setSessionProperty(e,t):e in this.userProperties||this.setUserProperty(e,t)}clearSessionProperties(){this.sessionProperties={},this.saveSessionProperties()}clearUserProperties(){this.userProperties={}}reset(){this.clearSessionProperties(),this.clearUserProperties(),this.initialProperties={},this.isInitialized=!1,this.initialize()}loadSessionProperties(){if("undefined"!=typeof sessionStorage)try{const e=sessionStorage.getItem("hb_session_properties");e&&(this.sessionProperties=JSON.parse(e))}catch(e){console.warn("Failed to load session properties:",e)}}saveSessionProperties(){if("undefined"!=typeof sessionStorage)try{sessionStorage.setItem("hb_session_properties",JSON.stringify(this.sessionProperties))}catch(e){console.warn("Failed to save session properties:",e)}}applyDenylist(e){this.config.propertyDenylist&&0!==this.config.propertyDenylist.length&&this.config.propertyDenylist.forEach(t=>{delete e[t]})}updateAutomaticProperties(){this.automaticProperties=Kc()}getAllProperties(){return{automatic:this.getAutomaticProperties(),session:{...this.sessionProperties},user:{...this.userProperties},initial:{...this.initialProperties}}}}const Yc="undefined"!=typeof window;class Zc{get isTrackerStarted(){return this.isStarted}setupDomReadyHandler(){if(Yc)if("complete"===document.readyState||"interactive"===document.readyState)this.onDomReady();else if(document.addEventListener){document.addEventListener("DOMContentLoaded",()=>this.onDomReady(),{capture:!1});const e=setInterval(()=>{"interactive"!==document.readyState&&"complete"!==document.readyState||(clearInterval(e),this.onDomReady())},10);setTimeout(()=>clearInterval(e),5e3)}else this.onDomReady();else this.onDomReady()}onDomReady(){this.isDomReady||(this.isDomReady=!0,_c("🎯 DOM is ready, processing queued requests"),this.requestQueue.forEach(e=>{this.processRequest(e)}),this.requestQueue=[],this.domReadyHandlers.forEach(e=>e()),this.domReadyHandlers=[])}queueRequest(e){this.isDomReady?this.processRequest(e):this.requestQueue.push(e)}async processRequest(e){switch(_c("Processing queued request:",e),e.type){case"addEvent":await this.addEvent(e.event);break;case"identifyUser":await this.identifyUser(e.userProperties);break;case"trackPageView":this.trackPageView();break;default:Tc("Unknown request type:",e.type)}}registerDomReadyHandler(e){this.isDomReady?e():this.domReadyHandlers.push(e)}static init(e,t){if(Yc&&!1!==t?.suppressConsoleErrors){const e=console.error;console.error=(...t)=>{const s=t.join(" ");s.includes("SecurityError: Failed to execute 'toDataURL'")||s.includes("Tainted canvases may not be exported")||s.includes("Cannot inline img src=")||s.includes("Cross-Origin")||s.includes("CORS")||s.includes("Access-Control-Allow-Origin")||s.includes("Failed to load resource")||s.includes("net::ERR_BLOCKED_BY_CLIENT")||s.includes("NetworkError when attempting to fetch resource")||s.includes("Failed to fetch")||s.includes("TypeError: NetworkError")||s.includes("HumanBehavior ERROR")||s.includes("Failed to track custom event")||s.includes("Error sending custom event")||e.apply(console,t)};const t=console.warn;console.warn=(...e)=>{const s=e.join(" ");s.includes("Cannot inline img src=")||s.includes("Cross-Origin")||s.includes("CORS")||s.includes("Access-Control-Allow-Origin")||s.includes("Failed to load resource")||s.includes("net::ERR_BLOCKED_BY_CLIENT")||s.includes("NetworkError when attempting to fetch resource")||s.includes("Failed to fetch")||s.includes("Custom event network error")||s.includes("Request blocked by ad blocker")||t.apply(console,e)},window.addEventListener("error",e=>{const t=e.message||"";if(t.includes("SecurityError")||t.includes("Tainted canvases")||t.includes("toDataURL")||t.includes("Cross-Origin")||t.includes("CORS")||t.includes("NetworkError")||t.includes("Failed to fetch"))return e.preventDefault(),!1})}if(Yc&&window.__humanBehaviorGlobalTracker)return _c("Tracker already initialized, returning existing instance"),window.__humanBehaviorGlobalTracker;t?.logLevel&&this.configureLogging({level:t.logLevel});const s=new Zc(e,t?.ingestionUrl,{enableAutomaticProperties:t?.enableAutomaticProperties,propertyDenylist:t?.propertyDenylist,redactionStrategy:t?.redactionStrategy,redactFields:t?.redactFields,maxQueueSize:t?.maxQueueSize,enableConsoleTracking:t?.enableConsoleTracking,enableNetworkTracking:t?.enableNetworkTracking});return s.recordCanvas=t?.recordCanvas??!1,t?.redactFields&&s.setUnredactedFields(t.redactFields),!1!==t?.enableAutomaticTracking&&s.setupAutomaticTracking(t?.automaticTrackingOptions),s.start(),s}constructor(e,t,s){if(this.eventQueue=[],this.pendingCustomEvents=[],this.pendingLogs=[],this.pendingNetworkErrors=[],this.customEventBatch=[],this.customEventBatchTimer=null,this.CUSTOM_EVENT_FLUSH_MS=100,this.CUSTOM_EVENT_BATCH_MAX=50,this._sessionActivityTimestamp=null,this._sessionStartTimestamp=null,this.userProperties={},this.isProcessing=!1,this.flushInterval=null,this.FLUSH_INTERVAL_MS=3e3,this.heartbeatInterval=null,this.HEARTBEAT_INTERVAL_MS=3e4,this.SESSION_IDLE_TIMEOUT_MS=18e5,this.SESSION_MAX_LENGTH_MS=864e5,this.focusBlurGraceTimeout=null,this.FOCUS_BLUR_GRACE_MS=2e3,this.lastEmittedFocusState=null,this.endUserId=null,this.initialized=!1,this.initializationPromise=null,this.monthlyLimitReached=!1,this.isDomReady=!1,this.requestQueue=[],this.domReadyHandlers=[],this.originalConsole=null,this.consoleTrackingEnabled=!1,this.originalFetch=null,this.networkTrackingEnabled=!1,this.enableConsoleTrackingFlag=!0,this.enableNetworkTrackingFlag=!0,this.navigationTrackingEnabled=!1,this.currentUrl="",this.previousUrl="",this.originalPushState=null,this.originalReplaceState=null,this.navigationListeners=[],this.lastPushStateAt=0,this.NAVIGATION_DEDUPE_MS=100,this._connectionBlocked=!1,this.recordInstance=null,this.sessionStartTime=Date.now(),this.rrwebRecord=null,this.fullSnapshotTimeout=null,this.recordCanvas=!1,this.isStarted=!1,this.minimumDurationMilliseconds=5e3,this._isIdle="unknown",this._lastActivityTimestamp=Date.now(),this.IDLE_THRESHOLD_MS=3e5,this.rageClickTracker={clicks:[]},this.RAGE_CLICK_THRESHOLD_PX=30,this.RAGE_CLICK_TIMEOUT_MS=1e3,this.RAGE_CLICK_CLICK_COUNT=3,this.rageJustFiredAt=0,this.deadClickTracker={pendingClicks:new Map},this.DEAD_CLICK_SCROLL_THRESHOLD_MS=100,this.DEAD_CLICK_SELECTION_THRESHOLD_MS=2500,this.DEAD_CLICK_MUTATION_THRESHOLD_MS=100,this.DEAD_CLICK_ABSOLUTE_TIMEOUT_MS=2750,!e)throw new Error("Human Behavior API Key is required");const r=t||"https://ingest.humanbehavior.co";if(this.api=new Fc({apiKey:e,ingestionUrl:r}),this.apiKey=e,this.ingestionUrl=r,this.MAX_QUEUE_SIZE=s?.maxQueueSize??1e3,this.enableConsoleTrackingFlag=!1!==s?.enableConsoleTracking,this.enableNetworkTrackingFlag=!1!==s?.enableNetworkTracking,this.redactionManager=new Uc({redactionStrategy:s?.redactionStrategy,legacyRedactFields:s?.redactFields}),this.propertyManager=new Hc({enableAutomaticProperties:!1!==s?.enableAutomaticProperties,propertyDenylist:s?.propertyDenylist||[]}),Yc){const e="human_behavior_end_user_id",t=this.getCookie(e);this.endUserId=t||Sc(),t?_c(`Reusing existing endUserId: ${this.endUserId}`):(this.setCookie(e,this.endUserId,365),_c(`Generated new endUserId: ${this.endUserId}`))}else this.endUserId=Sc();if(Yc){const e=this.apiKey||"default";this._window_id_storage_key=`human_behavior_${e}_window_id`,this._primary_window_exists_storage_key=`human_behavior_${e}_primary_window_exists`,this.sessionId=this.getOrCreateSessionId(),this.windowId=this.getOrCreateWindowId(),this.currentUrl=window.location.href,window.__humanBehaviorGlobalTracker=this,this.setupWindowUnloadListener()}else this._window_id_storage_key="",this._primary_window_exists_storage_key="",this.sessionId=Sc(),this.windowId=Sc();this.api.setTrackingContext(this.sessionId,this.endUserId),this.initializationPromise=this.init().catch(e=>{Ec("Initialization failed:",e)})}async init(){try{this.initialized=!0,Yc?(this.setupPageUnloadHandler(),this.setupNavigationTracking()):xc("HumanBehaviorTracker initialized in server environment. Session tracking is disabled."),xc(`HumanBehaviorTracker initialized with sessionId: ${this.sessionId}, endUserId: ${this.endUserId}`)}catch(e){Ec("Failed to initialize HumanBehaviorTracker:",e),this.initialized=!0}}async ensureInitialized(){this.initializationPromise&&await this.initializationPromise}setupNavigationTracking(){if(!Yc||this.navigationTrackingEnabled)return;this.navigationTrackingEnabled=!0,_c("Setting up navigation tracking"),this.originalPushState=history.pushState,this.originalReplaceState=history.replaceState,history.pushState=(...e)=>{this.previousUrl=this.currentUrl,this.originalPushState.apply(history,e),this.currentUrl=window.location.href,this.lastPushStateAt=Date.now(),this.trackNavigationEvent("pushState",this.previousUrl,this.currentUrl),this.takeFullSnapshot()},history.replaceState=(...e)=>{this.previousUrl=this.currentUrl,this.originalReplaceState.apply(history,e),this.currentUrl=window.location.href,this.lastPushStateAt=Date.now(),this.trackNavigationEvent("replaceState",this.previousUrl,this.currentUrl),this.takeFullSnapshot()};const e=()=>{this.previousUrl=this.currentUrl,this.currentUrl=window.location.href,this.trackNavigationEvent("popstate",this.previousUrl,this.currentUrl),this.takeFullSnapshot()};window.addEventListener("popstate",e),this.navigationListeners.push(()=>{window.removeEventListener("popstate",e)});const t=()=>{if(Date.now()-this.lastPushStateAt<this.NAVIGATION_DEDUPE_MS)return this.previousUrl=this.currentUrl,void(this.currentUrl=window.location.href);this.previousUrl=this.currentUrl,this.currentUrl=window.location.href,this.trackNavigationEvent("hashchange",this.previousUrl,this.currentUrl)};window.addEventListener("hashchange",t),this.navigationListeners.push(()=>{window.removeEventListener("hashchange",t)}),this.trackNavigationEvent("pageLoad","",this.currentUrl)}async trackNavigationEvent(e,t,s){if(this.initialized)if("pageLoad"===e||t!==s)try{if("pageLoad"===e||"pushState"===e||"replaceState"===e||"popstate"===e||"hashchange"===e){const s={url:window.location.href,fromUrl:t,$navigation_type:e,navigationType:e,pathname:window.location.pathname,search:window.location.search,hash:window.location.hash,referrer:document.referrer,timestamp:Date.now()};await this.customEvent("$pageview",s)}_c(`Navigation tracked: ${e} from ${t} to ${s}`)}catch(e){Ec("Failed to track navigation event:",e)}else _c(`Navigation dedupe: ${e} same URL (${s})`)}async trackPageView(e){if(this.initialized){this.propertyManager.updateAutomaticProperties();try{const t={url:e||window.location.href,pathname:window.location.pathname,search:window.location.search,hash:window.location.hash,referrer:document.referrer,timestamp:(new Date).toISOString()},s=this.propertyManager.getEventProperties(t);await this.addEvent({type:5,data:{payload:{eventType:"pageview",...s}},timestamp:Date.now()}),_c(`Pageview tracked: ${t.url}`)}catch(e){Ec("Failed to track pageview event:",e)}}}async customEvent(e,t){if(null==e||"string"!=typeof e||""===e.trim())return void Tc("customEvent() called with empty or invalid name; skipping");this.endUserId||(Tc(`endUserId not available, using anonymous ID for event: ${e}`),this.endUserId=Sc()),Yc&&this.checkAndRefreshSession();const s=this.propertyManager.getEventProperties(t);if(this.shouldSkipDueToMinimumDuration())return _c(`Custom event '${e}' queued due to session duration below minimum`),void this.pendingCustomEvents.push({eventName:e,properties:s,timestamp:Date.now()});await this.flushPendingCustomEvents(),this.queueCustomEvent(e,s),_c(`Custom event queued: ${e}`,s)}queueCustomEvent(e,t){this.customEventBatch.push({eventName:e,eventProperties:t}),this.customEventBatch.length>=this.CUSTOM_EVENT_BATCH_MAX?this.flushCustomEventBatch():null==this.customEventBatchTimer&&(this.customEventBatchTimer=setTimeout(()=>{this.customEventBatchTimer=null,this.flushCustomEventBatch()},this.CUSTOM_EVENT_FLUSH_MS))}async flushCustomEventBatch(){if(null!=this.customEventBatchTimer&&(clearTimeout(this.customEventBatchTimer),this.customEventBatchTimer=null),0===this.customEventBatch.length)return;const e=this.customEventBatch;this.customEventBatch=[];try{return await this.api.sendCustomEventBatch(this.sessionId,e,this.endUserId),void _c(`Custom event batch flushed: ${e.length} event(s)`)}catch(e){Ec("Failed to flush custom event batch, falling back per-event:",e)}for(const t of e)try{await this.api.sendCustomEvent(this.sessionId,t.eventName,t.eventProperties,this.endUserId)}catch(e){Ec("Per-event fallback also failed:",e);try{await this.addEvent({type:5,data:{payload:{eventType:"custom",eventName:t.eventName,properties:t.eventProperties||{},timestamp:(new Date).toISOString(),url:Yc?window.location.href:"",pathname:Yc?window.location.pathname:""}},timestamp:Date.now()})}catch(e){Ec("Failed to add custom event to event stream as fallback:",e)}}}setupAutomaticTracking(e){if(!Yc)return;const t={trackButtons:!1!==e?.trackButtons,trackLinks:!1,trackForms:!1!==e?.trackForms,includeText:!1!==e?.includeText,includeClasses:e?.includeClasses||!1};_c("Setting up automatic tracking with config:",t),this.setupAutocapture(t),t.trackForms&&this.setupAutomaticFormTracking(t),this.setupRageClickDetection(),this.setupDeadClickDetection()}setupAutocapture(e){document.addEventListener("click",async t=>{const s=t.target;if(!s||1!==s.nodeType||"function"!=typeof s.closest)return;const r=s.closest('button, a, input, select, textarea, label, [role="button"], [role="link"], [role="tab"], [role="menuitem"]')||s,i=(r.tagName||"").toLowerCase(),n={tag:i,x:t.clientX,y:t.clientY,page:window.location.pathname,path:this.buildDomPath(r),timestamp:Date.now()};r.id&&(n.id=r.id,n.elementId=r.id);const o=r.getAttribute&&r.getAttribute("role");o&&(n.role=o);const a=r.type;!a||"input"!==i&&"button"!==i||(n.type=a);const l=r.href;if(l&&(n.href=l),!1!==e.includeText){const e=(r.textContent||"").replace(/\s+/g," ").trim();e&&(n.text=e.substring(0,200),n.elementText=e.substring(0,100))}const c=r.className;e.includeClasses&&"string"==typeof c&&c&&(n.class=c,n.elementClass=c),await this.customEvent("$click",n)})}buildDomPath(e){const t=[];let s=e,r=0;for(;s&&1===s.nodeType&&r<8;){const e=(s.tagName||"").toLowerCase();if(!e)break;let i=e;if(s.id)i+="#"+s.id;else if("string"==typeof s.className&&s.className){const e=s.className.trim().split(/\s+/)[0];e&&(i+="."+e)}if(t.unshift(i),"body"===e||"html"===e)break;s=s.parentElement,r++}return t.join(" > ")}setupRageClickDetection(){Yc&&document.addEventListener("click",async e=>{const t=e.target;if(!t||1!==t.nodeType)return;const s=e.clientX,r=e.clientY,i=Date.now();if(this.isRageClick(s,r,i,t)){const e=("function"==typeof t.closest?t.closest('button, a, [role="button"], [role="link"]'):null)||t,n=(e.tagName||"").toLowerCase(),o={x:s,y:r,page:window.location.pathname,element:n,clickCount:this.rageClickTracker.clicks.length,timestamp:i};e.id&&(o.elementId=e.id);const a=e.className;"string"==typeof a&&a&&(o.elementClass=a),e.textContent&&(o.elementText=e.textContent.trim().substring(0,100)),Object.keys(o).forEach(e=>{null!==o[e]&&void 0!==o[e]||delete o[e]}),await this.customEvent("$rageclick",o),this.rageJustFiredAt=i}})}isRageClick(e,t,s,r){if(this.rageJustFiredAt>0&&s-this.rageJustFiredAt<this.RAGE_CLICK_TIMEOUT_MS)return!1;if(this.rageJustFiredAt>0&&s-this.rageJustFiredAt>=this.RAGE_CLICK_TIMEOUT_MS)return this.rageJustFiredAt=0,this.rageClickTracker.clicks=[{x:e,y:t,timestamp:s,element:r}],!1;const i=this.rageClickTracker.clicks,n=i[i.length-1],o=i[0];if(o&&n&&s-n.timestamp<this.RAGE_CLICK_TIMEOUT_MS&&Math.hypot(e-o.x,t-o.y)<this.RAGE_CLICK_THRESHOLD_PX){if(i.push({x:e,y:t,timestamp:s,element:r}),i.length===this.RAGE_CLICK_CLICK_COUNT)return!0}else this.rageClickTracker.clicks=[{x:e,y:t,timestamp:s,element:r}];return!1}setupDeadClickDetection(){Yc&&(this.setupDeadClickMutationObserver(),this.setupDeadClickScrollObserver(),this.setupDeadClickSelectionObserver(),this.setupDeadClickNavigationTracking(),document.addEventListener("click",e=>{const t=e.target;if(!t||1!==t.nodeType)return;if(!this.isInteractiveElement(t))return;if(this.ignoreClickForDeadDetection(t))return;const s=Date.now()+Math.random(),r=Date.now(),i=this.deadClickTracker.lastMutationTime,n=this.DEAD_CLICK_ABSOLUTE_TIMEOUT_MS,o=window.setTimeout(()=>{this.handleDeadClickTimeout(s)},n);this.deadClickTracker.pendingClicks.set(s,{element:t,originalEvent:e,timestamp:r,timer:o,cancelled:!1,lastMutationTimeAtClick:i})}))}setupDeadClickMutationObserver(){Yc&&(this.deadClickTracker.mutationObserver||(this.deadClickTracker.mutationObserver=new MutationObserver(()=>{const e=Date.now();this.deadClickTracker.lastMutationTime=e,this.deadClickTracker.pendingClicks.forEach((t,s)=>{if(t.cancelled)return;const r=e-t.timestamp,i=t.lastMutationTimeAtClick||0,n=e>i,o=r>=0&&r<this.DEAD_CLICK_MUTATION_THRESHOLD_MS,a=r<0&&Math.abs(r)<50;(o&&n||a)&&this.cancelPendingClick(s)})}),this.deadClickTracker.mutationObserver.observe(document,{attributes:!0,characterData:!0,childList:!0,subtree:!0})))}setupDeadClickScrollObserver(){Yc&&window.addEventListener("scroll",()=>{const e=Date.now();this.deadClickTracker.pendingClicks.forEach((t,s)=>{e-t.timestamp<this.DEAD_CLICK_SCROLL_THRESHOLD_MS&&this.cancelPendingClick(s)})},{capture:!0,passive:!0})}setupDeadClickSelectionObserver(){Yc&&document.addEventListener("selectionchange",()=>{const e=Date.now();this.deadClickTracker.lastSelectionChangedTime=e,this.deadClickTracker.pendingClicks.forEach((t,s)=>{e-t.timestamp<this.DEAD_CLICK_SELECTION_THRESHOLD_MS&&this.cancelPendingClick(s)})})}setupDeadClickNavigationTracking(){if(!Yc)return;let e=window.location.href;const t=this.trackNavigationEvent.bind(this);this.trackNavigationEvent=async(s,r,i)=>(this.cancelAllPendingClicks(),e=window.location.href,t(s,r,i));const s=()=>{const t=window.location.href;t!==e&&(this.cancelAllPendingClicks(),e=t)};window.addEventListener("popstate",s),window.addEventListener("hashchange",s),window.addEventListener("beforeunload",()=>{this.cancelAllPendingClicks()}),setInterval(()=>{s()},100)}isInteractiveElement(e){if(!e||1!==e.nodeType||!e.tagName)return!1;const t=e.tagName.toLowerCase();if("button"===t||"a"===t)return!0;if("input"===t)return!1;if(["select","textarea"].includes(t))return!0;const s=e.getAttribute("role");if(s&&["button","link","tab","menuitem","checkbox","radio"].includes(s))return!0;if(e.onclick||e.getAttribute("onclick"))return!0;try{if("pointer"===window.getComputedStyle(e).cursor)return!0}catch(e){}return!!e.closest('button, a, [role="button"], [role="link"], [role="tab"], [role="menuitem"]')}ignoreClickForDeadDetection(e){if(!e||!e.tagName)return!0;if("html"===e.tagName.toLowerCase())return!0;const t=Date.now();for(const s of this.deadClickTracker.pendingClicks.values())if(s.element===e&&Math.abs(t-s.timestamp)<1e3)return!0;return!1}cancelPendingClick(e){const t=this.deadClickTracker.pendingClicks.get(e);t&&!t.cancelled&&(clearTimeout(t.timer),t.cancelled=!0,this.deadClickTracker.pendingClicks.delete(e))}cancelAllPendingClicks(){this.deadClickTracker.pendingClicks.forEach((e,t)=>{e.cancelled||(clearTimeout(e.timer),this.deadClickTracker.pendingClicks.delete(t))})}async handleDeadClickTimeout(e){const t=this.deadClickTracker.pendingClicks.get(e);if(!t||t.cancelled)return;const s=Date.now()-t.timestamp;let r;const i=t.lastMutationTimeAtClick||0,n=this.deadClickTracker.lastMutationTime||0,o=n>i&&n>=t.timestamp,a=i>0&&i<t.timestamp&&t.timestamp-i<50;let l;o?r=n-t.timestamp:a&&(r=0),this.deadClickTracker.lastSelectionChangedTime&&t.timestamp<=this.deadClickTracker.lastSelectionChangedTime&&(l=this.deadClickTracker.lastSelectionChangedTime-t.timestamp);const c=void 0!==r&&r<this.DEAD_CLICK_MUTATION_THRESHOLD_MS,h=void 0!==l&&l<this.DEAD_CLICK_SELECTION_THRESHOLD_MS;c||h||await this.fireDeadClickEvent(t,s,r,l),this.deadClickTracker.pendingClicks.delete(e)}async fireDeadClickEvent(e,t,s,r){const i=e.element.closest('button, a, [role="button"], [role="link"]')||e.element,n={x:e.originalEvent.clientX,y:e.originalEvent.clientY,page:window.location.pathname,element:i.tagName.toLowerCase(),absoluteDelayMs:t,timestamp:e.timestamp};void 0!==s&&(n.mutationDelayMs=s),void 0!==r&&(n.selectionChangedDelayMs=r),i.id&&(n.elementId=i.id),i.className&&(n.elementClass=i.className),i.textContent&&(n.elementText=i.textContent.trim().substring(0,100)),Object.keys(n).forEach(e=>{null!==n[e]&&void 0!==n[e]||delete n[e]}),await this.customEvent("$deadclick",n)}setupAutomaticLinkTracking(e){}setupAutomaticFormTracking(e){document.addEventListener("submit",async t=>{const s=t.target,r=new FormData(s),i={formId:s.id||null,formAction:s.action||null,formMethod:s.method||"get",fields:Array.from(r.keys()),page:window.location.pathname,timestamp:Date.now()};e.includeClasses&&(i.formClass=s.className||null),Object.keys(i).forEach(e=>{null===i[e]&&delete i[e]}),await this.customEvent("$form_submitted",i)})}cleanupNavigationTracking(){this.navigationTrackingEnabled&&(this.originalPushState&&(history.pushState=this.originalPushState),this.originalReplaceState&&(history.replaceState=this.originalReplaceState),this.navigationListeners.forEach(e=>e()),this.navigationListeners=[],this.navigationTrackingEnabled=!1,_c("Navigation tracking cleaned up"))}static logToStorage(e){xc(e)}static configureLogging(e){Cc.setConfig({level:{none:0,error:1,warn:2,info:3,debug:4}[e.level||"error"],enableConsole:!1!==e.enableConsole,enableStorage:e.enableStorage||!1})}enableConsoleTracking(){Yc&&!this.consoleTrackingEnabled&&(this.originalConsole={log:console.log,warn:console.warn,error:console.error},console.log=(...e)=>{this.trackConsoleEvent("log",e),this.originalConsole.log(...e)},console.warn=(...e)=>{this.trackConsoleEvent("warn",e),this.originalConsole.warn(...e)},console.error=(...e)=>{this.trackConsoleEvent("error",e),this.originalConsole.error(...e)},this.consoleTrackingEnabled=!0,_c("Console tracking enabled"))}enableNetworkTracking(){Yc&&!this.networkTrackingEnabled&&"undefined"!=typeof fetch&&(this.originalFetch=window.fetch.bind(window),window.fetch=async(e,t)=>{const s=Date.now(),r=Sc(),i="string"==typeof e?e:e instanceof URL?e.toString():e.url,n=(t?.method||("object"==typeof e&&"method"in e?e.method:void 0)||"GET").toUpperCase(),o=this.shouldSkipNetworkTracking(i);let a=null,l=!1;o||(a=setTimeout(()=>{const e=Date.now()-s;if(!l){l=!0;const t={requestId:r,url:i,method:n,status:null,statusText:null,duration:e,timestampMs:Date.now(),sessionId:this.sessionId,endUserId:this.endUserId,errorType:"long_loading",errorMessage:`Request took longer than 10000ms (${e}ms elapsed)`,startTimeMs:s,spanName:`${n} ${i}`,spanStatus:"slow",attributes:{"http.method":n,"http.url":i,"request.duration_ms":e,"request.long_loading_threshold_ms":1e4},automaticProperties:this.propertyManager.getAutomaticProperties()};return this.shouldSkipDueToMinimumDuration()?(_c("Long-loading network error queued due to session duration below minimum"),void this.pendingNetworkErrors.push({errorData:t,timestamp:Date.now()})):(this.flushPendingNetworkErrors(),void this.api.sendNetworkError(t).catch(()=>{}))}},1e4));try{const l=await this.originalFetch(e,t),c=Date.now()-s;if(a&&clearTimeout(a),!l.ok&&!o){const e={requestId:r,url:i,method:n,status:l.status,statusText:l.statusText,duration:c,timestampMs:Date.now(),sessionId:this.sessionId,endUserId:this.endUserId,errorType:this.classifyHttpError(l.status),errorMessage:l.statusText,startTimeMs:s,spanName:`${n} ${i}`,spanStatus:"error",attributes:{"http.status_code":l.status,"http.status_text":l.statusText},automaticProperties:this.propertyManager.getAutomaticProperties()};if(this.shouldSkipDueToMinimumDuration())return _c("Failed request network error queued due to session duration below minimum"),this.pendingNetworkErrors.push({errorData:e,timestamp:Date.now()}),l;this.flushPendingNetworkErrors(),this.api.sendNetworkError(e).catch(()=>{})}return l}catch(e){const t=Date.now()-s;if(a&&clearTimeout(a),!o){const o={requestId:r,url:i,method:n,status:null,statusText:null,duration:t,timestampMs:Date.now(),sessionId:this.sessionId,endUserId:this.endUserId,errorType:this.classifyNetworkError(e),errorMessage:e.message,errorName:e.name,startTimeMs:s,spanName:`${n} ${i}`,spanStatus:"error",attributes:{"error.name":e.name,"error.message":e.message},automaticProperties:this.propertyManager.getAutomaticProperties()};if(this.shouldSkipDueToMinimumDuration())throw _c("Network error queued due to session duration below minimum"),this.pendingNetworkErrors.push({errorData:o,timestamp:Date.now()}),e;this.flushPendingNetworkErrors(),this.api.sendNetworkError(o).catch(()=>{})}throw e}},this.networkTrackingEnabled=!0,_c("Network tracking enabled"))}async flushPendingCustomEvents(){if(0===this.pendingCustomEvents.length)return;const e=[...this.pendingCustomEvents];this.pendingCustomEvents=[],_c(`Flushing ${e.length} pending custom events`);for(const{eventName:t,properties:s}of e)this.queueCustomEvent(t,s)}async flushPendingLogs(){if(0===this.pendingLogs.length)return;const e=[...this.pendingLogs];this.pendingLogs=[],_c(`Flushing ${e.length} pending logs`);for(const{logData:t}of e)try{await this.api.sendLog(t)}catch(e){Ec("Failed to flush pending log:",e)}}async flushPendingNetworkErrors(){if(0===this.pendingNetworkErrors.length)return;const e=[...this.pendingNetworkErrors];this.pendingNetworkErrors=[],_c(`Flushing ${e.length} pending network errors`);for(const{errorData:t}of e)try{await this.api.sendNetworkError(t)}catch(e){Ec("Failed to flush pending network error:",e)}}enablePageLoadTracking(){Yc&&"undefined"!=typeof window&&("complete"===document.readyState?this.trackPageLoad():window.addEventListener("load",()=>{this.trackPageLoad()}),_c("Page load tracking enabled"))}trackPageLoad(){if(Yc&&"undefined"!=typeof performance)try{const e=performance.getEntriesByType("navigation")[0];if(!e)return;const t=e.loadEventEnd-e.fetchStart;if(t>3e3){const s=Sc(),r=e.domContentLoadedEventEnd-e.fetchStart,i=e.domComplete-e.fetchStart,n={requestId:s,url:window.location.href,method:"GET",status:200,statusText:"OK",duration:t,timestampMs:e.loadEventEnd+performance.timeOrigin,sessionId:this.sessionId,endUserId:this.endUserId,errorType:"slow_page_load",errorMessage:`Page load took ${t}ms`,startTimeMs:e.fetchStart+performance.timeOrigin,spanName:"page_load",spanStatus:"slow",attributes:{"page.url":window.location.href,"page.load_time":t,"page.dom_content_loaded":r,"page.dom_complete":i}};if(this.shouldSkipDueToMinimumDuration())return _c("Slow page load network error queued due to session duration below minimum"),void this.pendingNetworkErrors.push({errorData:n,timestamp:Date.now()});this.flushPendingNetworkErrors(),this.api.sendNetworkError(n).catch(()=>{})}}catch(e){Tc("Failed to track page load:",e)}}shouldSkipNetworkTracking(e){if(!e||!this.ingestionUrl)return!1;try{const t=new URL(e),s=new URL(this.ingestionUrl);return!(t.origin!==s.origin||!t.pathname.startsWith("/api/ingestion/"))||!!e.includes(this.ingestionUrl)}catch(t){return e.includes(this.ingestionUrl)}}classifyHttpError(e){return e>=400&&e<500?"client_error":e>=500?"server_error":"unknown_error"}classifyNetworkError(e){const t=e.message||"",s=e.name||"";return t.includes("blocked")||t.includes("ERR_BLOCKED_BY_CLIENT")||t.includes("net::ERR_BLOCKED_BY_CLIENT")||"TypeError"===s&&t.includes("Failed to fetch")?"blocked_by_client":t.includes("CORS")||t.includes("Cross-Origin")||t.includes("Access-Control-Allow-Origin")||"TypeError"===s&&t.includes("CORS")?"cors_error":t.includes("timeout")||t.includes("TIMEOUT")||t.includes("NetworkError")||"NetworkError"===s?"network_error":t.includes("abort")||"AbortError"===s?"aborted":"unknown_error"}disableConsoleTracking(){Yc&&this.consoleTrackingEnabled&&(this.originalConsole&&(console.log=this.originalConsole.log,console.warn=this.originalConsole.warn,console.error=this.originalConsole.error),this.consoleTrackingEnabled=!1,_c("Console tracking disabled"))}trackConsoleEvent(e,t){if(this.initialized)if("log"!==e)try{if(Ic())return void(this.originalConsole&&this.originalConsole[e](...t));const s=(new Error).stack||"";if(this.isSDKStackFrame(s))return void(this.originalConsole&&this.originalConsole[e](...t));const r={level:e,message:t.map(e=>"object"==typeof e?JSON.stringify(e):String(e)).join(" "),timestampMs:Date.now(),url:Yc?window.location.href:"",userAgent:Yc?navigator.userAgent:"",stack:s,sessionId:this.sessionId,endUserId:this.endUserId,automaticProperties:this.propertyManager.getAutomaticProperties()};if(this.shouldSkipDueToMinimumDuration())return _c(`Console ${e} queued due to session duration below minimum`),void this.pendingLogs.push({logData:r,timestamp:Date.now()});this.flushPendingLogs(),this.api.sendLog(r).catch(e=>{this.addEvent({type:5,data:{payload:{eventType:"console",...r}},timestamp:Date.now()}).catch(()=>{})})}catch(e){Ec("Error in trackConsoleEvent:",e)}else this.originalConsole&&this.originalConsole.log(...t)}isSDKStackFrame(e){if(!e)return!1;const t=["humanbehavior-js","@humanbehavior/core","@humanbehavior/browser","tracker.ts","api.ts","logger.ts","utils/logger","packages/core","packages/browser","index.mjs","index.js"],s=e.split("\n");e.toLowerCase();let r=!1;for(let e=0;e<s.length;e++){const i=s[e].trim().toLowerCase();if(i&&"error"!==i&&!i.startsWith("error:")&&!t.some(e=>i.includes(e.toLowerCase()))){r=!0;break}}return!r}setupPageUnloadHandler(){if(!Yc)return;const e="__humanBehaviorUnloadAttached";if(window[e])return _c("Page unload handlers already attached on window β€” skipping re-attach"),void(window.__humanBehaviorActiveTracker=this);window[e]=!0,window.__humanBehaviorActiveTracker=this,_c("Setting up page unload handler"),window.addEventListener("visibilitychange",()=>{const e="hidden"===document.visibilityState?"hidden":"visible";this.emitVisibilityMarker(e),"hidden"===document.visibilityState?(_c("Page hidden - sending pending events"),this.flushEvents()):"visible"===document.visibilityState&&(_c("Page visible - taking full snapshot for multi-window replay"),this.takeFullSnapshot())}),this.setupWindowFocusTracking();const t="onpagehide"in window?"pagehide":"beforeunload";window.addEventListener(t,()=>{_c("Page unloading - sending final events via sendBeacon");let e=!1;const t=()=>{if(!e){e=!0;try{this.api?.sendSessionEndBeacon(this.sessionId,this.endUserId)}catch{}}};try{if(this.customEventBatch.length>0){null!=this.customEventBatchTimer&&(clearTimeout(this.customEventBatchTimer),this.customEventBatchTimer=null);const e=this.customEventBatch;this.customEventBatch=[];const t=this.api?.sendCustomEventBatchBeacon(this.sessionId,e,this.endUserId);t||this.api?.sendCustomEventBatch(this.sessionId,e,this.endUserId).catch(()=>{})}}catch{}const s=this.minimumDurationMilliseconds,r=this.getSessionDuration();if(null!==r&&r>=0&&r<s)return _c(`Session duration (${r}ms) below minimum (${s}ms), not sending on unload`),void t();const i=[...this.eventQueue];if(Yc&&window.__hb_pending_snapshots){const e=window.__hb_pending_snapshots;Array.isArray(e)&&e.length>0&&(_c("Including pending FullSnapshot(s) in sendBeacon for short session"),i.unshift(...e),delete window.__hb_pending_snapshots)}if(i.length>0&&this.api)try{const e=this.propertyManager.getAutomaticProperties();this.api.sendBeaconEvents(i,this.sessionId,this.endUserId||void 0,this.windowId,e),this.eventQueue=[]}catch(e){Tc("Failed to send events via sendBeacon on unload:",e)}this.api&&this.api.unload(),t()});const s=()=>{localStorage.setItem("human_behavior_last_activity",Date.now().toString())};window.addEventListener("click",s),window.addEventListener("keydown",s),window.addEventListener("scroll",s),window.addEventListener("mousemove",s)}viewLogs(){try{const e=Cc.getLogs();xc("HumanBehavior Logs:",e),Cc.clearLogs()}catch(e){Ec("Failed to read logs:",e)}}async identifyUser(e){const t=e?.userProperties&&"object"==typeof e.userProperties?e.userProperties:e||{},s=this.endUserId;this.userProperties={...this.userProperties,...t};try{this.propertyManager?.setUserProperties(t)}catch{}_c("Identifying user:",{userProperties:t,originalEndUserId:s,sessionId:this.sessionId}),!Yc||this.propertyManager.getAutomaticProperties();const r=await this.api.sendUserData(s||"",t,this.sessionId);if(r.actualUserId||r.wasExistingUser){const t=r.actualUserId||s;if(t&&t!==s){const r="human_behavior_end_user_id";if(this.setCookie(r,t,365),Yc)try{localStorage.setItem(r,t)}catch(e){_c("Failed to set canonical endUserId in localStorage:",e)}_c(`πŸ”— Preexisting user detected. Future sessions will use canonical ID: ${t} (current session stays: ${s})`)}}return s||""}getUserAttributes(){return{...(()=>{try{return this.propertyManager?.getAllProperties().user||{}}catch{return{}}})(),...this.userProperties}}async start(){if(!Yc)return;if(this.isStarted)return void _c("HumanBehaviorTracker already started, skipping start() call.");this.isStarted=!0,this._lastActivityTimestamp=null!==this._sessionActivityTimestamp?this._sessionActivityTimestamp:Date.now(),this._isIdle="unknown",this.flushInterval=window.setInterval(()=>{this.flushEvents()},this.FLUSH_INTERVAL_MS),this.heartbeatInterval=window.setInterval(()=>{try{if("undefined"!=typeof document&&"visible"!==document.visibilityState)return;if(!this.sessionId||!this.api)return;this.api.sendHeartbeatBeacon(this.sessionId,this.endUserId)}catch{}},this.HEARTBEAT_INTERVAL_MS),this.enableConsoleTrackingFlag&&this.enableConsoleTracking(),this.enableNetworkTrackingFlag&&this.enableNetworkTracking(),this.enablePageLoadTracking(),this.api.sendIpInfo(this.sessionId,this.endUserId);const e=()=>{if(this.recordInstance)return void _c("🎯 Recording already started, skipping duplicate start");_c("🎯 DOM ready, starting session recording"),this.rrwebRecord=pc;const e=pc({emit:e=>{this.addRecordingEvent(e),2===e.type&&_c(`🎯 FullSnapshot generated at ${(new Date).toISOString()}`)},maskTextSelector:this.redactionManager.getMaskTextSelector()||void 0,maskTextFn:void 0,maskAllInputs:"privacy-first"===this.redactionManager.getRedactionMode(),maskInputOptions:{password:!0,text:!0,textarea:!0,email:!0,number:!0,tel:!0,url:!0,search:!0,date:!0,time:!0,month:!0,week:!0},maskInputFn:(e,t)=>{try{const s=this.redactionManager.getRedactionMode();if(!(t instanceof HTMLElement))return e;if("privacy-first"===s)return"*".repeat(e.length||1);const r=this.redactionManager.shouldUnredactElement(t);return t.id,t.name,t.type,r?e:"*".repeat(e.length||1)}catch{return e}},slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1,recordCanvas:this.recordCanvas,sampling:this.recordCanvas?{canvas:4}:void 0,dataURLOptions:this.recordCanvas?{type:"image/webp",quality:.4}:void 0,hooks:{input:e=>{try{if("privacy-first"===this.redactionManager.getRedactionMode())return;const t="undefined"!=typeof document?document.querySelector(`[data-rrweb-id="${e.id}"]`):null;t&&t instanceof HTMLElement&&(this.redactionManager.shouldUnredactElement(t)||(void 0!==e.text&&(e.text="*".repeat(e.text?.length||1)),void 0!==e.value&&(e.value="*".repeat(e.value?.length||1))))}catch{}}}});this.recordInstance=e||null};if(_c(`🎯 DOM ready state: ${document.readyState}`),"complete"===document.readyState||"interactive"===document.readyState)_c(`🎯 DOM ready (${document.readyState}), starting recording immediately`),e();else{_c("🎯 DOM not ready, waiting for DOMContentLoaded event");const t=()=>("interactive"===document.readyState||"complete"===document.readyState)&&(_c(`🎯 DOM ready (${document.readyState}), starting recording`),e(),!0);if(t())return;document.addEventListener("DOMContentLoaded",()=>{_c("🎯 DOMContentLoaded fired, starting recording"),e()},{once:!0});const s=setInterval(()=>{t()&&clearInterval(s)},10);setTimeout(()=>clearInterval(s),5e3)}}emitVisibilityMarker(e){try{const t={type:5,data:{tag:"$visibility",payload:{state:e}},timestamp:Date.now()};this.eventQueue.push(t)}catch{}}emitFocusMarker(e){try{const t={type:5,data:{tag:"$focus",payload:{state:e}},timestamp:Date.now()};this.eventQueue.push(t)}catch{}}setupWindowFocusTracking(){if(Yc){try{"function"!=typeof document.hasFocus||document.hasFocus()||(this.emitFocusMarker("blurred"),this.lastEmittedFocusState="blurred")}catch{}window.addEventListener("blur",()=>this.onWindowBlur(),!1),window.addEventListener("focus",()=>this.onWindowFocus(),!1)}}onWindowBlur(){Yc&&(null!==this.focusBlurGraceTimeout&&clearTimeout(this.focusBlurGraceTimeout),this.focusBlurGraceTimeout=window.setTimeout(()=>{this.focusBlurGraceTimeout=null;try{if("function"==typeof document.hasFocus&&document.hasFocus())return;if("blurred"===this.lastEmittedFocusState)return;this.emitFocusMarker("blurred"),this.lastEmittedFocusState="blurred"}catch{}},this.FOCUS_BLUR_GRACE_MS))}onWindowFocus(){if(Yc&&(null!==this.focusBlurGraceTimeout&&(clearTimeout(this.focusBlurGraceTimeout),this.focusBlurGraceTimeout=null),"blurred"===this.lastEmittedFocusState))try{this.emitFocusMarker("focused"),this.lastEmittedFocusState="focused"}catch{}}takeFullSnapshot(){this.fullSnapshotTimeout&&clearTimeout(this.fullSnapshotTimeout),this.fullSnapshotTimeout=window.setTimeout(()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{try{this.rrwebRecord&&"function"==typeof this.rrwebRecord.takeFullSnapshot?(this.rrwebRecord.takeFullSnapshot(),_c("βœ… FullSnapshot taken (delayed for animations)")):Tc("⚠️ takeFullSnapshot not available on record function")}catch(e){Ec("❌ Failed to take FullSnapshot:",e)}})})},1e3)}async stop(){await this.ensureInitialized(),Yc&&(this.flushInterval&&(clearInterval(this.flushInterval),this.flushInterval=null),this.heartbeatInterval&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null),this.recordInstance&&(this.recordInstance(),this.recordInstance=null),this.fullSnapshotTimeout&&(clearTimeout(this.fullSnapshotTimeout),this.fullSnapshotTimeout=null),null!==this.focusBlurGraceTimeout&&(clearTimeout(this.focusBlurGraceTimeout),this.focusBlurGraceTimeout=null),this.rrwebRecord=null,this.disableConsoleTracking(),this.cleanupNavigationTracking(),this.deadClickTracker.mutationObserver&&(this.deadClickTracker.mutationObserver.disconnect(),this.deadClickTracker.mutationObserver=void 0),this.deadClickTracker.pendingClicks.forEach((e,t)=>{e.cancelled||clearTimeout(e.timer)}),this.deadClickTracker.pendingClicks.clear())}async addEvent(e){if(Yc&&this.checkAndRefreshSession(),e&&"object"==typeof e){if(2===e.type){const t=!!e.data,s=!(!e.data||!e.data.node);_c(t&&s?`βœ… Valid FullSnapshot: hasData=${t}, hasNode=${s}, dataType=${e.data?.node?.type}`:`⚠️ Empty FullSnapshot detected: hasData=${t}, hasNode=${s} - continuing session`)}this.eventQueue.length>=this.MAX_QUEUE_SIZE&&(this.eventQueue.shift(),_c("Queue is full, the oldest event is dropped.")),this.eventQueue.push(e),2===e.type?(_c("FullSnapshot added, triggering immediate flush"),this.flushEvents()):this.eventQueue.length>=.8*this.MAX_QUEUE_SIZE&&(_c(`Queue at ${this.eventQueue.length}/${this.MAX_QUEUE_SIZE}, triggering immediate flush`),this.flushEvents())}else _c("⚠️ Skipping invalid event:",e)}getSessionDuration(){const e=this._sessionStartTimestamp??this.sessionStartTime;if(!e)return null;const t=this.eventQueue.filter(e=>e&&e.timestamp);if(0===t.length)return null;const s=t.reduce((e,t)=>!e||t.timestamp&&t.timestamp>e.timestamp?t:e,null);if(!s||!s.timestamp)return null;const r=s.timestamp-e;return r>=0?r:null}shouldSkipDueToMinimumDuration(){const e=this.minimumDurationMilliseconds,t=this.getSessionDuration();return!!(null!==t&&t>=0&&t<e)&&(_c(`Session duration (${t}ms) below minimum (${e}ms), skipping send`),!0)}async flushEvents(){if(this.isProcessing)return;if(this.monthlyLimitReached)return;if(!0===this._isIdle&&0===this.eventQueue.length)return;const e=this.minimumDurationMilliseconds,t=this.getSessionDuration();if(null!==t&&t>=0&&t<e)return _c(`Session duration (${t}ms) below minimum (${e}ms), buffering`),void setTimeout(()=>{this.flushEvents()},2e3);this.isProcessing=!0;try{const t=this.eventQueue,s=t.filter(e=>e&&2===e.type);if(this.eventQueue=[],s.length>0&&Yc&&(window.__hb_pending_snapshots=s,setTimeout(()=>{delete window.__hb_pending_snapshots},5e3)),t.length>0){_c("Flushing events:",t);const s=t.filter(e=>2===e.type);s.length>0&&_c(`[FIXED] Sending ${s.length} FullSnapshot(s) with valid data`);try{const e=this.propertyManager.getAutomaticProperties();await this.api.sendEventsChunked(t,this.sessionId,this.endUserId,this.windowId,e)}catch(e){if(e.message?.includes("ERROR: Session already completed"))Tc("Session expired, events will be lost");else if(e.message?.includes("413")||e.message?.includes("Content Too Large"))Tc("Payload too large, events will be lost");else{if(!(e.message?.includes("ERR_BLOCKED_BY_CLIENT")||e.message?.includes("Failed to fetch")||e.message?.includes("NetworkError")))throw e;Tc("Request blocked by ad blocker or network issue, events will be lost")}}}await this.flushPendingCustomEvents(),await this.flushPendingLogs(),await this.flushPendingNetworkErrors()}finally{this.isProcessing=!1}}isInteractiveEvent(e){if(3!==e.type)return!1;const t=e.data?.source;return[1,2,3,4,5,6,11].includes(t)}updateIdleState(e){const t=this.isInteractiveEvent(e),s=e.timestamp||Date.now();if(t){const e=!0===this._isIdle;this._lastActivityTimestamp=s,null!==this._sessionActivityTimestamp&&(this._sessionActivityTimestamp=s),e?(_c("βœ… User activity detected, exiting idle state"),this._isIdle=!1,this.rrwebRecord&&"function"==typeof this.rrwebRecord.takeFullSnapshot&&(this.rrwebRecord.takeFullSnapshot(),_c("βœ… FullSnapshot taken after returning from idle"))):"unknown"===this._isIdle&&(this._isIdle=!1)}else if(!0!==this._isIdle){const e=s-this._lastActivityTimestamp;e>this.IDLE_THRESHOLD_MS&&(_c(`⏸️ Session idle detected (${Math.round(e/1e3)}s since last activity) - stopping background event recording`),_c(`ℹ️ Session will expire after ${Math.round(this.SESSION_IDLE_TIMEOUT_MS/6e4)} minutes of inactivity (${Math.round((this.SESSION_IDLE_TIMEOUT_MS-e)/1e3)}s remaining)`),this._isIdle=!0,this.flushEvents())}}async addRecordingEvent(e){if(Yc&&this.checkAndRefreshSession(),e&&"object"==typeof e){if(this.updateIdleState(e),!0!==this._isIdle||3!==e.type||this.isInteractiveEvent(e)){if(2===e.type){const t=!!e.data,s=!(!e.data||!e.data.node);_c(t&&s?`βœ… Valid FullSnapshot: hasData=${t}, hasNode=${s}, dataType=${e.data?.node?.type}`:`⚠️ Empty FullSnapshot detected: hasData=${t}, hasNode=${s} - continuing session`)}this.eventQueue.length>=this.MAX_QUEUE_SIZE&&(this.eventQueue.shift(),_c("Queue is full, the oldest event is dropped.")),this.eventQueue.push(e),2===e.type?(_c("FullSnapshot added, triggering immediate flush"),this.flushEvents()):!0!==this._isIdle&&this.eventQueue.length>=.8*this.MAX_QUEUE_SIZE&&(_c(`Queue at ${this.eventQueue.length}/${this.MAX_QUEUE_SIZE}, triggering immediate flush`),this.flushEvents())}}else _c("⚠️ Skipping invalid recording event:",e)}_canUseSessionStorage(){if(!Yc)return!1;try{const e="__sessionStorage_test__";return sessionStorage.setItem(e,e),sessionStorage.removeItem(e),!0}catch{return!1}}_getWindowIdFromStorage(){if(!this._canUseSessionStorage())return null;try{return sessionStorage.getItem(this._window_id_storage_key)}catch{return null}}_setWindowIdInStorage(e){if(this._canUseSessionStorage())try{sessionStorage.setItem(this._window_id_storage_key,e),_c(`Stored windowId in sessionStorage: ${e}`)}catch(e){Tc("Failed to store windowId in sessionStorage:",e)}}_removeWindowIdFromStorage(){if(this._canUseSessionStorage())try{sessionStorage.removeItem(this._window_id_storage_key)}catch(e){Tc("Failed to remove windowId from sessionStorage:",e)}}_getPrimaryWindowExists(){if(!this._canUseSessionStorage())return!1;try{return"true"===sessionStorage.getItem(this._primary_window_exists_storage_key)}catch{return!1}}_setPrimaryWindowExists(e){if(this._canUseSessionStorage())try{e?sessionStorage.setItem(this._primary_window_exists_storage_key,"true"):sessionStorage.removeItem(this._primary_window_exists_storage_key)}catch(e){Tc("Failed to set primary_window_exists flag:",e)}}getOrCreateWindowId(){if(!Yc)return Sc();const e=this._getWindowIdFromStorage(),t=this._getPrimaryWindowExists();if(e&&!t)return _c(`Reusing windowId from previous page load: ${e}`),this._setWindowIdInStorage(e),this._setPrimaryWindowExists(!0),e;{const e=Sc();return _c(`Creating new windowId: ${e} (new window/tab detected)`),this._setWindowIdInStorage(e),this._setPrimaryWindowExists(!0),e}}setupWindowUnloadListener(){Yc&&window.addEventListener("beforeunload",()=>{this._canUseSessionStorage()&&(this._setPrimaryWindowExists(!1),_c("Cleared primary_window_exists flag on beforeunload"))},{capture:!1})}setCookie(e,t,s){if(Yc)try{const r=new Date;r.setTime(r.getTime()+24*s*60*60*1e3);const i=`expires=${r.toUTCString()}`;document.cookie=`${e}=${t};${i};path=/;SameSite=Lax`,localStorage.setItem(e,t),_c(`Set cookie and localStorage: ${e}`)}catch(s){try{localStorage.setItem(e,t),_c(`Cookie blocked, using localStorage: ${e}`)}catch(e){Ec("Failed to store user ID in both cookie and localStorage:",e)}}}getCookie(e){if(!Yc)return null;try{const t=e+"=",s=document.cookie.split(";");for(let r=0;r<s.length;r++){let i=s[r];for(;" "===i.charAt(0);)i=i.substring(1,i.length);if(0===i.indexOf(t)){const s=i.substring(t.length,i.length);return _c(`Found cookie: ${e}`),s}}const r=localStorage.getItem(e);return r?(_c(`Cookie not found, using localStorage: ${e}`),r):null}catch(t){try{const t=localStorage.getItem(e);if(t)return _c(`Cookie access failed, using localStorage: ${e}`),t}catch(e){Ec("Failed to access both cookie and localStorage:",e)}return null}}deleteCookie(e){if(Yc){try{document.cookie=`${e}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/; SameSite=Lax`,_c(`Deleted cookie: ${e}`)}catch(t){Ec(`Failed to delete cookie: ${e}`,t)}try{localStorage.removeItem(e),_c(`Removed from localStorage: ${e}`)}catch(t){Ec(`Failed to remove from localStorage: ${e}`,t)}}}logout(){if(Yc)try{const e="human_behavior_end_user_id";this.deleteCookie(e);const t="human_behavior_session";localStorage.removeItem(t),this.endUserId=null,this.userProperties={},this.endUserId=Sc(),this.setCookie("human_behavior_end_user_id",this.endUserId,365),this.sessionId=this.createNewSession(t),this.windowId=Sc(),this._setWindowIdInStorage(this.windowId),this.api.setTrackingContext(this.sessionId,this.endUserId),this.takeFullSnapshot(),xc("User logged out - cleared all user data and started fresh session")}catch(e){Ec("Error during logout:",e)}}async redact(e){await this.ensureInitialized(),Yc?this.redactionManager=new Uc(e):Tc("Redaction is only available in browser environments")}setRedactedFields(e){this.redactionManager.setFieldsToRedact(e),this.recordInstance&&this.restartWithNewRedaction()}setUnredactedFields(e){this.redactionManager.setFieldsToUnredact(e),this.recordInstance&&this.restartWithNewRedaction()}restartWithNewRedaction(){this.recordInstance&&(this.recordInstance(),this.start())}hasUnredactedFields(){return this.redactionManager.hasUnredactedFields()}getUnredactedFields(){return this.redactionManager.getUnredactedFields()}redactFields(e){this.redactionManager.redactFields(e),this.recordInstance&&this.restartWithNewRedaction()}clearUnredactedFields(){this.redactionManager.clearUnredactedFields(),this.recordInstance&&this.restartWithNewRedaction()}checkAndRefreshSession(){if(!Yc)return;const e="human_behavior_session",t=Date.now(),s=this.getStoredSession(e);if(!s||!s.sessionId)return this.createNewSession(e),this.windowId=Sc(),this._setWindowIdInStorage(this.windowId),this.api.setTrackingContext(this.sessionId,this.endUserId),this.takeFullSnapshot(),void _c(`Created new session (no stored session): ${this.sessionId}`);this.updateSessionActivity(e,t,s.sessionId,s.sessionStartTimestamp)}getOrCreateSessionId(){if(!Yc)return Sc();const e="human_behavior_session",t=Date.now(),s=this.getStoredSession(e);if(!s||!s.sessionId){const t=this.createNewSession(e);return this.api.setTrackingContext(t,this.endUserId),t}const r=t-s.lastActivityTimestamp,i=t-s.sessionStartTimestamp;if(r>this.SESSION_IDLE_TIMEOUT_MS||i>this.SESSION_MAX_LENGTH_MS){_c(`Session expired: idle=${r}ms, age=${i}ms`);const t=this.createNewSession(e);return this.api.setTrackingContext(t,this.endUserId),t}return this.updateSessionActivity(e,t,s.sessionId,s.sessionStartTimestamp),s.sessionId}getStoredSession(e){const t=Date.now(),s=this.SESSION_IDLE_TIMEOUT_MS,r=this.SESSION_MAX_LENGTH_MS;if(this.sessionId&&null!==this._sessionActivityTimestamp&&null!==this._sessionStartTimestamp){const i=t-this._sessionActivityTimestamp,n=t-this._sessionStartTimestamp;if(!(i>s||n>r))return{sessionId:this.sessionId,lastActivityTimestamp:this._sessionActivityTimestamp,sessionStartTimestamp:this._sessionStartTimestamp};{_c("Session in memory expired: creating new session immediately");const t=this.sessionId;if(this.createNewSession(e),this.windowId=Sc(),this._setWindowIdInStorage(this.windowId),this.api.setTrackingContext(this.sessionId,this.endUserId),this.takeFullSnapshot(),xc(`πŸ”„ Session timeout (memory): Created new session ${this.sessionId} (previous: ${t})`),null!==this._sessionActivityTimestamp&&null!==this._sessionStartTimestamp)return{sessionId:this.sessionId,lastActivityTimestamp:this._sessionActivityTimestamp,sessionStartTimestamp:this._sessionStartTimestamp}}}try{const i=localStorage.getItem(e);if(!i)return null;const n=JSON.parse(i),o=t-n.lastActivityTimestamp,a=t-n.sessionStartTimestamp;if(o>s||a>r){_c(`Session in localStorage expired: idle=${Math.round(o/1e3/60)}min, age=${Math.round(a/1e3/60/60)}hrs`);const t=n.sessionId;if(this.createNewSession(e),this.windowId=Sc(),this._setWindowIdInStorage(this.windowId),this.api.setTrackingContext(this.sessionId,this.endUserId),this.takeFullSnapshot(),xc(`πŸ”„ Session timeout (localStorage): Created new session ${this.sessionId} (previous: ${t})`),null!==this._sessionActivityTimestamp&&null!==this._sessionStartTimestamp)return{sessionId:this.sessionId,lastActivityTimestamp:this._sessionActivityTimestamp,sessionStartTimestamp:this._sessionStartTimestamp}}return n.sessionId&&(this.sessionId=n.sessionId,this._sessionActivityTimestamp=n.lastActivityTimestamp,this._sessionStartTimestamp=n.sessionStartTimestamp),n}catch{return null}}createNewSession(e){const t=Sc(),s=Date.now();this.sessionId=t,this._sessionActivityTimestamp=s,this._sessionStartTimestamp=s,this._lastActivityTimestamp=s;const r={sessionId:t,lastActivityTimestamp:s,sessionStartTimestamp:s};try{localStorage.setItem(e,JSON.stringify(r))}catch(e){Tc(`Failed to save session to localStorage: ${e}`)}return _c(`Created new session: ${t}`),t}updateSessionActivity(e,t,s,r){this.sessionId=s,this._sessionActivityTimestamp=t,this._sessionStartTimestamp=r;const i={sessionId:s,lastActivityTimestamp:t,sessionStartTimestamp:r};try{localStorage.setItem(e,JSON.stringify(i))}catch(e){Tc(`Failed to update session in localStorage: ${e}`)}}getSessionId(){return this.sessionId}getCurrentUrl(){return Yc&&"undefined"!=typeof window&&window.location?window.location.href:this.currentUrl}getSnapshotFrequencyInfo(){return{sessionDuration:Date.now()-this.sessionStartTime,currentInterval:3e5,currentThreshold:1e3,phase:"configured"}}async testConnection(){try{return await this.api.init(this.sessionId,this.endUserId),{success:!0}}catch(e){return{success:!1,error:e.message||"Unknown error"}}}getConnectionStatus(){const e=[];let t=!1;return this.eventQueue.length>0&&(t=!0,e.push("Some requests may be blocked by ad blockers")),this._connectionBlocked&&(t=!0,e.push("Initial connection test failed - ad blocker may be active")),"undefined"==typeof window&&e.push("Not running in browser environment"),void 0===navigator.sendBeacon&&e.push("sendBeacon not available, using fetch fallback"),{blocked:t,recommendations:e}}isPreexistingUser(){if(!Yc)return!1;const e=this.getCookie("human_behavior_end_user_id");return null!==e&&e!==this.endUserId}getUserInfo(){return{endUserId:this.endUserId,sessionId:this.sessionId,isPreexistingUser:this.isPreexistingUser(),initialized:this.initialized}}setSessionProperty(e,t){this.propertyManager.setSessionProperty(e,t)}setSessionProperties(e){this.propertyManager.setSessionProperties(e)}getSessionProperty(e){return this.propertyManager.getSessionProperty(e)}removeSessionProperty(e){this.propertyManager.removeSessionProperty(e)}setUserProperty(e,t){this.propertyManager.setUserProperty(e,t)}setUserProperties(e){this.propertyManager.setUserProperties(e)}getUserProperty(e){return this.propertyManager.getUserProperty(e)}removeUserProperty(e){this.propertyManager.removeUserProperty(e)}setOnce(e,t,s="user"){this.propertyManager.setOnce(e,t,s)}clearSessionProperties(){this.propertyManager.clearSessionProperties()}clearUserProperties(){this.propertyManager.clearUserProperties()}getAllProperties(){return this.propertyManager.getAllProperties()}}Yc&&(window.HumanBehaviorTracker=Zc);const qc=(e,t,s)=>new Zc(e,t,s);"undefined"!=typeof window&&(window.HumanBehaviorTracker=Zc,window.humanbehavior={init:qc}),e.HumanBehaviorAPI=Fc,e.HumanBehaviorTracker=Zc,e.PropertyManager=Hc,e.RedactionManager=Uc,e.getAutomaticProperties=Kc,e.getCurrentPageProperties=Vc,e.getDeviceInfo=jc,e.getInitialProperties=Gc,e.getLocationInfo=Wc,e.identifyUserGlobally=function(e){const t=globalThis.__humanBehaviorGlobalTracker;return t?.identifyUser?t.identifyUser({userProperties:e}):(console.warn("HumanBehavior tracker not found. Make sure the SDK is initialized."),null)},e.init=qc,e.isGlobalTrackerAvailable=function(){const e=globalThis.__humanBehaviorGlobalTracker;return!!e?.identifyUser},e.isSDKLogging=Ic,e.logDebug=_c,e.logError=Ec,e.logInfo=xc,e.logWarn=Tc,e.logger=Cc,e.sendEventGlobally=function(e,t){const s=("undefined"!=typeof window?window:globalThis).__humanBehaviorGlobalTracker;return s?.customEvent?s.customEvent(e,t):s?.track?s.track(e,t):(console.warn("HumanBehavior tracker not found. Make sure the SDK is initialized."),null)}}),"undefined"!=typeof window&&(window.HumanBehaviorTracker=HumanBehaviorTracker,window.humanbehavior={init:HumanBehaviorTracker.init});
1
+ "undefined"!=typeof window&&(window.HumanBehaviorTracker=window.HumanBehaviorTracker||{},window.humanbehavior=window.humanbehavior||{},window.humanbehavior.init=window.HumanBehaviorTracker.init),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).HumanBehaviorTracker={})}(this,function(e){"use strict";var t,s=Object.defineProperty,r=(e,t,r)=>((e,t,r)=>t in e?s(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r),i=Object.defineProperty,n=(e,t,s)=>((e,t,s)=>t in e?i(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s)(e,"symbol"!=typeof t?t+"":t,s),o=(e=>(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))(o||{});const a={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},l={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},c={};function h(e){if(c[e])return c[e];const t=globalThis[e],s=t.prototype,r=e in a?a[e]:void 0,i=Boolean(r&&r.every(e=>{var t,r;return Boolean(null==(r=null==(t=Object.getOwnPropertyDescriptor(s,e))?void 0:t.get)?void 0:r.toString().includes("[native code]"))})),n=e in l?l[e]:void 0,o=Boolean(n&&n.every(e=>{var t;return"function"==typeof s[e]&&(null==(t=s[e])?void 0:t.toString().includes("[native code]"))}));if(i&&o&&!globalThis.Zone)return c[e]=t.prototype,t.prototype;try{const r=document.createElement("iframe");document.body.appendChild(r);const i=r.contentWindow;if(!i)return t.prototype;const n=i[e].prototype;return document.body.removeChild(r),n?c[e]=n:s}catch{return s}}const u={};function d(e,t,s){var r;const i=`${e}.${String(s)}`;if(u[i])return u[i].call(t);const n=h(e),o=null==(r=Object.getOwnPropertyDescriptor(n,s))?void 0:r.get;return o?(u[i]=o,o.call(t)):t[s]}const p={};function m(e,t,s){const r=`${e}.${String(s)}`;if(p[r])return p[r].bind(t);const i=h(e)[s];return"function"!=typeof i?t[s]:(p[r]=i,i.bind(t))}const f={ownerDocument:function(e){return d("Node",e,"ownerDocument")},childNodes:function(e){return d("Node",e,"childNodes")},parentNode:function(e){return d("Node",e,"parentNode")},parentElement:function(e){return d("Node",e,"parentElement")},textContent:function(e){return d("Node",e,"textContent")},contains:function(e,t){return m("Node",e,"contains")(t)},getRootNode:function(e){return m("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?d("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?d("Element",e,"shadowRoot"):null},querySelector:function(e,t){return d("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return d("Element",e,"querySelectorAll")(t)},mutationObserver:function(){return h("MutationObserver").constructor},patch:function(e,t,s){try{if(!(t in e))return()=>{};const r=e[t],i=s(r);return"function"==typeof i&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=i,()=>{e[t]=r}}catch{return()=>{}}}};function g(e){return e.nodeType===e.ELEMENT_NODE}function y(e){const t=e&&"host"in e&&"mode"in e&&f.host(e)||null;return Boolean(t&&"shadowRoot"in t&&f.shadowRoot(t)===e)}function w(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function v(e){try{const s=e.rules||e.cssRules;if(!s)return null;let r=e.href;!r&&e.ownerNode&&(r=e.ownerNode.baseURI);const i=Array.from(s,e=>S(e,r)).join("");return(t=i).includes(" background-clip: text;")&&!t.includes(" -webkit-background-clip: text;")&&(t=t.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),t}catch(e){return null}var t}function S(e,t){if(function(e){return"styleSheet"in e}(e)){let t;try{t=v(e.styleSheet)||function(e){const{cssText:t}=e;if(t.split('"').length<3)return t;const s=["@import",`url(${JSON.stringify(e.href)})`];return""===e.layerName?s.push("layer"):e.layerName&&s.push(`layer(${e.layerName})`),e.supportsText&&s.push(`supports(${e.supportsText})`),e.media.length&&s.push(e.media.mediaText),s.join(" ")+";"}(e)}catch(s){t=e.cssText}return e.styleSheet.href?A(t,e.styleSheet.href):t}{let s=e.cssText;return function(e){return"selectorText"in e}(e)&&e.selectorText.includes(":")&&(s=function(e){const t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}(s)),t?A(s,t):s}}class b{constructor(){n(this,"idNodeMap",new Map),n(this,"nodeMetaMap",new WeakMap)}getId(e){var t;if(!e)return-1;return(null==(t=this.getMeta(e))?void 0:t.id)??-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach(e=>this.removeNodeFromMap(e))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const s=t.id;this.idNodeMap.set(s,e),this.nodeMetaMap.set(e,t)}replace(e,t){const s=this.getNode(e);if(s){const e=this.nodeMetaMap.get(s);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function C({element:e,maskInputOptions:t,tagName:s,type:r,value:i,maskInputFn:n}){let o=i||"";const a=r&&k(r);return(t[s.toLowerCase()]||a&&t[a])&&(o=n?n(o,e):"*".repeat(o.length)),o}function k(e){return e.toLowerCase()}const I="__rrweb_original__";function E(e){const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?k(t):null}function T(e,t){let s;try{s=new URL(e,t??window.location.href)}catch(e){return null}const r=s.pathname.match(/\.([0-9a-z]+)(?:$)/i);return(null==r?void 0:r[1])??null}const x=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,M=/^(?:[a-z+]+:)?\/\//i,_=/^www\..*/i,O=/^(data:)([^,]*),(.*)/i;function A(e,t){return(e||"").replace(x,(e,s,r,i,n,o)=>{const a=r||n||o,l=s||i||"";if(!a)return e;if(M.test(a)||_.test(a))return`url(${l}${a}${l})`;if(O.test(a))return`url(${l}${a}${l})`;if("/"===a[0])return`url(${l}${function(e){let t="";return t=e.indexOf("//")>-1?e.split("/").slice(0,3).join("/"):e.split("/")[0],t=t.split("?")[0],t}(t)+a}${l})`;const c=t.split("/"),h=a.split("/");c.pop();for(const e of h)"."!==e&&(".."===e?c.pop():c.push(e));return`url(${l}${c.join("/")}${l})`})}function R(e,t=!1){return t?e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,""):e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"").replace(/0px/g,"0")}function D(e,t){return function(e,t,s=!1){const r=Array.from(t.childNodes),i=[];let n=0;if(r.length>1&&e&&"string"==typeof e){let t=R(e,s);const o=t.length/e.length;for(let a=1;a<r.length;a++)if(r[a].textContent&&"string"==typeof r[a].textContent){const l=R(r[a].textContent,s),c=100;let h=3;for(;h<l.length&&(l[h].match(/[a-zA-Z0-9]/)||-1!==l.indexOf(l.substring(0,h),1));h++);for(;h<l.length;h++){let u=l.substring(0,h),d=t.split(u),p=-1;if(2===d.length)p=d[0].length;else if(d.length>2&&""===d[0]&&""!==r[a-1].textContent)p=t.indexOf(u,1);else if(1===d.length){if(u=u.substring(0,u.length-1),d=t.split(u),d.length<=1)return i.push(e),i;h=c+1}else h===l.length-1&&(p=t.indexOf(u));if(d.length>=2&&h>c){const e=r[a-1].textContent;if(e&&"string"==typeof e){const s=R(e).length;p=t.indexOf(u,s)}-1===p&&(p=d[0].length)}if(-1!==p){let a=Math.floor(p/o);for(;a>0&&a<e.length;){if(n+=1,n>50*r.length)return i.push(e),i;const l=R(e.substring(0,a),s);if(l.length===p){i.push(e.substring(0,a)),e=e.substring(a),t=t.substring(p);break}l.length<p?a+=Math.max(1,Math.floor((p-l.length)/o)):a-=Math.max(1,Math.floor((l.length-p)*o))}break}}}}return i.push(e),i}(e,t).join("/* rr_split */")}let P=1;const L=new RegExp("[^a-z0-9-_:]");function N(){return P++}let F,U;const B=/^[^ \t\n\r\u000c]+/,$=/^[, \t\n\r\u000c]+/;const z=new WeakMap;function j(e,t){return t&&""!==t.trim()?K(e,t):t}function W(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function K(e,t){let s=z.get(e);if(s||(s=e.createElement("a"),z.set(e,s)),t){if(t.startsWith("blob:")||t.startsWith("data:"))return t}else t="";return s.setAttribute("href",t),s.href}function G(e,t,s,r){return r?"src"===s||"href"===s&&("use"!==t||"#"!==r[0])||"xlink:href"===s&&"#"!==r[0]||"background"===s&&["table","td","th"].includes(t)?j(e,r):"srcset"===s?function(e,t){if(""===t.trim())return t;let s=0;function r(e){let r;const i=e.exec(t.substring(s));return i?(r=i[0],s+=r.length,r):""}const i=[];for(;r($),!(s>=t.length);){let n=r(B);if(","===n.slice(-1))n=j(e,n.substring(0,n.length-1)),i.push(n);else{let r="";n=j(e,n);let o=!1;for(;;){const e=t.charAt(s);if(""===e){i.push((n+r).trim());break}if(o)")"===e&&(o=!1);else{if(","===e){s+=1,i.push((n+r).trim());break}"("===e&&(o=!0)}r+=e,s+=1}}}return i.join(", ")}(e,r):"style"===s?A(r,K(e)):"object"===t&&"data"===s?j(e,r):r:r}function V(e,t,s){return["video","audio"].includes(e)&&"autoplay"===t}function H(e,t,s){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!s&&H(f.parentNode(e),t,s);for(let s=e.classList.length;s--;){const r=e.classList[s];if(t.test(r))return!0}return!!s&&H(f.parentNode(e),t,s)}function Y(e,t,s,r){let i;if(g(e)){if(i=e,!f.childNodes(i).length)return!1}else{if(null===f.parentElement(e))return!1;i=f.parentElement(e)}try{if("string"==typeof t){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(s)if(r){if(i.closest(s))return!0}else if(i.matches(s))return!0}catch(e){}return!1}function Z(e,t){const{doc:s,mirror:r,blockClass:i,blockSelector:n,needsMask:a,inlineStylesheet:l,maskInputOptions:c={},maskTextFn:h,maskInputFn:u,dataURLOptions:d={},inlineImages:p,recordCanvas:m,keepIframeSrcFn:g,newlyAddedElement:y=!1,cssCaptured:w=!1}=t,S=function(e,t){if(!t.hasNode(e))return;const s=t.getId(e);return 1===s?void 0:s}(s,r);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:o.Document,childNodes:[],compatMode:e.compatMode}:{type:o.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:o.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:S};case e.ELEMENT_NODE:return function(e,t){const{doc:s,blockClass:r,blockSelector:i,inlineStylesheet:n,maskInputOptions:a={},maskInputFn:l,dataURLOptions:c={},inlineImages:h,recordCanvas:u,keepIframeSrcFn:d,newlyAddedElement:p=!1,rootId:m}=t,f=function(e,t,s){try{if("string"==typeof t){if(e.classList.contains(t))return!0}else for(let s=e.classList.length;s--;){const r=e.classList[s];if(t.test(r))return!0}if(s)return e.matches(s)}catch(e){}return!1}(e,r,i),g=function(e){if(e instanceof HTMLFormElement)return"form";const t=k(e.tagName);return L.test(t)?"div":t}(e);let y={};const w=e.attributes.length;for(let t=0;t<w;t++){const r=e.attributes[t];V(g,r.name,r.value)||(y[r.name]=G(s,g,k(r.name),r.value))}if("link"===g&&n){const t=Array.from(s.styleSheets).find(t=>t.href===e.href);let r=null;t&&(r=v(t)),r&&(delete y.rel,delete y.href,y._cssText=r)}if("style"===g&&e.sheet){let t=v(e.sheet);t&&(e.childNodes.length>1&&(t=D(t,e)),y._cssText=t)}if(["input","textarea","select"].includes(g)){const t=e.value,s=e.checked;"radio"!==y.type&&"checkbox"!==y.type&&"submit"!==y.type&&"button"!==y.type&&t?y.value=C({element:e,type:E(e),tagName:g,value:t,maskInputOptions:a,maskInputFn:l}):s&&(y.checked=s)}"option"===g&&(e.selected&&!a.select?y.selected=!0:delete y.selected);"dialog"===g&&e.open&&(y.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal");if("canvas"===g&&u)if("2d"===e.__context)(function(e){const t=e.getContext("2d");if(!t)return!0;for(let s=0;s<e.width;s+=50)for(let r=0;r<e.height;r+=50){const i=t.getImageData,n=I in i?i[I]:i;if(new Uint32Array(n.call(t,s,r,Math.min(50,e.width-s),Math.min(50,e.height-r)).data.buffer).some(e=>0!==e))return!1}return!0})(e)||(y.rr_dataURL=e.toDataURL(c.type,c.quality));else if(!("__context"in e)){const t=e.toDataURL(c.type,c.quality),r=s.createElement("canvas");r.width=e.width,r.height=e.height;t!==r.toDataURL(c.type,c.quality)&&(y.rr_dataURL=t)}if("img"===g&&h){F||(F=s.createElement("canvas"),U=F.getContext("2d"));const t=e,r=t.currentSrc||t.getAttribute("src")||"<unknown-src>",i=t.crossOrigin,n=()=>{t.removeEventListener("load",n);try{F.width=t.naturalWidth,F.height=t.naturalHeight,U.drawImage(t,0,0),y.rr_dataURL=F.toDataURL(c.type,c.quality)}catch(e){if("anonymous"!==t.crossOrigin)return t.crossOrigin="anonymous",void(t.complete&&0!==t.naturalWidth?n():t.addEventListener("load",n));console.warn(`Cannot inline img src=${r}! Error: ${e}`)}"anonymous"===t.crossOrigin&&(i?y.crossOrigin=i:t.removeAttribute("crossorigin"))};t.complete&&0!==t.naturalWidth?n():t.addEventListener("load",n)}if(["audio","video"].includes(g)){const t=y;t.rr_mediaState=e.paused?"paused":"played",t.rr_mediaCurrentTime=e.currentTime,t.rr_mediaPlaybackRate=e.playbackRate,t.rr_mediaMuted=e.muted,t.rr_mediaLoop=e.loop,t.rr_mediaVolume=e.volume}p||(e.scrollLeft&&(y.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(y.rr_scrollTop=e.scrollTop));if(f){const{width:t,height:s}=e.getBoundingClientRect();y={class:y.class,rr_width:`${t}px`,rr_height:`${s}px`}}"iframe"!==g||d(y.src)||(e.contentDocument||(y.rr_src=y.src),delete y.src);let S;try{customElements.get(g)&&(S=!0)}catch(e){}return{type:o.Element,tagName:g,attributes:y,childNodes:[],isSVG:W(e)||void 0,needBlock:f,rootId:m,isCustom:S}}(e,{doc:s,blockClass:i,blockSelector:n,inlineStylesheet:l,maskInputOptions:c,maskInputFn:u,dataURLOptions:d,inlineImages:p,recordCanvas:m,keepIframeSrcFn:g,newlyAddedElement:y,rootId:S});case e.TEXT_NODE:return function(e,t){const{needsMask:s,maskTextFn:r,rootId:i,cssCaptured:n}=t,a=f.parentNode(e),l=a&&a.tagName;let c="";const h="STYLE"===l||void 0,u="SCRIPT"===l||void 0;u?c="SCRIPT_PLACEHOLDER":n||(c=f.textContent(e),h&&c&&(c=A(c,K(t.doc))));!h&&!u&&c&&s&&(c=r?r(c,f.parentElement(e)):c.replace(/[\S]/g,"*"));return{type:o.Text,textContent:c||"",rootId:i}}(e,{doc:s,needsMask:a,maskTextFn:h,rootId:S,cssCaptured:w});case e.CDATA_SECTION_NODE:return{type:o.CDATA,textContent:"",rootId:S};case e.COMMENT_NODE:return{type:o.Comment,textContent:f.textContent(e)||"",rootId:S};default:return!1}}function q(e){return null==e?"":e.toLowerCase()}function J(e){return!0===e||"all"===e?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===e,headMetaDescKeywords:"all"===e,headTitleMutations:"all"===e}:e||{}}function X(e,t){const{doc:s,mirror:r,blockClass:i,blockSelector:n,maskTextClass:a,maskTextSelector:l,skipChild:c=!1,inlineStylesheet:h=!0,maskInputOptions:u={},maskTextFn:d,maskInputFn:p,slimDOMOptions:m,dataURLOptions:v={},inlineImages:S=!1,recordCanvas:b=!1,onSerialize:C,onIframeLoad:k,iframeLoadTimeout:I=5e3,onStylesheetLoad:E,stylesheetLoadTimeout:x=5e3,keepIframeSrcFn:M=()=>!1,newlyAddedElement:_=!1,cssCaptured:O=!1}=t;let{needsMask:A}=t,{preserveWhiteSpace:R=!0}=t;if(!A){A=Y(e,a,l,void 0===A)}const D=Z(e,{doc:s,mirror:r,blockClass:i,blockSelector:n,needsMask:A,inlineStylesheet:h,maskInputOptions:u,maskTextFn:d,maskInputFn:p,dataURLOptions:v,inlineImages:S,recordCanvas:b,keepIframeSrcFn:M,newlyAddedElement:_,cssCaptured:O});if(!D)return console.warn(e,"not serialized"),null;let P;P=r.hasNode(e)?r.getId(e):function(e,t){if(t.comment&&e.type===o.Comment)return!0;if(e.type===o.Element){if(t.script&&("script"===e.tagName||"link"===e.tagName&&("preload"===e.attributes.rel&&"script"===e.attributes.as||"modulepreload"===e.attributes.rel)||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&"js"===T(e.attributes.href)))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(q(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===q(e.attributes.name)||"icon"===q(e.attributes.rel)||"apple-touch-icon"===q(e.attributes.rel)||"shortcut icon"===q(e.attributes.rel))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&q(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(q(e.attributes.property).match(/^(og|twitter|fb):/)||q(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===q(e.attributes.name)))return!0;if(t.headMetaRobots&&("robots"===q(e.attributes.name)||"googlebot"===q(e.attributes.name)||"bingbot"===q(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&("author"===q(e.attributes.name)||"generator"===q(e.attributes.name)||"framework"===q(e.attributes.name)||"publisher"===q(e.attributes.name)||"progid"===q(e.attributes.name)||q(e.attributes.property).match(/^article:/)||q(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&("google-site-verification"===q(e.attributes.name)||"yandex-verification"===q(e.attributes.name)||"csrf-token"===q(e.attributes.name)||"p:domain_verify"===q(e.attributes.name)||"verify-v1"===q(e.attributes.name)||"verification"===q(e.attributes.name)||"shopify-checkout-api-token"===q(e.attributes.name)))return!0}}return!1}(D,m)||!R&&D.type===o.Text&&!D.textContent.replace(/^\s+|\s+$/gm,"").length?-2:N();const L=Object.assign(D,{id:P});if(r.add(e,L),-2===P)return null;C&&C(e);let F=!c;if(L.type===o.Element){F=F&&!L.needBlock,delete L.needBlock;const t=f.shadowRoot(e);t&&w(t)&&(L.isShadowHost=!0)}if((L.type===o.Document||L.type===o.Element)&&F){m.headWhitespace&&L.type===o.Element&&"head"===L.tagName&&(R=!1);const t={doc:s,mirror:r,blockClass:i,blockSelector:n,needsMask:A,maskTextClass:a,maskTextSelector:l,skipChild:c,inlineStylesheet:h,maskInputOptions:u,maskTextFn:d,maskInputFn:p,slimDOMOptions:m,dataURLOptions:v,inlineImages:S,recordCanvas:b,preserveWhiteSpace:R,onSerialize:C,onIframeLoad:k,iframeLoadTimeout:I,onStylesheetLoad:E,stylesheetLoadTimeout:x,keepIframeSrcFn:M,cssCaptured:!1};if(L.type===o.Element&&"textarea"===L.tagName&&void 0!==L.attributes.value);else{L.type===o.Element&&void 0!==L.attributes._cssText&&"string"==typeof L.attributes._cssText&&(t.cssCaptured=!0);for(const s of Array.from(f.childNodes(e))){const e=X(s,t);e&&L.childNodes.push(e)}}let y=null;if(g(e)&&(y=f.shadowRoot(e)))for(const e of Array.from(f.childNodes(y))){const s=X(e,t);s&&(w(y)&&(s.isShadow=!0),L.childNodes.push(s))}}const U=f.parentNode(e);return U&&y(U)&&w(U)&&(L.isShadow=!0),L.type===o.Element&&"iframe"===L.tagName&&function(e,t,s){const r=e.contentWindow;if(!r)return;let i,n=!1;try{i=r.document.readyState}catch(e){return}if("complete"!==i){const r=setTimeout(()=>{n||(t(),n=!0)},s);return void e.addEventListener("load",()=>{clearTimeout(r),n=!0,t()})}const o="about:blank";if(r.location.href!==o||e.src===o||""===e.src)return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}(e,()=>{const t=e.contentDocument;if(t&&k){const s=X(t,{doc:t,mirror:r,blockClass:i,blockSelector:n,needsMask:A,maskTextClass:a,maskTextSelector:l,skipChild:!1,inlineStylesheet:h,maskInputOptions:u,maskTextFn:d,maskInputFn:p,slimDOMOptions:m,dataURLOptions:v,inlineImages:S,recordCanvas:b,preserveWhiteSpace:R,onSerialize:C,onIframeLoad:k,iframeLoadTimeout:I,onStylesheetLoad:E,stylesheetLoadTimeout:x,keepIframeSrcFn:M});s&&k(e,s)}},I),L.type===o.Element&&"link"===L.tagName&&"string"==typeof L.attributes.rel&&("stylesheet"===L.attributes.rel||"preload"===L.attributes.rel&&"string"==typeof L.attributes.href&&"css"===T(L.attributes.href))&&function(e,t,s){let r,i=!1;try{r=e.sheet}catch(e){return}if(r)return;const n=setTimeout(()=>{i||(t(),i=!0)},s);e.addEventListener("load",()=>{clearTimeout(n),i=!0,t()})}(e,()=>{if(E){const t=X(e,{doc:s,mirror:r,blockClass:i,blockSelector:n,needsMask:A,maskTextClass:a,maskTextSelector:l,skipChild:!1,inlineStylesheet:h,maskInputOptions:u,maskTextFn:d,maskInputFn:p,slimDOMOptions:m,dataURLOptions:v,inlineImages:S,recordCanvas:b,preserveWhiteSpace:R,onSerialize:C,onIframeLoad:k,iframeLoadTimeout:I,onStylesheetLoad:E,stylesheetLoadTimeout:x,keepIframeSrcFn:M});t&&E(e,t)}},x),L}function Q(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function ee(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var s=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};s.prototype=t.prototype}else s={};return Object.defineProperty(s,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(s,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),s}var te={exports:{}},se=String,re=function(){return{isColorSupported:!1,reset:se,bold:se,dim:se,italic:se,underline:se,inverse:se,hidden:se,strikethrough:se,black:se,red:se,green:se,yellow:se,blue:se,magenta:se,cyan:se,white:se,gray:se,bgBlack:se,bgRed:se,bgGreen:se,bgYellow:se,bgBlue:se,bgMagenta:se,bgCyan:se,bgWhite:se}};te.exports=re(),te.exports.createColors=re;var ie=te.exports;const ne=ee(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));let oe=ie,ae=ne,le=class e extends Error{constructor(t,s,r,i,n,o){super(t),this.name="CssSyntaxError",this.reason=t,n&&(this.file=n),i&&(this.source=i),o&&(this.plugin=o),void 0!==s&&void 0!==r&&("number"==typeof s?(this.line=s,this.column=r):(this.line=s.line,this.column=s.column,this.endLine=r.line,this.endColumn=r.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,e)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",void 0!==this.line&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(e){if(!this.source)return"";let t=this.source;null==e&&(e=oe.isColorSupported),ae&&e&&(t=ae(t));let s,r,i=t.split(/\r?\n/),n=Math.max(this.line-3,0),o=Math.min(this.line+2,i.length),a=String(o).length;if(e){let{bold:e,gray:t,red:i}=oe.createColors(!0);s=t=>e(i(t)),r=e=>t(e)}else s=r=e=>e;return i.slice(n,o).map((e,t)=>{let i=n+1+t,o=" "+(" "+i).slice(-a)+" | ";if(i===this.line){let t=r(o.replace(/\d/g," "))+e.slice(0,this.column-1).replace(/[^\t]/g," ");return s(">")+r(o)+e+"\n "+t+s("^")}return" "+r(o)+e}).join("\n")}toString(){let e=this.showSourceCode();return e&&(e="\n\n"+e+"\n"),this.name+": "+this.message+e}};var ce=le;le.default=le;var he={};he.isClean=Symbol("isClean"),he.my=Symbol("my");const ue={after:"\n",beforeClose:"\n",beforeComment:"\n",beforeDecl:"\n",beforeOpen:" ",beforeRule:"\n",colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};let de=class{constructor(e){this.builder=e}atrule(e,t){let s="@"+e.name,r=e.params?this.rawValue(e,"params"):"";if(void 0!==e.raws.afterName?s+=e.raws.afterName:r&&(s+=" "),e.nodes)this.block(e,s+r);else{let i=(e.raws.between||"")+(t?";":"");this.builder(s+r+i,e)}}beforeAfter(e,t){let s;s="decl"===e.type?this.raw(e,null,"beforeDecl"):"comment"===e.type?this.raw(e,null,"beforeComment"):"before"===t?this.raw(e,null,"beforeRule"):this.raw(e,null,"beforeClose");let r=e.parent,i=0;for(;r&&"root"!==r.type;)i+=1,r=r.parent;if(s.includes("\n")){let t=this.raw(e,null,"indent");if(t.length)for(let e=0;e<i;e++)s+=t}return s}block(e,t){let s,r=this.raw(e,"between","beforeOpen");this.builder(t+r+"{",e,"start"),e.nodes&&e.nodes.length?(this.body(e),s=this.raw(e,"after")):s=this.raw(e,"after","emptyBody"),s&&this.builder(s),this.builder("}",e,"end")}body(e){let t=e.nodes.length-1;for(;t>0&&"comment"===e.nodes[t].type;)t-=1;let s=this.raw(e,"semicolon");for(let r=0;r<e.nodes.length;r++){let i=e.nodes[r],n=this.raw(i,"before");n&&this.builder(n),this.stringify(i,t!==r||s)}}comment(e){let t=this.raw(e,"left","commentLeft"),s=this.raw(e,"right","commentRight");this.builder("/*"+t+e.text+s+"*/",e)}decl(e,t){let s=this.raw(e,"between","colon"),r=e.prop+s+this.rawValue(e,"value");e.important&&(r+=e.raws.important||" !important"),t&&(r+=";"),this.builder(r,e)}document(e){this.body(e)}raw(e,t,s){let r;if(s||(s=t),t&&(r=e.raws[t],void 0!==r))return r;let i=e.parent;if("before"===s){if(!i||"root"===i.type&&i.first===e)return"";if(i&&"document"===i.type)return""}if(!i)return ue[s];let n=e.root();if(n.rawCache||(n.rawCache={}),void 0!==n.rawCache[s])return n.rawCache[s];if("before"===s||"after"===s)return this.beforeAfter(e,s);{let i="raw"+((o=s)[0].toUpperCase()+o.slice(1));this[i]?r=this[i](n,e):n.walk(e=>{if(r=e.raws[t],void 0!==r)return!1})}var o;return void 0===r&&(r=ue[s]),n.rawCache[s]=r,r}rawBeforeClose(e){let t;return e.walk(e=>{if(e.nodes&&e.nodes.length>0&&void 0!==e.raws.after)return t=e.raws.after,t.includes("\n")&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawBeforeComment(e,t){let s;return e.walkComments(e=>{if(void 0!==e.raws.before)return s=e.raws.before,s.includes("\n")&&(s=s.replace(/[^\n]+$/,"")),!1}),void 0===s?s=this.raw(t,null,"beforeDecl"):s&&(s=s.replace(/\S/g,"")),s}rawBeforeDecl(e,t){let s;return e.walkDecls(e=>{if(void 0!==e.raws.before)return s=e.raws.before,s.includes("\n")&&(s=s.replace(/[^\n]+$/,"")),!1}),void 0===s?s=this.raw(t,null,"beforeRule"):s&&(s=s.replace(/\S/g,"")),s}rawBeforeOpen(e){let t;return e.walk(e=>{if("decl"!==e.type&&(t=e.raws.between,void 0!==t))return!1}),t}rawBeforeRule(e){let t;return e.walk(s=>{if(s.nodes&&(s.parent!==e||e.first!==s)&&void 0!==s.raws.before)return t=s.raws.before,t.includes("\n")&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawColon(e){let t;return e.walkDecls(e=>{if(void 0!==e.raws.between)return t=e.raws.between.replace(/[^\s:]/g,""),!1}),t}rawEmptyBody(e){let t;return e.walk(e=>{if(e.nodes&&0===e.nodes.length&&(t=e.raws.after,void 0!==t))return!1}),t}rawIndent(e){if(e.raws.indent)return e.raws.indent;let t;return e.walk(s=>{let r=s.parent;if(r&&r!==e&&r.parent&&r.parent===e&&void 0!==s.raws.before){let e=s.raws.before.split("\n");return t=e[e.length-1],t=t.replace(/\S/g,""),!1}}),t}rawSemicolon(e){let t;return e.walk(e=>{if(e.nodes&&e.nodes.length&&"decl"===e.last.type&&(t=e.raws.semicolon,void 0!==t))return!1}),t}rawValue(e,t){let s=e[t],r=e.raws[t];return r&&r.value===s?r.raw:s}root(e){this.body(e),e.raws.after&&this.builder(e.raws.after)}rule(e){this.block(e,this.rawValue(e,"selector")),e.raws.ownSemicolon&&this.builder(e.raws.ownSemicolon,e,"end")}stringify(e,t){if(!this[e.type])throw new Error("Unknown AST node type "+e.type+". Maybe you need to change PostCSS stringifier.");this[e.type](e,t)}};var pe=de;de.default=de;let me=pe;function fe(e,t){new me(t).stringify(e)}var ge=fe;fe.default=fe;let{isClean:ye,my:we}=he,ve=ce,Se=pe,be=ge;function Ce(e,t){let s=new e.constructor;for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;if("proxyCache"===r)continue;let i=e[r],n=typeof i;"parent"===r&&"object"===n?t&&(s[r]=t):"source"===r?s[r]=i:Array.isArray(i)?s[r]=i.map(e=>Ce(e,s)):("object"===n&&null!==i&&(i=Ce(i)),s[r]=i)}return s}let ke=class{constructor(e={}){this.raws={},this[ye]=!1,this[we]=!0;for(let t in e)if("nodes"===t){this.nodes=[];for(let s of e[t])"function"==typeof s.clone?this.append(s.clone()):this.append(s)}else this[t]=e[t]}addToError(e){if(e.postcssNode=this,e.stack&&this.source&&/\n\s{4}at /.test(e.stack)){let t=this.source;e.stack=e.stack.replace(/\n\s{4}at /,`$&${t.input.from}:${t.start.line}:${t.start.column}$&`)}return e}after(e){return this.parent.insertAfter(this,e),this}assign(e={}){for(let t in e)this[t]=e[t];return this}before(e){return this.parent.insertBefore(this,e),this}cleanRaws(e){delete this.raws.before,delete this.raws.after,e||delete this.raws.between}clone(e={}){let t=Ce(this);for(let s in e)t[s]=e[s];return t}cloneAfter(e={}){let t=this.clone(e);return this.parent.insertAfter(this,t),t}cloneBefore(e={}){let t=this.clone(e);return this.parent.insertBefore(this,t),t}error(e,t={}){if(this.source){let{end:s,start:r}=this.rangeBy(t);return this.source.input.error(e,{column:r.column,line:r.line},{column:s.column,line:s.line},t)}return new ve(e)}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:"root"===t?()=>e.root().toProxy():e[t],set:(e,t,s)=>(e[t]===s||(e[t]=s,"prop"!==t&&"value"!==t&&"name"!==t&&"params"!==t&&"important"!==t&&"text"!==t||e.markDirty()),!0)}}markDirty(){if(this[ye]){this[ye]=!1;let e=this;for(;e=e.parent;)e[ye]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e,t){let s=this.source.start;if(e.index)s=this.positionInside(e.index,t);else if(e.word){let r=(t=this.toString()).indexOf(e.word);-1!==r&&(s=this.positionInside(r,t))}return s}positionInside(e,t){let s=t||this.toString(),r=this.source.start.column,i=this.source.start.line;for(let t=0;t<e;t++)"\n"===s[t]?(r=1,i+=1):r+=1;return{column:r,line:i}}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}rangeBy(e){let t={column:this.source.start.column,line:this.source.start.line},s=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:t.column+1,line:t.line};if(e.word){let r=this.toString(),i=r.indexOf(e.word);-1!==i&&(t=this.positionInside(i,r),s=this.positionInside(i+e.word.length,r))}else e.start?t={column:e.start.column,line:e.start.line}:e.index&&(t=this.positionInside(e.index)),e.end?s={column:e.end.column,line:e.end.line}:"number"==typeof e.endIndex?s=this.positionInside(e.endIndex):e.index&&(s=this.positionInside(e.index+1));return(s.line<t.line||s.line===t.line&&s.column<=t.column)&&(s={column:t.column+1,line:t.line}),{end:s,start:t}}raw(e,t){return(new Se).raw(this,e,t)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...e){if(this.parent){let t=this,s=!1;for(let r of e)r===this?s=!0:s?(this.parent.insertAfter(t,r),t=r):this.parent.insertBefore(t,r);s||this.remove()}return this}root(){let e=this;for(;e.parent&&"document"!==e.parent.type;)e=e.parent;return e}toJSON(e,t){let s={},r=null==t;t=t||new Map;let i=0;for(let e in this){if(!Object.prototype.hasOwnProperty.call(this,e))continue;if("parent"===e||"proxyCache"===e)continue;let r=this[e];if(Array.isArray(r))s[e]=r.map(e=>"object"==typeof e&&e.toJSON?e.toJSON(null,t):e);else if("object"==typeof r&&r.toJSON)s[e]=r.toJSON(null,t);else if("source"===e){let n=t.get(r.input);null==n&&(n=i,t.set(r.input,i),i++),s[e]={end:r.end,inputId:n,start:r.start}}else s[e]=r}return r&&(s.inputs=[...t.keys()].map(e=>e.toJSON())),s}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(e=be){e.stringify&&(e=e.stringify);let t="";return e(this,e=>{t+=e}),t}warn(e,t,s){let r={node:this};for(let e in s)r[e]=s[e];return e.warn(t,r)}get proxyOf(){return this}};var Ie=ke;ke.default=ke;let Ee=Ie,Te=class extends Ee{constructor(e){e&&void 0!==e.value&&"string"!=typeof e.value&&(e={...e,value:String(e.value)}),super(e),this.type="decl"}get variable(){return this.prop.startsWith("--")||"$"===this.prop[0]}};var xe=Te;Te.default=Te;var Me={nanoid:(e=21)=>{let t="",s=e;for(;s--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t}};let{SourceMapConsumer:_e,SourceMapGenerator:Oe}=ne,{existsSync:Ae,readFileSync:Re}=ne,{dirname:De,join:Pe}=ne;let Le=class{constructor(e,t){if(!1===t.map)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");let s=t.map?t.map.prev:void 0,r=this.loadMap(t.from,s);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=De(this.mapFile)),r&&(this.text=r)}consumer(){return this.consumerCache||(this.consumerCache=new _e(this.text)),this.consumerCache}decodeInline(e){if(/^data:application\/json;charset=utf-?8,/.test(e)||/^data:application\/json,/.test(e))return decodeURIComponent(e.substr(RegExp.lastMatch.length));if(/^data:application\/json;charset=utf-?8;base64,/.test(e)||/^data:application\/json;base64,/.test(e))return t=e.substr(RegExp.lastMatch.length),Buffer?Buffer.from(t,"base64").toString():window.atob(t);var t;let s=e.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+s)}getAnnotationURL(e){return e.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(e){return"object"==typeof e&&("string"==typeof e.mappings||"string"==typeof e._mappings||Array.isArray(e.sections))}loadAnnotation(e){let t=e.match(/\/\*\s*# sourceMappingURL=/gm);if(!t)return;let s=e.lastIndexOf(t.pop()),r=e.indexOf("*/",s);s>-1&&r>-1&&(this.annotation=this.getAnnotationURL(e.substring(s,r)))}loadFile(e){if(this.root=De(e),Ae(e))return this.mapFile=e,Re(e,"utf-8").toString().trim()}loadMap(e,t){if(!1===t)return!1;if(t){if("string"==typeof t)return t;if("function"!=typeof t){if(t instanceof _e)return Oe.fromSourceMap(t).toString();if(t instanceof Oe)return t.toString();if(this.isMap(t))return JSON.stringify(t);throw new Error("Unsupported previous source map format: "+t.toString())}{let s=t(e);if(s){let e=this.loadFile(s);if(!e)throw new Error("Unable to load previous source map: "+s.toString());return e}}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let t=this.annotation;return e&&(t=Pe(De(e),t)),this.loadFile(t)}}}startWith(e,t){return!!e&&e.substr(0,t.length)===t}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}};var Ne=Le;Le.default=Le;let{SourceMapConsumer:Fe,SourceMapGenerator:Ue}=ne,{fileURLToPath:Be,pathToFileURL:$e}=ne,{isAbsolute:ze,resolve:je}=ne,{nanoid:We}=Me,Ke=ne,Ge=ce,Ve=Ne,He=Symbol("fromOffsetCache"),Ye=Boolean(Fe&&Ue),Ze=Boolean(je&&ze),qe=class{constructor(e,t={}){if(null==e||"object"==typeof e&&!e.toString)throw new Error(`PostCSS received ${e} instead of CSS string`);if(this.css=e.toString(),"\ufeff"===this.css[0]||"οΏΎ"===this.css[0]?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,t.from&&(!Ze||/^\w+:\/\//.test(t.from)||ze(t.from)?this.file=t.from:this.file=je(t.from)),Ze&&Ye){let e=new Ve(this.css,t);if(e.text){this.map=e;let t=e.consumer().file;!this.file&&t&&(this.file=this.mapResolve(t))}}this.file||(this.id="<input css "+We(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,s,r={}){let i,n,o;if(t&&"object"==typeof t){let e=t,r=s;if("number"==typeof e.offset){let r=this.fromOffset(e.offset);t=r.line,s=r.col}else t=e.line,s=e.column;if("number"==typeof r.offset){let e=this.fromOffset(r.offset);n=e.line,o=e.col}else n=r.line,o=r.column}else if(!s){let e=this.fromOffset(t);t=e.line,s=e.col}let a=this.origin(t,s,n,o);return i=a?new Ge(e,void 0===a.endLine?a.line:{column:a.column,line:a.line},void 0===a.endLine?a.column:{column:a.endColumn,line:a.endLine},a.source,a.file,r.plugin):new Ge(e,void 0===n?t:{column:s,line:t},void 0===n?s:{column:o,line:n},this.css,this.file,r.plugin),i.input={column:s,endColumn:o,endLine:n,line:t,source:this.css},this.file&&($e&&(i.input.url=$e(this.file).toString()),i.input.file=this.file),i}fromOffset(e){let t,s;if(this[He])s=this[He];else{let e=this.css.split("\n");s=new Array(e.length);let t=0;for(let r=0,i=e.length;r<i;r++)s[r]=t,t+=e[r].length+1;this[He]=s}t=s[s.length-1];let r=0;if(e>=t)r=s.length-1;else{let t,i=s.length-2;for(;r<i;)if(t=r+(i-r>>1),e<s[t])i=t-1;else{if(!(e>=s[t+1])){r=t;break}r=t+1}}return{col:e-s[r]+1,line:r+1}}mapResolve(e){return/^\w+:\/\//.test(e)?e:je(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,s,r){if(!this.map)return!1;let i,n,o=this.map.consumer(),a=o.originalPositionFor({column:t,line:e});if(!a.source)return!1;"number"==typeof s&&(i=o.originalPositionFor({column:r,line:s})),n=ze(a.source)?$e(a.source):new URL(a.source,this.map.consumer().sourceRoot||$e(this.map.mapFile));let l={column:a.column,endColumn:i&&i.column,endLine:i&&i.line,line:a.line,url:n.toString()};if("file:"===n.protocol){if(!Be)throw new Error("file: protocol is not available in this PostCSS build");l.file=Be(n)}let c=o.sourceContentFor(a.source);return c&&(l.source=c),l}toJSON(){let e={};for(let t of["hasBOM","css","file","id"])null!=this[t]&&(e[t]=this[t]);return this.map&&(e.map={...this.map},e.map.consumerCache&&(e.map.consumerCache=void 0)),e}get from(){return this.file||this.id}};var Je=qe;qe.default=qe,Ke&&Ke.registerInput&&Ke.registerInput(qe);let{SourceMapConsumer:Xe,SourceMapGenerator:Qe}=ne,{dirname:et,relative:tt,resolve:st,sep:rt}=ne,{pathToFileURL:it}=ne,nt=Je,ot=Boolean(Xe&&Qe),at=Boolean(et&&st&&tt&&rt);var lt=class{constructor(e,t,s,r){this.stringify=e,this.mapOpts=s.map||{},this.root=t,this.opts=s,this.css=r,this.originalCSS=r,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let e;e=this.isInline()?"data:application/json;base64,"+this.toBase64(this.map.toString()):"string"==typeof this.mapOpts.annotation?this.mapOpts.annotation:"function"==typeof this.mapOpts.annotation?this.mapOpts.annotation(this.opts.to,this.root):this.outputFile()+".map";let t="\n";this.css.includes("\r\n")&&(t="\r\n"),this.css+=t+"/*# sourceMappingURL="+e+" */"}applyPrevMaps(){for(let e of this.previous()){let t,s=this.toUrl(this.path(e.file)),r=e.root||et(e.file);!1===this.mapOpts.sourcesContent?(t=new Xe(e.text),t.sourcesContent&&(t.sourcesContent=null)):t=e.consumer(),this.map.applySourceMap(t,s,this.toUrl(this.path(r)))}}clearAnnotation(){if(!1!==this.mapOpts.annotation)if(this.root){let e;for(let t=this.root.nodes.length-1;t>=0;t--)e=this.root.nodes[t],"comment"===e.type&&0===e.text.indexOf("# sourceMappingURL=")&&this.root.removeChild(t)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),at&&ot&&this.isMap())return this.generateMap();{let e="";return this.stringify(this.root,t=>{e+=t}),[e]}}generateMap(){if(this.root)this.generateString();else if(1===this.previous().length){let e=this.previous()[0].consumer();e.file=this.outputFile(),this.map=Qe.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new Qe({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new Qe({file:this.outputFile(),ignoreInvalidMapping:!0});let e,t,s=1,r=1,i="<no source>",n={generated:{column:0,line:0},original:{column:0,line:0},source:""};this.stringify(this.root,(o,a,l)=>{if(this.css+=o,a&&"end"!==l&&(n.generated.line=s,n.generated.column=r-1,a.source&&a.source.start?(n.source=this.sourcePath(a),n.original.line=a.source.start.line,n.original.column=a.source.start.column-1,this.map.addMapping(n)):(n.source=i,n.original.line=1,n.original.column=0,this.map.addMapping(n))),e=o.match(/\n/g),e?(s+=e.length,t=o.lastIndexOf("\n"),r=o.length-t):r+=o.length,a&&"start"!==l){let e=a.parent||{raws:{}};("decl"===a.type||"atrule"===a.type&&!a.nodes)&&a===e.last&&!e.raws.semicolon||(a.source&&a.source.end?(n.source=this.sourcePath(a),n.original.line=a.source.end.line,n.original.column=a.source.end.column-1,n.generated.line=s,n.generated.column=r-2,this.map.addMapping(n)):(n.source=i,n.original.line=1,n.original.column=0,n.generated.line=s,n.generated.column=r-1,this.map.addMapping(n)))}})}isAnnotation(){return!!this.isInline()||(void 0!==this.mapOpts.annotation?this.mapOpts.annotation:!this.previous().length||this.previous().some(e=>e.annotation))}isInline(){if(void 0!==this.mapOpts.inline)return this.mapOpts.inline;let e=this.mapOpts.annotation;return(void 0===e||!0===e)&&(!this.previous().length||this.previous().some(e=>e.inline))}isMap(){return void 0!==this.opts.map?!!this.opts.map:this.previous().length>0}isSourcesContent(){return void 0!==this.mapOpts.sourcesContent?this.mapOpts.sourcesContent:!this.previous().length||this.previous().some(e=>e.withContent())}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(e){if(this.mapOpts.absolute)return e;if(60===e.charCodeAt(0))return e;if(/^\w+:\/\//.test(e))return e;let t=this.memoizedPaths.get(e);if(t)return t;let s=this.opts.to?et(this.opts.to):".";"string"==typeof this.mapOpts.annotation&&(s=et(st(s,this.mapOpts.annotation)));let r=tt(s,e);return this.memoizedPaths.set(e,r),r}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(e=>{if(e.source&&e.source.input.map){let t=e.source.input.map;this.previousMaps.includes(t)||this.previousMaps.push(t)}});else{let e=new nt(this.originalCSS,this.opts);e.map&&this.previousMaps.push(e.map)}return this.previousMaps}setSourcesContent(){let e={};if(this.root)this.root.walk(t=>{if(t.source){let s=t.source.input.from;if(s&&!e[s]){e[s]=!0;let r=this.usesFileUrls?this.toFileUrl(s):this.toUrl(this.path(s));this.map.setSourceContent(r,t.source.input.css)}}});else if(this.css){let e=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(e,this.css)}}sourcePath(e){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(e.source.input.from):this.toUrl(this.path(e.source.input.from))}toBase64(e){return Buffer?Buffer.from(e).toString("base64"):window.btoa(unescape(encodeURIComponent(e)))}toFileUrl(e){let t=this.memoizedFileURLs.get(e);if(t)return t;if(it){let t=it(e).toString();return this.memoizedFileURLs.set(e,t),t}throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(e){let t=this.memoizedURLs.get(e);if(t)return t;"\\"===rt&&(e=e.replace(/\\/g,"/"));let s=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,s),s}};let ct=Ie,ht=class extends ct{constructor(e){super(e),this.type="comment"}};var ut=ht;ht.default=ht;let dt,pt,mt,ft,{isClean:gt,my:yt}=he,wt=xe,vt=ut,St=Ie;function bt(e){return e.map(e=>(e.nodes&&(e.nodes=bt(e.nodes)),delete e.source,e))}function Ct(e){if(e[gt]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)Ct(t)}let kt=class e extends St{append(...e){for(let t of e){let e=this.normalize(t,this.last);for(let t of e)this.proxyOf.nodes.push(t)}return this.markDirty(),this}cleanRaws(e){if(super.cleanRaws(e),this.nodes)for(let t of this.nodes)t.cleanRaws(e)}each(e){if(!this.proxyOf.nodes)return;let t,s,r=this.getIterator();for(;this.indexes[r]<this.proxyOf.nodes.length&&(t=this.indexes[r],s=e(this.proxyOf.nodes[t],t),!1!==s);)this.indexes[r]+=1;return delete this.indexes[r],s}every(e){return this.nodes.every(e)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let e=this.lastEach;return this.indexes[e]=0,e}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:e[t]?"each"===t||"string"==typeof t&&t.startsWith("walk")?(...s)=>e[t](...s.map(e=>"function"==typeof e?(t,s)=>e(t.toProxy(),s):e)):"every"===t||"some"===t?s=>e[t]((e,...t)=>s(e.toProxy(),...t)):"root"===t?()=>e.root().toProxy():"nodes"===t?e.nodes.map(e=>e.toProxy()):"first"===t||"last"===t?e[t].toProxy():e[t]:e[t],set:(e,t,s)=>(e[t]===s||(e[t]=s,"name"!==t&&"params"!==t&&"selector"!==t||e.markDirty()),!0)}}index(e){return"number"==typeof e?e:(e.proxyOf&&(e=e.proxyOf),this.proxyOf.nodes.indexOf(e))}insertAfter(e,t){let s,r=this.index(e),i=this.normalize(t,this.proxyOf.nodes[r]).reverse();r=this.index(e);for(let e of i)this.proxyOf.nodes.splice(r+1,0,e);for(let e in this.indexes)s=this.indexes[e],r<s&&(this.indexes[e]=s+i.length);return this.markDirty(),this}insertBefore(e,t){let s,r=this.index(e),i=0===r&&"prepend",n=this.normalize(t,this.proxyOf.nodes[r],i).reverse();r=this.index(e);for(let e of n)this.proxyOf.nodes.splice(r,0,e);for(let e in this.indexes)s=this.indexes[e],r<=s&&(this.indexes[e]=s+n.length);return this.markDirty(),this}normalize(t,s){if("string"==typeof t)t=bt(dt(t).nodes);else if(void 0===t)t=[];else if(Array.isArray(t)){t=t.slice(0);for(let e of t)e.parent&&e.parent.removeChild(e,"ignore")}else if("root"===t.type&&"document"!==this.type){t=t.nodes.slice(0);for(let e of t)e.parent&&e.parent.removeChild(e,"ignore")}else if(t.type)t=[t];else if(t.prop){if(void 0===t.value)throw new Error("Value field is missed in node creation");"string"!=typeof t.value&&(t.value=String(t.value)),t=[new wt(t)]}else if(t.selector)t=[new pt(t)];else if(t.name)t=[new mt(t)];else{if(!t.text)throw new Error("Unknown node type in node creation");t=[new vt(t)]}return t.map(t=>(t[yt]||e.rebuild(t),(t=t.proxyOf).parent&&t.parent.removeChild(t),t[gt]&&Ct(t),void 0===t.raws.before&&s&&void 0!==s.raws.before&&(t.raws.before=s.raws.before.replace(/\S/g,"")),t.parent=this.proxyOf,t))}prepend(...e){e=e.reverse();for(let t of e){let e=this.normalize(t,this.first,"prepend").reverse();for(let t of e)this.proxyOf.nodes.unshift(t);for(let t in this.indexes)this.indexes[t]=this.indexes[t]+e.length}return this.markDirty(),this}push(e){return e.parent=this,this.proxyOf.nodes.push(e),this}removeAll(){for(let e of this.proxyOf.nodes)e.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(e){let t;e=this.index(e),this.proxyOf.nodes[e].parent=void 0,this.proxyOf.nodes.splice(e,1);for(let s in this.indexes)t=this.indexes[s],t>=e&&(this.indexes[s]=t-1);return this.markDirty(),this}replaceValues(e,t,s){return s||(s=t,t={}),this.walkDecls(r=>{t.props&&!t.props.includes(r.prop)||t.fast&&!r.value.includes(t.fast)||(r.value=r.value.replace(e,s))}),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each((t,s)=>{let r;try{r=e(t,s)}catch(e){throw t.addToError(e)}return!1!==r&&t.walk&&(r=t.walk(e)),r})}walkAtRules(e,t){return t?e instanceof RegExp?this.walk((s,r)=>{if("atrule"===s.type&&e.test(s.name))return t(s,r)}):this.walk((s,r)=>{if("atrule"===s.type&&s.name===e)return t(s,r)}):(t=e,this.walk((e,s)=>{if("atrule"===e.type)return t(e,s)}))}walkComments(e){return this.walk((t,s)=>{if("comment"===t.type)return e(t,s)})}walkDecls(e,t){return t?e instanceof RegExp?this.walk((s,r)=>{if("decl"===s.type&&e.test(s.prop))return t(s,r)}):this.walk((s,r)=>{if("decl"===s.type&&s.prop===e)return t(s,r)}):(t=e,this.walk((e,s)=>{if("decl"===e.type)return t(e,s)}))}walkRules(e,t){return t?e instanceof RegExp?this.walk((s,r)=>{if("rule"===s.type&&e.test(s.selector))return t(s,r)}):this.walk((s,r)=>{if("rule"===s.type&&s.selector===e)return t(s,r)}):(t=e,this.walk((e,s)=>{if("rule"===e.type)return t(e,s)}))}get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}};kt.registerParse=e=>{dt=e},kt.registerRule=e=>{pt=e},kt.registerAtRule=e=>{mt=e},kt.registerRoot=e=>{ft=e};var It=kt;kt.default=kt,kt.rebuild=e=>{"atrule"===e.type?Object.setPrototypeOf(e,mt.prototype):"rule"===e.type?Object.setPrototypeOf(e,pt.prototype):"decl"===e.type?Object.setPrototypeOf(e,wt.prototype):"comment"===e.type?Object.setPrototypeOf(e,vt.prototype):"root"===e.type&&Object.setPrototypeOf(e,ft.prototype),e[yt]=!0,e.nodes&&e.nodes.forEach(e=>{kt.rebuild(e)})};let Et,Tt,xt=It,Mt=class extends xt{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(e={}){return new Et(new Tt,this,e).stringify()}};Mt.registerLazyResult=e=>{Et=e},Mt.registerProcessor=e=>{Tt=e};var _t=Mt;Mt.default=Mt;let Ot={};var At=function(e){Ot[e]||(Ot[e]=!0,"undefined"!=typeof console&&console.warn&&console.warn(e))};let Rt=class{constructor(e,t={}){if(this.type="warning",this.text=e,t.node&&t.node.source){let e=t.node.rangeBy(t);this.line=e.start.line,this.column=e.start.column,this.endLine=e.end.line,this.endColumn=e.end.column}for(let e in t)this[e]=t[e]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}};var Dt=Rt;Rt.default=Rt;let Pt=Dt,Lt=class{constructor(e,t,s){this.processor=e,this.messages=[],this.root=t,this.opts=s,this.css=void 0,this.map=void 0}toString(){return this.css}warn(e,t={}){t.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(t.plugin=this.lastPlugin.postcssPlugin);let s=new Pt(e,t);return this.messages.push(s),s}warnings(){return this.messages.filter(e=>"warning"===e.type)}get content(){return this.css}};var Nt=Lt;Lt.default=Lt;const Ft="'".charCodeAt(0),Ut='"'.charCodeAt(0),Bt="\\".charCodeAt(0),$t="/".charCodeAt(0),zt="\n".charCodeAt(0),jt=" ".charCodeAt(0),Wt="\f".charCodeAt(0),Kt="\t".charCodeAt(0),Gt="\r".charCodeAt(0),Vt="[".charCodeAt(0),Ht="]".charCodeAt(0),Yt="(".charCodeAt(0),Zt=")".charCodeAt(0),qt="{".charCodeAt(0),Jt="}".charCodeAt(0),Xt=";".charCodeAt(0),Qt="*".charCodeAt(0),es=":".charCodeAt(0),ts="@".charCodeAt(0),ss=/[\t\n\f\r "#'()/;[\\\]{}]/g,rs=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,is=/.[\r\n"'(/\\]/,ns=/[\da-f]/i;let os=It,as=class extends os{constructor(e){super(e),this.type="atrule"}append(...e){return this.proxyOf.nodes||(this.nodes=[]),super.append(...e)}prepend(...e){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...e)}};var ls=as;as.default=as,os.registerAtRule(as);let cs,hs,us=It,ds=class extends us{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}normalize(e,t,s){let r=super.normalize(e);if(t)if("prepend"===s)this.nodes.length>1?t.raws.before=this.nodes[1].raws.before:delete t.raws.before;else if(this.first!==t)for(let e of r)e.raws.before=t.raws.before;return r}removeChild(e,t){let s=this.index(e);return!t&&0===s&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[s].raws.before),super.removeChild(e)}toResult(e={}){return new cs(new hs,this,e).stringify()}};ds.registerLazyResult=e=>{cs=e},ds.registerProcessor=e=>{hs=e};var ps=ds;ds.default=ds,us.registerRoot(ds);let ms={comma:e=>ms.split(e,[","],!0),space:e=>ms.split(e,[" ","\n","\t"]),split(e,t,s){let r=[],i="",n=!1,o=0,a=!1,l="",c=!1;for(let s of e)c?c=!1:"\\"===s?c=!0:a?s===l&&(a=!1):'"'===s||"'"===s?(a=!0,l=s):"("===s?o+=1:")"===s?o>0&&(o-=1):0===o&&t.includes(s)&&(n=!0),n?(""!==i&&r.push(i.trim()),i="",n=!1):i+=s;return(s||""!==i)&&r.push(i.trim()),r}};var fs=ms;ms.default=ms;let gs=It,ys=fs,ws=class extends gs{constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return ys.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\s*/):null,s=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(s)}};var vs=ws;ws.default=ws,gs.registerRule(ws);let Ss=xe,bs=function(e,t={}){let s,r,i,n,o,a,l,c,h,u,d=e.css.valueOf(),p=t.ignoreErrors,m=d.length,f=0,g=[],y=[];function w(t){throw e.error("Unclosed "+t,f)}return{back:function(e){y.push(e)},endOfFile:function(){return 0===y.length&&f>=m},nextToken:function(e){if(y.length)return y.pop();if(f>=m)return;let t=!!e&&e.ignoreUnclosed;switch(s=d.charCodeAt(f),s){case zt:case jt:case Kt:case Gt:case Wt:r=f;do{r+=1,s=d.charCodeAt(r)}while(s===jt||s===zt||s===Kt||s===Gt||s===Wt);u=["space",d.slice(f,r)],f=r-1;break;case Vt:case Ht:case qt:case Jt:case es:case Xt:case Zt:{let e=String.fromCharCode(s);u=[e,e,f];break}case Yt:if(c=g.length?g.pop()[1]:"",h=d.charCodeAt(f+1),"url"===c&&h!==Ft&&h!==Ut&&h!==jt&&h!==zt&&h!==Kt&&h!==Wt&&h!==Gt){r=f;do{if(a=!1,r=d.indexOf(")",r+1),-1===r){if(p||t){r=f;break}w("bracket")}for(l=r;d.charCodeAt(l-1)===Bt;)l-=1,a=!a}while(a);u=["brackets",d.slice(f,r+1),f,r],f=r}else r=d.indexOf(")",f+1),n=d.slice(f,r+1),-1===r||is.test(n)?u=["(","(",f]:(u=["brackets",n,f,r],f=r);break;case Ft:case Ut:i=s===Ft?"'":'"',r=f;do{if(a=!1,r=d.indexOf(i,r+1),-1===r){if(p||t){r=f+1;break}w("string")}for(l=r;d.charCodeAt(l-1)===Bt;)l-=1,a=!a}while(a);u=["string",d.slice(f,r+1),f,r],f=r;break;case ts:ss.lastIndex=f+1,ss.test(d),r=0===ss.lastIndex?d.length-1:ss.lastIndex-2,u=["at-word",d.slice(f,r+1),f,r],f=r;break;case Bt:for(r=f,o=!0;d.charCodeAt(r+1)===Bt;)r+=1,o=!o;if(s=d.charCodeAt(r+1),o&&s!==$t&&s!==jt&&s!==zt&&s!==Kt&&s!==Gt&&s!==Wt&&(r+=1,ns.test(d.charAt(r)))){for(;ns.test(d.charAt(r+1));)r+=1;d.charCodeAt(r+1)===jt&&(r+=1)}u=["word",d.slice(f,r+1),f,r],f=r;break;default:s===$t&&d.charCodeAt(f+1)===Qt?(r=d.indexOf("*/",f+2)+1,0===r&&(p||t?r=d.length:w("comment")),u=["comment",d.slice(f,r+1),f,r],f=r):(rs.lastIndex=f+1,rs.test(d),r=0===rs.lastIndex?d.length-1:rs.lastIndex-2,u=["word",d.slice(f,r+1),f,r],g.push(u),f=r)}return f++,u},position:function(){return f}}},Cs=ut,ks=ls,Is=ps,Es=vs;const Ts={empty:!0,space:!0};let xs=It,Ms=class{constructor(e){this.input=e,this.root=new Is,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}atrule(e){let t,s,r,i=new ks;i.name=e[1].slice(1),""===i.name&&this.unnamedAtrule(i,e),this.init(i,e[2]);let n=!1,o=!1,a=[],l=[];for(;!this.tokenizer.endOfFile();){if(t=(e=this.tokenizer.nextToken())[0],"("===t||"["===t?l.push("("===t?")":"]"):"{"===t&&l.length>0?l.push("}"):t===l[l.length-1]&&l.pop(),0===l.length){if(";"===t){i.source.end=this.getPosition(e[2]),i.source.end.offset++,this.semicolon=!0;break}if("{"===t){o=!0;break}if("}"===t){if(a.length>0){for(r=a.length-1,s=a[r];s&&"space"===s[0];)s=a[--r];s&&(i.source.end=this.getPosition(s[3]||s[2]),i.source.end.offset++)}this.end(e);break}a.push(e)}else a.push(e);if(this.tokenizer.endOfFile()){n=!0;break}}i.raws.between=this.spacesAndCommentsFromEnd(a),a.length?(i.raws.afterName=this.spacesAndCommentsFromStart(a),this.raw(i,"params",a),n&&(e=a[a.length-1],i.source.end=this.getPosition(e[3]||e[2]),i.source.end.offset++,this.spaces=i.raws.between,i.raws.between="")):(i.raws.afterName="",i.params=""),o&&(i.nodes=[],this.current=i)}checkMissedSemicolon(e){let t=this.colon(e);if(!1===t)return;let s,r=0;for(let i=t-1;i>=0&&(s=e[i],"space"===s[0]||(r+=1,2!==r));i--);throw this.input.error("Missed semicolon","word"===s[0]?s[3]+1:s[2])}colon(e){let t,s,r,i=0;for(let[n,o]of e.entries()){if(t=o,s=t[0],"("===s&&(i+=1),")"===s&&(i-=1),0===i&&":"===s){if(r){if("word"===r[0]&&"progid"===r[1])continue;return n}this.doubleColon(t)}r=t}return!1}comment(e){let t=new Cs;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;let s=e[1].slice(2,-2);if(/^\s*$/.test(s))t.text="",t.raws.left=s,t.raws.right="";else{let e=s.match(/^(\s*)([^]*\S)(\s*)$/);t.text=e[2],t.raws.left=e[1],t.raws.right=e[3]}}createTokenizer(){this.tokenizer=bs(this.input)}decl(e,t){let s=new Ss;this.init(s,e[0][2]);let r,i=e[e.length-1];for(";"===i[0]&&(this.semicolon=!0,e.pop()),s.source.end=this.getPosition(i[3]||i[2]||function(e){for(let t=e.length-1;t>=0;t--){let s=e[t],r=s[3]||s[2];if(r)return r}}(e)),s.source.end.offset++;"word"!==e[0][0];)1===e.length&&this.unknownWord(e),s.raws.before+=e.shift()[1];for(s.source.start=this.getPosition(e[0][2]),s.prop="";e.length;){let t=e[0][0];if(":"===t||"space"===t||"comment"===t)break;s.prop+=e.shift()[1]}for(s.raws.between="";e.length;){if(r=e.shift(),":"===r[0]){s.raws.between+=r[1];break}"word"===r[0]&&/\w/.test(r[1])&&this.unknownWord([r]),s.raws.between+=r[1]}"_"!==s.prop[0]&&"*"!==s.prop[0]||(s.raws.before+=s.prop[0],s.prop=s.prop.slice(1));let n,o=[];for(;e.length&&(n=e[0][0],"space"===n||"comment"===n);)o.push(e.shift());this.precheckMissedSemicolon(e);for(let t=e.length-1;t>=0;t--){if(r=e[t],"!important"===r[1].toLowerCase()){s.important=!0;let r=this.stringFrom(e,t);r=this.spacesFromEnd(e)+r," !important"!==r&&(s.raws.important=r);break}if("important"===r[1].toLowerCase()){let r=e.slice(0),i="";for(let e=t;e>0;e--){let t=r[e][0];if(0===i.trim().indexOf("!")&&"space"!==t)break;i=r.pop()[1]+i}0===i.trim().indexOf("!")&&(s.important=!0,s.raws.important=i,e=r)}if("space"!==r[0]&&"comment"!==r[0])break}e.some(e=>"space"!==e[0]&&"comment"!==e[0])&&(s.raws.between+=o.map(e=>e[1]).join(""),o=[]),this.raw(s,"value",o.concat(e),t),s.value.includes(":")&&!t&&this.checkMissedSemicolon(e)}doubleColon(e){throw this.input.error("Double colon",{offset:e[2]},{offset:e[2]+e[1].length})}emptyRule(e){let t=new Es;this.init(t,e[2]),t.selector="",t.raws.between="",this.current=t}end(e){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(e[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(e)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(e){if(this.spaces+=e[1],this.current.nodes){let e=this.current.nodes[this.current.nodes.length-1];e&&"rule"===e.type&&!e.raws.ownSemicolon&&(e.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(e){let t=this.input.fromOffset(e);return{column:t.col,line:t.line,offset:e}}init(e,t){this.current.push(e),e.source={input:this.input,start:this.getPosition(t)},e.raws.before=this.spaces,this.spaces="","comment"!==e.type&&(this.semicolon=!1)}other(e){let t=!1,s=null,r=!1,i=null,n=[],o=e[1].startsWith("--"),a=[],l=e;for(;l;){if(s=l[0],a.push(l),"("===s||"["===s)i||(i=l),n.push("("===s?")":"]");else if(o&&r&&"{"===s)i||(i=l),n.push("}");else if(0===n.length){if(";"===s){if(r)return void this.decl(a,o);break}if("{"===s)return void this.rule(a);if("}"===s){this.tokenizer.back(a.pop()),t=!0;break}":"===s&&(r=!0)}else s===n[n.length-1]&&(n.pop(),0===n.length&&(i=null));l=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),n.length>0&&this.unclosedBracket(i),t&&r){if(!o)for(;a.length&&(l=a[a.length-1][0],"space"===l||"comment"===l);)this.tokenizer.back(a.pop());this.decl(a,o)}else this.unknownWord(a)}parse(){let e;for(;!this.tokenizer.endOfFile();)switch(e=this.tokenizer.nextToken(),e[0]){case"space":this.spaces+=e[1];break;case";":this.freeSemicolon(e);break;case"}":this.end(e);break;case"comment":this.comment(e);break;case"at-word":this.atrule(e);break;case"{":this.emptyRule(e);break;default:this.other(e)}this.endFile()}precheckMissedSemicolon(){}raw(e,t,s,r){let i,n,o,a,l=s.length,c="",h=!0;for(let e=0;e<l;e+=1)i=s[e],n=i[0],"space"!==n||e!==l-1||r?"comment"===n?(a=s[e-1]?s[e-1][0]:"empty",o=s[e+1]?s[e+1][0]:"empty",Ts[a]||Ts[o]||","===c.slice(-1)?h=!1:c+=i[1]):c+=i[1]:h=!1;if(!h){let r=s.reduce((e,t)=>e+t[1],"");e.raws[t]={raw:r,value:c}}e[t]=c}rule(e){e.pop();let t=new Es;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t}spacesAndCommentsFromEnd(e){let t,s="";for(;e.length&&(t=e[e.length-1][0],"space"===t||"comment"===t);)s=e.pop()[1]+s;return s}spacesAndCommentsFromStart(e){let t,s="";for(;e.length&&(t=e[0][0],"space"===t||"comment"===t);)s+=e.shift()[1];return s}spacesFromEnd(e){let t,s="";for(;e.length&&(t=e[e.length-1][0],"space"===t);)s=e.pop()[1]+s;return s}stringFrom(e,t){let s="";for(let r=t;r<e.length;r++)s+=e[r][1];return e.splice(t,e.length-t),s}unclosedBlock(){let e=this.current.source.start;throw this.input.error("Unclosed block",e.line,e.column)}unclosedBracket(e){throw this.input.error("Unclosed bracket",{offset:e[2]},{offset:e[2]+1})}unexpectedClose(e){throw this.input.error("Unexpected }",{offset:e[2]},{offset:e[2]+1})}unknownWord(e){throw this.input.error("Unknown word",{offset:e[0][2]},{offset:e[0][2]+e[0][1].length})}unnamedAtrule(e,t){throw this.input.error("At-rule without name",{offset:t[2]},{offset:t[2]+t[1].length})}},_s=Je;function Os(e,t){let s=new _s(e,t),r=new Ms(s);try{r.parse()}catch(e){throw"production"!==process.env.NODE_ENV&&"CssSyntaxError"===e.name&&t&&t.from&&(/\.scss$/i.test(t.from)?e.message+="\nYou tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser":/\.sass/i.test(t.from)?e.message+="\nYou tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser":/\.less$/i.test(t.from)&&(e.message+="\nYou tried to parse Less with the standard CSS parser; try again with the postcss-less parser")),e}return r.root}var As=Os;Os.default=Os,xs.registerParse(Os);let{isClean:Rs,my:Ds}=he,Ps=lt,Ls=ge,Ns=It,Fs=_t,Us=At,Bs=Nt,$s=As,zs=ps;const js={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},Ws={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},Ks={Once:!0,postcssPlugin:!0,prepare:!0};function Gs(e){return"object"==typeof e&&"function"==typeof e.then}function Vs(e){let t=!1,s=js[e.type];return"decl"===e.type?t=e.prop.toLowerCase():"atrule"===e.type&&(t=e.name.toLowerCase()),t&&e.append?[s,s+"-"+t,0,s+"Exit",s+"Exit-"+t]:t?[s,s+"-"+t,s+"Exit",s+"Exit-"+t]:e.append?[s,0,s+"Exit"]:[s,s+"Exit"]}function Hs(e){let t;return t="document"===e.type?["Document",0,"DocumentExit"]:"root"===e.type?["Root",0,"RootExit"]:Vs(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function Ys(e){return e[Rs]=!1,e.nodes&&e.nodes.forEach(e=>Ys(e)),e}let Zs={},qs=class e{constructor(t,s,r){let i;if(this.stringified=!1,this.processed=!1,"object"!=typeof s||null===s||"root"!==s.type&&"document"!==s.type)if(s instanceof e||s instanceof Bs)i=Ys(s.root),s.map&&(void 0===r.map&&(r.map={}),r.map.inline||(r.map.inline=!1),r.map.prev=s.map);else{let e=$s;r.syntax&&(e=r.syntax.parse),r.parser&&(e=r.parser),e.parse&&(e=e.parse);try{i=e(s,r)}catch(e){this.processed=!0,this.error=e}i&&!i[Ds]&&Ns.rebuild(i)}else i=Ys(s);this.result=new Bs(t,i,r),this.helpers={...Zs,postcss:Zs,result:this.result},this.plugins=this.processor.plugins.map(e=>"object"==typeof e&&e.prepare?{...e,...e.prepare(this.result)}:e)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(e,t){let s=this.result.lastPlugin;try{if(t&&t.addToError(e),this.error=e,"CssSyntaxError"!==e.name||e.plugin){if(s.postcssVersion&&"production"!==process.env.NODE_ENV){let e=s.postcssPlugin,t=s.postcssVersion,r=this.result.processor.version,i=t.split("."),n=r.split(".");(i[0]!==n[0]||parseInt(i[1])>parseInt(n[1]))&&console.error("Unknown error from PostCSS plugin. Your current PostCSS version is "+r+", but "+e+" uses "+t+". Perhaps this is the source of the error below.")}}else e.plugin=s.postcssPlugin,e.setMessage()}catch(e){console&&console.error&&console.error(e)}return e}prepareVisitors(){this.listeners={};let e=(e,t,s)=>{this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push([e,s])};for(let t of this.plugins)if("object"==typeof t)for(let s in t){if(!Ws[s]&&/^[A-Z]/.test(s))throw new Error(`Unknown event ${s} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!Ks[s])if("object"==typeof t[s])for(let r in t[s])e(t,"*"===r?s:s+"-"+r.toLowerCase(),t[s][r]);else"function"==typeof t[s]&&e(t,s,t[s])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let e=0;e<this.plugins.length;e++){let t=this.plugins[e],s=this.runOnRoot(t);if(Gs(s))try{await s}catch(e){throw this.handleError(e)}}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[Rs];){e[Rs]=!0;let t=[Hs(e)];for(;t.length>0;){let e=this.visitTick(t);if(Gs(e))try{await e}catch(e){let s=t[t.length-1].node;throw this.handleError(e,s)}}}if(this.listeners.OnceExit)for(let[t,s]of this.listeners.OnceExit){this.result.lastPlugin=t;try{if("document"===e.type){let t=e.nodes.map(e=>s(e,this.helpers));await Promise.all(t)}else await s(e,this.helpers)}catch(e){throw this.handleError(e)}}}return this.processed=!0,this.stringify()}runOnRoot(e){this.result.lastPlugin=e;try{if("object"==typeof e&&e.Once){if("document"===this.result.root.type){let t=this.result.root.nodes.map(t=>e.Once(t,this.helpers));return Gs(t[0])?Promise.all(t):t}return e.Once(this.result.root,this.helpers)}if("function"==typeof e)return e(this.result.root,this.result)}catch(e){throw this.handleError(e)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let e=this.result.opts,t=Ls;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let s=new Ps(t,this.result.root,this.result.opts).generate();return this.result.css=s[0],this.result.map=s[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let e of this.plugins){if(Gs(this.runOnRoot(e)))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[Rs];)e[Rs]=!0,this.walkSync(e);if(this.listeners.OnceExit)if("document"===e.type)for(let t of e.nodes)this.visitSync(this.listeners.OnceExit,t);else this.visitSync(this.listeners.OnceExit,e)}return this.result}then(e,t){return"production"!==process.env.NODE_ENV&&("from"in this.opts||Us("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(e,t)}toString(){return this.css}visitSync(e,t){for(let[s,r]of e){let e;this.result.lastPlugin=s;try{e=r(t,this.helpers)}catch(e){throw this.handleError(e,t.proxyOf)}if("root"!==t.type&&"document"!==t.type&&!t.parent)return!0;if(Gs(e))throw this.getAsyncError()}}visitTick(e){let t=e[e.length-1],{node:s,visitors:r}=t;if("root"!==s.type&&"document"!==s.type&&!s.parent)return void e.pop();if(r.length>0&&t.visitorIndex<r.length){let[e,i]=r[t.visitorIndex];t.visitorIndex+=1,t.visitorIndex===r.length&&(t.visitors=[],t.visitorIndex=0),this.result.lastPlugin=e;try{return i(s.toProxy(),this.helpers)}catch(e){throw this.handleError(e,s)}}if(0!==t.iterator){let r,i=t.iterator;for(;r=s.nodes[s.indexes[i]];)if(s.indexes[i]+=1,!r[Rs])return r[Rs]=!0,void e.push(Hs(r));t.iterator=0,delete s.indexes[i]}let i=t.events;for(;t.eventIndex<i.length;){let e=i[t.eventIndex];if(t.eventIndex+=1,0===e)return void(s.nodes&&s.nodes.length&&(s[Rs]=!0,t.iterator=s.getIterator()));if(this.listeners[e])return void(t.visitors=this.listeners[e])}e.pop()}walkSync(e){e[Rs]=!0;let t=Vs(e);for(let s of t)if(0===s)e.nodes&&e.each(e=>{e[Rs]||this.walkSync(e)});else{let t=this.listeners[s];if(t&&this.visitSync(t,e.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}};qs.registerPostcss=e=>{Zs=e};var Js=qs;qs.default=qs,zs.registerLazyResult(qs),Fs.registerLazyResult(qs);let Xs=lt,Qs=ge,er=At,tr=As;const sr=Nt;let rr=class{constructor(e,t,s){let r;t=t.toString(),this.stringified=!1,this._processor=e,this._css=t,this._opts=s,this._map=void 0;let i=Qs;this.result=new sr(this._processor,r,this._opts),this.result.css=t;let n=this;Object.defineProperty(this.result,"root",{get:()=>n.root});let o=new Xs(i,r,this._opts,t);if(o.isMap()){let[e,t]=o.generate();e&&(this.result.css=e),t&&(this.result.map=t)}else o.clearAnnotation(),this.result.css=o.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}sync(){if(this.error)throw this.error;return this.result}then(e,t){return"production"!==process.env.NODE_ENV&&("from"in this._opts||er("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(e,t)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let e,t=tr;try{e=t(this._css,this._opts)}catch(e){this.error=e}if(this.error)throw this.error;return this._root=e,e}get[Symbol.toStringTag](){return"NoWorkResult"}};var ir=rr;rr.default=rr;let nr=ir,or=Js,ar=_t,lr=ps,cr=class{constructor(e=[]){this.version="8.4.38",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let s of e)if(!0===s.postcss?s=s():s.postcss&&(s=s.postcss),"object"==typeof s&&Array.isArray(s.plugins))t=t.concat(s.plugins);else if("object"==typeof s&&s.postcssPlugin)t.push(s);else if("function"==typeof s)t.push(s);else{if("object"!=typeof s||!s.parse&&!s.stringify)throw new Error(s+" is not a PostCSS plugin");if("production"!==process.env.NODE_ENV)throw new Error("PostCSS syntaxes cannot be used as plugins. Instead, please use one of the syntax/parser/stringifier options as outlined in your PostCSS runner documentation.")}return t}process(e,t={}){return this.plugins.length||t.parser||t.stringifier||t.syntax?new or(this,e,t):new nr(this,e,t)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}};var hr=cr;cr.default=cr,lr.registerProcessor(cr),ar.registerProcessor(cr);let ur=xe,dr=Ne,pr=ut,mr=ls,fr=Je,gr=ps,yr=vs;function wr(e,t){if(Array.isArray(e))return e.map(e=>wr(e));let{inputs:s,...r}=e;if(s){t=[];for(let e of s){let s={...e,__proto__:fr.prototype};s.map&&(s.map={...s.map,__proto__:dr.prototype}),t.push(s)}}if(r.nodes&&(r.nodes=e.nodes.map(e=>wr(e,t))),r.source){let{inputId:e,...s}=r.source;r.source=s,null!=e&&(r.source.input=t[e])}if("root"===r.type)return new gr(r);if("decl"===r.type)return new ur(r);if("rule"===r.type)return new yr(r);if("comment"===r.type)return new pr(r);if("atrule"===r.type)return new mr(r);throw new Error("Unknown node type: "+e.type)}var vr=wr;wr.default=wr;let Sr=ce,br=xe,Cr=Js,kr=It,Ir=hr,Er=ge,Tr=vr,xr=_t,Mr=Dt,_r=ut,Or=ls,Ar=Nt,Rr=Je,Dr=As,Pr=fs,Lr=vs,Nr=ps,Fr=Ie;function Ur(...e){return 1===e.length&&Array.isArray(e[0])&&(e=e[0]),new Ir(e)}Ur.plugin=function(e,t){let s,r=!1;function i(...s){console&&console.warn&&!r&&(r=!0,console.warn(e+": postcss.plugin was deprecated. Migration guide:\nhttps://evilmartians.com/chronicles/postcss-8-plugin-migration"),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(e+": ι‡Œι’ postcss.plugin 蒫弃用. θΏη§»ζŒ‡ε—:\nhttps://www.w3ctech.com/topic/2226"));let i=t(...s);return i.postcssPlugin=e,i.postcssVersion=(new Ir).version,i}return Object.defineProperty(i,"postcss",{get:()=>(s||(s=i()),s)}),i.process=function(e,t,s){return Ur([i(s)]).process(e,t)},i},Ur.stringify=Er,Ur.parse=Dr,Ur.fromJSON=Tr,Ur.list=Pr,Ur.comment=e=>new _r(e),Ur.atRule=e=>new Or(e),Ur.decl=e=>new br(e),Ur.rule=e=>new Lr(e),Ur.root=e=>new Nr(e),Ur.document=e=>new xr(e),Ur.CssSyntaxError=Sr,Ur.Declaration=br,Ur.Container=kr,Ur.Processor=Ir,Ur.Document=xr,Ur.Comment=_r,Ur.Warning=Mr,Ur.AtRule=Or,Ur.Result=Ar,Ur.Input=Rr,Ur.Rule=Lr,Ur.Root=Nr,Ur.Node=Fr,Cr.registerPostcss(Ur);var Br=Ur;Ur.default=Ur;const $r=Q(Br);$r.stringify,$r.fromJSON,$r.plugin,$r.parse,$r.list,$r.document,$r.comment,$r.atRule,$r.rule,$r.decl,$r.root,$r.CssSyntaxError,$r.Declaration,$r.Container,$r.Processor,$r.Document,$r.Comment,$r.Warning,$r.AtRule,$r.Result,$r.Input,$r.Rule,$r.Root,$r.Node;var zr=Object.defineProperty,jr=(e,t,s)=>((e,t,s)=>t in e?zr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s)(e,"symbol"!=typeof t?t+"":t,s);function Wr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Kr(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var s=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};s.prototype=t.prototype}else s={};return Object.defineProperty(s,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(s,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),s}var Gr={exports:{}},Vr=String,Hr=function(){return{isColorSupported:!1,reset:Vr,bold:Vr,dim:Vr,italic:Vr,underline:Vr,inverse:Vr,hidden:Vr,strikethrough:Vr,black:Vr,red:Vr,green:Vr,yellow:Vr,blue:Vr,magenta:Vr,cyan:Vr,white:Vr,gray:Vr,bgBlack:Vr,bgRed:Vr,bgGreen:Vr,bgYellow:Vr,bgBlue:Vr,bgMagenta:Vr,bgCyan:Vr,bgWhite:Vr}};Gr.exports=Hr(),Gr.exports.createColors=Hr;var Yr=Gr.exports;const Zr=Kr(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));let qr=Yr,Jr=Zr,Xr=class e extends Error{constructor(t,s,r,i,n,o){super(t),this.name="CssSyntaxError",this.reason=t,n&&(this.file=n),i&&(this.source=i),o&&(this.plugin=o),void 0!==s&&void 0!==r&&("number"==typeof s?(this.line=s,this.column=r):(this.line=s.line,this.column=s.column,this.endLine=r.line,this.endColumn=r.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,e)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",void 0!==this.line&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(e){if(!this.source)return"";let t=this.source;null==e&&(e=qr.isColorSupported),Jr&&e&&(t=Jr(t));let s,r,i=t.split(/\r?\n/),n=Math.max(this.line-3,0),o=Math.min(this.line+2,i.length),a=String(o).length;if(e){let{bold:e,gray:t,red:i}=qr.createColors(!0);s=t=>e(i(t)),r=e=>t(e)}else s=r=e=>e;return i.slice(n,o).map((e,t)=>{let i=n+1+t,o=" "+(" "+i).slice(-a)+" | ";if(i===this.line){let t=r(o.replace(/\d/g," "))+e.slice(0,this.column-1).replace(/[^\t]/g," ");return s(">")+r(o)+e+"\n "+t+s("^")}return" "+r(o)+e}).join("\n")}toString(){let e=this.showSourceCode();return e&&(e="\n\n"+e+"\n"),this.name+": "+this.message+e}};var Qr=Xr;Xr.default=Xr;var ei={};ei.isClean=Symbol("isClean"),ei.my=Symbol("my");const ti={after:"\n",beforeClose:"\n",beforeComment:"\n",beforeDecl:"\n",beforeOpen:" ",beforeRule:"\n",colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};let si=class{constructor(e){this.builder=e}atrule(e,t){let s="@"+e.name,r=e.params?this.rawValue(e,"params"):"";if(void 0!==e.raws.afterName?s+=e.raws.afterName:r&&(s+=" "),e.nodes)this.block(e,s+r);else{let i=(e.raws.between||"")+(t?";":"");this.builder(s+r+i,e)}}beforeAfter(e,t){let s;s="decl"===e.type?this.raw(e,null,"beforeDecl"):"comment"===e.type?this.raw(e,null,"beforeComment"):"before"===t?this.raw(e,null,"beforeRule"):this.raw(e,null,"beforeClose");let r=e.parent,i=0;for(;r&&"root"!==r.type;)i+=1,r=r.parent;if(s.includes("\n")){let t=this.raw(e,null,"indent");if(t.length)for(let e=0;e<i;e++)s+=t}return s}block(e,t){let s,r=this.raw(e,"between","beforeOpen");this.builder(t+r+"{",e,"start"),e.nodes&&e.nodes.length?(this.body(e),s=this.raw(e,"after")):s=this.raw(e,"after","emptyBody"),s&&this.builder(s),this.builder("}",e,"end")}body(e){let t=e.nodes.length-1;for(;t>0&&"comment"===e.nodes[t].type;)t-=1;let s=this.raw(e,"semicolon");for(let r=0;r<e.nodes.length;r++){let i=e.nodes[r],n=this.raw(i,"before");n&&this.builder(n),this.stringify(i,t!==r||s)}}comment(e){let t=this.raw(e,"left","commentLeft"),s=this.raw(e,"right","commentRight");this.builder("/*"+t+e.text+s+"*/",e)}decl(e,t){let s=this.raw(e,"between","colon"),r=e.prop+s+this.rawValue(e,"value");e.important&&(r+=e.raws.important||" !important"),t&&(r+=";"),this.builder(r,e)}document(e){this.body(e)}raw(e,t,s){let r;if(s||(s=t),t&&(r=e.raws[t],void 0!==r))return r;let i=e.parent;if("before"===s){if(!i||"root"===i.type&&i.first===e)return"";if(i&&"document"===i.type)return""}if(!i)return ti[s];let n=e.root();if(n.rawCache||(n.rawCache={}),void 0!==n.rawCache[s])return n.rawCache[s];if("before"===s||"after"===s)return this.beforeAfter(e,s);{let i="raw"+((o=s)[0].toUpperCase()+o.slice(1));this[i]?r=this[i](n,e):n.walk(e=>{if(r=e.raws[t],void 0!==r)return!1})}var o;return void 0===r&&(r=ti[s]),n.rawCache[s]=r,r}rawBeforeClose(e){let t;return e.walk(e=>{if(e.nodes&&e.nodes.length>0&&void 0!==e.raws.after)return t=e.raws.after,t.includes("\n")&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawBeforeComment(e,t){let s;return e.walkComments(e=>{if(void 0!==e.raws.before)return s=e.raws.before,s.includes("\n")&&(s=s.replace(/[^\n]+$/,"")),!1}),void 0===s?s=this.raw(t,null,"beforeDecl"):s&&(s=s.replace(/\S/g,"")),s}rawBeforeDecl(e,t){let s;return e.walkDecls(e=>{if(void 0!==e.raws.before)return s=e.raws.before,s.includes("\n")&&(s=s.replace(/[^\n]+$/,"")),!1}),void 0===s?s=this.raw(t,null,"beforeRule"):s&&(s=s.replace(/\S/g,"")),s}rawBeforeOpen(e){let t;return e.walk(e=>{if("decl"!==e.type&&(t=e.raws.between,void 0!==t))return!1}),t}rawBeforeRule(e){let t;return e.walk(s=>{if(s.nodes&&(s.parent!==e||e.first!==s)&&void 0!==s.raws.before)return t=s.raws.before,t.includes("\n")&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawColon(e){let t;return e.walkDecls(e=>{if(void 0!==e.raws.between)return t=e.raws.between.replace(/[^\s:]/g,""),!1}),t}rawEmptyBody(e){let t;return e.walk(e=>{if(e.nodes&&0===e.nodes.length&&(t=e.raws.after,void 0!==t))return!1}),t}rawIndent(e){if(e.raws.indent)return e.raws.indent;let t;return e.walk(s=>{let r=s.parent;if(r&&r!==e&&r.parent&&r.parent===e&&void 0!==s.raws.before){let e=s.raws.before.split("\n");return t=e[e.length-1],t=t.replace(/\S/g,""),!1}}),t}rawSemicolon(e){let t;return e.walk(e=>{if(e.nodes&&e.nodes.length&&"decl"===e.last.type&&(t=e.raws.semicolon,void 0!==t))return!1}),t}rawValue(e,t){let s=e[t],r=e.raws[t];return r&&r.value===s?r.raw:s}root(e){this.body(e),e.raws.after&&this.builder(e.raws.after)}rule(e){this.block(e,this.rawValue(e,"selector")),e.raws.ownSemicolon&&this.builder(e.raws.ownSemicolon,e,"end")}stringify(e,t){if(!this[e.type])throw new Error("Unknown AST node type "+e.type+". Maybe you need to change PostCSS stringifier.");this[e.type](e,t)}};var ri=si;si.default=si;let ii=ri;function ni(e,t){new ii(t).stringify(e)}var oi=ni;ni.default=ni;let{isClean:ai,my:li}=ei,ci=Qr,hi=ri,ui=oi;function di(e,t){let s=new e.constructor;for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;if("proxyCache"===r)continue;let i=e[r],n=typeof i;"parent"===r&&"object"===n?t&&(s[r]=t):"source"===r?s[r]=i:Array.isArray(i)?s[r]=i.map(e=>di(e,s)):("object"===n&&null!==i&&(i=di(i)),s[r]=i)}return s}let pi=class{constructor(e={}){this.raws={},this[ai]=!1,this[li]=!0;for(let t in e)if("nodes"===t){this.nodes=[];for(let s of e[t])"function"==typeof s.clone?this.append(s.clone()):this.append(s)}else this[t]=e[t]}addToError(e){if(e.postcssNode=this,e.stack&&this.source&&/\n\s{4}at /.test(e.stack)){let t=this.source;e.stack=e.stack.replace(/\n\s{4}at /,`$&${t.input.from}:${t.start.line}:${t.start.column}$&`)}return e}after(e){return this.parent.insertAfter(this,e),this}assign(e={}){for(let t in e)this[t]=e[t];return this}before(e){return this.parent.insertBefore(this,e),this}cleanRaws(e){delete this.raws.before,delete this.raws.after,e||delete this.raws.between}clone(e={}){let t=di(this);for(let s in e)t[s]=e[s];return t}cloneAfter(e={}){let t=this.clone(e);return this.parent.insertAfter(this,t),t}cloneBefore(e={}){let t=this.clone(e);return this.parent.insertBefore(this,t),t}error(e,t={}){if(this.source){let{end:s,start:r}=this.rangeBy(t);return this.source.input.error(e,{column:r.column,line:r.line},{column:s.column,line:s.line},t)}return new ci(e)}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:"root"===t?()=>e.root().toProxy():e[t],set:(e,t,s)=>(e[t]===s||(e[t]=s,"prop"!==t&&"value"!==t&&"name"!==t&&"params"!==t&&"important"!==t&&"text"!==t||e.markDirty()),!0)}}markDirty(){if(this[ai]){this[ai]=!1;let e=this;for(;e=e.parent;)e[ai]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e,t){let s=this.source.start;if(e.index)s=this.positionInside(e.index,t);else if(e.word){let r=(t=this.toString()).indexOf(e.word);-1!==r&&(s=this.positionInside(r,t))}return s}positionInside(e,t){let s=t||this.toString(),r=this.source.start.column,i=this.source.start.line;for(let t=0;t<e;t++)"\n"===s[t]?(r=1,i+=1):r+=1;return{column:r,line:i}}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}rangeBy(e){let t={column:this.source.start.column,line:this.source.start.line},s=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:t.column+1,line:t.line};if(e.word){let r=this.toString(),i=r.indexOf(e.word);-1!==i&&(t=this.positionInside(i,r),s=this.positionInside(i+e.word.length,r))}else e.start?t={column:e.start.column,line:e.start.line}:e.index&&(t=this.positionInside(e.index)),e.end?s={column:e.end.column,line:e.end.line}:"number"==typeof e.endIndex?s=this.positionInside(e.endIndex):e.index&&(s=this.positionInside(e.index+1));return(s.line<t.line||s.line===t.line&&s.column<=t.column)&&(s={column:t.column+1,line:t.line}),{end:s,start:t}}raw(e,t){return(new hi).raw(this,e,t)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...e){if(this.parent){let t=this,s=!1;for(let r of e)r===this?s=!0:s?(this.parent.insertAfter(t,r),t=r):this.parent.insertBefore(t,r);s||this.remove()}return this}root(){let e=this;for(;e.parent&&"document"!==e.parent.type;)e=e.parent;return e}toJSON(e,t){let s={},r=null==t;t=t||new Map;let i=0;for(let e in this){if(!Object.prototype.hasOwnProperty.call(this,e))continue;if("parent"===e||"proxyCache"===e)continue;let r=this[e];if(Array.isArray(r))s[e]=r.map(e=>"object"==typeof e&&e.toJSON?e.toJSON(null,t):e);else if("object"==typeof r&&r.toJSON)s[e]=r.toJSON(null,t);else if("source"===e){let n=t.get(r.input);null==n&&(n=i,t.set(r.input,i),i++),s[e]={end:r.end,inputId:n,start:r.start}}else s[e]=r}return r&&(s.inputs=[...t.keys()].map(e=>e.toJSON())),s}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(e=ui){e.stringify&&(e=e.stringify);let t="";return e(this,e=>{t+=e}),t}warn(e,t,s){let r={node:this};for(let e in s)r[e]=s[e];return e.warn(t,r)}get proxyOf(){return this}};var mi=pi;pi.default=pi;let fi=mi,gi=class extends fi{constructor(e){e&&void 0!==e.value&&"string"!=typeof e.value&&(e={...e,value:String(e.value)}),super(e),this.type="decl"}get variable(){return this.prop.startsWith("--")||"$"===this.prop[0]}};var yi=gi;gi.default=gi;var wi={nanoid:(e=21)=>{let t="",s=e;for(;s--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t}};let{SourceMapConsumer:vi,SourceMapGenerator:Si}=Zr,{existsSync:bi,readFileSync:Ci}=Zr,{dirname:ki,join:Ii}=Zr;let Ei=class{constructor(e,t){if(!1===t.map)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");let s=t.map?t.map.prev:void 0,r=this.loadMap(t.from,s);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=ki(this.mapFile)),r&&(this.text=r)}consumer(){return this.consumerCache||(this.consumerCache=new vi(this.text)),this.consumerCache}decodeInline(e){if(/^data:application\/json;charset=utf-?8,/.test(e)||/^data:application\/json,/.test(e))return decodeURIComponent(e.substr(RegExp.lastMatch.length));if(/^data:application\/json;charset=utf-?8;base64,/.test(e)||/^data:application\/json;base64,/.test(e))return t=e.substr(RegExp.lastMatch.length),Buffer?Buffer.from(t,"base64").toString():window.atob(t);var t;let s=e.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+s)}getAnnotationURL(e){return e.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(e){return"object"==typeof e&&("string"==typeof e.mappings||"string"==typeof e._mappings||Array.isArray(e.sections))}loadAnnotation(e){let t=e.match(/\/\*\s*# sourceMappingURL=/gm);if(!t)return;let s=e.lastIndexOf(t.pop()),r=e.indexOf("*/",s);s>-1&&r>-1&&(this.annotation=this.getAnnotationURL(e.substring(s,r)))}loadFile(e){if(this.root=ki(e),bi(e))return this.mapFile=e,Ci(e,"utf-8").toString().trim()}loadMap(e,t){if(!1===t)return!1;if(t){if("string"==typeof t)return t;if("function"!=typeof t){if(t instanceof vi)return Si.fromSourceMap(t).toString();if(t instanceof Si)return t.toString();if(this.isMap(t))return JSON.stringify(t);throw new Error("Unsupported previous source map format: "+t.toString())}{let s=t(e);if(s){let e=this.loadFile(s);if(!e)throw new Error("Unable to load previous source map: "+s.toString());return e}}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let t=this.annotation;return e&&(t=Ii(ki(e),t)),this.loadFile(t)}}}startWith(e,t){return!!e&&e.substr(0,t.length)===t}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}};var Ti=Ei;Ei.default=Ei;let{SourceMapConsumer:xi,SourceMapGenerator:Mi}=Zr,{fileURLToPath:_i,pathToFileURL:Oi}=Zr,{isAbsolute:Ai,resolve:Ri}=Zr,{nanoid:Di}=wi,Pi=Zr,Li=Qr,Ni=Ti,Fi=Symbol("fromOffsetCache"),Ui=Boolean(xi&&Mi),Bi=Boolean(Ri&&Ai),$i=class{constructor(e,t={}){if(null==e||"object"==typeof e&&!e.toString)throw new Error(`PostCSS received ${e} instead of CSS string`);if(this.css=e.toString(),"\ufeff"===this.css[0]||"οΏΎ"===this.css[0]?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,t.from&&(!Bi||/^\w+:\/\//.test(t.from)||Ai(t.from)?this.file=t.from:this.file=Ri(t.from)),Bi&&Ui){let e=new Ni(this.css,t);if(e.text){this.map=e;let t=e.consumer().file;!this.file&&t&&(this.file=this.mapResolve(t))}}this.file||(this.id="<input css "+Di(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,s,r={}){let i,n,o;if(t&&"object"==typeof t){let e=t,r=s;if("number"==typeof e.offset){let r=this.fromOffset(e.offset);t=r.line,s=r.col}else t=e.line,s=e.column;if("number"==typeof r.offset){let e=this.fromOffset(r.offset);n=e.line,o=e.col}else n=r.line,o=r.column}else if(!s){let e=this.fromOffset(t);t=e.line,s=e.col}let a=this.origin(t,s,n,o);return i=a?new Li(e,void 0===a.endLine?a.line:{column:a.column,line:a.line},void 0===a.endLine?a.column:{column:a.endColumn,line:a.endLine},a.source,a.file,r.plugin):new Li(e,void 0===n?t:{column:s,line:t},void 0===n?s:{column:o,line:n},this.css,this.file,r.plugin),i.input={column:s,endColumn:o,endLine:n,line:t,source:this.css},this.file&&(Oi&&(i.input.url=Oi(this.file).toString()),i.input.file=this.file),i}fromOffset(e){let t,s;if(this[Fi])s=this[Fi];else{let e=this.css.split("\n");s=new Array(e.length);let t=0;for(let r=0,i=e.length;r<i;r++)s[r]=t,t+=e[r].length+1;this[Fi]=s}t=s[s.length-1];let r=0;if(e>=t)r=s.length-1;else{let t,i=s.length-2;for(;r<i;)if(t=r+(i-r>>1),e<s[t])i=t-1;else{if(!(e>=s[t+1])){r=t;break}r=t+1}}return{col:e-s[r]+1,line:r+1}}mapResolve(e){return/^\w+:\/\//.test(e)?e:Ri(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,s,r){if(!this.map)return!1;let i,n,o=this.map.consumer(),a=o.originalPositionFor({column:t,line:e});if(!a.source)return!1;"number"==typeof s&&(i=o.originalPositionFor({column:r,line:s})),n=Ai(a.source)?Oi(a.source):new URL(a.source,this.map.consumer().sourceRoot||Oi(this.map.mapFile));let l={column:a.column,endColumn:i&&i.column,endLine:i&&i.line,line:a.line,url:n.toString()};if("file:"===n.protocol){if(!_i)throw new Error("file: protocol is not available in this PostCSS build");l.file=_i(n)}let c=o.sourceContentFor(a.source);return c&&(l.source=c),l}toJSON(){let e={};for(let t of["hasBOM","css","file","id"])null!=this[t]&&(e[t]=this[t]);return this.map&&(e.map={...this.map},e.map.consumerCache&&(e.map.consumerCache=void 0)),e}get from(){return this.file||this.id}};var zi=$i;$i.default=$i,Pi&&Pi.registerInput&&Pi.registerInput($i);let{SourceMapConsumer:ji,SourceMapGenerator:Wi}=Zr,{dirname:Ki,relative:Gi,resolve:Vi,sep:Hi}=Zr,{pathToFileURL:Yi}=Zr,Zi=zi,qi=Boolean(ji&&Wi),Ji=Boolean(Ki&&Vi&&Gi&&Hi);var Xi=class{constructor(e,t,s,r){this.stringify=e,this.mapOpts=s.map||{},this.root=t,this.opts=s,this.css=r,this.originalCSS=r,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let e;e=this.isInline()?"data:application/json;base64,"+this.toBase64(this.map.toString()):"string"==typeof this.mapOpts.annotation?this.mapOpts.annotation:"function"==typeof this.mapOpts.annotation?this.mapOpts.annotation(this.opts.to,this.root):this.outputFile()+".map";let t="\n";this.css.includes("\r\n")&&(t="\r\n"),this.css+=t+"/*# sourceMappingURL="+e+" */"}applyPrevMaps(){for(let e of this.previous()){let t,s=this.toUrl(this.path(e.file)),r=e.root||Ki(e.file);!1===this.mapOpts.sourcesContent?(t=new ji(e.text),t.sourcesContent&&(t.sourcesContent=null)):t=e.consumer(),this.map.applySourceMap(t,s,this.toUrl(this.path(r)))}}clearAnnotation(){if(!1!==this.mapOpts.annotation)if(this.root){let e;for(let t=this.root.nodes.length-1;t>=0;t--)e=this.root.nodes[t],"comment"===e.type&&0===e.text.indexOf("# sourceMappingURL=")&&this.root.removeChild(t)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),Ji&&qi&&this.isMap())return this.generateMap();{let e="";return this.stringify(this.root,t=>{e+=t}),[e]}}generateMap(){if(this.root)this.generateString();else if(1===this.previous().length){let e=this.previous()[0].consumer();e.file=this.outputFile(),this.map=Wi.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new Wi({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new Wi({file:this.outputFile(),ignoreInvalidMapping:!0});let e,t,s=1,r=1,i="<no source>",n={generated:{column:0,line:0},original:{column:0,line:0},source:""};this.stringify(this.root,(o,a,l)=>{if(this.css+=o,a&&"end"!==l&&(n.generated.line=s,n.generated.column=r-1,a.source&&a.source.start?(n.source=this.sourcePath(a),n.original.line=a.source.start.line,n.original.column=a.source.start.column-1,this.map.addMapping(n)):(n.source=i,n.original.line=1,n.original.column=0,this.map.addMapping(n))),e=o.match(/\n/g),e?(s+=e.length,t=o.lastIndexOf("\n"),r=o.length-t):r+=o.length,a&&"start"!==l){let e=a.parent||{raws:{}};("decl"===a.type||"atrule"===a.type&&!a.nodes)&&a===e.last&&!e.raws.semicolon||(a.source&&a.source.end?(n.source=this.sourcePath(a),n.original.line=a.source.end.line,n.original.column=a.source.end.column-1,n.generated.line=s,n.generated.column=r-2,this.map.addMapping(n)):(n.source=i,n.original.line=1,n.original.column=0,n.generated.line=s,n.generated.column=r-1,this.map.addMapping(n)))}})}isAnnotation(){return!!this.isInline()||(void 0!==this.mapOpts.annotation?this.mapOpts.annotation:!this.previous().length||this.previous().some(e=>e.annotation))}isInline(){if(void 0!==this.mapOpts.inline)return this.mapOpts.inline;let e=this.mapOpts.annotation;return(void 0===e||!0===e)&&(!this.previous().length||this.previous().some(e=>e.inline))}isMap(){return void 0!==this.opts.map?!!this.opts.map:this.previous().length>0}isSourcesContent(){return void 0!==this.mapOpts.sourcesContent?this.mapOpts.sourcesContent:!this.previous().length||this.previous().some(e=>e.withContent())}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(e){if(this.mapOpts.absolute)return e;if(60===e.charCodeAt(0))return e;if(/^\w+:\/\//.test(e))return e;let t=this.memoizedPaths.get(e);if(t)return t;let s=this.opts.to?Ki(this.opts.to):".";"string"==typeof this.mapOpts.annotation&&(s=Ki(Vi(s,this.mapOpts.annotation)));let r=Gi(s,e);return this.memoizedPaths.set(e,r),r}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(e=>{if(e.source&&e.source.input.map){let t=e.source.input.map;this.previousMaps.includes(t)||this.previousMaps.push(t)}});else{let e=new Zi(this.originalCSS,this.opts);e.map&&this.previousMaps.push(e.map)}return this.previousMaps}setSourcesContent(){let e={};if(this.root)this.root.walk(t=>{if(t.source){let s=t.source.input.from;if(s&&!e[s]){e[s]=!0;let r=this.usesFileUrls?this.toFileUrl(s):this.toUrl(this.path(s));this.map.setSourceContent(r,t.source.input.css)}}});else if(this.css){let e=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(e,this.css)}}sourcePath(e){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(e.source.input.from):this.toUrl(this.path(e.source.input.from))}toBase64(e){return Buffer?Buffer.from(e).toString("base64"):window.btoa(unescape(encodeURIComponent(e)))}toFileUrl(e){let t=this.memoizedFileURLs.get(e);if(t)return t;if(Yi){let t=Yi(e).toString();return this.memoizedFileURLs.set(e,t),t}throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(e){let t=this.memoizedURLs.get(e);if(t)return t;"\\"===Hi&&(e=e.replace(/\\/g,"/"));let s=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,s),s}};let Qi=mi,en=class extends Qi{constructor(e){super(e),this.type="comment"}};var tn=en;en.default=en;let sn,rn,nn,on,{isClean:an,my:ln}=ei,cn=yi,hn=tn,un=mi;function dn(e){return e.map(e=>(e.nodes&&(e.nodes=dn(e.nodes)),delete e.source,e))}function pn(e){if(e[an]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)pn(t)}let mn=class e extends un{append(...e){for(let t of e){let e=this.normalize(t,this.last);for(let t of e)this.proxyOf.nodes.push(t)}return this.markDirty(),this}cleanRaws(e){if(super.cleanRaws(e),this.nodes)for(let t of this.nodes)t.cleanRaws(e)}each(e){if(!this.proxyOf.nodes)return;let t,s,r=this.getIterator();for(;this.indexes[r]<this.proxyOf.nodes.length&&(t=this.indexes[r],s=e(this.proxyOf.nodes[t],t),!1!==s);)this.indexes[r]+=1;return delete this.indexes[r],s}every(e){return this.nodes.every(e)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let e=this.lastEach;return this.indexes[e]=0,e}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:e[t]?"each"===t||"string"==typeof t&&t.startsWith("walk")?(...s)=>e[t](...s.map(e=>"function"==typeof e?(t,s)=>e(t.toProxy(),s):e)):"every"===t||"some"===t?s=>e[t]((e,...t)=>s(e.toProxy(),...t)):"root"===t?()=>e.root().toProxy():"nodes"===t?e.nodes.map(e=>e.toProxy()):"first"===t||"last"===t?e[t].toProxy():e[t]:e[t],set:(e,t,s)=>(e[t]===s||(e[t]=s,"name"!==t&&"params"!==t&&"selector"!==t||e.markDirty()),!0)}}index(e){return"number"==typeof e?e:(e.proxyOf&&(e=e.proxyOf),this.proxyOf.nodes.indexOf(e))}insertAfter(e,t){let s,r=this.index(e),i=this.normalize(t,this.proxyOf.nodes[r]).reverse();r=this.index(e);for(let e of i)this.proxyOf.nodes.splice(r+1,0,e);for(let e in this.indexes)s=this.indexes[e],r<s&&(this.indexes[e]=s+i.length);return this.markDirty(),this}insertBefore(e,t){let s,r=this.index(e),i=0===r&&"prepend",n=this.normalize(t,this.proxyOf.nodes[r],i).reverse();r=this.index(e);for(let e of n)this.proxyOf.nodes.splice(r,0,e);for(let e in this.indexes)s=this.indexes[e],r<=s&&(this.indexes[e]=s+n.length);return this.markDirty(),this}normalize(t,s){if("string"==typeof t)t=dn(sn(t).nodes);else if(void 0===t)t=[];else if(Array.isArray(t)){t=t.slice(0);for(let e of t)e.parent&&e.parent.removeChild(e,"ignore")}else if("root"===t.type&&"document"!==this.type){t=t.nodes.slice(0);for(let e of t)e.parent&&e.parent.removeChild(e,"ignore")}else if(t.type)t=[t];else if(t.prop){if(void 0===t.value)throw new Error("Value field is missed in node creation");"string"!=typeof t.value&&(t.value=String(t.value)),t=[new cn(t)]}else if(t.selector)t=[new rn(t)];else if(t.name)t=[new nn(t)];else{if(!t.text)throw new Error("Unknown node type in node creation");t=[new hn(t)]}return t.map(t=>(t[ln]||e.rebuild(t),(t=t.proxyOf).parent&&t.parent.removeChild(t),t[an]&&pn(t),void 0===t.raws.before&&s&&void 0!==s.raws.before&&(t.raws.before=s.raws.before.replace(/\S/g,"")),t.parent=this.proxyOf,t))}prepend(...e){e=e.reverse();for(let t of e){let e=this.normalize(t,this.first,"prepend").reverse();for(let t of e)this.proxyOf.nodes.unshift(t);for(let t in this.indexes)this.indexes[t]=this.indexes[t]+e.length}return this.markDirty(),this}push(e){return e.parent=this,this.proxyOf.nodes.push(e),this}removeAll(){for(let e of this.proxyOf.nodes)e.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(e){let t;e=this.index(e),this.proxyOf.nodes[e].parent=void 0,this.proxyOf.nodes.splice(e,1);for(let s in this.indexes)t=this.indexes[s],t>=e&&(this.indexes[s]=t-1);return this.markDirty(),this}replaceValues(e,t,s){return s||(s=t,t={}),this.walkDecls(r=>{t.props&&!t.props.includes(r.prop)||t.fast&&!r.value.includes(t.fast)||(r.value=r.value.replace(e,s))}),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each((t,s)=>{let r;try{r=e(t,s)}catch(e){throw t.addToError(e)}return!1!==r&&t.walk&&(r=t.walk(e)),r})}walkAtRules(e,t){return t?e instanceof RegExp?this.walk((s,r)=>{if("atrule"===s.type&&e.test(s.name))return t(s,r)}):this.walk((s,r)=>{if("atrule"===s.type&&s.name===e)return t(s,r)}):(t=e,this.walk((e,s)=>{if("atrule"===e.type)return t(e,s)}))}walkComments(e){return this.walk((t,s)=>{if("comment"===t.type)return e(t,s)})}walkDecls(e,t){return t?e instanceof RegExp?this.walk((s,r)=>{if("decl"===s.type&&e.test(s.prop))return t(s,r)}):this.walk((s,r)=>{if("decl"===s.type&&s.prop===e)return t(s,r)}):(t=e,this.walk((e,s)=>{if("decl"===e.type)return t(e,s)}))}walkRules(e,t){return t?e instanceof RegExp?this.walk((s,r)=>{if("rule"===s.type&&e.test(s.selector))return t(s,r)}):this.walk((s,r)=>{if("rule"===s.type&&s.selector===e)return t(s,r)}):(t=e,this.walk((e,s)=>{if("rule"===e.type)return t(e,s)}))}get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}};mn.registerParse=e=>{sn=e},mn.registerRule=e=>{rn=e},mn.registerAtRule=e=>{nn=e},mn.registerRoot=e=>{on=e};var fn=mn;mn.default=mn,mn.rebuild=e=>{"atrule"===e.type?Object.setPrototypeOf(e,nn.prototype):"rule"===e.type?Object.setPrototypeOf(e,rn.prototype):"decl"===e.type?Object.setPrototypeOf(e,cn.prototype):"comment"===e.type?Object.setPrototypeOf(e,hn.prototype):"root"===e.type&&Object.setPrototypeOf(e,on.prototype),e[ln]=!0,e.nodes&&e.nodes.forEach(e=>{mn.rebuild(e)})};let gn,yn,wn=fn,vn=class extends wn{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(e={}){return new gn(new yn,this,e).stringify()}};vn.registerLazyResult=e=>{gn=e},vn.registerProcessor=e=>{yn=e};var Sn=vn;vn.default=vn;let bn={};var Cn=function(e){bn[e]||(bn[e]=!0,"undefined"!=typeof console&&console.warn&&console.warn(e))};let kn=class{constructor(e,t={}){if(this.type="warning",this.text=e,t.node&&t.node.source){let e=t.node.rangeBy(t);this.line=e.start.line,this.column=e.start.column,this.endLine=e.end.line,this.endColumn=e.end.column}for(let e in t)this[e]=t[e]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}};var In=kn;kn.default=kn;let En=In,Tn=class{constructor(e,t,s){this.processor=e,this.messages=[],this.root=t,this.opts=s,this.css=void 0,this.map=void 0}toString(){return this.css}warn(e,t={}){t.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(t.plugin=this.lastPlugin.postcssPlugin);let s=new En(e,t);return this.messages.push(s),s}warnings(){return this.messages.filter(e=>"warning"===e.type)}get content(){return this.css}};var xn=Tn;Tn.default=Tn;const Mn="'".charCodeAt(0),_n='"'.charCodeAt(0),On="\\".charCodeAt(0),An="/".charCodeAt(0),Rn="\n".charCodeAt(0),Dn=" ".charCodeAt(0),Pn="\f".charCodeAt(0),Ln="\t".charCodeAt(0),Nn="\r".charCodeAt(0),Fn="[".charCodeAt(0),Un="]".charCodeAt(0),Bn="(".charCodeAt(0),$n=")".charCodeAt(0),zn="{".charCodeAt(0),jn="}".charCodeAt(0),Wn=";".charCodeAt(0),Kn="*".charCodeAt(0),Gn=":".charCodeAt(0),Vn="@".charCodeAt(0),Hn=/[\t\n\f\r "#'()/;[\\\]{}]/g,Yn=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,Zn=/.[\r\n"'(/\\]/,qn=/[\da-f]/i;let Jn=fn,Xn=class extends Jn{constructor(e){super(e),this.type="atrule"}append(...e){return this.proxyOf.nodes||(this.nodes=[]),super.append(...e)}prepend(...e){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...e)}};var Qn=Xn;Xn.default=Xn,Jn.registerAtRule(Xn);let eo,to,so=fn,ro=class extends so{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}normalize(e,t,s){let r=super.normalize(e);if(t)if("prepend"===s)this.nodes.length>1?t.raws.before=this.nodes[1].raws.before:delete t.raws.before;else if(this.first!==t)for(let e of r)e.raws.before=t.raws.before;return r}removeChild(e,t){let s=this.index(e);return!t&&0===s&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[s].raws.before),super.removeChild(e)}toResult(e={}){return new eo(new to,this,e).stringify()}};ro.registerLazyResult=e=>{eo=e},ro.registerProcessor=e=>{to=e};var io=ro;ro.default=ro,so.registerRoot(ro);let no={comma:e=>no.split(e,[","],!0),space:e=>no.split(e,[" ","\n","\t"]),split(e,t,s){let r=[],i="",n=!1,o=0,a=!1,l="",c=!1;for(let s of e)c?c=!1:"\\"===s?c=!0:a?s===l&&(a=!1):'"'===s||"'"===s?(a=!0,l=s):"("===s?o+=1:")"===s?o>0&&(o-=1):0===o&&t.includes(s)&&(n=!0),n?(""!==i&&r.push(i.trim()),i="",n=!1):i+=s;return(s||""!==i)&&r.push(i.trim()),r}};var oo=no;no.default=no;let ao=fn,lo=oo,co=class extends ao{constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return lo.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\s*/):null,s=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(s)}};var ho=co;co.default=co,ao.registerRule(co);let uo=yi,po=function(e,t={}){let s,r,i,n,o,a,l,c,h,u,d=e.css.valueOf(),p=t.ignoreErrors,m=d.length,f=0,g=[],y=[];function w(t){throw e.error("Unclosed "+t,f)}return{back:function(e){y.push(e)},endOfFile:function(){return 0===y.length&&f>=m},nextToken:function(e){if(y.length)return y.pop();if(f>=m)return;let t=!!e&&e.ignoreUnclosed;switch(s=d.charCodeAt(f),s){case Rn:case Dn:case Ln:case Nn:case Pn:r=f;do{r+=1,s=d.charCodeAt(r)}while(s===Dn||s===Rn||s===Ln||s===Nn||s===Pn);u=["space",d.slice(f,r)],f=r-1;break;case Fn:case Un:case zn:case jn:case Gn:case Wn:case $n:{let e=String.fromCharCode(s);u=[e,e,f];break}case Bn:if(c=g.length?g.pop()[1]:"",h=d.charCodeAt(f+1),"url"===c&&h!==Mn&&h!==_n&&h!==Dn&&h!==Rn&&h!==Ln&&h!==Pn&&h!==Nn){r=f;do{if(a=!1,r=d.indexOf(")",r+1),-1===r){if(p||t){r=f;break}w("bracket")}for(l=r;d.charCodeAt(l-1)===On;)l-=1,a=!a}while(a);u=["brackets",d.slice(f,r+1),f,r],f=r}else r=d.indexOf(")",f+1),n=d.slice(f,r+1),-1===r||Zn.test(n)?u=["(","(",f]:(u=["brackets",n,f,r],f=r);break;case Mn:case _n:i=s===Mn?"'":'"',r=f;do{if(a=!1,r=d.indexOf(i,r+1),-1===r){if(p||t){r=f+1;break}w("string")}for(l=r;d.charCodeAt(l-1)===On;)l-=1,a=!a}while(a);u=["string",d.slice(f,r+1),f,r],f=r;break;case Vn:Hn.lastIndex=f+1,Hn.test(d),r=0===Hn.lastIndex?d.length-1:Hn.lastIndex-2,u=["at-word",d.slice(f,r+1),f,r],f=r;break;case On:for(r=f,o=!0;d.charCodeAt(r+1)===On;)r+=1,o=!o;if(s=d.charCodeAt(r+1),o&&s!==An&&s!==Dn&&s!==Rn&&s!==Ln&&s!==Nn&&s!==Pn&&(r+=1,qn.test(d.charAt(r)))){for(;qn.test(d.charAt(r+1));)r+=1;d.charCodeAt(r+1)===Dn&&(r+=1)}u=["word",d.slice(f,r+1),f,r],f=r;break;default:s===An&&d.charCodeAt(f+1)===Kn?(r=d.indexOf("*/",f+2)+1,0===r&&(p||t?r=d.length:w("comment")),u=["comment",d.slice(f,r+1),f,r],f=r):(Yn.lastIndex=f+1,Yn.test(d),r=0===Yn.lastIndex?d.length-1:Yn.lastIndex-2,u=["word",d.slice(f,r+1),f,r],g.push(u),f=r)}return f++,u},position:function(){return f}}},mo=tn,fo=Qn,go=io,yo=ho;const wo={empty:!0,space:!0};let vo=fn,So=class{constructor(e){this.input=e,this.root=new go,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}atrule(e){let t,s,r,i=new fo;i.name=e[1].slice(1),""===i.name&&this.unnamedAtrule(i,e),this.init(i,e[2]);let n=!1,o=!1,a=[],l=[];for(;!this.tokenizer.endOfFile();){if(t=(e=this.tokenizer.nextToken())[0],"("===t||"["===t?l.push("("===t?")":"]"):"{"===t&&l.length>0?l.push("}"):t===l[l.length-1]&&l.pop(),0===l.length){if(";"===t){i.source.end=this.getPosition(e[2]),i.source.end.offset++,this.semicolon=!0;break}if("{"===t){o=!0;break}if("}"===t){if(a.length>0){for(r=a.length-1,s=a[r];s&&"space"===s[0];)s=a[--r];s&&(i.source.end=this.getPosition(s[3]||s[2]),i.source.end.offset++)}this.end(e);break}a.push(e)}else a.push(e);if(this.tokenizer.endOfFile()){n=!0;break}}i.raws.between=this.spacesAndCommentsFromEnd(a),a.length?(i.raws.afterName=this.spacesAndCommentsFromStart(a),this.raw(i,"params",a),n&&(e=a[a.length-1],i.source.end=this.getPosition(e[3]||e[2]),i.source.end.offset++,this.spaces=i.raws.between,i.raws.between="")):(i.raws.afterName="",i.params=""),o&&(i.nodes=[],this.current=i)}checkMissedSemicolon(e){let t=this.colon(e);if(!1===t)return;let s,r=0;for(let i=t-1;i>=0&&(s=e[i],"space"===s[0]||(r+=1,2!==r));i--);throw this.input.error("Missed semicolon","word"===s[0]?s[3]+1:s[2])}colon(e){let t,s,r,i=0;for(let[n,o]of e.entries()){if(t=o,s=t[0],"("===s&&(i+=1),")"===s&&(i-=1),0===i&&":"===s){if(r){if("word"===r[0]&&"progid"===r[1])continue;return n}this.doubleColon(t)}r=t}return!1}comment(e){let t=new mo;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;let s=e[1].slice(2,-2);if(/^\s*$/.test(s))t.text="",t.raws.left=s,t.raws.right="";else{let e=s.match(/^(\s*)([^]*\S)(\s*)$/);t.text=e[2],t.raws.left=e[1],t.raws.right=e[3]}}createTokenizer(){this.tokenizer=po(this.input)}decl(e,t){let s=new uo;this.init(s,e[0][2]);let r,i=e[e.length-1];for(";"===i[0]&&(this.semicolon=!0,e.pop()),s.source.end=this.getPosition(i[3]||i[2]||function(e){for(let t=e.length-1;t>=0;t--){let s=e[t],r=s[3]||s[2];if(r)return r}}(e)),s.source.end.offset++;"word"!==e[0][0];)1===e.length&&this.unknownWord(e),s.raws.before+=e.shift()[1];for(s.source.start=this.getPosition(e[0][2]),s.prop="";e.length;){let t=e[0][0];if(":"===t||"space"===t||"comment"===t)break;s.prop+=e.shift()[1]}for(s.raws.between="";e.length;){if(r=e.shift(),":"===r[0]){s.raws.between+=r[1];break}"word"===r[0]&&/\w/.test(r[1])&&this.unknownWord([r]),s.raws.between+=r[1]}"_"!==s.prop[0]&&"*"!==s.prop[0]||(s.raws.before+=s.prop[0],s.prop=s.prop.slice(1));let n,o=[];for(;e.length&&(n=e[0][0],"space"===n||"comment"===n);)o.push(e.shift());this.precheckMissedSemicolon(e);for(let t=e.length-1;t>=0;t--){if(r=e[t],"!important"===r[1].toLowerCase()){s.important=!0;let r=this.stringFrom(e,t);r=this.spacesFromEnd(e)+r," !important"!==r&&(s.raws.important=r);break}if("important"===r[1].toLowerCase()){let r=e.slice(0),i="";for(let e=t;e>0;e--){let t=r[e][0];if(0===i.trim().indexOf("!")&&"space"!==t)break;i=r.pop()[1]+i}0===i.trim().indexOf("!")&&(s.important=!0,s.raws.important=i,e=r)}if("space"!==r[0]&&"comment"!==r[0])break}e.some(e=>"space"!==e[0]&&"comment"!==e[0])&&(s.raws.between+=o.map(e=>e[1]).join(""),o=[]),this.raw(s,"value",o.concat(e),t),s.value.includes(":")&&!t&&this.checkMissedSemicolon(e)}doubleColon(e){throw this.input.error("Double colon",{offset:e[2]},{offset:e[2]+e[1].length})}emptyRule(e){let t=new yo;this.init(t,e[2]),t.selector="",t.raws.between="",this.current=t}end(e){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(e[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(e)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(e){if(this.spaces+=e[1],this.current.nodes){let e=this.current.nodes[this.current.nodes.length-1];e&&"rule"===e.type&&!e.raws.ownSemicolon&&(e.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(e){let t=this.input.fromOffset(e);return{column:t.col,line:t.line,offset:e}}init(e,t){this.current.push(e),e.source={input:this.input,start:this.getPosition(t)},e.raws.before=this.spaces,this.spaces="","comment"!==e.type&&(this.semicolon=!1)}other(e){let t=!1,s=null,r=!1,i=null,n=[],o=e[1].startsWith("--"),a=[],l=e;for(;l;){if(s=l[0],a.push(l),"("===s||"["===s)i||(i=l),n.push("("===s?")":"]");else if(o&&r&&"{"===s)i||(i=l),n.push("}");else if(0===n.length){if(";"===s){if(r)return void this.decl(a,o);break}if("{"===s)return void this.rule(a);if("}"===s){this.tokenizer.back(a.pop()),t=!0;break}":"===s&&(r=!0)}else s===n[n.length-1]&&(n.pop(),0===n.length&&(i=null));l=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),n.length>0&&this.unclosedBracket(i),t&&r){if(!o)for(;a.length&&(l=a[a.length-1][0],"space"===l||"comment"===l);)this.tokenizer.back(a.pop());this.decl(a,o)}else this.unknownWord(a)}parse(){let e;for(;!this.tokenizer.endOfFile();)switch(e=this.tokenizer.nextToken(),e[0]){case"space":this.spaces+=e[1];break;case";":this.freeSemicolon(e);break;case"}":this.end(e);break;case"comment":this.comment(e);break;case"at-word":this.atrule(e);break;case"{":this.emptyRule(e);break;default:this.other(e)}this.endFile()}precheckMissedSemicolon(){}raw(e,t,s,r){let i,n,o,a,l=s.length,c="",h=!0;for(let e=0;e<l;e+=1)i=s[e],n=i[0],"space"!==n||e!==l-1||r?"comment"===n?(a=s[e-1]?s[e-1][0]:"empty",o=s[e+1]?s[e+1][0]:"empty",wo[a]||wo[o]||","===c.slice(-1)?h=!1:c+=i[1]):c+=i[1]:h=!1;if(!h){let r=s.reduce((e,t)=>e+t[1],"");e.raws[t]={raw:r,value:c}}e[t]=c}rule(e){e.pop();let t=new yo;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t}spacesAndCommentsFromEnd(e){let t,s="";for(;e.length&&(t=e[e.length-1][0],"space"===t||"comment"===t);)s=e.pop()[1]+s;return s}spacesAndCommentsFromStart(e){let t,s="";for(;e.length&&(t=e[0][0],"space"===t||"comment"===t);)s+=e.shift()[1];return s}spacesFromEnd(e){let t,s="";for(;e.length&&(t=e[e.length-1][0],"space"===t);)s=e.pop()[1]+s;return s}stringFrom(e,t){let s="";for(let r=t;r<e.length;r++)s+=e[r][1];return e.splice(t,e.length-t),s}unclosedBlock(){let e=this.current.source.start;throw this.input.error("Unclosed block",e.line,e.column)}unclosedBracket(e){throw this.input.error("Unclosed bracket",{offset:e[2]},{offset:e[2]+1})}unexpectedClose(e){throw this.input.error("Unexpected }",{offset:e[2]},{offset:e[2]+1})}unknownWord(e){throw this.input.error("Unknown word",{offset:e[0][2]},{offset:e[0][2]+e[0][1].length})}unnamedAtrule(e,t){throw this.input.error("At-rule without name",{offset:t[2]},{offset:t[2]+t[1].length})}},bo=zi;function Co(e,t){let s=new bo(e,t),r=new So(s);try{r.parse()}catch(e){throw"production"!==process.env.NODE_ENV&&"CssSyntaxError"===e.name&&t&&t.from&&(/\.scss$/i.test(t.from)?e.message+="\nYou tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser":/\.sass/i.test(t.from)?e.message+="\nYou tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser":/\.less$/i.test(t.from)&&(e.message+="\nYou tried to parse Less with the standard CSS parser; try again with the postcss-less parser")),e}return r.root}var ko=Co;Co.default=Co,vo.registerParse(Co);let{isClean:Io,my:Eo}=ei,To=Xi,xo=oi,Mo=fn,_o=Sn,Oo=Cn,Ao=xn,Ro=ko,Do=io;const Po={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},Lo={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},No={Once:!0,postcssPlugin:!0,prepare:!0};function Fo(e){return"object"==typeof e&&"function"==typeof e.then}function Uo(e){let t=!1,s=Po[e.type];return"decl"===e.type?t=e.prop.toLowerCase():"atrule"===e.type&&(t=e.name.toLowerCase()),t&&e.append?[s,s+"-"+t,0,s+"Exit",s+"Exit-"+t]:t?[s,s+"-"+t,s+"Exit",s+"Exit-"+t]:e.append?[s,0,s+"Exit"]:[s,s+"Exit"]}function Bo(e){let t;return t="document"===e.type?["Document",0,"DocumentExit"]:"root"===e.type?["Root",0,"RootExit"]:Uo(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function $o(e){return e[Io]=!1,e.nodes&&e.nodes.forEach(e=>$o(e)),e}let zo={},jo=class e{constructor(t,s,r){let i;if(this.stringified=!1,this.processed=!1,"object"!=typeof s||null===s||"root"!==s.type&&"document"!==s.type)if(s instanceof e||s instanceof Ao)i=$o(s.root),s.map&&(void 0===r.map&&(r.map={}),r.map.inline||(r.map.inline=!1),r.map.prev=s.map);else{let e=Ro;r.syntax&&(e=r.syntax.parse),r.parser&&(e=r.parser),e.parse&&(e=e.parse);try{i=e(s,r)}catch(e){this.processed=!0,this.error=e}i&&!i[Eo]&&Mo.rebuild(i)}else i=$o(s);this.result=new Ao(t,i,r),this.helpers={...zo,postcss:zo,result:this.result},this.plugins=this.processor.plugins.map(e=>"object"==typeof e&&e.prepare?{...e,...e.prepare(this.result)}:e)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(e,t){let s=this.result.lastPlugin;try{if(t&&t.addToError(e),this.error=e,"CssSyntaxError"!==e.name||e.plugin){if(s.postcssVersion&&"production"!==process.env.NODE_ENV){let e=s.postcssPlugin,t=s.postcssVersion,r=this.result.processor.version,i=t.split("."),n=r.split(".");(i[0]!==n[0]||parseInt(i[1])>parseInt(n[1]))&&console.error("Unknown error from PostCSS plugin. Your current PostCSS version is "+r+", but "+e+" uses "+t+". Perhaps this is the source of the error below.")}}else e.plugin=s.postcssPlugin,e.setMessage()}catch(e){console&&console.error&&console.error(e)}return e}prepareVisitors(){this.listeners={};let e=(e,t,s)=>{this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push([e,s])};for(let t of this.plugins)if("object"==typeof t)for(let s in t){if(!Lo[s]&&/^[A-Z]/.test(s))throw new Error(`Unknown event ${s} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!No[s])if("object"==typeof t[s])for(let r in t[s])e(t,"*"===r?s:s+"-"+r.toLowerCase(),t[s][r]);else"function"==typeof t[s]&&e(t,s,t[s])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let e=0;e<this.plugins.length;e++){let t=this.plugins[e],s=this.runOnRoot(t);if(Fo(s))try{await s}catch(e){throw this.handleError(e)}}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[Io];){e[Io]=!0;let t=[Bo(e)];for(;t.length>0;){let e=this.visitTick(t);if(Fo(e))try{await e}catch(e){let s=t[t.length-1].node;throw this.handleError(e,s)}}}if(this.listeners.OnceExit)for(let[t,s]of this.listeners.OnceExit){this.result.lastPlugin=t;try{if("document"===e.type){let t=e.nodes.map(e=>s(e,this.helpers));await Promise.all(t)}else await s(e,this.helpers)}catch(e){throw this.handleError(e)}}}return this.processed=!0,this.stringify()}runOnRoot(e){this.result.lastPlugin=e;try{if("object"==typeof e&&e.Once){if("document"===this.result.root.type){let t=this.result.root.nodes.map(t=>e.Once(t,this.helpers));return Fo(t[0])?Promise.all(t):t}return e.Once(this.result.root,this.helpers)}if("function"==typeof e)return e(this.result.root,this.result)}catch(e){throw this.handleError(e)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let e=this.result.opts,t=xo;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let s=new To(t,this.result.root,this.result.opts).generate();return this.result.css=s[0],this.result.map=s[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let e of this.plugins){if(Fo(this.runOnRoot(e)))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[Io];)e[Io]=!0,this.walkSync(e);if(this.listeners.OnceExit)if("document"===e.type)for(let t of e.nodes)this.visitSync(this.listeners.OnceExit,t);else this.visitSync(this.listeners.OnceExit,e)}return this.result}then(e,t){return"production"!==process.env.NODE_ENV&&("from"in this.opts||Oo("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(e,t)}toString(){return this.css}visitSync(e,t){for(let[s,r]of e){let e;this.result.lastPlugin=s;try{e=r(t,this.helpers)}catch(e){throw this.handleError(e,t.proxyOf)}if("root"!==t.type&&"document"!==t.type&&!t.parent)return!0;if(Fo(e))throw this.getAsyncError()}}visitTick(e){let t=e[e.length-1],{node:s,visitors:r}=t;if("root"!==s.type&&"document"!==s.type&&!s.parent)return void e.pop();if(r.length>0&&t.visitorIndex<r.length){let[e,i]=r[t.visitorIndex];t.visitorIndex+=1,t.visitorIndex===r.length&&(t.visitors=[],t.visitorIndex=0),this.result.lastPlugin=e;try{return i(s.toProxy(),this.helpers)}catch(e){throw this.handleError(e,s)}}if(0!==t.iterator){let r,i=t.iterator;for(;r=s.nodes[s.indexes[i]];)if(s.indexes[i]+=1,!r[Io])return r[Io]=!0,void e.push(Bo(r));t.iterator=0,delete s.indexes[i]}let i=t.events;for(;t.eventIndex<i.length;){let e=i[t.eventIndex];if(t.eventIndex+=1,0===e)return void(s.nodes&&s.nodes.length&&(s[Io]=!0,t.iterator=s.getIterator()));if(this.listeners[e])return void(t.visitors=this.listeners[e])}e.pop()}walkSync(e){e[Io]=!0;let t=Uo(e);for(let s of t)if(0===s)e.nodes&&e.each(e=>{e[Io]||this.walkSync(e)});else{let t=this.listeners[s];if(t&&this.visitSync(t,e.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}};jo.registerPostcss=e=>{zo=e};var Wo=jo;jo.default=jo,Do.registerLazyResult(jo),_o.registerLazyResult(jo);let Ko=Xi,Go=oi,Vo=Cn,Ho=ko;const Yo=xn;let Zo=class{constructor(e,t,s){let r;t=t.toString(),this.stringified=!1,this._processor=e,this._css=t,this._opts=s,this._map=void 0;let i=Go;this.result=new Yo(this._processor,r,this._opts),this.result.css=t;let n=this;Object.defineProperty(this.result,"root",{get:()=>n.root});let o=new Ko(i,r,this._opts,t);if(o.isMap()){let[e,t]=o.generate();e&&(this.result.css=e),t&&(this.result.map=t)}else o.clearAnnotation(),this.result.css=o.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}sync(){if(this.error)throw this.error;return this.result}then(e,t){return"production"!==process.env.NODE_ENV&&("from"in this._opts||Vo("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(e,t)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let e,t=Ho;try{e=t(this._css,this._opts)}catch(e){this.error=e}if(this.error)throw this.error;return this._root=e,e}get[Symbol.toStringTag](){return"NoWorkResult"}};var qo=Zo;Zo.default=Zo;let Jo=qo,Xo=Wo,Qo=Sn,ea=io,ta=class{constructor(e=[]){this.version="8.4.38",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let s of e)if(!0===s.postcss?s=s():s.postcss&&(s=s.postcss),"object"==typeof s&&Array.isArray(s.plugins))t=t.concat(s.plugins);else if("object"==typeof s&&s.postcssPlugin)t.push(s);else if("function"==typeof s)t.push(s);else{if("object"!=typeof s||!s.parse&&!s.stringify)throw new Error(s+" is not a PostCSS plugin");if("production"!==process.env.NODE_ENV)throw new Error("PostCSS syntaxes cannot be used as plugins. Instead, please use one of the syntax/parser/stringifier options as outlined in your PostCSS runner documentation.")}return t}process(e,t={}){return this.plugins.length||t.parser||t.stringifier||t.syntax?new Xo(this,e,t):new Jo(this,e,t)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}};var sa=ta;ta.default=ta,ea.registerProcessor(ta),Qo.registerProcessor(ta);let ra=yi,ia=Ti,na=tn,oa=Qn,aa=zi,la=io,ca=ho;function ha(e,t){if(Array.isArray(e))return e.map(e=>ha(e));let{inputs:s,...r}=e;if(s){t=[];for(let e of s){let s={...e,__proto__:aa.prototype};s.map&&(s.map={...s.map,__proto__:ia.prototype}),t.push(s)}}if(r.nodes&&(r.nodes=e.nodes.map(e=>ha(e,t))),r.source){let{inputId:e,...s}=r.source;r.source=s,null!=e&&(r.source.input=t[e])}if("root"===r.type)return new la(r);if("decl"===r.type)return new ra(r);if("rule"===r.type)return new ca(r);if("comment"===r.type)return new na(r);if("atrule"===r.type)return new oa(r);throw new Error("Unknown node type: "+e.type)}var ua=ha;ha.default=ha;let da=Qr,pa=yi,ma=Wo,fa=fn,ga=sa,ya=oi,wa=ua,va=Sn,Sa=In,ba=tn,Ca=Qn,ka=xn,Ia=zi,Ea=ko,Ta=oo,xa=ho,Ma=io,_a=mi;function Oa(...e){return 1===e.length&&Array.isArray(e[0])&&(e=e[0]),new ga(e)}Oa.plugin=function(e,t){let s,r=!1;function i(...s){console&&console.warn&&!r&&(r=!0,console.warn(e+": postcss.plugin was deprecated. Migration guide:\nhttps://evilmartians.com/chronicles/postcss-8-plugin-migration"),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(e+": ι‡Œι’ postcss.plugin 蒫弃用. θΏη§»ζŒ‡ε—:\nhttps://www.w3ctech.com/topic/2226"));let i=t(...s);return i.postcssPlugin=e,i.postcssVersion=(new ga).version,i}return Object.defineProperty(i,"postcss",{get:()=>(s||(s=i()),s)}),i.process=function(e,t,s){return Oa([i(s)]).process(e,t)},i},Oa.stringify=ya,Oa.parse=Ea,Oa.fromJSON=wa,Oa.list=Ta,Oa.comment=e=>new ba(e),Oa.atRule=e=>new Ca(e),Oa.decl=e=>new pa(e),Oa.rule=e=>new xa(e),Oa.root=e=>new Ma(e),Oa.document=e=>new va(e),Oa.CssSyntaxError=da,Oa.Declaration=pa,Oa.Container=fa,Oa.Processor=ga,Oa.Document=va,Oa.Comment=ba,Oa.Warning=Sa,Oa.AtRule=Ca,Oa.Result=ka,Oa.Input=Ia,Oa.Rule=xa,Oa.Root=Ma,Oa.Node=_a,ma.registerPostcss(Oa);var Aa=Oa;Oa.default=Oa;const Ra=Wr(Aa);Ra.stringify,Ra.fromJSON,Ra.plugin,Ra.parse,Ra.list,Ra.document,Ra.comment,Ra.atRule,Ra.rule,Ra.decl,Ra.root,Ra.CssSyntaxError,Ra.Declaration,Ra.Container,Ra.Processor,Ra.Document,Ra.Comment,Ra.Warning,Ra.AtRule,Ra.Result,Ra.Input,Ra.Rule,Ra.Root,Ra.Node;class Da{constructor(...e){jr(this,"parentElement",null),jr(this,"parentNode",null),jr(this,"ownerDocument"),jr(this,"firstChild",null),jr(this,"lastChild",null),jr(this,"previousSibling",null),jr(this,"nextSibling",null),jr(this,"ELEMENT_NODE",1),jr(this,"TEXT_NODE",3),jr(this,"nodeType"),jr(this,"nodeName"),jr(this,"RRNodeType")}get childNodes(){const e=[];let t=this.firstChild;for(;t;)e.push(t),t=t.nextSibling;return e}contains(e){if(!(e instanceof Da))return!1;if(e.ownerDocument!==this.ownerDocument)return!1;if(e===this)return!0;for(;e.parentNode;){if(e.parentNode===this)return!0;e=e.parentNode}return!1}appendChild(e){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(e,t){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}}const Pa={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},La={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Na={};function Fa(e){if(Na[e])return Na[e];const t=globalThis[e],s=t.prototype,r=e in Pa?Pa[e]:void 0,i=Boolean(r&&r.every(e=>{var t,r;return Boolean(null==(r=null==(t=Object.getOwnPropertyDescriptor(s,e))?void 0:t.get)?void 0:r.toString().includes("[native code]"))})),n=e in La?La[e]:void 0,o=Boolean(n&&n.every(e=>{var t;return"function"==typeof s[e]&&(null==(t=s[e])?void 0:t.toString().includes("[native code]"))}));if(i&&o&&!globalThis.Zone)return Na[e]=t.prototype,t.prototype;try{const r=document.createElement("iframe");document.body.appendChild(r);const i=r.contentWindow;if(!i)return t.prototype;const n=i[e].prototype;return document.body.removeChild(r),n?Na[e]=n:s}catch{return s}}const Ua={};function Ba(e,t,s){var r;const i=`${e}.${String(s)}`;if(Ua[i])return Ua[i].call(t);const n=Fa(e),o=null==(r=Object.getOwnPropertyDescriptor(n,s))?void 0:r.get;return o?(Ua[i]=o,o.call(t)):t[s]}const $a={};function za(e,t,s){const r=`${e}.${String(s)}`;if($a[r])return $a[r].bind(t);const i=Fa(e)[s];return"function"!=typeof i?t[s]:($a[r]=i,i.bind(t))}function ja(){return Fa("MutationObserver").constructor}function Wa(e,t,s){try{if(!(t in e))return()=>{};const r=e[t],i=s(r);return"function"==typeof i&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=i,()=>{e[t]=r}}catch{return()=>{}}}const Ka={ownerDocument:function(e){return Ba("Node",e,"ownerDocument")},childNodes:function(e){return Ba("Node",e,"childNodes")},parentNode:function(e){return Ba("Node",e,"parentNode")},parentElement:function(e){return Ba("Node",e,"parentElement")},textContent:function(e){return Ba("Node",e,"textContent")},contains:function(e,t){return za("Node",e,"contains")(t)},getRootNode:function(e){return za("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?Ba("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?Ba("Element",e,"shadowRoot"):null},querySelector:function(e,t){return Ba("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return Ba("Element",e,"querySelectorAll")(t)},mutationObserver:ja,patch:Wa};function Ga(e,t,s=document){const r={capture:!0,passive:!0};return s.addEventListener(e,t,r),()=>s.removeEventListener(e,t,r)}const Va="Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.";let Ha={map:{},getId:()=>(console.error(Va),-1),getNode:()=>(console.error(Va),null),removeNodeFromMap(){console.error(Va)},has:()=>(console.error(Va),!1),reset(){console.error(Va)}};function Ya(e,t,s={}){let r=null,i=0;return function(...n){const o=Date.now();i||!1!==s.leading||(i=o);const a=t-(o-i),l=this;a<=0||a>t?(r&&(clearTimeout(r),r=null),i=o,e.apply(l,n)):r||!1===s.trailing||(r=setTimeout(()=>{i=!1===s.leading?0:Date.now(),r=null,e.apply(l,n)},a))}}function Za(e,t,s,r,i=window){const n=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,r?s:{set(e){setTimeout(()=>{s.set.call(this,e)},0),n&&n.set&&n.set.call(this,e)}}),()=>Za(e,t,n||{},!0)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(Ha=new Proxy(Ha,{get:(e,t,s)=>("map"===t&&console.error(Va),Reflect.get(e,t,s))}));let qa=Date.now;function Ja(e){var t,s,r,i;const n=e.document;return{left:n.scrollingElement?n.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:n.documentElement.scrollLeft||(null==n?void 0:n.body)&&(null==(t=Ka.parentElement(n.body))?void 0:t.scrollLeft)||(null==(s=null==n?void 0:n.body)?void 0:s.scrollLeft)||0,top:n.scrollingElement?n.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==n?void 0:n.documentElement.scrollTop)||(null==n?void 0:n.body)&&(null==(r=Ka.parentElement(n.body))?void 0:r.scrollTop)||(null==(i=null==n?void 0:n.body)?void 0:i.scrollTop)||0}}function Xa(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Qa(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function el(e){if(!e)return null;return e.nodeType===e.ELEMENT_NODE?e:Ka.parentElement(e)}function tl(e,t,s,r){if(!e)return!1;const i=el(e);if(!i)return!1;try{if("string"==typeof t){if(i.classList.contains(t))return!0;if(r&&null!==i.closest("."+t))return!0}else if(H(i,t,r))return!0}catch(e){}if(s){if(i.matches(s))return!0;if(r&&null!==i.closest(s))return!0}return!1}function sl(e,t,s){return!("TITLE"!==e.tagName||!s.headTitleMutations)||-2===t.getId(e)}function rl(e,t){if(y(e))return!1;const s=t.getId(e);if(!t.has(s))return!0;const r=Ka.parentNode(e);return(!r||r.nodeType!==e.DOCUMENT_NODE)&&(!r||rl(r,t))}function il(e){return Boolean(e.changedTouches)}function nl(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function ol(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function al(e){return!!e&&(e instanceof Da&&"shadowRoot"in e?Boolean(e.shadowRoot):Boolean(Ka.shadowRoot(e)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(qa=()=>(new Date).getTime());class ll{constructor(){r(this,"id",1),r(this,"styleIDMap",new WeakMap),r(this,"idStyleMap",new Map)}getId(e){return this.styleIDMap.get(e)??-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let s;return s=void 0===t?this.id++:t,this.styleIDMap.set(e,s),this.idStyleMap.set(s,e),s}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function cl(e){var t;let s=null;return"getRootNode"in e&&(null==(t=Ka.getRootNode(e))?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&Ka.host(Ka.getRootNode(e))&&(s=Ka.host(Ka.getRootNode(e))),s}function hl(e){const t=Ka.ownerDocument(e);if(!t)return!1;const s=function(e){let t,s=e;for(;t=cl(s);)s=t;return s}(e);return Ka.contains(t,s)}function ul(e){const t=Ka.ownerDocument(e);return!!t&&(Ka.contains(t,e)||hl(e))}var dl=(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))(dl||{}),pl=(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))(pl||{}),ml=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(ml||{}),fl=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(fl||{}),gl=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(gl||{}),yl=(e=>(e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e))(yl||{}),wl=(e=>(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))(wl||{});function vl(e){return"__ln"in e}class Sl{constructor(){r(this,"length",0),r(this,"head",null),r(this,"tail",null)}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let s=0;s<e;s++)t=(null==t?void 0:t.next)||null;return t}addNode(e){const t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&vl(e.previousSibling)){const s=e.previousSibling.__ln.next;t.next=s,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,s&&(s.previous=t)}else if(e.nextSibling&&vl(e.nextSibling)&&e.nextSibling.__ln.previous){const s=e.nextSibling.__ln.previous;t.previous=s,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,s&&(s.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;null===t.next&&(this.tail=t),this.length++}removeNode(e){const t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}}const bl=(e,t)=>`${e}@${t}`;class Cl{constructor(){r(this,"frozen",!1),r(this,"locked",!1),r(this,"texts",[]),r(this,"attributes",[]),r(this,"attributeMap",new WeakMap),r(this,"removes",[]),r(this,"mapRemoves",[]),r(this,"movedMap",{}),r(this,"addedSet",new Set),r(this,"movedSet",new Set),r(this,"droppedSet",new Set),r(this,"removesSubTreeCache",new Set),r(this,"mutationCb"),r(this,"blockClass"),r(this,"blockSelector"),r(this,"maskTextClass"),r(this,"maskTextSelector"),r(this,"inlineStylesheet"),r(this,"maskInputOptions"),r(this,"maskTextFn"),r(this,"maskInputFn"),r(this,"keepIframeSrcFn"),r(this,"recordCanvas"),r(this,"inlineImages"),r(this,"slimDOMOptions"),r(this,"dataURLOptions"),r(this,"doc"),r(this,"mirror"),r(this,"iframeManager"),r(this,"stylesheetManager"),r(this,"shadowDomManager"),r(this,"canvasManager"),r(this,"processedNodeManager"),r(this,"unattachedDoc"),r(this,"processMutations",e=>{e.forEach(this.processMutation),this.emit()}),r(this,"emit",()=>{if(this.frozen||this.locked)return;const e=[],t=new Set,s=new Sl,r=e=>{let t=e,s=-2;for(;-2===s;)t=t&&t.nextSibling,s=t&&this.mirror.getId(t);return s},i=i=>{const n=Ka.parentNode(i);if(!n||!ul(i))return;let o=!1;if(i.nodeType===Node.TEXT_NODE){const e=n.tagName;if("TEXTAREA"===e)return;"STYLE"===e&&this.addedSet.has(n)&&(o=!0)}const a=y(n)?this.mirror.getId(cl(i)):this.mirror.getId(n),l=r(i);if(-1===a||-1===l)return s.addNode(i);const c=X(i,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:e=>{nl(e,this.mirror)&&this.iframeManager.addIframe(e),ol(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),al(i)&&this.shadowDomManager.addShadowRoot(Ka.shadowRoot(i),this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)},cssCaptured:o});c&&(e.push({parentId:a,nextId:l,node:c}),t.add(c.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const e of this.movedSet)Il(this.removesSubTreeCache,e,this.mirror)&&!this.movedSet.has(Ka.parentNode(e))||i(e);for(const e of this.addedSet)El(this.droppedSet,e)||Il(this.removesSubTreeCache,e,this.mirror)?El(this.movedSet,e)?i(e):this.droppedSet.add(e):i(e);let n=null;for(;s.length;){let e=null;if(n){const t=this.mirror.getId(Ka.parentNode(n.value)),s=r(n.value);-1!==t&&-1!==s&&(e=n)}if(!e){let t=s.tail;for(;t;){const s=t;if(t=t.previous,s){const t=this.mirror.getId(Ka.parentNode(s.value));if(-1===r(s.value))continue;if(-1!==t){e=s;break}{const t=s.value,r=Ka.parentNode(t);if(r&&r.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const t=Ka.host(r);if(-1!==this.mirror.getId(t)){e=s;break}}}}}}if(!e){for(;s.head;)s.removeNode(s.head.value);break}n=e.previous,s.removeNode(e.value),i(e.value)}const o={texts:this.texts.map(e=>{const t=e.node,s=Ka.parentNode(t);return s&&"TEXTAREA"===s.tagName&&this.genTextAreaValueMutation(s),{id:this.mirror.getId(t),value:e.value}}).filter(e=>!t.has(e.id)).filter(e=>this.mirror.has(e.id)),attributes:this.attributes.map(e=>{const{attributes:t}=e;if("string"==typeof t.style){const s=JSON.stringify(e.styleDiff),r=JSON.stringify(e._unchangedStyles);s.length<t.style.length&&(s+r).split("var(").length===t.style.split("var(").length&&(t.style=e.styleDiff)}return{id:this.mirror.getId(e.node),attributes:t}}).filter(e=>!t.has(e.id)).filter(e=>this.mirror.has(e.id)),removes:this.removes,adds:e};(o.texts.length||o.attributes.length||o.removes.length||o.adds.length)&&(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},this.mutationCb(o))}),r(this,"genTextAreaValueMutation",e=>{let t=this.attributeMap.get(e);t||(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(t),this.attributeMap.set(e,t));const s=Array.from(Ka.childNodes(e),e=>Ka.textContent(e)||"").join("");t.attributes.value=C({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:E(e),value:s,maskInputFn:this.maskInputFn})}),r(this,"processMutation",e=>{if(!sl(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":{const t=Ka.textContent(e.target);tl(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:Y(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,el(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const t=e.target;let s=e.attributeName,r=e.target.getAttribute(s);if("value"===s){const e=E(t);r=C({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:e,value:r,maskInputFn:this.maskInputFn})}if(tl(e.target,this.blockClass,this.blockSelector,!1)||r===e.oldValue)return;let i=this.attributeMap.get(e.target);if("IFRAME"===t.tagName&&"src"===s&&!this.keepIframeSrcFn(r)){if(t.contentDocument)return;s="rr_src"}if(i||(i={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(i),this.attributeMap.set(e.target,i)),"type"===s&&"INPUT"===t.tagName&&"password"===(e.oldValue||"").toLowerCase()&&t.setAttribute("data-rr-is-password","true"),!V(t.tagName,s))if(i.attributes[s]=G(this.doc,k(t.tagName),k(s),r),"style"===s){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(e){this.unattachedDoc=this.doc}const s=this.unattachedDoc.createElement("span");e.oldValue&&s.setAttribute("style",e.oldValue);for(const e of Array.from(t.style)){const r=t.style.getPropertyValue(e),n=t.style.getPropertyPriority(e);r!==s.style.getPropertyValue(e)||n!==s.style.getPropertyPriority(e)?i.styleDiff[e]=""===n?r:[r,n]:i._unchangedStyles[e]=[r,n]}for(const e of Array.from(s.style))""===t.style.getPropertyValue(e)&&(i.styleDiff[e]=!1)}else"open"===s&&"DIALOG"===t.tagName&&(t.matches("dialog:modal")?i.attributes.rr_open_mode="modal":i.attributes.rr_open_mode="non-modal");break}case"childList":if(tl(e.target,this.blockClass,this.blockSelector,!0))return;if("TEXTAREA"===e.target.tagName)return void this.genTextAreaValueMutation(e.target);e.addedNodes.forEach(t=>this.genAdds(t,e.target)),e.removedNodes.forEach(t=>{const s=this.mirror.getId(t),r=y(e.target)?this.mirror.getId(Ka.host(e.target)):this.mirror.getId(e.target);tl(e.target,this.blockClass,this.blockSelector,!1)||sl(t,this.mirror,this.slimDOMOptions)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(kl(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===s||rl(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[bl(s,r)]?kl(this.movedSet,t):(this.removes.push({parentId:r,id:s,isShadow:!(!y(e.target)||!w(e.target))||void 0}),function(e,t){const s=[e];for(;s.length;){const e=s.pop();t.has(e)||(t.add(e),Ka.childNodes(e).forEach(e=>s.push(e)))}}(t,this.removesSubTreeCache))),this.mapRemoves.push(t))})}}),r(this,"genAdds",(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!this.addedSet.has(e)&&!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(sl(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);let s=null;t&&this.mirror.hasNode(t)&&(s=this.mirror.getId(t)),s&&-1!==s&&(this.movedMap[bl(this.mirror.getId(e),s)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);tl(e,this.blockClass,this.blockSelector,!1)||(Ka.childNodes(e).forEach(e=>this.genAdds(e)),al(e)&&Ka.childNodes(Ka.shadowRoot(e)).forEach(t=>{this.processedNodeManager.add(t,this),this.genAdds(t,e)}))}})}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(t=>{this[t]=e[t]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function kl(e,t){e.delete(t),Ka.childNodes(t).forEach(t=>kl(e,t))}function Il(e,t,s){return 0!==e.size&&function(e,t){const s=Ka.parentNode(t);return!!s&&e.has(s)}(e,t)}function El(e,t){return 0!==e.size&&Tl(e,t)}function Tl(e,t){const s=Ka.parentNode(t);return!!s&&(!!e.has(s)||Tl(e,s))}let xl;const Ml=e=>{if(!xl)return e;return(...t)=>{try{return e(...t)}catch(e){if(xl&&!0===xl(e))return;throw e}}},_l=[];function Ol(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch{}return e&&e.target}function Al(e,t){const s=new Cl;_l.push(s),s.init(e);const r=new(ja())(Ml(s.processMutations.bind(s)));return r.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),r}function Rl({mouseInteractionCb:e,doc:t,mirror:s,blockClass:r,blockSelector:i,sampling:n}){if(!1===n.mouseInteraction)return()=>{};const o=!0===n.mouseInteraction||void 0===n.mouseInteraction?{}:n.mouseInteraction,a=[];let l=null;return Object.keys(ml).filter(e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==o[e]).forEach(n=>{let o=k(n);const c=(t=>n=>{const o=Ol(n);if(tl(o,r,i,!0))return;let a=null,c=t;if("pointerType"in n){switch(n.pointerType){case"mouse":a=fl.Mouse;break;case"touch":a=fl.Touch;break;case"pen":a=fl.Pen}a===fl.Touch?ml[t]===ml.MouseDown?c="TouchStart":ml[t]===ml.MouseUp&&(c="TouchEnd"):fl.Pen}else il(n)&&(a=fl.Touch);null!==a?(l=a,(c.startsWith("Touch")&&a===fl.Touch||c.startsWith("Mouse")&&a===fl.Mouse)&&(a=null)):ml[t]===ml.Click&&(a=l,l=null);const h=il(n)?n.changedTouches[0]:n;if(!h)return;const u=s.getId(o),{clientX:d,clientY:p}=h;Ml(e)({type:ml[c],id:u,x:d,y:p,...null!==a&&{pointerType:a}})})(n);if(window.PointerEvent)switch(ml[n]){case ml.MouseDown:case ml.MouseUp:o=o.replace("mouse","pointer");break;case ml.TouchStart:case ml.TouchEnd:return}a.push(Ga(o,c,t))}),Ml(()=>{a.forEach(e=>e())})}function Dl({scrollCb:e,doc:t,mirror:s,blockClass:r,blockSelector:i,sampling:n}){return Ga("scroll",Ml(Ya(Ml(n=>{const o=Ol(n);if(!o||tl(o,r,i,!0))return;const a=s.getId(o);if(o===t&&t.defaultView){const s=Ja(t.defaultView);e({id:a,x:s.left,y:s.top})}else e({id:a,x:o.scrollLeft,y:o.scrollTop})}),n.scroll||100)),t)}const Pl=["INPUT","TEXTAREA","SELECT"],Ll=new WeakMap;function Nl(e){return function(e,t){if($l("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||$l("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||$l("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||$l("CSSConditionRule")&&e.parentRule instanceof CSSConditionRule){const s=Array.from(e.parentRule.cssRules).indexOf(e);t.unshift(s)}else if(e.parentStyleSheet){const s=Array.from(e.parentStyleSheet.cssRules).indexOf(e);t.unshift(s)}return t}(e,[])}function Fl(e,t,s){let r,i;return e?(e.ownerNode?r=t.getId(e.ownerNode):i=s.getId(e),{styleId:i,id:r}):{}}function Ul({mirror:e,stylesheetManager:t},s){var r,i,n;let o=null;o="#document"===s.nodeName?e.getId(s):e.getId(Ka.host(s));const a="#document"===s.nodeName?null==(r=s.defaultView)?void 0:r.Document:null==(n=null==(i=s.ownerDocument)?void 0:i.defaultView)?void 0:n.ShadowRoot,l=(null==a?void 0:a.prototype)?Object.getOwnPropertyDescriptor(null==a?void 0:a.prototype,"adoptedStyleSheets"):void 0;return null!==o&&-1!==o&&a&&l?(Object.defineProperty(s,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get(){var e;return null==(e=l.get)?void 0:e.call(this)},set(e){var s;const r=null==(s=l.set)?void 0:s.call(this,e);if(null!==o&&-1!==o)try{t.adoptStyleSheets(e,o)}catch(e){}return r}}),Ml(()=>{Object.defineProperty(s,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})})):()=>{}}function Bl(e,t={}){const s=e.doc.defaultView;if(!s)return()=>{};let r;!function(e,t){const{mutationCb:s,mousemoveCb:r,mouseInteractionCb:i,scrollCb:n,viewportResizeCb:o,inputCb:a,mediaInteractionCb:l,styleSheetRuleCb:c,styleDeclarationCb:h,canvasMutationCb:u,fontCb:d,selectionCb:p,customElementCb:m}=e;e.mutationCb=(...e)=>{t.mutation&&t.mutation(...e),s(...e)},e.mousemoveCb=(...e)=>{t.mousemove&&t.mousemove(...e),r(...e)},e.mouseInteractionCb=(...e)=>{t.mouseInteraction&&t.mouseInteraction(...e),i(...e)},e.scrollCb=(...e)=>{t.scroll&&t.scroll(...e),n(...e)},e.viewportResizeCb=(...e)=>{t.viewportResize&&t.viewportResize(...e),o(...e)},e.inputCb=(...e)=>{t.input&&t.input(...e),a(...e)},e.mediaInteractionCb=(...e)=>{t.mediaInteaction&&t.mediaInteaction(...e),l(...e)},e.styleSheetRuleCb=(...e)=>{t.styleSheetRule&&t.styleSheetRule(...e),c(...e)},e.styleDeclarationCb=(...e)=>{t.styleDeclaration&&t.styleDeclaration(...e),h(...e)},e.canvasMutationCb=(...e)=>{t.canvasMutation&&t.canvasMutation(...e),u(...e)},e.fontCb=(...e)=>{t.font&&t.font(...e),d(...e)},e.selectionCb=(...e)=>{t.selection&&t.selection(...e),p(...e)},e.customElementCb=(...e)=>{t.customElement&&t.customElement(...e),m(...e)}}(e,t),e.recordDOM&&(r=Al(e,e.doc));const i=function({mousemoveCb:e,sampling:t,doc:s,mirror:r}){if(!1===t.mousemove)return()=>{};const i="number"==typeof t.mousemove?t.mousemove:50,n="number"==typeof t.mousemoveCallback?t.mousemoveCallback:500;let o,a=[];const l=Ya(Ml(t=>{const s=Date.now()-o;e(a.map(e=>(e.timeOffset-=s,e)),t),a=[],o=null}),n),c=Ml(Ya(Ml(e=>{const t=Ol(e),{clientX:s,clientY:i}=il(e)?e.changedTouches[0]:e;o||(o=qa()),a.push({x:s,y:i,id:r.getId(t),timeOffset:qa()-o}),l("undefined"!=typeof DragEvent&&e instanceof DragEvent?pl.Drag:e instanceof MouseEvent?pl.MouseMove:pl.TouchMove)}),i,{trailing:!1})),h=[Ga("mousemove",c,s),Ga("touchmove",c,s),Ga("drag",c,s)];return Ml(()=>{h.forEach(e=>e())})}(e),n=Rl(e),o=Dl(e),a=function({viewportResizeCb:e},{win:t}){let s=-1,r=-1;return Ga("resize",Ml(Ya(Ml(()=>{const t=Xa(),i=Qa();s===t&&r===i||(e({width:Number(i),height:Number(t)}),s=t,r=i)}),200)),t)}(e,{win:s}),l=function({inputCb:e,doc:t,mirror:s,blockClass:r,blockSelector:i,ignoreClass:n,ignoreSelector:o,maskInputOptions:a,maskInputFn:l,sampling:c,userTriggeredOnInput:h}){function u(e){let s=Ol(e);const c=e.isTrusted,u=s&&s.tagName;if(s&&"OPTION"===u&&(s=Ka.parentElement(s)),!s||!u||Pl.indexOf(u)<0||tl(s,r,i,!0))return;if(s.classList.contains(n)||o&&s.matches(o))return;let p=s.value,m=!1;const f=E(s)||"";"radio"===f||"checkbox"===f?m=s.checked:(a[u.toLowerCase()]||a[f])&&(p=C({element:s,maskInputOptions:a,tagName:u,type:f,value:p,maskInputFn:l})),d(s,h?{text:p,isChecked:m,userTriggered:c}:{text:p,isChecked:m});const g=s.name;"radio"===f&&g&&m&&t.querySelectorAll(`input[type="radio"][name="${g}"]`).forEach(e=>{if(e!==s){const t=e.value;d(e,h?{text:t,isChecked:!m,userTriggered:!1}:{text:t,isChecked:!m})}})}function d(t,r){const i=Ll.get(t);if(!i||i.text!==r.text||i.isChecked!==r.isChecked){Ll.set(t,r);const i=s.getId(t);Ml(e)({...r,id:i})}}const p=("last"===c.input?["change"]:["input","change"]).map(e=>Ga(e,Ml(u),t)),m=t.defaultView;if(!m)return()=>{p.forEach(e=>e())};const f=m.Object.getOwnPropertyDescriptor(m.HTMLInputElement.prototype,"value"),g=[[m.HTMLInputElement.prototype,"value"],[m.HTMLInputElement.prototype,"checked"],[m.HTMLSelectElement.prototype,"value"],[m.HTMLTextAreaElement.prototype,"value"],[m.HTMLSelectElement.prototype,"selectedIndex"],[m.HTMLOptionElement.prototype,"selected"]];return f&&f.set&&p.push(...g.map(e=>Za(e[0],e[1],{set(){Ml(u)({target:this,isTrusted:!1})}},!1,m))),Ml(()=>{p.forEach(e=>e())})}(e),c=function({mediaInteractionCb:e,blockClass:t,blockSelector:s,mirror:r,sampling:i,doc:n}){const o=Ml(n=>Ya(Ml(i=>{const o=Ol(i);if(!o||tl(o,t,s,!0))return;const{currentTime:a,volume:l,muted:c,playbackRate:h,loop:u}=o;e({type:n,id:r.getId(o),currentTime:a,volume:l,muted:c,playbackRate:h,loop:u})}),i.media||500)),a=[Ga("play",o(yl.Play),n),Ga("pause",o(yl.Pause),n),Ga("seeked",o(yl.Seeked),n),Ga("volumechange",o(yl.VolumeChange),n),Ga("ratechange",o(yl.RateChange),n)];return Ml(()=>{a.forEach(e=>e())})}(e);let h=()=>{},u=()=>{},d=()=>{},p=()=>{};e.recordDOM&&(h=function({styleSheetRuleCb:e,mirror:t,stylesheetManager:s},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};const i=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:Ml((r,i,n)=>{const[o,a]=n,{id:l,styleId:c}=Fl(i,t,s.styleMirror);return(l&&-1!==l||c&&-1!==c)&&e({id:l,styleId:c,adds:[{rule:o,index:a}]}),r.apply(i,n)})}),r.CSSStyleSheet.prototype.addRule=function(e,t,s=this.cssRules.length){const i=`${e} { ${t} }`;return r.CSSStyleSheet.prototype.insertRule.apply(this,[i,s])};const n=r.CSSStyleSheet.prototype.deleteRule;let o,a;r.CSSStyleSheet.prototype.deleteRule=new Proxy(n,{apply:Ml((r,i,n)=>{const[o]=n,{id:a,styleId:l}=Fl(i,t,s.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,removes:[{index:o}]}),r.apply(i,n)})}),r.CSSStyleSheet.prototype.removeRule=function(e){return r.CSSStyleSheet.prototype.deleteRule.apply(this,[e])},r.CSSStyleSheet.prototype.replace&&(o=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(o,{apply:Ml((r,i,n)=>{const[o]=n,{id:a,styleId:l}=Fl(i,t,s.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,replace:o}),r.apply(i,n)})})),r.CSSStyleSheet.prototype.replaceSync&&(a=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:Ml((r,i,n)=>{const[o]=n,{id:a,styleId:l}=Fl(i,t,s.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,replaceSync:o}),r.apply(i,n)})}));const l={};zl("CSSGroupingRule")?l.CSSGroupingRule=r.CSSGroupingRule:(zl("CSSMediaRule")&&(l.CSSMediaRule=r.CSSMediaRule),zl("CSSConditionRule")&&(l.CSSConditionRule=r.CSSConditionRule),zl("CSSSupportsRule")&&(l.CSSSupportsRule=r.CSSSupportsRule));const c={};return Object.entries(l).forEach(([r,i])=>{c[r]={insertRule:i.prototype.insertRule,deleteRule:i.prototype.deleteRule},i.prototype.insertRule=new Proxy(c[r].insertRule,{apply:Ml((r,i,n)=>{const[o,a]=n,{id:l,styleId:c}=Fl(i.parentStyleSheet,t,s.styleMirror);return(l&&-1!==l||c&&-1!==c)&&e({id:l,styleId:c,adds:[{rule:o,index:[...Nl(i),a||0]}]}),r.apply(i,n)})}),i.prototype.deleteRule=new Proxy(c[r].deleteRule,{apply:Ml((r,i,n)=>{const[o]=n,{id:a,styleId:l}=Fl(i.parentStyleSheet,t,s.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,removes:[{index:[...Nl(i),o]}]}),r.apply(i,n)})})}),Ml(()=>{r.CSSStyleSheet.prototype.insertRule=i,r.CSSStyleSheet.prototype.deleteRule=n,o&&(r.CSSStyleSheet.prototype.replace=o),a&&(r.CSSStyleSheet.prototype.replaceSync=a),Object.entries(l).forEach(([e,t])=>{t.prototype.insertRule=c[e].insertRule,t.prototype.deleteRule=c[e].deleteRule})})}(e,{win:s}),u=Ul(e,e.doc),d=function({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:s,stylesheetManager:r},{win:i}){const n=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(n,{apply:Ml((i,o,a)=>{var l;const[c,h,u]=a;if(s.has(c))return n.apply(o,[c,h,u]);const{id:d,styleId:p}=Fl(null==(l=o.parentRule)?void 0:l.parentStyleSheet,t,r.styleMirror);return(d&&-1!==d||p&&-1!==p)&&e({id:d,styleId:p,set:{property:c,value:h,priority:u},index:Nl(o.parentRule)}),i.apply(o,a)})});const o=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(o,{apply:Ml((i,n,a)=>{var l;const[c]=a;if(s.has(c))return o.apply(n,[c]);const{id:h,styleId:u}=Fl(null==(l=n.parentRule)?void 0:l.parentStyleSheet,t,r.styleMirror);return(h&&-1!==h||u&&-1!==u)&&e({id:h,styleId:u,remove:{property:c},index:Nl(n.parentRule)}),i.apply(n,a)})}),Ml(()=>{i.CSSStyleDeclaration.prototype.setProperty=n,i.CSSStyleDeclaration.prototype.removeProperty=o})}(e,{win:s}),e.collectFonts&&(p=function({fontCb:e,doc:t}){const s=t.defaultView;if(!s)return()=>{};const r=[],i=new WeakMap,n=s.FontFace;s.FontFace=function(e,t,s){const r=new n(e,t,s);return i.set(r,{family:e,buffer:"string"!=typeof t,descriptors:s,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),r};const o=Wa(t.fonts,"add",function(t){return function(s){return setTimeout(Ml(()=>{const t=i.get(s);t&&(e(t),i.delete(s))}),0),t.apply(this,[s])}});return r.push(()=>{s.FontFace=n}),r.push(o),Ml(()=>{r.forEach(e=>e())})}(e)));const m=function(e){const{doc:t,mirror:s,blockClass:r,blockSelector:i,selectionCb:n}=e;let o=!0;const a=Ml(()=>{const e=t.getSelection();if(!e||o&&(null==e?void 0:e.isCollapsed))return;o=e.isCollapsed||!1;const a=[],l=e.rangeCount||0;for(let t=0;t<l;t++){const n=e.getRangeAt(t),{startContainer:o,startOffset:l,endContainer:c,endOffset:h}=n;tl(o,r,i,!0)||tl(c,r,i,!0)||a.push({start:s.getId(o),startOffset:l,end:s.getId(c),endOffset:h})}n({ranges:a})});return a(),Ga("selectionchange",a)}(e),f=function({doc:e,customElementCb:t}){const s=e.defaultView;return s&&s.customElements?Wa(s.customElements,"define",function(e){return function(s,r,i){try{t({define:{name:s}})}catch(e){console.warn(`Custom element callback failed for ${s}`)}return e.apply(this,[s,r,i])}}):()=>{}}(e),g=[];for(const t of e.plugins)g.push(t.observer(t.callback,s,t.options));return Ml(()=>{_l.forEach(e=>e.reset()),null==r||r.disconnect(),i(),n(),o(),a(),l(),c(),h(),u(),d(),p(),m(),f(),g.forEach(e=>e())})}function $l(e){return void 0!==window[e]}function zl(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class jl{constructor(e){r(this,"iframeIdToRemoteIdMap",new WeakMap),r(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,s,r){const i=s||this.getIdToRemoteIdMap(e),n=r||this.getRemoteIdToIdMap(e);let o=i.get(t);return o||(o=this.generateIdFn(),i.set(t,o),n.set(o,t)),o}getIds(e,t){const s=this.getIdToRemoteIdMap(e),r=this.getRemoteIdToIdMap(e);return t.map(t=>this.getId(e,t,s,r))}getRemoteId(e,t,s){const r=s||this.getRemoteIdToIdMap(e);if("number"!=typeof t)return t;const i=r.get(t);return i||-1}getRemoteIds(e,t){const s=this.getRemoteIdToIdMap(e);return t.map(t=>this.getRemoteId(e,t,s))}reset(e){if(!e)return this.iframeIdToRemoteIdMap=new WeakMap,void(this.iframeRemoteIdToIdMap=new WeakMap);this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}}class Wl{constructor(e){r(this,"iframes",new WeakMap),r(this,"crossOriginIframeMap",new WeakMap),r(this,"crossOriginIframeMirror",new jl(N)),r(this,"crossOriginIframeStyleMirror"),r(this,"crossOriginIframeRootIdMap",new WeakMap),r(this,"mirror"),r(this,"mutationCb"),r(this,"wrappedEmit"),r(this,"loadListener"),r(this,"stylesheetManager"),r(this,"recordCrossOriginIframes"),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new jl(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var s,r;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&(null==(s=e.contentWindow)||s.addEventListener("message",this.handleMessage.bind(this))),null==(r=this.loadListener)||r.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){const t=e;if("rrweb"!==t.data.type||t.origin!==t.data.origin)return;if(!e.source)return;const s=this.crossOriginIframeMap.get(e.source);if(!s)return;const r=this.transformCrossOriginEvent(s,t.data.event);r&&this.wrappedEmit(r,t.data.isCheckout)}transformCrossOriginEvent(e,t){var s;switch(t.type){case dl.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);const s=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,s),this.patchRootIdOnNode(t.data.node,s),{timestamp:t.timestamp,type:dl.IncrementalSnapshot,data:{source:pl.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case dl.Meta:case dl.Load:case dl.DomContentLoaded:return!1;case dl.Plugin:return t;case dl.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case dl.IncrementalSnapshot:switch(t.data.source){case pl.Mutation:return t.data.adds.forEach(t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e);const s=this.crossOriginIframeRootIdMap.get(e);s&&this.patchRootIdOnNode(t.node,s)}),t.data.removes.forEach(t=>{this.replaceIds(t,e,["parentId","id"])}),t.data.attributes.forEach(t=>{this.replaceIds(t,e,["id"])}),t.data.texts.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case pl.Drag:case pl.TouchMove:case pl.MouseMove:return t.data.positions.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case pl.ViewportResize:return!1;case pl.MediaInteraction:case pl.MouseInteraction:case pl.Scroll:case pl.CanvasMutation:case pl.Input:return this.replaceIds(t.data,e,["id"]),t;case pl.StyleSheetRule:case pl.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case pl.Font:return t;case pl.Selection:return t.data.ranges.forEach(t=>{this.replaceIds(t,e,["start","end"])}),t;case pl.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null==(s=t.data.styles)||s.forEach(t=>{this.replaceStyleIds(t,e,["styleId"])}),t}}return!1}replace(e,t,s,r){for(const i of r)(Array.isArray(t[i])||"number"==typeof t[i])&&(Array.isArray(t[i])?t[i]=e.getIds(s,t[i]):t[i]=e.getId(s,t[i]));return t}replaceIds(e,t,s){return this.replace(this.crossOriginIframeMirror,e,t,s)}replaceStyleIds(e,t,s){return this.replace(this.crossOriginIframeStyleMirror,e,t,s)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(e=>{this.replaceIdOnNode(e,t)})}patchRootIdOnNode(e,t){e.type===wl.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(e=>{this.patchRootIdOnNode(e,t)})}}class Kl{constructor(e){r(this,"shadowDoms",new WeakSet),r(this,"mutationCb"),r(this,"scrollCb"),r(this,"bypassOptions"),r(this,"mirror"),r(this,"restoreHandlers",[]),this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){if(!w(e))return;if(this.shadowDoms.has(e))return;this.shadowDoms.add(e);const s=Al({...this.bypassOptions,doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},e);this.restoreHandlers.push(()=>s.disconnect()),this.restoreHandlers.push(Dl({...this.bypassOptions,scrollCb:this.scrollCb,doc:e,mirror:this.mirror})),setTimeout(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(Ka.host(e))),this.restoreHandlers.push(Ul({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))},0)}observeAttachShadow(e){e.contentWindow&&e.contentDocument&&this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){const s=this;this.restoreHandlers.push(Wa(e.prototype,"attachShadow",function(e){return function(r){const i=e.call(this,r),n=Ka.shadowRoot(this);return n&&ul(this)&&s.addShadowRoot(n,t),i}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch(e){}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}for(var Gl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Vl="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Hl=0;Hl<64;Hl++)Vl[Gl.charCodeAt(Hl)]=Hl;const Yl=new Map;const Zl=(e,t,s)=>{if(!e||!Xl(e,t)&&"object"!=typeof e)return;const r=function(e,t){let s=Yl.get(e);return s||(s=new Map,Yl.set(e,s)),s.has(t)||s.set(t,[]),s.get(t)}(s,e.constructor.name);let i=r.indexOf(e);return-1===i&&(i=r.length,r.push(e)),i};function ql(e,t,s){if(e instanceof Array)return e.map(e=>ql(e,t,s));if(null===e)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray){return{rr_type:e.constructor.name,args:[Object.values(e)]}}if(e instanceof ArrayBuffer){return{rr_type:e.constructor.name,base64:function(e){var t,s=new Uint8Array(e),r=s.length,i="";for(t=0;t<r;t+=3)i+=Gl[s[t]>>2],i+=Gl[(3&s[t])<<4|s[t+1]>>4],i+=Gl[(15&s[t+1])<<2|s[t+2]>>6],i+=Gl[63&s[t+2]];return r%3==2?i=i.substring(0,i.length-1)+"=":r%3==1&&(i=i.substring(0,i.length-2)+"=="),i}(e)}}if(e instanceof DataView){return{rr_type:e.constructor.name,args:[ql(e.buffer,t,s),e.byteOffset,e.byteLength]}}if(e instanceof HTMLImageElement){const t=e.constructor.name,{src:s}=e;return{rr_type:t,src:s}}if(e instanceof HTMLCanvasElement){return{rr_type:"HTMLImageElement",src:e.toDataURL()}}if(e instanceof ImageData){return{rr_type:e.constructor.name,args:[ql(e.data,t,s),e.width,e.height]}}if(Xl(e,t)||"object"==typeof e){return{rr_type:e.constructor.name,index:Zl(e,t,s)}}return e}const Jl=(e,t,s)=>e.map(e=>ql(e,t,s)),Xl=(e,t)=>{const s=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(e=>"function"==typeof t[e]);return Boolean(s.find(s=>e instanceof t[s]))};function Ql(e,t,s,r){const i=[];try{const n=Wa(e.HTMLCanvasElement.prototype,"getContext",function(e){return function(i,...n){if(!tl(this,t,s,!0)){const e=function(e){return"experimental-webgl"===e?"webgl":e}(i);if("__context"in this||(this.__context=e),r&&["webgl","webgl2"].includes(e))if(n[0]&&"object"==typeof n[0]){const e=n[0];e.preserveDrawingBuffer||(e.preserveDrawingBuffer=!0)}else n.splice(0,1,{preserveDrawingBuffer:!0})}return e.apply(this,[i,...n])}});i.push(n)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{i.forEach(e=>e())}}function ec(e,t,s,r,i,n){const o=[],a=Object.getOwnPropertyNames(e);for(const l of a)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(l))try{if("function"!=typeof e[l])continue;const a=Wa(e,l,function(e){return function(...o){const a=e.apply(this,o);if(Zl(a,n,this),"tagName"in this.canvas&&!tl(this.canvas,r,i,!0)){const e=Jl(o,n,this),r={type:t,property:l,args:e};s(this.canvas,r)}return a}});o.push(a)}catch{const r=Za(e,l,{set(e){s(this.canvas,{type:t,property:l,args:[e],setter:!0})}});o.push(r)}return o}const tc="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",sc="undefined"!=typeof window&&window.Blob&&new Blob([(rc=tc,Uint8Array.from(atob(rc),e=>e.charCodeAt(0)))],{type:"text/javascript;charset=utf-8"});var rc;function ic(e){let t;try{if(t=sc&&(window.URL||window.webkitURL).createObjectURL(sc),!t)throw"";const s=new Worker(t,{name:null==e?void 0:e.name});return s.addEventListener("error",()=>{(window.URL||window.webkitURL).revokeObjectURL(t)}),s}catch(t){return new Worker("data:text/javascript;base64,"+tc,{name:null==e?void 0:e.name})}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}class nc{constructor(e){r(this,"pendingCanvasMutations",new Map),r(this,"rafStamps",{latestId:0,invokeId:null}),r(this,"mirror"),r(this,"mutationCb"),r(this,"resetObservers"),r(this,"frozen",!1),r(this,"locked",!1),r(this,"processMutation",(e,t)=>{!(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId)&&this.rafStamps.invokeId||(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(t)});const{sampling:t="all",win:s,blockClass:i,blockSelector:n,recordCanvas:o,dataURLOptions:a}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,o&&"all"===t&&this.initCanvasMutationObserver(s,i,n),o&&"number"==typeof t&&this.initCanvasFPSObserver(t,s,i,n,{dataURLOptions:a})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(e,t,s,r,i){const n=Ql(t,s,r,!0),o=new Map,a=new ic;a.onmessage=e=>{const{id:t}=e.data;if(o.set(t,!1),!("base64"in e.data))return;const{base64:s,type:r,width:i,height:n}=e.data;this.mutationCb({id:t,type:gl["2D"],commands:[{property:"clearRect",args:[0,0,i,n]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:s}],type:r}]},0,0]}]})};const l=1e3/e;let c,h=0;const u=e=>{h&&e-h<l||(h=e,(()=>{const e=[];return t.document.querySelectorAll("canvas").forEach(t=>{tl(t,s,r,!0)||e.push(t)}),e})().forEach(async e=>{var t;const s=this.mirror.getId(e);if(o.get(s))return;if(0===e.width||0===e.height)return;if(o.set(s,!0),["webgl","webgl2"].includes(e.__context)){const s=e.getContext(e.__context);!1===(null==(t=null==s?void 0:s.getContextAttributes())?void 0:t.preserveDrawingBuffer)&&s.clear(s.COLOR_BUFFER_BIT)}const r=await createImageBitmap(e);a.postMessage({id:s,bitmap:r,width:e.width,height:e.height,dataURLOptions:i.dataURLOptions},[r])})),c=requestAnimationFrame(u)};c=requestAnimationFrame(u),this.resetObservers=()=>{n(),cancelAnimationFrame(c)}}initCanvasMutationObserver(e,t,s){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const r=Ql(e,t,s,!1),i=function(e,t,s,r){const i=[],n=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const o of n)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[o])continue;const n=Wa(t.CanvasRenderingContext2D.prototype,o,function(i){return function(...n){return tl(this.canvas,s,r,!0)||setTimeout(()=>{const s=Jl(n,t,this);e(this.canvas,{type:gl["2D"],property:o,args:s})},0),i.apply(this,n)}});i.push(n)}catch{const s=Za(t.CanvasRenderingContext2D.prototype,o,{set(t){e(this.canvas,{type:gl["2D"],property:o,args:[t],setter:!0})}});i.push(s)}return()=>{i.forEach(e=>e())}}(this.processMutation.bind(this),e,t,s),n=function(e,t,s,r){const i=[];return i.push(...ec(t.WebGLRenderingContext.prototype,gl.WebGL,e,s,r,t)),void 0!==t.WebGL2RenderingContext&&i.push(...ec(t.WebGL2RenderingContext.prototype,gl.WebGL2,e,s,r,t)),()=>{i.forEach(e=>e())}}(this.processMutation.bind(this),e,t,s);this.resetObservers=()=>{r(),i(),n()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{const s=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,s)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const s=this.pendingCanvasMutations.get(e);if(!s||-1===t)return;const r=s.map(e=>{const{type:t,...s}=e;return s}),{type:i}=s[0];this.mutationCb({id:t,type:i,commands:r}),this.pendingCanvasMutations.delete(e)}}class oc{constructor(e){r(this,"trackedLinkElements",new WeakSet),r(this,"mutationCb"),r(this,"adoptedStyleSheetCb"),r(this,"styleMirror",new ll),this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(0===e.length)return;const s={id:t,styleIds:[]},r=[];for(const t of e){let e;this.styleMirror.has(t)?e=this.styleMirror.getId(t):(e=this.styleMirror.add(t),r.push({styleId:e,rules:Array.from(t.rules||CSSRule,(e,s)=>({rule:S(e,t.href),index:s}))})),s.styleIds.push(e)}r.length>0&&(s.styles=r),this.adoptedStyleSheetCb(s)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class ac{constructor(){r(this,"nodeMap",new WeakMap),r(this,"active",!1)}inOtherBuffer(e,t){const s=this.nodeMap.get(e);return s&&Array.from(s).some(e=>e!==t)}add(e,t){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}destroy(){}}let lc,cc,hc,uc=!1;try{if(2!==Array.from([1],e=>2*e)[0]){const e=document.createElement("iframe");document.body.appendChild(e),Array.from=(null==(t=e.contentWindow)?void 0:t.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}const dc=new b;function pc(e={}){const{emit:t,checkoutEveryNms:s,checkoutEveryNth:r,blockClass:i="rr-block",blockSelector:n=null,ignoreClass:o="rr-ignore",ignoreSelector:a=null,maskTextClass:l="rr-mask",maskTextSelector:c=null,inlineStylesheet:h=!0,maskAllInputs:u,maskInputOptions:d,slimDOMOptions:p,maskInputFn:m,maskTextFn:f,hooks:g,packFn:y,sampling:w={},dataURLOptions:v={},mousemoveWait:S,recordDOM:C=!0,recordCanvas:k=!1,recordCrossOriginIframes:I=!1,recordAfter:E=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:T=!1,collectFonts:x=!1,inlineImages:M=!1,plugins:_,keepIframeSrcFn:O=()=>!1,ignoreCSSAttributes:A=new Set([]),errorHandler:R}=e;xl=R;const D=!I||window.parent===window;let P=!1;if(!D)try{window.parent.document&&(P=!1)}catch(e){P=!0}if(D&&!t)throw new Error("emit function is required");if(!D&&!P)return()=>{};void 0!==S&&void 0===w.mousemove&&(w.mousemove=S),dc.reset();const L=!0===u?{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}:void 0!==d?d:{password:!0},N=J(p);let F;!function(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach)}();let U=0;const B=e=>{for(const t of _||[])t.eventProcessor&&(e=t.eventProcessor(e));return y&&!P&&(e=y(e)),e};lc=(e,i)=>{var n;const o=e;if(o.timestamp=qa(),!(null==(n=_l[0])?void 0:n.isFrozen())||o.type===dl.FullSnapshot||o.type===dl.IncrementalSnapshot&&o.data.source===pl.Mutation||_l.forEach(e=>e.unfreeze()),D)null==t||t(B(o),i);else if(P){const e={type:"rrweb",event:B(o),origin:window.location.origin,isCheckout:i};window.parent.postMessage(e,"*")}if(o.type===dl.FullSnapshot)F=o,U=0;else if(o.type===dl.IncrementalSnapshot){if(o.data.source===pl.Mutation&&o.data.isAttachIframe)return;U++;const e=r&&U>=r,t=s&&o.timestamp-F.timestamp>s;(e||t)&&cc(!0)}};const $=e=>{lc({type:dl.IncrementalSnapshot,data:{source:pl.Mutation,...e}})},z=e=>lc({type:dl.IncrementalSnapshot,data:{source:pl.Scroll,...e}}),j=e=>lc({type:dl.IncrementalSnapshot,data:{source:pl.CanvasMutation,...e}}),W=new oc({mutationCb:$,adoptedStyleSheetCb:e=>lc({type:dl.IncrementalSnapshot,data:{source:pl.AdoptedStyleSheet,...e}})}),K=new Wl({mirror:dc,mutationCb:$,stylesheetManager:W,recordCrossOriginIframes:I,wrappedEmit:lc});for(const e of _||[])e.getMirror&&e.getMirror({nodeMirror:dc,crossOriginIframeMirror:K.crossOriginIframeMirror,crossOriginIframeStyleMirror:K.crossOriginIframeStyleMirror});const G=new ac;hc=new nc({recordCanvas:k,mutationCb:j,win:window,blockClass:i,blockSelector:n,mirror:dc,sampling:w.canvas,dataURLOptions:v});const V=new Kl({mutationCb:$,scrollCb:z,bypassOptions:{blockClass:i,blockSelector:n,maskTextClass:l,maskTextSelector:c,inlineStylesheet:h,maskInputOptions:L,dataURLOptions:v,maskTextFn:f,maskInputFn:m,recordCanvas:k,inlineImages:M,sampling:w,slimDOMOptions:N,iframeManager:K,stylesheetManager:W,canvasManager:hc,keepIframeSrcFn:O,processedNodeManager:G},mirror:dc});cc=(e=!1)=>{if(!C)return;lc({type:dl.Meta,data:{href:window.location.href,width:Qa(),height:Xa()}},e),W.reset(),V.init(),_l.forEach(e=>e.lock());const t=function(e,t){const{mirror:s=new b,blockClass:r="rr-block",blockSelector:i=null,maskTextClass:n="rr-mask",maskTextSelector:o=null,inlineStylesheet:a=!0,inlineImages:l=!1,recordCanvas:c=!1,maskAllInputs:h=!1,maskTextFn:u,maskInputFn:d,slimDOM:p=!1,dataURLOptions:m,preserveWhiteSpace:f,onSerialize:g,onIframeLoad:y,iframeLoadTimeout:w,onStylesheetLoad:v,stylesheetLoadTimeout:S,keepIframeSrcFn:C=()=>!1}=t||{};return X(e,{doc:e,mirror:s,blockClass:r,blockSelector:i,maskTextClass:n,maskTextSelector:o,skipChild:!1,inlineStylesheet:a,maskInputOptions:!0===h?{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}:!1===h?{password:!0}:h,maskTextFn:u,maskInputFn:d,slimDOMOptions:J(p),dataURLOptions:m,inlineImages:l,recordCanvas:c,preserveWhiteSpace:f,onSerialize:g,onIframeLoad:y,iframeLoadTimeout:w,onStylesheetLoad:v,stylesheetLoadTimeout:S,keepIframeSrcFn:C,newlyAddedElement:!1})}(document,{mirror:dc,blockClass:i,blockSelector:n,maskTextClass:l,maskTextSelector:c,inlineStylesheet:h,maskAllInputs:L,maskTextFn:f,maskInputFn:m,slimDOM:N,dataURLOptions:v,recordCanvas:k,inlineImages:M,onSerialize:e=>{nl(e,dc)&&K.addIframe(e),ol(e,dc)&&W.trackLinkElement(e),al(e)&&V.addShadowRoot(Ka.shadowRoot(e),document)},onIframeLoad:(e,t)=>{K.attachIframe(e,t),V.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{W.attachLinkElement(e,t)},keepIframeSrcFn:O});if(!t)return console.warn("Failed to snapshot the document");lc({type:dl.FullSnapshot,data:{node:t,initialOffset:Ja(window)}},e),_l.forEach(e=>e.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&W.adoptStyleSheets(document.adoptedStyleSheets,dc.getId(document))};try{const e=[],t=e=>{var t;return Ml(Bl)({mutationCb:$,mousemoveCb:(e,t)=>lc({type:dl.IncrementalSnapshot,data:{source:t,positions:e}}),mouseInteractionCb:e=>lc({type:dl.IncrementalSnapshot,data:{source:pl.MouseInteraction,...e}}),scrollCb:z,viewportResizeCb:e=>lc({type:dl.IncrementalSnapshot,data:{source:pl.ViewportResize,...e}}),inputCb:e=>lc({type:dl.IncrementalSnapshot,data:{source:pl.Input,...e}}),mediaInteractionCb:e=>lc({type:dl.IncrementalSnapshot,data:{source:pl.MediaInteraction,...e}}),styleSheetRuleCb:e=>lc({type:dl.IncrementalSnapshot,data:{source:pl.StyleSheetRule,...e}}),styleDeclarationCb:e=>lc({type:dl.IncrementalSnapshot,data:{source:pl.StyleDeclaration,...e}}),canvasMutationCb:j,fontCb:e=>lc({type:dl.IncrementalSnapshot,data:{source:pl.Font,...e}}),selectionCb:e=>{lc({type:dl.IncrementalSnapshot,data:{source:pl.Selection,...e}})},customElementCb:e=>{lc({type:dl.IncrementalSnapshot,data:{source:pl.CustomElement,...e}})},blockClass:i,ignoreClass:o,ignoreSelector:a,maskTextClass:l,maskTextSelector:c,maskInputOptions:L,inlineStylesheet:h,sampling:w,recordDOM:C,recordCanvas:k,inlineImages:M,userTriggeredOnInput:T,collectFonts:x,doc:e,maskInputFn:m,maskTextFn:f,keepIframeSrcFn:O,blockSelector:n,slimDOMOptions:N,dataURLOptions:v,mirror:dc,iframeManager:K,stylesheetManager:W,shadowDomManager:V,processedNodeManager:G,canvasManager:hc,ignoreCSSAttributes:A,plugins:(null==(t=null==_?void 0:_.filter(e=>e.observer))?void 0:t.map(e=>({observer:e.observer,options:e.options,callback:t=>lc({type:dl.Plugin,data:{plugin:e.name,payload:t}})})))||[]},g)};K.addLoadListener(s=>{try{e.push(t(s.contentDocument))}catch(e){console.warn(e)}});const s=()=>{cc(),e.push(t(document)),uc=!0};return["interactive","complete"].includes(document.readyState)?s():(e.push(Ga("DOMContentLoaded",()=>{lc({type:dl.DomContentLoaded,data:{}}),"DOMContentLoaded"===E&&s()})),e.push(Ga("load",()=>{lc({type:dl.Load,data:{}}),"load"===E&&s()},window))),()=>{e.forEach(e=>{try{e()}catch(e){String(e).toLowerCase().includes("cross-origin")||console.warn(e)}}),G.destroy(),uc=!1,xl=void 0}}catch(e){console.warn(e)}}var mc,fc;pc.addCustomEvent=(e,t)=>{if(!uc)throw new Error("please add custom event after start recording");lc({type:dl.Custom,data:{tag:e,payload:t}})},pc.freezePage=()=>{_l.forEach(e=>e.freeze())},pc.takeFullSnapshot=e=>{if(!uc)throw new Error("please take full snapshot after start recording");cc(e)},pc.mirror=dc,(fc=mc||(mc={}))[fc.NotStarted=0]="NotStarted",fc[fc.Running=1]="Running",fc[fc.Stopped=2]="Stopped";const gc=[];for(let e=0;e<256;++e)gc.push((e+256).toString(16).slice(1));let yc;const wc=new Uint8Array(16);const vc={};function Sc(e,t,s){let r;{const e=Date.now(),i=function(){if(!yc){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");yc=crypto.getRandomValues.bind(crypto)}return yc(wc)}();!function(e,t,s){e.msecs??=-1/0,e.nsecs??=0,t===e.msecs?(e.nsecs++,e.nsecs>=1e4&&(e.node=void 0,e.nsecs=0)):t>e.msecs?e.nsecs=0:t<e.msecs&&(e.node=void 0);e.node||(e.node=s.slice(10,16),e.node[0]|=1,e.clockseq=16383&(s[8]<<8|s[9]));e.msecs=t}(vc,e,i),r=function(e,t,s,r,i,n,o=0){if(e.length<16)throw new Error("Random bytes length must be >= 16");if(n){if(o<0||o+16>n.length)throw new RangeError(`UUID byte range ${o}:${o+15} is out of buffer bounds`)}else n=new Uint8Array(16),o=0;t??=Date.now(),s??=0,r??=16383&(e[8]<<8|e[9]),i??=e.slice(10,16);const a=(1e4*(268435455&(t+=122192928e5))+s)%4294967296;n[o++]=a>>>24&255,n[o++]=a>>>16&255,n[o++]=a>>>8&255,n[o++]=255&a;const l=t/4294967296*1e4&268435455;n[o++]=l>>>8&255,n[o++]=255&l,n[o++]=l>>>24&15|16,n[o++]=l>>>16&255,n[o++]=r>>>8|128,n[o++]=255&r;for(let e=0;e<6;++e)n[o++]=i[e];return n}(i,vc.msecs,vc.nsecs,vc.clockseq,vc.node,t,s)}return t??function(e,t=0){return(gc[e[t+0]]+gc[e[t+1]]+gc[e[t+2]]+gc[e[t+3]]+"-"+gc[e[t+4]]+gc[e[t+5]]+"-"+gc[e[t+6]]+gc[e[t+7]]+"-"+gc[e[t+8]]+gc[e[t+9]]+"-"+gc[e[t+10]]+gc[e[t+11]]+gc[e[t+12]]+gc[e[t+13]]+gc[e[t+14]]+gc[e[t+15]]).toLowerCase()}(r)}var bc;e.LogLevel=void 0,(bc=e.LogLevel||(e.LogLevel={}))[bc.NONE=0]="NONE",bc[bc.ERROR=1]="ERROR",bc[bc.WARN=2]="WARN",bc[bc.INFO=3]="INFO",bc[bc.DEBUG=4]="DEBUG";const Cc=new class{constructor(t){this.config={level:e.LogLevel.ERROR,enableConsole:!0,enableStorage:!1},this.isBrowser="undefined"!=typeof window,t&&(this.config={...this.config,...t})}setConfig(e){this.config={...this.config,...e}}shouldLog(e){return e<=this.config.level}formatMessage(e,t,...s){return`[HumanBehavior ${e}] ${(new Date).toISOString()}: ${t}`}error(t,...s){if(!this.shouldLog(e.LogLevel.ERROR))return;const r=this.formatMessage("ERROR",t);this.config.enableConsole&&console.error(r,...s),this.config.enableStorage&&this.isBrowser&&this.logToStorage(r,s)}warn(t,...s){if(!this.shouldLog(e.LogLevel.WARN))return;const r=this.formatMessage("WARN",t);this.config.enableConsole&&console.warn(r,...s),this.config.enableStorage&&this.isBrowser&&this.logToStorage(r,s)}info(t,...s){if(!this.shouldLog(e.LogLevel.INFO))return;const r=this.formatMessage("INFO",t);this.config.enableConsole&&console.log(r,...s),this.config.enableStorage&&this.isBrowser&&this.logToStorage(r,s)}debug(t,...s){if(!this.shouldLog(e.LogLevel.DEBUG))return;const r=this.formatMessage("DEBUG",t);this.config.enableConsole&&console.log(r,...s),this.config.enableStorage&&this.isBrowser&&this.logToStorage(r,s)}logToStorage(e,t){try{const s=JSON.parse(localStorage.getItem("human_behavior_logs")||"[]"),r={message:e,args:t.length>0?t:void 0,timestamp:Date.now()};s.push(r),s.length>1e3&&s.splice(0,s.length-1e3),localStorage.setItem("human_behavior_logs",JSON.stringify(s))}catch(e){}}getLogs(){if(!this.isBrowser)return[];try{return JSON.parse(localStorage.getItem("human_behavior_logs")||"[]")}catch(e){return[]}}clearLogs(){this.isBrowser&&localStorage.removeItem("human_behavior_logs")}};let kc=!1;const Ic=()=>kc,Ec=(e,...t)=>{kc=!0;try{Cc.error(e,...t)}finally{kc=!1}},Tc=(e,...t)=>{kc=!0;try{Cc.warn(e,...t)}finally{kc=!1}},xc=(e,...t)=>{kc=!0;try{Cc.info(e,...t)}finally{kc=!1}},Mc=(e,...t)=>{kc=!0;try{Cc.debug(e,...t)}finally{kc=!1}};class _c{constructor(e){this._isPolling=!1,this._pollIntervalMs=3e3,this._queue=[],this._queue=[],this._areWeOnline=!0,this._sendRequest=e,"undefined"!=typeof window&&"onLine"in window.navigator&&(this._areWeOnline=window.navigator.onLine,window.addEventListener("online",()=>{this._areWeOnline=!0,this._flush()}),window.addEventListener("offline",()=>{this._areWeOnline=!1}))}get length(){return this._queue.length}async retriableRequest(e){const t=e.retriesPerformedSoFar||0;if(t>0){const s=new URL(e.url);s.searchParams.set("retry_count",t.toString()),e.url=s.toString()}try{await this._sendRequest(e)}catch(s){if(this._shouldRetry(s,t)&&t<10)return void this._enqueue(e);e.callback&&e.callback({statusCode:s.status||0,text:s.message||"Request failed"})}}_shouldRetry(e,t){return e.status>=400&&e.status<500?408===e.status||429===e.status:e.status>=500||!e.status}_enqueue(e){const t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;const s=function(e){const t=3e3*2**e,s=t/2,r=Math.min(18e5,t),i=(Math.random()-.5)*(r-s);return Math.ceil(r+i)}(t),r=Date.now()+s;this._queue.push({retryAt:r,requestOptions:e});let i=`Enqueued failed request for retry in ${Math.round(s/1e3)}s`;"undefined"==typeof navigator||navigator.onLine||(i+=" (Browser is offline)"),Tc(i),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(){const e=Date.now(),t=[],s=this._queue.filter(s=>s.retryAt<e||(t.push(s),!1));if(this._queue=t,s.length>0)for(const{requestOptions:e}of s)this.retriableRequest(e).catch(e=>{Ec("Failed to retry request:",e)})}unload(){this._poller&&(clearTimeout(this._poller),this._poller=void 0);for(const{requestOptions:e}of this._queue)try{this._sendBeaconRequest(e)}catch(e){Ec("Failed to send request via sendBeacon on unload:",e)}this._queue=[]}_sendBeaconRequest(e){if("undefined"!=typeof navigator&&navigator.sendBeacon)try{const t=new URL(e.url);t.searchParams.set("beacon","1");let s=null;e.body&&("string"==typeof e.body?s=new Blob([e.body],{type:"application/json"}):e.body instanceof Blob&&(s=e.body)),navigator.sendBeacon(t.toString(),s)||Tc("sendBeacon returned false for unload request")}catch(e){Ec("Error sending beacon request:",e)}}}class Oc{constructor(e,t=1e3){this.storageKey="human_behavior_queue",this.maxQueueSize=t}getQueue(){if("undefined"==typeof window||!window.localStorage)return[];try{const e=window.localStorage.getItem(this.storageKey);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch(e){return Tc("Failed to read persisted queue:",e),[]}}setQueue(e){if("undefined"!=typeof window&&window.localStorage)try{const t=e.slice(-this.maxQueueSize);window.localStorage.setItem(this.storageKey,JSON.stringify(t)),Mc(`Persisted ${t.length} events to storage`)}catch(t){if("QuotaExceededError"===t.name||22===t.code){Tc("Storage quota exceeded, clearing old events");try{const t=e.slice(-Math.floor(this.maxQueueSize/2));window.localStorage.setItem(this.storageKey,JSON.stringify(t))}catch(e){Tc("Failed to save smaller queue, clearing storage"),this.clearQueue()}}else Tc("Failed to persist queue:",t)}}addToQueue(e){const t=this.getQueue();t.push(e),t.length>this.maxQueueSize&&(t.shift(),Mc("Queue is full, the oldest event is dropped.")),this.setQueue(t)}removeFromQueue(e){const t=this.getQueue();t.splice(0,e),this.setQueue(t)}clearQueue(){if("undefined"!=typeof window&&window.localStorage)try{window.localStorage.removeItem(this.storageKey)}catch(e){Tc("Failed to clear persisted queue:",e)}}getQueueLength(){return this.getQueue().length}}const Ac="0.8.0-beta.0",Rc=1048576,Dc=52428.8;function Pc(e,t,s){return(new TextEncoder).encode(Lc({sessionId:s,events:[...e,t]})).length>Rc}function Lc(e){return JSON.stringify(e,(e,t)=>"bigint"==typeof t?t.toString():t)}function Nc(e,t){if(!e||"object"!=typeof e)return[];if((new TextEncoder).encode(Lc({sessionId:t,events:[e]})).length<=Rc)return[e];const s={...e},r=["screenshot","html","dom","fullText","innerHTML","outerHTML"];return r.forEach(e=>{s[e]&&delete s[e]}),(new TextEncoder).encode(Lc({sessionId:t,events:[s]})).length<=Rc?[s]:[{type:e.type,timestamp:e.timestamp,url:e.url,pathname:e.pathname,...Object.fromEntries(Object.entries(e).filter(([e,t])=>!r.includes(e)&&"object"!=typeof t&&"string"!=typeof t||"string"==typeof t&&t.length<1e3))}]}class Fc{constructor({apiKey:e,ingestionUrl:t}){this.monthlyLimitReached=!1,this.sessionId="",this.endUserId=null,this.cspBlocked=!1,this.requestTimeout=1e4,this.currentBatchSize=100,this.apiKey=e,this.baseUrl=t,this.persistence=new Oc(e),this.retryQueue=new _c(e=>this._sendRequestInternal(e)),this._loadPersistedEvents()}setTrackingContext(e,t){this.sessionId=e,this.endUserId=t}async _loadPersistedEvents(){const e=this.persistence.getQueue();if(0!==e.length){Mc(`Loading ${e.length} persisted events from storage`);for(const t of e)try{await this.sendEventsChunked(t.events,t.sessionId,t.endUserId||void 0,t.windowId,t.automaticProperties),this.persistence.removeFromQueue(1)}catch(e){Tc("Failed to send persisted event, will retry later:",e)}}}async _sendRequestInternal(e){const t="undefined"!=typeof AbortController?new AbortController:null;let s=null;t&&(s=setTimeout(()=>{t.abort()},this.requestTimeout));try{const r=e.estimatedSize||0,i="POST"===e.method&&r<Dc,n=await fetch(e.url,{method:e.method||"GET",headers:e.headers||{},body:e.body,signal:t?.signal,keepalive:i});s&&clearTimeout(s);const o=await n.text();let a=null;try{a=JSON.parse(o)}catch{}if(e.callback&&e.callback({statusCode:n.status,text:o,json:a}),!n.ok)throw{status:n.status,message:o}}catch(e){if(s&&clearTimeout(s),"AbortError"===e.name)throw{status:0,message:"Request timeout"};throw e}}unload(){this.retryQueue.unload()}checkMonthlyLimit(){return!this.monthlyLimitReached}async init(e,t){if(!this.checkMonthlyLimit())return{sessionId:e,endUserId:t};let s=null,r=null;"undefined"!=typeof window&&(s=window.location.href,r=document.referrer),xc("API init called with:",{sessionId:e,userId:t,entryURL:s,referrer:r,baseUrl:this.baseUrl});try{const i=await this.trackedFetch(`${this.baseUrl}/api/ingestion/init`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`,Referer:r||""},body:Lc({sessionId:e,endUserId:t,entryURL:s,referrer:r,sdkVersion:Ac})});if(xc("API init response status:",i.status),!i.ok){if(429===i.status)return this.monthlyLimitReached=!0,{sessionId:e,endUserId:t};const s=await i.text();throw Ec("API init failed:",i.status,s),new Error(`Failed to initialize ingestion: ${i.statusText} - ${s}`)}const n=await i.json();return!0===n.monthlyLimitReached&&(this.monthlyLimitReached=!0,xc("Monthly limit reached detected from server response")),xc("API init success:",n),{sessionId:n.sessionId,endUserId:n.endUserId}}catch(e){throw Ec("API init error:",e),e}}async sendEvents(e,t,s){const r=e.filter(e=>e&&"object"==typeof e),i=await this.trackedFetch(`${this.baseUrl}/api/ingestion/events`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:Lc({sessionId:t,events:r,endUserId:s,sdkVersion:Ac})});if(!i.ok){if(429===i.status)throw this.monthlyLimitReached=!0,new Error("429: Monthly video processing limit reached");throw new Error(`Failed to send events: ${i.statusText}`)}!0===(await i.json()).monthlyLimitReached&&(this.monthlyLimitReached=!0,xc("Monthly limit reached detected from events response"))}async sendEventsChunked(e,t,s,r,i){if(!this.checkMonthlyLimit())return[];try{const n=[];let o=[];for(const a of e)if(a&&"object"==typeof a)if(Pc(o,a,t)){if(o.length>0){Mc(`[SDK] Sending chunk with ${o.length} events`);const e=await this.trackedFetch(`${this.baseUrl}/api/ingestion/events`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:Lc({sessionId:t,events:o,endUserId:s,windowId:r,automaticProperties:i,sdkVersion:Ac})});if(!e.ok){if(429===e.status)return this.monthlyLimitReached=!0,n.flat();throw new Error(`Failed to send events: ${e.statusText}`)}const a=await e.json();!0===a.monthlyLimitReached&&(this.monthlyLimitReached=!0,xc("Monthly limit reached detected from chunked events response")),n.push(a),o=[]}o=Nc(a,t)}else o.push(a);if(o.length>0){const e=await this._sendChunkWithRetry(o,t,s,r,i||o[0]?.automaticProperties);e&&n.push(e)}return n.flat()}catch(n){throw Ec("Error sending events:",n),this._persistEvents(e,t,s,r,i),n}}async _sendChunkWithRetry(e,t,s,r,i){let n=Math.min(this.currentBatchSize,e.length),o=0;for(;o<e.length;){const a=Lc({sessionId:t,events:e.slice(o,o+n),endUserId:s,windowId:r,automaticProperties:i,sdkVersion:Ac}),l=(new TextEncoder).encode(a).length;try{const c=await this.trackedFetch(`${this.baseUrl}/api/ingestion/events`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:a},l);if(!c.ok){if(429===c.status)return this.monthlyLimitReached=!0,this._persistEvents(e.slice(o),t,s,r,i),null;if(413===c.status){Tc(`413 error: reducing batch size from ${n} to ${Math.max(1,Math.floor(n/2))}`),this.currentBatchSize=Math.max(1,Math.floor(n/2)),n=this.currentBatchSize;continue}return await this.retryQueue.retriableRequest({url:`${this.baseUrl}/api/ingestion/events`,method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:a,estimatedSize:l,callback:e=>{200===e.statusCode&&e.json&&!0===e.json.monthlyLimitReached&&(this.monthlyLimitReached=!0)}}),this._persistEvents(e.slice(o),t,s,r,i),null}const h=await c.json();if(!0===h.monthlyLimitReached&&(this.monthlyLimitReached=!0,xc("Monthly limit reached detected from chunked events response")),o+=n,o>=e.length)return h}catch(n){return Tc("Network error sending chunk, adding to retry queue:",n),await this.retryQueue.retriableRequest({url:`${this.baseUrl}/api/ingestion/events`,method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:a,estimatedSize:l,callback:e=>{200===e.statusCode&&e.json&&!0===e.json.monthlyLimitReached&&(this.monthlyLimitReached=!0)}}),this._persistEvents(e.slice(o),t,s,r,i),null}}return null}_persistEvents(e,t,s,r,i){0!==e.length&&this.persistence.addToQueue({sessionId:t,events:e,endUserId:s,windowId:r,automaticProperties:i,timestamp:Date.now()})}async sendUserData(e,t,s){try{const r={userId:e,userAttributes:t,sessionId:s,posthogName:t.email||t.name||null};Mc("Sending user data to server:",r);const i=await this.trackedFetch(`${this.baseUrl}/api/ingestion/user`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:Lc(r)});if(!i.ok)throw new Error(`Failed to send user data: ${i.statusText} with API key: ${this.apiKey}`);const n=await i.json();return Mc("Server response:",n),n}catch(e){throw Ec("Error sending user data:",e),e}}async sendUserAuth(e,t,s,r){try{const i=await this.trackedFetch(`${this.baseUrl}/api/ingestion/user/auth`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:Lc({userId:e,userAttributes:t,sessionId:s,authFields:r})});if(!i.ok)throw new Error(`Failed to authenticate user: ${i.statusText} with API key: ${this.apiKey}`);return await i.json()}catch(e){throw Ec("Error authenticating user:",e),e}}sendSessionEndBeacon(e,t){if("undefined"==typeof navigator||"function"!=typeof navigator.sendBeacon)return!1;try{const s={sessionId:e,endUserId:t||null,apiKey:this.apiKey},r=new Blob([Lc(s)],{type:"application/json"});return navigator.sendBeacon(`${this.baseUrl}/api/ingestion/session-end`,r)}catch{return!1}}sendHeartbeatBeacon(e,t){if("undefined"==typeof navigator||"function"!=typeof navigator.sendBeacon)return!1;try{const s={sessionId:e,endUserId:t||null,apiKey:this.apiKey},r=new Blob([Lc(s)],{type:"application/json"});return navigator.sendBeacon(`${this.baseUrl}/api/ingestion/heartbeat`,r)}catch{return!1}}sendBeaconEvents(e,t,s,r,i,n){const o={sessionId:t,events:e,endUserId:s||null,windowId:r,automaticProperties:i,sdkVersion:Ac,apiKey:this.apiKey},a=new Blob([Lc(o)],{type:"application/json"});return navigator.sendBeacon(`${this.baseUrl}/api/ingestion/events`,a)}async sendCustomEvent(e,t,s,r){xc("[SDK] Sending custom event",{sessionId:e,eventName:t,eventProperties:s,endUserId:r});try{const i=await this.trackedFetch(`${this.baseUrl}/api/ingestion/customEvent`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:Lc({sessionId:e,eventName:t,eventProperties:s||{},endUserId:r||null})});if(xc("[SDK] Custom event response",{status:i.status,statusText:i.statusText}),!i.ok){const e=await i.text();throw Ec("[SDK] Failed to send custom event",{status:i.status,statusText:i.statusText,errorText:e}),new Error(`Failed to send custom event: ${i.status} ${i.statusText} - ${e}`)}const n=await i.json();return Mc("[SDK] Custom event success",n),n}catch(r){throw Ec("[SDK] Error sending custom event",r,{sessionId:e,eventName:t,eventProperties:s}),r}}async sendCustomEventBatch(e,t,s){try{const r=await this.trackedFetch(`${this.baseUrl}/api/ingestion/customEvent/batch`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:Lc({sessionId:e,events:t,endUserId:s||null})});if(!r.ok)throw new Error(`Failed to send custom event batch: ${r.statusText}`);return await r.json()}catch(e){throw Ec("Error sending custom event batch:",e),e}}sendCustomEventBatchBeacon(e,t,s){if("undefined"==typeof navigator||"function"!=typeof navigator.sendBeacon)return!1;try{const r={sessionId:e,events:t,endUserId:s||null,apiKey:this.apiKey},i=new Blob([Lc(r)],{type:"application/json"});return navigator.sendBeacon(`${this.baseUrl}/api/ingestion/customEvent/batch`,i)}catch{return!1}}async sendLog(e){try{if(Mc("[SDK] Sending log to server:",{level:e.level,message:e.message.substring(0,50),sessionId:e.sessionId}),!this.baseUrl)return;if(!e.sessionId)return;const t=await fetch(`${this.baseUrl}/api/ingestion/logs`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:Lc(e)});t.ok?Mc("[SDK] Log sent successfully"):Tc("[SDK] Failed to send log to server:",t.status,t.statusText)}catch(e){Tc("[SDK] Failed to send log to server:",e)}}async sendNetworkError(e){try{if(Mc("[SDK] Sending network error to server:",{errorType:e.errorType,url:e.url.substring(0,50),sessionId:e.sessionId}),!this.baseUrl)return;if(!e.sessionId)return;const t=await fetch(`${this.baseUrl}/api/ingestion/network`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:Lc(e)});t.ok?Mc("[SDK] Network error sent successfully"):Tc("[SDK] Failed to send network error to server:",t.status,t.statusText)}catch(e){Tc("[SDK] Failed to send network error to server:",e)}}async sendIpInfo(e,t){try{if(!this.baseUrl||!e||!t)return;const s=await fetch(`${this.baseUrl}/api/ingestion/ip-info`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:Lc({sessionId:e,endUserId:t,ipDetectionMethod:"server_header"})});s.ok||Tc("[SDK] Failed to send ip-info:",s.status,s.statusText)}catch(e){Tc("[SDK] Failed to send ip-info:",e)}}async trackedFetch(e,t,s){const r=Date.now(),i=Sc(),n=this.shouldSkipNetworkTracking(e);if(this.cspBlocked&&"POST"===t.method&&"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon)return this.trackedFetchWithBeaconFallback(e,t,n);try{const o="undefined"!=typeof AbortController?new AbortController:null;let a=null;o&&(a=setTimeout(()=>{o.abort()},this.requestTimeout));const l="POST"===t.method&&void 0!==s&&s<Dc,c=await fetch(e,{...t,signal:o?.signal,keepalive:l});a&&clearTimeout(a);const h=Date.now()-r;return c.ok||n||await this.sendNetworkError({requestId:i,url:e,method:t.method||"GET",status:c.status,statusText:c.statusText,duration:h,timestampMs:Date.now(),sessionId:this.sessionId,endUserId:this.endUserId,errorType:this.classifyHttpError(c.status),errorMessage:c.statusText,startTimeMs:r,spanName:`${t.method||"GET"} ${e}`,spanStatus:"error",attributes:{"http.status_code":c.status,"http.status_text":c.statusText}}).catch(()=>{}),c}catch(s){const o=Date.now()-r;if("AbortError"===s.name){const e=new Error("Request timeout");e.name="TimeoutError",s=e}if(this.isCSPViolation(s)&&"POST"===t.method&&"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon)return this.cspBlocked=!0,Tc("[SDK] CSP violation detected, falling back to sendBeacon for future requests"),this.trackedFetchWithBeaconFallback(e,t,n);throw n||await this.sendNetworkError({requestId:i,url:e,method:t.method||"GET",status:null,statusText:null,duration:o,timestampMs:Date.now(),sessionId:this.sessionId,endUserId:this.endUserId,errorType:this.classifyNetworkError(s),errorMessage:s.message,errorName:s.name,startTimeMs:r,spanName:`${t.method||"GET"} ${e}`,spanStatus:"error",attributes:{"error.name":s.name,"error.message":s.message}}).catch(()=>{}),s}}async trackedFetchWithBeaconFallback(e,t,s){try{let s=null,r="";if(t.body)if("string"==typeof t.body)try{s=JSON.parse(t.body),r=t.body}catch{r=t.body}else{if(t.body instanceof Blob)return Tc("[SDK] Cannot extract apiKey from Blob body for sendBeacon, using URL param"),e=`${e}${e.includes("?")?"&":"?"}apiKey=${encodeURIComponent(this.apiKey)}`,navigator.sendBeacon(e,t.body)?new Response(null,{status:200,statusText:"OK",headers:new Headers}):new Response(null,{status:500,statusText:"sendBeacon failed",headers:new Headers});r=Lc(t.body),s=t.body}if(e.includes("/api/ingestion/"))if(s&&"object"==typeof s)s.apiKey=this.apiKey,r=Lc(s);else if(r)try{const e=JSON.parse(r);e.apiKey=this.apiKey,r=Lc(e)}catch{e=`${e}${e.includes("?")?"&":"?"}apiKey=${encodeURIComponent(this.apiKey)}`}else e=`${e}${e.includes("?")?"&":"?"}apiKey=${encodeURIComponent(this.apiKey)}`;else e=`${e}${e.includes("?")?"&":"?"}apiKey=${encodeURIComponent(this.apiKey)}`;const i=r?new Blob([r],{type:"application/json"}):null;return navigator.sendBeacon(e,i)?(Mc("[SDK] Successfully sent request via sendBeacon (CSP fallback)"),new Response(null,{status:200,statusText:"OK",headers:new Headers})):(Tc("[SDK] sendBeacon returned false - browser may be throttling"),new Response(null,{status:200,statusText:"OK (sendBeacon best-effort)",headers:new Headers}))}catch(e){return Ec("[SDK] sendBeacon fallback failed:",e),new Response(null,{status:500,statusText:"Failed to send via sendBeacon",headers:new Headers})}}isCSPViolation(e){const t=(e?.message||"").toLowerCase();return"typeerror"===(e?.name||"").toLowerCase()&&t.includes("failed to fetch")||t.includes("content security policy")||t.includes("csp")||t.includes("violates")||t.includes("refused to connect")&&t.includes("violates")}shouldSkipNetworkTracking(e){if(!e||!this.baseUrl)return!1;try{const t=new URL(e),s=new URL(this.baseUrl);return!(t.origin!==s.origin||!t.pathname.startsWith("/api/ingestion/"))||!!e.includes(this.baseUrl)}catch(t){return e.includes(this.baseUrl)}}classifyHttpError(e){return e>=400&&e<500?"client_error":e>=500?"server_error":"unknown_error"}classifyNetworkError(e){const t=e.message||"",s=e.name||"";return this.isCSPViolation(e)?"csp_violation":t.includes("ERR_BLOCKED_BY_CLIENT")||t.includes("ERR_BLOCKED_BY_RESPONSE")||t.includes("blocked:other")||t.includes("net::ERR_BLOCKED_BY_CLIENT")||t.includes("net::ERR_BLOCKED_BY_RESPONSE")||"TypeError"===s&&t.includes("Failed to fetch")&&(t.includes("blocked")||t.includes("ERR_BLOCKED"))?"blocked_by_client":t.includes("CORS")||t.includes("Access-Control")?"cors_error":t.includes("timeout")||"TimeoutError"===s?"timeout_error":t.includes("Failed to fetch")||t.includes("NetworkError")?"network_error":"unknown_error"}}class Uc{constructor(e){if(this.redactedText="[REDACTED]",this.unredactedFields=new Set,this.redactedFields=new Set,this.redactionMode="privacy-first",this.excludeSelectors=['[data-no-redact="true"]',".human-behavior-no-redact"],e?.redactedText&&(this.redactedText=e.redactedText),e?.excludeSelectors&&(this.excludeSelectors=[...this.excludeSelectors,...e.excludeSelectors]),e?.redactionStrategy)if(this.redactionMode=e.redactionStrategy.mode,"privacy-first"===this.redactionMode)e.redactionStrategy.unredactFields&&this.setFieldsToUnredact(e.redactionStrategy.unredactFields);else{const t=['input[type="password"]','[data-hb-redact="true"]'],s=e.redactionStrategy.redactFields&&e.redactionStrategy.redactFields.length>0?e.redactionStrategy.redactFields:t;this.setFieldsToRedact(s)}e?.legacyRedactFields&&this.setFieldsToUnredact(e.legacyRedactFields),e?.userFields&&this.setFieldsToUnredact(e.userFields)}setFieldsToRedact(e){this.redactedFields.clear(),['input[type="password"]','input[type="password" i]','[type="password"]','[type="password" i]',...e].forEach(e=>{this.redactedFields.add(e)}),this.redactedFields.size>0?Mc(`Redaction: Active for ${this.redactedFields.size} field(s):`,Array.from(this.redactedFields)):Mc("Redaction: No fields to redact"),this.applyRedactionClasses()}setFieldsToUnredact(e){this.unredactedFields.clear();const t=e.filter(e=>!this.isPasswordSelector(e)||(Tc(`Cannot unredact password field: ${e} - Password fields are always protected`),!1));t.forEach(e=>this.unredactedFields.add(e)),t.length>0?Mc(`Unredaction: Active for ${t.length} field(s):`,t):Mc("Unredaction: No valid fields to unredact"),this.applyUnredactionClasses()}redactFields(e){e.forEach(e=>{this.unredactedFields.delete(e)}),this.unredactedFields.size>0?Mc(`Unredaction: Removed ${e.length} field(s), ${this.unredactedFields.size} remaining:`,Array.from(this.unredactedFields)):Mc("Unredaction: All fields redacted"),this.applyUnredactionClasses()}clearUnredactedFields(){this.unredactedFields.clear(),Mc("Unredaction: All fields cleared, everything redacted"),this.removeUnredactionClasses()}hasUnredactedFields(){return this.unredactedFields.size>0}getRedactionMode(){return this.redactionMode}getUnredactedFields(){return Array.from(this.unredactedFields)}getMaskTextSelector(){return"privacy-first"===this.redactionMode?0===this.unredactedFields.size?null:Array.from(this.unredactedFields).join(","):0===this.redactedFields.size?null:Array.from(this.redactedFields).join(",")}applyRedactionClasses(){0!==this.redactedFields.size&&("undefined"!=typeof document&&"loading"!==document.readyState?this.redactedFields.forEach(e=>{try{const t=document.querySelectorAll(e);t.forEach(e=>{e&&e.classList&&e.classList.add("rr-mask")}),Mc(`Added rr-mask class to ${t.length} element(s) for selector: ${e}`)}catch(t){Tc(`Invalid selector: ${e}`)}}):Mc("DOM not ready, deferring redaction class application"))}applyUnredactionClasses(){0!==this.unredactedFields.size&&("undefined"!=typeof document&&"loading"!==document.readyState?this.unredactedFields.forEach(e=>{try{const t=document.querySelectorAll(e);t.forEach(e=>{e&&e.classList&&e.classList.remove("rr-mask")}),Mc(`Removed rr-mask class from ${t.length} element(s) for selector: ${e}`)}catch(t){Tc(`Invalid selector: ${e}`)}}):Mc("DOM not ready, deferring unredaction class application"))}removeUnredactionClasses(){Mc("Unredaction classes removed")}isPasswordSelector(e){return['input[type="password"]','input[type="password" i]','[type="password"]','[type="password" i]'].some(t=>e.toLowerCase().includes(t.toLowerCase().replace(/[\[\]]/g,"")))}getOriginalValue(e){if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)return e.value}isElementUnredacted(e){return this.shouldUnredactElement(e)}shouldUnredactElement(e){if("privacy-first"===this.redactionMode){if(0===this.unredactedFields.size)return!1;for(const t of this.unredactedFields)try{if(e.matches(t))return!0}catch(e){Tc(`Invalid selector: ${t}`)}return!1}if(0===this.redactedFields.size)return!0;for(const t of this.redactedFields)try{if(e.matches(t))return!1}catch(e){Tc(`Invalid selector: ${t}`)}return!0}}new Uc;const Bc="undefined"!=typeof window;function $c(){if(!Bc)return"unknown";const e=navigator.userAgent.toLowerCase(),t=window.screen.width,s=window.screen.height;return/mobile|android|iphone|ipad|ipod|blackberry|windows phone/i.test(e)?/ipad/i.test(e)||t>=768&&s>=1024?"tablet":"mobile":/windows|macintosh|linux/i.test(e)?"desktop":"unknown"}function zc(e){try{return new URL(e).hostname}catch{return""}}function jc(){if(!Bc)return{device_type:"unknown",browser:"unknown",browser_version:"unknown",os:"unknown",os_version:"unknown",screen_resolution:"unknown",viewport_size:"unknown",color_depth:0,timezone:"unknown",language:"unknown",languages:[]};const{browser:e,browser_version:t}=function(){if(!Bc)return{browser:"unknown",browser_version:"unknown"};const e=navigator.userAgent;if(/chrome/i.test(e)&&!/edge/i.test(e)){const t=e.match(/chrome\/(\d+)/i);return{browser:"chrome",browser_version:t?t[1]:"unknown"}}if(/firefox/i.test(e)){const t=e.match(/firefox\/(\d+)/i);return{browser:"firefox",browser_version:t?t[1]:"unknown"}}if(/safari/i.test(e)&&!/chrome/i.test(e)){const t=e.match(/version\/(\d+)/i);return{browser:"safari",browser_version:t?t[1]:"unknown"}}if(/edge/i.test(e)){const t=e.match(/edge\/(\d+)/i);return{browser:"edge",browser_version:t?t[1]:"unknown"}}if(/msie|trident/i.test(e)){const t=e.match(/msie (\d+)/i)||e.match(/rv:(\d+)/i);return{browser:"ie",browser_version:t?t[1]:"unknown"}}return{browser:"unknown",browser_version:"unknown"}}(),{os:s,os_version:r}=function(){if(!Bc)return{os:"unknown",os_version:"unknown"};const e=navigator.userAgent;if(/windows/i.test(e)){const t=e.match(/windows nt (\d+\.\d+)/i);let s="unknown";if(t){const e=parseFloat(t[1]);s=10===e?"10":6.3===e?"8.1":6.2===e?"8":6.1===e?"7":t[1]}return{os:"windows",os_version:s}}if(/macintosh|mac os x/i.test(e)){const t=e.match(/mac os x (\d+[._]\d+)/i);return{os:"macos",os_version:t?t[1].replace("_","."):"unknown"}}if(/iphone|ipad|ipod/i.test(e)){const t=e.match(/os (\d+[._]\d+)/i);return{os:"ios",os_version:t?t[1].replace("_","."):"unknown"}}if(/android/i.test(e)){const t=e.match(/android (\d+\.\d+)/i);return{os:"android",os_version:t?t[1]:"unknown"}}return/linux/i.test(e)?{os:"linux",os_version:"unknown"}:{os:"unknown",os_version:"unknown"}}();return{device_type:$c(),browser:e,browser_version:t,os:s,os_version:r,screen_resolution:`${window.screen.width}x${window.screen.height}`,viewport_size:`${window.innerWidth}x${window.innerHeight}`,color_depth:window.screen.colorDepth,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,language:navigator.language,languages:[...navigator.languages||[navigator.language]],raw_user_agent:navigator.userAgent}}function Wc(){if(!Bc)return{current_url:"",pathname:"",search:"",hash:"",title:"",referrer:"",referrer_domain:"",initial_referrer:"",initial_referrer_domain:""};const e=window.location.href,t=document.referrer,s=function(e){const t=new URL(e),s={};return["utm_source","utm_medium","utm_campaign","utm_term","utm_content"].forEach(e=>{const r=t.searchParams.get(e);r&&(s[e]=r)}),s}(e);return{current_url:e,pathname:window.location.pathname,search:window.location.search,hash:window.location.hash,title:document.title,referrer:t,referrer_domain:zc(t),initial_referrer:t,initial_referrer_domain:zc(t),initial_host:window.location.hostname,...s}}function Kc(){return{...jc(),...Wc()}}function Gc(){if(!Bc)return{};const e=Wc();return{initial_referrer:e.initial_referrer,initial_referrer_domain:e.initial_referrer_domain,initial_url:e.current_url,initial_pathname:e.pathname,initial_utm_source:e.utm_source,initial_utm_medium:e.utm_medium,initial_utm_campaign:e.utm_campaign,initial_utm_term:e.utm_term,initial_utm_content:e.utm_content}}function Vc(){if(!Bc)return{};const e=Wc();return{current_url:e.current_url,pathname:e.pathname,search:e.search,hash:e.hash,title:e.title,referrer:e.referrer,referrer_domain:e.referrer_domain,utm_source:e.utm_source,utm_medium:e.utm_medium,utm_campaign:e.utm_campaign,utm_term:e.utm_term,utm_content:e.utm_content}}class Hc{constructor(e={}){this.sessionProperties={},this.userProperties={},this.initialProperties={},this.isInitialized=!1,this.config={enableAutomaticProperties:!0,enableSessionProperties:!0,enableUserProperties:!0,propertyDenylist:[],...e},this.automaticProperties=Kc(),this.initialize()}initialize(){this.isInitialized||(this.initialProperties=Gc(),this.loadSessionProperties(),this.isInitialized=!0)}getEventProperties(e={}){const t={};return this.config.enableAutomaticProperties&&(Object.assign(t,this.getAutomaticProperties()),this.config.enableSessionProperties&&Object.assign(t,this.sessionProperties),this.config.enableUserProperties&&Object.assign(t,this.userProperties),this.sessionProperties.$initial_properties_captured||(Object.assign(t,this.initialProperties),this.setSessionProperty("$initial_properties_captured",!0))),Object.assign(t,e),this.applyDenylist(t),t}getAutomaticProperties(){return{...this.automaticProperties,...Vc()}}getAutomaticPropertiesWithGeoIP(e={}){return{...this.automaticProperties,...Vc(),...e}}setSessionProperty(e,t){this.sessionProperties[e]=t,this.saveSessionProperties()}setSessionProperties(e){Object.assign(this.sessionProperties,e),this.saveSessionProperties()}getSessionProperty(e){return this.sessionProperties[e]}removeSessionProperty(e){delete this.sessionProperties[e],this.saveSessionProperties()}setUserProperty(e,t){this.userProperties[e]=t}setUserProperties(e){Object.assign(this.userProperties,e)}getUserProperty(e){return this.userProperties[e]}removeUserProperty(e){delete this.userProperties[e]}setOnce(e,t,s="user"){"session"===s?e in this.sessionProperties||this.setSessionProperty(e,t):e in this.userProperties||this.setUserProperty(e,t)}clearSessionProperties(){this.sessionProperties={},this.saveSessionProperties()}clearUserProperties(){this.userProperties={}}reset(){this.clearSessionProperties(),this.clearUserProperties(),this.initialProperties={},this.isInitialized=!1,this.initialize()}loadSessionProperties(){if("undefined"!=typeof sessionStorage)try{const e=sessionStorage.getItem("hb_session_properties");e&&(this.sessionProperties=JSON.parse(e))}catch(e){console.warn("Failed to load session properties:",e)}}saveSessionProperties(){if("undefined"!=typeof sessionStorage)try{sessionStorage.setItem("hb_session_properties",JSON.stringify(this.sessionProperties))}catch(e){console.warn("Failed to save session properties:",e)}}applyDenylist(e){this.config.propertyDenylist&&0!==this.config.propertyDenylist.length&&this.config.propertyDenylist.forEach(t=>{delete e[t]})}updateAutomaticProperties(){this.automaticProperties=Kc()}getAllProperties(){return{automatic:this.getAutomaticProperties(),session:{...this.sessionProperties},user:{...this.userProperties},initial:{...this.initialProperties}}}}const Yc="undefined"!=typeof window;class Zc{get isTrackerStarted(){return this.isStarted}setupDomReadyHandler(){if(Yc)if("complete"===document.readyState||"interactive"===document.readyState)this.onDomReady();else if(document.addEventListener){document.addEventListener("DOMContentLoaded",()=>this.onDomReady(),{capture:!1});const e=setInterval(()=>{"interactive"!==document.readyState&&"complete"!==document.readyState||(clearInterval(e),this.onDomReady())},10);setTimeout(()=>clearInterval(e),5e3)}else this.onDomReady();else this.onDomReady()}onDomReady(){this.isDomReady||(this.isDomReady=!0,Mc("🎯 DOM is ready, processing queued requests"),this.requestQueue.forEach(e=>{this.processRequest(e)}),this.requestQueue=[],this.domReadyHandlers.forEach(e=>e()),this.domReadyHandlers=[])}queueRequest(e){this.isDomReady?this.processRequest(e):this.requestQueue.push(e)}async processRequest(e){switch(Mc("Processing queued request:",e),e.type){case"addEvent":await this.addEvent(e.event);break;case"identifyUser":await this.identifyUser(e.userProperties);break;case"trackPageView":this.trackPageView();break;default:Tc("Unknown request type:",e.type)}}registerDomReadyHandler(e){this.isDomReady?e():this.domReadyHandlers.push(e)}static init(e,t){if(Yc&&!1!==t?.suppressConsoleErrors){const e=console.error;console.error=(...t)=>{const s=t.join(" ");s.includes("SecurityError: Failed to execute 'toDataURL'")||s.includes("Tainted canvases may not be exported")||s.includes("Cannot inline img src=")||s.includes("Cross-Origin")||s.includes("CORS")||s.includes("Access-Control-Allow-Origin")||s.includes("Failed to load resource")||s.includes("net::ERR_BLOCKED_BY_CLIENT")||s.includes("NetworkError when attempting to fetch resource")||s.includes("Failed to fetch")||s.includes("TypeError: NetworkError")||s.includes("HumanBehavior ERROR")||s.includes("Failed to track custom event")||s.includes("Error sending custom event")||e.apply(console,t)};const t=console.warn;console.warn=(...e)=>{const s=e.join(" ");s.includes("Cannot inline img src=")||s.includes("Cross-Origin")||s.includes("CORS")||s.includes("Access-Control-Allow-Origin")||s.includes("Failed to load resource")||s.includes("net::ERR_BLOCKED_BY_CLIENT")||s.includes("NetworkError when attempting to fetch resource")||s.includes("Failed to fetch")||s.includes("Custom event network error")||s.includes("Request blocked by ad blocker")||t.apply(console,e)},window.addEventListener("error",e=>{const t=e.message||"";if(t.includes("SecurityError")||t.includes("Tainted canvases")||t.includes("toDataURL")||t.includes("Cross-Origin")||t.includes("CORS")||t.includes("NetworkError")||t.includes("Failed to fetch"))return e.preventDefault(),!1})}if(Yc&&window.__humanBehaviorGlobalTracker)return Mc("Tracker already initialized, returning existing instance"),window.__humanBehaviorGlobalTracker;t?.logLevel&&this.configureLogging({level:t.logLevel});const s=new Zc(e,t?.ingestionUrl,{enableAutomaticProperties:t?.enableAutomaticProperties,propertyDenylist:t?.propertyDenylist,redactionStrategy:t?.redactionStrategy,redactFields:t?.redactFields,maxQueueSize:t?.maxQueueSize,enableConsoleTracking:t?.enableConsoleTracking,enableNetworkTracking:t?.enableNetworkTracking,installMetadata:t?.installMetadata});return s.recordCanvas=t?.recordCanvas??!1,t?.redactFields&&s.setUnredactedFields(t.redactFields),!1!==t?.enableAutomaticTracking&&s.setupAutomaticTracking(t?.automaticTrackingOptions),s.start(),s}constructor(e,t,s){if(this.eventQueue=[],this.pendingCustomEvents=[],this.pendingLogs=[],this.pendingNetworkErrors=[],this.customEventBatch=[],this.customEventBatchTimer=null,this.CUSTOM_EVENT_FLUSH_MS=100,this.CUSTOM_EVENT_BATCH_MAX=50,this._sessionActivityTimestamp=null,this._sessionStartTimestamp=null,this.userProperties={},this.isProcessing=!1,this.flushInterval=null,this.FLUSH_INTERVAL_MS=3e3,this.heartbeatInterval=null,this.HEARTBEAT_INTERVAL_MS=3e4,this.SESSION_IDLE_TIMEOUT_MS=9e5,this.SESSION_MAX_LENGTH_MS=864e5,this.focusBlurGraceTimeout=null,this.FOCUS_BLUR_GRACE_MS=2e3,this.lastEmittedFocusState=null,this.endUserId=null,this.initialized=!1,this.initializationPromise=null,this.monthlyLimitReached=!1,this.isDomReady=!1,this.requestQueue=[],this.domReadyHandlers=[],this.originalConsole=null,this.consoleTrackingEnabled=!1,this.originalFetch=null,this.networkTrackingEnabled=!1,this.enableConsoleTrackingFlag=!0,this.enableNetworkTrackingFlag=!0,this.navigationTrackingEnabled=!1,this.currentUrl="",this.previousUrl="",this.originalPushState=null,this.originalReplaceState=null,this.navigationListeners=[],this.lastPushStateAt=0,this.NAVIGATION_DEDUPE_MS=100,this._connectionBlocked=!1,this.recordInstance=null,this.sessionStartTime=Date.now(),this.rrwebRecord=null,this.fullSnapshotTimeout=null,this.recordCanvas=!1,this.isStarted=!1,this.minimumDurationMilliseconds=5e3,this._isIdle="unknown",this._lastActivityTimestamp=Date.now(),this.IDLE_THRESHOLD_MS=3e5,this.rageClickTracker={clicks:[]},this.RAGE_CLICK_THRESHOLD_PX=30,this.RAGE_CLICK_TIMEOUT_MS=1e3,this.RAGE_CLICK_CLICK_COUNT=3,this.rageJustFiredAt=0,this.deadClickTracker={pendingClicks:new Map},this.DEAD_CLICK_SCROLL_THRESHOLD_MS=100,this.DEAD_CLICK_SELECTION_THRESHOLD_MS=2500,this.DEAD_CLICK_MUTATION_THRESHOLD_MS=100,this.DEAD_CLICK_ABSOLUTE_TIMEOUT_MS=2750,!e)throw new Error("Human Behavior API Key is required");const r=t||"https://ingest.humanbehavior.co";if(this.api=new Fc({apiKey:e,ingestionUrl:r}),this.apiKey=e,this.ingestionUrl=r,this.MAX_QUEUE_SIZE=s?.maxQueueSize??1e3,this.enableConsoleTrackingFlag=!1!==s?.enableConsoleTracking,this.enableNetworkTrackingFlag=!1!==s?.enableNetworkTracking,this.installMetadata=s?.installMetadata,this.redactionManager=new Uc({redactionStrategy:s?.redactionStrategy,legacyRedactFields:s?.redactFields}),this.propertyManager=new Hc({enableAutomaticProperties:!1!==s?.enableAutomaticProperties,propertyDenylist:s?.propertyDenylist||[]}),Yc){const e="human_behavior_end_user_id",t=this.getCookie(e);this.endUserId=t||Sc(),t?Mc(`Reusing existing endUserId: ${this.endUserId}`):(this.setCookie(e,this.endUserId,365),Mc(`Generated new endUserId: ${this.endUserId}`))}else this.endUserId=Sc();if(Yc){const e=this.apiKey||"default";this._window_id_storage_key=`human_behavior_${e}_window_id`,this._primary_window_exists_storage_key=`human_behavior_${e}_primary_window_exists`,this.sessionId=this.getOrCreateSessionId(),this.windowId=this.getOrCreateWindowId(),this.currentUrl=window.location.href,window.__humanBehaviorGlobalTracker=this,this.setupWindowUnloadListener()}else this._window_id_storage_key="",this._primary_window_exists_storage_key="",this.sessionId=Sc(),this.windowId=Sc();this.api.setTrackingContext(this.sessionId,this.endUserId),this.initializationPromise=this.init().catch(e=>{Ec("Initialization failed:",e)})}async init(){try{this.initialized=!0,Yc?(this.setupPageUnloadHandler(),this.setupNavigationTracking(),this.emitInstallCheck()):xc("HumanBehaviorTracker initialized in server environment. Session tracking is disabled."),xc(`HumanBehaviorTracker initialized with sessionId: ${this.sessionId}, endUserId: ${this.endUserId}`)}catch(e){Ec("Failed to initialize HumanBehaviorTracker:",e),this.initialized=!0}}async emitInstallCheck(){if(!Yc)return;let e="unknown";try{e=new URL(this.ingestionUrl).host}catch{}await this.customEvent("$sdk_install_check",{sdkVersion:"0.8.0-beta.0",packageName:"humanbehavior-js",ingestionHost:e,environment:this.installMetadata?.environment||("localhost"===window.location.hostname?"local":"browser"),framework:this.installMetadata?.framework,packageManager:this.installMetadata?.packageManager,wizardVersion:this.installMetadata?.wizardVersion,installId:this.installMetadata?.installId,targetPackagePathHash:this.installMetadata?.targetPackagePathHash})}async ensureInitialized(){this.initializationPromise&&await this.initializationPromise}setupNavigationTracking(){if(!Yc||this.navigationTrackingEnabled)return;this.navigationTrackingEnabled=!0,Mc("Setting up navigation tracking"),this.originalPushState=history.pushState,this.originalReplaceState=history.replaceState,history.pushState=(...e)=>{this.previousUrl=this.currentUrl,this.originalPushState.apply(history,e),this.currentUrl=window.location.href,this.lastPushStateAt=Date.now(),this.trackNavigationEvent("pushState",this.previousUrl,this.currentUrl)},history.replaceState=(...e)=>{this.previousUrl=this.currentUrl,this.originalReplaceState.apply(history,e),this.currentUrl=window.location.href,this.lastPushStateAt=Date.now(),this.trackNavigationEvent("replaceState",this.previousUrl,this.currentUrl)};const e=()=>{this.previousUrl=this.currentUrl,this.currentUrl=window.location.href,this.trackNavigationEvent("popstate",this.previousUrl,this.currentUrl)};window.addEventListener("popstate",e),this.navigationListeners.push(()=>{window.removeEventListener("popstate",e)});const t=()=>{if(Date.now()-this.lastPushStateAt<this.NAVIGATION_DEDUPE_MS)return this.previousUrl=this.currentUrl,void(this.currentUrl=window.location.href);this.previousUrl=this.currentUrl,this.currentUrl=window.location.href,this.trackNavigationEvent("hashchange",this.previousUrl,this.currentUrl)};window.addEventListener("hashchange",t),this.navigationListeners.push(()=>{window.removeEventListener("hashchange",t)});const s=setInterval(()=>{const e=window.location.href;e!==this.currentUrl&&(this.previousUrl=this.currentUrl,this.currentUrl=e,this.trackNavigationEvent("urlChange",this.previousUrl,this.currentUrl))},250);this.navigationListeners.push(()=>clearInterval(s)),this.trackNavigationEvent("pageLoad","",this.currentUrl)}async trackNavigationEvent(e,t,s){if(this.initialized)if("pageLoad"===e||t!==s)try{if("pageLoad"===e||"pushState"===e||"replaceState"===e||"popstate"===e||"hashchange"===e||"urlChange"===e){const s={url:window.location.href,fromUrl:t,$navigation_type:e,navigationType:e,pathname:window.location.pathname,search:window.location.search,hash:window.location.hash,referrer:document.referrer,timestamp:Date.now()};await this.customEvent("$pageview",s)}Mc(`Navigation tracked: ${e} from ${t} to ${s}`)}catch(e){Ec("Failed to track navigation event:",e)}else Mc(`Navigation dedupe: ${e} same URL (${s})`)}async trackPageView(e){if(this.initialized){this.propertyManager.updateAutomaticProperties();try{const t={url:e||window.location.href,pathname:window.location.pathname,search:window.location.search,hash:window.location.hash,referrer:document.referrer,timestamp:(new Date).toISOString()},s=this.propertyManager.getEventProperties(t);await this.addEvent({type:5,data:{payload:{eventType:"pageview",...s}},timestamp:Date.now()}),Mc(`Pageview tracked: ${t.url}`)}catch(e){Ec("Failed to track pageview event:",e)}}}async customEvent(e,t){if(null==e||"string"!=typeof e||""===e.trim())return void Tc("customEvent() called with empty or invalid name; skipping");this.endUserId||(Tc(`endUserId not available, using anonymous ID for event: ${e}`),this.endUserId=Sc()),Yc&&this.checkAndRefreshSession();const s=this.propertyManager.getEventProperties(t);if(this.shouldSkipDueToMinimumDuration())return Mc(`Custom event '${e}' queued due to session duration below minimum`),void this.pendingCustomEvents.push({eventName:e,properties:s,timestamp:Date.now()});await this.flushPendingCustomEvents(),this.queueCustomEvent(e,s),Mc(`Custom event queued: ${e}`,s)}queueCustomEvent(e,t){this.customEventBatch.push({eventName:e,eventProperties:t}),this.customEventBatch.length>=this.CUSTOM_EVENT_BATCH_MAX?this.flushCustomEventBatch():null==this.customEventBatchTimer&&(this.customEventBatchTimer=setTimeout(()=>{this.customEventBatchTimer=null,this.flushCustomEventBatch()},this.CUSTOM_EVENT_FLUSH_MS))}async flushCustomEventBatch(){if(null!=this.customEventBatchTimer&&(clearTimeout(this.customEventBatchTimer),this.customEventBatchTimer=null),0===this.customEventBatch.length)return;const e=this.customEventBatch;this.customEventBatch=[];try{return await this.api.sendCustomEventBatch(this.sessionId,e,this.endUserId),void Mc(`Custom event batch flushed: ${e.length} event(s)`)}catch(e){Ec("Failed to flush custom event batch, falling back per-event:",e)}for(const t of e)try{await this.api.sendCustomEvent(this.sessionId,t.eventName,t.eventProperties,this.endUserId)}catch(e){Ec("Per-event fallback also failed:",e);try{await this.addEvent({type:5,data:{payload:{eventType:"custom",eventName:t.eventName,properties:t.eventProperties||{},timestamp:(new Date).toISOString(),url:Yc?window.location.href:"",pathname:Yc?window.location.pathname:""}},timestamp:Date.now()})}catch(e){Ec("Failed to add custom event to event stream as fallback:",e)}}}setupAutomaticTracking(e){if(!Yc)return;const t={trackButtons:!1!==e?.trackButtons,trackLinks:!1,trackForms:!1!==e?.trackForms,includeText:!1!==e?.includeText,includeClasses:e?.includeClasses||!1};Mc("Setting up automatic tracking with config:",t),this.setupAutocapture(t),t.trackForms&&this.setupAutomaticFormTracking(t),this.setupRageClickDetection(),this.setupDeadClickDetection()}setupAutocapture(e){document.addEventListener("click",async t=>{const s=t.target;if(!s||1!==s.nodeType||"function"!=typeof s.closest)return;const r=s.closest('button, a, input, select, textarea, label, [role="button"], [role="link"], [role="tab"], [role="menuitem"]')||s,i=(r.tagName||"").toLowerCase(),n={tag:i,x:t.clientX,y:t.clientY,page:window.location.pathname,path:this.buildDomPath(r),timestamp:Date.now()};r.id&&(n.id=r.id,n.elementId=r.id);const o=r.getAttribute&&r.getAttribute("role");o&&(n.role=o);const a=r.type;!a||"input"!==i&&"button"!==i||(n.type=a);const l=r.href;if(l&&(n.href=l),!1!==e.includeText){const e=(r.textContent||"").replace(/\s+/g," ").trim();e&&(n.text=e.substring(0,200),n.elementText=e.substring(0,100))}const c=r.className;e.includeClasses&&"string"==typeof c&&c&&(n.class=c,n.elementClass=c),await this.customEvent("$click",n)})}buildDomPath(e){const t=[];let s=e,r=0;for(;s&&1===s.nodeType&&r<8;){const e=(s.tagName||"").toLowerCase();if(!e)break;let i=e;if(s.id)i+="#"+s.id;else if("string"==typeof s.className&&s.className){const e=s.className.trim().split(/\s+/)[0];e&&(i+="."+e)}if(t.unshift(i),"body"===e||"html"===e)break;s=s.parentElement,r++}return t.join(" > ")}setupRageClickDetection(){Yc&&document.addEventListener("click",async e=>{const t=e.target;if(!t||1!==t.nodeType)return;const s=e.clientX,r=e.clientY,i=Date.now();if(this.isRageClick(s,r,i,t)){const e=("function"==typeof t.closest?t.closest('button, a, [role="button"], [role="link"]'):null)||t,n=(e.tagName||"").toLowerCase(),o={x:s,y:r,page:window.location.pathname,element:n,clickCount:this.rageClickTracker.clicks.length,timestamp:i};e.id&&(o.elementId=e.id);const a=e.className;"string"==typeof a&&a&&(o.elementClass=a),e.textContent&&(o.elementText=e.textContent.trim().substring(0,100)),Object.keys(o).forEach(e=>{null!==o[e]&&void 0!==o[e]||delete o[e]}),await this.customEvent("$rageclick",o),this.rageJustFiredAt=i}})}isRageClick(e,t,s,r){if(this.rageJustFiredAt>0&&s-this.rageJustFiredAt<this.RAGE_CLICK_TIMEOUT_MS)return!1;if(this.rageJustFiredAt>0&&s-this.rageJustFiredAt>=this.RAGE_CLICK_TIMEOUT_MS)return this.rageJustFiredAt=0,this.rageClickTracker.clicks=[{x:e,y:t,timestamp:s,element:r}],!1;const i=this.rageClickTracker.clicks,n=i[i.length-1],o=i[0];if(o&&n&&s-n.timestamp<this.RAGE_CLICK_TIMEOUT_MS&&Math.hypot(e-o.x,t-o.y)<this.RAGE_CLICK_THRESHOLD_PX){if(i.push({x:e,y:t,timestamp:s,element:r}),i.length===this.RAGE_CLICK_CLICK_COUNT)return!0}else this.rageClickTracker.clicks=[{x:e,y:t,timestamp:s,element:r}];return!1}setupDeadClickDetection(){Yc&&(this.setupDeadClickMutationObserver(),this.setupDeadClickScrollObserver(),this.setupDeadClickSelectionObserver(),this.setupDeadClickNavigationTracking(),document.addEventListener("click",e=>{const t=e.target;if(!t||1!==t.nodeType)return;if(!this.isInteractiveElement(t))return;if(this.ignoreClickForDeadDetection(t))return;const s=Date.now()+Math.random(),r=Date.now(),i=this.deadClickTracker.lastMutationTime,n=this.DEAD_CLICK_ABSOLUTE_TIMEOUT_MS,o=window.setTimeout(()=>{this.handleDeadClickTimeout(s)},n);this.deadClickTracker.pendingClicks.set(s,{element:t,originalEvent:e,timestamp:r,timer:o,cancelled:!1,lastMutationTimeAtClick:i})}))}setupDeadClickMutationObserver(){Yc&&(this.deadClickTracker.mutationObserver||(this.deadClickTracker.mutationObserver=new MutationObserver(()=>{const e=Date.now();this.deadClickTracker.lastMutationTime=e,this.deadClickTracker.pendingClicks.forEach((t,s)=>{if(t.cancelled)return;const r=e-t.timestamp,i=t.lastMutationTimeAtClick||0,n=e>i,o=r>=0&&r<this.DEAD_CLICK_MUTATION_THRESHOLD_MS,a=r<0&&Math.abs(r)<50;(o&&n||a)&&this.cancelPendingClick(s)})}),this.deadClickTracker.mutationObserver.observe(document,{attributes:!0,characterData:!0,childList:!0,subtree:!0})))}setupDeadClickScrollObserver(){Yc&&window.addEventListener("scroll",()=>{const e=Date.now();this.deadClickTracker.pendingClicks.forEach((t,s)=>{e-t.timestamp<this.DEAD_CLICK_SCROLL_THRESHOLD_MS&&this.cancelPendingClick(s)})},{capture:!0,passive:!0})}setupDeadClickSelectionObserver(){Yc&&document.addEventListener("selectionchange",()=>{const e=Date.now();this.deadClickTracker.lastSelectionChangedTime=e,this.deadClickTracker.pendingClicks.forEach((t,s)=>{e-t.timestamp<this.DEAD_CLICK_SELECTION_THRESHOLD_MS&&this.cancelPendingClick(s)})})}setupDeadClickNavigationTracking(){if(!Yc)return;let e=window.location.href;const t=this.trackNavigationEvent.bind(this);this.trackNavigationEvent=async(s,r,i)=>(this.cancelAllPendingClicks(),e=window.location.href,t(s,r,i));const s=()=>{const t=window.location.href;t!==e&&(this.cancelAllPendingClicks(),e=t)};window.addEventListener("popstate",s),window.addEventListener("hashchange",s),window.addEventListener("beforeunload",()=>{this.cancelAllPendingClicks()}),setInterval(()=>{s()},100)}isInteractiveElement(e){if(!e||1!==e.nodeType||!e.tagName)return!1;const t=e.tagName.toLowerCase();if("button"===t||"a"===t)return!0;if("input"===t)return!1;if(["select","textarea"].includes(t))return!0;const s=e.getAttribute("role");if(s&&["button","link","tab","menuitem","checkbox","radio"].includes(s))return!0;if(e.onclick||e.getAttribute("onclick"))return!0;try{if("pointer"===window.getComputedStyle(e).cursor)return!0}catch(e){}return!!e.closest('button, a, [role="button"], [role="link"], [role="tab"], [role="menuitem"]')}ignoreClickForDeadDetection(e){if(!e||!e.tagName)return!0;if("html"===e.tagName.toLowerCase())return!0;const t=Date.now();for(const s of this.deadClickTracker.pendingClicks.values())if(s.element===e&&Math.abs(t-s.timestamp)<1e3)return!0;return!1}cancelPendingClick(e){const t=this.deadClickTracker.pendingClicks.get(e);t&&!t.cancelled&&(clearTimeout(t.timer),t.cancelled=!0,this.deadClickTracker.pendingClicks.delete(e))}cancelAllPendingClicks(){this.deadClickTracker.pendingClicks.forEach((e,t)=>{e.cancelled||(clearTimeout(e.timer),this.deadClickTracker.pendingClicks.delete(t))})}async handleDeadClickTimeout(e){const t=this.deadClickTracker.pendingClicks.get(e);if(!t||t.cancelled)return;const s=Date.now()-t.timestamp;let r;const i=t.lastMutationTimeAtClick||0,n=this.deadClickTracker.lastMutationTime||0,o=n>i&&n>=t.timestamp,a=i>0&&i<t.timestamp&&t.timestamp-i<50;let l;o?r=n-t.timestamp:a&&(r=0),this.deadClickTracker.lastSelectionChangedTime&&t.timestamp<=this.deadClickTracker.lastSelectionChangedTime&&(l=this.deadClickTracker.lastSelectionChangedTime-t.timestamp);const c=void 0!==r&&r<this.DEAD_CLICK_MUTATION_THRESHOLD_MS,h=void 0!==l&&l<this.DEAD_CLICK_SELECTION_THRESHOLD_MS;c||h||await this.fireDeadClickEvent(t,s,r,l),this.deadClickTracker.pendingClicks.delete(e)}async fireDeadClickEvent(e,t,s,r){const i=e.element.closest('button, a, [role="button"], [role="link"]')||e.element,n={x:e.originalEvent.clientX,y:e.originalEvent.clientY,page:window.location.pathname,element:i.tagName.toLowerCase(),absoluteDelayMs:t,timestamp:e.timestamp};void 0!==s&&(n.mutationDelayMs=s),void 0!==r&&(n.selectionChangedDelayMs=r),i.id&&(n.elementId=i.id),i.className&&(n.elementClass=i.className),i.textContent&&(n.elementText=i.textContent.trim().substring(0,100)),Object.keys(n).forEach(e=>{null!==n[e]&&void 0!==n[e]||delete n[e]}),await this.customEvent("$deadclick",n)}setupAutomaticLinkTracking(e){}setupAutomaticFormTracking(e){document.addEventListener("submit",async t=>{const s=t.target,r=new FormData(s),i={formId:s.id||null,formAction:s.action||null,formMethod:s.method||"get",fields:Array.from(r.keys()),page:window.location.pathname,timestamp:Date.now()};e.includeClasses&&(i.formClass=s.className||null),Object.keys(i).forEach(e=>{null===i[e]&&delete i[e]}),await this.customEvent("$form_submitted",i)})}cleanupNavigationTracking(){this.navigationTrackingEnabled&&(this.originalPushState&&(history.pushState=this.originalPushState),this.originalReplaceState&&(history.replaceState=this.originalReplaceState),this.navigationListeners.forEach(e=>e()),this.navigationListeners=[],this.navigationTrackingEnabled=!1,Mc("Navigation tracking cleaned up"))}static logToStorage(e){xc(e)}static configureLogging(e){Cc.setConfig({level:{none:0,error:1,warn:2,info:3,debug:4}[e.level||"error"],enableConsole:!1!==e.enableConsole,enableStorage:e.enableStorage||!1})}enableConsoleTracking(){Yc&&!this.consoleTrackingEnabled&&(this.originalConsole={log:console.log,warn:console.warn,error:console.error},console.log=(...e)=>{this.trackConsoleEvent("log",e),this.originalConsole.log(...e)},console.warn=(...e)=>{this.trackConsoleEvent("warn",e),this.originalConsole.warn(...e)},console.error=(...e)=>{this.trackConsoleEvent("error",e),this.originalConsole.error(...e)},this.consoleTrackingEnabled=!0,Mc("Console tracking enabled"))}enableNetworkTracking(){Yc&&!this.networkTrackingEnabled&&"undefined"!=typeof fetch&&(this.originalFetch=window.fetch.bind(window),window.fetch=async(e,t)=>{const s=Date.now(),r=Sc(),i="string"==typeof e?e:e instanceof URL?e.toString():e.url,n=(t?.method||("object"==typeof e&&"method"in e?e.method:void 0)||"GET").toUpperCase(),o=this.shouldSkipNetworkTracking(i);let a=null,l=!1;o||(a=setTimeout(()=>{const e=Date.now()-s;if(!l){l=!0;const t={requestId:r,url:i,method:n,status:null,statusText:null,duration:e,timestampMs:Date.now(),sessionId:this.sessionId,endUserId:this.endUserId,errorType:"long_loading",errorMessage:`Request took longer than 10000ms (${e}ms elapsed)`,startTimeMs:s,spanName:`${n} ${i}`,spanStatus:"slow",attributes:{"http.method":n,"http.url":i,"request.duration_ms":e,"request.long_loading_threshold_ms":1e4},automaticProperties:this.propertyManager.getAutomaticProperties()};return this.shouldSkipDueToMinimumDuration()?(Mc("Long-loading network error queued due to session duration below minimum"),void this.pendingNetworkErrors.push({errorData:t,timestamp:Date.now()})):(this.flushPendingNetworkErrors(),void this.api.sendNetworkError(t).catch(()=>{}))}},1e4));try{const l=await this.originalFetch(e,t),c=Date.now()-s;if(a&&clearTimeout(a),!l.ok&&!o){const e={requestId:r,url:i,method:n,status:l.status,statusText:l.statusText,duration:c,timestampMs:Date.now(),sessionId:this.sessionId,endUserId:this.endUserId,errorType:this.classifyHttpError(l.status),errorMessage:l.statusText,startTimeMs:s,spanName:`${n} ${i}`,spanStatus:"error",attributes:{"http.status_code":l.status,"http.status_text":l.statusText},automaticProperties:this.propertyManager.getAutomaticProperties()};if(this.shouldSkipDueToMinimumDuration())return Mc("Failed request network error queued due to session duration below minimum"),this.pendingNetworkErrors.push({errorData:e,timestamp:Date.now()}),l;this.flushPendingNetworkErrors(),this.api.sendNetworkError(e).catch(()=>{})}return l}catch(e){const t=Date.now()-s;if(a&&clearTimeout(a),!o){const o={requestId:r,url:i,method:n,status:null,statusText:null,duration:t,timestampMs:Date.now(),sessionId:this.sessionId,endUserId:this.endUserId,errorType:this.classifyNetworkError(e),errorMessage:e.message,errorName:e.name,startTimeMs:s,spanName:`${n} ${i}`,spanStatus:"error",attributes:{"error.name":e.name,"error.message":e.message},automaticProperties:this.propertyManager.getAutomaticProperties()};if(this.shouldSkipDueToMinimumDuration())throw Mc("Network error queued due to session duration below minimum"),this.pendingNetworkErrors.push({errorData:o,timestamp:Date.now()}),e;this.flushPendingNetworkErrors(),this.api.sendNetworkError(o).catch(()=>{})}throw e}},this.networkTrackingEnabled=!0,Mc("Network tracking enabled"))}async flushPendingCustomEvents(){if(0===this.pendingCustomEvents.length)return;const e=[...this.pendingCustomEvents];this.pendingCustomEvents=[],Mc(`Flushing ${e.length} pending custom events`);for(const{eventName:t,properties:s}of e)this.queueCustomEvent(t,s)}async flushPendingLogs(){if(0===this.pendingLogs.length)return;const e=[...this.pendingLogs];this.pendingLogs=[],Mc(`Flushing ${e.length} pending logs`);for(const{logData:t}of e)try{await this.api.sendLog(t)}catch(e){Ec("Failed to flush pending log:",e)}}async flushPendingNetworkErrors(){if(0===this.pendingNetworkErrors.length)return;const e=[...this.pendingNetworkErrors];this.pendingNetworkErrors=[],Mc(`Flushing ${e.length} pending network errors`);for(const{errorData:t}of e)try{await this.api.sendNetworkError(t)}catch(e){Ec("Failed to flush pending network error:",e)}}enablePageLoadTracking(){Yc&&"undefined"!=typeof window&&("complete"===document.readyState?this.trackPageLoad():window.addEventListener("load",()=>{this.trackPageLoad()}),Mc("Page load tracking enabled"))}trackPageLoad(){if(Yc&&"undefined"!=typeof performance)try{const e=performance.getEntriesByType("navigation")[0];if(!e)return;const t=e.loadEventEnd-e.fetchStart;if(t>3e3){const s=Sc(),r=e.domContentLoadedEventEnd-e.fetchStart,i=e.domComplete-e.fetchStart,n={requestId:s,url:window.location.href,method:"GET",status:200,statusText:"OK",duration:t,timestampMs:e.loadEventEnd+performance.timeOrigin,sessionId:this.sessionId,endUserId:this.endUserId,errorType:"slow_page_load",errorMessage:`Page load took ${t}ms`,startTimeMs:e.fetchStart+performance.timeOrigin,spanName:"page_load",spanStatus:"slow",attributes:{"page.url":window.location.href,"page.load_time":t,"page.dom_content_loaded":r,"page.dom_complete":i}};if(this.shouldSkipDueToMinimumDuration())return Mc("Slow page load network error queued due to session duration below minimum"),void this.pendingNetworkErrors.push({errorData:n,timestamp:Date.now()});this.flushPendingNetworkErrors(),this.api.sendNetworkError(n).catch(()=>{})}}catch(e){Tc("Failed to track page load:",e)}}shouldSkipNetworkTracking(e){if(!e||!this.ingestionUrl)return!1;try{const t=new URL(e),s=new URL(this.ingestionUrl);return!(t.origin!==s.origin||!t.pathname.startsWith("/api/ingestion/"))||!!e.includes(this.ingestionUrl)}catch(t){return e.includes(this.ingestionUrl)}}classifyHttpError(e){return e>=400&&e<500?"client_error":e>=500?"server_error":"unknown_error"}classifyNetworkError(e){const t=e.message||"",s=e.name||"";return t.includes("blocked")||t.includes("ERR_BLOCKED_BY_CLIENT")||t.includes("net::ERR_BLOCKED_BY_CLIENT")||"TypeError"===s&&t.includes("Failed to fetch")?"blocked_by_client":t.includes("CORS")||t.includes("Cross-Origin")||t.includes("Access-Control-Allow-Origin")||"TypeError"===s&&t.includes("CORS")?"cors_error":t.includes("timeout")||t.includes("TIMEOUT")||t.includes("NetworkError")||"NetworkError"===s?"network_error":t.includes("abort")||"AbortError"===s?"aborted":"unknown_error"}disableConsoleTracking(){Yc&&this.consoleTrackingEnabled&&(this.originalConsole&&(console.log=this.originalConsole.log,console.warn=this.originalConsole.warn,console.error=this.originalConsole.error),this.consoleTrackingEnabled=!1,Mc("Console tracking disabled"))}trackConsoleEvent(e,t){if(this.initialized)if("log"!==e)try{if(Ic())return void(this.originalConsole&&this.originalConsole[e](...t));const s=(new Error).stack||"";if(this.isSDKStackFrame(s))return void(this.originalConsole&&this.originalConsole[e](...t));const r={level:e,message:t.map(e=>"object"==typeof e?JSON.stringify(e):String(e)).join(" "),timestampMs:Date.now(),url:Yc?window.location.href:"",userAgent:Yc?navigator.userAgent:"",stack:s,sessionId:this.sessionId,endUserId:this.endUserId,automaticProperties:this.propertyManager.getAutomaticProperties()};if(this.shouldSkipDueToMinimumDuration())return Mc(`Console ${e} queued due to session duration below minimum`),void this.pendingLogs.push({logData:r,timestamp:Date.now()});this.flushPendingLogs(),this.api.sendLog(r).catch(e=>{this.addEvent({type:5,data:{payload:{eventType:"console",...r}},timestamp:Date.now()}).catch(()=>{})})}catch(e){Ec("Error in trackConsoleEvent:",e)}else this.originalConsole&&this.originalConsole.log(...t)}isSDKStackFrame(e){if(!e)return!1;const t=["humanbehavior-js","@humanbehavior/core","@humanbehavior/browser","tracker.ts","api.ts","logger.ts","utils/logger","packages/core","packages/browser","index.mjs","index.js"],s=e.split("\n");e.toLowerCase();let r=!1;for(let e=0;e<s.length;e++){const i=s[e].trim().toLowerCase();if(i&&"error"!==i&&!i.startsWith("error:")&&!t.some(e=>i.includes(e.toLowerCase()))){r=!0;break}}return!r}setupPageUnloadHandler(){if(!Yc)return;const e="__humanBehaviorUnloadAttached";if(window[e])return Mc("Page unload handlers already attached on window β€” skipping re-attach"),void(window.__humanBehaviorActiveTracker=this);window[e]=!0,window.__humanBehaviorActiveTracker=this,Mc("Setting up page unload handler"),window.addEventListener("visibilitychange",()=>{const e="hidden"===document.visibilityState?"hidden":"visible";this.emitVisibilityMarker(e),"hidden"===document.visibilityState&&(Mc("Page hidden - sending pending events"),this.flushEvents())}),this.setupWindowFocusTracking();const t="onpagehide"in window?"pagehide":"beforeunload";window.addEventListener(t,()=>{Mc("Page unloading - sending final events via sendBeacon");let e=!1;try{if(this.customEventBatch.length>0){null!=this.customEventBatchTimer&&(clearTimeout(this.customEventBatchTimer),this.customEventBatchTimer=null);const e=this.customEventBatch;this.customEventBatch=[];const t=this.api?.sendCustomEventBatchBeacon(this.sessionId,e,this.endUserId);t||this.api?.sendCustomEventBatch(this.sessionId,e,this.endUserId).catch(()=>{})}}catch{}const t=[...this.eventQueue];if(Yc&&window.__hb_pending_snapshots){const e=window.__hb_pending_snapshots;Array.isArray(e)&&e.length>0&&(Mc("Including pending FullSnapshot(s) in sendBeacon for short session"),t.unshift(...e),delete window.__hb_pending_snapshots)}if(t.length>0&&this.api)try{const e=this.propertyManager.getAutomaticProperties();this.api.sendBeaconEvents(t,this.sessionId,this.endUserId||void 0,this.windowId,e),this.eventQueue=[]}catch(e){Tc("Failed to send events via sendBeacon on unload:",e)}this.api&&this.api.unload(),(()=>{if(!e){e=!0;try{this.api?.sendSessionEndBeacon(this.sessionId,this.endUserId)}catch{}}})()});const s=()=>{localStorage.setItem("human_behavior_last_activity",Date.now().toString())};window.addEventListener("click",s),window.addEventListener("keydown",s),window.addEventListener("scroll",s),window.addEventListener("mousemove",s)}viewLogs(){try{const e=Cc.getLogs();xc("HumanBehavior Logs:",e),Cc.clearLogs()}catch(e){Ec("Failed to read logs:",e)}}async identifyUser(e){const t=e?.userProperties&&"object"==typeof e.userProperties?e.userProperties:e||{},s=this.endUserId;this.userProperties={...this.userProperties,...t};try{this.propertyManager?.setUserProperties(t)}catch{}Mc("Identifying user:",{userProperties:t,originalEndUserId:s,sessionId:this.sessionId}),!Yc||this.propertyManager.getAutomaticProperties();const r=await this.api.sendUserData(s||"",t,this.sessionId);if(r.actualUserId||r.wasExistingUser){const t=r.actualUserId||s;if(t&&t!==s){const r="human_behavior_end_user_id";if(this.setCookie(r,t,365),Yc)try{localStorage.setItem(r,t)}catch(e){Mc("Failed to set canonical endUserId in localStorage:",e)}Mc(`πŸ”— Preexisting user detected. Future sessions will use canonical ID: ${t} (current session stays: ${s})`)}}return s||""}getUserAttributes(){return{...(()=>{try{return this.propertyManager?.getAllProperties().user||{}}catch{return{}}})(),...this.userProperties}}async start(){if(!Yc)return;if(this.isStarted)return void Mc("HumanBehaviorTracker already started, skipping start() call.");this.isStarted=!0,this._lastActivityTimestamp=null!==this._sessionActivityTimestamp?this._sessionActivityTimestamp:Date.now(),this._isIdle="unknown",this.flushInterval=window.setInterval(()=>{this.flushEvents()},this.FLUSH_INTERVAL_MS),this.heartbeatInterval=window.setInterval(()=>{try{if("undefined"!=typeof document&&"visible"!==document.visibilityState)return;if(!this.sessionId||!this.api)return;this.api.sendHeartbeatBeacon(this.sessionId,this.endUserId)}catch{}},this.HEARTBEAT_INTERVAL_MS),this.enableConsoleTrackingFlag&&this.enableConsoleTracking(),this.enableNetworkTrackingFlag&&this.enableNetworkTracking(),this.enablePageLoadTracking(),this.api.sendIpInfo(this.sessionId,this.endUserId);const e=()=>{if(this.recordInstance)return void Mc("🎯 Recording already started, skipping duplicate start");Mc("🎯 DOM ready, starting session recording"),this.rrwebRecord=pc;const e=pc({emit:e=>{this.addRecordingEvent(e),2===e.type&&Mc(`🎯 FullSnapshot generated at ${(new Date).toISOString()}`)},maskTextSelector:this.redactionManager.getMaskTextSelector()||void 0,maskTextFn:void 0,maskAllInputs:"privacy-first"===this.redactionManager.getRedactionMode(),maskInputOptions:{password:!0,text:!0,textarea:!0,email:!0,number:!0,tel:!0,url:!0,search:!0,date:!0,time:!0,month:!0,week:!0},maskInputFn:(e,t)=>{try{const s=this.redactionManager.getRedactionMode();if(!(t instanceof HTMLElement))return e;if("privacy-first"===s)return"*".repeat(e.length||1);const r=this.redactionManager.shouldUnredactElement(t);return t.id,t.name,t.type,r?e:"*".repeat(e.length||1)}catch{return e}},slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1,recordCanvas:this.recordCanvas,sampling:this.recordCanvas?{canvas:4}:void 0,dataURLOptions:this.recordCanvas?{type:"image/webp",quality:.4}:void 0,hooks:{input:e=>{try{if("privacy-first"===this.redactionManager.getRedactionMode())return;const t="undefined"!=typeof document?document.querySelector(`[data-rrweb-id="${e.id}"]`):null;t&&t instanceof HTMLElement&&(this.redactionManager.shouldUnredactElement(t)||(void 0!==e.text&&(e.text="*".repeat(e.text?.length||1)),void 0!==e.value&&(e.value="*".repeat(e.value?.length||1))))}catch{}}}});this.recordInstance=e||null};if(Mc(`🎯 DOM ready state: ${document.readyState}`),"complete"===document.readyState||"interactive"===document.readyState)Mc(`🎯 DOM ready (${document.readyState}), starting recording immediately`),e();else{Mc("🎯 DOM not ready, waiting for DOMContentLoaded event");const t=()=>("interactive"===document.readyState||"complete"===document.readyState)&&(Mc(`🎯 DOM ready (${document.readyState}), starting recording`),e(),!0);if(t())return;document.addEventListener("DOMContentLoaded",()=>{Mc("🎯 DOMContentLoaded fired, starting recording"),e()},{once:!0});const s=setInterval(()=>{t()&&clearInterval(s)},10);setTimeout(()=>clearInterval(s),5e3)}}emitVisibilityMarker(e){try{const t={type:5,data:{tag:"$visibility",payload:{state:e}},timestamp:Date.now()};this.eventQueue.push(t)}catch{}}emitFocusMarker(e){try{const t={type:5,data:{tag:"$focus",payload:{state:e}},timestamp:Date.now()};this.eventQueue.push(t)}catch{}}setupWindowFocusTracking(){if(Yc){try{"function"!=typeof document.hasFocus||document.hasFocus()||(this.emitFocusMarker("blurred"),this.lastEmittedFocusState="blurred")}catch{}window.addEventListener("blur",()=>this.onWindowBlur(),!1),window.addEventListener("focus",()=>this.onWindowFocus(),!1)}}onWindowBlur(){Yc&&(null!==this.focusBlurGraceTimeout&&clearTimeout(this.focusBlurGraceTimeout),this.focusBlurGraceTimeout=window.setTimeout(()=>{this.focusBlurGraceTimeout=null;try{if("function"==typeof document.hasFocus&&document.hasFocus())return;if("blurred"===this.lastEmittedFocusState)return;this.emitFocusMarker("blurred"),this.lastEmittedFocusState="blurred"}catch{}},this.FOCUS_BLUR_GRACE_MS))}onWindowFocus(){if(Yc&&(null!==this.focusBlurGraceTimeout&&(clearTimeout(this.focusBlurGraceTimeout),this.focusBlurGraceTimeout=null),"blurred"===this.lastEmittedFocusState))try{this.emitFocusMarker("focused"),this.lastEmittedFocusState="focused"}catch{}}takeFullSnapshot(){this.fullSnapshotTimeout&&clearTimeout(this.fullSnapshotTimeout),this.fullSnapshotTimeout=window.setTimeout(()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{try{this.rrwebRecord&&"function"==typeof this.rrwebRecord.takeFullSnapshot?(this.rrwebRecord.takeFullSnapshot(),Mc("βœ… FullSnapshot taken (delayed for animations)")):Tc("⚠️ takeFullSnapshot not available on record function")}catch(e){Ec("❌ Failed to take FullSnapshot:",e)}})})},1e3)}async stop(){await this.ensureInitialized(),Yc&&(this.flushInterval&&(clearInterval(this.flushInterval),this.flushInterval=null),this.heartbeatInterval&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null),this.recordInstance&&(this.recordInstance(),this.recordInstance=null),this.fullSnapshotTimeout&&(clearTimeout(this.fullSnapshotTimeout),this.fullSnapshotTimeout=null),null!==this.focusBlurGraceTimeout&&(clearTimeout(this.focusBlurGraceTimeout),this.focusBlurGraceTimeout=null),this.rrwebRecord=null,this.disableConsoleTracking(),this.cleanupNavigationTracking(),this.deadClickTracker.mutationObserver&&(this.deadClickTracker.mutationObserver.disconnect(),this.deadClickTracker.mutationObserver=void 0),this.deadClickTracker.pendingClicks.forEach((e,t)=>{e.cancelled||clearTimeout(e.timer)}),this.deadClickTracker.pendingClicks.clear())}async addEvent(e){if(Yc&&this.checkAndRefreshSession(),e&&"object"==typeof e){if(2===e.type){const t=!!e.data,s=!(!e.data||!e.data.node);Mc(t&&s?`βœ… Valid FullSnapshot: hasData=${t}, hasNode=${s}, dataType=${e.data?.node?.type}`:`⚠️ Empty FullSnapshot detected: hasData=${t}, hasNode=${s} - continuing session`)}this.eventQueue.length>=this.MAX_QUEUE_SIZE&&(this.eventQueue.shift(),Mc("Queue is full, the oldest event is dropped.")),this.eventQueue.push(e),2===e.type?(Mc("FullSnapshot added, triggering immediate flush"),this.flushEvents()):this.eventQueue.length>=.8*this.MAX_QUEUE_SIZE&&(Mc(`Queue at ${this.eventQueue.length}/${this.MAX_QUEUE_SIZE}, triggering immediate flush`),this.flushEvents())}else Mc("⚠️ Skipping invalid event:",e)}getSessionDuration(){const e=this._sessionStartTimestamp??this.sessionStartTime;if(!e)return null;const t=this.eventQueue.filter(e=>e&&e.timestamp);if(0===t.length)return null;const s=t.reduce((e,t)=>!e||t.timestamp&&t.timestamp>e.timestamp?t:e,null);if(!s||!s.timestamp)return null;const r=s.timestamp-e;return r>=0?r:null}shouldSkipDueToMinimumDuration(){const e=this.minimumDurationMilliseconds,t=this.getSessionDuration();return!!(null!==t&&t>=0&&t<e)&&(Mc(`Session duration (${t}ms) below minimum (${e}ms), skipping send`),!0)}async flushEvents(){if(this.isProcessing)return;if(this.monthlyLimitReached)return;if(!0===this._isIdle&&0===this.eventQueue.length)return;const e=this.minimumDurationMilliseconds,t=this.getSessionDuration();if(null!==t&&t>=0&&t<e)return Mc(`Session duration (${t}ms) below minimum (${e}ms), buffering`),void setTimeout(()=>{this.flushEvents()},2e3);this.isProcessing=!0;try{const t=this.eventQueue,s=t.filter(e=>e&&2===e.type);if(this.eventQueue=[],s.length>0&&Yc&&(window.__hb_pending_snapshots=s,setTimeout(()=>{delete window.__hb_pending_snapshots},5e3)),t.length>0){Mc("Flushing events:",t);const s=t.filter(e=>2===e.type);s.length>0&&Mc(`[FIXED] Sending ${s.length} FullSnapshot(s) with valid data`);try{const e=this.propertyManager.getAutomaticProperties();await this.api.sendEventsChunked(t,this.sessionId,this.endUserId,this.windowId,e)}catch(e){if(e.message?.includes("ERROR: Session already completed"))Tc("Session expired, events will be lost");else if(e.message?.includes("413")||e.message?.includes("Content Too Large"))Tc("Payload too large, events will be lost");else{if(!(e.message?.includes("ERR_BLOCKED_BY_CLIENT")||e.message?.includes("Failed to fetch")||e.message?.includes("NetworkError")))throw e;Tc("Request blocked by ad blocker or network issue, events will be lost")}}}await this.flushPendingCustomEvents(),await this.flushPendingLogs(),await this.flushPendingNetworkErrors()}finally{this.isProcessing=!1}}isInteractiveEvent(e){if(3!==e.type)return!1;const t=e.data?.source;return[1,2,3,4,5,6,11].includes(t)}updateIdleState(e){const t=this.isInteractiveEvent(e),s=e.timestamp||Date.now();if(t){const e=!0===this._isIdle;this._lastActivityTimestamp=s,null!==this._sessionActivityTimestamp&&(this._sessionActivityTimestamp=s),e?(Mc("βœ… User activity detected, exiting idle state"),this._isIdle=!1):"unknown"===this._isIdle&&(this._isIdle=!1)}else if(!0!==this._isIdle){const e=s-this._lastActivityTimestamp;e>this.IDLE_THRESHOLD_MS&&(Mc(`⏸️ Session idle detected (${Math.round(e/1e3)}s since last activity) - stopping background event recording`),Mc(`ℹ️ Session will expire after ${Math.round(this.SESSION_IDLE_TIMEOUT_MS/6e4)} minutes of inactivity (${Math.round((this.SESSION_IDLE_TIMEOUT_MS-e)/1e3)}s remaining)`),this._isIdle=!0,this.flushEvents())}}async addRecordingEvent(e){if(Yc&&this.checkAndRefreshSession(),e&&"object"==typeof e){if(this.updateIdleState(e),!0!==this._isIdle||3!==e.type||this.isInteractiveEvent(e)){if(2===e.type){const t=!!e.data,s=!(!e.data||!e.data.node);Mc(t&&s?`βœ… Valid FullSnapshot: hasData=${t}, hasNode=${s}, dataType=${e.data?.node?.type}`:`⚠️ Empty FullSnapshot detected: hasData=${t}, hasNode=${s} - continuing session`)}this.eventQueue.length>=this.MAX_QUEUE_SIZE&&(this.eventQueue.shift(),Mc("Queue is full, the oldest event is dropped.")),this.eventQueue.push(e),2===e.type?(Mc("FullSnapshot added, triggering immediate flush"),this.flushEvents()):!0!==this._isIdle&&this.eventQueue.length>=.8*this.MAX_QUEUE_SIZE&&(Mc(`Queue at ${this.eventQueue.length}/${this.MAX_QUEUE_SIZE}, triggering immediate flush`),this.flushEvents())}}else Mc("⚠️ Skipping invalid recording event:",e)}_canUseSessionStorage(){if(!Yc)return!1;try{const e="__sessionStorage_test__";return sessionStorage.setItem(e,e),sessionStorage.removeItem(e),!0}catch{return!1}}_getWindowIdFromStorage(){if(!this._canUseSessionStorage())return null;try{return sessionStorage.getItem(this._window_id_storage_key)}catch{return null}}_setWindowIdInStorage(e){if(this._canUseSessionStorage())try{sessionStorage.setItem(this._window_id_storage_key,e),Mc(`Stored windowId in sessionStorage: ${e}`)}catch(e){Tc("Failed to store windowId in sessionStorage:",e)}}_removeWindowIdFromStorage(){if(this._canUseSessionStorage())try{sessionStorage.removeItem(this._window_id_storage_key)}catch(e){Tc("Failed to remove windowId from sessionStorage:",e)}}_getPrimaryWindowExists(){if(!this._canUseSessionStorage())return!1;try{return"true"===sessionStorage.getItem(this._primary_window_exists_storage_key)}catch{return!1}}_setPrimaryWindowExists(e){if(this._canUseSessionStorage())try{e?sessionStorage.setItem(this._primary_window_exists_storage_key,"true"):sessionStorage.removeItem(this._primary_window_exists_storage_key)}catch(e){Tc("Failed to set primary_window_exists flag:",e)}}getOrCreateWindowId(){if(!Yc)return Sc();const e=this._getWindowIdFromStorage(),t=this._getPrimaryWindowExists();if(e&&!t)return Mc(`Reusing windowId from previous page load: ${e}`),this._setWindowIdInStorage(e),this._setPrimaryWindowExists(!0),e;{const e=Sc();return Mc(`Creating new windowId: ${e} (new window/tab detected)`),this._setWindowIdInStorage(e),this._setPrimaryWindowExists(!0),e}}setupWindowUnloadListener(){Yc&&window.addEventListener("beforeunload",()=>{this._canUseSessionStorage()&&(this._setPrimaryWindowExists(!1),Mc("Cleared primary_window_exists flag on beforeunload"))},{capture:!1})}setCookie(e,t,s){if(Yc)try{const r=new Date;r.setTime(r.getTime()+24*s*60*60*1e3);const i=`expires=${r.toUTCString()}`;document.cookie=`${e}=${t};${i};path=/;SameSite=Lax`,localStorage.setItem(e,t),Mc(`Set cookie and localStorage: ${e}`)}catch(s){try{localStorage.setItem(e,t),Mc(`Cookie blocked, using localStorage: ${e}`)}catch(e){Ec("Failed to store user ID in both cookie and localStorage:",e)}}}getCookie(e){if(!Yc)return null;try{const t=e+"=",s=document.cookie.split(";");for(let r=0;r<s.length;r++){let i=s[r];for(;" "===i.charAt(0);)i=i.substring(1,i.length);if(0===i.indexOf(t)){const s=i.substring(t.length,i.length);return Mc(`Found cookie: ${e}`),s}}const r=localStorage.getItem(e);return r?(Mc(`Cookie not found, using localStorage: ${e}`),r):null}catch(t){try{const t=localStorage.getItem(e);if(t)return Mc(`Cookie access failed, using localStorage: ${e}`),t}catch(e){Ec("Failed to access both cookie and localStorage:",e)}return null}}deleteCookie(e){if(Yc){try{document.cookie=`${e}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/; SameSite=Lax`,Mc(`Deleted cookie: ${e}`)}catch(t){Ec(`Failed to delete cookie: ${e}`,t)}try{localStorage.removeItem(e),Mc(`Removed from localStorage: ${e}`)}catch(t){Ec(`Failed to remove from localStorage: ${e}`,t)}}}logout(){if(Yc)try{const e="human_behavior_end_user_id";this.deleteCookie(e);const t="human_behavior_session";localStorage.removeItem(t),this.endUserId=null,this.userProperties={},this.endUserId=Sc(),this.setCookie("human_behavior_end_user_id",this.endUserId,365),this.sessionId=this.createNewSession(t),this.windowId=Sc(),this._setWindowIdInStorage(this.windowId),this.api.setTrackingContext(this.sessionId,this.endUserId),this.takeFullSnapshot(),xc("User logged out - cleared all user data and started fresh session")}catch(e){Ec("Error during logout:",e)}}async redact(e){await this.ensureInitialized(),Yc?this.redactionManager=new Uc(e):Tc("Redaction is only available in browser environments")}setRedactedFields(e){this.redactionManager.setFieldsToRedact(e),this.recordInstance&&this.restartWithNewRedaction()}setUnredactedFields(e){this.redactionManager.setFieldsToUnredact(e),this.recordInstance&&this.restartWithNewRedaction()}restartWithNewRedaction(){this.recordInstance&&(this.recordInstance(),this.start())}hasUnredactedFields(){return this.redactionManager.hasUnredactedFields()}getUnredactedFields(){return this.redactionManager.getUnredactedFields()}redactFields(e){this.redactionManager.redactFields(e),this.recordInstance&&this.restartWithNewRedaction()}clearUnredactedFields(){this.redactionManager.clearUnredactedFields(),this.recordInstance&&this.restartWithNewRedaction()}checkAndRefreshSession(){if(!Yc)return;const e="human_behavior_session",t=Date.now(),s=this.getStoredSession(e);if(!s||!s.sessionId)return this.createNewSession(e),this.windowId=Sc(),this._setWindowIdInStorage(this.windowId),this.api.setTrackingContext(this.sessionId,this.endUserId),this.takeFullSnapshot(),void Mc(`Created new session (no stored session): ${this.sessionId}`);this.updateSessionActivity(e,t,s.sessionId,s.sessionStartTimestamp)}getOrCreateSessionId(){if(!Yc)return Sc();const e="human_behavior_session",t=Date.now(),s=this.getStoredSession(e);if(!s||!s.sessionId){const t=this.createNewSession(e);return this.api.setTrackingContext(t,this.endUserId),t}const r=t-s.lastActivityTimestamp,i=t-s.sessionStartTimestamp;if(r>this.SESSION_IDLE_TIMEOUT_MS||i>this.SESSION_MAX_LENGTH_MS){Mc(`Session expired: idle=${r}ms, age=${i}ms`);const t=this.createNewSession(e);return this.api.setTrackingContext(t,this.endUserId),t}return this.updateSessionActivity(e,t,s.sessionId,s.sessionStartTimestamp),s.sessionId}getStoredSession(e){const t=Date.now(),s=this.SESSION_IDLE_TIMEOUT_MS,r=this.SESSION_MAX_LENGTH_MS;if(this.sessionId&&null!==this._sessionActivityTimestamp&&null!==this._sessionStartTimestamp){const i=t-this._sessionActivityTimestamp,n=t-this._sessionStartTimestamp;if(!(i>s||n>r))return{sessionId:this.sessionId,lastActivityTimestamp:this._sessionActivityTimestamp,sessionStartTimestamp:this._sessionStartTimestamp};{Mc("Session in memory expired: creating new session immediately");const t=this.sessionId;if(this.createNewSession(e),this.windowId=Sc(),this._setWindowIdInStorage(this.windowId),this.api.setTrackingContext(this.sessionId,this.endUserId),this.takeFullSnapshot(),xc(`πŸ”„ Session timeout (memory): Created new session ${this.sessionId} (previous: ${t})`),null!==this._sessionActivityTimestamp&&null!==this._sessionStartTimestamp)return{sessionId:this.sessionId,lastActivityTimestamp:this._sessionActivityTimestamp,sessionStartTimestamp:this._sessionStartTimestamp}}}try{const i=localStorage.getItem(e);if(!i)return null;const n=JSON.parse(i),o=t-n.lastActivityTimestamp,a=t-n.sessionStartTimestamp;if(o>s||a>r){Mc(`Session in localStorage expired: idle=${Math.round(o/1e3/60)}min, age=${Math.round(a/1e3/60/60)}hrs`);const t=n.sessionId;if(this.createNewSession(e),this.windowId=Sc(),this._setWindowIdInStorage(this.windowId),this.api.setTrackingContext(this.sessionId,this.endUserId),this.takeFullSnapshot(),xc(`πŸ”„ Session timeout (localStorage): Created new session ${this.sessionId} (previous: ${t})`),null!==this._sessionActivityTimestamp&&null!==this._sessionStartTimestamp)return{sessionId:this.sessionId,lastActivityTimestamp:this._sessionActivityTimestamp,sessionStartTimestamp:this._sessionStartTimestamp}}return n.sessionId&&(this.sessionId=n.sessionId,this._sessionActivityTimestamp=n.lastActivityTimestamp,this._sessionStartTimestamp=n.sessionStartTimestamp),n}catch{return null}}createNewSession(e){const t=Sc(),s=Date.now();this.sessionId=t,this._sessionActivityTimestamp=s,this._sessionStartTimestamp=s,this._lastActivityTimestamp=s;const r={sessionId:t,lastActivityTimestamp:s,sessionStartTimestamp:s};try{localStorage.setItem(e,JSON.stringify(r))}catch(e){Tc(`Failed to save session to localStorage: ${e}`)}return Mc(`Created new session: ${t}`),t}updateSessionActivity(e,t,s,r){this.sessionId=s,this._sessionActivityTimestamp=t,this._sessionStartTimestamp=r;const i={sessionId:s,lastActivityTimestamp:t,sessionStartTimestamp:r};try{localStorage.setItem(e,JSON.stringify(i))}catch(e){Tc(`Failed to update session in localStorage: ${e}`)}}getSessionId(){return this.sessionId}getCurrentUrl(){return Yc&&"undefined"!=typeof window&&window.location?window.location.href:this.currentUrl}getSnapshotFrequencyInfo(){return{sessionDuration:Date.now()-this.sessionStartTime,currentInterval:3e5,currentThreshold:1e3,phase:"configured"}}async testConnection(){try{return await this.api.init(this.sessionId,this.endUserId),{success:!0}}catch(e){return{success:!1,error:e.message||"Unknown error"}}}getConnectionStatus(){const e=[];let t=!1;return this.eventQueue.length>0&&(t=!0,e.push("Some requests may be blocked by ad blockers")),this._connectionBlocked&&(t=!0,e.push("Initial connection test failed - ad blocker may be active")),"undefined"==typeof window&&e.push("Not running in browser environment"),void 0===navigator.sendBeacon&&e.push("sendBeacon not available, using fetch fallback"),{blocked:t,recommendations:e}}isPreexistingUser(){if(!Yc)return!1;const e=this.getCookie("human_behavior_end_user_id");return null!==e&&e!==this.endUserId}getUserInfo(){return{endUserId:this.endUserId,sessionId:this.sessionId,isPreexistingUser:this.isPreexistingUser(),initialized:this.initialized}}setSessionProperty(e,t){this.propertyManager.setSessionProperty(e,t)}setSessionProperties(e){this.propertyManager.setSessionProperties(e)}getSessionProperty(e){return this.propertyManager.getSessionProperty(e)}removeSessionProperty(e){this.propertyManager.removeSessionProperty(e)}setUserProperty(e,t){this.propertyManager.setUserProperty(e,t)}setUserProperties(e){this.propertyManager.setUserProperties(e)}getUserProperty(e){return this.propertyManager.getUserProperty(e)}removeUserProperty(e){this.propertyManager.removeUserProperty(e)}setOnce(e,t,s="user"){this.propertyManager.setOnce(e,t,s)}clearSessionProperties(){this.propertyManager.clearSessionProperties()}clearUserProperties(){this.propertyManager.clearUserProperties()}getAllProperties(){return this.propertyManager.getAllProperties()}}Yc&&(window.HumanBehaviorTracker=Zc);const qc=(e,t,s)=>new Zc(e,t,s);"undefined"!=typeof window&&(window.HumanBehaviorTracker=Zc,window.humanbehavior={init:qc}),e.HumanBehaviorAPI=Fc,e.HumanBehaviorTracker=Zc,e.PropertyManager=Hc,e.RedactionManager=Uc,e.getAutomaticProperties=Kc,e.getCurrentPageProperties=Vc,e.getDeviceInfo=jc,e.getInitialProperties=Gc,e.getLocationInfo=Wc,e.identifyUserGlobally=function(e){const t=globalThis.__humanBehaviorGlobalTracker;return t?.identifyUser?t.identifyUser({userProperties:e}):(console.warn("HumanBehavior tracker not found. Make sure the SDK is initialized."),null)},e.init=qc,e.isGlobalTrackerAvailable=function(){const e=globalThis.__humanBehaviorGlobalTracker;return!!e?.identifyUser},e.isSDKLogging=Ic,e.logDebug=Mc,e.logError=Ec,e.logInfo=xc,e.logWarn=Tc,e.logger=Cc,e.sendEventGlobally=function(e,t){const s=("undefined"!=typeof window?window:globalThis).__humanBehaviorGlobalTracker;return s?.customEvent?s.customEvent(e,t):s?.track?s.track(e,t):(console.warn("HumanBehavior tracker not found. Make sure the SDK is initialized."),null)}}),"undefined"!=typeof window&&(window.HumanBehaviorTracker=HumanBehaviorTracker,window.humanbehavior={init:HumanBehaviorTracker.init});
2
2
  //# sourceMappingURL=index.min.js.map