humanbehavior-js 0.5.69 β 0.5.71
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.
- package/README.md +48 -13
- package/package.json +1 -1
- package/packages/browser/dist/cjs/index.js +5 -5
- package/packages/browser/dist/cjs/index.js.map +1 -1
- package/packages/browser/dist/esm/index.js +4 -4
- package/packages/browser/dist/esm/index.js.map +1 -1
- package/packages/browser/dist/index.min.js +1 -1
- package/packages/browser/dist/index.min.js.map +1 -1
- package/packages/core/dist/index.js +1 -1
- package/packages/core/dist/index.js.map +1 -1
- package/packages/core/dist/index.mjs +1 -1
- package/packages/core/dist/index.mjs.map +1 -1
- package/packages/core/dist/tracker.d.ts.map +1 -1
- package/packages/react/dist/index.js +1 -1
- package/packages/react/dist/index.js.map +1 -1
- package/packages/react/dist/index.mjs +1 -1
- package/packages/react/dist/index.mjs.map +1 -1
- package/packages/wizard/dist/cli/ai-auto-install.d.ts.map +1 -1
- package/packages/wizard/dist/cli/ai-auto-install.js +100 -34
- package/packages/wizard/dist/cli/ai-auto-install.js.map +1 -1
- package/packages/wizard/dist/cli/auto-install.js +82 -34
- package/packages/wizard/dist/cli/auto-install.js.map +1 -1
- package/packages/wizard/dist/core/install-wizard.d.ts +4 -0
- package/packages/wizard/dist/core/install-wizard.d.ts.map +1 -1
- package/packages/wizard/dist/index.js +1 -1
- package/packages/wizard/dist/index.js.map +1 -1
- package/packages/wizard/dist/index.mjs +1 -1
- package/packages/wizard/dist/index.mjs.map +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as e,Fragment as t,jsxs as s}from"react/jsx-runtime";import{createContext as r,useState as n,useRef as i,useEffect as o,useCallback as a,useMemo as l,useContext as c}from"react";var h,u=Object.defineProperty,d=(e,t,s)=>((e,t,s)=>t in e?u(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s)(e,"symbol"!=typeof t?t+"":t,s),p=Object.defineProperty,m=(e,t,s)=>((e,t,s)=>t in e?p(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s)(e,"symbol"!=typeof t?t+"":t,s),f=(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))(f||{});const g={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},y={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},w={};function v(e){if(w[e])return w[e];const t=globalThis[e],s=t.prototype,r=e in g?g[e]:void 0,n=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]"))})),i=e in y?y[e]:void 0,o=Boolean(i&&i.every(e=>{var t;return"function"==typeof s[e]&&(null==(t=s[e])?void 0:t.toString().includes("[native code]"))}));if(n&&o)return w[e]=t.prototype,t.prototype;try{const r=document.createElement("iframe");document.body.appendChild(r);const n=r.contentWindow;if(!n)return t.prototype;const i=n[e].prototype;return document.body.removeChild(r),i?w[e]=i:s}catch{return s}}const S={};function b(e,t,s){var r;const n=`${e}.${String(s)}`;if(S[n])return S[n].call(t);const i=v(e),o=null==(r=Object.getOwnPropertyDescriptor(i,s))?void 0:r.get;return o?(S[n]=o,o.call(t)):t[s]}const C={};function I(e,t,s){const r=`${e}.${String(s)}`;if(C[r])return C[r].bind(t);const n=v(e)[s];return"function"!=typeof n?t[s]:(C[r]=n,n.bind(t))}const k={childNodes:function(e){return b("Node",e,"childNodes")},parentNode:function(e){return b("Node",e,"parentNode")},parentElement:function(e){return b("Node",e,"parentElement")},textContent:function(e){return b("Node",e,"textContent")},contains:function(e,t){return I("Node",e,"contains")(t)},getRootNode:function(e){return I("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?b("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?b("Element",e,"shadowRoot"):null},querySelector:function(e,t){return b("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return b("Element",e,"querySelectorAll")(t)},mutationObserver:function(){return v("MutationObserver").constructor}};function E(e){return e.nodeType===e.ELEMENT_NODE}function x(e){const t=e&&"host"in e&&"mode"in e&&k.host(e)||null;return Boolean(t&&"shadowRoot"in t&&k.shadowRoot(t)===e)}function O(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function T(e){try{const s=e.rules||e.cssRules;if(!s)return null;const r=Array.from(s,t=>R(t,e.href)).join("");return(t=r).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 R(e,t){if(function(e){return"styleSheet"in e}(e)){let t;try{t=T(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?$(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?$(s,t):s}}class M{constructor(){m(this,"idNodeMap",new Map),m(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 _({element:e,maskInputOptions:t,tagName:s,type:r,value:n,maskInputFn:i}){let o=n||"";const a=r&&A(r);return(t[s.toLowerCase()]||a&&t[a])&&(o=i?i(o,e):"*".repeat(o.length)),o}function A(e){return e.toLowerCase()}const P="__rrweb_original__";function N(e){const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?A(t):null}function F(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 L=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,D=/^(?:[a-z+]+:)?\/\//i,U=/^www\..*/i,B=/^(data:)([^,]*),(.*)/i;function $(e,t){return(e||"").replace(L,(e,s,r,n,i,o)=>{const a=r||i||o,l=s||n||"";if(!a)return e;if(D.test(a)||U.test(a))return`url(${l}${a}${l})`;if(B.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})`})}let z=1;const j=new RegExp("[^a-z0-9-_:]");function W(){return z++}let K,V;const G=/^[^ \t\n\r\u000c]+/,H=/^[, \t\n\r\u000c]+/;const Y=new WeakMap;function q(e,t){return t&&""!==t.trim()?J(e,t):t}function Z(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function J(e,t){let s=Y.get(e);if(s||(s=e.createElement("a"),Y.set(e,s)),t){if(t.startsWith("blob:")||t.startsWith("data:"))return t}else t="";return s.setAttribute("href",t),s.href}function Q(e,t,s,r){return r?"src"===s||"href"===s&&("use"!==t||"#"!==r[0])||"xlink:href"===s&&"#"!==r[0]?q(e,r):"background"!==s||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===s?function(e,t){if(""===t.trim())return t;let s=0;function r(e){let r;const n=e.exec(t.substring(s));return n?(r=n[0],s+=r.length,r):""}const n=[];for(;r(H),!(s>=t.length);){let i=r(G);if(","===i.slice(-1))i=q(e,i.substring(0,i.length-1)),n.push(i);else{let r="";i=q(e,i);let o=!1;for(;;){const e=t.charAt(s);if(""===e){n.push((i+r).trim());break}if(o)")"===e&&(o=!1);else{if(","===e){s+=1,n.push((i+r).trim());break}"("===e&&(o=!0)}r+=e,s+=1}}}return n.join(", ")}(e,r):"style"===s?$(r,J(e)):"object"===t&&"data"===s?q(e,r):r:q(e,r):r}function X(e,t,s){return("video"===e||"audio"===e)&&"autoplay"===t}function ee(e,t,s){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!s&&ee(k.parentNode(e),t,s);for(let s=e.classList.length;s--;){const r=e.classList[s];if(t.test(r))return!0}return!!s&&ee(k.parentNode(e),t,s)}function te(e,t,s,r){let n;if(E(e)){if(n=e,!k.childNodes(n).length)return!1}else{if(null===k.parentElement(e))return!1;n=k.parentElement(e)}try{if("string"==typeof t){if(r){if(n.closest(`.${t}`))return!0}else if(n.classList.contains(t))return!0}else if(ee(n,t,r))return!0;if(s)if(r){if(n.closest(s))return!0}else if(n.matches(s))return!0}catch(e){}return!1}function se(e,t){const{doc:s,mirror:r,blockClass:n,blockSelector:i,needsMask:o,inlineStylesheet:a,maskInputOptions:l={},maskTextFn:c,maskInputFn:h,dataURLOptions:u={},inlineImages:d,recordCanvas:p,keepIframeSrcFn:m,newlyAddedElement:g=!1}=t,y=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:f.Document,childNodes:[],compatMode:e.compatMode}:{type:f.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:f.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:y};case e.ELEMENT_NODE:return function(e,t){const{doc:s,blockClass:r,blockSelector:n,inlineStylesheet:i,maskInputOptions:o={},maskInputFn:a,dataURLOptions:l={},inlineImages:c,recordCanvas:h,keepIframeSrcFn:u,newlyAddedElement:d=!1,rootId:p}=t,m=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,n),g=function(e){if(e instanceof HTMLFormElement)return"form";const t=A(e.tagName);return j.test(t)?"div":t}(e);let y={};const w=e.attributes.length;for(let t=0;t<w;t++){const r=e.attributes[t];X(g,r.name,r.value)||(y[r.name]=Q(s,g,A(r.name),r.value))}if("link"===g&&i){const t=Array.from(s.styleSheets).find(t=>t.href===e.href);let r=null;t&&(r=T(t)),r&&(delete y.rel,delete y.href,y._cssText=r)}if("style"===g&&e.sheet&&!(e.innerText||k.textContent(e)||"").trim().length){const t=T(e.sheet);t&&(y._cssText=t)}if("input"===g||"textarea"===g||"select"===g){const t=e.value,s=e.checked;"radio"!==y.type&&"checkbox"!==y.type&&"submit"!==y.type&&"button"!==y.type&&t?y.value=_({element:e,type:N(e),tagName:g,value:t,maskInputOptions:o,maskInputFn:a}):s&&(y.checked=s)}"option"===g&&(e.selected&&!o.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&&h)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 n=t.getImageData,i=P in n?n[P]:n;if(new Uint32Array(i.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(l.type,l.quality));else if(!("__context"in e)){const t=e.toDataURL(l.type,l.quality),r=s.createElement("canvas");r.width=e.width,r.height=e.height;t!==r.toDataURL(l.type,l.quality)&&(y.rr_dataURL=t)}if("img"===g&&c){K||(K=s.createElement("canvas"),V=K.getContext("2d"));const t=e,r=t.currentSrc||t.getAttribute("src")||"<unknown-src>",n=t.crossOrigin,i=()=>{t.removeEventListener("load",i);try{K.width=t.naturalWidth,K.height=t.naturalHeight,V.drawImage(t,0,0),y.rr_dataURL=K.toDataURL(l.type,l.quality)}catch(e){if("anonymous"!==t.crossOrigin)return t.crossOrigin="anonymous",void(t.complete&&0!==t.naturalWidth?i():t.addEventListener("load",i));console.warn(`Cannot inline img src=${r}! Error: ${e}`)}"anonymous"===t.crossOrigin&&(n?y.crossOrigin=n:t.removeAttribute("crossorigin"))};t.complete&&0!==t.naturalWidth?i():t.addEventListener("load",i)}if("audio"===g||"video"===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}d||(e.scrollLeft&&(y.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(y.rr_scrollTop=e.scrollTop));if(m){const{width:t,height:s}=e.getBoundingClientRect();y={class:y.class,rr_width:`${t}px`,rr_height:`${s}px`}}"iframe"!==g||u(y.src)||(e.contentDocument||(y.rr_src=y.src),delete y.src);let v;try{customElements.get(g)&&(v=!0)}catch(e){}return{type:f.Element,tagName:g,attributes:y,childNodes:[],isSVG:Z(e)||void 0,needBlock:m,rootId:p,isCustom:v}}(e,{doc:s,blockClass:n,blockSelector:i,inlineStylesheet:a,maskInputOptions:l,maskInputFn:h,dataURLOptions:u,inlineImages:d,recordCanvas:p,keepIframeSrcFn:m,newlyAddedElement:g,rootId:y});case e.TEXT_NODE:return function(e,t){var s;const{needsMask:r,maskTextFn:n,rootId:i}=t,o=k.parentNode(e),a=o&&o.tagName;let l=k.textContent(e);const c="STYLE"===a||void 0,h="SCRIPT"===a||void 0;if(c&&l){try{e.nextSibling||e.previousSibling||(null==(s=o.sheet)?void 0:s.cssRules)&&(l=T(o.sheet))}catch(t){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${t}`,e)}l=$(l,J(t.doc))}h&&(l="SCRIPT_PLACEHOLDER");!c&&!h&&l&&r&&(l=n?n(l,k.parentElement(e)):l.replace(/[\S]/g,"*"));return{type:f.Text,textContent:l||"",isStyle:c,rootId:i}}(e,{doc:s,needsMask:o,maskTextFn:c,rootId:y});case e.CDATA_SECTION_NODE:return{type:f.CDATA,textContent:"",rootId:y};case e.COMMENT_NODE:return{type:f.Comment,textContent:k.textContent(e)||"",rootId:y};default:return!1}}function re(e){return null==e?"":e.toLowerCase()}function ne(e,t){const{doc:s,mirror:r,blockClass:n,blockSelector:i,maskTextClass:o,maskTextSelector:a,skipChild:l=!1,inlineStylesheet:c=!0,maskInputOptions:h={},maskTextFn:u,maskInputFn:d,slimDOMOptions:p,dataURLOptions:m={},inlineImages:g=!1,recordCanvas:y=!1,onSerialize:w,onIframeLoad:v,iframeLoadTimeout:S=5e3,onStylesheetLoad:b,stylesheetLoadTimeout:C=5e3,keepIframeSrcFn:I=()=>!1,newlyAddedElement:T=!1}=t;let{needsMask:R}=t,{preserveWhiteSpace:M=!0}=t;if(!R){R=te(e,o,a,void 0===R)}const _=se(e,{doc:s,mirror:r,blockClass:n,blockSelector:i,needsMask:R,inlineStylesheet:c,maskInputOptions:h,maskTextFn:u,maskInputFn:d,dataURLOptions:m,inlineImages:g,recordCanvas:y,keepIframeSrcFn:I,newlyAddedElement:T});if(!_)return console.warn(e,"not serialized"),null;let A;A=r.hasNode(e)?r.getId(e):!function(e,t){if(t.comment&&e.type===f.Comment)return!0;if(e.type===f.Element){if(t.script&&("script"===e.tagName||"link"===e.tagName&&("preload"===e.attributes.rel||"modulepreload"===e.attributes.rel)&&"script"===e.attributes.as||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&"js"===F(e.attributes.href)))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(re(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===re(e.attributes.name)||"icon"===re(e.attributes.rel)||"apple-touch-icon"===re(e.attributes.rel)||"shortcut icon"===re(e.attributes.rel))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&re(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(re(e.attributes.property).match(/^(og|twitter|fb):/)||re(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===re(e.attributes.name)))return!0;if(t.headMetaRobots&&("robots"===re(e.attributes.name)||"googlebot"===re(e.attributes.name)||"bingbot"===re(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&("author"===re(e.attributes.name)||"generator"===re(e.attributes.name)||"framework"===re(e.attributes.name)||"publisher"===re(e.attributes.name)||"progid"===re(e.attributes.name)||re(e.attributes.property).match(/^article:/)||re(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&("google-site-verification"===re(e.attributes.name)||"yandex-verification"===re(e.attributes.name)||"csrf-token"===re(e.attributes.name)||"p:domain_verify"===re(e.attributes.name)||"verify-v1"===re(e.attributes.name)||"verification"===re(e.attributes.name)||"shopify-checkout-api-token"===re(e.attributes.name)))return!0}}return!1}(_,p)&&(M||_.type!==f.Text||_.isStyle||_.textContent.replace(/^\s+|\s+$/gm,"").length)?W():-2;const P=Object.assign(_,{id:A});if(r.add(e,P),-2===A)return null;w&&w(e);let N=!l;if(P.type===f.Element){N=N&&!P.needBlock,delete P.needBlock;const t=k.shadowRoot(e);t&&O(t)&&(P.isShadowHost=!0)}if((P.type===f.Document||P.type===f.Element)&&N){p.headWhitespace&&P.type===f.Element&&"head"===P.tagName&&(M=!1);const t={doc:s,mirror:r,blockClass:n,blockSelector:i,needsMask:R,maskTextClass:o,maskTextSelector:a,skipChild:l,inlineStylesheet:c,maskInputOptions:h,maskTextFn:u,maskInputFn:d,slimDOMOptions:p,dataURLOptions:m,inlineImages:g,recordCanvas:y,preserveWhiteSpace:M,onSerialize:w,onIframeLoad:v,iframeLoadTimeout:S,onStylesheetLoad:b,stylesheetLoadTimeout:C,keepIframeSrcFn:I};if(P.type===f.Element&&"textarea"===P.tagName&&void 0!==P.attributes.value);else for(const s of Array.from(k.childNodes(e))){const e=ne(s,t);e&&P.childNodes.push(e)}let x=null;if(E(e)&&(x=k.shadowRoot(e)))for(const e of Array.from(k.childNodes(x))){const s=ne(e,t);s&&(O(x)&&(s.isShadow=!0),P.childNodes.push(s))}}const L=k.parentNode(e);return L&&x(L)&&O(L)&&(P.isShadow=!0),P.type===f.Element&&"iframe"===P.tagName&&function(e,t,s){const r=e.contentWindow;if(!r)return;let n,i=!1;try{n=r.document.readyState}catch(e){return}if("complete"!==n){const r=setTimeout(()=>{i||(t(),i=!0)},s);return void e.addEventListener("load",()=>{clearTimeout(r),i=!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&&v){const s=ne(t,{doc:t,mirror:r,blockClass:n,blockSelector:i,needsMask:R,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:h,maskTextFn:u,maskInputFn:d,slimDOMOptions:p,dataURLOptions:m,inlineImages:g,recordCanvas:y,preserveWhiteSpace:M,onSerialize:w,onIframeLoad:v,iframeLoadTimeout:S,onStylesheetLoad:b,stylesheetLoadTimeout:C,keepIframeSrcFn:I});s&&v(e,s)}},S),P.type===f.Element&&"link"===P.tagName&&"string"==typeof P.attributes.rel&&("stylesheet"===P.attributes.rel||"preload"===P.attributes.rel&&"string"==typeof P.attributes.href&&"css"===F(P.attributes.href))&&function(e,t,s){let r,n=!1;try{r=e.sheet}catch(e){return}if(r)return;const i=setTimeout(()=>{n||(t(),n=!0)},s);e.addEventListener("load",()=>{clearTimeout(i),n=!0,t()})}(e,()=>{if(b){const t=ne(e,{doc:s,mirror:r,blockClass:n,blockSelector:i,needsMask:R,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:h,maskTextFn:u,maskInputFn:d,slimDOMOptions:p,dataURLOptions:m,inlineImages:g,recordCanvas:y,preserveWhiteSpace:M,onSerialize:w,onIframeLoad:v,iframeLoadTimeout:S,onStylesheetLoad:b,stylesheetLoadTimeout:C,keepIframeSrcFn:I});t&&b(e,t)}},C),P}function ie(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function oe(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 ae={exports:{}},le=String,ce=function(){return{isColorSupported:!1,reset:le,bold:le,dim:le,italic:le,underline:le,inverse:le,hidden:le,strikethrough:le,black:le,red:le,green:le,yellow:le,blue:le,magenta:le,cyan:le,white:le,gray:le,bgBlack:le,bgRed:le,bgGreen:le,bgYellow:le,bgBlue:le,bgMagenta:le,bgCyan:le,bgWhite:le}};ae.exports=ce(),ae.exports.createColors=ce;var he=ae.exports;const ue=oe(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));let de=he,pe=ue,me=class e extends Error{constructor(t,s,r,n,i,o){super(t),this.name="CssSyntaxError",this.reason=t,i&&(this.file=i),n&&(this.source=n),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=de.isColorSupported),pe&&e&&(t=pe(t));let s,r,n=t.split(/\r?\n/),i=Math.max(this.line-3,0),o=Math.min(this.line+2,n.length),a=String(o).length;if(e){let{bold:e,gray:t,red:n}=de.createColors(!0);s=t=>e(n(t)),r=e=>t(e)}else s=r=e=>e;return n.slice(i,o).map((e,t)=>{let n=i+1+t,o=" "+(" "+n).slice(-a)+" | ";if(n===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 fe=me;me.default=me;var ge={};ge.isClean=Symbol("isClean"),ge.my=Symbol("my");const ye={after:"\n",beforeClose:"\n",beforeComment:"\n",beforeDecl:"\n",beforeOpen:" ",beforeRule:"\n",colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};let we=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 n=(e.raws.between||"")+(t?";":"");this.builder(s+r+n,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,n=0;for(;r&&"root"!==r.type;)n+=1,r=r.parent;if(s.includes("\n")){let t=this.raw(e,null,"indent");if(t.length)for(let e=0;e<n;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 n=e.nodes[r],i=this.raw(n,"before");i&&this.builder(i),this.stringify(n,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 n=e.parent;if("before"===s){if(!n||"root"===n.type&&n.first===e)return"";if(n&&"document"===n.type)return""}if(!n)return ye[s];let i=e.root();if(i.rawCache||(i.rawCache={}),void 0!==i.rawCache[s])return i.rawCache[s];if("before"===s||"after"===s)return this.beforeAfter(e,s);{let n="raw"+((o=s)[0].toUpperCase()+o.slice(1));this[n]?r=this[n](i,e):i.walk(e=>{if(r=e.raws[t],void 0!==r)return!1})}var o;return void 0===r&&(r=ye[s]),i.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 ve=we;we.default=we;let Se=ve;function be(e,t){new Se(t).stringify(e)}var Ce=be;be.default=be;let{isClean:Ie,my:ke}=ge,Ee=fe,xe=ve,Oe=Ce;function Te(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 n=e[r],i=typeof n;"parent"===r&&"object"===i?t&&(s[r]=t):"source"===r?s[r]=n:Array.isArray(n)?s[r]=n.map(e=>Te(e,s)):("object"===i&&null!==n&&(n=Te(n)),s[r]=n)}return s}let Re=class{constructor(e={}){this.raws={},this[Ie]=!1,this[ke]=!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=Te(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 Ee(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[Ie]){this[Ie]=!1;let e=this;for(;e=e.parent;)e[Ie]=!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,n=this.source.start.line;for(let t=0;t<e;t++)"\n"===s[t]?(r=1,n+=1):r+=1;return{column:r,line:n}}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(),n=r.indexOf(e.word);-1!==n&&(t=this.positionInside(n,r),s=this.positionInside(n+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 xe).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 n=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 i=t.get(r.input);null==i&&(i=n,t.set(r.input,n),n++),s[e]={end:r.end,inputId:i,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=Oe){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 Me=Re;Re.default=Re;let _e=Me,Ae=class extends _e{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 Pe=Ae;Ae.default=Ae;var Ne={nanoid:(e=21)=>{let t="",s=e;for(;s--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t}};let{SourceMapConsumer:Fe,SourceMapGenerator:Le}=ue,{existsSync:De,readFileSync:Ue}=ue,{dirname:Be,join:$e}=ue;let ze=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=Be(this.mapFile)),r&&(this.text=r)}consumer(){return this.consumerCache||(this.consumerCache=new Fe(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=Be(e),De(e))return this.mapFile=e,Ue(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 Fe)return Le.fromSourceMap(t).toString();if(t instanceof Le)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=$e(Be(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 je=ze;ze.default=ze;let{SourceMapConsumer:We,SourceMapGenerator:Ke}=ue,{fileURLToPath:Ve,pathToFileURL:Ge}=ue,{isAbsolute:He,resolve:Ye}=ue,{nanoid:qe}=Ne,Ze=ue,Je=fe,Qe=je,Xe=Symbol("fromOffsetCache"),et=Boolean(We&&Ke),tt=Boolean(Ye&&He),st=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&&(!tt||/^\w+:\/\//.test(t.from)||He(t.from)?this.file=t.from:this.file=Ye(t.from)),tt&&et){let e=new Qe(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 "+qe(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,s,r={}){let n,i,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);i=e.line,o=e.col}else i=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,i,o);return n=a?new Je(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 Je(e,void 0===i?t:{column:s,line:t},void 0===i?s:{column:o,line:i},this.css,this.file,r.plugin),n.input={column:s,endColumn:o,endLine:i,line:t,source:this.css},this.file&&(Ge&&(n.input.url=Ge(this.file).toString()),n.input.file=this.file),n}fromOffset(e){let t,s;if(this[Xe])s=this[Xe];else{let e=this.css.split("\n");s=new Array(e.length);let t=0;for(let r=0,n=e.length;r<n;r++)s[r]=t,t+=e[r].length+1;this[Xe]=s}t=s[s.length-1];let r=0;if(e>=t)r=s.length-1;else{let t,n=s.length-2;for(;r<n;)if(t=r+(n-r>>1),e<s[t])n=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:Ye(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,s,r){if(!this.map)return!1;let n,i,o=this.map.consumer(),a=o.originalPositionFor({column:t,line:e});if(!a.source)return!1;"number"==typeof s&&(n=o.originalPositionFor({column:r,line:s})),i=He(a.source)?Ge(a.source):new URL(a.source,this.map.consumer().sourceRoot||Ge(this.map.mapFile));let l={column:a.column,endColumn:n&&n.column,endLine:n&&n.line,line:a.line,url:i.toString()};if("file:"===i.protocol){if(!Ve)throw new Error("file: protocol is not available in this PostCSS build");l.file=Ve(i)}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 rt=st;st.default=st,Ze&&Ze.registerInput&&Ze.registerInput(st);let{SourceMapConsumer:nt,SourceMapGenerator:it}=ue,{dirname:ot,relative:at,resolve:lt,sep:ct}=ue,{pathToFileURL:ht}=ue,ut=rt,dt=Boolean(nt&&it),pt=Boolean(ot&<&&at&&ct);var mt=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||ot(e.file);!1===this.mapOpts.sourcesContent?(t=new nt(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(),pt&&dt&&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=it.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new it({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 it({file:this.outputFile(),ignoreInvalidMapping:!0});let e,t,s=1,r=1,n="<no source>",i={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&&(i.generated.line=s,i.generated.column=r-1,a.source&&a.source.start?(i.source=this.sourcePath(a),i.original.line=a.source.start.line,i.original.column=a.source.start.column-1,this.map.addMapping(i)):(i.source=n,i.original.line=1,i.original.column=0,this.map.addMapping(i))),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?(i.source=this.sourcePath(a),i.original.line=a.source.end.line,i.original.column=a.source.end.column-1,i.generated.line=s,i.generated.column=r-2,this.map.addMapping(i)):(i.source=n,i.original.line=1,i.original.column=0,i.generated.line=s,i.generated.column=r-1,this.map.addMapping(i)))}})}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?ot(this.opts.to):".";"string"==typeof this.mapOpts.annotation&&(s=ot(lt(s,this.mapOpts.annotation)));let r=at(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 ut(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(ht){let t=ht(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;"\\"===ct&&(e=e.replace(/\\/g,"/"));let s=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,s),s}};let ft=Me,gt=class extends ft{constructor(e){super(e),this.type="comment"}};var yt=gt;gt.default=gt;let wt,vt,St,bt,{isClean:Ct,my:It}=ge,kt=Pe,Et=yt,xt=Me;function Ot(e){return e.map(e=>(e.nodes&&(e.nodes=Ot(e.nodes)),delete e.source,e))}function Tt(e){if(e[Ct]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)Tt(t)}let Rt=class e extends xt{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),n=this.normalize(t,this.proxyOf.nodes[r]).reverse();r=this.index(e);for(let e of n)this.proxyOf.nodes.splice(r+1,0,e);for(let e in this.indexes)s=this.indexes[e],r<s&&(this.indexes[e]=s+n.length);return this.markDirty(),this}insertBefore(e,t){let s,r=this.index(e),n=0===r&&"prepend",i=this.normalize(t,this.proxyOf.nodes[r],n).reverse();r=this.index(e);for(let e of i)this.proxyOf.nodes.splice(r,0,e);for(let e in this.indexes)s=this.indexes[e],r<=s&&(this.indexes[e]=s+i.length);return this.markDirty(),this}normalize(t,s){if("string"==typeof t)t=Ot(wt(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 kt(t)]}else if(t.selector)t=[new vt(t)];else if(t.name)t=[new St(t)];else{if(!t.text)throw new Error("Unknown node type in node creation");t=[new Et(t)]}return t.map(t=>(t[It]||e.rebuild(t),(t=t.proxyOf).parent&&t.parent.removeChild(t),t[Ct]&&Tt(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]}};Rt.registerParse=e=>{wt=e},Rt.registerRule=e=>{vt=e},Rt.registerAtRule=e=>{St=e},Rt.registerRoot=e=>{bt=e};var Mt=Rt;Rt.default=Rt,Rt.rebuild=e=>{"atrule"===e.type?Object.setPrototypeOf(e,St.prototype):"rule"===e.type?Object.setPrototypeOf(e,vt.prototype):"decl"===e.type?Object.setPrototypeOf(e,kt.prototype):"comment"===e.type?Object.setPrototypeOf(e,Et.prototype):"root"===e.type&&Object.setPrototypeOf(e,bt.prototype),e[It]=!0,e.nodes&&e.nodes.forEach(e=>{Rt.rebuild(e)})};let _t,At,Pt=Mt,Nt=class extends Pt{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(e={}){return new _t(new At,this,e).stringify()}};Nt.registerLazyResult=e=>{_t=e},Nt.registerProcessor=e=>{At=e};var Ft=Nt;Nt.default=Nt;let Lt={};var Dt=function(e){Lt[e]||(Lt[e]=!0,"undefined"!=typeof console&&console.warn&&console.warn(e))};let Ut=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 Bt=Ut;Ut.default=Ut;let $t=Bt,zt=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 $t(e,t);return this.messages.push(s),s}warnings(){return this.messages.filter(e=>"warning"===e.type)}get content(){return this.css}};var jt=zt;zt.default=zt;const Wt="'".charCodeAt(0),Kt='"'.charCodeAt(0),Vt="\\".charCodeAt(0),Gt="/".charCodeAt(0),Ht="\n".charCodeAt(0),Yt=" ".charCodeAt(0),qt="\f".charCodeAt(0),Zt="\t".charCodeAt(0),Jt="\r".charCodeAt(0),Qt="[".charCodeAt(0),Xt="]".charCodeAt(0),es="(".charCodeAt(0),ts=")".charCodeAt(0),ss="{".charCodeAt(0),rs="}".charCodeAt(0),ns=";".charCodeAt(0),is="*".charCodeAt(0),os=":".charCodeAt(0),as="@".charCodeAt(0),ls=/[\t\n\f\r "#'()/;[\\\]{}]/g,cs=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,hs=/.[\r\n"'(/\\]/,us=/[\da-f]/i;let ds=Mt,ps=class extends ds{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 ms=ps;ps.default=ps,ds.registerAtRule(ps);let fs,gs,ys=Mt,ws=class extends ys{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 fs(new gs,this,e).stringify()}};ws.registerLazyResult=e=>{fs=e},ws.registerProcessor=e=>{gs=e};var vs=ws;ws.default=ws,ys.registerRoot(ws);let Ss={comma:e=>Ss.split(e,[","],!0),space:e=>Ss.split(e,[" ","\n","\t"]),split(e,t,s){let r=[],n="",i=!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)&&(i=!0),i?(""!==n&&r.push(n.trim()),n="",i=!1):n+=s;return(s||""!==n)&&r.push(n.trim()),r}};var bs=Ss;Ss.default=Ss;let Cs=Mt,Is=bs,ks=class extends Cs{constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return Is.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 Es=ks;ks.default=ks,Cs.registerRule(ks);let xs=Pe,Os=function(e,t={}){let s,r,n,i,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 Ht:case Yt:case Zt:case Jt:case qt:r=f;do{r+=1,s=d.charCodeAt(r)}while(s===Yt||s===Ht||s===Zt||s===Jt||s===qt);u=["space",d.slice(f,r)],f=r-1;break;case Qt:case Xt:case ss:case rs:case os:case ns:case ts:{let e=String.fromCharCode(s);u=[e,e,f];break}case es:if(c=g.length?g.pop()[1]:"",h=d.charCodeAt(f+1),"url"===c&&h!==Wt&&h!==Kt&&h!==Yt&&h!==Ht&&h!==Zt&&h!==qt&&h!==Jt){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)===Vt;)l-=1,a=!a}while(a);u=["brackets",d.slice(f,r+1),f,r],f=r}else r=d.indexOf(")",f+1),i=d.slice(f,r+1),-1===r||hs.test(i)?u=["(","(",f]:(u=["brackets",i,f,r],f=r);break;case Wt:case Kt:n=s===Wt?"'":'"',r=f;do{if(a=!1,r=d.indexOf(n,r+1),-1===r){if(p||t){r=f+1;break}w("string")}for(l=r;d.charCodeAt(l-1)===Vt;)l-=1,a=!a}while(a);u=["string",d.slice(f,r+1),f,r],f=r;break;case as:ls.lastIndex=f+1,ls.test(d),r=0===ls.lastIndex?d.length-1:ls.lastIndex-2,u=["at-word",d.slice(f,r+1),f,r],f=r;break;case Vt:for(r=f,o=!0;d.charCodeAt(r+1)===Vt;)r+=1,o=!o;if(s=d.charCodeAt(r+1),o&&s!==Gt&&s!==Yt&&s!==Ht&&s!==Zt&&s!==Jt&&s!==qt&&(r+=1,us.test(d.charAt(r)))){for(;us.test(d.charAt(r+1));)r+=1;d.charCodeAt(r+1)===Yt&&(r+=1)}u=["word",d.slice(f,r+1),f,r],f=r;break;default:s===Gt&&d.charCodeAt(f+1)===is?(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):(cs.lastIndex=f+1,cs.test(d),r=0===cs.lastIndex?d.length-1:cs.lastIndex-2,u=["word",d.slice(f,r+1),f,r],g.push(u),f=r)}return f++,u},position:function(){return f}}},Ts=yt,Rs=ms,Ms=vs,_s=Es;const As={empty:!0,space:!0};let Ps=Mt,Ns=class{constructor(e){this.input=e,this.root=new Ms,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,n=new Rs;n.name=e[1].slice(1),""===n.name&&this.unnamedAtrule(n,e),this.init(n,e[2]);let i=!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){n.source.end=this.getPosition(e[2]),n.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&&(n.source.end=this.getPosition(s[3]||s[2]),n.source.end.offset++)}this.end(e);break}a.push(e)}else a.push(e);if(this.tokenizer.endOfFile()){i=!0;break}}n.raws.between=this.spacesAndCommentsFromEnd(a),a.length?(n.raws.afterName=this.spacesAndCommentsFromStart(a),this.raw(n,"params",a),i&&(e=a[a.length-1],n.source.end=this.getPosition(e[3]||e[2]),n.source.end.offset++,this.spaces=n.raws.between,n.raws.between="")):(n.raws.afterName="",n.params=""),o&&(n.nodes=[],this.current=n)}checkMissedSemicolon(e){let t=this.colon(e);if(!1===t)return;let s,r=0;for(let n=t-1;n>=0&&(s=e[n],"space"===s[0]||(r+=1,2!==r));n--);throw this.input.error("Missed semicolon","word"===s[0]?s[3]+1:s[2])}colon(e){let t,s,r,n=0;for(let[i,o]of e.entries()){if(t=o,s=t[0],"("===s&&(n+=1),")"===s&&(n-=1),0===n&&":"===s){if(r){if("word"===r[0]&&"progid"===r[1])continue;return i}this.doubleColon(t)}r=t}return!1}comment(e){let t=new Ts;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=Os(this.input)}decl(e,t){let s=new xs;this.init(s,e[0][2]);let r,n=e[e.length-1];for(";"===n[0]&&(this.semicolon=!0,e.pop()),s.source.end=this.getPosition(n[3]||n[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 i,o=[];for(;e.length&&(i=e[0][0],"space"===i||"comment"===i);)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),n="";for(let e=t;e>0;e--){let t=r[e][0];if(0===n.trim().indexOf("!")&&"space"!==t)break;n=r.pop()[1]+n}0===n.trim().indexOf("!")&&(s.important=!0,s.raws.important=n,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 _s;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,n=null,i=[],o=e[1].startsWith("--"),a=[],l=e;for(;l;){if(s=l[0],a.push(l),"("===s||"["===s)n||(n=l),i.push("("===s?")":"]");else if(o&&r&&"{"===s)n||(n=l),i.push("}");else if(0===i.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===i[i.length-1]&&(i.pop(),0===i.length&&(n=null));l=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),i.length>0&&this.unclosedBracket(n),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 n,i,o,a,l=s.length,c="",h=!0;for(let e=0;e<l;e+=1)n=s[e],i=n[0],"space"!==i||e!==l-1||r?"comment"===i?(a=s[e-1]?s[e-1][0]:"empty",o=s[e+1]?s[e+1][0]:"empty",As[a]||As[o]||","===c.slice(-1)?h=!1:c+=n[1]):c+=n[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 _s;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})}},Fs=rt;function Ls(e,t){let s=new Fs(e,t),r=new Ns(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 Ds=Ls;Ls.default=Ls,Ps.registerParse(Ls);let{isClean:Us,my:Bs}=ge,$s=mt,zs=Ce,js=Mt,Ws=Ft,Ks=Dt,Vs=jt,Gs=Ds,Hs=vs;const Ys={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},qs={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},Zs={Once:!0,postcssPlugin:!0,prepare:!0};function Js(e){return"object"==typeof e&&"function"==typeof e.then}function Qs(e){let t=!1,s=Ys[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 Xs(e){let t;return t="document"===e.type?["Document",0,"DocumentExit"]:"root"===e.type?["Root",0,"RootExit"]:Qs(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function er(e){return e[Us]=!1,e.nodes&&e.nodes.forEach(e=>er(e)),e}let tr={},sr=class e{constructor(t,s,r){let n;if(this.stringified=!1,this.processed=!1,"object"!=typeof s||null===s||"root"!==s.type&&"document"!==s.type)if(s instanceof e||s instanceof Vs)n=er(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=Gs;r.syntax&&(e=r.syntax.parse),r.parser&&(e=r.parser),e.parse&&(e=e.parse);try{n=e(s,r)}catch(e){this.processed=!0,this.error=e}n&&!n[Bs]&&js.rebuild(n)}else n=er(s);this.result=new Vs(t,n,r),this.helpers={...tr,postcss:tr,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,n=t.split("."),i=r.split(".");(n[0]!==i[0]||parseInt(n[1])>parseInt(i[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(!qs[s]&&/^[A-Z]/.test(s))throw new Error(`Unknown event ${s} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!Zs[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(Js(s))try{await s}catch(e){throw this.handleError(e)}}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[Us];){e[Us]=!0;let t=[Xs(e)];for(;t.length>0;){let e=this.visitTick(t);if(Js(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 Js(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=zs;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let s=new $s(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(Js(this.runOnRoot(e)))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[Us];)e[Us]=!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||Ks("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(Js(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,n]=r[t.visitorIndex];t.visitorIndex+=1,t.visitorIndex===r.length&&(t.visitors=[],t.visitorIndex=0),this.result.lastPlugin=e;try{return n(s.toProxy(),this.helpers)}catch(e){throw this.handleError(e,s)}}if(0!==t.iterator){let r,n=t.iterator;for(;r=s.nodes[s.indexes[n]];)if(s.indexes[n]+=1,!r[Us])return r[Us]=!0,void e.push(Xs(r));t.iterator=0,delete s.indexes[n]}let n=t.events;for(;t.eventIndex<n.length;){let e=n[t.eventIndex];if(t.eventIndex+=1,0===e)return void(s.nodes&&s.nodes.length&&(s[Us]=!0,t.iterator=s.getIterator()));if(this.listeners[e])return void(t.visitors=this.listeners[e])}e.pop()}walkSync(e){e[Us]=!0;let t=Qs(e);for(let s of t)if(0===s)e.nodes&&e.each(e=>{e[Us]||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"}};sr.registerPostcss=e=>{tr=e};var rr=sr;sr.default=sr,Hs.registerLazyResult(sr),Ws.registerLazyResult(sr);let nr=mt,ir=Ce,or=Dt,ar=Ds;const lr=jt;let cr=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 n=ir;this.result=new lr(this._processor,r,this._opts),this.result.css=t;let i=this;Object.defineProperty(this.result,"root",{get:()=>i.root});let o=new nr(n,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||or("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=ar;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 hr=cr;cr.default=cr;let ur=hr,dr=rr,pr=Ft,mr=vs,fr=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 dr(this,e,t):new ur(this,e,t)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}};var gr=fr;fr.default=fr,mr.registerProcessor(fr),pr.registerProcessor(fr);let yr=Pe,wr=je,vr=yt,Sr=ms,br=rt,Cr=vs,Ir=Es;function kr(e,t){if(Array.isArray(e))return e.map(e=>kr(e));let{inputs:s,...r}=e;if(s){t=[];for(let e of s){let s={...e,__proto__:br.prototype};s.map&&(s.map={...s.map,__proto__:wr.prototype}),t.push(s)}}if(r.nodes&&(r.nodes=e.nodes.map(e=>kr(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 Cr(r);if("decl"===r.type)return new yr(r);if("rule"===r.type)return new Ir(r);if("comment"===r.type)return new vr(r);if("atrule"===r.type)return new Sr(r);throw new Error("Unknown node type: "+e.type)}var Er=kr;kr.default=kr;let xr=fe,Or=Pe,Tr=rr,Rr=Mt,Mr=gr,_r=Ce,Ar=Er,Pr=Ft,Nr=Bt,Fr=yt,Lr=ms,Dr=jt,Ur=rt,Br=Ds,$r=bs,zr=Es,jr=vs,Wr=Me;function Kr(...e){return 1===e.length&&Array.isArray(e[0])&&(e=e[0]),new Mr(e)}Kr.plugin=function(e,t){let s,r=!1;function n(...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 n=t(...s);return n.postcssPlugin=e,n.postcssVersion=(new Mr).version,n}return Object.defineProperty(n,"postcss",{get:()=>(s||(s=n()),s)}),n.process=function(e,t,s){return Kr([n(s)]).process(e,t)},n},Kr.stringify=_r,Kr.parse=Br,Kr.fromJSON=Ar,Kr.list=$r,Kr.comment=e=>new Fr(e),Kr.atRule=e=>new Lr(e),Kr.decl=e=>new Or(e),Kr.rule=e=>new zr(e),Kr.root=e=>new jr(e),Kr.document=e=>new Pr(e),Kr.CssSyntaxError=xr,Kr.Declaration=Or,Kr.Container=Rr,Kr.Processor=Mr,Kr.Document=Pr,Kr.Comment=Fr,Kr.Warning=Nr,Kr.AtRule=Lr,Kr.Result=Dr,Kr.Input=Ur,Kr.Rule=zr,Kr.Root=jr,Kr.Node=Wr,Tr.registerPostcss(Kr);var Vr=Kr;Kr.default=Kr;const Gr=ie(Vr);Gr.stringify,Gr.fromJSON,Gr.plugin,Gr.parse,Gr.list,Gr.document,Gr.comment,Gr.atRule,Gr.rule,Gr.decl,Gr.root,Gr.CssSyntaxError,Gr.Declaration,Gr.Container,Gr.Processor,Gr.Document,Gr.Comment,Gr.Warning,Gr.AtRule,Gr.Result,Gr.Input,Gr.Rule,Gr.Root,Gr.Node;var Hr=Object.defineProperty,Yr=(e,t,s)=>((e,t,s)=>t in e?Hr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s)(e,"symbol"!=typeof t?t+"":t,s);function qr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Zr(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 Jr={exports:{}},Qr=String,Xr=function(){return{isColorSupported:!1,reset:Qr,bold:Qr,dim:Qr,italic:Qr,underline:Qr,inverse:Qr,hidden:Qr,strikethrough:Qr,black:Qr,red:Qr,green:Qr,yellow:Qr,blue:Qr,magenta:Qr,cyan:Qr,white:Qr,gray:Qr,bgBlack:Qr,bgRed:Qr,bgGreen:Qr,bgYellow:Qr,bgBlue:Qr,bgMagenta:Qr,bgCyan:Qr,bgWhite:Qr}};Jr.exports=Xr(),Jr.exports.createColors=Xr;var en=Jr.exports;const tn=Zr(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));let sn=en,rn=tn,nn=class e extends Error{constructor(t,s,r,n,i,o){super(t),this.name="CssSyntaxError",this.reason=t,i&&(this.file=i),n&&(this.source=n),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=sn.isColorSupported),rn&&e&&(t=rn(t));let s,r,n=t.split(/\r?\n/),i=Math.max(this.line-3,0),o=Math.min(this.line+2,n.length),a=String(o).length;if(e){let{bold:e,gray:t,red:n}=sn.createColors(!0);s=t=>e(n(t)),r=e=>t(e)}else s=r=e=>e;return n.slice(i,o).map((e,t)=>{let n=i+1+t,o=" "+(" "+n).slice(-a)+" | ";if(n===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 on=nn;nn.default=nn;var an={};an.isClean=Symbol("isClean"),an.my=Symbol("my");const ln={after:"\n",beforeClose:"\n",beforeComment:"\n",beforeDecl:"\n",beforeOpen:" ",beforeRule:"\n",colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};let cn=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 n=(e.raws.between||"")+(t?";":"");this.builder(s+r+n,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,n=0;for(;r&&"root"!==r.type;)n+=1,r=r.parent;if(s.includes("\n")){let t=this.raw(e,null,"indent");if(t.length)for(let e=0;e<n;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 n=e.nodes[r],i=this.raw(n,"before");i&&this.builder(i),this.stringify(n,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 n=e.parent;if("before"===s){if(!n||"root"===n.type&&n.first===e)return"";if(n&&"document"===n.type)return""}if(!n)return ln[s];let i=e.root();if(i.rawCache||(i.rawCache={}),void 0!==i.rawCache[s])return i.rawCache[s];if("before"===s||"after"===s)return this.beforeAfter(e,s);{let n="raw"+((o=s)[0].toUpperCase()+o.slice(1));this[n]?r=this[n](i,e):i.walk(e=>{if(r=e.raws[t],void 0!==r)return!1})}var o;return void 0===r&&(r=ln[s]),i.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 hn=cn;cn.default=cn;let un=hn;function dn(e,t){new un(t).stringify(e)}var pn=dn;dn.default=dn;let{isClean:mn,my:fn}=an,gn=on,yn=hn,wn=pn;function vn(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 n=e[r],i=typeof n;"parent"===r&&"object"===i?t&&(s[r]=t):"source"===r?s[r]=n:Array.isArray(n)?s[r]=n.map(e=>vn(e,s)):("object"===i&&null!==n&&(n=vn(n)),s[r]=n)}return s}let Sn=class{constructor(e={}){this.raws={},this[mn]=!1,this[fn]=!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=vn(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 gn(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[mn]){this[mn]=!1;let e=this;for(;e=e.parent;)e[mn]=!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,n=this.source.start.line;for(let t=0;t<e;t++)"\n"===s[t]?(r=1,n+=1):r+=1;return{column:r,line:n}}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(),n=r.indexOf(e.word);-1!==n&&(t=this.positionInside(n,r),s=this.positionInside(n+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 yn).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 n=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 i=t.get(r.input);null==i&&(i=n,t.set(r.input,n),n++),s[e]={end:r.end,inputId:i,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=wn){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 bn=Sn;Sn.default=Sn;let Cn=bn,In=class extends Cn{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 kn=In;In.default=In;var En={nanoid:(e=21)=>{let t="",s=e;for(;s--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t}};let{SourceMapConsumer:xn,SourceMapGenerator:On}=tn,{existsSync:Tn,readFileSync:Rn}=tn,{dirname:Mn,join:_n}=tn;let An=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=Mn(this.mapFile)),r&&(this.text=r)}consumer(){return this.consumerCache||(this.consumerCache=new xn(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=Mn(e),Tn(e))return this.mapFile=e,Rn(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 xn)return On.fromSourceMap(t).toString();if(t instanceof On)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=_n(Mn(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 Pn=An;An.default=An;let{SourceMapConsumer:Nn,SourceMapGenerator:Fn}=tn,{fileURLToPath:Ln,pathToFileURL:Dn}=tn,{isAbsolute:Un,resolve:Bn}=tn,{nanoid:$n}=En,zn=tn,jn=on,Wn=Pn,Kn=Symbol("fromOffsetCache"),Vn=Boolean(Nn&&Fn),Gn=Boolean(Bn&&Un),Hn=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&&(!Gn||/^\w+:\/\//.test(t.from)||Un(t.from)?this.file=t.from:this.file=Bn(t.from)),Gn&&Vn){let e=new Wn(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 "+$n(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,s,r={}){let n,i,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);i=e.line,o=e.col}else i=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,i,o);return n=a?new jn(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 jn(e,void 0===i?t:{column:s,line:t},void 0===i?s:{column:o,line:i},this.css,this.file,r.plugin),n.input={column:s,endColumn:o,endLine:i,line:t,source:this.css},this.file&&(Dn&&(n.input.url=Dn(this.file).toString()),n.input.file=this.file),n}fromOffset(e){let t,s;if(this[Kn])s=this[Kn];else{let e=this.css.split("\n");s=new Array(e.length);let t=0;for(let r=0,n=e.length;r<n;r++)s[r]=t,t+=e[r].length+1;this[Kn]=s}t=s[s.length-1];let r=0;if(e>=t)r=s.length-1;else{let t,n=s.length-2;for(;r<n;)if(t=r+(n-r>>1),e<s[t])n=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:Bn(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,s,r){if(!this.map)return!1;let n,i,o=this.map.consumer(),a=o.originalPositionFor({column:t,line:e});if(!a.source)return!1;"number"==typeof s&&(n=o.originalPositionFor({column:r,line:s})),i=Un(a.source)?Dn(a.source):new URL(a.source,this.map.consumer().sourceRoot||Dn(this.map.mapFile));let l={column:a.column,endColumn:n&&n.column,endLine:n&&n.line,line:a.line,url:i.toString()};if("file:"===i.protocol){if(!Ln)throw new Error("file: protocol is not available in this PostCSS build");l.file=Ln(i)}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 Yn=Hn;Hn.default=Hn,zn&&zn.registerInput&&zn.registerInput(Hn);let{SourceMapConsumer:qn,SourceMapGenerator:Zn}=tn,{dirname:Jn,relative:Qn,resolve:Xn,sep:ei}=tn,{pathToFileURL:ti}=tn,si=Yn,ri=Boolean(qn&&Zn),ni=Boolean(Jn&&Xn&&Qn&&ei);var ii=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||Jn(e.file);!1===this.mapOpts.sourcesContent?(t=new qn(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(),ni&&ri&&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=Zn.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new Zn({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 Zn({file:this.outputFile(),ignoreInvalidMapping:!0});let e,t,s=1,r=1,n="<no source>",i={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&&(i.generated.line=s,i.generated.column=r-1,a.source&&a.source.start?(i.source=this.sourcePath(a),i.original.line=a.source.start.line,i.original.column=a.source.start.column-1,this.map.addMapping(i)):(i.source=n,i.original.line=1,i.original.column=0,this.map.addMapping(i))),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?(i.source=this.sourcePath(a),i.original.line=a.source.end.line,i.original.column=a.source.end.column-1,i.generated.line=s,i.generated.column=r-2,this.map.addMapping(i)):(i.source=n,i.original.line=1,i.original.column=0,i.generated.line=s,i.generated.column=r-1,this.map.addMapping(i)))}})}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?Jn(this.opts.to):".";"string"==typeof this.mapOpts.annotation&&(s=Jn(Xn(s,this.mapOpts.annotation)));let r=Qn(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 si(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(ti){let t=ti(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;"\\"===ei&&(e=e.replace(/\\/g,"/"));let s=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,s),s}};let oi=bn,ai=class extends oi{constructor(e){super(e),this.type="comment"}};var li=ai;ai.default=ai;let ci,hi,ui,di,{isClean:pi,my:mi}=an,fi=kn,gi=li,yi=bn;function wi(e){return e.map(e=>(e.nodes&&(e.nodes=wi(e.nodes)),delete e.source,e))}function vi(e){if(e[pi]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)vi(t)}let Si=class e extends yi{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),n=this.normalize(t,this.proxyOf.nodes[r]).reverse();r=this.index(e);for(let e of n)this.proxyOf.nodes.splice(r+1,0,e);for(let e in this.indexes)s=this.indexes[e],r<s&&(this.indexes[e]=s+n.length);return this.markDirty(),this}insertBefore(e,t){let s,r=this.index(e),n=0===r&&"prepend",i=this.normalize(t,this.proxyOf.nodes[r],n).reverse();r=this.index(e);for(let e of i)this.proxyOf.nodes.splice(r,0,e);for(let e in this.indexes)s=this.indexes[e],r<=s&&(this.indexes[e]=s+i.length);return this.markDirty(),this}normalize(t,s){if("string"==typeof t)t=wi(ci(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 fi(t)]}else if(t.selector)t=[new hi(t)];else if(t.name)t=[new ui(t)];else{if(!t.text)throw new Error("Unknown node type in node creation");t=[new gi(t)]}return t.map(t=>(t[mi]||e.rebuild(t),(t=t.proxyOf).parent&&t.parent.removeChild(t),t[pi]&&vi(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]}};Si.registerParse=e=>{ci=e},Si.registerRule=e=>{hi=e},Si.registerAtRule=e=>{ui=e},Si.registerRoot=e=>{di=e};var bi=Si;Si.default=Si,Si.rebuild=e=>{"atrule"===e.type?Object.setPrototypeOf(e,ui.prototype):"rule"===e.type?Object.setPrototypeOf(e,hi.prototype):"decl"===e.type?Object.setPrototypeOf(e,fi.prototype):"comment"===e.type?Object.setPrototypeOf(e,gi.prototype):"root"===e.type&&Object.setPrototypeOf(e,di.prototype),e[mi]=!0,e.nodes&&e.nodes.forEach(e=>{Si.rebuild(e)})};let Ci,Ii,ki=bi,Ei=class extends ki{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(e={}){return new Ci(new Ii,this,e).stringify()}};Ei.registerLazyResult=e=>{Ci=e},Ei.registerProcessor=e=>{Ii=e};var xi=Ei;Ei.default=Ei;let Oi={};var Ti=function(e){Oi[e]||(Oi[e]=!0,"undefined"!=typeof console&&console.warn&&console.warn(e))};let Ri=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 Mi=Ri;Ri.default=Ri;let _i=Mi,Ai=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 _i(e,t);return this.messages.push(s),s}warnings(){return this.messages.filter(e=>"warning"===e.type)}get content(){return this.css}};var Pi=Ai;Ai.default=Ai;const Ni="'".charCodeAt(0),Fi='"'.charCodeAt(0),Li="\\".charCodeAt(0),Di="/".charCodeAt(0),Ui="\n".charCodeAt(0),Bi=" ".charCodeAt(0),$i="\f".charCodeAt(0),zi="\t".charCodeAt(0),ji="\r".charCodeAt(0),Wi="[".charCodeAt(0),Ki="]".charCodeAt(0),Vi="(".charCodeAt(0),Gi=")".charCodeAt(0),Hi="{".charCodeAt(0),Yi="}".charCodeAt(0),qi=";".charCodeAt(0),Zi="*".charCodeAt(0),Ji=":".charCodeAt(0),Qi="@".charCodeAt(0),Xi=/[\t\n\f\r "#'()/;[\\\]{}]/g,eo=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,to=/.[\r\n"'(/\\]/,so=/[\da-f]/i;let ro=bi,no=class extends ro{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 io=no;no.default=no,ro.registerAtRule(no);let oo,ao,lo=bi,co=class extends lo{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 oo(new ao,this,e).stringify()}};co.registerLazyResult=e=>{oo=e},co.registerProcessor=e=>{ao=e};var ho=co;co.default=co,lo.registerRoot(co);let uo={comma:e=>uo.split(e,[","],!0),space:e=>uo.split(e,[" ","\n","\t"]),split(e,t,s){let r=[],n="",i=!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)&&(i=!0),i?(""!==n&&r.push(n.trim()),n="",i=!1):n+=s;return(s||""!==n)&&r.push(n.trim()),r}};var po=uo;uo.default=uo;let mo=bi,fo=po,go=class extends mo{constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return fo.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 yo=go;go.default=go,mo.registerRule(go);let wo=kn,vo=function(e,t={}){let s,r,n,i,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 Ui:case Bi:case zi:case ji:case $i:r=f;do{r+=1,s=d.charCodeAt(r)}while(s===Bi||s===Ui||s===zi||s===ji||s===$i);u=["space",d.slice(f,r)],f=r-1;break;case Wi:case Ki:case Hi:case Yi:case Ji:case qi:case Gi:{let e=String.fromCharCode(s);u=[e,e,f];break}case Vi:if(c=g.length?g.pop()[1]:"",h=d.charCodeAt(f+1),"url"===c&&h!==Ni&&h!==Fi&&h!==Bi&&h!==Ui&&h!==zi&&h!==$i&&h!==ji){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)===Li;)l-=1,a=!a}while(a);u=["brackets",d.slice(f,r+1),f,r],f=r}else r=d.indexOf(")",f+1),i=d.slice(f,r+1),-1===r||to.test(i)?u=["(","(",f]:(u=["brackets",i,f,r],f=r);break;case Ni:case Fi:n=s===Ni?"'":'"',r=f;do{if(a=!1,r=d.indexOf(n,r+1),-1===r){if(p||t){r=f+1;break}w("string")}for(l=r;d.charCodeAt(l-1)===Li;)l-=1,a=!a}while(a);u=["string",d.slice(f,r+1),f,r],f=r;break;case Qi:Xi.lastIndex=f+1,Xi.test(d),r=0===Xi.lastIndex?d.length-1:Xi.lastIndex-2,u=["at-word",d.slice(f,r+1),f,r],f=r;break;case Li:for(r=f,o=!0;d.charCodeAt(r+1)===Li;)r+=1,o=!o;if(s=d.charCodeAt(r+1),o&&s!==Di&&s!==Bi&&s!==Ui&&s!==zi&&s!==ji&&s!==$i&&(r+=1,so.test(d.charAt(r)))){for(;so.test(d.charAt(r+1));)r+=1;d.charCodeAt(r+1)===Bi&&(r+=1)}u=["word",d.slice(f,r+1),f,r],f=r;break;default:s===Di&&d.charCodeAt(f+1)===Zi?(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):(eo.lastIndex=f+1,eo.test(d),r=0===eo.lastIndex?d.length-1:eo.lastIndex-2,u=["word",d.slice(f,r+1),f,r],g.push(u),f=r)}return f++,u},position:function(){return f}}},So=li,bo=io,Co=ho,Io=yo;const ko={empty:!0,space:!0};let Eo=bi,xo=class{constructor(e){this.input=e,this.root=new Co,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,n=new bo;n.name=e[1].slice(1),""===n.name&&this.unnamedAtrule(n,e),this.init(n,e[2]);let i=!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){n.source.end=this.getPosition(e[2]),n.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&&(n.source.end=this.getPosition(s[3]||s[2]),n.source.end.offset++)}this.end(e);break}a.push(e)}else a.push(e);if(this.tokenizer.endOfFile()){i=!0;break}}n.raws.between=this.spacesAndCommentsFromEnd(a),a.length?(n.raws.afterName=this.spacesAndCommentsFromStart(a),this.raw(n,"params",a),i&&(e=a[a.length-1],n.source.end=this.getPosition(e[3]||e[2]),n.source.end.offset++,this.spaces=n.raws.between,n.raws.between="")):(n.raws.afterName="",n.params=""),o&&(n.nodes=[],this.current=n)}checkMissedSemicolon(e){let t=this.colon(e);if(!1===t)return;let s,r=0;for(let n=t-1;n>=0&&(s=e[n],"space"===s[0]||(r+=1,2!==r));n--);throw this.input.error("Missed semicolon","word"===s[0]?s[3]+1:s[2])}colon(e){let t,s,r,n=0;for(let[i,o]of e.entries()){if(t=o,s=t[0],"("===s&&(n+=1),")"===s&&(n-=1),0===n&&":"===s){if(r){if("word"===r[0]&&"progid"===r[1])continue;return i}this.doubleColon(t)}r=t}return!1}comment(e){let t=new So;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=vo(this.input)}decl(e,t){let s=new wo;this.init(s,e[0][2]);let r,n=e[e.length-1];for(";"===n[0]&&(this.semicolon=!0,e.pop()),s.source.end=this.getPosition(n[3]||n[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 i,o=[];for(;e.length&&(i=e[0][0],"space"===i||"comment"===i);)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),n="";for(let e=t;e>0;e--){let t=r[e][0];if(0===n.trim().indexOf("!")&&"space"!==t)break;n=r.pop()[1]+n}0===n.trim().indexOf("!")&&(s.important=!0,s.raws.important=n,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 Io;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,n=null,i=[],o=e[1].startsWith("--"),a=[],l=e;for(;l;){if(s=l[0],a.push(l),"("===s||"["===s)n||(n=l),i.push("("===s?")":"]");else if(o&&r&&"{"===s)n||(n=l),i.push("}");else if(0===i.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===i[i.length-1]&&(i.pop(),0===i.length&&(n=null));l=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),i.length>0&&this.unclosedBracket(n),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 n,i,o,a,l=s.length,c="",h=!0;for(let e=0;e<l;e+=1)n=s[e],i=n[0],"space"!==i||e!==l-1||r?"comment"===i?(a=s[e-1]?s[e-1][0]:"empty",o=s[e+1]?s[e+1][0]:"empty",ko[a]||ko[o]||","===c.slice(-1)?h=!1:c+=n[1]):c+=n[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 Io;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})}},Oo=Yn;function To(e,t){let s=new Oo(e,t),r=new xo(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 Ro=To;To.default=To,Eo.registerParse(To);let{isClean:Mo,my:_o}=an,Ao=ii,Po=pn,No=bi,Fo=xi,Lo=Ti,Do=Pi,Uo=Ro,Bo=ho;const $o={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},zo={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},jo={Once:!0,postcssPlugin:!0,prepare:!0};function Wo(e){return"object"==typeof e&&"function"==typeof e.then}function Ko(e){let t=!1,s=$o[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 Vo(e){let t;return t="document"===e.type?["Document",0,"DocumentExit"]:"root"===e.type?["Root",0,"RootExit"]:Ko(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function Go(e){return e[Mo]=!1,e.nodes&&e.nodes.forEach(e=>Go(e)),e}let Ho={},Yo=class e{constructor(t,s,r){let n;if(this.stringified=!1,this.processed=!1,"object"!=typeof s||null===s||"root"!==s.type&&"document"!==s.type)if(s instanceof e||s instanceof Do)n=Go(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=Uo;r.syntax&&(e=r.syntax.parse),r.parser&&(e=r.parser),e.parse&&(e=e.parse);try{n=e(s,r)}catch(e){this.processed=!0,this.error=e}n&&!n[_o]&&No.rebuild(n)}else n=Go(s);this.result=new Do(t,n,r),this.helpers={...Ho,postcss:Ho,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,n=t.split("."),i=r.split(".");(n[0]!==i[0]||parseInt(n[1])>parseInt(i[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(!zo[s]&&/^[A-Z]/.test(s))throw new Error(`Unknown event ${s} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!jo[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(Wo(s))try{await s}catch(e){throw this.handleError(e)}}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[Mo];){e[Mo]=!0;let t=[Vo(e)];for(;t.length>0;){let e=this.visitTick(t);if(Wo(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 Wo(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=Po;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let s=new Ao(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(Wo(this.runOnRoot(e)))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[Mo];)e[Mo]=!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||Lo("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(Wo(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,n]=r[t.visitorIndex];t.visitorIndex+=1,t.visitorIndex===r.length&&(t.visitors=[],t.visitorIndex=0),this.result.lastPlugin=e;try{return n(s.toProxy(),this.helpers)}catch(e){throw this.handleError(e,s)}}if(0!==t.iterator){let r,n=t.iterator;for(;r=s.nodes[s.indexes[n]];)if(s.indexes[n]+=1,!r[Mo])return r[Mo]=!0,void e.push(Vo(r));t.iterator=0,delete s.indexes[n]}let n=t.events;for(;t.eventIndex<n.length;){let e=n[t.eventIndex];if(t.eventIndex+=1,0===e)return void(s.nodes&&s.nodes.length&&(s[Mo]=!0,t.iterator=s.getIterator()));if(this.listeners[e])return void(t.visitors=this.listeners[e])}e.pop()}walkSync(e){e[Mo]=!0;let t=Ko(e);for(let s of t)if(0===s)e.nodes&&e.each(e=>{e[Mo]||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"}};Yo.registerPostcss=e=>{Ho=e};var qo=Yo;Yo.default=Yo,Bo.registerLazyResult(Yo),Fo.registerLazyResult(Yo);let Zo=ii,Jo=pn,Qo=Ti,Xo=Ro;const ea=Pi;let ta=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 n=Jo;this.result=new ea(this._processor,r,this._opts),this.result.css=t;let i=this;Object.defineProperty(this.result,"root",{get:()=>i.root});let o=new Zo(n,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||Qo("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=Xo;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 sa=ta;ta.default=ta;let ra=sa,na=qo,ia=xi,oa=ho,aa=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 na(this,e,t):new ra(this,e,t)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}};var la=aa;aa.default=aa,oa.registerProcessor(aa),ia.registerProcessor(aa);let ca=kn,ha=Pn,ua=li,da=io,pa=Yn,ma=ho,fa=yo;function ga(e,t){if(Array.isArray(e))return e.map(e=>ga(e));let{inputs:s,...r}=e;if(s){t=[];for(let e of s){let s={...e,__proto__:pa.prototype};s.map&&(s.map={...s.map,__proto__:ha.prototype}),t.push(s)}}if(r.nodes&&(r.nodes=e.nodes.map(e=>ga(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 ma(r);if("decl"===r.type)return new ca(r);if("rule"===r.type)return new fa(r);if("comment"===r.type)return new ua(r);if("atrule"===r.type)return new da(r);throw new Error("Unknown node type: "+e.type)}var ya=ga;ga.default=ga;let wa=on,va=kn,Sa=qo,ba=bi,Ca=la,Ia=pn,ka=ya,Ea=xi,xa=Mi,Oa=li,Ta=io,Ra=Pi,Ma=Yn,_a=Ro,Aa=po,Pa=yo,Na=ho,Fa=bn;function La(...e){return 1===e.length&&Array.isArray(e[0])&&(e=e[0]),new Ca(e)}La.plugin=function(e,t){let s,r=!1;function n(...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 n=t(...s);return n.postcssPlugin=e,n.postcssVersion=(new Ca).version,n}return Object.defineProperty(n,"postcss",{get:()=>(s||(s=n()),s)}),n.process=function(e,t,s){return La([n(s)]).process(e,t)},n},La.stringify=Ia,La.parse=_a,La.fromJSON=ka,La.list=Aa,La.comment=e=>new Oa(e),La.atRule=e=>new Ta(e),La.decl=e=>new va(e),La.rule=e=>new Pa(e),La.root=e=>new Na(e),La.document=e=>new Ea(e),La.CssSyntaxError=wa,La.Declaration=va,La.Container=ba,La.Processor=Ca,La.Document=Ea,La.Comment=Oa,La.Warning=xa,La.AtRule=Ta,La.Result=Ra,La.Input=Ma,La.Rule=Pa,La.Root=Na,La.Node=Fa,Sa.registerPostcss(La);var Da=La;La.default=La;const Ua=qr(Da);Ua.stringify,Ua.fromJSON,Ua.plugin,Ua.parse,Ua.list,Ua.document,Ua.comment,Ua.atRule,Ua.rule,Ua.decl,Ua.root,Ua.CssSyntaxError,Ua.Declaration,Ua.Container,Ua.Processor,Ua.Document,Ua.Comment,Ua.Warning,Ua.AtRule,Ua.Result,Ua.Input,Ua.Rule,Ua.Root,Ua.Node;class Ba{constructor(...e){Yr(this,"parentElement",null),Yr(this,"parentNode",null),Yr(this,"ownerDocument"),Yr(this,"firstChild",null),Yr(this,"lastChild",null),Yr(this,"previousSibling",null),Yr(this,"nextSibling",null),Yr(this,"ELEMENT_NODE",1),Yr(this,"TEXT_NODE",3),Yr(this,"nodeType"),Yr(this,"nodeName"),Yr(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 Ba))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 $a={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},za={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},ja={};function Wa(e){if(ja[e])return ja[e];const t=globalThis[e],s=t.prototype,r=e in $a?$a[e]:void 0,n=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]"))})),i=e in za?za[e]:void 0,o=Boolean(i&&i.every(e=>{var t;return"function"==typeof s[e]&&(null==(t=s[e])?void 0:t.toString().includes("[native code]"))}));if(n&&o)return ja[e]=t.prototype,t.prototype;try{const r=document.createElement("iframe");document.body.appendChild(r);const n=r.contentWindow;if(!n)return t.prototype;const i=n[e].prototype;return document.body.removeChild(r),i?ja[e]=i:s}catch{return s}}const Ka={};function Va(e,t,s){var r;const n=`${e}.${String(s)}`;if(Ka[n])return Ka[n].call(t);const i=Wa(e),o=null==(r=Object.getOwnPropertyDescriptor(i,s))?void 0:r.get;return o?(Ka[n]=o,o.call(t)):t[s]}const Ga={};function Ha(e,t,s){const r=`${e}.${String(s)}`;if(Ga[r])return Ga[r].bind(t);const n=Wa(e)[s];return"function"!=typeof n?t[s]:(Ga[r]=n,n.bind(t))}function Ya(){return Wa("MutationObserver").constructor}const qa={childNodes:function(e){return Va("Node",e,"childNodes")},parentNode:function(e){return Va("Node",e,"parentNode")},parentElement:function(e){return Va("Node",e,"parentElement")},textContent:function(e){return Va("Node",e,"textContent")},contains:function(e,t){return Ha("Node",e,"contains")(t)},getRootNode:function(e){return Ha("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?Va("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?Va("Element",e,"shadowRoot"):null},querySelector:function(e,t){return Va("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return Va("Element",e,"querySelectorAll")(t)},mutationObserver:Ya};function Za(e,t,s=document){const r={capture:!0,passive:!0};return s.addEventListener(e,t,r),()=>s.removeEventListener(e,t,r)}const Ja="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 Qa={map:{},getId:()=>(console.error(Ja),-1),getNode:()=>(console.error(Ja),null),removeNodeFromMap(){console.error(Ja)},has:()=>(console.error(Ja),!1),reset(){console.error(Ja)}};function Xa(e,t,s={}){let r=null,n=0;return function(...i){const o=Date.now();n||!1!==s.leading||(n=o);const a=t-(o-n),l=this;a<=0||a>t?(r&&(clearTimeout(r),r=null),n=o,e.apply(l,i)):r||!1===s.trailing||(r=setTimeout(()=>{n=!1===s.leading?0:Date.now(),r=null,e.apply(l,i)},a))}}function el(e,t,s,r,n=window){const i=n.Object.getOwnPropertyDescriptor(e,t);return n.Object.defineProperty(e,t,r?s:{set(e){setTimeout(()=>{s.set.call(this,e)},0),i&&i.set&&i.set.call(this,e)}}),()=>el(e,t,i||{},!0)}function tl(e,t,s){try{if(!(t in e))return()=>{};const r=e[t],n=s(r);return"function"==typeof n&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=n,()=>{e[t]=r}}catch{return()=>{}}}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(Qa=new Proxy(Qa,{get:(e,t,s)=>("map"===t&&console.error(Ja),Reflect.get(e,t,s))}));let sl=Date.now;function rl(e){var t,s,r,n;const i=e.document;return{left:i.scrollingElement?i.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:i.documentElement.scrollLeft||(null==i?void 0:i.body)&&(null==(t=qa.parentElement(i.body))?void 0:t.scrollLeft)||(null==(s=null==i?void 0:i.body)?void 0:s.scrollLeft)||0,top:i.scrollingElement?i.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==i?void 0:i.documentElement.scrollTop)||(null==i?void 0:i.body)&&(null==(r=qa.parentElement(i.body))?void 0:r.scrollTop)||(null==(n=null==i?void 0:i.body)?void 0:n.scrollTop)||0}}function nl(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function il(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function ol(e){if(!e)return null;return e.nodeType===e.ELEMENT_NODE?e:qa.parentElement(e)}function al(e,t,s,r){if(!e)return!1;const n=ol(e);if(!n)return!1;try{if("string"==typeof t){if(n.classList.contains(t))return!0;if(r&&null!==n.closest("."+t))return!0}else if(ee(n,t,r))return!0}catch(e){}if(s){if(n.matches(s))return!0;if(r&&null!==n.closest(s))return!0}return!1}function ll(e,t,s){return!("TITLE"!==e.tagName||!s.headTitleMutations)||-2===t.getId(e)}function cl(e,t){if(x(e))return!1;const s=t.getId(e);if(!t.has(s))return!0;const r=qa.parentNode(e);return(!r||r.nodeType!==e.DOCUMENT_NODE)&&(!r||cl(r,t))}function hl(e){return Boolean(e.changedTouches)}function ul(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function dl(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function pl(e){return!!e&&(e instanceof Ba&&"shadowRoot"in e?Boolean(e.shadowRoot):Boolean(qa.shadowRoot(e)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(sl=()=>(new Date).getTime());class ml{constructor(){d(this,"id",1),d(this,"styleIDMap",new WeakMap),d(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 fl(e){var t;let s=null;return"getRootNode"in e&&(null==(t=qa.getRootNode(e))?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&qa.host(qa.getRootNode(e))&&(s=qa.host(qa.getRootNode(e))),s}function gl(e){const t=e.ownerDocument;if(!t)return!1;const s=function(e){let t,s=e;for(;t=fl(s);)s=t;return s}(e);return qa.contains(t,s)}function yl(e){const t=e.ownerDocument;return!!t&&(qa.contains(t,e)||gl(e))}var wl=(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))(wl||{}),vl=(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))(vl||{}),Sl=(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))(Sl||{}),bl=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(bl||{}),Cl=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(Cl||{}),Il=(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))(Il||{});function kl(e){return"__ln"in e}class El{constructor(){d(this,"length",0),d(this,"head",null),d(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&&kl(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&&kl(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 xl=(e,t)=>`${e}@${t}`;class Ol{constructor(){d(this,"frozen",!1),d(this,"locked",!1),d(this,"texts",[]),d(this,"attributes",[]),d(this,"attributeMap",new WeakMap),d(this,"removes",[]),d(this,"mapRemoves",[]),d(this,"movedMap",{}),d(this,"addedSet",new Set),d(this,"movedSet",new Set),d(this,"droppedSet",new Set),d(this,"mutationCb"),d(this,"blockClass"),d(this,"blockSelector"),d(this,"maskTextClass"),d(this,"maskTextSelector"),d(this,"inlineStylesheet"),d(this,"maskInputOptions"),d(this,"maskTextFn"),d(this,"maskInputFn"),d(this,"keepIframeSrcFn"),d(this,"recordCanvas"),d(this,"inlineImages"),d(this,"slimDOMOptions"),d(this,"dataURLOptions"),d(this,"doc"),d(this,"mirror"),d(this,"iframeManager"),d(this,"stylesheetManager"),d(this,"shadowDomManager"),d(this,"canvasManager"),d(this,"processedNodeManager"),d(this,"unattachedDoc"),d(this,"processMutations",e=>{e.forEach(this.processMutation),this.emit()}),d(this,"emit",()=>{if(this.frozen||this.locked)return;const e=[],t=new Set,s=new El,r=e=>{let t=e,s=-2;for(;-2===s;)t=t&&t.nextSibling,s=t&&this.mirror.getId(t);return s},n=n=>{const i=qa.parentNode(n);if(!i||!yl(n)||"TEXTAREA"===i.tagName)return;const o=x(i)?this.mirror.getId(fl(n)):this.mirror.getId(i),a=r(n);if(-1===o||-1===a)return s.addNode(n);const l=ne(n,{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=>{ul(e,this.mirror)&&this.iframeManager.addIframe(e),dl(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),pl(n)&&this.shadowDomManager.addShadowRoot(qa.shadowRoot(n),this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)}});l&&(e.push({parentId:o,nextId:a,node:l}),t.add(l.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const e of this.movedSet)Rl(this.removes,e,this.mirror)&&!this.movedSet.has(qa.parentNode(e))||n(e);for(const e of this.addedSet)Ml(this.droppedSet,e)||Rl(this.removes,e,this.mirror)?Ml(this.movedSet,e)?n(e):this.droppedSet.add(e):n(e);let i=null;for(;s.length;){let e=null;if(i){const t=this.mirror.getId(qa.parentNode(i.value)),s=r(i.value);-1!==t&&-1!==s&&(e=i)}if(!e){let t=s.tail;for(;t;){const s=t;if(t=t.previous,s){const t=this.mirror.getId(qa.parentNode(s.value));if(-1===r(s.value))continue;if(-1!==t){e=s;break}{const t=s.value,r=qa.parentNode(t);if(r&&r.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const t=qa.host(r);if(-1!==this.mirror.getId(t)){e=s;break}}}}}}if(!e){for(;s.head;)s.removeNode(s.head.value);break}i=e.previous,s.removeNode(e.value),n(e.value)}const o={texts:this.texts.map(e=>{const t=e.node,s=qa.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.movedMap={},this.mutationCb(o))}),d(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)),t.attributes.value=Array.from(qa.childNodes(e),e=>qa.textContent(e)||"").join("")}),d(this,"processMutation",e=>{if(!ll(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":{const t=qa.textContent(e.target);al(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:te(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,ol(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=N(t);r=_({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:e,value:r,maskInputFn:this.maskInputFn})}if(al(e.target,this.blockClass,this.blockSelector,!1)||r===e.oldValue)return;let n=this.attributeMap.get(e.target);if("IFRAME"===t.tagName&&"src"===s&&!this.keepIframeSrcFn(r)){if(t.contentDocument)return;s="rr_src"}if(n||(n={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(n),this.attributeMap.set(e.target,n)),"type"===s&&"INPUT"===t.tagName&&"password"===(e.oldValue||"").toLowerCase()&&t.setAttribute("data-rr-is-password","true"),!X(t.tagName,s))if(n.attributes[s]=Q(this.doc,A(t.tagName),A(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),i=t.style.getPropertyPriority(e);r!==s.style.getPropertyValue(e)||i!==s.style.getPropertyPriority(e)?n.styleDiff[e]=""===i?r:[r,i]:n._unchangedStyles[e]=[r,i]}for(const e of Array.from(s.style))""===t.style.getPropertyValue(e)&&(n.styleDiff[e]=!1)}else"open"===s&&"DIALOG"===t.tagName&&(t.matches("dialog:modal")?n.attributes.rr_open_mode="modal":n.attributes.rr_open_mode="non-modal");break}case"childList":if(al(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=x(e.target)?this.mirror.getId(qa.host(e.target)):this.mirror.getId(e.target);al(e.target,this.blockClass,this.blockSelector,!1)||ll(t,this.mirror,this.slimDOMOptions)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(Tl(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===s||cl(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[xl(s,r)]?Tl(this.movedSet,t):this.removes.push({parentId:r,id:s,isShadow:!(!x(e.target)||!O(e.target))||void 0})),this.mapRemoves.push(t))})}}),d(this,"genAdds",(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!this.addedSet.has(e)&&!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(ll(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[xl(this.mirror.getId(e),s)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);al(e,this.blockClass,this.blockSelector,!1)||(qa.childNodes(e).forEach(e=>this.genAdds(e)),pl(e)&&qa.childNodes(qa.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 Tl(e,t){e.delete(t),qa.childNodes(t).forEach(t=>Tl(e,t))}function Rl(e,t,s){return 0!==e.length&&function(e,t,s){let r=qa.parentNode(t);for(;r;){const t=s.getId(r);if(e.some(e=>e.id===t))return!0;r=qa.parentNode(r)}return!1}(e,t,s)}function Ml(e,t){return 0!==e.size&&_l(e,t)}function _l(e,t){const s=qa.parentNode(t);return!!s&&(!!e.has(s)||_l(e,s))}let Al;const Pl=e=>{if(!Al)return e;return(...t)=>{try{return e(...t)}catch(e){if(Al&&!0===Al(e))return;throw e}}},Nl=[];function Fl(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 Ll(e,t){const s=new Ol;Nl.push(s),s.init(e);const r=new(Ya())(Pl(s.processMutations.bind(s)));return r.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),r}function Dl({mouseInteractionCb:e,doc:t,mirror:s,blockClass:r,blockSelector:n,sampling:i}){if(!1===i.mouseInteraction)return()=>{};const o=!0===i.mouseInteraction||void 0===i.mouseInteraction?{}:i.mouseInteraction,a=[];let l=null;return Object.keys(Sl).filter(e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==o[e]).forEach(i=>{let o=A(i);const c=(t=>i=>{const o=Fl(i);if(al(o,r,n,!0))return;let a=null,c=t;if("pointerType"in i){switch(i.pointerType){case"mouse":a=bl.Mouse;break;case"touch":a=bl.Touch;break;case"pen":a=bl.Pen}a===bl.Touch?Sl[t]===Sl.MouseDown?c="TouchStart":Sl[t]===Sl.MouseUp&&(c="TouchEnd"):bl.Pen}else hl(i)&&(a=bl.Touch);null!==a?(l=a,(c.startsWith("Touch")&&a===bl.Touch||c.startsWith("Mouse")&&a===bl.Mouse)&&(a=null)):Sl[t]===Sl.Click&&(a=l,l=null);const h=hl(i)?i.changedTouches[0]:i;if(!h)return;const u=s.getId(o),{clientX:d,clientY:p}=h;Pl(e)({type:Sl[c],id:u,x:d,y:p,...null!==a&&{pointerType:a}})})(i);if(window.PointerEvent)switch(Sl[i]){case Sl.MouseDown:case Sl.MouseUp:o=o.replace("mouse","pointer");break;case Sl.TouchStart:case Sl.TouchEnd:return}a.push(Za(o,c,t))}),Pl(()=>{a.forEach(e=>e())})}function Ul({scrollCb:e,doc:t,mirror:s,blockClass:r,blockSelector:n,sampling:i}){return Za("scroll",Pl(Xa(Pl(i=>{const o=Fl(i);if(!o||al(o,r,n,!0))return;const a=s.getId(o);if(o===t&&t.defaultView){const s=rl(t.defaultView);e({id:a,x:s.left,y:s.top})}else e({id:a,x:o.scrollLeft,y:o.scrollTop})}),i.scroll||100)),t)}const Bl=["INPUT","TEXTAREA","SELECT"],$l=new WeakMap;function zl(e){return function(e,t){if(Vl("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||Vl("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||Vl("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||Vl("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 jl(e,t,s){let r,n;return e?(e.ownerNode?r=t.getId(e.ownerNode):n=s.getId(e),{styleId:n,id:r}):{}}function Wl({mirror:e,stylesheetManager:t},s){var r,n,i;let o=null;o="#document"===s.nodeName?e.getId(s):e.getId(qa.host(s));const a="#document"===s.nodeName?null==(r=s.defaultView)?void 0:r.Document:null==(i=null==(n=s.ownerDocument)?void 0:n.defaultView)?void 0:i.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}}),Pl(()=>{Object.defineProperty(s,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})})):()=>{}}function Kl(e,t={}){const s=e.doc.defaultView;if(!s)return()=>{};let r;!function(e,t){const{mutationCb:s,mousemoveCb:r,mouseInteractionCb:n,scrollCb:i,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),n(...e)},e.scrollCb=(...e)=>{t.scroll&&t.scroll(...e),i(...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=Ll(e,e.doc));const n=function({mousemoveCb:e,sampling:t,doc:s,mirror:r}){if(!1===t.mousemove)return()=>{};const n="number"==typeof t.mousemove?t.mousemove:50,i="number"==typeof t.mousemoveCallback?t.mousemoveCallback:500;let o,a=[];const l=Xa(Pl(t=>{const s=Date.now()-o;e(a.map(e=>(e.timeOffset-=s,e)),t),a=[],o=null}),i),c=Pl(Xa(Pl(e=>{const t=Fl(e),{clientX:s,clientY:n}=hl(e)?e.changedTouches[0]:e;o||(o=sl()),a.push({x:s,y:n,id:r.getId(t),timeOffset:sl()-o}),l("undefined"!=typeof DragEvent&&e instanceof DragEvent?vl.Drag:e instanceof MouseEvent?vl.MouseMove:vl.TouchMove)}),n,{trailing:!1})),h=[Za("mousemove",c,s),Za("touchmove",c,s),Za("drag",c,s)];return Pl(()=>{h.forEach(e=>e())})}(e),i=Dl(e),o=Ul(e),a=function({viewportResizeCb:e},{win:t}){let s=-1,r=-1;return Za("resize",Pl(Xa(Pl(()=>{const t=nl(),n=il();s===t&&r===n||(e({width:Number(n),height:Number(t)}),s=t,r=n)}),200)),t)}(e,{win:s}),l=function({inputCb:e,doc:t,mirror:s,blockClass:r,blockSelector:n,ignoreClass:i,ignoreSelector:o,maskInputOptions:a,maskInputFn:l,sampling:c,userTriggeredOnInput:h}){function u(e){let s=Fl(e);const c=e.isTrusted,u=s&&s.tagName;if(s&&"OPTION"===u&&(s=qa.parentElement(s)),!s||!u||Bl.indexOf(u)<0||al(s,r,n,!0))return;if(s.classList.contains(i)||o&&s.matches(o))return;let p=s.value,m=!1;const f=N(s)||"";"radio"===f||"checkbox"===f?m=s.checked:(a[u.toLowerCase()]||a[f])&&(p=_({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 n=$l.get(t);if(!n||n.text!==r.text||n.isChecked!==r.isChecked){$l.set(t,r);const n=s.getId(t);Pl(e)({...r,id:n})}}const p=("last"===c.input?["change"]:["input","change"]).map(e=>Za(e,Pl(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=>el(e[0],e[1],{set(){Pl(u)({target:this,isTrusted:!1})}},!1,m))),Pl(()=>{p.forEach(e=>e())})}(e),c=function({mediaInteractionCb:e,blockClass:t,blockSelector:s,mirror:r,sampling:n,doc:i}){const o=Pl(i=>Xa(Pl(n=>{const o=Fl(n);if(!o||al(o,t,s,!0))return;const{currentTime:a,volume:l,muted:c,playbackRate:h,loop:u}=o;e({type:i,id:r.getId(o),currentTime:a,volume:l,muted:c,playbackRate:h,loop:u})}),n.media||500)),a=[Za("play",o(Il.Play),i),Za("pause",o(Il.Pause),i),Za("seeked",o(Il.Seeked),i),Za("volumechange",o(Il.VolumeChange),i),Za("ratechange",o(Il.RateChange),i)];return Pl(()=>{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 n=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(n,{apply:Pl((r,n,i)=>{const[o,a]=i,{id:l,styleId:c}=jl(n,t,s.styleMirror);return(l&&-1!==l||c&&-1!==c)&&e({id:l,styleId:c,adds:[{rule:o,index:a}]}),r.apply(n,i)})}),r.CSSStyleSheet.prototype.addRule=function(e,t,s=this.cssRules.length){const n=`${e} { ${t} }`;return r.CSSStyleSheet.prototype.insertRule.apply(this,[n,s])};const i=r.CSSStyleSheet.prototype.deleteRule;let o,a;r.CSSStyleSheet.prototype.deleteRule=new Proxy(i,{apply:Pl((r,n,i)=>{const[o]=i,{id:a,styleId:l}=jl(n,t,s.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,removes:[{index:o}]}),r.apply(n,i)})}),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:Pl((r,n,i)=>{const[o]=i,{id:a,styleId:l}=jl(n,t,s.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,replace:o}),r.apply(n,i)})})),r.CSSStyleSheet.prototype.replaceSync&&(a=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:Pl((r,n,i)=>{const[o]=i,{id:a,styleId:l}=jl(n,t,s.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,replaceSync:o}),r.apply(n,i)})}));const l={};Gl("CSSGroupingRule")?l.CSSGroupingRule=r.CSSGroupingRule:(Gl("CSSMediaRule")&&(l.CSSMediaRule=r.CSSMediaRule),Gl("CSSConditionRule")&&(l.CSSConditionRule=r.CSSConditionRule),Gl("CSSSupportsRule")&&(l.CSSSupportsRule=r.CSSSupportsRule));const c={};return Object.entries(l).forEach(([r,n])=>{c[r]={insertRule:n.prototype.insertRule,deleteRule:n.prototype.deleteRule},n.prototype.insertRule=new Proxy(c[r].insertRule,{apply:Pl((r,n,i)=>{const[o,a]=i,{id:l,styleId:c}=jl(n.parentStyleSheet,t,s.styleMirror);return(l&&-1!==l||c&&-1!==c)&&e({id:l,styleId:c,adds:[{rule:o,index:[...zl(n),a||0]}]}),r.apply(n,i)})}),n.prototype.deleteRule=new Proxy(c[r].deleteRule,{apply:Pl((r,n,i)=>{const[o]=i,{id:a,styleId:l}=jl(n.parentStyleSheet,t,s.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,removes:[{index:[...zl(n),o]}]}),r.apply(n,i)})})}),Pl(()=>{r.CSSStyleSheet.prototype.insertRule=n,r.CSSStyleSheet.prototype.deleteRule=i,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=Wl(e,e.doc),d=function({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:s,stylesheetManager:r},{win:n}){const i=n.CSSStyleDeclaration.prototype.setProperty;n.CSSStyleDeclaration.prototype.setProperty=new Proxy(i,{apply:Pl((n,o,a)=>{var l;const[c,h,u]=a;if(s.has(c))return i.apply(o,[c,h,u]);const{id:d,styleId:p}=jl(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:zl(o.parentRule)}),n.apply(o,a)})});const o=n.CSSStyleDeclaration.prototype.removeProperty;return n.CSSStyleDeclaration.prototype.removeProperty=new Proxy(o,{apply:Pl((n,i,a)=>{var l;const[c]=a;if(s.has(c))return o.apply(i,[c]);const{id:h,styleId:u}=jl(null==(l=i.parentRule)?void 0:l.parentStyleSheet,t,r.styleMirror);return(h&&-1!==h||u&&-1!==u)&&e({id:h,styleId:u,remove:{property:c},index:zl(i.parentRule)}),n.apply(i,a)})}),Pl(()=>{n.CSSStyleDeclaration.prototype.setProperty=i,n.CSSStyleDeclaration.prototype.removeProperty=o})}(e,{win:s}),e.collectFonts&&(p=function({fontCb:e,doc:t}){const s=t.defaultView;if(!s)return()=>{};const r=[],n=new WeakMap,i=s.FontFace;s.FontFace=function(e,t,s){const r=new i(e,t,s);return n.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=tl(t.fonts,"add",function(t){return function(s){return setTimeout(Pl(()=>{const t=n.get(s);t&&(e(t),n.delete(s))}),0),t.apply(this,[s])}});return r.push(()=>{s.FontFace=i}),r.push(o),Pl(()=>{r.forEach(e=>e())})}(e)));const m=function(e){const{doc:t,mirror:s,blockClass:r,blockSelector:n,selectionCb:i}=e;let o=!0;const a=Pl(()=>{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 i=e.getRangeAt(t),{startContainer:o,startOffset:l,endContainer:c,endOffset:h}=i;al(o,r,n,!0)||al(c,r,n,!0)||a.push({start:s.getId(o),startOffset:l,end:s.getId(c),endOffset:h})}i({ranges:a})});return a(),Za("selectionchange",a)}(e),f=function({doc:e,customElementCb:t}){const s=e.defaultView;return s&&s.customElements?tl(s.customElements,"define",function(e){return function(s,r,n){try{t({define:{name:s}})}catch(e){console.warn(`Custom element callback failed for ${s}`)}return e.apply(this,[s,r,n])}}):()=>{}}(e),g=[];for(const t of e.plugins)g.push(t.observer(t.callback,s,t.options));return Pl(()=>{Nl.forEach(e=>e.reset()),null==r||r.disconnect(),n(),i(),o(),a(),l(),c(),h(),u(),d(),p(),m(),f(),g.forEach(e=>e())})}function Vl(e){return void 0!==window[e]}function Gl(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class Hl{constructor(e){d(this,"iframeIdToRemoteIdMap",new WeakMap),d(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,s,r){const n=s||this.getIdToRemoteIdMap(e),i=r||this.getRemoteIdToIdMap(e);let o=n.get(t);return o||(o=this.generateIdFn(),n.set(t,o),i.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 n=r.get(t);return n||-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 Yl{constructor(e){d(this,"iframes",new WeakMap),d(this,"crossOriginIframeMap",new WeakMap),d(this,"crossOriginIframeMirror",new Hl(W)),d(this,"crossOriginIframeStyleMirror"),d(this,"crossOriginIframeRootIdMap",new WeakMap),d(this,"mirror"),d(this,"mutationCb"),d(this,"wrappedEmit"),d(this,"loadListener"),d(this,"stylesheetManager"),d(this,"recordCrossOriginIframes"),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Hl(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 wl.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:wl.IncrementalSnapshot,data:{source:vl.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case wl.Meta:case wl.Load:case wl.DomContentLoaded:return!1;case wl.Plugin:return t;case wl.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case wl.IncrementalSnapshot:switch(t.data.source){case vl.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 vl.Drag:case vl.TouchMove:case vl.MouseMove:return t.data.positions.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case vl.ViewportResize:return!1;case vl.MediaInteraction:case vl.MouseInteraction:case vl.Scroll:case vl.CanvasMutation:case vl.Input:return this.replaceIds(t.data,e,["id"]),t;case vl.StyleSheetRule:case vl.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case vl.Font:return t;case vl.Selection:return t.data.ranges.forEach(t=>{this.replaceIds(t,e,["start","end"])}),t;case vl.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 n of r)(Array.isArray(t[n])||"number"==typeof t[n])&&(Array.isArray(t[n])?t[n]=e.getIds(s,t[n]):t[n]=e.getId(s,t[n]));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===f.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(e=>{this.patchRootIdOnNode(e,t)})}}class ql{constructor(e){d(this,"shadowDoms",new WeakSet),d(this,"mutationCb"),d(this,"scrollCb"),d(this,"bypassOptions"),d(this,"mirror"),d(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(!O(e))return;if(this.shadowDoms.has(e))return;this.shadowDoms.add(e);const s=Ll({...this.bypassOptions,doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},e);this.restoreHandlers.push(()=>s.disconnect()),this.restoreHandlers.push(Ul({...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(qa.host(e))),this.restoreHandlers.push(Wl({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(tl(e.prototype,"attachShadow",function(e){return function(r){const n=e.call(this,r),i=qa.shadowRoot(this);return i&&yl(this)&&s.addShadowRoot(i,t),n}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch(e){}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}for(var Zl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Jl="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Ql=0;Ql<64;Ql++)Jl[Zl.charCodeAt(Ql)]=Ql;const Xl=new Map;const ec=(e,t,s)=>{if(!e||!rc(e,t)&&"object"!=typeof e)return;const r=function(e,t){let s=Xl.get(e);return s||(s=new Map,Xl.set(e,s)),s.has(t)||s.set(t,[]),s.get(t)}(s,e.constructor.name);let n=r.indexOf(e);return-1===n&&(n=r.length,r.push(e)),n};function tc(e,t,s){if(e instanceof Array)return e.map(e=>tc(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,n="";for(t=0;t<r;t+=3)n+=Zl[s[t]>>2],n+=Zl[(3&s[t])<<4|s[t+1]>>4],n+=Zl[(15&s[t+1])<<2|s[t+2]>>6],n+=Zl[63&s[t+2]];return r%3==2?n=n.substring(0,n.length-1)+"=":r%3==1&&(n=n.substring(0,n.length-2)+"=="),n}(e)}}if(e instanceof DataView){return{rr_type:e.constructor.name,args:[tc(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:[tc(e.data,t,s),e.width,e.height]}}if(rc(e,t)||"object"==typeof e){return{rr_type:e.constructor.name,index:ec(e,t,s)}}return e}const sc=(e,t,s)=>e.map(e=>tc(e,t,s)),rc=(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 nc(e,t,s,r){const n=[];try{const i=tl(e.HTMLCanvasElement.prototype,"getContext",function(e){return function(n,...i){if(!al(this,t,s,!0)){const e=function(e){return"experimental-webgl"===e?"webgl":e}(n);if("__context"in this||(this.__context=e),r&&["webgl","webgl2"].includes(e))if(i[0]&&"object"==typeof i[0]){const e=i[0];e.preserveDrawingBuffer||(e.preserveDrawingBuffer=!0)}else i.splice(0,1,{preserveDrawingBuffer:!0})}return e.apply(this,[n,...i])}});n.push(i)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{n.forEach(e=>e())}}function ic(e,t,s,r,n,i){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=tl(e,l,function(e){return function(...o){const a=e.apply(this,o);if(ec(a,i,this),"tagName"in this.canvas&&!al(this.canvas,r,n,!0)){const e=sc(o,i,this),r={type:t,property:l,args:e};s(this.canvas,r)}return a}});o.push(a)}catch{const r=el(e,l,{set(e){s(this.canvas,{type:t,property:l,args:[e],setter:!0})}});o.push(r)}return o}const oc="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",ac="undefined"!=typeof window&&window.Blob&&new Blob([(lc=oc,Uint8Array.from(atob(lc),e=>e.charCodeAt(0)))],{type:"text/javascript;charset=utf-8"});var lc;function cc(e){let t;try{if(t=ac&&(window.URL||window.webkitURL).createObjectURL(ac),!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,"+oc,{name:null==e?void 0:e.name})}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}class hc{constructor(e){d(this,"pendingCanvasMutations",new Map),d(this,"rafStamps",{latestId:0,invokeId:null}),d(this,"mirror"),d(this,"mutationCb"),d(this,"resetObservers"),d(this,"frozen",!1),d(this,"locked",!1),d(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:r,blockSelector:n,recordCanvas:i,dataURLOptions:o}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,i&&"all"===t&&this.initCanvasMutationObserver(s,r,n),i&&"number"==typeof t&&this.initCanvasFPSObserver(t,s,r,n,{dataURLOptions:o})}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,n){const i=nc(t,s,r,!0),o=new Map,a=new cc;a.onmessage=e=>{const{id:t}=e.data;if(o.set(t,!1),!("base64"in e.data))return;const{base64:s,type:r,width:n,height:i}=e.data;this.mutationCb({id:t,type:Cl["2D"],commands:[{property:"clearRect",args:[0,0,n,i]},{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=>{al(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:n.dataURLOptions},[r])})),c=requestAnimationFrame(u)};c=requestAnimationFrame(u),this.resetObservers=()=>{i(),cancelAnimationFrame(c)}}initCanvasMutationObserver(e,t,s){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const r=nc(e,t,s,!1),n=function(e,t,s,r){const n=[],i=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const o of i)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[o])continue;const i=tl(t.CanvasRenderingContext2D.prototype,o,function(n){return function(...i){return al(this.canvas,s,r,!0)||setTimeout(()=>{const s=sc(i,t,this);e(this.canvas,{type:Cl["2D"],property:o,args:s})},0),n.apply(this,i)}});n.push(i)}catch{const s=el(t.CanvasRenderingContext2D.prototype,o,{set(t){e(this.canvas,{type:Cl["2D"],property:o,args:[t],setter:!0})}});n.push(s)}return()=>{n.forEach(e=>e())}}(this.processMutation.bind(this),e,t,s),i=function(e,t,s,r){const n=[];return n.push(...ic(t.WebGLRenderingContext.prototype,Cl.WebGL,e,s,r,t)),void 0!==t.WebGL2RenderingContext&&n.push(...ic(t.WebGL2RenderingContext.prototype,Cl.WebGL2,e,s,r,t)),()=>{n.forEach(e=>e())}}(this.processMutation.bind(this),e,t,s);this.resetObservers=()=>{r(),n(),i()}}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:n}=s[0];this.mutationCb({id:t,type:n,commands:r}),this.pendingCanvasMutations.delete(e)}}class uc{constructor(e){d(this,"trackedLinkElements",new WeakSet),d(this,"mutationCb"),d(this,"adoptedStyleSheetCb"),d(this,"styleMirror",new ml),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:R(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 dc{constructor(){d(this,"nodeMap",new WeakMap),d(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 pc,mc,fc,gc=!1;try{if(2!==Array.from([1],e=>2*e)[0]){const e=document.createElement("iframe");document.body.appendChild(e),Array.from=(null==(h=e.contentWindow)?void 0:h.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}const yc=new M;function wc(e={}){const{emit:t,checkoutEveryNms:s,checkoutEveryNth:r,blockClass:n="rr-block",blockSelector:i=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:b=!0,recordCanvas:C=!1,recordCrossOriginIframes:I=!1,recordAfter:k=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:E=!1,collectFonts:x=!1,inlineImages:O=!1,plugins:T,keepIframeSrcFn:R=()=>!1,ignoreCSSAttributes:_=new Set([]),errorHandler:A}=e;Al=A;const P=!I||window.parent===window;let N=!1;if(!P)try{window.parent.document&&(N=!1)}catch(e){N=!0}if(P&&!t)throw new Error("emit function is required");if(!P&&!N)return()=>{};void 0!==S&&void 0===w.mousemove&&(w.mousemove=S),yc.reset();const F=!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},L=!0===p||"all"===p?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===p,headMetaDescKeywords:"all"===p,headTitleMutations:"all"===p}:p||{};let D;!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||[])t.eventProcessor&&(e=t.eventProcessor(e));return y&&!N&&(e=y(e)),e};pc=(e,n)=>{var i;const o=e;if(o.timestamp=sl(),!(null==(i=Nl[0])?void 0:i.isFrozen())||o.type===wl.FullSnapshot||o.type===wl.IncrementalSnapshot&&o.data.source===vl.Mutation||Nl.forEach(e=>e.unfreeze()),P)null==t||t(B(o),n);else if(N){const e={type:"rrweb",event:B(o),origin:window.location.origin,isCheckout:n};window.parent.postMessage(e,"*")}if(o.type===wl.FullSnapshot)D=o,U=0;else if(o.type===wl.IncrementalSnapshot){if(o.data.source===vl.Mutation&&o.data.isAttachIframe)return;U++;const e=r&&U>=r,t=s&&o.timestamp-D.timestamp>s;(e||t)&&mc(!0)}};const $=e=>{pc({type:wl.IncrementalSnapshot,data:{source:vl.Mutation,...e}})},z=e=>pc({type:wl.IncrementalSnapshot,data:{source:vl.Scroll,...e}}),j=e=>pc({type:wl.IncrementalSnapshot,data:{source:vl.CanvasMutation,...e}}),W=new uc({mutationCb:$,adoptedStyleSheetCb:e=>pc({type:wl.IncrementalSnapshot,data:{source:vl.AdoptedStyleSheet,...e}})}),K=new Yl({mirror:yc,mutationCb:$,stylesheetManager:W,recordCrossOriginIframes:I,wrappedEmit:pc});for(const e of T||[])e.getMirror&&e.getMirror({nodeMirror:yc,crossOriginIframeMirror:K.crossOriginIframeMirror,crossOriginIframeStyleMirror:K.crossOriginIframeStyleMirror});const V=new dc;fc=new hc({recordCanvas:C,mutationCb:j,win:window,blockClass:n,blockSelector:i,mirror:yc,sampling:w.canvas,dataURLOptions:v});const G=new ql({mutationCb:$,scrollCb:z,bypassOptions:{blockClass:n,blockSelector:i,maskTextClass:l,maskTextSelector:c,inlineStylesheet:h,maskInputOptions:F,dataURLOptions:v,maskTextFn:f,maskInputFn:m,recordCanvas:C,inlineImages:O,sampling:w,slimDOMOptions:L,iframeManager:K,stylesheetManager:W,canvasManager:fc,keepIframeSrcFn:R,processedNodeManager:V},mirror:yc});mc=(e=!1)=>{if(!b)return;pc({type:wl.Meta,data:{href:window.location.href,width:il(),height:nl()}},e),W.reset(),G.init(),Nl.forEach(e=>e.lock());const t=function(e,t){const{mirror:s=new M,blockClass:r="rr-block",blockSelector:n=null,maskTextClass:i="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:b=()=>!1}=t||{};return ne(e,{doc:e,mirror:s,blockClass:r,blockSelector:n,maskTextClass:i,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:!0===p||"all"===p?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===p,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===p?{}:p,dataURLOptions:m,inlineImages:l,recordCanvas:c,preserveWhiteSpace:f,onSerialize:g,onIframeLoad:y,iframeLoadTimeout:w,onStylesheetLoad:v,stylesheetLoadTimeout:S,keepIframeSrcFn:b,newlyAddedElement:!1})}(document,{mirror:yc,blockClass:n,blockSelector:i,maskTextClass:l,maskTextSelector:c,inlineStylesheet:h,maskAllInputs:F,maskTextFn:f,maskInputFn:m,slimDOM:L,dataURLOptions:v,recordCanvas:C,inlineImages:O,onSerialize:e=>{ul(e,yc)&&K.addIframe(e),dl(e,yc)&&W.trackLinkElement(e),pl(e)&&G.addShadowRoot(qa.shadowRoot(e),document)},onIframeLoad:(e,t)=>{K.attachIframe(e,t),G.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{W.attachLinkElement(e,t)},keepIframeSrcFn:R});if(!t)return console.warn("Failed to snapshot the document");pc({type:wl.FullSnapshot,data:{node:t,initialOffset:rl(window)}},e),Nl.forEach(e=>e.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&W.adoptStyleSheets(document.adoptedStyleSheets,yc.getId(document))};try{const e=[],t=e=>{var t;return Pl(Kl)({mutationCb:$,mousemoveCb:(e,t)=>pc({type:wl.IncrementalSnapshot,data:{source:t,positions:e}}),mouseInteractionCb:e=>pc({type:wl.IncrementalSnapshot,data:{source:vl.MouseInteraction,...e}}),scrollCb:z,viewportResizeCb:e=>pc({type:wl.IncrementalSnapshot,data:{source:vl.ViewportResize,...e}}),inputCb:e=>pc({type:wl.IncrementalSnapshot,data:{source:vl.Input,...e}}),mediaInteractionCb:e=>pc({type:wl.IncrementalSnapshot,data:{source:vl.MediaInteraction,...e}}),styleSheetRuleCb:e=>pc({type:wl.IncrementalSnapshot,data:{source:vl.StyleSheetRule,...e}}),styleDeclarationCb:e=>pc({type:wl.IncrementalSnapshot,data:{source:vl.StyleDeclaration,...e}}),canvasMutationCb:j,fontCb:e=>pc({type:wl.IncrementalSnapshot,data:{source:vl.Font,...e}}),selectionCb:e=>{pc({type:wl.IncrementalSnapshot,data:{source:vl.Selection,...e}})},customElementCb:e=>{pc({type:wl.IncrementalSnapshot,data:{source:vl.CustomElement,...e}})},blockClass:n,ignoreClass:o,ignoreSelector:a,maskTextClass:l,maskTextSelector:c,maskInputOptions:F,inlineStylesheet:h,sampling:w,recordDOM:b,recordCanvas:C,inlineImages:O,userTriggeredOnInput:E,collectFonts:x,doc:e,maskInputFn:m,maskTextFn:f,keepIframeSrcFn:R,blockSelector:i,slimDOMOptions:L,dataURLOptions:v,mirror:yc,iframeManager:K,stylesheetManager:W,shadowDomManager:G,processedNodeManager:V,canvasManager:fc,ignoreCSSAttributes:_,plugins:(null==(t=null==T?void 0:T.filter(e=>e.observer))?void 0:t.map(e=>({observer:e.observer,options:e.options,callback:t=>pc({type:wl.Plugin,data:{plugin:e.name,payload:t}})})))||[]},g)};K.addLoadListener(s=>{try{e.push(t(s.contentDocument))}catch(e){console.warn(e)}});const s=()=>{mc(),e.push(t(document)),gc=!0};return"interactive"===document.readyState||"complete"===document.readyState?s():(e.push(Za("DOMContentLoaded",()=>{pc({type:wl.DomContentLoaded,data:{}}),"DOMContentLoaded"===k&&s()})),e.push(Za("load",()=>{pc({type:wl.Load,data:{}}),"load"===k&&s()},window))),()=>{e.forEach(e=>e()),V.destroy(),gc=!1,Al=void 0}}catch(e){console.warn(e)}}var vc,Sc;wc.addCustomEvent=(e,t)=>{if(!gc)throw new Error("please add custom event after start recording");pc({type:wl.Custom,data:{tag:e,payload:t}})},wc.freezePage=()=>{Nl.forEach(e=>e.freeze())},wc.takeFullSnapshot=e=>{if(!gc)throw new Error("please take full snapshot after start recording");mc(e)},wc.mirror=yc,(Sc=vc||(vc={}))[Sc.NotStarted=0]="NotStarted",Sc[Sc.Running=1]="Running",Sc[Sc.Stopped=2]="Stopped";const bc=[];for(let e=0;e<256;++e)bc.push((e+256).toString(16).slice(1));let Cc;const Ic=new Uint8Array(16);const kc={};function Ec(e,t,s){let r;{const e=Date.now(),n=function(){if(!Cc){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Cc=crypto.getRandomValues.bind(crypto)}return Cc(Ic)}();!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}(kc,e,n),r=function(e,t,s,r,n,i,o=0){if(e.length<16)throw new Error("Random bytes length must be >= 16");if(i){if(o<0||o+16>i.length)throw new RangeError(`UUID byte range ${o}:${o+15} is out of buffer bounds`)}else i=new Uint8Array(16),o=0;t??=Date.now(),s??=0,r??=16383&(e[8]<<8|e[9]),n??=e.slice(10,16);const a=(1e4*(268435455&(t+=122192928e5))+s)%4294967296;i[o++]=a>>>24&255,i[o++]=a>>>16&255,i[o++]=a>>>8&255,i[o++]=255&a;const l=t/4294967296*1e4&268435455;i[o++]=l>>>8&255,i[o++]=255&l,i[o++]=l>>>24&15|16,i[o++]=l>>>16&255,i[o++]=r>>>8|128,i[o++]=255&r;for(let e=0;e<6;++e)i[o++]=n[e];return i}(n,kc.msecs,kc.nsecs,kc.clockseq,kc.node,t,s)}return t??function(e,t=0){return(bc[e[t+0]]+bc[e[t+1]]+bc[e[t+2]]+bc[e[t+3]]+"-"+bc[e[t+4]]+bc[e[t+5]]+"-"+bc[e[t+6]]+bc[e[t+7]]+"-"+bc[e[t+8]]+bc[e[t+9]]+"-"+bc[e[t+10]]+bc[e[t+11]]+bc[e[t+12]]+bc[e[t+13]]+bc[e[t+14]]+bc[e[t+15]]).toLowerCase()}(r)}var xc,Oc;(Oc=xc||(xc={}))[Oc.NONE=0]="NONE",Oc[Oc.ERROR=1]="ERROR",Oc[Oc.WARN=2]="WARN",Oc[Oc.INFO=3]="INFO",Oc[Oc.DEBUG=4]="DEBUG";const Tc=new class{constructor(e){this.config={level:xc.ERROR,enableConsole:!0,enableStorage:!1},this.isBrowser="undefined"!=typeof window,e&&(this.config={...this.config,...e})}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(e,...t){if(!this.shouldLog(xc.ERROR))return;const s=this.formatMessage("ERROR",e);this.config.enableConsole&&console.error(s,...t),this.config.enableStorage&&this.isBrowser&&this.logToStorage(s,t)}warn(e,...t){if(!this.shouldLog(xc.WARN))return;const s=this.formatMessage("WARN",e);this.config.enableConsole&&console.warn(s,...t),this.config.enableStorage&&this.isBrowser&&this.logToStorage(s,t)}info(e,...t){if(!this.shouldLog(xc.INFO))return;const s=this.formatMessage("INFO",e);this.config.enableConsole&&console.log(s,...t),this.config.enableStorage&&this.isBrowser&&this.logToStorage(s,t)}debug(e,...t){if(!this.shouldLog(xc.DEBUG))return;const s=this.formatMessage("DEBUG",e);this.config.enableConsole&&console.log(s,...t),this.config.enableStorage&&this.isBrowser&&this.logToStorage(s,t)}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 Rc=!1;const Mc=(e,...t)=>{Rc=!0;try{Tc.error(e,...t)}finally{Rc=!1}},_c=(e,...t)=>{Rc=!0;try{Tc.warn(e,...t)}finally{Rc=!1}},Ac=(e,...t)=>{Rc=!0;try{Tc.info(e,...t)}finally{Rc=!1}},Pc=(e,...t)=>{Rc=!0;try{Tc.debug(e,...t)}finally{Rc=!1}};class Nc{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),n=(Math.random()-.5)*(r-s);return Math.ceil(r+n)}(t),r=Date.now()+s;this._queue.push({retryAt:r,requestOptions:e});let n=`Enqueued failed request for retry in ${Math.round(s/1e3)}s`;"undefined"==typeof navigator||navigator.onLine||(n+=" (Browser is offline)"),_c(n),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=>{Mc("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){Mc("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)||_c("sendBeacon returned false for unload request")}catch(e){Mc("Error sending beacon request:",e)}}}class Fc{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 _c("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)),Pc(`Persisted ${t.length} events to storage`)}catch(t){if("QuotaExceededError"===t.name||22===t.code){_c("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){_c("Failed to save smaller queue, clearing storage"),this.clearQueue()}}else _c("Failed to persist queue:",t)}}addToQueue(e){const t=this.getQueue();t.push(e),t.length>this.maxQueueSize&&(t.shift(),Pc("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){_c("Failed to clear persisted queue:",e)}}getQueueLength(){return this.getQueue().length}}const Lc="0.5.69",Dc=1048576,Uc=52428.8;function Bc(e,t,s){return(new TextEncoder).encode($c({sessionId:s,events:[...e,t]})).length>Dc}function $c(e){return JSON.stringify(e,(e,t)=>"bigint"==typeof t?t.toString():t)}function zc(e,t){if(!e||"object"!=typeof e)return[];if((new TextEncoder).encode($c({sessionId:t,events:[e]})).length<=Dc)return[e];const s={...e},r=["screenshot","html","dom","fullText","innerHTML","outerHTML"];return r.forEach(e=>{s[e]&&delete s[e]}),(new TextEncoder).encode($c({sessionId:t,events:[s]})).length<=Dc?[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 jc{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 Fc(e),this.retryQueue=new Nc(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){Pc(`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){_c("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,n="POST"===e.method&&r<Uc,i=await fetch(e.url,{method:e.method||"GET",headers:e.headers||{},body:e.body,signal:t?.signal,keepalive:n});s&&clearTimeout(s);const o=await i.text();let a=null;try{a=JSON.parse(o)}catch{}if(e.callback&&e.callback({statusCode:i.status,text:o,json:a}),!i.ok)throw{status:i.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),Ac("API init called with:",{sessionId:e,userId:t,entryURL:s,referrer:r,baseUrl:this.baseUrl});try{const n=await this.trackedFetch(`${this.baseUrl}/api/ingestion/init`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`,Referer:r||""},body:$c({sessionId:e,endUserId:t,entryURL:s,referrer:r,sdkVersion:Lc})});if(Ac("API init response status:",n.status),!n.ok){if(429===n.status)return this.monthlyLimitReached=!0,{sessionId:e,endUserId:t};const s=await n.text();throw Mc("API init failed:",n.status,s),new Error(`Failed to initialize ingestion: ${n.statusText} - ${s}`)}const i=await n.json();return!0===i.monthlyLimitReached&&(this.monthlyLimitReached=!0,Ac("Monthly limit reached detected from server response")),Ac("API init success:",i),{sessionId:i.sessionId,endUserId:i.endUserId}}catch(e){throw Mc("API init error:",e),e}}async sendEvents(e,t,s){const r=e.filter(e=>e&&"object"==typeof e),n=await this.trackedFetch(`${this.baseUrl}/api/ingestion/events`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:$c({sessionId:t,events:r,endUserId:s,sdkVersion:Lc})});if(!n.ok){if(429===n.status)throw this.monthlyLimitReached=!0,new Error("429: Monthly video processing limit reached");throw new Error(`Failed to send events: ${n.statusText}`)}!0===(await n.json()).monthlyLimitReached&&(this.monthlyLimitReached=!0,Ac("Monthly limit reached detected from events response"))}async sendEventsChunked(e,t,s,r,n){if(!this.checkMonthlyLimit())return[];try{const i=[];let o=[];for(const a of e)if(a&&"object"==typeof a)if(Bc(o,a,t)){if(o.length>0){Pc(`[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:$c({sessionId:t,events:o,endUserId:s,windowId:r,automaticProperties:n,sdkVersion:Lc})});if(!e.ok){if(429===e.status)return this.monthlyLimitReached=!0,i.flat();throw new Error(`Failed to send events: ${e.statusText}`)}const a=await e.json();!0===a.monthlyLimitReached&&(this.monthlyLimitReached=!0,Ac("Monthly limit reached detected from chunked events response")),i.push(a),o=[]}o=zc(a,t)}else o.push(a);if(o.length>0){const e=await this._sendChunkWithRetry(o,t,s,r,n||o[0]?.automaticProperties);e&&i.push(e)}return i.flat()}catch(i){throw Mc("Error sending events:",i),this._persistEvents(e,t,s,r,n),i}}async _sendChunkWithRetry(e,t,s,r,n){let i=Math.min(this.currentBatchSize,e.length),o=0;for(;o<e.length;){const a=$c({sessionId:t,events:e.slice(o,o+i),endUserId:s,windowId:r,automaticProperties:n,sdkVersion:Lc}),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,n),null;if(413===c.status){_c(`413 error: reducing batch size from ${i} to ${Math.max(1,Math.floor(i/2))}`),this.currentBatchSize=Math.max(1,Math.floor(i/2)),i=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,n),null}const h=await c.json();if(!0===h.monthlyLimitReached&&(this.monthlyLimitReached=!0,Ac("Monthly limit reached detected from chunked events response")),o+=i,o>=e.length)return h}catch(i){return _c("Network error sending chunk, adding to retry queue:",i),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,n),null}}return null}_persistEvents(e,t,s,r,n){0!==e.length&&this.persistence.addToQueue({sessionId:t,events:e,endUserId:s,windowId:r,automaticProperties:n,timestamp:Date.now()})}async sendUserData(e,t,s){try{const r={userId:e,userAttributes:t,sessionId:s,posthogName:t.email||t.name||null};Pc("Sending user data to server:",r);const n=await this.trackedFetch(`${this.baseUrl}/api/ingestion/user`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:$c(r)});if(!n.ok)throw new Error(`Failed to send user data: ${n.statusText} with API key: ${this.apiKey}`);const i=await n.json();return Pc("Server response:",i),i}catch(e){throw Mc("Error sending user data:",e),e}}async sendUserAuth(e,t,s,r){try{const n=await this.trackedFetch(`${this.baseUrl}/api/ingestion/user/auth`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:$c({userId:e,userAttributes:t,sessionId:s,authFields:r})});if(!n.ok)throw new Error(`Failed to authenticate user: ${n.statusText} with API key: ${this.apiKey}`);return await n.json()}catch(e){throw Mc("Error authenticating user:",e),e}}sendBeaconEvents(e,t,s,r,n){const i={sessionId:t,events:e,endUserId:s||null,windowId:r,automaticProperties:n,sdkVersion:Lc,apiKey:this.apiKey},o=new Blob([$c(i)],{type:"application/json"});return navigator.sendBeacon(`${this.baseUrl}/api/ingestion/events`,o)}async sendCustomEvent(e,t,s,r){Ac("[SDK] Sending custom event",{sessionId:e,eventName:t,eventProperties:s,endUserId:r});try{const n=await this.trackedFetch(`${this.baseUrl}/api/ingestion/customEvent`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:$c({sessionId:e,eventName:t,eventProperties:s||{},endUserId:r||null})});if(Ac("[SDK] Custom event response",{status:n.status,statusText:n.statusText}),!n.ok){const e=await n.text();throw Mc("[SDK] Failed to send custom event",{status:n.status,statusText:n.statusText,errorText:e}),new Error(`Failed to send custom event: ${n.status} ${n.statusText} - ${e}`)}const i=await n.json();return Pc("[SDK] Custom event success",i),i}catch(r){throw Mc("[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:$c({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 Mc("Error sending custom event batch:",e),e}}async sendLog(e){try{if(Pc("[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:$c(e)});t.ok?Pc("[SDK] Log sent successfully"):_c("[SDK] Failed to send log to server:",t.status,t.statusText)}catch(e){_c("[SDK] Failed to send log to server:",e)}}async sendNetworkError(e){try{if(Pc("[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:$c(e)});t.ok?Pc("[SDK] Network error sent successfully"):_c("[SDK] Failed to send network error to server:",t.status,t.statusText)}catch(e){_c("[SDK] Failed to send network error to server:",e)}}async trackedFetch(e,t,s){const r=Date.now(),n=Ec(),i=this.shouldSkipNetworkTracking(e);if(this.cspBlocked&&"POST"===t.method&&"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon)return this.trackedFetchWithBeaconFallback(e,t,i);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<Uc,c=await fetch(e,{...t,signal:o?.signal,keepalive:l});a&&clearTimeout(a);const h=Date.now()-r;return c.ok||i||await this.sendNetworkError({requestId:n,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,_c("[SDK] CSP violation detected, falling back to sendBeacon for future requests"),this.trackedFetchWithBeaconFallback(e,t,i);throw i||await this.sendNetworkError({requestId:n,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 _c("[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=$c(t.body),s=t.body}if(e.includes("/api/ingestion/"))if(s&&"object"==typeof s)s.apiKey=this.apiKey,r=$c(s);else if(r)try{const e=JSON.parse(r);e.apiKey=this.apiKey,r=$c(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 n=r?new Blob([r],{type:"application/json"}):null;return navigator.sendBeacon(e,n)?(Pc("[SDK] Successfully sent request via sendBeacon (CSP fallback)"),new Response(null,{status:200,statusText:"OK",headers:new Headers})):(_c("[SDK] sendBeacon returned false - browser may be throttling"),new Response(null,{status:200,statusText:"OK (sendBeacon best-effort)",headers:new Headers}))}catch(e){return Mc("[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 Wc{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?Pc(`Redaction: Active for ${this.redactedFields.size} field(s):`,Array.from(this.redactedFields)):Pc("Redaction: No fields to redact"),this.applyRedactionClasses()}setFieldsToUnredact(e){this.unredactedFields.clear();const t=e.filter(e=>!this.isPasswordSelector(e)||(_c(`Cannot unredact password field: ${e} - Password fields are always protected`),!1));t.forEach(e=>this.unredactedFields.add(e)),t.length>0?Pc(`Unredaction: Active for ${t.length} field(s):`,t):Pc("Unredaction: No valid fields to unredact"),this.applyUnredactionClasses()}redactFields(e){e.forEach(e=>{this.unredactedFields.delete(e)}),this.unredactedFields.size>0?Pc(`Unredaction: Removed ${e.length} field(s), ${this.unredactedFields.size} remaining:`,Array.from(this.unredactedFields)):Pc("Unredaction: All fields redacted"),this.applyUnredactionClasses()}clearUnredactedFields(){this.unredactedFields.clear(),Pc("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")}),Pc(`Added rr-mask class to ${t.length} element(s) for selector: ${e}`)}catch(t){_c(`Invalid selector: ${e}`)}}):Pc("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")}),Pc(`Removed rr-mask class from ${t.length} element(s) for selector: ${e}`)}catch(t){_c(`Invalid selector: ${e}`)}}):Pc("DOM not ready, deferring unredaction class application"))}removeUnredactionClasses(){Pc("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){_c(`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){_c(`Invalid selector: ${t}`)}return!0}}new Wc;const Kc="undefined"!=typeof window;function Vc(){if(!Kc)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 Gc(e){try{return new URL(e).hostname}catch{return""}}function Hc(){if(!Kc)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(!Kc)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(!Kc)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:Vc(),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 Yc(){if(!Kc)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:Gc(t),initial_referrer:t,initial_referrer_domain:Gc(t),initial_host:window.location.hostname,...s}}function qc(){return{...Hc(),...Yc()}}function Zc(){if(!Kc)return{};const e=Yc();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 Jc{constructor(e={}){this.sessionProperties={},this.userProperties={},this.initialProperties={},this.isInitialized=!1,this.config={enableAutomaticProperties:!0,enableSessionProperties:!0,enableUserProperties:!0,propertyDenylist:[],...e},this.automaticProperties=qc(),this.initialize()}initialize(){this.isInitialized||(this.initialProperties=function(){if(!Kc)return{};const e=Yc();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}}(),this.loadSessionProperties(),this.isInitialized=!0)}getEventProperties(e={}){const t={...e};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)),this.applyDenylist(t),t}getAutomaticProperties(){return{...this.automaticProperties,...Zc()}}getAutomaticPropertiesWithGeoIP(e={}){return{...this.automaticProperties,...Zc(),...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=qc()}getAllProperties(){return{automatic:this.getAutomaticProperties(),session:{...this.sessionProperties},user:{...this.userProperties},initial:{...this.initialProperties}}}}const Qc="undefined"!=typeof window;class Xc{get isTrackerStarted(){return this.isStarted}setupDomReadyHandler(){if(Qc)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,Pc("π― 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(Pc("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:_c("Unknown request type:",e.type)}}registerDomReadyHandler(e){this.isDomReady?e():this.domReadyHandlers.push(e)}static init(e,t){if(Qc&&!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(Qc&&window.__humanBehaviorGlobalTracker)return Pc("Tracker already initialized, returning existing instance"),window.__humanBehaviorGlobalTracker;t?.logLevel&&this.configureLogging({level:t.logLevel});const s=new Xc(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._sessionActivityTimestamp=null,this._sessionStartTimestamp=null,this.userProperties={},this.isProcessing=!1,this.flushInterval=null,this.FLUSH_INTERVAL_MS=3e3,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._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.deadClickTracker={pendingClicks:new Map},this.DEAD_CLICK_SCROLL_THRESHOLD_MS=100,this.DEAD_CLICK_SELECTION_THRESHOLD_MS=100,this.DEAD_CLICK_MUTATION_THRESHOLD_MS=2e3,this.DEAD_CLICK_ABSOLUTE_TIMEOUT_MS=1400,!e)throw new Error("Human Behavior API Key is required");const r=t||"https://ingest.humanbehavior.co";if(this.api=new jc({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 Wc({redactionStrategy:s?.redactionStrategy,legacyRedactFields:s?.redactFields}),this.propertyManager=new Jc({enableAutomaticProperties:!1!==s?.enableAutomaticProperties,propertyDenylist:s?.propertyDenylist||[]}),Qc){const e="human_behavior_end_user_id",t=this.getCookie(e);this.endUserId=t||Ec(),t?Pc(`Reusing existing endUserId: ${this.endUserId}`):(this.setCookie(e,this.endUserId,365),Pc(`Generated new endUserId: ${this.endUserId}`))}else this.endUserId=Ec();if(Qc){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=Ec(),this.windowId=Ec();this.api.setTrackingContext(this.sessionId,this.endUserId),this.initializationPromise=this.init().catch(e=>{Mc("Initialization failed:",e)})}async init(){try{Qc?(this.setupPageUnloadHandler(),this.setupNavigationTracking()):Ac("HumanBehaviorTracker initialized in server environment. Session tracking is disabled."),this.initialized=!0,Ac(`HumanBehaviorTracker initialized with sessionId: ${this.sessionId}, endUserId: ${this.endUserId}`)}catch(e){Mc("Failed to initialize HumanBehaviorTracker:",e),this.initialized=!0}}async ensureInitialized(){this.initializationPromise&&await this.initializationPromise}setupNavigationTracking(){if(!Qc||this.navigationTrackingEnabled)return;this.navigationTrackingEnabled=!0,Pc("Setting up navigation tracking"),this.originalPushState=history.pushState,this.originalReplaceState=history.replaceState,history.pushState=(...e)=>{this.previousUrl=this.currentUrl,this.currentUrl=window.location.href,this.originalPushState.apply(history,e),this.trackNavigationEvent("pushState",this.previousUrl,this.currentUrl),this.takeFullSnapshot()},history.replaceState=(...e)=>{this.previousUrl=this.currentUrl,this.currentUrl=window.location.href,this.originalReplaceState.apply(history,e),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=()=>{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)try{const r={type:e,from:t,to:s,timestamp:(new Date).toISOString(),pathname:window.location.pathname,search:window.location.search,hash:window.location.hash,referrer:document.referrer};if(await this.addEvent({type:5,data:{payload:{eventType:"navigation",...r}},timestamp:Date.now()}),"pageLoad"===e||"pushState"===e||"replaceState"===e||"popstate"===e||"hashchange"===e){const s={url:window.location.href,fromUrl:t,navigationType:e,pathname:window.location.pathname,search:window.location.search,hash:window.location.hash,referrer:document.referrer,timestamp:Date.now()};await this.customEvent("$page_viewed",s)}Pc(`Navigation tracked: ${e} from ${t} to ${s}`)}catch(e){Mc("Failed to track navigation event:",e)}}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()}),Pc(`Pageview tracked: ${t.url}`)}catch(e){Mc("Failed to track pageview event:",e)}}}async customEvent(e,t){this.endUserId||(_c(`endUserId not available, using anonymous ID for event: ${e}`),this.endUserId=Ec()),Qc&&this.checkAndRefreshSession();const s=this.propertyManager.getEventProperties(t);if(this.shouldSkipDueToMinimumDuration())return Pc(`Custom event '${e}' queued due to session duration below minimum`),void this.pendingCustomEvents.push({eventName:e,properties:s,timestamp:Date.now()});await this.flushPendingCustomEvents();try{await this.api.sendCustomEvent(this.sessionId,e,s,this.endUserId),Pc(`Custom event tracked: ${e}`,s)}catch(t){Mc("Failed to track custom event:",t),t.message?.includes("500")||t.message?.includes("Internal Server Error")||t.message?.includes("Failed to send custom event")?_c("Custom event endpoint failed, using fallback"):t.message?.includes("ERR_BLOCKED_BY_CLIENT")?_c("Custom event request blocked by ad blocker, using fallback"):t.message?.includes("Failed to fetch")&&_c("Custom event network error, using fallback");try{const t={eventName:e,properties:s||{},timestamp:(new Date).toISOString(),url:window.location.href,pathname:window.location.pathname};await this.addEvent({type:5,data:{payload:{eventType:"custom",...t}},timestamp:Date.now()}),Pc(`Custom event added to event stream as fallback: ${e}`)}catch(e){Mc("Failed to add custom event to event stream as fallback:",e)}}}setupAutomaticTracking(e){if(!Qc)return;const t={trackButtons:!1!==e?.trackButtons,trackLinks:!1,trackForms:!1!==e?.trackForms,includeText:!1!==e?.includeText,includeClasses:e?.includeClasses||!1};Pc("Setting up automatic tracking with config:",t),t.trackButtons&&this.setupAutomaticButtonTracking(t),t.trackForms&&this.setupAutomaticFormTracking(t),this.setupRageClickDetection()}setupAutomaticButtonTracking(e){document.addEventListener("click",async t=>{const s=t.target;if("BUTTON"===s.tagName||s.closest("button")){const t="BUTTON"===s.tagName?s:s.closest("button"),r={buttonId:t.id||null,buttonType:t.type||"button",page:window.location.pathname,timestamp:Date.now()};e.includeText&&(r.buttonText=t.textContent?.trim()||null),e.includeClasses&&(r.buttonClass=t.className||null),Object.keys(r).forEach(e=>{null===r[e]&&delete r[e]}),await this.customEvent("$button_clicked",r)}})}setupRageClickDetection(){Qc&&document.addEventListener("click",async e=>{const t=e.target,s=e.clientX,r=e.clientY,n=Date.now();if(this.isRageClick(s,r,n,t)){const e=t.closest('button, a, [role="button"], [role="link"]')||t,i={x:s,y:r,page:window.location.pathname,element:e.tagName.toLowerCase(),clickCount:this.RAGE_CLICK_CLICK_COUNT,timestamp:n};e.id&&(i.elementId=e.id),e.className&&(i.elementClass=e.className),e.textContent&&(i.elementText=e.textContent.trim().substring(0,100)),Object.keys(i).forEach(e=>{null!==i[e]&&void 0!==i[e]||delete i[e]}),await this.customEvent("$rageclick",i),this.rageClickTracker.clicks=[]}})}isRageClick(e,t,s,r){const n=this.rageClickTracker.clicks,i=n[n.length-1];if(i&&Math.abs(e-i.x)+Math.abs(t-i.y)<this.RAGE_CLICK_THRESHOLD_PX&&s-i.timestamp<this.RAGE_CLICK_TIMEOUT_MS){if(n.push({x:e,y:t,timestamp:s,element:r}),n.length>=this.RAGE_CLICK_CLICK_COUNT)return!0}else this.rageClickTracker.clicks=[{x:e,y:t,timestamp:s,element:r}];return!1}isInteractiveElement(e){const t=e.tagName.toLowerCase();if("button"===t||"a"===t)return!0;if(["input","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"]')}setupAutomaticLinkTracking(e){}setupAutomaticFormTracking(e){document.addEventListener("submit",async t=>{const s=t.target,r=new FormData(s),n={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&&(n.formClass=s.className||null),Object.keys(n).forEach(e=>{null===n[e]&&delete n[e]}),await this.customEvent("$form_submitted",n)})}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,Pc("Navigation tracking cleaned up"))}static logToStorage(e){Ac(e)}static configureLogging(e){Tc.setConfig({level:{none:0,error:1,warn:2,info:3,debug:4}[e.level||"error"],enableConsole:!1!==e.enableConsole,enableStorage:e.enableStorage||!1})}enableConsoleTracking(){Qc&&!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,Pc("Console tracking enabled"))}enableNetworkTracking(){Qc&&!this.networkTrackingEnabled&&"undefined"!=typeof fetch&&(this.originalFetch=window.fetch.bind(window),window.fetch=async(e,t)=>{const s=Date.now(),r=Ec(),n="string"==typeof e?e:e instanceof URL?e.toString():e.url,i=(t?.method||("object"==typeof e&&"method"in e?e.method:void 0)||"GET").toUpperCase(),o=this.shouldSkipNetworkTracking(n);let a=null,l=!1;o||(a=setTimeout(()=>{const e=Date.now()-s;if(!l){l=!0;const t={requestId:r,url:n,method:i,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:`${i} ${n}`,spanStatus:"slow",attributes:{"http.method":i,"http.url":n,"request.duration_ms":e,"request.long_loading_threshold_ms":1e4}};return this.shouldSkipDueToMinimumDuration()?(Pc("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:n,method:i,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:`${i} ${n}`,spanStatus:"error",attributes:{"http.status_code":l.status,"http.status_text":l.statusText}};if(this.shouldSkipDueToMinimumDuration())return Pc("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:n,method:i,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:`${i} ${n}`,spanStatus:"error",attributes:{"error.name":e.name,"error.message":e.message}};if(this.shouldSkipDueToMinimumDuration())throw Pc("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,Pc("Network tracking enabled"))}async flushPendingCustomEvents(){if(0===this.pendingCustomEvents.length)return;const e=[...this.pendingCustomEvents];this.pendingCustomEvents=[],Pc(`Flushing ${e.length} pending custom events`);for(const{eventName:t,properties:s}of e)try{await this.api.sendCustomEvent(this.sessionId,t,s,this.endUserId)}catch(e){Mc("Failed to flush pending custom event:",e)}}async flushPendingLogs(){if(0===this.pendingLogs.length)return;const e=[...this.pendingLogs];this.pendingLogs=[],Pc(`Flushing ${e.length} pending logs`);for(const{logData:t}of e)try{await this.api.sendLog(t)}catch(e){Mc("Failed to flush pending log:",e)}}async flushPendingNetworkErrors(){if(0===this.pendingNetworkErrors.length)return;const e=[...this.pendingNetworkErrors];this.pendingNetworkErrors=[],Pc(`Flushing ${e.length} pending network errors`);for(const{errorData:t}of e)try{await this.api.sendNetworkError(t)}catch(e){Mc("Failed to flush pending network error:",e)}}enablePageLoadTracking(){Qc&&"undefined"!=typeof window&&("complete"===document.readyState?this.trackPageLoad():window.addEventListener("load",()=>{this.trackPageLoad()}),Pc("Page load tracking enabled"))}trackPageLoad(){if(Qc&&"undefined"!=typeof performance)try{const e=performance.getEntriesByType("navigation")[0];if(!e)return;const t=e.loadEventEnd-e.fetchStart;if(t>3e3){const s=Ec(),r=e.domContentLoadedEventEnd-e.fetchStart,n=e.domComplete-e.fetchStart,i={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":n}};if(this.shouldSkipDueToMinimumDuration())return Pc("Slow page load network error queued due to session duration below minimum"),void this.pendingNetworkErrors.push({errorData:i,timestamp:Date.now()});this.flushPendingNetworkErrors(),this.api.sendNetworkError(i).catch(()=>{})}}catch(e){_c("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(){Qc&&this.consoleTrackingEnabled&&(this.originalConsole&&(console.log=this.originalConsole.log,console.warn=this.originalConsole.warn,console.error=this.originalConsole.error),this.consoleTrackingEnabled=!1,Pc("Console tracking disabled"))}trackConsoleEvent(e,t){if(this.initialized)if("log"!==e)try{if(Rc)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:Qc?window.location.href:"",userAgent:Qc?navigator.userAgent:"",stack:s,sessionId:this.sessionId,endUserId:this.endUserId};if(this.shouldSkipDueToMinimumDuration())return Pc(`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){Mc("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 n=s[e].trim().toLowerCase();if(n&&"error"!==n&&!n.startsWith("error:")&&!t.some(e=>n.includes(e.toLowerCase()))){r=!0;break}}return!r}setupPageUnloadHandler(){if(!Qc)return;Pc("Setting up page unload handler"),window.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState&&(Pc("Page hidden - sending pending events"),this.flushEvents())});const e="onpagehide"in window?"pagehide":"beforeunload";window.addEventListener(e,()=>{Pc("Page unloading - sending final events via sendBeacon");const e=this.minimumDurationMilliseconds,t=this.getSessionDuration();if(null!==t&&t>=0&&t<e)return void Pc(`Session duration (${t}ms) below minimum (${e}ms), not sending on unload`);const s=[...this.eventQueue];if(Qc&&window.__hb_pending_snapshots){const e=window.__hb_pending_snapshots;Array.isArray(e)&&e.length>0&&(Pc("Including pending FullSnapshot(s) in sendBeacon for short session"),s.unshift(...e),delete window.__hb_pending_snapshots)}if(s.length>0&&this.api)try{const e=this.propertyManager.getAutomaticProperties();this.api.sendBeaconEvents(s,this.sessionId,this.endUserId||void 0,this.windowId,e),this.eventQueue=[]}catch(e){_c("Failed to send events via sendBeacon on unload:",e)}this.api&&this.api.unload()});const t=()=>{localStorage.setItem("human_behavior_last_activity",Date.now().toString())};window.addEventListener("click",t),window.addEventListener("keydown",t),window.addEventListener("scroll",t),window.addEventListener("mousemove",t)}viewLogs(){try{const e=Tc.getLogs();Ac("HumanBehavior Logs:",e),Tc.clearLogs()}catch(e){Mc("Failed to read logs:",e)}}async identifyUser({userProperties:e}){const t=this.endUserId;this.userProperties=e,Pc("Identifying user:",{userProperties:e,originalEndUserId:t,sessionId:this.sessionId}),!Qc||this.propertyManager.getAutomaticProperties();const s=await this.api.sendUserData(t||"",e,this.sessionId);if(s.actualUserId||s.wasExistingUser){const r=s.actualUserId||t;if(r&&r!==t){const s="human_behavior_end_user_id";if(this.setCookie(s,r,365),Qc)try{localStorage.setItem(s,r)}catch(e){Pc("Failed to set canonical endUserId in localStorage:",e)}Pc(`π Preexisting user detected. Future sessions will use canonical ID: ${r} (current session stays: ${t})`)}}return t||""}getUserAttributes(){return{...this.userProperties}}async start(){if(!Qc)return;if(this.isStarted)return void Pc("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.enableConsoleTrackingFlag&&this.enableConsoleTracking(),this.enableNetworkTrackingFlag&&this.enableNetworkTracking(),this.enablePageLoadTracking();const e=()=>{if(this.recordInstance)return void Pc("π― Recording already started, skipping duplicate start");Pc("π― DOM ready, starting session recording"),this.rrwebRecord=wc;const e=wc({emit:e=>{this.addRecordingEvent(e),2===e.type&&Pc(`π― 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(Pc(`π― DOM ready state: ${document.readyState}`),"complete"===document.readyState||"interactive"===document.readyState)Pc(`π― DOM ready (${document.readyState}), starting recording immediately`),e();else{Pc("π― DOM not ready, waiting for DOMContentLoaded event");const t=()=>("interactive"===document.readyState||"complete"===document.readyState)&&(Pc(`π― DOM ready (${document.readyState}), starting recording`),e(),!0);if(t())return;document.addEventListener("DOMContentLoaded",()=>{Pc("π― DOMContentLoaded fired, starting recording"),e()},{once:!0});const s=setInterval(()=>{t()&&clearInterval(s)},10);setTimeout(()=>clearInterval(s),5e3)}}takeFullSnapshot(){this.fullSnapshotTimeout&&clearTimeout(this.fullSnapshotTimeout),this.fullSnapshotTimeout=window.setTimeout(()=>{try{requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.rrwebRecord&&"function"==typeof this.rrwebRecord.takeFullSnapshot?(this.rrwebRecord.takeFullSnapshot(),Pc("β
FullSnapshot taken for navigation (delayed for animations)")):_c("β οΈ takeFullSnapshot not available on record function")})})}catch(e){Mc("β Failed to take FullSnapshot for navigation:",e)}},1e3)}async stop(){await this.ensureInitialized(),Qc&&(this.flushInterval&&(clearInterval(this.flushInterval),this.flushInterval=null),this.recordInstance&&(this.recordInstance(),this.recordInstance=null),this.fullSnapshotTimeout&&(clearTimeout(this.fullSnapshotTimeout),this.fullSnapshotTimeout=null),this.rrwebRecord=null,this.disableConsoleTracking(),this.cleanupNavigationTracking())}async addEvent(e){if(Qc&&this.checkAndRefreshSession(),e&&"object"==typeof e){if(2===e.type){const t=!!e.data,s=!(!e.data||!e.data.node);Pc(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(),Pc("Queue is full, the oldest event is dropped.")),this.eventQueue.push(e),2===e.type?(Pc("FullSnapshot added, triggering immediate flush"),this.flushEvents()):this.eventQueue.length>=.8*this.MAX_QUEUE_SIZE&&(Pc(`Queue at ${this.eventQueue.length}/${this.MAX_QUEUE_SIZE}, triggering immediate flush`),this.flushEvents())}else Pc("β οΈ 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)&&(Pc(`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 Pc(`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&&Qc&&(window.__hb_pending_snapshots=s,setTimeout(()=>{delete window.__hb_pending_snapshots},5e3)),t.length>0){Pc("Flushing events:",t);const s=t.filter(e=>2===e.type);s.length>0&&Pc(`[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"))_c("Session expired, events will be lost");else if(e.message?.includes("413")||e.message?.includes("Content Too Large"))_c("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;_c("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?(Pc("β
User activity detected, exiting idle state"),this._isIdle=!1,this.rrwebRecord&&"function"==typeof this.rrwebRecord.takeFullSnapshot&&(this.rrwebRecord.takeFullSnapshot(),Pc("β
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&&(Pc(`βΈοΈ Session idle detected (${Math.round(e/1e3)}s since last activity) - stopping background event recording`),Pc(`βΉοΈ Session will expire after 15 minutes of inactivity (${Math.round((9e5-e)/1e3)}s remaining)`),this._isIdle=!0,this.flushEvents())}}async addRecordingEvent(e){if(Qc&&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);Pc(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(),Pc("Queue is full, the oldest event is dropped.")),this.eventQueue.push(e),2===e.type?(Pc("FullSnapshot added, triggering immediate flush"),this.flushEvents()):!0!==this._isIdle&&this.eventQueue.length>=.8*this.MAX_QUEUE_SIZE&&(Pc(`Queue at ${this.eventQueue.length}/${this.MAX_QUEUE_SIZE}, triggering immediate flush`),this.flushEvents())}}else Pc("β οΈ Skipping invalid recording event:",e)}_canUseSessionStorage(){if(!Qc)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),Pc(`Stored windowId in sessionStorage: ${e}`)}catch(e){_c("Failed to store windowId in sessionStorage:",e)}}_removeWindowIdFromStorage(){if(this._canUseSessionStorage())try{sessionStorage.removeItem(this._window_id_storage_key)}catch(e){_c("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){_c("Failed to set primary_window_exists flag:",e)}}getOrCreateWindowId(){if(!Qc)return Ec();const e=this._getWindowIdFromStorage(),t=this._getPrimaryWindowExists();if(e&&!t)return Pc(`Reusing windowId from previous page load: ${e}`),this._setWindowIdInStorage(e),this._setPrimaryWindowExists(!0),e;{const e=Ec();return Pc(`Creating new windowId: ${e} (new window/tab detected)`),this._setWindowIdInStorage(e),this._setPrimaryWindowExists(!0),e}}setupWindowUnloadListener(){Qc&&window.addEventListener("beforeunload",()=>{this._canUseSessionStorage()&&(this._setPrimaryWindowExists(!1),Pc("Cleared primary_window_exists flag on beforeunload"))},{capture:!1})}setCookie(e,t,s){if(Qc)try{const r=new Date;r.setTime(r.getTime()+24*s*60*60*1e3);const n=`expires=${r.toUTCString()}`;document.cookie=`${e}=${t};${n};path=/;SameSite=Lax`,localStorage.setItem(e,t),Pc(`Set cookie and localStorage: ${e}`)}catch(s){try{localStorage.setItem(e,t),Pc(`Cookie blocked, using localStorage: ${e}`)}catch(e){Mc("Failed to store user ID in both cookie and localStorage:",e)}}}getCookie(e){if(!Qc)return null;try{const t=e+"=",s=document.cookie.split(";");for(let r=0;r<s.length;r++){let n=s[r];for(;" "===n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(t)){const s=n.substring(t.length,n.length);return Pc(`Found cookie: ${e}`),s}}const r=localStorage.getItem(e);return r?(Pc(`Cookie not found, using localStorage: ${e}`),r):null}catch(t){try{const t=localStorage.getItem(e);if(t)return Pc(`Cookie access failed, using localStorage: ${e}`),t}catch(e){Mc("Failed to access both cookie and localStorage:",e)}return null}}deleteCookie(e){if(Qc){try{document.cookie=`${e}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/; SameSite=Lax`,Pc(`Deleted cookie: ${e}`)}catch(t){Mc(`Failed to delete cookie: ${e}`,t)}try{localStorage.removeItem(e),Pc(`Removed from localStorage: ${e}`)}catch(t){Mc(`Failed to remove from localStorage: ${e}`,t)}}}logout(){if(Qc)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=Ec(),this.setCookie("human_behavior_end_user_id",this.endUserId,365),this.sessionId=this.createNewSession(t),this.windowId=Ec(),this._setWindowIdInStorage(this.windowId),this.api.setTrackingContext(this.sessionId,this.endUserId),Ac("User logged out - cleared all user data and started fresh session")}catch(e){Mc("Error during logout:",e)}}async redact(e){await this.ensureInitialized(),Qc?this.redactionManager=new Wc(e):_c("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(!Qc)return;const e="human_behavior_session",t=Date.now(),s=this.getStoredSession(e);if(!s||!s.sessionId)return this.createNewSession(e),this.windowId=Ec(),this._setWindowIdInStorage(this.windowId),this.api.setTrackingContext(this.sessionId,this.endUserId),void Pc(`Created new session (no stored session): ${this.sessionId}`);this.updateSessionActivity(e,t,s.sessionId,s.sessionStartTimestamp)}getOrCreateSessionId(){if(!Qc)return Ec();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,n=t-s.sessionStartTimestamp;if(r>9e5||n>864e5){Pc(`Session expired: idle=${r}ms, age=${n}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=9e5,r=864e5;if(this.sessionId&&null!==this._sessionActivityTimestamp&&null!==this._sessionStartTimestamp){const n=t-this._sessionActivityTimestamp,i=t-this._sessionStartTimestamp;if(!(n>s||i>r))return{sessionId:this.sessionId,lastActivityTimestamp:this._sessionActivityTimestamp,sessionStartTimestamp:this._sessionStartTimestamp};{Pc("Session in memory expired: creating new session immediately");const t=this.sessionId;if(this.createNewSession(e),this.windowId=Ec(),this._setWindowIdInStorage(this.windowId),this.api.setTrackingContext(this.sessionId,this.endUserId),Ac(`π 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 n=localStorage.getItem(e);if(!n)return null;const i=JSON.parse(n),o=t-i.lastActivityTimestamp,a=t-i.sessionStartTimestamp;if(o>s||a>r){Pc(`Session in localStorage expired: idle=${Math.round(o/1e3/60)}min, age=${Math.round(a/1e3/60/60)}hrs`);const t=i.sessionId;if(this.createNewSession(e),this.windowId=Ec(),this._setWindowIdInStorage(this.windowId),this.api.setTrackingContext(this.sessionId,this.endUserId),Ac(`π 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 i.sessionId&&(this.sessionId=i.sessionId,this._sessionActivityTimestamp=i.lastActivityTimestamp,this._sessionStartTimestamp=i.sessionStartTimestamp),i}catch{return null}}createNewSession(e){const t=Ec(),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){_c(`Failed to save session to localStorage: ${e}`)}return Pc(`Created new session: ${t}`),t}updateSessionActivity(e,t,s,r){this.sessionId=s,this._sessionActivityTimestamp=t,this._sessionStartTimestamp=r;const n={sessionId:s,lastActivityTimestamp:t,sessionStartTimestamp:r};try{localStorage.setItem(e,JSON.stringify(n))}catch(e){_c(`Failed to update session in localStorage: ${e}`)}}getSessionId(){return this.sessionId}getCurrentUrl(){return 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(!Qc)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()}}Qc&&(window.HumanBehaviorTracker=Xc);const eh=(e,t,s)=>new Xc(e,t,s);"undefined"!=typeof window&&(window.HumanBehaviorTracker=Xc,window.humanbehavior={init:eh});const th=()=>"undefined"!=typeof window,sh=r(null),rh=({apiKey:r,client:c,children:h,options:u})=>{const[d,p]=n(c||null),[m,f]=n([]),[g,y]=n(!1),[w,v]=n(!1),S=i(r),b=i(c),C=i(m);o(()=>{S.current=r,b.current=c},[r,c]),o(()=>{C.current=m},[m]);const I=a(e=>{f(t=>[...t,e])},[]);o(()=>{y(!0)},[]),o(()=>{if(th()){if(b.current)return p(b.current),void v(!0);if(S.current&&""!==S.current.trim()){if(null===d)try{const e=Xc.init(S.current.trim(),{ingestionUrl:u?.ingestionUrl,logLevel:u?.logLevel,redactFields:u?.redactFields,redactionStrategy:u?.redactionStrategy,enableAutomaticTracking:u?.enableAutomaticTracking,suppressConsoleErrors:u?.suppressConsoleErrors,recordCanvas:u?.recordCanvas,enableAutomaticProperties:u?.enableAutomaticProperties,propertyDenylist:u?.propertyDenylist,automaticTrackingOptions:u?.automaticTrackingOptions,maxQueueSize:u?.maxQueueSize,enableConsoleTracking:u?.enableConsoleTracking,enableNetworkTracking:u?.enableNetworkTracking});p(e),v(!0),e.initializationPromise?.then(async()=>{e.isTrackerStarted||await e.start();const t=C.current;if(t.length>0){for(const s of t)if("identify"===s.type){Pc("Processing queued identify event",s);try{await e.identifyUser({userProperties:s.userProperties})}catch(e){Mc("Failed to process queued user info:",e)}}else e.addEvent(s);f([])}}).catch(e=>{Mc("Failed to initialize HumanBehaviorTracker:",e)})}catch(e){Mc("Failed to create HumanBehaviorTracker:",e)}}else Mc("An apiKey is required when no client is provided")}},[g]);const k=l(()=>g&&w?d:nh(I),[g,w,d,I]);return th()?s(sh.Provider,{value:k,children:[e(lh,{}),h]}):e(t,{children:h})},nh=e=>({addEvent:t=>{e(t)},identifyUser:async({userProperties:t})=>(e({type:"identify",userProperties:t}),""),start:()=>{},stop:()=>{},logout:()=>{},viewLogs:()=>{_c("Logs are not available until HumanBehaviorTracker is initialized")},setUnredactedFields:()=>{},hasUnredactedFields:()=>!1,getUnredactedFields:()=>[],trackPageView:()=>{}}),ih=()=>{const e=c(sh);if(!e)throw new Error("useHumanBehavior must be used within a HumanBehaviorProvider");return e},oh=()=>{const e=ih();return{setUnredactedFields:a(t=>{e.setUnredactedFields(t)},[e]),hasUnredactedFields:a(()=>e.hasUnredactedFields(),[e]),getUnredactedFields:a(()=>e.getUnredactedFields(),[e])}},ah=()=>{const e=ih();return{identifyUser:a(async({userProperties:t})=>{try{return await e.identifyUser({userProperties:t}),{success:!0}}catch(e){return Mc("Failed to identify user:",e),{success:!1,error:e}}},[e])}};function lh(){const e=c(sh);return o(()=>{if(e&&"undefined"!=typeof window){e.trackPageView();const t=()=>{e.trackPageView()};window.addEventListener("popstate",t);const s=history.pushState,r=history.replaceState;return history.pushState=function(...e){s.apply(this,e),t()},history.replaceState=function(...e){r.apply(this,e),t()},()=>{window.removeEventListener("popstate",t),history.pushState=s,history.replaceState=r}}},[e]),null}export{rh as HumanBehaviorProvider,Xc as HumanBehaviorTracker,ih as useHumanBehavior,oh as useRedaction,ah as useUserTracking};
|
|
1
|
+
import{jsx as e,Fragment as t,jsxs as s}from"react/jsx-runtime";import{createContext as r,useState as n,useRef as i,useEffect as o,useCallback as a,useMemo as l,useContext as c}from"react";var h,u=Object.defineProperty,d=(e,t,s)=>((e,t,s)=>t in e?u(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s)(e,"symbol"!=typeof t?t+"":t,s),p=Object.defineProperty,m=(e,t,s)=>((e,t,s)=>t in e?p(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s)(e,"symbol"!=typeof t?t+"":t,s),f=(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))(f||{});const g={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},y={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},w={};function v(e){if(w[e])return w[e];const t=globalThis[e],s=t.prototype,r=e in g?g[e]:void 0,n=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]"))})),i=e in y?y[e]:void 0,o=Boolean(i&&i.every(e=>{var t;return"function"==typeof s[e]&&(null==(t=s[e])?void 0:t.toString().includes("[native code]"))}));if(n&&o)return w[e]=t.prototype,t.prototype;try{const r=document.createElement("iframe");document.body.appendChild(r);const n=r.contentWindow;if(!n)return t.prototype;const i=n[e].prototype;return document.body.removeChild(r),i?w[e]=i:s}catch{return s}}const S={};function b(e,t,s){var r;const n=`${e}.${String(s)}`;if(S[n])return S[n].call(t);const i=v(e),o=null==(r=Object.getOwnPropertyDescriptor(i,s))?void 0:r.get;return o?(S[n]=o,o.call(t)):t[s]}const C={};function I(e,t,s){const r=`${e}.${String(s)}`;if(C[r])return C[r].bind(t);const n=v(e)[s];return"function"!=typeof n?t[s]:(C[r]=n,n.bind(t))}const k={childNodes:function(e){return b("Node",e,"childNodes")},parentNode:function(e){return b("Node",e,"parentNode")},parentElement:function(e){return b("Node",e,"parentElement")},textContent:function(e){return b("Node",e,"textContent")},contains:function(e,t){return I("Node",e,"contains")(t)},getRootNode:function(e){return I("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?b("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?b("Element",e,"shadowRoot"):null},querySelector:function(e,t){return b("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return b("Element",e,"querySelectorAll")(t)},mutationObserver:function(){return v("MutationObserver").constructor}};function E(e){return e.nodeType===e.ELEMENT_NODE}function x(e){const t=e&&"host"in e&&"mode"in e&&k.host(e)||null;return Boolean(t&&"shadowRoot"in t&&k.shadowRoot(t)===e)}function O(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function T(e){try{const s=e.rules||e.cssRules;if(!s)return null;const r=Array.from(s,t=>R(t,e.href)).join("");return(t=r).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 R(e,t){if(function(e){return"styleSheet"in e}(e)){let t;try{t=T(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?$(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?$(s,t):s}}class M{constructor(){m(this,"idNodeMap",new Map),m(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 _({element:e,maskInputOptions:t,tagName:s,type:r,value:n,maskInputFn:i}){let o=n||"";const a=r&&A(r);return(t[s.toLowerCase()]||a&&t[a])&&(o=i?i(o,e):"*".repeat(o.length)),o}function A(e){return e.toLowerCase()}const P="__rrweb_original__";function N(e){const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?A(t):null}function F(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 L=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,D=/^(?:[a-z+]+:)?\/\//i,U=/^www\..*/i,B=/^(data:)([^,]*),(.*)/i;function $(e,t){return(e||"").replace(L,(e,s,r,n,i,o)=>{const a=r||i||o,l=s||n||"";if(!a)return e;if(D.test(a)||U.test(a))return`url(${l}${a}${l})`;if(B.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})`})}let z=1;const j=new RegExp("[^a-z0-9-_:]");function W(){return z++}let K,V;const G=/^[^ \t\n\r\u000c]+/,H=/^[, \t\n\r\u000c]+/;const Y=new WeakMap;function q(e,t){return t&&""!==t.trim()?J(e,t):t}function Z(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function J(e,t){let s=Y.get(e);if(s||(s=e.createElement("a"),Y.set(e,s)),t){if(t.startsWith("blob:")||t.startsWith("data:"))return t}else t="";return s.setAttribute("href",t),s.href}function Q(e,t,s,r){return r?"src"===s||"href"===s&&("use"!==t||"#"!==r[0])||"xlink:href"===s&&"#"!==r[0]?q(e,r):"background"!==s||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===s?function(e,t){if(""===t.trim())return t;let s=0;function r(e){let r;const n=e.exec(t.substring(s));return n?(r=n[0],s+=r.length,r):""}const n=[];for(;r(H),!(s>=t.length);){let i=r(G);if(","===i.slice(-1))i=q(e,i.substring(0,i.length-1)),n.push(i);else{let r="";i=q(e,i);let o=!1;for(;;){const e=t.charAt(s);if(""===e){n.push((i+r).trim());break}if(o)")"===e&&(o=!1);else{if(","===e){s+=1,n.push((i+r).trim());break}"("===e&&(o=!0)}r+=e,s+=1}}}return n.join(", ")}(e,r):"style"===s?$(r,J(e)):"object"===t&&"data"===s?q(e,r):r:q(e,r):r}function X(e,t,s){return("video"===e||"audio"===e)&&"autoplay"===t}function ee(e,t,s){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!s&&ee(k.parentNode(e),t,s);for(let s=e.classList.length;s--;){const r=e.classList[s];if(t.test(r))return!0}return!!s&&ee(k.parentNode(e),t,s)}function te(e,t,s,r){let n;if(E(e)){if(n=e,!k.childNodes(n).length)return!1}else{if(null===k.parentElement(e))return!1;n=k.parentElement(e)}try{if("string"==typeof t){if(r){if(n.closest(`.${t}`))return!0}else if(n.classList.contains(t))return!0}else if(ee(n,t,r))return!0;if(s)if(r){if(n.closest(s))return!0}else if(n.matches(s))return!0}catch(e){}return!1}function se(e,t){const{doc:s,mirror:r,blockClass:n,blockSelector:i,needsMask:o,inlineStylesheet:a,maskInputOptions:l={},maskTextFn:c,maskInputFn:h,dataURLOptions:u={},inlineImages:d,recordCanvas:p,keepIframeSrcFn:m,newlyAddedElement:g=!1}=t,y=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:f.Document,childNodes:[],compatMode:e.compatMode}:{type:f.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:f.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:y};case e.ELEMENT_NODE:return function(e,t){const{doc:s,blockClass:r,blockSelector:n,inlineStylesheet:i,maskInputOptions:o={},maskInputFn:a,dataURLOptions:l={},inlineImages:c,recordCanvas:h,keepIframeSrcFn:u,newlyAddedElement:d=!1,rootId:p}=t,m=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,n),g=function(e){if(e instanceof HTMLFormElement)return"form";const t=A(e.tagName);return j.test(t)?"div":t}(e);let y={};const w=e.attributes.length;for(let t=0;t<w;t++){const r=e.attributes[t];X(g,r.name,r.value)||(y[r.name]=Q(s,g,A(r.name),r.value))}if("link"===g&&i){const t=Array.from(s.styleSheets).find(t=>t.href===e.href);let r=null;t&&(r=T(t)),r&&(delete y.rel,delete y.href,y._cssText=r)}if("style"===g&&e.sheet&&!(e.innerText||k.textContent(e)||"").trim().length){const t=T(e.sheet);t&&(y._cssText=t)}if("input"===g||"textarea"===g||"select"===g){const t=e.value,s=e.checked;"radio"!==y.type&&"checkbox"!==y.type&&"submit"!==y.type&&"button"!==y.type&&t?y.value=_({element:e,type:N(e),tagName:g,value:t,maskInputOptions:o,maskInputFn:a}):s&&(y.checked=s)}"option"===g&&(e.selected&&!o.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&&h)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 n=t.getImageData,i=P in n?n[P]:n;if(new Uint32Array(i.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(l.type,l.quality));else if(!("__context"in e)){const t=e.toDataURL(l.type,l.quality),r=s.createElement("canvas");r.width=e.width,r.height=e.height;t!==r.toDataURL(l.type,l.quality)&&(y.rr_dataURL=t)}if("img"===g&&c){K||(K=s.createElement("canvas"),V=K.getContext("2d"));const t=e,r=t.currentSrc||t.getAttribute("src")||"<unknown-src>",n=t.crossOrigin,i=()=>{t.removeEventListener("load",i);try{K.width=t.naturalWidth,K.height=t.naturalHeight,V.drawImage(t,0,0),y.rr_dataURL=K.toDataURL(l.type,l.quality)}catch(e){if("anonymous"!==t.crossOrigin)return t.crossOrigin="anonymous",void(t.complete&&0!==t.naturalWidth?i():t.addEventListener("load",i));console.warn(`Cannot inline img src=${r}! Error: ${e}`)}"anonymous"===t.crossOrigin&&(n?y.crossOrigin=n:t.removeAttribute("crossorigin"))};t.complete&&0!==t.naturalWidth?i():t.addEventListener("load",i)}if("audio"===g||"video"===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}d||(e.scrollLeft&&(y.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(y.rr_scrollTop=e.scrollTop));if(m){const{width:t,height:s}=e.getBoundingClientRect();y={class:y.class,rr_width:`${t}px`,rr_height:`${s}px`}}"iframe"!==g||u(y.src)||(e.contentDocument||(y.rr_src=y.src),delete y.src);let v;try{customElements.get(g)&&(v=!0)}catch(e){}return{type:f.Element,tagName:g,attributes:y,childNodes:[],isSVG:Z(e)||void 0,needBlock:m,rootId:p,isCustom:v}}(e,{doc:s,blockClass:n,blockSelector:i,inlineStylesheet:a,maskInputOptions:l,maskInputFn:h,dataURLOptions:u,inlineImages:d,recordCanvas:p,keepIframeSrcFn:m,newlyAddedElement:g,rootId:y});case e.TEXT_NODE:return function(e,t){var s;const{needsMask:r,maskTextFn:n,rootId:i}=t,o=k.parentNode(e),a=o&&o.tagName;let l=k.textContent(e);const c="STYLE"===a||void 0,h="SCRIPT"===a||void 0;if(c&&l){try{e.nextSibling||e.previousSibling||(null==(s=o.sheet)?void 0:s.cssRules)&&(l=T(o.sheet))}catch(t){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${t}`,e)}l=$(l,J(t.doc))}h&&(l="SCRIPT_PLACEHOLDER");!c&&!h&&l&&r&&(l=n?n(l,k.parentElement(e)):l.replace(/[\S]/g,"*"));return{type:f.Text,textContent:l||"",isStyle:c,rootId:i}}(e,{doc:s,needsMask:o,maskTextFn:c,rootId:y});case e.CDATA_SECTION_NODE:return{type:f.CDATA,textContent:"",rootId:y};case e.COMMENT_NODE:return{type:f.Comment,textContent:k.textContent(e)||"",rootId:y};default:return!1}}function re(e){return null==e?"":e.toLowerCase()}function ne(e,t){const{doc:s,mirror:r,blockClass:n,blockSelector:i,maskTextClass:o,maskTextSelector:a,skipChild:l=!1,inlineStylesheet:c=!0,maskInputOptions:h={},maskTextFn:u,maskInputFn:d,slimDOMOptions:p,dataURLOptions:m={},inlineImages:g=!1,recordCanvas:y=!1,onSerialize:w,onIframeLoad:v,iframeLoadTimeout:S=5e3,onStylesheetLoad:b,stylesheetLoadTimeout:C=5e3,keepIframeSrcFn:I=()=>!1,newlyAddedElement:T=!1}=t;let{needsMask:R}=t,{preserveWhiteSpace:M=!0}=t;if(!R){R=te(e,o,a,void 0===R)}const _=se(e,{doc:s,mirror:r,blockClass:n,blockSelector:i,needsMask:R,inlineStylesheet:c,maskInputOptions:h,maskTextFn:u,maskInputFn:d,dataURLOptions:m,inlineImages:g,recordCanvas:y,keepIframeSrcFn:I,newlyAddedElement:T});if(!_)return console.warn(e,"not serialized"),null;let A;A=r.hasNode(e)?r.getId(e):!function(e,t){if(t.comment&&e.type===f.Comment)return!0;if(e.type===f.Element){if(t.script&&("script"===e.tagName||"link"===e.tagName&&("preload"===e.attributes.rel||"modulepreload"===e.attributes.rel)&&"script"===e.attributes.as||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&"js"===F(e.attributes.href)))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(re(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===re(e.attributes.name)||"icon"===re(e.attributes.rel)||"apple-touch-icon"===re(e.attributes.rel)||"shortcut icon"===re(e.attributes.rel))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&re(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(re(e.attributes.property).match(/^(og|twitter|fb):/)||re(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===re(e.attributes.name)))return!0;if(t.headMetaRobots&&("robots"===re(e.attributes.name)||"googlebot"===re(e.attributes.name)||"bingbot"===re(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&("author"===re(e.attributes.name)||"generator"===re(e.attributes.name)||"framework"===re(e.attributes.name)||"publisher"===re(e.attributes.name)||"progid"===re(e.attributes.name)||re(e.attributes.property).match(/^article:/)||re(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&("google-site-verification"===re(e.attributes.name)||"yandex-verification"===re(e.attributes.name)||"csrf-token"===re(e.attributes.name)||"p:domain_verify"===re(e.attributes.name)||"verify-v1"===re(e.attributes.name)||"verification"===re(e.attributes.name)||"shopify-checkout-api-token"===re(e.attributes.name)))return!0}}return!1}(_,p)&&(M||_.type!==f.Text||_.isStyle||_.textContent.replace(/^\s+|\s+$/gm,"").length)?W():-2;const P=Object.assign(_,{id:A});if(r.add(e,P),-2===A)return null;w&&w(e);let N=!l;if(P.type===f.Element){N=N&&!P.needBlock,delete P.needBlock;const t=k.shadowRoot(e);t&&O(t)&&(P.isShadowHost=!0)}if((P.type===f.Document||P.type===f.Element)&&N){p.headWhitespace&&P.type===f.Element&&"head"===P.tagName&&(M=!1);const t={doc:s,mirror:r,blockClass:n,blockSelector:i,needsMask:R,maskTextClass:o,maskTextSelector:a,skipChild:l,inlineStylesheet:c,maskInputOptions:h,maskTextFn:u,maskInputFn:d,slimDOMOptions:p,dataURLOptions:m,inlineImages:g,recordCanvas:y,preserveWhiteSpace:M,onSerialize:w,onIframeLoad:v,iframeLoadTimeout:S,onStylesheetLoad:b,stylesheetLoadTimeout:C,keepIframeSrcFn:I};if(P.type===f.Element&&"textarea"===P.tagName&&void 0!==P.attributes.value);else for(const s of Array.from(k.childNodes(e))){const e=ne(s,t);e&&P.childNodes.push(e)}let x=null;if(E(e)&&(x=k.shadowRoot(e)))for(const e of Array.from(k.childNodes(x))){const s=ne(e,t);s&&(O(x)&&(s.isShadow=!0),P.childNodes.push(s))}}const L=k.parentNode(e);return L&&x(L)&&O(L)&&(P.isShadow=!0),P.type===f.Element&&"iframe"===P.tagName&&function(e,t,s){const r=e.contentWindow;if(!r)return;let n,i=!1;try{n=r.document.readyState}catch(e){return}if("complete"!==n){const r=setTimeout(()=>{i||(t(),i=!0)},s);return void e.addEventListener("load",()=>{clearTimeout(r),i=!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&&v){const s=ne(t,{doc:t,mirror:r,blockClass:n,blockSelector:i,needsMask:R,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:h,maskTextFn:u,maskInputFn:d,slimDOMOptions:p,dataURLOptions:m,inlineImages:g,recordCanvas:y,preserveWhiteSpace:M,onSerialize:w,onIframeLoad:v,iframeLoadTimeout:S,onStylesheetLoad:b,stylesheetLoadTimeout:C,keepIframeSrcFn:I});s&&v(e,s)}},S),P.type===f.Element&&"link"===P.tagName&&"string"==typeof P.attributes.rel&&("stylesheet"===P.attributes.rel||"preload"===P.attributes.rel&&"string"==typeof P.attributes.href&&"css"===F(P.attributes.href))&&function(e,t,s){let r,n=!1;try{r=e.sheet}catch(e){return}if(r)return;const i=setTimeout(()=>{n||(t(),n=!0)},s);e.addEventListener("load",()=>{clearTimeout(i),n=!0,t()})}(e,()=>{if(b){const t=ne(e,{doc:s,mirror:r,blockClass:n,blockSelector:i,needsMask:R,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:h,maskTextFn:u,maskInputFn:d,slimDOMOptions:p,dataURLOptions:m,inlineImages:g,recordCanvas:y,preserveWhiteSpace:M,onSerialize:w,onIframeLoad:v,iframeLoadTimeout:S,onStylesheetLoad:b,stylesheetLoadTimeout:C,keepIframeSrcFn:I});t&&b(e,t)}},C),P}function ie(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function oe(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 ae={exports:{}},le=String,ce=function(){return{isColorSupported:!1,reset:le,bold:le,dim:le,italic:le,underline:le,inverse:le,hidden:le,strikethrough:le,black:le,red:le,green:le,yellow:le,blue:le,magenta:le,cyan:le,white:le,gray:le,bgBlack:le,bgRed:le,bgGreen:le,bgYellow:le,bgBlue:le,bgMagenta:le,bgCyan:le,bgWhite:le}};ae.exports=ce(),ae.exports.createColors=ce;var he=ae.exports;const ue=oe(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));let de=he,pe=ue,me=class e extends Error{constructor(t,s,r,n,i,o){super(t),this.name="CssSyntaxError",this.reason=t,i&&(this.file=i),n&&(this.source=n),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=de.isColorSupported),pe&&e&&(t=pe(t));let s,r,n=t.split(/\r?\n/),i=Math.max(this.line-3,0),o=Math.min(this.line+2,n.length),a=String(o).length;if(e){let{bold:e,gray:t,red:n}=de.createColors(!0);s=t=>e(n(t)),r=e=>t(e)}else s=r=e=>e;return n.slice(i,o).map((e,t)=>{let n=i+1+t,o=" "+(" "+n).slice(-a)+" | ";if(n===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 fe=me;me.default=me;var ge={};ge.isClean=Symbol("isClean"),ge.my=Symbol("my");const ye={after:"\n",beforeClose:"\n",beforeComment:"\n",beforeDecl:"\n",beforeOpen:" ",beforeRule:"\n",colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};let we=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 n=(e.raws.between||"")+(t?";":"");this.builder(s+r+n,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,n=0;for(;r&&"root"!==r.type;)n+=1,r=r.parent;if(s.includes("\n")){let t=this.raw(e,null,"indent");if(t.length)for(let e=0;e<n;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 n=e.nodes[r],i=this.raw(n,"before");i&&this.builder(i),this.stringify(n,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 n=e.parent;if("before"===s){if(!n||"root"===n.type&&n.first===e)return"";if(n&&"document"===n.type)return""}if(!n)return ye[s];let i=e.root();if(i.rawCache||(i.rawCache={}),void 0!==i.rawCache[s])return i.rawCache[s];if("before"===s||"after"===s)return this.beforeAfter(e,s);{let n="raw"+((o=s)[0].toUpperCase()+o.slice(1));this[n]?r=this[n](i,e):i.walk(e=>{if(r=e.raws[t],void 0!==r)return!1})}var o;return void 0===r&&(r=ye[s]),i.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 ve=we;we.default=we;let Se=ve;function be(e,t){new Se(t).stringify(e)}var Ce=be;be.default=be;let{isClean:Ie,my:ke}=ge,Ee=fe,xe=ve,Oe=Ce;function Te(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 n=e[r],i=typeof n;"parent"===r&&"object"===i?t&&(s[r]=t):"source"===r?s[r]=n:Array.isArray(n)?s[r]=n.map(e=>Te(e,s)):("object"===i&&null!==n&&(n=Te(n)),s[r]=n)}return s}let Re=class{constructor(e={}){this.raws={},this[Ie]=!1,this[ke]=!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=Te(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 Ee(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[Ie]){this[Ie]=!1;let e=this;for(;e=e.parent;)e[Ie]=!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,n=this.source.start.line;for(let t=0;t<e;t++)"\n"===s[t]?(r=1,n+=1):r+=1;return{column:r,line:n}}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(),n=r.indexOf(e.word);-1!==n&&(t=this.positionInside(n,r),s=this.positionInside(n+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 xe).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 n=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 i=t.get(r.input);null==i&&(i=n,t.set(r.input,n),n++),s[e]={end:r.end,inputId:i,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=Oe){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 Me=Re;Re.default=Re;let _e=Me,Ae=class extends _e{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 Pe=Ae;Ae.default=Ae;var Ne={nanoid:(e=21)=>{let t="",s=e;for(;s--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t}};let{SourceMapConsumer:Fe,SourceMapGenerator:Le}=ue,{existsSync:De,readFileSync:Ue}=ue,{dirname:Be,join:$e}=ue;let ze=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=Be(this.mapFile)),r&&(this.text=r)}consumer(){return this.consumerCache||(this.consumerCache=new Fe(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=Be(e),De(e))return this.mapFile=e,Ue(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 Fe)return Le.fromSourceMap(t).toString();if(t instanceof Le)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=$e(Be(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 je=ze;ze.default=ze;let{SourceMapConsumer:We,SourceMapGenerator:Ke}=ue,{fileURLToPath:Ve,pathToFileURL:Ge}=ue,{isAbsolute:He,resolve:Ye}=ue,{nanoid:qe}=Ne,Ze=ue,Je=fe,Qe=je,Xe=Symbol("fromOffsetCache"),et=Boolean(We&&Ke),tt=Boolean(Ye&&He),st=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&&(!tt||/^\w+:\/\//.test(t.from)||He(t.from)?this.file=t.from:this.file=Ye(t.from)),tt&&et){let e=new Qe(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 "+qe(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,s,r={}){let n,i,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);i=e.line,o=e.col}else i=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,i,o);return n=a?new Je(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 Je(e,void 0===i?t:{column:s,line:t},void 0===i?s:{column:o,line:i},this.css,this.file,r.plugin),n.input={column:s,endColumn:o,endLine:i,line:t,source:this.css},this.file&&(Ge&&(n.input.url=Ge(this.file).toString()),n.input.file=this.file),n}fromOffset(e){let t,s;if(this[Xe])s=this[Xe];else{let e=this.css.split("\n");s=new Array(e.length);let t=0;for(let r=0,n=e.length;r<n;r++)s[r]=t,t+=e[r].length+1;this[Xe]=s}t=s[s.length-1];let r=0;if(e>=t)r=s.length-1;else{let t,n=s.length-2;for(;r<n;)if(t=r+(n-r>>1),e<s[t])n=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:Ye(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,s,r){if(!this.map)return!1;let n,i,o=this.map.consumer(),a=o.originalPositionFor({column:t,line:e});if(!a.source)return!1;"number"==typeof s&&(n=o.originalPositionFor({column:r,line:s})),i=He(a.source)?Ge(a.source):new URL(a.source,this.map.consumer().sourceRoot||Ge(this.map.mapFile));let l={column:a.column,endColumn:n&&n.column,endLine:n&&n.line,line:a.line,url:i.toString()};if("file:"===i.protocol){if(!Ve)throw new Error("file: protocol is not available in this PostCSS build");l.file=Ve(i)}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 rt=st;st.default=st,Ze&&Ze.registerInput&&Ze.registerInput(st);let{SourceMapConsumer:nt,SourceMapGenerator:it}=ue,{dirname:ot,relative:at,resolve:lt,sep:ct}=ue,{pathToFileURL:ht}=ue,ut=rt,dt=Boolean(nt&&it),pt=Boolean(ot&<&&at&&ct);var mt=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||ot(e.file);!1===this.mapOpts.sourcesContent?(t=new nt(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(),pt&&dt&&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=it.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new it({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 it({file:this.outputFile(),ignoreInvalidMapping:!0});let e,t,s=1,r=1,n="<no source>",i={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&&(i.generated.line=s,i.generated.column=r-1,a.source&&a.source.start?(i.source=this.sourcePath(a),i.original.line=a.source.start.line,i.original.column=a.source.start.column-1,this.map.addMapping(i)):(i.source=n,i.original.line=1,i.original.column=0,this.map.addMapping(i))),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?(i.source=this.sourcePath(a),i.original.line=a.source.end.line,i.original.column=a.source.end.column-1,i.generated.line=s,i.generated.column=r-2,this.map.addMapping(i)):(i.source=n,i.original.line=1,i.original.column=0,i.generated.line=s,i.generated.column=r-1,this.map.addMapping(i)))}})}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?ot(this.opts.to):".";"string"==typeof this.mapOpts.annotation&&(s=ot(lt(s,this.mapOpts.annotation)));let r=at(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 ut(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(ht){let t=ht(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;"\\"===ct&&(e=e.replace(/\\/g,"/"));let s=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,s),s}};let ft=Me,gt=class extends ft{constructor(e){super(e),this.type="comment"}};var yt=gt;gt.default=gt;let wt,vt,St,bt,{isClean:Ct,my:It}=ge,kt=Pe,Et=yt,xt=Me;function Ot(e){return e.map(e=>(e.nodes&&(e.nodes=Ot(e.nodes)),delete e.source,e))}function Tt(e){if(e[Ct]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)Tt(t)}let Rt=class e extends xt{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),n=this.normalize(t,this.proxyOf.nodes[r]).reverse();r=this.index(e);for(let e of n)this.proxyOf.nodes.splice(r+1,0,e);for(let e in this.indexes)s=this.indexes[e],r<s&&(this.indexes[e]=s+n.length);return this.markDirty(),this}insertBefore(e,t){let s,r=this.index(e),n=0===r&&"prepend",i=this.normalize(t,this.proxyOf.nodes[r],n).reverse();r=this.index(e);for(let e of i)this.proxyOf.nodes.splice(r,0,e);for(let e in this.indexes)s=this.indexes[e],r<=s&&(this.indexes[e]=s+i.length);return this.markDirty(),this}normalize(t,s){if("string"==typeof t)t=Ot(wt(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 kt(t)]}else if(t.selector)t=[new vt(t)];else if(t.name)t=[new St(t)];else{if(!t.text)throw new Error("Unknown node type in node creation");t=[new Et(t)]}return t.map(t=>(t[It]||e.rebuild(t),(t=t.proxyOf).parent&&t.parent.removeChild(t),t[Ct]&&Tt(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]}};Rt.registerParse=e=>{wt=e},Rt.registerRule=e=>{vt=e},Rt.registerAtRule=e=>{St=e},Rt.registerRoot=e=>{bt=e};var Mt=Rt;Rt.default=Rt,Rt.rebuild=e=>{"atrule"===e.type?Object.setPrototypeOf(e,St.prototype):"rule"===e.type?Object.setPrototypeOf(e,vt.prototype):"decl"===e.type?Object.setPrototypeOf(e,kt.prototype):"comment"===e.type?Object.setPrototypeOf(e,Et.prototype):"root"===e.type&&Object.setPrototypeOf(e,bt.prototype),e[It]=!0,e.nodes&&e.nodes.forEach(e=>{Rt.rebuild(e)})};let _t,At,Pt=Mt,Nt=class extends Pt{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(e={}){return new _t(new At,this,e).stringify()}};Nt.registerLazyResult=e=>{_t=e},Nt.registerProcessor=e=>{At=e};var Ft=Nt;Nt.default=Nt;let Lt={};var Dt=function(e){Lt[e]||(Lt[e]=!0,"undefined"!=typeof console&&console.warn&&console.warn(e))};let Ut=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 Bt=Ut;Ut.default=Ut;let $t=Bt,zt=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 $t(e,t);return this.messages.push(s),s}warnings(){return this.messages.filter(e=>"warning"===e.type)}get content(){return this.css}};var jt=zt;zt.default=zt;const Wt="'".charCodeAt(0),Kt='"'.charCodeAt(0),Vt="\\".charCodeAt(0),Gt="/".charCodeAt(0),Ht="\n".charCodeAt(0),Yt=" ".charCodeAt(0),qt="\f".charCodeAt(0),Zt="\t".charCodeAt(0),Jt="\r".charCodeAt(0),Qt="[".charCodeAt(0),Xt="]".charCodeAt(0),es="(".charCodeAt(0),ts=")".charCodeAt(0),ss="{".charCodeAt(0),rs="}".charCodeAt(0),ns=";".charCodeAt(0),is="*".charCodeAt(0),os=":".charCodeAt(0),as="@".charCodeAt(0),ls=/[\t\n\f\r "#'()/;[\\\]{}]/g,cs=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,hs=/.[\r\n"'(/\\]/,us=/[\da-f]/i;let ds=Mt,ps=class extends ds{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 ms=ps;ps.default=ps,ds.registerAtRule(ps);let fs,gs,ys=Mt,ws=class extends ys{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 fs(new gs,this,e).stringify()}};ws.registerLazyResult=e=>{fs=e},ws.registerProcessor=e=>{gs=e};var vs=ws;ws.default=ws,ys.registerRoot(ws);let Ss={comma:e=>Ss.split(e,[","],!0),space:e=>Ss.split(e,[" ","\n","\t"]),split(e,t,s){let r=[],n="",i=!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)&&(i=!0),i?(""!==n&&r.push(n.trim()),n="",i=!1):n+=s;return(s||""!==n)&&r.push(n.trim()),r}};var bs=Ss;Ss.default=Ss;let Cs=Mt,Is=bs,ks=class extends Cs{constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return Is.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 Es=ks;ks.default=ks,Cs.registerRule(ks);let xs=Pe,Os=function(e,t={}){let s,r,n,i,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 Ht:case Yt:case Zt:case Jt:case qt:r=f;do{r+=1,s=d.charCodeAt(r)}while(s===Yt||s===Ht||s===Zt||s===Jt||s===qt);u=["space",d.slice(f,r)],f=r-1;break;case Qt:case Xt:case ss:case rs:case os:case ns:case ts:{let e=String.fromCharCode(s);u=[e,e,f];break}case es:if(c=g.length?g.pop()[1]:"",h=d.charCodeAt(f+1),"url"===c&&h!==Wt&&h!==Kt&&h!==Yt&&h!==Ht&&h!==Zt&&h!==qt&&h!==Jt){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)===Vt;)l-=1,a=!a}while(a);u=["brackets",d.slice(f,r+1),f,r],f=r}else r=d.indexOf(")",f+1),i=d.slice(f,r+1),-1===r||hs.test(i)?u=["(","(",f]:(u=["brackets",i,f,r],f=r);break;case Wt:case Kt:n=s===Wt?"'":'"',r=f;do{if(a=!1,r=d.indexOf(n,r+1),-1===r){if(p||t){r=f+1;break}w("string")}for(l=r;d.charCodeAt(l-1)===Vt;)l-=1,a=!a}while(a);u=["string",d.slice(f,r+1),f,r],f=r;break;case as:ls.lastIndex=f+1,ls.test(d),r=0===ls.lastIndex?d.length-1:ls.lastIndex-2,u=["at-word",d.slice(f,r+1),f,r],f=r;break;case Vt:for(r=f,o=!0;d.charCodeAt(r+1)===Vt;)r+=1,o=!o;if(s=d.charCodeAt(r+1),o&&s!==Gt&&s!==Yt&&s!==Ht&&s!==Zt&&s!==Jt&&s!==qt&&(r+=1,us.test(d.charAt(r)))){for(;us.test(d.charAt(r+1));)r+=1;d.charCodeAt(r+1)===Yt&&(r+=1)}u=["word",d.slice(f,r+1),f,r],f=r;break;default:s===Gt&&d.charCodeAt(f+1)===is?(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):(cs.lastIndex=f+1,cs.test(d),r=0===cs.lastIndex?d.length-1:cs.lastIndex-2,u=["word",d.slice(f,r+1),f,r],g.push(u),f=r)}return f++,u},position:function(){return f}}},Ts=yt,Rs=ms,Ms=vs,_s=Es;const As={empty:!0,space:!0};let Ps=Mt,Ns=class{constructor(e){this.input=e,this.root=new Ms,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,n=new Rs;n.name=e[1].slice(1),""===n.name&&this.unnamedAtrule(n,e),this.init(n,e[2]);let i=!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){n.source.end=this.getPosition(e[2]),n.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&&(n.source.end=this.getPosition(s[3]||s[2]),n.source.end.offset++)}this.end(e);break}a.push(e)}else a.push(e);if(this.tokenizer.endOfFile()){i=!0;break}}n.raws.between=this.spacesAndCommentsFromEnd(a),a.length?(n.raws.afterName=this.spacesAndCommentsFromStart(a),this.raw(n,"params",a),i&&(e=a[a.length-1],n.source.end=this.getPosition(e[3]||e[2]),n.source.end.offset++,this.spaces=n.raws.between,n.raws.between="")):(n.raws.afterName="",n.params=""),o&&(n.nodes=[],this.current=n)}checkMissedSemicolon(e){let t=this.colon(e);if(!1===t)return;let s,r=0;for(let n=t-1;n>=0&&(s=e[n],"space"===s[0]||(r+=1,2!==r));n--);throw this.input.error("Missed semicolon","word"===s[0]?s[3]+1:s[2])}colon(e){let t,s,r,n=0;for(let[i,o]of e.entries()){if(t=o,s=t[0],"("===s&&(n+=1),")"===s&&(n-=1),0===n&&":"===s){if(r){if("word"===r[0]&&"progid"===r[1])continue;return i}this.doubleColon(t)}r=t}return!1}comment(e){let t=new Ts;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=Os(this.input)}decl(e,t){let s=new xs;this.init(s,e[0][2]);let r,n=e[e.length-1];for(";"===n[0]&&(this.semicolon=!0,e.pop()),s.source.end=this.getPosition(n[3]||n[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 i,o=[];for(;e.length&&(i=e[0][0],"space"===i||"comment"===i);)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),n="";for(let e=t;e>0;e--){let t=r[e][0];if(0===n.trim().indexOf("!")&&"space"!==t)break;n=r.pop()[1]+n}0===n.trim().indexOf("!")&&(s.important=!0,s.raws.important=n,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 _s;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,n=null,i=[],o=e[1].startsWith("--"),a=[],l=e;for(;l;){if(s=l[0],a.push(l),"("===s||"["===s)n||(n=l),i.push("("===s?")":"]");else if(o&&r&&"{"===s)n||(n=l),i.push("}");else if(0===i.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===i[i.length-1]&&(i.pop(),0===i.length&&(n=null));l=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),i.length>0&&this.unclosedBracket(n),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 n,i,o,a,l=s.length,c="",h=!0;for(let e=0;e<l;e+=1)n=s[e],i=n[0],"space"!==i||e!==l-1||r?"comment"===i?(a=s[e-1]?s[e-1][0]:"empty",o=s[e+1]?s[e+1][0]:"empty",As[a]||As[o]||","===c.slice(-1)?h=!1:c+=n[1]):c+=n[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 _s;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})}},Fs=rt;function Ls(e,t){let s=new Fs(e,t),r=new Ns(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 Ds=Ls;Ls.default=Ls,Ps.registerParse(Ls);let{isClean:Us,my:Bs}=ge,$s=mt,zs=Ce,js=Mt,Ws=Ft,Ks=Dt,Vs=jt,Gs=Ds,Hs=vs;const Ys={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},qs={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},Zs={Once:!0,postcssPlugin:!0,prepare:!0};function Js(e){return"object"==typeof e&&"function"==typeof e.then}function Qs(e){let t=!1,s=Ys[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 Xs(e){let t;return t="document"===e.type?["Document",0,"DocumentExit"]:"root"===e.type?["Root",0,"RootExit"]:Qs(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function er(e){return e[Us]=!1,e.nodes&&e.nodes.forEach(e=>er(e)),e}let tr={},sr=class e{constructor(t,s,r){let n;if(this.stringified=!1,this.processed=!1,"object"!=typeof s||null===s||"root"!==s.type&&"document"!==s.type)if(s instanceof e||s instanceof Vs)n=er(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=Gs;r.syntax&&(e=r.syntax.parse),r.parser&&(e=r.parser),e.parse&&(e=e.parse);try{n=e(s,r)}catch(e){this.processed=!0,this.error=e}n&&!n[Bs]&&js.rebuild(n)}else n=er(s);this.result=new Vs(t,n,r),this.helpers={...tr,postcss:tr,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,n=t.split("."),i=r.split(".");(n[0]!==i[0]||parseInt(n[1])>parseInt(i[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(!qs[s]&&/^[A-Z]/.test(s))throw new Error(`Unknown event ${s} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!Zs[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(Js(s))try{await s}catch(e){throw this.handleError(e)}}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[Us];){e[Us]=!0;let t=[Xs(e)];for(;t.length>0;){let e=this.visitTick(t);if(Js(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 Js(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=zs;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let s=new $s(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(Js(this.runOnRoot(e)))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[Us];)e[Us]=!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||Ks("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(Js(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,n]=r[t.visitorIndex];t.visitorIndex+=1,t.visitorIndex===r.length&&(t.visitors=[],t.visitorIndex=0),this.result.lastPlugin=e;try{return n(s.toProxy(),this.helpers)}catch(e){throw this.handleError(e,s)}}if(0!==t.iterator){let r,n=t.iterator;for(;r=s.nodes[s.indexes[n]];)if(s.indexes[n]+=1,!r[Us])return r[Us]=!0,void e.push(Xs(r));t.iterator=0,delete s.indexes[n]}let n=t.events;for(;t.eventIndex<n.length;){let e=n[t.eventIndex];if(t.eventIndex+=1,0===e)return void(s.nodes&&s.nodes.length&&(s[Us]=!0,t.iterator=s.getIterator()));if(this.listeners[e])return void(t.visitors=this.listeners[e])}e.pop()}walkSync(e){e[Us]=!0;let t=Qs(e);for(let s of t)if(0===s)e.nodes&&e.each(e=>{e[Us]||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"}};sr.registerPostcss=e=>{tr=e};var rr=sr;sr.default=sr,Hs.registerLazyResult(sr),Ws.registerLazyResult(sr);let nr=mt,ir=Ce,or=Dt,ar=Ds;const lr=jt;let cr=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 n=ir;this.result=new lr(this._processor,r,this._opts),this.result.css=t;let i=this;Object.defineProperty(this.result,"root",{get:()=>i.root});let o=new nr(n,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||or("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=ar;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 hr=cr;cr.default=cr;let ur=hr,dr=rr,pr=Ft,mr=vs,fr=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 dr(this,e,t):new ur(this,e,t)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}};var gr=fr;fr.default=fr,mr.registerProcessor(fr),pr.registerProcessor(fr);let yr=Pe,wr=je,vr=yt,Sr=ms,br=rt,Cr=vs,Ir=Es;function kr(e,t){if(Array.isArray(e))return e.map(e=>kr(e));let{inputs:s,...r}=e;if(s){t=[];for(let e of s){let s={...e,__proto__:br.prototype};s.map&&(s.map={...s.map,__proto__:wr.prototype}),t.push(s)}}if(r.nodes&&(r.nodes=e.nodes.map(e=>kr(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 Cr(r);if("decl"===r.type)return new yr(r);if("rule"===r.type)return new Ir(r);if("comment"===r.type)return new vr(r);if("atrule"===r.type)return new Sr(r);throw new Error("Unknown node type: "+e.type)}var Er=kr;kr.default=kr;let xr=fe,Or=Pe,Tr=rr,Rr=Mt,Mr=gr,_r=Ce,Ar=Er,Pr=Ft,Nr=Bt,Fr=yt,Lr=ms,Dr=jt,Ur=rt,Br=Ds,$r=bs,zr=Es,jr=vs,Wr=Me;function Kr(...e){return 1===e.length&&Array.isArray(e[0])&&(e=e[0]),new Mr(e)}Kr.plugin=function(e,t){let s,r=!1;function n(...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 n=t(...s);return n.postcssPlugin=e,n.postcssVersion=(new Mr).version,n}return Object.defineProperty(n,"postcss",{get:()=>(s||(s=n()),s)}),n.process=function(e,t,s){return Kr([n(s)]).process(e,t)},n},Kr.stringify=_r,Kr.parse=Br,Kr.fromJSON=Ar,Kr.list=$r,Kr.comment=e=>new Fr(e),Kr.atRule=e=>new Lr(e),Kr.decl=e=>new Or(e),Kr.rule=e=>new zr(e),Kr.root=e=>new jr(e),Kr.document=e=>new Pr(e),Kr.CssSyntaxError=xr,Kr.Declaration=Or,Kr.Container=Rr,Kr.Processor=Mr,Kr.Document=Pr,Kr.Comment=Fr,Kr.Warning=Nr,Kr.AtRule=Lr,Kr.Result=Dr,Kr.Input=Ur,Kr.Rule=zr,Kr.Root=jr,Kr.Node=Wr,Tr.registerPostcss(Kr);var Vr=Kr;Kr.default=Kr;const Gr=ie(Vr);Gr.stringify,Gr.fromJSON,Gr.plugin,Gr.parse,Gr.list,Gr.document,Gr.comment,Gr.atRule,Gr.rule,Gr.decl,Gr.root,Gr.CssSyntaxError,Gr.Declaration,Gr.Container,Gr.Processor,Gr.Document,Gr.Comment,Gr.Warning,Gr.AtRule,Gr.Result,Gr.Input,Gr.Rule,Gr.Root,Gr.Node;var Hr=Object.defineProperty,Yr=(e,t,s)=>((e,t,s)=>t in e?Hr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s)(e,"symbol"!=typeof t?t+"":t,s);function qr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Zr(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 Jr={exports:{}},Qr=String,Xr=function(){return{isColorSupported:!1,reset:Qr,bold:Qr,dim:Qr,italic:Qr,underline:Qr,inverse:Qr,hidden:Qr,strikethrough:Qr,black:Qr,red:Qr,green:Qr,yellow:Qr,blue:Qr,magenta:Qr,cyan:Qr,white:Qr,gray:Qr,bgBlack:Qr,bgRed:Qr,bgGreen:Qr,bgYellow:Qr,bgBlue:Qr,bgMagenta:Qr,bgCyan:Qr,bgWhite:Qr}};Jr.exports=Xr(),Jr.exports.createColors=Xr;var en=Jr.exports;const tn=Zr(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));let sn=en,rn=tn,nn=class e extends Error{constructor(t,s,r,n,i,o){super(t),this.name="CssSyntaxError",this.reason=t,i&&(this.file=i),n&&(this.source=n),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=sn.isColorSupported),rn&&e&&(t=rn(t));let s,r,n=t.split(/\r?\n/),i=Math.max(this.line-3,0),o=Math.min(this.line+2,n.length),a=String(o).length;if(e){let{bold:e,gray:t,red:n}=sn.createColors(!0);s=t=>e(n(t)),r=e=>t(e)}else s=r=e=>e;return n.slice(i,o).map((e,t)=>{let n=i+1+t,o=" "+(" "+n).slice(-a)+" | ";if(n===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 on=nn;nn.default=nn;var an={};an.isClean=Symbol("isClean"),an.my=Symbol("my");const ln={after:"\n",beforeClose:"\n",beforeComment:"\n",beforeDecl:"\n",beforeOpen:" ",beforeRule:"\n",colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};let cn=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 n=(e.raws.between||"")+(t?";":"");this.builder(s+r+n,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,n=0;for(;r&&"root"!==r.type;)n+=1,r=r.parent;if(s.includes("\n")){let t=this.raw(e,null,"indent");if(t.length)for(let e=0;e<n;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 n=e.nodes[r],i=this.raw(n,"before");i&&this.builder(i),this.stringify(n,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 n=e.parent;if("before"===s){if(!n||"root"===n.type&&n.first===e)return"";if(n&&"document"===n.type)return""}if(!n)return ln[s];let i=e.root();if(i.rawCache||(i.rawCache={}),void 0!==i.rawCache[s])return i.rawCache[s];if("before"===s||"after"===s)return this.beforeAfter(e,s);{let n="raw"+((o=s)[0].toUpperCase()+o.slice(1));this[n]?r=this[n](i,e):i.walk(e=>{if(r=e.raws[t],void 0!==r)return!1})}var o;return void 0===r&&(r=ln[s]),i.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 hn=cn;cn.default=cn;let un=hn;function dn(e,t){new un(t).stringify(e)}var pn=dn;dn.default=dn;let{isClean:mn,my:fn}=an,gn=on,yn=hn,wn=pn;function vn(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 n=e[r],i=typeof n;"parent"===r&&"object"===i?t&&(s[r]=t):"source"===r?s[r]=n:Array.isArray(n)?s[r]=n.map(e=>vn(e,s)):("object"===i&&null!==n&&(n=vn(n)),s[r]=n)}return s}let Sn=class{constructor(e={}){this.raws={},this[mn]=!1,this[fn]=!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=vn(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 gn(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[mn]){this[mn]=!1;let e=this;for(;e=e.parent;)e[mn]=!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,n=this.source.start.line;for(let t=0;t<e;t++)"\n"===s[t]?(r=1,n+=1):r+=1;return{column:r,line:n}}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(),n=r.indexOf(e.word);-1!==n&&(t=this.positionInside(n,r),s=this.positionInside(n+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 yn).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 n=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 i=t.get(r.input);null==i&&(i=n,t.set(r.input,n),n++),s[e]={end:r.end,inputId:i,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=wn){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 bn=Sn;Sn.default=Sn;let Cn=bn,In=class extends Cn{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 kn=In;In.default=In;var En={nanoid:(e=21)=>{let t="",s=e;for(;s--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t}};let{SourceMapConsumer:xn,SourceMapGenerator:On}=tn,{existsSync:Tn,readFileSync:Rn}=tn,{dirname:Mn,join:_n}=tn;let An=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=Mn(this.mapFile)),r&&(this.text=r)}consumer(){return this.consumerCache||(this.consumerCache=new xn(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=Mn(e),Tn(e))return this.mapFile=e,Rn(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 xn)return On.fromSourceMap(t).toString();if(t instanceof On)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=_n(Mn(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 Pn=An;An.default=An;let{SourceMapConsumer:Nn,SourceMapGenerator:Fn}=tn,{fileURLToPath:Ln,pathToFileURL:Dn}=tn,{isAbsolute:Un,resolve:Bn}=tn,{nanoid:$n}=En,zn=tn,jn=on,Wn=Pn,Kn=Symbol("fromOffsetCache"),Vn=Boolean(Nn&&Fn),Gn=Boolean(Bn&&Un),Hn=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&&(!Gn||/^\w+:\/\//.test(t.from)||Un(t.from)?this.file=t.from:this.file=Bn(t.from)),Gn&&Vn){let e=new Wn(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 "+$n(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,s,r={}){let n,i,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);i=e.line,o=e.col}else i=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,i,o);return n=a?new jn(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 jn(e,void 0===i?t:{column:s,line:t},void 0===i?s:{column:o,line:i},this.css,this.file,r.plugin),n.input={column:s,endColumn:o,endLine:i,line:t,source:this.css},this.file&&(Dn&&(n.input.url=Dn(this.file).toString()),n.input.file=this.file),n}fromOffset(e){let t,s;if(this[Kn])s=this[Kn];else{let e=this.css.split("\n");s=new Array(e.length);let t=0;for(let r=0,n=e.length;r<n;r++)s[r]=t,t+=e[r].length+1;this[Kn]=s}t=s[s.length-1];let r=0;if(e>=t)r=s.length-1;else{let t,n=s.length-2;for(;r<n;)if(t=r+(n-r>>1),e<s[t])n=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:Bn(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,s,r){if(!this.map)return!1;let n,i,o=this.map.consumer(),a=o.originalPositionFor({column:t,line:e});if(!a.source)return!1;"number"==typeof s&&(n=o.originalPositionFor({column:r,line:s})),i=Un(a.source)?Dn(a.source):new URL(a.source,this.map.consumer().sourceRoot||Dn(this.map.mapFile));let l={column:a.column,endColumn:n&&n.column,endLine:n&&n.line,line:a.line,url:i.toString()};if("file:"===i.protocol){if(!Ln)throw new Error("file: protocol is not available in this PostCSS build");l.file=Ln(i)}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 Yn=Hn;Hn.default=Hn,zn&&zn.registerInput&&zn.registerInput(Hn);let{SourceMapConsumer:qn,SourceMapGenerator:Zn}=tn,{dirname:Jn,relative:Qn,resolve:Xn,sep:ei}=tn,{pathToFileURL:ti}=tn,si=Yn,ri=Boolean(qn&&Zn),ni=Boolean(Jn&&Xn&&Qn&&ei);var ii=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||Jn(e.file);!1===this.mapOpts.sourcesContent?(t=new qn(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(),ni&&ri&&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=Zn.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new Zn({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 Zn({file:this.outputFile(),ignoreInvalidMapping:!0});let e,t,s=1,r=1,n="<no source>",i={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&&(i.generated.line=s,i.generated.column=r-1,a.source&&a.source.start?(i.source=this.sourcePath(a),i.original.line=a.source.start.line,i.original.column=a.source.start.column-1,this.map.addMapping(i)):(i.source=n,i.original.line=1,i.original.column=0,this.map.addMapping(i))),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?(i.source=this.sourcePath(a),i.original.line=a.source.end.line,i.original.column=a.source.end.column-1,i.generated.line=s,i.generated.column=r-2,this.map.addMapping(i)):(i.source=n,i.original.line=1,i.original.column=0,i.generated.line=s,i.generated.column=r-1,this.map.addMapping(i)))}})}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?Jn(this.opts.to):".";"string"==typeof this.mapOpts.annotation&&(s=Jn(Xn(s,this.mapOpts.annotation)));let r=Qn(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 si(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(ti){let t=ti(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;"\\"===ei&&(e=e.replace(/\\/g,"/"));let s=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,s),s}};let oi=bn,ai=class extends oi{constructor(e){super(e),this.type="comment"}};var li=ai;ai.default=ai;let ci,hi,ui,di,{isClean:pi,my:mi}=an,fi=kn,gi=li,yi=bn;function wi(e){return e.map(e=>(e.nodes&&(e.nodes=wi(e.nodes)),delete e.source,e))}function vi(e){if(e[pi]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)vi(t)}let Si=class e extends yi{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),n=this.normalize(t,this.proxyOf.nodes[r]).reverse();r=this.index(e);for(let e of n)this.proxyOf.nodes.splice(r+1,0,e);for(let e in this.indexes)s=this.indexes[e],r<s&&(this.indexes[e]=s+n.length);return this.markDirty(),this}insertBefore(e,t){let s,r=this.index(e),n=0===r&&"prepend",i=this.normalize(t,this.proxyOf.nodes[r],n).reverse();r=this.index(e);for(let e of i)this.proxyOf.nodes.splice(r,0,e);for(let e in this.indexes)s=this.indexes[e],r<=s&&(this.indexes[e]=s+i.length);return this.markDirty(),this}normalize(t,s){if("string"==typeof t)t=wi(ci(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 fi(t)]}else if(t.selector)t=[new hi(t)];else if(t.name)t=[new ui(t)];else{if(!t.text)throw new Error("Unknown node type in node creation");t=[new gi(t)]}return t.map(t=>(t[mi]||e.rebuild(t),(t=t.proxyOf).parent&&t.parent.removeChild(t),t[pi]&&vi(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]}};Si.registerParse=e=>{ci=e},Si.registerRule=e=>{hi=e},Si.registerAtRule=e=>{ui=e},Si.registerRoot=e=>{di=e};var bi=Si;Si.default=Si,Si.rebuild=e=>{"atrule"===e.type?Object.setPrototypeOf(e,ui.prototype):"rule"===e.type?Object.setPrototypeOf(e,hi.prototype):"decl"===e.type?Object.setPrototypeOf(e,fi.prototype):"comment"===e.type?Object.setPrototypeOf(e,gi.prototype):"root"===e.type&&Object.setPrototypeOf(e,di.prototype),e[mi]=!0,e.nodes&&e.nodes.forEach(e=>{Si.rebuild(e)})};let Ci,Ii,ki=bi,Ei=class extends ki{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(e={}){return new Ci(new Ii,this,e).stringify()}};Ei.registerLazyResult=e=>{Ci=e},Ei.registerProcessor=e=>{Ii=e};var xi=Ei;Ei.default=Ei;let Oi={};var Ti=function(e){Oi[e]||(Oi[e]=!0,"undefined"!=typeof console&&console.warn&&console.warn(e))};let Ri=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 Mi=Ri;Ri.default=Ri;let _i=Mi,Ai=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 _i(e,t);return this.messages.push(s),s}warnings(){return this.messages.filter(e=>"warning"===e.type)}get content(){return this.css}};var Pi=Ai;Ai.default=Ai;const Ni="'".charCodeAt(0),Fi='"'.charCodeAt(0),Li="\\".charCodeAt(0),Di="/".charCodeAt(0),Ui="\n".charCodeAt(0),Bi=" ".charCodeAt(0),$i="\f".charCodeAt(0),zi="\t".charCodeAt(0),ji="\r".charCodeAt(0),Wi="[".charCodeAt(0),Ki="]".charCodeAt(0),Vi="(".charCodeAt(0),Gi=")".charCodeAt(0),Hi="{".charCodeAt(0),Yi="}".charCodeAt(0),qi=";".charCodeAt(0),Zi="*".charCodeAt(0),Ji=":".charCodeAt(0),Qi="@".charCodeAt(0),Xi=/[\t\n\f\r "#'()/;[\\\]{}]/g,eo=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,to=/.[\r\n"'(/\\]/,so=/[\da-f]/i;let ro=bi,no=class extends ro{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 io=no;no.default=no,ro.registerAtRule(no);let oo,ao,lo=bi,co=class extends lo{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 oo(new ao,this,e).stringify()}};co.registerLazyResult=e=>{oo=e},co.registerProcessor=e=>{ao=e};var ho=co;co.default=co,lo.registerRoot(co);let uo={comma:e=>uo.split(e,[","],!0),space:e=>uo.split(e,[" ","\n","\t"]),split(e,t,s){let r=[],n="",i=!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)&&(i=!0),i?(""!==n&&r.push(n.trim()),n="",i=!1):n+=s;return(s||""!==n)&&r.push(n.trim()),r}};var po=uo;uo.default=uo;let mo=bi,fo=po,go=class extends mo{constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return fo.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 yo=go;go.default=go,mo.registerRule(go);let wo=kn,vo=function(e,t={}){let s,r,n,i,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 Ui:case Bi:case zi:case ji:case $i:r=f;do{r+=1,s=d.charCodeAt(r)}while(s===Bi||s===Ui||s===zi||s===ji||s===$i);u=["space",d.slice(f,r)],f=r-1;break;case Wi:case Ki:case Hi:case Yi:case Ji:case qi:case Gi:{let e=String.fromCharCode(s);u=[e,e,f];break}case Vi:if(c=g.length?g.pop()[1]:"",h=d.charCodeAt(f+1),"url"===c&&h!==Ni&&h!==Fi&&h!==Bi&&h!==Ui&&h!==zi&&h!==$i&&h!==ji){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)===Li;)l-=1,a=!a}while(a);u=["brackets",d.slice(f,r+1),f,r],f=r}else r=d.indexOf(")",f+1),i=d.slice(f,r+1),-1===r||to.test(i)?u=["(","(",f]:(u=["brackets",i,f,r],f=r);break;case Ni:case Fi:n=s===Ni?"'":'"',r=f;do{if(a=!1,r=d.indexOf(n,r+1),-1===r){if(p||t){r=f+1;break}w("string")}for(l=r;d.charCodeAt(l-1)===Li;)l-=1,a=!a}while(a);u=["string",d.slice(f,r+1),f,r],f=r;break;case Qi:Xi.lastIndex=f+1,Xi.test(d),r=0===Xi.lastIndex?d.length-1:Xi.lastIndex-2,u=["at-word",d.slice(f,r+1),f,r],f=r;break;case Li:for(r=f,o=!0;d.charCodeAt(r+1)===Li;)r+=1,o=!o;if(s=d.charCodeAt(r+1),o&&s!==Di&&s!==Bi&&s!==Ui&&s!==zi&&s!==ji&&s!==$i&&(r+=1,so.test(d.charAt(r)))){for(;so.test(d.charAt(r+1));)r+=1;d.charCodeAt(r+1)===Bi&&(r+=1)}u=["word",d.slice(f,r+1),f,r],f=r;break;default:s===Di&&d.charCodeAt(f+1)===Zi?(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):(eo.lastIndex=f+1,eo.test(d),r=0===eo.lastIndex?d.length-1:eo.lastIndex-2,u=["word",d.slice(f,r+1),f,r],g.push(u),f=r)}return f++,u},position:function(){return f}}},So=li,bo=io,Co=ho,Io=yo;const ko={empty:!0,space:!0};let Eo=bi,xo=class{constructor(e){this.input=e,this.root=new Co,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,n=new bo;n.name=e[1].slice(1),""===n.name&&this.unnamedAtrule(n,e),this.init(n,e[2]);let i=!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){n.source.end=this.getPosition(e[2]),n.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&&(n.source.end=this.getPosition(s[3]||s[2]),n.source.end.offset++)}this.end(e);break}a.push(e)}else a.push(e);if(this.tokenizer.endOfFile()){i=!0;break}}n.raws.between=this.spacesAndCommentsFromEnd(a),a.length?(n.raws.afterName=this.spacesAndCommentsFromStart(a),this.raw(n,"params",a),i&&(e=a[a.length-1],n.source.end=this.getPosition(e[3]||e[2]),n.source.end.offset++,this.spaces=n.raws.between,n.raws.between="")):(n.raws.afterName="",n.params=""),o&&(n.nodes=[],this.current=n)}checkMissedSemicolon(e){let t=this.colon(e);if(!1===t)return;let s,r=0;for(let n=t-1;n>=0&&(s=e[n],"space"===s[0]||(r+=1,2!==r));n--);throw this.input.error("Missed semicolon","word"===s[0]?s[3]+1:s[2])}colon(e){let t,s,r,n=0;for(let[i,o]of e.entries()){if(t=o,s=t[0],"("===s&&(n+=1),")"===s&&(n-=1),0===n&&":"===s){if(r){if("word"===r[0]&&"progid"===r[1])continue;return i}this.doubleColon(t)}r=t}return!1}comment(e){let t=new So;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=vo(this.input)}decl(e,t){let s=new wo;this.init(s,e[0][2]);let r,n=e[e.length-1];for(";"===n[0]&&(this.semicolon=!0,e.pop()),s.source.end=this.getPosition(n[3]||n[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 i,o=[];for(;e.length&&(i=e[0][0],"space"===i||"comment"===i);)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),n="";for(let e=t;e>0;e--){let t=r[e][0];if(0===n.trim().indexOf("!")&&"space"!==t)break;n=r.pop()[1]+n}0===n.trim().indexOf("!")&&(s.important=!0,s.raws.important=n,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 Io;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,n=null,i=[],o=e[1].startsWith("--"),a=[],l=e;for(;l;){if(s=l[0],a.push(l),"("===s||"["===s)n||(n=l),i.push("("===s?")":"]");else if(o&&r&&"{"===s)n||(n=l),i.push("}");else if(0===i.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===i[i.length-1]&&(i.pop(),0===i.length&&(n=null));l=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),i.length>0&&this.unclosedBracket(n),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 n,i,o,a,l=s.length,c="",h=!0;for(let e=0;e<l;e+=1)n=s[e],i=n[0],"space"!==i||e!==l-1||r?"comment"===i?(a=s[e-1]?s[e-1][0]:"empty",o=s[e+1]?s[e+1][0]:"empty",ko[a]||ko[o]||","===c.slice(-1)?h=!1:c+=n[1]):c+=n[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 Io;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})}},Oo=Yn;function To(e,t){let s=new Oo(e,t),r=new xo(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 Ro=To;To.default=To,Eo.registerParse(To);let{isClean:Mo,my:_o}=an,Ao=ii,Po=pn,No=bi,Fo=xi,Lo=Ti,Do=Pi,Uo=Ro,Bo=ho;const $o={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},zo={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},jo={Once:!0,postcssPlugin:!0,prepare:!0};function Wo(e){return"object"==typeof e&&"function"==typeof e.then}function Ko(e){let t=!1,s=$o[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 Vo(e){let t;return t="document"===e.type?["Document",0,"DocumentExit"]:"root"===e.type?["Root",0,"RootExit"]:Ko(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function Go(e){return e[Mo]=!1,e.nodes&&e.nodes.forEach(e=>Go(e)),e}let Ho={},Yo=class e{constructor(t,s,r){let n;if(this.stringified=!1,this.processed=!1,"object"!=typeof s||null===s||"root"!==s.type&&"document"!==s.type)if(s instanceof e||s instanceof Do)n=Go(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=Uo;r.syntax&&(e=r.syntax.parse),r.parser&&(e=r.parser),e.parse&&(e=e.parse);try{n=e(s,r)}catch(e){this.processed=!0,this.error=e}n&&!n[_o]&&No.rebuild(n)}else n=Go(s);this.result=new Do(t,n,r),this.helpers={...Ho,postcss:Ho,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,n=t.split("."),i=r.split(".");(n[0]!==i[0]||parseInt(n[1])>parseInt(i[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(!zo[s]&&/^[A-Z]/.test(s))throw new Error(`Unknown event ${s} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!jo[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(Wo(s))try{await s}catch(e){throw this.handleError(e)}}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[Mo];){e[Mo]=!0;let t=[Vo(e)];for(;t.length>0;){let e=this.visitTick(t);if(Wo(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 Wo(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=Po;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let s=new Ao(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(Wo(this.runOnRoot(e)))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[Mo];)e[Mo]=!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||Lo("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(Wo(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,n]=r[t.visitorIndex];t.visitorIndex+=1,t.visitorIndex===r.length&&(t.visitors=[],t.visitorIndex=0),this.result.lastPlugin=e;try{return n(s.toProxy(),this.helpers)}catch(e){throw this.handleError(e,s)}}if(0!==t.iterator){let r,n=t.iterator;for(;r=s.nodes[s.indexes[n]];)if(s.indexes[n]+=1,!r[Mo])return r[Mo]=!0,void e.push(Vo(r));t.iterator=0,delete s.indexes[n]}let n=t.events;for(;t.eventIndex<n.length;){let e=n[t.eventIndex];if(t.eventIndex+=1,0===e)return void(s.nodes&&s.nodes.length&&(s[Mo]=!0,t.iterator=s.getIterator()));if(this.listeners[e])return void(t.visitors=this.listeners[e])}e.pop()}walkSync(e){e[Mo]=!0;let t=Ko(e);for(let s of t)if(0===s)e.nodes&&e.each(e=>{e[Mo]||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"}};Yo.registerPostcss=e=>{Ho=e};var qo=Yo;Yo.default=Yo,Bo.registerLazyResult(Yo),Fo.registerLazyResult(Yo);let Zo=ii,Jo=pn,Qo=Ti,Xo=Ro;const ea=Pi;let ta=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 n=Jo;this.result=new ea(this._processor,r,this._opts),this.result.css=t;let i=this;Object.defineProperty(this.result,"root",{get:()=>i.root});let o=new Zo(n,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||Qo("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=Xo;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 sa=ta;ta.default=ta;let ra=sa,na=qo,ia=xi,oa=ho,aa=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 na(this,e,t):new ra(this,e,t)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}};var la=aa;aa.default=aa,oa.registerProcessor(aa),ia.registerProcessor(aa);let ca=kn,ha=Pn,ua=li,da=io,pa=Yn,ma=ho,fa=yo;function ga(e,t){if(Array.isArray(e))return e.map(e=>ga(e));let{inputs:s,...r}=e;if(s){t=[];for(let e of s){let s={...e,__proto__:pa.prototype};s.map&&(s.map={...s.map,__proto__:ha.prototype}),t.push(s)}}if(r.nodes&&(r.nodes=e.nodes.map(e=>ga(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 ma(r);if("decl"===r.type)return new ca(r);if("rule"===r.type)return new fa(r);if("comment"===r.type)return new ua(r);if("atrule"===r.type)return new da(r);throw new Error("Unknown node type: "+e.type)}var ya=ga;ga.default=ga;let wa=on,va=kn,Sa=qo,ba=bi,Ca=la,Ia=pn,ka=ya,Ea=xi,xa=Mi,Oa=li,Ta=io,Ra=Pi,Ma=Yn,_a=Ro,Aa=po,Pa=yo,Na=ho,Fa=bn;function La(...e){return 1===e.length&&Array.isArray(e[0])&&(e=e[0]),new Ca(e)}La.plugin=function(e,t){let s,r=!1;function n(...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 n=t(...s);return n.postcssPlugin=e,n.postcssVersion=(new Ca).version,n}return Object.defineProperty(n,"postcss",{get:()=>(s||(s=n()),s)}),n.process=function(e,t,s){return La([n(s)]).process(e,t)},n},La.stringify=Ia,La.parse=_a,La.fromJSON=ka,La.list=Aa,La.comment=e=>new Oa(e),La.atRule=e=>new Ta(e),La.decl=e=>new va(e),La.rule=e=>new Pa(e),La.root=e=>new Na(e),La.document=e=>new Ea(e),La.CssSyntaxError=wa,La.Declaration=va,La.Container=ba,La.Processor=Ca,La.Document=Ea,La.Comment=Oa,La.Warning=xa,La.AtRule=Ta,La.Result=Ra,La.Input=Ma,La.Rule=Pa,La.Root=Na,La.Node=Fa,Sa.registerPostcss(La);var Da=La;La.default=La;const Ua=qr(Da);Ua.stringify,Ua.fromJSON,Ua.plugin,Ua.parse,Ua.list,Ua.document,Ua.comment,Ua.atRule,Ua.rule,Ua.decl,Ua.root,Ua.CssSyntaxError,Ua.Declaration,Ua.Container,Ua.Processor,Ua.Document,Ua.Comment,Ua.Warning,Ua.AtRule,Ua.Result,Ua.Input,Ua.Rule,Ua.Root,Ua.Node;class Ba{constructor(...e){Yr(this,"parentElement",null),Yr(this,"parentNode",null),Yr(this,"ownerDocument"),Yr(this,"firstChild",null),Yr(this,"lastChild",null),Yr(this,"previousSibling",null),Yr(this,"nextSibling",null),Yr(this,"ELEMENT_NODE",1),Yr(this,"TEXT_NODE",3),Yr(this,"nodeType"),Yr(this,"nodeName"),Yr(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 Ba))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 $a={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},za={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},ja={};function Wa(e){if(ja[e])return ja[e];const t=globalThis[e],s=t.prototype,r=e in $a?$a[e]:void 0,n=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]"))})),i=e in za?za[e]:void 0,o=Boolean(i&&i.every(e=>{var t;return"function"==typeof s[e]&&(null==(t=s[e])?void 0:t.toString().includes("[native code]"))}));if(n&&o)return ja[e]=t.prototype,t.prototype;try{const r=document.createElement("iframe");document.body.appendChild(r);const n=r.contentWindow;if(!n)return t.prototype;const i=n[e].prototype;return document.body.removeChild(r),i?ja[e]=i:s}catch{return s}}const Ka={};function Va(e,t,s){var r;const n=`${e}.${String(s)}`;if(Ka[n])return Ka[n].call(t);const i=Wa(e),o=null==(r=Object.getOwnPropertyDescriptor(i,s))?void 0:r.get;return o?(Ka[n]=o,o.call(t)):t[s]}const Ga={};function Ha(e,t,s){const r=`${e}.${String(s)}`;if(Ga[r])return Ga[r].bind(t);const n=Wa(e)[s];return"function"!=typeof n?t[s]:(Ga[r]=n,n.bind(t))}function Ya(){return Wa("MutationObserver").constructor}const qa={childNodes:function(e){return Va("Node",e,"childNodes")},parentNode:function(e){return Va("Node",e,"parentNode")},parentElement:function(e){return Va("Node",e,"parentElement")},textContent:function(e){return Va("Node",e,"textContent")},contains:function(e,t){return Ha("Node",e,"contains")(t)},getRootNode:function(e){return Ha("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?Va("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?Va("Element",e,"shadowRoot"):null},querySelector:function(e,t){return Va("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return Va("Element",e,"querySelectorAll")(t)},mutationObserver:Ya};function Za(e,t,s=document){const r={capture:!0,passive:!0};return s.addEventListener(e,t,r),()=>s.removeEventListener(e,t,r)}const Ja="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 Qa={map:{},getId:()=>(console.error(Ja),-1),getNode:()=>(console.error(Ja),null),removeNodeFromMap(){console.error(Ja)},has:()=>(console.error(Ja),!1),reset(){console.error(Ja)}};function Xa(e,t,s={}){let r=null,n=0;return function(...i){const o=Date.now();n||!1!==s.leading||(n=o);const a=t-(o-n),l=this;a<=0||a>t?(r&&(clearTimeout(r),r=null),n=o,e.apply(l,i)):r||!1===s.trailing||(r=setTimeout(()=>{n=!1===s.leading?0:Date.now(),r=null,e.apply(l,i)},a))}}function el(e,t,s,r,n=window){const i=n.Object.getOwnPropertyDescriptor(e,t);return n.Object.defineProperty(e,t,r?s:{set(e){setTimeout(()=>{s.set.call(this,e)},0),i&&i.set&&i.set.call(this,e)}}),()=>el(e,t,i||{},!0)}function tl(e,t,s){try{if(!(t in e))return()=>{};const r=e[t],n=s(r);return"function"==typeof n&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=n,()=>{e[t]=r}}catch{return()=>{}}}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(Qa=new Proxy(Qa,{get:(e,t,s)=>("map"===t&&console.error(Ja),Reflect.get(e,t,s))}));let sl=Date.now;function rl(e){var t,s,r,n;const i=e.document;return{left:i.scrollingElement?i.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:i.documentElement.scrollLeft||(null==i?void 0:i.body)&&(null==(t=qa.parentElement(i.body))?void 0:t.scrollLeft)||(null==(s=null==i?void 0:i.body)?void 0:s.scrollLeft)||0,top:i.scrollingElement?i.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==i?void 0:i.documentElement.scrollTop)||(null==i?void 0:i.body)&&(null==(r=qa.parentElement(i.body))?void 0:r.scrollTop)||(null==(n=null==i?void 0:i.body)?void 0:n.scrollTop)||0}}function nl(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function il(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function ol(e){if(!e)return null;return e.nodeType===e.ELEMENT_NODE?e:qa.parentElement(e)}function al(e,t,s,r){if(!e)return!1;const n=ol(e);if(!n)return!1;try{if("string"==typeof t){if(n.classList.contains(t))return!0;if(r&&null!==n.closest("."+t))return!0}else if(ee(n,t,r))return!0}catch(e){}if(s){if(n.matches(s))return!0;if(r&&null!==n.closest(s))return!0}return!1}function ll(e,t,s){return!("TITLE"!==e.tagName||!s.headTitleMutations)||-2===t.getId(e)}function cl(e,t){if(x(e))return!1;const s=t.getId(e);if(!t.has(s))return!0;const r=qa.parentNode(e);return(!r||r.nodeType!==e.DOCUMENT_NODE)&&(!r||cl(r,t))}function hl(e){return Boolean(e.changedTouches)}function ul(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function dl(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function pl(e){return!!e&&(e instanceof Ba&&"shadowRoot"in e?Boolean(e.shadowRoot):Boolean(qa.shadowRoot(e)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(sl=()=>(new Date).getTime());class ml{constructor(){d(this,"id",1),d(this,"styleIDMap",new WeakMap),d(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 fl(e){var t;let s=null;return"getRootNode"in e&&(null==(t=qa.getRootNode(e))?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&qa.host(qa.getRootNode(e))&&(s=qa.host(qa.getRootNode(e))),s}function gl(e){const t=e.ownerDocument;if(!t)return!1;const s=function(e){let t,s=e;for(;t=fl(s);)s=t;return s}(e);return qa.contains(t,s)}function yl(e){const t=e.ownerDocument;return!!t&&(qa.contains(t,e)||gl(e))}var wl=(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))(wl||{}),vl=(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))(vl||{}),Sl=(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))(Sl||{}),bl=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(bl||{}),Cl=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(Cl||{}),Il=(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))(Il||{});function kl(e){return"__ln"in e}class El{constructor(){d(this,"length",0),d(this,"head",null),d(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&&kl(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&&kl(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 xl=(e,t)=>`${e}@${t}`;class Ol{constructor(){d(this,"frozen",!1),d(this,"locked",!1),d(this,"texts",[]),d(this,"attributes",[]),d(this,"attributeMap",new WeakMap),d(this,"removes",[]),d(this,"mapRemoves",[]),d(this,"movedMap",{}),d(this,"addedSet",new Set),d(this,"movedSet",new Set),d(this,"droppedSet",new Set),d(this,"mutationCb"),d(this,"blockClass"),d(this,"blockSelector"),d(this,"maskTextClass"),d(this,"maskTextSelector"),d(this,"inlineStylesheet"),d(this,"maskInputOptions"),d(this,"maskTextFn"),d(this,"maskInputFn"),d(this,"keepIframeSrcFn"),d(this,"recordCanvas"),d(this,"inlineImages"),d(this,"slimDOMOptions"),d(this,"dataURLOptions"),d(this,"doc"),d(this,"mirror"),d(this,"iframeManager"),d(this,"stylesheetManager"),d(this,"shadowDomManager"),d(this,"canvasManager"),d(this,"processedNodeManager"),d(this,"unattachedDoc"),d(this,"processMutations",e=>{e.forEach(this.processMutation),this.emit()}),d(this,"emit",()=>{if(this.frozen||this.locked)return;const e=[],t=new Set,s=new El,r=e=>{let t=e,s=-2;for(;-2===s;)t=t&&t.nextSibling,s=t&&this.mirror.getId(t);return s},n=n=>{const i=qa.parentNode(n);if(!i||!yl(n)||"TEXTAREA"===i.tagName)return;const o=x(i)?this.mirror.getId(fl(n)):this.mirror.getId(i),a=r(n);if(-1===o||-1===a)return s.addNode(n);const l=ne(n,{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=>{ul(e,this.mirror)&&this.iframeManager.addIframe(e),dl(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),pl(n)&&this.shadowDomManager.addShadowRoot(qa.shadowRoot(n),this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)}});l&&(e.push({parentId:o,nextId:a,node:l}),t.add(l.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const e of this.movedSet)Rl(this.removes,e,this.mirror)&&!this.movedSet.has(qa.parentNode(e))||n(e);for(const e of this.addedSet)Ml(this.droppedSet,e)||Rl(this.removes,e,this.mirror)?Ml(this.movedSet,e)?n(e):this.droppedSet.add(e):n(e);let i=null;for(;s.length;){let e=null;if(i){const t=this.mirror.getId(qa.parentNode(i.value)),s=r(i.value);-1!==t&&-1!==s&&(e=i)}if(!e){let t=s.tail;for(;t;){const s=t;if(t=t.previous,s){const t=this.mirror.getId(qa.parentNode(s.value));if(-1===r(s.value))continue;if(-1!==t){e=s;break}{const t=s.value,r=qa.parentNode(t);if(r&&r.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const t=qa.host(r);if(-1!==this.mirror.getId(t)){e=s;break}}}}}}if(!e){for(;s.head;)s.removeNode(s.head.value);break}i=e.previous,s.removeNode(e.value),n(e.value)}const o={texts:this.texts.map(e=>{const t=e.node,s=qa.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.movedMap={},this.mutationCb(o))}),d(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)),t.attributes.value=Array.from(qa.childNodes(e),e=>qa.textContent(e)||"").join("")}),d(this,"processMutation",e=>{if(!ll(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":{const t=qa.textContent(e.target);al(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:te(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,ol(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=N(t);r=_({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:e,value:r,maskInputFn:this.maskInputFn})}if(al(e.target,this.blockClass,this.blockSelector,!1)||r===e.oldValue)return;let n=this.attributeMap.get(e.target);if("IFRAME"===t.tagName&&"src"===s&&!this.keepIframeSrcFn(r)){if(t.contentDocument)return;s="rr_src"}if(n||(n={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(n),this.attributeMap.set(e.target,n)),"type"===s&&"INPUT"===t.tagName&&"password"===(e.oldValue||"").toLowerCase()&&t.setAttribute("data-rr-is-password","true"),!X(t.tagName,s))if(n.attributes[s]=Q(this.doc,A(t.tagName),A(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),i=t.style.getPropertyPriority(e);r!==s.style.getPropertyValue(e)||i!==s.style.getPropertyPriority(e)?n.styleDiff[e]=""===i?r:[r,i]:n._unchangedStyles[e]=[r,i]}for(const e of Array.from(s.style))""===t.style.getPropertyValue(e)&&(n.styleDiff[e]=!1)}else"open"===s&&"DIALOG"===t.tagName&&(t.matches("dialog:modal")?n.attributes.rr_open_mode="modal":n.attributes.rr_open_mode="non-modal");break}case"childList":if(al(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=x(e.target)?this.mirror.getId(qa.host(e.target)):this.mirror.getId(e.target);al(e.target,this.blockClass,this.blockSelector,!1)||ll(t,this.mirror,this.slimDOMOptions)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(Tl(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===s||cl(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[xl(s,r)]?Tl(this.movedSet,t):this.removes.push({parentId:r,id:s,isShadow:!(!x(e.target)||!O(e.target))||void 0})),this.mapRemoves.push(t))})}}),d(this,"genAdds",(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!this.addedSet.has(e)&&!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(ll(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[xl(this.mirror.getId(e),s)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);al(e,this.blockClass,this.blockSelector,!1)||(qa.childNodes(e).forEach(e=>this.genAdds(e)),pl(e)&&qa.childNodes(qa.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 Tl(e,t){e.delete(t),qa.childNodes(t).forEach(t=>Tl(e,t))}function Rl(e,t,s){return 0!==e.length&&function(e,t,s){let r=qa.parentNode(t);for(;r;){const t=s.getId(r);if(e.some(e=>e.id===t))return!0;r=qa.parentNode(r)}return!1}(e,t,s)}function Ml(e,t){return 0!==e.size&&_l(e,t)}function _l(e,t){const s=qa.parentNode(t);return!!s&&(!!e.has(s)||_l(e,s))}let Al;const Pl=e=>{if(!Al)return e;return(...t)=>{try{return e(...t)}catch(e){if(Al&&!0===Al(e))return;throw e}}},Nl=[];function Fl(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 Ll(e,t){const s=new Ol;Nl.push(s),s.init(e);const r=new(Ya())(Pl(s.processMutations.bind(s)));return r.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),r}function Dl({mouseInteractionCb:e,doc:t,mirror:s,blockClass:r,blockSelector:n,sampling:i}){if(!1===i.mouseInteraction)return()=>{};const o=!0===i.mouseInteraction||void 0===i.mouseInteraction?{}:i.mouseInteraction,a=[];let l=null;return Object.keys(Sl).filter(e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==o[e]).forEach(i=>{let o=A(i);const c=(t=>i=>{const o=Fl(i);if(al(o,r,n,!0))return;let a=null,c=t;if("pointerType"in i){switch(i.pointerType){case"mouse":a=bl.Mouse;break;case"touch":a=bl.Touch;break;case"pen":a=bl.Pen}a===bl.Touch?Sl[t]===Sl.MouseDown?c="TouchStart":Sl[t]===Sl.MouseUp&&(c="TouchEnd"):bl.Pen}else hl(i)&&(a=bl.Touch);null!==a?(l=a,(c.startsWith("Touch")&&a===bl.Touch||c.startsWith("Mouse")&&a===bl.Mouse)&&(a=null)):Sl[t]===Sl.Click&&(a=l,l=null);const h=hl(i)?i.changedTouches[0]:i;if(!h)return;const u=s.getId(o),{clientX:d,clientY:p}=h;Pl(e)({type:Sl[c],id:u,x:d,y:p,...null!==a&&{pointerType:a}})})(i);if(window.PointerEvent)switch(Sl[i]){case Sl.MouseDown:case Sl.MouseUp:o=o.replace("mouse","pointer");break;case Sl.TouchStart:case Sl.TouchEnd:return}a.push(Za(o,c,t))}),Pl(()=>{a.forEach(e=>e())})}function Ul({scrollCb:e,doc:t,mirror:s,blockClass:r,blockSelector:n,sampling:i}){return Za("scroll",Pl(Xa(Pl(i=>{const o=Fl(i);if(!o||al(o,r,n,!0))return;const a=s.getId(o);if(o===t&&t.defaultView){const s=rl(t.defaultView);e({id:a,x:s.left,y:s.top})}else e({id:a,x:o.scrollLeft,y:o.scrollTop})}),i.scroll||100)),t)}const Bl=["INPUT","TEXTAREA","SELECT"],$l=new WeakMap;function zl(e){return function(e,t){if(Vl("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||Vl("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||Vl("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||Vl("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 jl(e,t,s){let r,n;return e?(e.ownerNode?r=t.getId(e.ownerNode):n=s.getId(e),{styleId:n,id:r}):{}}function Wl({mirror:e,stylesheetManager:t},s){var r,n,i;let o=null;o="#document"===s.nodeName?e.getId(s):e.getId(qa.host(s));const a="#document"===s.nodeName?null==(r=s.defaultView)?void 0:r.Document:null==(i=null==(n=s.ownerDocument)?void 0:n.defaultView)?void 0:i.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}}),Pl(()=>{Object.defineProperty(s,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})})):()=>{}}function Kl(e,t={}){const s=e.doc.defaultView;if(!s)return()=>{};let r;!function(e,t){const{mutationCb:s,mousemoveCb:r,mouseInteractionCb:n,scrollCb:i,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),n(...e)},e.scrollCb=(...e)=>{t.scroll&&t.scroll(...e),i(...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=Ll(e,e.doc));const n=function({mousemoveCb:e,sampling:t,doc:s,mirror:r}){if(!1===t.mousemove)return()=>{};const n="number"==typeof t.mousemove?t.mousemove:50,i="number"==typeof t.mousemoveCallback?t.mousemoveCallback:500;let o,a=[];const l=Xa(Pl(t=>{const s=Date.now()-o;e(a.map(e=>(e.timeOffset-=s,e)),t),a=[],o=null}),i),c=Pl(Xa(Pl(e=>{const t=Fl(e),{clientX:s,clientY:n}=hl(e)?e.changedTouches[0]:e;o||(o=sl()),a.push({x:s,y:n,id:r.getId(t),timeOffset:sl()-o}),l("undefined"!=typeof DragEvent&&e instanceof DragEvent?vl.Drag:e instanceof MouseEvent?vl.MouseMove:vl.TouchMove)}),n,{trailing:!1})),h=[Za("mousemove",c,s),Za("touchmove",c,s),Za("drag",c,s)];return Pl(()=>{h.forEach(e=>e())})}(e),i=Dl(e),o=Ul(e),a=function({viewportResizeCb:e},{win:t}){let s=-1,r=-1;return Za("resize",Pl(Xa(Pl(()=>{const t=nl(),n=il();s===t&&r===n||(e({width:Number(n),height:Number(t)}),s=t,r=n)}),200)),t)}(e,{win:s}),l=function({inputCb:e,doc:t,mirror:s,blockClass:r,blockSelector:n,ignoreClass:i,ignoreSelector:o,maskInputOptions:a,maskInputFn:l,sampling:c,userTriggeredOnInput:h}){function u(e){let s=Fl(e);const c=e.isTrusted,u=s&&s.tagName;if(s&&"OPTION"===u&&(s=qa.parentElement(s)),!s||!u||Bl.indexOf(u)<0||al(s,r,n,!0))return;if(s.classList.contains(i)||o&&s.matches(o))return;let p=s.value,m=!1;const f=N(s)||"";"radio"===f||"checkbox"===f?m=s.checked:(a[u.toLowerCase()]||a[f])&&(p=_({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 n=$l.get(t);if(!n||n.text!==r.text||n.isChecked!==r.isChecked){$l.set(t,r);const n=s.getId(t);Pl(e)({...r,id:n})}}const p=("last"===c.input?["change"]:["input","change"]).map(e=>Za(e,Pl(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=>el(e[0],e[1],{set(){Pl(u)({target:this,isTrusted:!1})}},!1,m))),Pl(()=>{p.forEach(e=>e())})}(e),c=function({mediaInteractionCb:e,blockClass:t,blockSelector:s,mirror:r,sampling:n,doc:i}){const o=Pl(i=>Xa(Pl(n=>{const o=Fl(n);if(!o||al(o,t,s,!0))return;const{currentTime:a,volume:l,muted:c,playbackRate:h,loop:u}=o;e({type:i,id:r.getId(o),currentTime:a,volume:l,muted:c,playbackRate:h,loop:u})}),n.media||500)),a=[Za("play",o(Il.Play),i),Za("pause",o(Il.Pause),i),Za("seeked",o(Il.Seeked),i),Za("volumechange",o(Il.VolumeChange),i),Za("ratechange",o(Il.RateChange),i)];return Pl(()=>{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 n=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(n,{apply:Pl((r,n,i)=>{const[o,a]=i,{id:l,styleId:c}=jl(n,t,s.styleMirror);return(l&&-1!==l||c&&-1!==c)&&e({id:l,styleId:c,adds:[{rule:o,index:a}]}),r.apply(n,i)})}),r.CSSStyleSheet.prototype.addRule=function(e,t,s=this.cssRules.length){const n=`${e} { ${t} }`;return r.CSSStyleSheet.prototype.insertRule.apply(this,[n,s])};const i=r.CSSStyleSheet.prototype.deleteRule;let o,a;r.CSSStyleSheet.prototype.deleteRule=new Proxy(i,{apply:Pl((r,n,i)=>{const[o]=i,{id:a,styleId:l}=jl(n,t,s.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,removes:[{index:o}]}),r.apply(n,i)})}),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:Pl((r,n,i)=>{const[o]=i,{id:a,styleId:l}=jl(n,t,s.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,replace:o}),r.apply(n,i)})})),r.CSSStyleSheet.prototype.replaceSync&&(a=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:Pl((r,n,i)=>{const[o]=i,{id:a,styleId:l}=jl(n,t,s.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,replaceSync:o}),r.apply(n,i)})}));const l={};Gl("CSSGroupingRule")?l.CSSGroupingRule=r.CSSGroupingRule:(Gl("CSSMediaRule")&&(l.CSSMediaRule=r.CSSMediaRule),Gl("CSSConditionRule")&&(l.CSSConditionRule=r.CSSConditionRule),Gl("CSSSupportsRule")&&(l.CSSSupportsRule=r.CSSSupportsRule));const c={};return Object.entries(l).forEach(([r,n])=>{c[r]={insertRule:n.prototype.insertRule,deleteRule:n.prototype.deleteRule},n.prototype.insertRule=new Proxy(c[r].insertRule,{apply:Pl((r,n,i)=>{const[o,a]=i,{id:l,styleId:c}=jl(n.parentStyleSheet,t,s.styleMirror);return(l&&-1!==l||c&&-1!==c)&&e({id:l,styleId:c,adds:[{rule:o,index:[...zl(n),a||0]}]}),r.apply(n,i)})}),n.prototype.deleteRule=new Proxy(c[r].deleteRule,{apply:Pl((r,n,i)=>{const[o]=i,{id:a,styleId:l}=jl(n.parentStyleSheet,t,s.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,removes:[{index:[...zl(n),o]}]}),r.apply(n,i)})})}),Pl(()=>{r.CSSStyleSheet.prototype.insertRule=n,r.CSSStyleSheet.prototype.deleteRule=i,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=Wl(e,e.doc),d=function({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:s,stylesheetManager:r},{win:n}){const i=n.CSSStyleDeclaration.prototype.setProperty;n.CSSStyleDeclaration.prototype.setProperty=new Proxy(i,{apply:Pl((n,o,a)=>{var l;const[c,h,u]=a;if(s.has(c))return i.apply(o,[c,h,u]);const{id:d,styleId:p}=jl(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:zl(o.parentRule)}),n.apply(o,a)})});const o=n.CSSStyleDeclaration.prototype.removeProperty;return n.CSSStyleDeclaration.prototype.removeProperty=new Proxy(o,{apply:Pl((n,i,a)=>{var l;const[c]=a;if(s.has(c))return o.apply(i,[c]);const{id:h,styleId:u}=jl(null==(l=i.parentRule)?void 0:l.parentStyleSheet,t,r.styleMirror);return(h&&-1!==h||u&&-1!==u)&&e({id:h,styleId:u,remove:{property:c},index:zl(i.parentRule)}),n.apply(i,a)})}),Pl(()=>{n.CSSStyleDeclaration.prototype.setProperty=i,n.CSSStyleDeclaration.prototype.removeProperty=o})}(e,{win:s}),e.collectFonts&&(p=function({fontCb:e,doc:t}){const s=t.defaultView;if(!s)return()=>{};const r=[],n=new WeakMap,i=s.FontFace;s.FontFace=function(e,t,s){const r=new i(e,t,s);return n.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=tl(t.fonts,"add",function(t){return function(s){return setTimeout(Pl(()=>{const t=n.get(s);t&&(e(t),n.delete(s))}),0),t.apply(this,[s])}});return r.push(()=>{s.FontFace=i}),r.push(o),Pl(()=>{r.forEach(e=>e())})}(e)));const m=function(e){const{doc:t,mirror:s,blockClass:r,blockSelector:n,selectionCb:i}=e;let o=!0;const a=Pl(()=>{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 i=e.getRangeAt(t),{startContainer:o,startOffset:l,endContainer:c,endOffset:h}=i;al(o,r,n,!0)||al(c,r,n,!0)||a.push({start:s.getId(o),startOffset:l,end:s.getId(c),endOffset:h})}i({ranges:a})});return a(),Za("selectionchange",a)}(e),f=function({doc:e,customElementCb:t}){const s=e.defaultView;return s&&s.customElements?tl(s.customElements,"define",function(e){return function(s,r,n){try{t({define:{name:s}})}catch(e){console.warn(`Custom element callback failed for ${s}`)}return e.apply(this,[s,r,n])}}):()=>{}}(e),g=[];for(const t of e.plugins)g.push(t.observer(t.callback,s,t.options));return Pl(()=>{Nl.forEach(e=>e.reset()),null==r||r.disconnect(),n(),i(),o(),a(),l(),c(),h(),u(),d(),p(),m(),f(),g.forEach(e=>e())})}function Vl(e){return void 0!==window[e]}function Gl(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class Hl{constructor(e){d(this,"iframeIdToRemoteIdMap",new WeakMap),d(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,s,r){const n=s||this.getIdToRemoteIdMap(e),i=r||this.getRemoteIdToIdMap(e);let o=n.get(t);return o||(o=this.generateIdFn(),n.set(t,o),i.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 n=r.get(t);return n||-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 Yl{constructor(e){d(this,"iframes",new WeakMap),d(this,"crossOriginIframeMap",new WeakMap),d(this,"crossOriginIframeMirror",new Hl(W)),d(this,"crossOriginIframeStyleMirror"),d(this,"crossOriginIframeRootIdMap",new WeakMap),d(this,"mirror"),d(this,"mutationCb"),d(this,"wrappedEmit"),d(this,"loadListener"),d(this,"stylesheetManager"),d(this,"recordCrossOriginIframes"),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Hl(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 wl.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:wl.IncrementalSnapshot,data:{source:vl.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case wl.Meta:case wl.Load:case wl.DomContentLoaded:return!1;case wl.Plugin:return t;case wl.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case wl.IncrementalSnapshot:switch(t.data.source){case vl.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 vl.Drag:case vl.TouchMove:case vl.MouseMove:return t.data.positions.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case vl.ViewportResize:return!1;case vl.MediaInteraction:case vl.MouseInteraction:case vl.Scroll:case vl.CanvasMutation:case vl.Input:return this.replaceIds(t.data,e,["id"]),t;case vl.StyleSheetRule:case vl.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case vl.Font:return t;case vl.Selection:return t.data.ranges.forEach(t=>{this.replaceIds(t,e,["start","end"])}),t;case vl.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 n of r)(Array.isArray(t[n])||"number"==typeof t[n])&&(Array.isArray(t[n])?t[n]=e.getIds(s,t[n]):t[n]=e.getId(s,t[n]));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===f.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(e=>{this.patchRootIdOnNode(e,t)})}}class ql{constructor(e){d(this,"shadowDoms",new WeakSet),d(this,"mutationCb"),d(this,"scrollCb"),d(this,"bypassOptions"),d(this,"mirror"),d(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(!O(e))return;if(this.shadowDoms.has(e))return;this.shadowDoms.add(e);const s=Ll({...this.bypassOptions,doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},e);this.restoreHandlers.push(()=>s.disconnect()),this.restoreHandlers.push(Ul({...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(qa.host(e))),this.restoreHandlers.push(Wl({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(tl(e.prototype,"attachShadow",function(e){return function(r){const n=e.call(this,r),i=qa.shadowRoot(this);return i&&yl(this)&&s.addShadowRoot(i,t),n}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch(e){}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}for(var Zl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Jl="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Ql=0;Ql<64;Ql++)Jl[Zl.charCodeAt(Ql)]=Ql;const Xl=new Map;const ec=(e,t,s)=>{if(!e||!rc(e,t)&&"object"!=typeof e)return;const r=function(e,t){let s=Xl.get(e);return s||(s=new Map,Xl.set(e,s)),s.has(t)||s.set(t,[]),s.get(t)}(s,e.constructor.name);let n=r.indexOf(e);return-1===n&&(n=r.length,r.push(e)),n};function tc(e,t,s){if(e instanceof Array)return e.map(e=>tc(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,n="";for(t=0;t<r;t+=3)n+=Zl[s[t]>>2],n+=Zl[(3&s[t])<<4|s[t+1]>>4],n+=Zl[(15&s[t+1])<<2|s[t+2]>>6],n+=Zl[63&s[t+2]];return r%3==2?n=n.substring(0,n.length-1)+"=":r%3==1&&(n=n.substring(0,n.length-2)+"=="),n}(e)}}if(e instanceof DataView){return{rr_type:e.constructor.name,args:[tc(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:[tc(e.data,t,s),e.width,e.height]}}if(rc(e,t)||"object"==typeof e){return{rr_type:e.constructor.name,index:ec(e,t,s)}}return e}const sc=(e,t,s)=>e.map(e=>tc(e,t,s)),rc=(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 nc(e,t,s,r){const n=[];try{const i=tl(e.HTMLCanvasElement.prototype,"getContext",function(e){return function(n,...i){if(!al(this,t,s,!0)){const e=function(e){return"experimental-webgl"===e?"webgl":e}(n);if("__context"in this||(this.__context=e),r&&["webgl","webgl2"].includes(e))if(i[0]&&"object"==typeof i[0]){const e=i[0];e.preserveDrawingBuffer||(e.preserveDrawingBuffer=!0)}else i.splice(0,1,{preserveDrawingBuffer:!0})}return e.apply(this,[n,...i])}});n.push(i)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{n.forEach(e=>e())}}function ic(e,t,s,r,n,i){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=tl(e,l,function(e){return function(...o){const a=e.apply(this,o);if(ec(a,i,this),"tagName"in this.canvas&&!al(this.canvas,r,n,!0)){const e=sc(o,i,this),r={type:t,property:l,args:e};s(this.canvas,r)}return a}});o.push(a)}catch{const r=el(e,l,{set(e){s(this.canvas,{type:t,property:l,args:[e],setter:!0})}});o.push(r)}return o}const oc="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",ac="undefined"!=typeof window&&window.Blob&&new Blob([(lc=oc,Uint8Array.from(atob(lc),e=>e.charCodeAt(0)))],{type:"text/javascript;charset=utf-8"});var lc;function cc(e){let t;try{if(t=ac&&(window.URL||window.webkitURL).createObjectURL(ac),!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,"+oc,{name:null==e?void 0:e.name})}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}class hc{constructor(e){d(this,"pendingCanvasMutations",new Map),d(this,"rafStamps",{latestId:0,invokeId:null}),d(this,"mirror"),d(this,"mutationCb"),d(this,"resetObservers"),d(this,"frozen",!1),d(this,"locked",!1),d(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:r,blockSelector:n,recordCanvas:i,dataURLOptions:o}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,i&&"all"===t&&this.initCanvasMutationObserver(s,r,n),i&&"number"==typeof t&&this.initCanvasFPSObserver(t,s,r,n,{dataURLOptions:o})}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,n){const i=nc(t,s,r,!0),o=new Map,a=new cc;a.onmessage=e=>{const{id:t}=e.data;if(o.set(t,!1),!("base64"in e.data))return;const{base64:s,type:r,width:n,height:i}=e.data;this.mutationCb({id:t,type:Cl["2D"],commands:[{property:"clearRect",args:[0,0,n,i]},{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=>{al(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:n.dataURLOptions},[r])})),c=requestAnimationFrame(u)};c=requestAnimationFrame(u),this.resetObservers=()=>{i(),cancelAnimationFrame(c)}}initCanvasMutationObserver(e,t,s){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const r=nc(e,t,s,!1),n=function(e,t,s,r){const n=[],i=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const o of i)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[o])continue;const i=tl(t.CanvasRenderingContext2D.prototype,o,function(n){return function(...i){return al(this.canvas,s,r,!0)||setTimeout(()=>{const s=sc(i,t,this);e(this.canvas,{type:Cl["2D"],property:o,args:s})},0),n.apply(this,i)}});n.push(i)}catch{const s=el(t.CanvasRenderingContext2D.prototype,o,{set(t){e(this.canvas,{type:Cl["2D"],property:o,args:[t],setter:!0})}});n.push(s)}return()=>{n.forEach(e=>e())}}(this.processMutation.bind(this),e,t,s),i=function(e,t,s,r){const n=[];return n.push(...ic(t.WebGLRenderingContext.prototype,Cl.WebGL,e,s,r,t)),void 0!==t.WebGL2RenderingContext&&n.push(...ic(t.WebGL2RenderingContext.prototype,Cl.WebGL2,e,s,r,t)),()=>{n.forEach(e=>e())}}(this.processMutation.bind(this),e,t,s);this.resetObservers=()=>{r(),n(),i()}}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:n}=s[0];this.mutationCb({id:t,type:n,commands:r}),this.pendingCanvasMutations.delete(e)}}class uc{constructor(e){d(this,"trackedLinkElements",new WeakSet),d(this,"mutationCb"),d(this,"adoptedStyleSheetCb"),d(this,"styleMirror",new ml),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:R(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 dc{constructor(){d(this,"nodeMap",new WeakMap),d(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 pc,mc,fc,gc=!1;try{if(2!==Array.from([1],e=>2*e)[0]){const e=document.createElement("iframe");document.body.appendChild(e),Array.from=(null==(h=e.contentWindow)?void 0:h.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}const yc=new M;function wc(e={}){const{emit:t,checkoutEveryNms:s,checkoutEveryNth:r,blockClass:n="rr-block",blockSelector:i=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:b=!0,recordCanvas:C=!1,recordCrossOriginIframes:I=!1,recordAfter:k=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:E=!1,collectFonts:x=!1,inlineImages:O=!1,plugins:T,keepIframeSrcFn:R=()=>!1,ignoreCSSAttributes:_=new Set([]),errorHandler:A}=e;Al=A;const P=!I||window.parent===window;let N=!1;if(!P)try{window.parent.document&&(N=!1)}catch(e){N=!0}if(P&&!t)throw new Error("emit function is required");if(!P&&!N)return()=>{};void 0!==S&&void 0===w.mousemove&&(w.mousemove=S),yc.reset();const F=!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},L=!0===p||"all"===p?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===p,headMetaDescKeywords:"all"===p,headTitleMutations:"all"===p}:p||{};let D;!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||[])t.eventProcessor&&(e=t.eventProcessor(e));return y&&!N&&(e=y(e)),e};pc=(e,n)=>{var i;const o=e;if(o.timestamp=sl(),!(null==(i=Nl[0])?void 0:i.isFrozen())||o.type===wl.FullSnapshot||o.type===wl.IncrementalSnapshot&&o.data.source===vl.Mutation||Nl.forEach(e=>e.unfreeze()),P)null==t||t(B(o),n);else if(N){const e={type:"rrweb",event:B(o),origin:window.location.origin,isCheckout:n};window.parent.postMessage(e,"*")}if(o.type===wl.FullSnapshot)D=o,U=0;else if(o.type===wl.IncrementalSnapshot){if(o.data.source===vl.Mutation&&o.data.isAttachIframe)return;U++;const e=r&&U>=r,t=s&&o.timestamp-D.timestamp>s;(e||t)&&mc(!0)}};const $=e=>{pc({type:wl.IncrementalSnapshot,data:{source:vl.Mutation,...e}})},z=e=>pc({type:wl.IncrementalSnapshot,data:{source:vl.Scroll,...e}}),j=e=>pc({type:wl.IncrementalSnapshot,data:{source:vl.CanvasMutation,...e}}),W=new uc({mutationCb:$,adoptedStyleSheetCb:e=>pc({type:wl.IncrementalSnapshot,data:{source:vl.AdoptedStyleSheet,...e}})}),K=new Yl({mirror:yc,mutationCb:$,stylesheetManager:W,recordCrossOriginIframes:I,wrappedEmit:pc});for(const e of T||[])e.getMirror&&e.getMirror({nodeMirror:yc,crossOriginIframeMirror:K.crossOriginIframeMirror,crossOriginIframeStyleMirror:K.crossOriginIframeStyleMirror});const V=new dc;fc=new hc({recordCanvas:C,mutationCb:j,win:window,blockClass:n,blockSelector:i,mirror:yc,sampling:w.canvas,dataURLOptions:v});const G=new ql({mutationCb:$,scrollCb:z,bypassOptions:{blockClass:n,blockSelector:i,maskTextClass:l,maskTextSelector:c,inlineStylesheet:h,maskInputOptions:F,dataURLOptions:v,maskTextFn:f,maskInputFn:m,recordCanvas:C,inlineImages:O,sampling:w,slimDOMOptions:L,iframeManager:K,stylesheetManager:W,canvasManager:fc,keepIframeSrcFn:R,processedNodeManager:V},mirror:yc});mc=(e=!1)=>{if(!b)return;pc({type:wl.Meta,data:{href:window.location.href,width:il(),height:nl()}},e),W.reset(),G.init(),Nl.forEach(e=>e.lock());const t=function(e,t){const{mirror:s=new M,blockClass:r="rr-block",blockSelector:n=null,maskTextClass:i="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:b=()=>!1}=t||{};return ne(e,{doc:e,mirror:s,blockClass:r,blockSelector:n,maskTextClass:i,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:!0===p||"all"===p?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===p,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===p?{}:p,dataURLOptions:m,inlineImages:l,recordCanvas:c,preserveWhiteSpace:f,onSerialize:g,onIframeLoad:y,iframeLoadTimeout:w,onStylesheetLoad:v,stylesheetLoadTimeout:S,keepIframeSrcFn:b,newlyAddedElement:!1})}(document,{mirror:yc,blockClass:n,blockSelector:i,maskTextClass:l,maskTextSelector:c,inlineStylesheet:h,maskAllInputs:F,maskTextFn:f,maskInputFn:m,slimDOM:L,dataURLOptions:v,recordCanvas:C,inlineImages:O,onSerialize:e=>{ul(e,yc)&&K.addIframe(e),dl(e,yc)&&W.trackLinkElement(e),pl(e)&&G.addShadowRoot(qa.shadowRoot(e),document)},onIframeLoad:(e,t)=>{K.attachIframe(e,t),G.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{W.attachLinkElement(e,t)},keepIframeSrcFn:R});if(!t)return console.warn("Failed to snapshot the document");pc({type:wl.FullSnapshot,data:{node:t,initialOffset:rl(window)}},e),Nl.forEach(e=>e.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&W.adoptStyleSheets(document.adoptedStyleSheets,yc.getId(document))};try{const e=[],t=e=>{var t;return Pl(Kl)({mutationCb:$,mousemoveCb:(e,t)=>pc({type:wl.IncrementalSnapshot,data:{source:t,positions:e}}),mouseInteractionCb:e=>pc({type:wl.IncrementalSnapshot,data:{source:vl.MouseInteraction,...e}}),scrollCb:z,viewportResizeCb:e=>pc({type:wl.IncrementalSnapshot,data:{source:vl.ViewportResize,...e}}),inputCb:e=>pc({type:wl.IncrementalSnapshot,data:{source:vl.Input,...e}}),mediaInteractionCb:e=>pc({type:wl.IncrementalSnapshot,data:{source:vl.MediaInteraction,...e}}),styleSheetRuleCb:e=>pc({type:wl.IncrementalSnapshot,data:{source:vl.StyleSheetRule,...e}}),styleDeclarationCb:e=>pc({type:wl.IncrementalSnapshot,data:{source:vl.StyleDeclaration,...e}}),canvasMutationCb:j,fontCb:e=>pc({type:wl.IncrementalSnapshot,data:{source:vl.Font,...e}}),selectionCb:e=>{pc({type:wl.IncrementalSnapshot,data:{source:vl.Selection,...e}})},customElementCb:e=>{pc({type:wl.IncrementalSnapshot,data:{source:vl.CustomElement,...e}})},blockClass:n,ignoreClass:o,ignoreSelector:a,maskTextClass:l,maskTextSelector:c,maskInputOptions:F,inlineStylesheet:h,sampling:w,recordDOM:b,recordCanvas:C,inlineImages:O,userTriggeredOnInput:E,collectFonts:x,doc:e,maskInputFn:m,maskTextFn:f,keepIframeSrcFn:R,blockSelector:i,slimDOMOptions:L,dataURLOptions:v,mirror:yc,iframeManager:K,stylesheetManager:W,shadowDomManager:G,processedNodeManager:V,canvasManager:fc,ignoreCSSAttributes:_,plugins:(null==(t=null==T?void 0:T.filter(e=>e.observer))?void 0:t.map(e=>({observer:e.observer,options:e.options,callback:t=>pc({type:wl.Plugin,data:{plugin:e.name,payload:t}})})))||[]},g)};K.addLoadListener(s=>{try{e.push(t(s.contentDocument))}catch(e){console.warn(e)}});const s=()=>{mc(),e.push(t(document)),gc=!0};return"interactive"===document.readyState||"complete"===document.readyState?s():(e.push(Za("DOMContentLoaded",()=>{pc({type:wl.DomContentLoaded,data:{}}),"DOMContentLoaded"===k&&s()})),e.push(Za("load",()=>{pc({type:wl.Load,data:{}}),"load"===k&&s()},window))),()=>{e.forEach(e=>e()),V.destroy(),gc=!1,Al=void 0}}catch(e){console.warn(e)}}var vc,Sc;wc.addCustomEvent=(e,t)=>{if(!gc)throw new Error("please add custom event after start recording");pc({type:wl.Custom,data:{tag:e,payload:t}})},wc.freezePage=()=>{Nl.forEach(e=>e.freeze())},wc.takeFullSnapshot=e=>{if(!gc)throw new Error("please take full snapshot after start recording");mc(e)},wc.mirror=yc,(Sc=vc||(vc={}))[Sc.NotStarted=0]="NotStarted",Sc[Sc.Running=1]="Running",Sc[Sc.Stopped=2]="Stopped";const bc=[];for(let e=0;e<256;++e)bc.push((e+256).toString(16).slice(1));let Cc;const Ic=new Uint8Array(16);const kc={};function Ec(e,t,s){let r;{const e=Date.now(),n=function(){if(!Cc){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Cc=crypto.getRandomValues.bind(crypto)}return Cc(Ic)}();!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}(kc,e,n),r=function(e,t,s,r,n,i,o=0){if(e.length<16)throw new Error("Random bytes length must be >= 16");if(i){if(o<0||o+16>i.length)throw new RangeError(`UUID byte range ${o}:${o+15} is out of buffer bounds`)}else i=new Uint8Array(16),o=0;t??=Date.now(),s??=0,r??=16383&(e[8]<<8|e[9]),n??=e.slice(10,16);const a=(1e4*(268435455&(t+=122192928e5))+s)%4294967296;i[o++]=a>>>24&255,i[o++]=a>>>16&255,i[o++]=a>>>8&255,i[o++]=255&a;const l=t/4294967296*1e4&268435455;i[o++]=l>>>8&255,i[o++]=255&l,i[o++]=l>>>24&15|16,i[o++]=l>>>16&255,i[o++]=r>>>8|128,i[o++]=255&r;for(let e=0;e<6;++e)i[o++]=n[e];return i}(n,kc.msecs,kc.nsecs,kc.clockseq,kc.node,t,s)}return t??function(e,t=0){return(bc[e[t+0]]+bc[e[t+1]]+bc[e[t+2]]+bc[e[t+3]]+"-"+bc[e[t+4]]+bc[e[t+5]]+"-"+bc[e[t+6]]+bc[e[t+7]]+"-"+bc[e[t+8]]+bc[e[t+9]]+"-"+bc[e[t+10]]+bc[e[t+11]]+bc[e[t+12]]+bc[e[t+13]]+bc[e[t+14]]+bc[e[t+15]]).toLowerCase()}(r)}var xc,Oc;(Oc=xc||(xc={}))[Oc.NONE=0]="NONE",Oc[Oc.ERROR=1]="ERROR",Oc[Oc.WARN=2]="WARN",Oc[Oc.INFO=3]="INFO",Oc[Oc.DEBUG=4]="DEBUG";const Tc=new class{constructor(e){this.config={level:xc.ERROR,enableConsole:!0,enableStorage:!1},this.isBrowser="undefined"!=typeof window,e&&(this.config={...this.config,...e})}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(e,...t){if(!this.shouldLog(xc.ERROR))return;const s=this.formatMessage("ERROR",e);this.config.enableConsole&&console.error(s,...t),this.config.enableStorage&&this.isBrowser&&this.logToStorage(s,t)}warn(e,...t){if(!this.shouldLog(xc.WARN))return;const s=this.formatMessage("WARN",e);this.config.enableConsole&&console.warn(s,...t),this.config.enableStorage&&this.isBrowser&&this.logToStorage(s,t)}info(e,...t){if(!this.shouldLog(xc.INFO))return;const s=this.formatMessage("INFO",e);this.config.enableConsole&&console.log(s,...t),this.config.enableStorage&&this.isBrowser&&this.logToStorage(s,t)}debug(e,...t){if(!this.shouldLog(xc.DEBUG))return;const s=this.formatMessage("DEBUG",e);this.config.enableConsole&&console.log(s,...t),this.config.enableStorage&&this.isBrowser&&this.logToStorage(s,t)}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 Rc=!1;const Mc=(e,...t)=>{Rc=!0;try{Tc.error(e,...t)}finally{Rc=!1}},_c=(e,...t)=>{Rc=!0;try{Tc.warn(e,...t)}finally{Rc=!1}},Ac=(e,...t)=>{Rc=!0;try{Tc.info(e,...t)}finally{Rc=!1}},Pc=(e,...t)=>{Rc=!0;try{Tc.debug(e,...t)}finally{Rc=!1}};class Nc{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),n=(Math.random()-.5)*(r-s);return Math.ceil(r+n)}(t),r=Date.now()+s;this._queue.push({retryAt:r,requestOptions:e});let n=`Enqueued failed request for retry in ${Math.round(s/1e3)}s`;"undefined"==typeof navigator||navigator.onLine||(n+=" (Browser is offline)"),_c(n),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=>{Mc("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){Mc("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)||_c("sendBeacon returned false for unload request")}catch(e){Mc("Error sending beacon request:",e)}}}class Fc{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 _c("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)),Pc(`Persisted ${t.length} events to storage`)}catch(t){if("QuotaExceededError"===t.name||22===t.code){_c("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){_c("Failed to save smaller queue, clearing storage"),this.clearQueue()}}else _c("Failed to persist queue:",t)}}addToQueue(e){const t=this.getQueue();t.push(e),t.length>this.maxQueueSize&&(t.shift(),Pc("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){_c("Failed to clear persisted queue:",e)}}getQueueLength(){return this.getQueue().length}}const Lc="0.5.69",Dc=1048576,Uc=52428.8;function Bc(e,t,s){return(new TextEncoder).encode($c({sessionId:s,events:[...e,t]})).length>Dc}function $c(e){return JSON.stringify(e,(e,t)=>"bigint"==typeof t?t.toString():t)}function zc(e,t){if(!e||"object"!=typeof e)return[];if((new TextEncoder).encode($c({sessionId:t,events:[e]})).length<=Dc)return[e];const s={...e},r=["screenshot","html","dom","fullText","innerHTML","outerHTML"];return r.forEach(e=>{s[e]&&delete s[e]}),(new TextEncoder).encode($c({sessionId:t,events:[s]})).length<=Dc?[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 jc{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 Fc(e),this.retryQueue=new Nc(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){Pc(`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){_c("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,n="POST"===e.method&&r<Uc,i=await fetch(e.url,{method:e.method||"GET",headers:e.headers||{},body:e.body,signal:t?.signal,keepalive:n});s&&clearTimeout(s);const o=await i.text();let a=null;try{a=JSON.parse(o)}catch{}if(e.callback&&e.callback({statusCode:i.status,text:o,json:a}),!i.ok)throw{status:i.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),Ac("API init called with:",{sessionId:e,userId:t,entryURL:s,referrer:r,baseUrl:this.baseUrl});try{const n=await this.trackedFetch(`${this.baseUrl}/api/ingestion/init`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`,Referer:r||""},body:$c({sessionId:e,endUserId:t,entryURL:s,referrer:r,sdkVersion:Lc})});if(Ac("API init response status:",n.status),!n.ok){if(429===n.status)return this.monthlyLimitReached=!0,{sessionId:e,endUserId:t};const s=await n.text();throw Mc("API init failed:",n.status,s),new Error(`Failed to initialize ingestion: ${n.statusText} - ${s}`)}const i=await n.json();return!0===i.monthlyLimitReached&&(this.monthlyLimitReached=!0,Ac("Monthly limit reached detected from server response")),Ac("API init success:",i),{sessionId:i.sessionId,endUserId:i.endUserId}}catch(e){throw Mc("API init error:",e),e}}async sendEvents(e,t,s){const r=e.filter(e=>e&&"object"==typeof e),n=await this.trackedFetch(`${this.baseUrl}/api/ingestion/events`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:$c({sessionId:t,events:r,endUserId:s,sdkVersion:Lc})});if(!n.ok){if(429===n.status)throw this.monthlyLimitReached=!0,new Error("429: Monthly video processing limit reached");throw new Error(`Failed to send events: ${n.statusText}`)}!0===(await n.json()).monthlyLimitReached&&(this.monthlyLimitReached=!0,Ac("Monthly limit reached detected from events response"))}async sendEventsChunked(e,t,s,r,n){if(!this.checkMonthlyLimit())return[];try{const i=[];let o=[];for(const a of e)if(a&&"object"==typeof a)if(Bc(o,a,t)){if(o.length>0){Pc(`[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:$c({sessionId:t,events:o,endUserId:s,windowId:r,automaticProperties:n,sdkVersion:Lc})});if(!e.ok){if(429===e.status)return this.monthlyLimitReached=!0,i.flat();throw new Error(`Failed to send events: ${e.statusText}`)}const a=await e.json();!0===a.monthlyLimitReached&&(this.monthlyLimitReached=!0,Ac("Monthly limit reached detected from chunked events response")),i.push(a),o=[]}o=zc(a,t)}else o.push(a);if(o.length>0){const e=await this._sendChunkWithRetry(o,t,s,r,n||o[0]?.automaticProperties);e&&i.push(e)}return i.flat()}catch(i){throw Mc("Error sending events:",i),this._persistEvents(e,t,s,r,n),i}}async _sendChunkWithRetry(e,t,s,r,n){let i=Math.min(this.currentBatchSize,e.length),o=0;for(;o<e.length;){const a=$c({sessionId:t,events:e.slice(o,o+i),endUserId:s,windowId:r,automaticProperties:n,sdkVersion:Lc}),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,n),null;if(413===c.status){_c(`413 error: reducing batch size from ${i} to ${Math.max(1,Math.floor(i/2))}`),this.currentBatchSize=Math.max(1,Math.floor(i/2)),i=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,n),null}const h=await c.json();if(!0===h.monthlyLimitReached&&(this.monthlyLimitReached=!0,Ac("Monthly limit reached detected from chunked events response")),o+=i,o>=e.length)return h}catch(i){return _c("Network error sending chunk, adding to retry queue:",i),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,n),null}}return null}_persistEvents(e,t,s,r,n){0!==e.length&&this.persistence.addToQueue({sessionId:t,events:e,endUserId:s,windowId:r,automaticProperties:n,timestamp:Date.now()})}async sendUserData(e,t,s){try{const r={userId:e,userAttributes:t,sessionId:s,posthogName:t.email||t.name||null};Pc("Sending user data to server:",r);const n=await this.trackedFetch(`${this.baseUrl}/api/ingestion/user`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:$c(r)});if(!n.ok)throw new Error(`Failed to send user data: ${n.statusText} with API key: ${this.apiKey}`);const i=await n.json();return Pc("Server response:",i),i}catch(e){throw Mc("Error sending user data:",e),e}}async sendUserAuth(e,t,s,r){try{const n=await this.trackedFetch(`${this.baseUrl}/api/ingestion/user/auth`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:$c({userId:e,userAttributes:t,sessionId:s,authFields:r})});if(!n.ok)throw new Error(`Failed to authenticate user: ${n.statusText} with API key: ${this.apiKey}`);return await n.json()}catch(e){throw Mc("Error authenticating user:",e),e}}sendBeaconEvents(e,t,s,r,n){const i={sessionId:t,events:e,endUserId:s||null,windowId:r,automaticProperties:n,sdkVersion:Lc,apiKey:this.apiKey},o=new Blob([$c(i)],{type:"application/json"});return navigator.sendBeacon(`${this.baseUrl}/api/ingestion/events`,o)}async sendCustomEvent(e,t,s,r){Ac("[SDK] Sending custom event",{sessionId:e,eventName:t,eventProperties:s,endUserId:r});try{const n=await this.trackedFetch(`${this.baseUrl}/api/ingestion/customEvent`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:$c({sessionId:e,eventName:t,eventProperties:s||{},endUserId:r||null})});if(Ac("[SDK] Custom event response",{status:n.status,statusText:n.statusText}),!n.ok){const e=await n.text();throw Mc("[SDK] Failed to send custom event",{status:n.status,statusText:n.statusText,errorText:e}),new Error(`Failed to send custom event: ${n.status} ${n.statusText} - ${e}`)}const i=await n.json();return Pc("[SDK] Custom event success",i),i}catch(r){throw Mc("[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:$c({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 Mc("Error sending custom event batch:",e),e}}async sendLog(e){try{if(Pc("[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:$c(e)});t.ok?Pc("[SDK] Log sent successfully"):_c("[SDK] Failed to send log to server:",t.status,t.statusText)}catch(e){_c("[SDK] Failed to send log to server:",e)}}async sendNetworkError(e){try{if(Pc("[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:$c(e)});t.ok?Pc("[SDK] Network error sent successfully"):_c("[SDK] Failed to send network error to server:",t.status,t.statusText)}catch(e){_c("[SDK] Failed to send network error to server:",e)}}async trackedFetch(e,t,s){const r=Date.now(),n=Ec(),i=this.shouldSkipNetworkTracking(e);if(this.cspBlocked&&"POST"===t.method&&"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon)return this.trackedFetchWithBeaconFallback(e,t,i);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<Uc,c=await fetch(e,{...t,signal:o?.signal,keepalive:l});a&&clearTimeout(a);const h=Date.now()-r;return c.ok||i||await this.sendNetworkError({requestId:n,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,_c("[SDK] CSP violation detected, falling back to sendBeacon for future requests"),this.trackedFetchWithBeaconFallback(e,t,i);throw i||await this.sendNetworkError({requestId:n,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 _c("[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=$c(t.body),s=t.body}if(e.includes("/api/ingestion/"))if(s&&"object"==typeof s)s.apiKey=this.apiKey,r=$c(s);else if(r)try{const e=JSON.parse(r);e.apiKey=this.apiKey,r=$c(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 n=r?new Blob([r],{type:"application/json"}):null;return navigator.sendBeacon(e,n)?(Pc("[SDK] Successfully sent request via sendBeacon (CSP fallback)"),new Response(null,{status:200,statusText:"OK",headers:new Headers})):(_c("[SDK] sendBeacon returned false - browser may be throttling"),new Response(null,{status:200,statusText:"OK (sendBeacon best-effort)",headers:new Headers}))}catch(e){return Mc("[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 Wc{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?Pc(`Redaction: Active for ${this.redactedFields.size} field(s):`,Array.from(this.redactedFields)):Pc("Redaction: No fields to redact"),this.applyRedactionClasses()}setFieldsToUnredact(e){this.unredactedFields.clear();const t=e.filter(e=>!this.isPasswordSelector(e)||(_c(`Cannot unredact password field: ${e} - Password fields are always protected`),!1));t.forEach(e=>this.unredactedFields.add(e)),t.length>0?Pc(`Unredaction: Active for ${t.length} field(s):`,t):Pc("Unredaction: No valid fields to unredact"),this.applyUnredactionClasses()}redactFields(e){e.forEach(e=>{this.unredactedFields.delete(e)}),this.unredactedFields.size>0?Pc(`Unredaction: Removed ${e.length} field(s), ${this.unredactedFields.size} remaining:`,Array.from(this.unredactedFields)):Pc("Unredaction: All fields redacted"),this.applyUnredactionClasses()}clearUnredactedFields(){this.unredactedFields.clear(),Pc("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")}),Pc(`Added rr-mask class to ${t.length} element(s) for selector: ${e}`)}catch(t){_c(`Invalid selector: ${e}`)}}):Pc("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")}),Pc(`Removed rr-mask class from ${t.length} element(s) for selector: ${e}`)}catch(t){_c(`Invalid selector: ${e}`)}}):Pc("DOM not ready, deferring unredaction class application"))}removeUnredactionClasses(){Pc("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){_c(`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){_c(`Invalid selector: ${t}`)}return!0}}new Wc;const Kc="undefined"!=typeof window;function Vc(){if(!Kc)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 Gc(e){try{return new URL(e).hostname}catch{return""}}function Hc(){if(!Kc)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(!Kc)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(!Kc)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:Vc(),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 Yc(){if(!Kc)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:Gc(t),initial_referrer:t,initial_referrer_domain:Gc(t),initial_host:window.location.hostname,...s}}function qc(){return{...Hc(),...Yc()}}function Zc(){if(!Kc)return{};const e=Yc();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 Jc{constructor(e={}){this.sessionProperties={},this.userProperties={},this.initialProperties={},this.isInitialized=!1,this.config={enableAutomaticProperties:!0,enableSessionProperties:!0,enableUserProperties:!0,propertyDenylist:[],...e},this.automaticProperties=qc(),this.initialize()}initialize(){this.isInitialized||(this.initialProperties=function(){if(!Kc)return{};const e=Yc();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}}(),this.loadSessionProperties(),this.isInitialized=!0)}getEventProperties(e={}){const t={...e};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)),this.applyDenylist(t),t}getAutomaticProperties(){return{...this.automaticProperties,...Zc()}}getAutomaticPropertiesWithGeoIP(e={}){return{...this.automaticProperties,...Zc(),...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=qc()}getAllProperties(){return{automatic:this.getAutomaticProperties(),session:{...this.sessionProperties},user:{...this.userProperties},initial:{...this.initialProperties}}}}const Qc="undefined"!=typeof window;class Xc{get isTrackerStarted(){return this.isStarted}setupDomReadyHandler(){if(Qc)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,Pc("π― 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(Pc("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:_c("Unknown request type:",e.type)}}registerDomReadyHandler(e){this.isDomReady?e():this.domReadyHandlers.push(e)}static init(e,t){if(Qc&&!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(Qc&&window.__humanBehaviorGlobalTracker)return Pc("Tracker already initialized, returning existing instance"),window.__humanBehaviorGlobalTracker;t?.logLevel&&this.configureLogging({level:t.logLevel});const s=new Xc(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._sessionActivityTimestamp=null,this._sessionStartTimestamp=null,this.userProperties={},this.isProcessing=!1,this.flushInterval=null,this.FLUSH_INTERVAL_MS=3e3,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._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.deadClickTracker={pendingClicks:new Map},this.DEAD_CLICK_SCROLL_THRESHOLD_MS=100,this.DEAD_CLICK_SELECTION_THRESHOLD_MS=100,this.DEAD_CLICK_MUTATION_THRESHOLD_MS=2e3,this.DEAD_CLICK_ABSOLUTE_TIMEOUT_MS=1400,!e)throw new Error("Human Behavior API Key is required");const r=t||"https://ingest.humanbehavior.co";if(this.api=new jc({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 Wc({redactionStrategy:s?.redactionStrategy,legacyRedactFields:s?.redactFields}),this.propertyManager=new Jc({enableAutomaticProperties:!1!==s?.enableAutomaticProperties,propertyDenylist:s?.propertyDenylist||[]}),Qc){const e="human_behavior_end_user_id",t=this.getCookie(e);this.endUserId=t||Ec(),t?Pc(`Reusing existing endUserId: ${this.endUserId}`):(this.setCookie(e,this.endUserId,365),Pc(`Generated new endUserId: ${this.endUserId}`))}else this.endUserId=Ec();if(Qc){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=Ec(),this.windowId=Ec();this.api.setTrackingContext(this.sessionId,this.endUserId),this.initializationPromise=this.init().catch(e=>{Mc("Initialization failed:",e)})}async init(){try{Qc?(this.setupPageUnloadHandler(),this.setupNavigationTracking()):Ac("HumanBehaviorTracker initialized in server environment. Session tracking is disabled."),this.initialized=!0,Ac(`HumanBehaviorTracker initialized with sessionId: ${this.sessionId}, endUserId: ${this.endUserId}`)}catch(e){Mc("Failed to initialize HumanBehaviorTracker:",e),this.initialized=!0}}async ensureInitialized(){this.initializationPromise&&await this.initializationPromise}setupNavigationTracking(){if(!Qc||this.navigationTrackingEnabled)return;this.navigationTrackingEnabled=!0,Pc("Setting up navigation tracking"),this.originalPushState=history.pushState,this.originalReplaceState=history.replaceState,history.pushState=(...e)=>{this.previousUrl=this.currentUrl,this.currentUrl=window.location.href,this.originalPushState.apply(history,e),this.trackNavigationEvent("pushState",this.previousUrl,this.currentUrl),this.takeFullSnapshot()},history.replaceState=(...e)=>{this.previousUrl=this.currentUrl,this.currentUrl=window.location.href,this.originalReplaceState.apply(history,e),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=()=>{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)try{const r={type:e,from:t,to:s,timestamp:(new Date).toISOString(),pathname:window.location.pathname,search:window.location.search,hash:window.location.hash,referrer:document.referrer};if(await this.addEvent({type:5,data:{payload:{eventType:"navigation",...r}},timestamp:Date.now()}),"pageLoad"===e||"pushState"===e||"replaceState"===e||"popstate"===e||"hashchange"===e){const s={url:window.location.href,fromUrl:t,navigationType:e,pathname:window.location.pathname,search:window.location.search,hash:window.location.hash,referrer:document.referrer,timestamp:Date.now()};await this.customEvent("$page_viewed",s)}Pc(`Navigation tracked: ${e} from ${t} to ${s}`)}catch(e){Mc("Failed to track navigation event:",e)}}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()}),Pc(`Pageview tracked: ${t.url}`)}catch(e){Mc("Failed to track pageview event:",e)}}}async customEvent(e,t){this.endUserId||(_c(`endUserId not available, using anonymous ID for event: ${e}`),this.endUserId=Ec()),Qc&&this.checkAndRefreshSession();const s=this.propertyManager.getEventProperties(t);if(this.shouldSkipDueToMinimumDuration())return Pc(`Custom event '${e}' queued due to session duration below minimum`),void this.pendingCustomEvents.push({eventName:e,properties:s,timestamp:Date.now()});await this.flushPendingCustomEvents();try{await this.api.sendCustomEvent(this.sessionId,e,s,this.endUserId),Pc(`Custom event tracked: ${e}`,s)}catch(t){Mc("Failed to track custom event:",t),t.message?.includes("500")||t.message?.includes("Internal Server Error")||t.message?.includes("Failed to send custom event")?_c("Custom event endpoint failed, using fallback"):t.message?.includes("ERR_BLOCKED_BY_CLIENT")?_c("Custom event request blocked by ad blocker, using fallback"):t.message?.includes("Failed to fetch")&&_c("Custom event network error, using fallback");try{const t={eventName:e,properties:s||{},timestamp:(new Date).toISOString(),url:window.location.href,pathname:window.location.pathname};await this.addEvent({type:5,data:{payload:{eventType:"custom",...t}},timestamp:Date.now()}),Pc(`Custom event added to event stream as fallback: ${e}`)}catch(e){Mc("Failed to add custom event to event stream as fallback:",e)}}}setupAutomaticTracking(e){if(!Qc)return;const t={trackButtons:!1!==e?.trackButtons,trackLinks:!1,trackForms:!1!==e?.trackForms,includeText:!1!==e?.includeText,includeClasses:e?.includeClasses||!1};Pc("Setting up automatic tracking with config:",t),t.trackButtons&&this.setupAutomaticButtonTracking(t),t.trackForms&&this.setupAutomaticFormTracking(t),this.setupRageClickDetection()}setupAutomaticButtonTracking(e){document.addEventListener("click",async t=>{const s=t.target;if("BUTTON"===s.tagName||s.closest("button")){const t="BUTTON"===s.tagName?s:s.closest("button"),r={buttonId:t.id||null,buttonType:t.type||"button",page:window.location.pathname,timestamp:Date.now()};e.includeText&&(r.buttonText=t.textContent?.trim()||null),e.includeClasses&&(r.buttonClass=t.className||null),Object.keys(r).forEach(e=>{null===r[e]&&delete r[e]}),await this.customEvent("$button_clicked",r)}})}setupRageClickDetection(){Qc&&document.addEventListener("click",async e=>{const t=e.target,s=e.clientX,r=e.clientY,n=Date.now();if(this.isRageClick(s,r,n,t)){const e=t.closest('button, a, [role="button"], [role="link"]')||t,i={x:s,y:r,page:window.location.pathname,element:e.tagName.toLowerCase(),clickCount:this.RAGE_CLICK_CLICK_COUNT,timestamp:n};e.id&&(i.elementId=e.id),e.className&&(i.elementClass=e.className),e.textContent&&(i.elementText=e.textContent.trim().substring(0,100)),Object.keys(i).forEach(e=>{null!==i[e]&&void 0!==i[e]||delete i[e]}),await this.customEvent("$rageclick",i),this.rageClickTracker.clicks=[]}})}isRageClick(e,t,s,r){const n=this.rageClickTracker.clicks,i=n[n.length-1];if(i&&Math.abs(e-i.x)+Math.abs(t-i.y)<this.RAGE_CLICK_THRESHOLD_PX&&s-i.timestamp<this.RAGE_CLICK_TIMEOUT_MS){if(n.push({x:e,y:t,timestamp:s,element:r}),n.length>=this.RAGE_CLICK_CLICK_COUNT)return!0}else this.rageClickTracker.clicks=[{x:e,y:t,timestamp:s,element:r}];return!1}isInteractiveElement(e){const t=e.tagName.toLowerCase();if("button"===t||"a"===t)return!0;if(["input","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"]')}setupAutomaticLinkTracking(e){}setupAutomaticFormTracking(e){document.addEventListener("submit",async t=>{const s=t.target,r=new FormData(s),n={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&&(n.formClass=s.className||null),Object.keys(n).forEach(e=>{null===n[e]&&delete n[e]}),await this.customEvent("$form_submitted",n)})}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,Pc("Navigation tracking cleaned up"))}static logToStorage(e){Ac(e)}static configureLogging(e){Tc.setConfig({level:{none:0,error:1,warn:2,info:3,debug:4}[e.level||"error"],enableConsole:!1!==e.enableConsole,enableStorage:e.enableStorage||!1})}enableConsoleTracking(){Qc&&!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,Pc("Console tracking enabled"))}enableNetworkTracking(){Qc&&!this.networkTrackingEnabled&&"undefined"!=typeof fetch&&(this.originalFetch=window.fetch.bind(window),window.fetch=async(e,t)=>{const s=Date.now(),r=Ec(),n="string"==typeof e?e:e instanceof URL?e.toString():e.url,i=(t?.method||("object"==typeof e&&"method"in e?e.method:void 0)||"GET").toUpperCase(),o=this.shouldSkipNetworkTracking(n);let a=null,l=!1;o||(a=setTimeout(()=>{const e=Date.now()-s;if(!l){l=!0;const t={requestId:r,url:n,method:i,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:`${i} ${n}`,spanStatus:"slow",attributes:{"http.method":i,"http.url":n,"request.duration_ms":e,"request.long_loading_threshold_ms":1e4}};return this.shouldSkipDueToMinimumDuration()?(Pc("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:n,method:i,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:`${i} ${n}`,spanStatus:"error",attributes:{"http.status_code":l.status,"http.status_text":l.statusText}};if(this.shouldSkipDueToMinimumDuration())return Pc("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:n,method:i,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:`${i} ${n}`,spanStatus:"error",attributes:{"error.name":e.name,"error.message":e.message}};if(this.shouldSkipDueToMinimumDuration())throw Pc("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,Pc("Network tracking enabled"))}async flushPendingCustomEvents(){if(0===this.pendingCustomEvents.length)return;const e=[...this.pendingCustomEvents];this.pendingCustomEvents=[],Pc(`Flushing ${e.length} pending custom events`);for(const{eventName:t,properties:s}of e)try{await this.api.sendCustomEvent(this.sessionId,t,s,this.endUserId)}catch(e){Mc("Failed to flush pending custom event:",e)}}async flushPendingLogs(){if(0===this.pendingLogs.length)return;const e=[...this.pendingLogs];this.pendingLogs=[],Pc(`Flushing ${e.length} pending logs`);for(const{logData:t}of e)try{await this.api.sendLog(t)}catch(e){Mc("Failed to flush pending log:",e)}}async flushPendingNetworkErrors(){if(0===this.pendingNetworkErrors.length)return;const e=[...this.pendingNetworkErrors];this.pendingNetworkErrors=[],Pc(`Flushing ${e.length} pending network errors`);for(const{errorData:t}of e)try{await this.api.sendNetworkError(t)}catch(e){Mc("Failed to flush pending network error:",e)}}enablePageLoadTracking(){Qc&&"undefined"!=typeof window&&("complete"===document.readyState?this.trackPageLoad():window.addEventListener("load",()=>{this.trackPageLoad()}),Pc("Page load tracking enabled"))}trackPageLoad(){if(Qc&&"undefined"!=typeof performance)try{const e=performance.getEntriesByType("navigation")[0];if(!e)return;const t=e.loadEventEnd-e.fetchStart;if(t>3e3){const s=Ec(),r=e.domContentLoadedEventEnd-e.fetchStart,n=e.domComplete-e.fetchStart,i={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":n}};if(this.shouldSkipDueToMinimumDuration())return Pc("Slow page load network error queued due to session duration below minimum"),void this.pendingNetworkErrors.push({errorData:i,timestamp:Date.now()});this.flushPendingNetworkErrors(),this.api.sendNetworkError(i).catch(()=>{})}}catch(e){_c("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(){Qc&&this.consoleTrackingEnabled&&(this.originalConsole&&(console.log=this.originalConsole.log,console.warn=this.originalConsole.warn,console.error=this.originalConsole.error),this.consoleTrackingEnabled=!1,Pc("Console tracking disabled"))}trackConsoleEvent(e,t){if(this.initialized)if("log"!==e)try{if(Rc)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:Qc?window.location.href:"",userAgent:Qc?navigator.userAgent:"",stack:s,sessionId:this.sessionId,endUserId:this.endUserId};if(this.shouldSkipDueToMinimumDuration())return Pc(`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){Mc("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 n=s[e].trim().toLowerCase();if(n&&"error"!==n&&!n.startsWith("error:")&&!t.some(e=>n.includes(e.toLowerCase()))){r=!0;break}}return!r}setupPageUnloadHandler(){if(!Qc)return;Pc("Setting up page unload handler"),window.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState?(Pc("Page hidden - sending pending events"),this.flushEvents()):"visible"===document.visibilityState&&(Pc("Page visible - taking full snapshot for multi-window replay"),this.takeFullSnapshot())});const e="onpagehide"in window?"pagehide":"beforeunload";window.addEventListener(e,()=>{Pc("Page unloading - sending final events via sendBeacon");const e=this.minimumDurationMilliseconds,t=this.getSessionDuration();if(null!==t&&t>=0&&t<e)return void Pc(`Session duration (${t}ms) below minimum (${e}ms), not sending on unload`);const s=[...this.eventQueue];if(Qc&&window.__hb_pending_snapshots){const e=window.__hb_pending_snapshots;Array.isArray(e)&&e.length>0&&(Pc("Including pending FullSnapshot(s) in sendBeacon for short session"),s.unshift(...e),delete window.__hb_pending_snapshots)}if(s.length>0&&this.api)try{const e=this.propertyManager.getAutomaticProperties();this.api.sendBeaconEvents(s,this.sessionId,this.endUserId||void 0,this.windowId,e),this.eventQueue=[]}catch(e){_c("Failed to send events via sendBeacon on unload:",e)}this.api&&this.api.unload()});const t=()=>{localStorage.setItem("human_behavior_last_activity",Date.now().toString())};window.addEventListener("click",t),window.addEventListener("keydown",t),window.addEventListener("scroll",t),window.addEventListener("mousemove",t)}viewLogs(){try{const e=Tc.getLogs();Ac("HumanBehavior Logs:",e),Tc.clearLogs()}catch(e){Mc("Failed to read logs:",e)}}async identifyUser({userProperties:e}){const t=this.endUserId;this.userProperties=e,Pc("Identifying user:",{userProperties:e,originalEndUserId:t,sessionId:this.sessionId}),!Qc||this.propertyManager.getAutomaticProperties();const s=await this.api.sendUserData(t||"",e,this.sessionId);if(s.actualUserId||s.wasExistingUser){const r=s.actualUserId||t;if(r&&r!==t){const s="human_behavior_end_user_id";if(this.setCookie(s,r,365),Qc)try{localStorage.setItem(s,r)}catch(e){Pc("Failed to set canonical endUserId in localStorage:",e)}Pc(`π Preexisting user detected. Future sessions will use canonical ID: ${r} (current session stays: ${t})`)}}return t||""}getUserAttributes(){return{...this.userProperties}}async start(){if(!Qc)return;if(this.isStarted)return void Pc("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.enableConsoleTrackingFlag&&this.enableConsoleTracking(),this.enableNetworkTrackingFlag&&this.enableNetworkTracking(),this.enablePageLoadTracking();const e=()=>{if(this.recordInstance)return void Pc("π― Recording already started, skipping duplicate start");Pc("π― DOM ready, starting session recording"),this.rrwebRecord=wc;const e=wc({emit:e=>{this.addRecordingEvent(e),2===e.type&&Pc(`π― 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(Pc(`π― DOM ready state: ${document.readyState}`),"complete"===document.readyState||"interactive"===document.readyState)Pc(`π― DOM ready (${document.readyState}), starting recording immediately`),e();else{Pc("π― DOM not ready, waiting for DOMContentLoaded event");const t=()=>("interactive"===document.readyState||"complete"===document.readyState)&&(Pc(`π― DOM ready (${document.readyState}), starting recording`),e(),!0);if(t())return;document.addEventListener("DOMContentLoaded",()=>{Pc("π― DOMContentLoaded fired, starting recording"),e()},{once:!0});const s=setInterval(()=>{t()&&clearInterval(s)},10);setTimeout(()=>clearInterval(s),5e3)}}takeFullSnapshot(){this.fullSnapshotTimeout&&clearTimeout(this.fullSnapshotTimeout),this.fullSnapshotTimeout=window.setTimeout(()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{try{this.rrwebRecord&&"function"==typeof this.rrwebRecord.takeFullSnapshot?(this.rrwebRecord.takeFullSnapshot(),Pc("β
FullSnapshot taken (delayed for animations)")):_c("β οΈ takeFullSnapshot not available on record function")}catch(e){Mc("β Failed to take FullSnapshot:",e)}})})},1e3)}async stop(){await this.ensureInitialized(),Qc&&(this.flushInterval&&(clearInterval(this.flushInterval),this.flushInterval=null),this.recordInstance&&(this.recordInstance(),this.recordInstance=null),this.fullSnapshotTimeout&&(clearTimeout(this.fullSnapshotTimeout),this.fullSnapshotTimeout=null),this.rrwebRecord=null,this.disableConsoleTracking(),this.cleanupNavigationTracking())}async addEvent(e){if(Qc&&this.checkAndRefreshSession(),e&&"object"==typeof e){if(2===e.type){const t=!!e.data,s=!(!e.data||!e.data.node);Pc(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(),Pc("Queue is full, the oldest event is dropped.")),this.eventQueue.push(e),2===e.type?(Pc("FullSnapshot added, triggering immediate flush"),this.flushEvents()):this.eventQueue.length>=.8*this.MAX_QUEUE_SIZE&&(Pc(`Queue at ${this.eventQueue.length}/${this.MAX_QUEUE_SIZE}, triggering immediate flush`),this.flushEvents())}else Pc("β οΈ 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)&&(Pc(`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 Pc(`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&&Qc&&(window.__hb_pending_snapshots=s,setTimeout(()=>{delete window.__hb_pending_snapshots},5e3)),t.length>0){Pc("Flushing events:",t);const s=t.filter(e=>2===e.type);s.length>0&&Pc(`[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"))_c("Session expired, events will be lost");else if(e.message?.includes("413")||e.message?.includes("Content Too Large"))_c("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;_c("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?(Pc("β
User activity detected, exiting idle state"),this._isIdle=!1,this.rrwebRecord&&"function"==typeof this.rrwebRecord.takeFullSnapshot&&(this.rrwebRecord.takeFullSnapshot(),Pc("β
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&&(Pc(`βΈοΈ Session idle detected (${Math.round(e/1e3)}s since last activity) - stopping background event recording`),Pc(`βΉοΈ Session will expire after 15 minutes of inactivity (${Math.round((9e5-e)/1e3)}s remaining)`),this._isIdle=!0,this.flushEvents())}}async addRecordingEvent(e){if(Qc&&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);Pc(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(),Pc("Queue is full, the oldest event is dropped.")),this.eventQueue.push(e),2===e.type?(Pc("FullSnapshot added, triggering immediate flush"),this.flushEvents()):!0!==this._isIdle&&this.eventQueue.length>=.8*this.MAX_QUEUE_SIZE&&(Pc(`Queue at ${this.eventQueue.length}/${this.MAX_QUEUE_SIZE}, triggering immediate flush`),this.flushEvents())}}else Pc("β οΈ Skipping invalid recording event:",e)}_canUseSessionStorage(){if(!Qc)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),Pc(`Stored windowId in sessionStorage: ${e}`)}catch(e){_c("Failed to store windowId in sessionStorage:",e)}}_removeWindowIdFromStorage(){if(this._canUseSessionStorage())try{sessionStorage.removeItem(this._window_id_storage_key)}catch(e){_c("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){_c("Failed to set primary_window_exists flag:",e)}}getOrCreateWindowId(){if(!Qc)return Ec();const e=this._getWindowIdFromStorage(),t=this._getPrimaryWindowExists();if(e&&!t)return Pc(`Reusing windowId from previous page load: ${e}`),this._setWindowIdInStorage(e),this._setPrimaryWindowExists(!0),e;{const e=Ec();return Pc(`Creating new windowId: ${e} (new window/tab detected)`),this._setWindowIdInStorage(e),this._setPrimaryWindowExists(!0),e}}setupWindowUnloadListener(){Qc&&window.addEventListener("beforeunload",()=>{this._canUseSessionStorage()&&(this._setPrimaryWindowExists(!1),Pc("Cleared primary_window_exists flag on beforeunload"))},{capture:!1})}setCookie(e,t,s){if(Qc)try{const r=new Date;r.setTime(r.getTime()+24*s*60*60*1e3);const n=`expires=${r.toUTCString()}`;document.cookie=`${e}=${t};${n};path=/;SameSite=Lax`,localStorage.setItem(e,t),Pc(`Set cookie and localStorage: ${e}`)}catch(s){try{localStorage.setItem(e,t),Pc(`Cookie blocked, using localStorage: ${e}`)}catch(e){Mc("Failed to store user ID in both cookie and localStorage:",e)}}}getCookie(e){if(!Qc)return null;try{const t=e+"=",s=document.cookie.split(";");for(let r=0;r<s.length;r++){let n=s[r];for(;" "===n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(t)){const s=n.substring(t.length,n.length);return Pc(`Found cookie: ${e}`),s}}const r=localStorage.getItem(e);return r?(Pc(`Cookie not found, using localStorage: ${e}`),r):null}catch(t){try{const t=localStorage.getItem(e);if(t)return Pc(`Cookie access failed, using localStorage: ${e}`),t}catch(e){Mc("Failed to access both cookie and localStorage:",e)}return null}}deleteCookie(e){if(Qc){try{document.cookie=`${e}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/; SameSite=Lax`,Pc(`Deleted cookie: ${e}`)}catch(t){Mc(`Failed to delete cookie: ${e}`,t)}try{localStorage.removeItem(e),Pc(`Removed from localStorage: ${e}`)}catch(t){Mc(`Failed to remove from localStorage: ${e}`,t)}}}logout(){if(Qc)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=Ec(),this.setCookie("human_behavior_end_user_id",this.endUserId,365),this.sessionId=this.createNewSession(t),this.windowId=Ec(),this._setWindowIdInStorage(this.windowId),this.api.setTrackingContext(this.sessionId,this.endUserId),this.takeFullSnapshot(),Ac("User logged out - cleared all user data and started fresh session")}catch(e){Mc("Error during logout:",e)}}async redact(e){await this.ensureInitialized(),Qc?this.redactionManager=new Wc(e):_c("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(!Qc)return;const e="human_behavior_session",t=Date.now(),s=this.getStoredSession(e);if(!s||!s.sessionId)return this.createNewSession(e),this.windowId=Ec(),this._setWindowIdInStorage(this.windowId),this.api.setTrackingContext(this.sessionId,this.endUserId),this.takeFullSnapshot(),void Pc(`Created new session (no stored session): ${this.sessionId}`);this.updateSessionActivity(e,t,s.sessionId,s.sessionStartTimestamp)}getOrCreateSessionId(){if(!Qc)return Ec();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,n=t-s.sessionStartTimestamp;if(r>9e5||n>864e5){Pc(`Session expired: idle=${r}ms, age=${n}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=9e5,r=864e5;if(this.sessionId&&null!==this._sessionActivityTimestamp&&null!==this._sessionStartTimestamp){const n=t-this._sessionActivityTimestamp,i=t-this._sessionStartTimestamp;if(!(n>s||i>r))return{sessionId:this.sessionId,lastActivityTimestamp:this._sessionActivityTimestamp,sessionStartTimestamp:this._sessionStartTimestamp};{Pc("Session in memory expired: creating new session immediately");const t=this.sessionId;if(this.createNewSession(e),this.windowId=Ec(),this._setWindowIdInStorage(this.windowId),this.api.setTrackingContext(this.sessionId,this.endUserId),this.takeFullSnapshot(),Ac(`π 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 n=localStorage.getItem(e);if(!n)return null;const i=JSON.parse(n),o=t-i.lastActivityTimestamp,a=t-i.sessionStartTimestamp;if(o>s||a>r){Pc(`Session in localStorage expired: idle=${Math.round(o/1e3/60)}min, age=${Math.round(a/1e3/60/60)}hrs`);const t=i.sessionId;if(this.createNewSession(e),this.windowId=Ec(),this._setWindowIdInStorage(this.windowId),this.api.setTrackingContext(this.sessionId,this.endUserId),this.takeFullSnapshot(),Ac(`π 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 i.sessionId&&(this.sessionId=i.sessionId,this._sessionActivityTimestamp=i.lastActivityTimestamp,this._sessionStartTimestamp=i.sessionStartTimestamp),i}catch{return null}}createNewSession(e){const t=Ec(),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){_c(`Failed to save session to localStorage: ${e}`)}return Pc(`Created new session: ${t}`),t}updateSessionActivity(e,t,s,r){this.sessionId=s,this._sessionActivityTimestamp=t,this._sessionStartTimestamp=r;const n={sessionId:s,lastActivityTimestamp:t,sessionStartTimestamp:r};try{localStorage.setItem(e,JSON.stringify(n))}catch(e){_c(`Failed to update session in localStorage: ${e}`)}}getSessionId(){return this.sessionId}getCurrentUrl(){return 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(!Qc)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()}}Qc&&(window.HumanBehaviorTracker=Xc);const eh=(e,t,s)=>new Xc(e,t,s);"undefined"!=typeof window&&(window.HumanBehaviorTracker=Xc,window.humanbehavior={init:eh});const th=()=>"undefined"!=typeof window,sh=r(null),rh=({apiKey:r,client:c,children:h,options:u})=>{const[d,p]=n(c||null),[m,f]=n([]),[g,y]=n(!1),[w,v]=n(!1),S=i(r),b=i(c),C=i(m);o(()=>{S.current=r,b.current=c},[r,c]),o(()=>{C.current=m},[m]);const I=a(e=>{f(t=>[...t,e])},[]);o(()=>{y(!0)},[]),o(()=>{if(th()){if(b.current)return p(b.current),void v(!0);if(S.current&&""!==S.current.trim()){if(null===d)try{const e=Xc.init(S.current.trim(),{ingestionUrl:u?.ingestionUrl,logLevel:u?.logLevel,redactFields:u?.redactFields,redactionStrategy:u?.redactionStrategy,enableAutomaticTracking:u?.enableAutomaticTracking,suppressConsoleErrors:u?.suppressConsoleErrors,recordCanvas:u?.recordCanvas,enableAutomaticProperties:u?.enableAutomaticProperties,propertyDenylist:u?.propertyDenylist,automaticTrackingOptions:u?.automaticTrackingOptions,maxQueueSize:u?.maxQueueSize,enableConsoleTracking:u?.enableConsoleTracking,enableNetworkTracking:u?.enableNetworkTracking});p(e),v(!0),e.initializationPromise?.then(async()=>{e.isTrackerStarted||await e.start();const t=C.current;if(t.length>0){for(const s of t)if("identify"===s.type){Pc("Processing queued identify event",s);try{await e.identifyUser({userProperties:s.userProperties})}catch(e){Mc("Failed to process queued user info:",e)}}else e.addEvent(s);f([])}}).catch(e=>{Mc("Failed to initialize HumanBehaviorTracker:",e)})}catch(e){Mc("Failed to create HumanBehaviorTracker:",e)}}else Mc("An apiKey is required when no client is provided")}},[g]);const k=l(()=>g&&w?d:nh(I),[g,w,d,I]);return th()?s(sh.Provider,{value:k,children:[e(lh,{}),h]}):e(t,{children:h})},nh=e=>({addEvent:t=>{e(t)},identifyUser:async({userProperties:t})=>(e({type:"identify",userProperties:t}),""),start:()=>{},stop:()=>{},logout:()=>{},viewLogs:()=>{_c("Logs are not available until HumanBehaviorTracker is initialized")},setUnredactedFields:()=>{},hasUnredactedFields:()=>!1,getUnredactedFields:()=>[],trackPageView:()=>{}}),ih=()=>{const e=c(sh);if(!e)throw new Error("useHumanBehavior must be used within a HumanBehaviorProvider");return e},oh=()=>{const e=ih();return{setUnredactedFields:a(t=>{e.setUnredactedFields(t)},[e]),hasUnredactedFields:a(()=>e.hasUnredactedFields(),[e]),getUnredactedFields:a(()=>e.getUnredactedFields(),[e])}},ah=()=>{const e=ih();return{identifyUser:a(async({userProperties:t})=>{try{return await e.identifyUser({userProperties:t}),{success:!0}}catch(e){return Mc("Failed to identify user:",e),{success:!1,error:e}}},[e])}};function lh(){const e=c(sh);return o(()=>{if(e&&"undefined"!=typeof window){e.trackPageView();const t=()=>{e.trackPageView()};window.addEventListener("popstate",t);const s=history.pushState,r=history.replaceState;return history.pushState=function(...e){s.apply(this,e),t()},history.replaceState=function(...e){r.apply(this,e),t()},()=>{window.removeEventListener("popstate",t),history.pushState=s,history.replaceState=r}}},[e]),null}export{rh as HumanBehaviorProvider,Xc as HumanBehaviorTracker,ih as useHumanBehavior,oh as useRedaction,ah as useUserTracking};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|