humanbehavior-js
Version:
SDK for HumanBehavior session and event recording
1 lines • 258 kB
JavaScript
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