UNPKG

@amplitude/rrweb-snapshot

Version:

rrweb's component to take a snapshot of DOM, aka DOM serializer

37 lines (36 loc) 82 kB
(function (g, f) { if ("object" == typeof exports && "object" == typeof module) { module.exports = f(); } else if ("function" == typeof define && define.amd) { define("rrwebSnapshot", [], f); } else if ("object" == typeof exports) { exports["rrwebSnapshot"] = f(); } else { g["rrwebSnapshot"] = f(); } }(this, () => { var exports = {}; var module = { exports }; "use strict";var Qr=Object.defineProperty,Zr=Object.defineProperties;var Xr=Object.getOwnPropertyDescriptors;var fe=Object.getOwnPropertySymbols;var Ot=Object.prototype.hasOwnProperty,Rt=Object.prototype.propertyIsEnumerable;var Et=(i,e,t)=>e in i?Qr(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,$=(i,e)=>{for(var t in e||(e={}))Ot.call(e,t)&&Et(i,t,e[t]);if(fe)for(var t of fe(e))Rt.call(e,t)&&Et(i,t,e[t]);return i},Z=(i,e)=>Zr(i,Xr(e));var ze=(i,e)=>{var t={};for(var r in i)Ot.call(i,r)&&e.indexOf(r)<0&&(t[r]=i[r]);if(i!=null&&fe)for(var r of fe(i))e.indexOf(r)<0&&Rt.call(i,r)&&(t[r]=i[r]);return t};var ei=Object.defineProperty,ti=(i,e,t)=>e in i?ei(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,Nt=(i,e,t)=>ti(i,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var y=(i=>(i[i.Document=0]="Document",i[i.DocumentType=1]="DocumentType",i[i.Element=2]="Element",i[i.Text=3]="Text",i[i.CDATA=4]="CDATA",i[i.Comment=5]="Comment",i))(y||{});const At={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Mt={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},ce={};function ri(i){var e,t;const r=(t=(e=globalThis==null?void 0:globalThis.Zone)==null?void 0:e.__symbol__)==null?void 0:t.call(e,i);if(r&&globalThis[r])return globalThis[r]}function ft(i){if(ce[i])return ce[i];const e=ri(i)||globalThis[i],t=e.prototype,r=i in At?At[i]:void 0,s=!!(r&&r.every(l=>{var a,u;return!!((u=(a=Object.getOwnPropertyDescriptor(t,l))==null?void 0:a.get)!=null&&u.toString().includes("[native code]"))})),o=i in Mt?Mt[i]:void 0,n=!!(o&&o.every(l=>{var a;return typeof t[l]=="function"&&((a=t[l])==null?void 0:a.toString().includes("[native code]"))}));if(s&&n)return ce[i]=e.prototype,e.prototype;try{const l=document.createElement("iframe");document.body.appendChild(l);const a=l.contentWindow;if(!a)return e.prototype;const u=a[i].prototype;return document.body.removeChild(l),u?ce[i]=u:t}catch(l){return t}}const je={};function U(i,e,t){var r;const s=`${i}.${String(t)}`;if(je[s])return je[s].call(e);const o=ft(i),n=(r=Object.getOwnPropertyDescriptor(o,t))==null?void 0:r.get;return n?(je[s]=n,n.call(e)):e[t]}const We={};function Qt(i,e,t){const r=`${i}.${String(t)}`;if(We[r])return We[r].bind(e);const o=ft(i)[t];return typeof o!="function"?e[t]:(We[r]=o,o.bind(e))}function ii(i){return U("Node",i,"childNodes")}function si(i){return U("Node",i,"parentNode")}function ni(i){return U("Node",i,"parentElement")}function oi(i){return U("Node",i,"textContent")}function li(i,e){return Qt("Node",i,"contains")(e)}function ai(i){return Qt("Node",i,"getRootNode")()}function ui(i){return!i||!("host"in i)?null:U("ShadowRoot",i,"host")}function fi(i){return i.styleSheets}function ci(i){return!i||!("shadowRoot"in i)?null:U("Element",i,"shadowRoot")}function hi(i,e){return U("Element",i,"querySelector")(e)}function pi(i,e){return U("Element",i,"querySelectorAll")(e)}function di(){return ft("MutationObserver").constructor}const N={childNodes:ii,parentNode:si,parentElement:ni,textContent:oi,contains:li,getRootNode:ai,host:ui,styleSheets:fi,shadowRoot:ci,querySelector:hi,querySelectorAll:pi,mutationObserver:di};function _e(i){return i.nodeType===i.ELEMENT_NODE}function Zt(i){const e=i&&"host"in i&&"mode"in i&&N.host(i)||null;return!!(e&&"shadowRoot"in e&&N.shadowRoot(e)===i)}function Se(i){return Object.prototype.toString.call(i)==="[object ShadowRoot]"}function mi(i){return i.includes(" background-clip: text;")&&!i.includes(" -webkit-background-clip: text;")&&(i=i.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),i}function Xt(i){const{cssText:e}=i;if(e.split('"').length<3)return e;const t=["@import",`url(${JSON.stringify(i.href)})`];return i.layerName===""?t.push("layer"):i.layerName&&t.push(`layer(${i.layerName})`),i.supportsText&&t.push(`supports(${i.supportsText})`),i.media.length&&t.push(i.media.mediaText),t.join(" ")+";"}function Ee(i){try{const e=i.rules||i.cssRules;if(!e)return null;let t=i.href;!t&&i.ownerNode&&i.ownerNode.ownerDocument&&(t=i.ownerNode.ownerDocument.location.href);const r=Array.from(e,s=>er(s,t)).join("");return mi(r)}catch(e){return null}}function er(i,e){if(rr(i)){let t;try{t=Ee(i.styleSheet)||Xt(i)}catch(r){t=i.cssText}return i.styleSheet.href?re(t,i.styleSheet.href):t}else{let t=i.cssText;return ir(i)&&i.selectorText.includes(":")&&(t=tr(t)),e?re(t,e):t}}function tr(i){const e=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return i.replace(e,"$1\\$2")}function rr(i){return"styleSheet"in i}function ir(i){return"selectorText"in i}class ke{constructor(){Nt(this,"idNodeMap",new Map),Nt(this,"nodeMetaMap",new WeakMap)}getId(e){var t;if(!e)return-1;const r=(t=this.getMeta(e))==null?void 0:t.id;return r!=null?r:-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(r=>this.removeNodeFromMap(r))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const r=t.id;this.idNodeMap.set(r,e),this.nodeMetaMap.set(e,t)}replace(e,t){const r=this.getNode(e);if(r){const s=this.nodeMetaMap.get(r);s&&this.nodeMetaMap.set(t,s)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function gi(){return new ke}function sr({element:i,maskInputOptions:e,tagName:t,type:r,value:s,maskInputFn:o}){let n=s||"";const l=r&&le(r);return(e[t.toLowerCase()]||l&&e[l])&&(o?n=o(n,i):n="*".repeat(n.length)),n}function le(i){return i.toLowerCase()}const _t="__rrweb_original__";function nr(i){const e=i.getContext("2d");if(!e)return!0;const t=50;for(let r=0;r<i.width;r+=t)for(let s=0;s<i.height;s+=t){const o=e.getImageData,n=_t in o?o[_t]:o;if(new Uint32Array(n.call(e,r,s,Math.min(t,i.width-r),Math.min(t,i.height-s)).data.buffer).some(a=>a!==0))return!1}return!0}function or(i,e){return!i||!e||i.type!==e.type?!1:i.type===y.Document?i.compatMode===e.compatMode:i.type===y.DocumentType?i.name===e.name&&i.publicId===e.publicId&&i.systemId===e.systemId:i.type===y.Comment||i.type===y.Text||i.type===y.CDATA?i.textContent===e.textContent:i.type===y.Element?i.tagName===e.tagName&&JSON.stringify(i.attributes)===JSON.stringify(e.attributes)&&i.isSVG===e.isSVG&&i.needBlock===e.needBlock:!1}function lr(i){const e=i.type;return i.hasAttribute("data-rr-is-password")?"password":e?le(e):null}function ct(i,e){var o;let t;try{t=new URL(i,e!=null?e:window.location.href)}catch(n){return null}const r=/\.([0-9a-z]+)(?:$)/i,s=t.pathname.match(r);return(o=s==null?void 0:s[1])!=null?o:null}function yi(i){let e="";return i.indexOf("//")>-1?e=i.split("/").slice(0,3).join("/"):e=i.split("/")[0],e=e.split("?")[0],e}const wi=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,bi=/^(?:[a-z+]+:)?\/\//i,Ci=/^www\..*/i,Si=/^(data:)([^,]*),(.*)/i;function re(i,e){return(i||"").replace(wi,(t,r,s,o,n,l)=>{const a=s||n||l,u=r||o||"";if(!a)return t;if(bi.test(a)||Ci.test(a))return`url(${u}${a}${u})`;if(Si.test(a))return`url(${u}${a}${u})`;if(a[0]==="/")return`url(${u}${yi(e)+a}${u})`;const f=e.split("/"),h=a.split("/");f.pop();for(const p of h)p!=="."&&(p===".."?f.pop():f.push(p));return`url(${u}${f.join("/")}${u})`})}function te(i,e=!1){return e?i.replace(/(\/\*[^*]*\*\/)|[\s;]/g,""):i.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"").replace(/0px/g,"0")}function ar(i,e,t=!1){const r=Array.from(e.childNodes),s=[];let o=0;if(r.length>1&&i&&typeof i=="string"){let n=te(i,t);const l=n.length/i.length;for(let a=1;a<r.length;a++)if(r[a].textContent&&typeof r[a].textContent=="string"){const u=te(r[a].textContent,t),f=100;let h=3;for(;h<u.length&&(u[h].match(/[a-zA-Z0-9]/)||u.indexOf(u.substring(0,h),1)!==-1);h++);for(;h<u.length;h++){let p=u.substring(0,h),m=n.split(p),w=-1;if(m.length===2)w=m[0].length;else if(m.length>2&&m[0]===""&&r[a-1].textContent!=="")w=n.indexOf(p,1);else if(m.length===1){if(p=p.substring(0,p.length-1),m=n.split(p),m.length<=1)return s.push(i),s;h=f+1}else h===u.length-1&&(w=n.indexOf(p));if(m.length>=2&&h>f){const x=r[a-1].textContent;if(x&&typeof x=="string"){const c=te(x).length;w=n.indexOf(p,c)}w===-1&&(w=m[0].length)}if(w!==-1){let x=Math.floor(w/l);for(;x>0&&x<i.length;){if(o+=1,o>50*r.length)return s.push(i),s;const c=te(i.substring(0,x),t);if(c.length===w){s.push(i.substring(0,x)),i=i.substring(x),n=n.substring(w);break}else c.length<w?x+=Math.max(1,Math.floor((w-c.length)/l)):x-=Math.max(1,Math.floor((c.length-w)*l))}break}}}}return s.push(i),s}function ur(i,e){return ar(i,e).join("/* rr_split */")}const xi="lightgrey";let fr=1;const vi=new RegExp("[^a-z0-9-_:]"),Je=-2;function cr(){return fr++}function Ei(i){if(i instanceof HTMLFormElement)return"form";const e=le(i.tagName);return vi.test(e)?"div":e}let W,kt;const Oi=/^[^ \t\n\r\u000c]+/,Ri=/^[, \t\n\r\u000c]+/;function Ni(i,e){if(e.trim()==="")return e;let t=0;function r(o){let n;const l=o.exec(e.substring(t));return l?(n=l[0],t+=n.length,n):""}const s=[];for(;r(Ri),!(t>=e.length);){let o=r(Oi);if(o.slice(-1)===",")o=V(i,o.substring(0,o.length-1)),s.push(o);else{let n="";o=V(i,o);let l=!1;for(;;){const a=e.charAt(t);if(a===""){s.push((o+n).trim());break}else if(l)a===")"&&(l=!1);else if(a===","){t+=1,s.push((o+n).trim());break}else a==="("&&(l=!0);n+=a,t+=1}}}return s.join(", ")}const Pt=new WeakMap;function V(i,e){return!e||e.trim()===""?e:ht(i,e)}function Ai(i){return!!(i.tagName==="svg"||i.ownerSVGElement)}function ht(i,e){let t=Pt.get(i);if(t||(t=i.createElement("a"),Pt.set(i,t)),!e)e="";else if(e.startsWith("blob:")||e.startsWith("data:"))return e;return t.setAttribute("href",e),t.href}function hr(i,e,t,r){return r&&(t==="src"||t==="href"&&!(e==="use"&&r[0]==="#")||t==="xlink:href"&&r[0]!=="#"||t==="background"&&(e==="table"||e==="td"||e==="th")?V(i,r):t==="srcset"?Ni(i,r):t==="style"?re(r,ht(i)):e==="object"&&t==="data"?V(i,r):r)}function pr(i,e,t){return(i==="video"||i==="audio")&&e==="autoplay"}function Mi(i,e,t){try{if(typeof e=="string"){if(i.classList.contains(e))return!0}else for(let r=i.classList.length;r--;){const s=i.classList[r];if(e.test(s))return!0}if(t)return i.matches(t)}catch(r){}return!1}function Oe(i,e,t){if(!i)return!1;if(i.nodeType!==i.ELEMENT_NODE)return t?Oe(N.parentNode(i),e,t):!1;for(let r=i.classList.length;r--;){const s=i.classList[r];if(e.test(s))return!0}return t?Oe(N.parentNode(i),e,t):!1}function dr(i,e,t,r){let s;if(_e(i)){if(s=i,!N.childNodes(s).length)return!1}else{if(N.parentElement(i)===null)return!1;s=N.parentElement(i)}try{if(typeof e=="string"){if(r){if(s.closest(`.${e}`))return!0}else if(s.classList.contains(e))return!0}else if(Oe(s,e,r))return!0;if(t){if(r){if(s.closest(t))return!0}else if(s.matches(t))return!0}}catch(o){}return!1}function _i(i,e,t){const r=i.contentWindow;if(!r)return;let s=!1,o;try{o=r.document.readyState}catch(l){return}if(o!=="complete"){const l=setTimeout(()=>{s||(e(),s=!0)},t);i.addEventListener("load",()=>{clearTimeout(l),s=!0,e()});return}const n="about:blank";if(r.location.href!==n||i.src===n||i.src==="")return setTimeout(e,0),i.addEventListener("load",e);i.addEventListener("load",e)}function ki(i,e,t){let r=!1,s;try{s=i.sheet}catch(n){return}if(s)return;const o=setTimeout(()=>{r||(e(),r=!0)},t);i.addEventListener("load",()=>{clearTimeout(o),r=!0,e()})}function Pi(i,e){const{doc:t,mirror:r,blockClass:s,blockSelector:o,needsMask:n,inlineStylesheet:l,maskInputOptions:a={},maskTextFn:u,maskInputFn:f,dataURLOptions:h={},inlineImages:p,recordCanvas:m,keepIframeSrcFn:w,newlyAddedElement:x=!1,cssCaptured:c=!1,applyBackgroundColorToBlockedElements:g=!1}=e,R=Ii(t,r);switch(i.nodeType){case i.DOCUMENT_NODE:return i.compatMode!=="CSS1Compat"?{type:y.Document,childNodes:[],compatMode:i.compatMode}:{type:y.Document,childNodes:[]};case i.DOCUMENT_TYPE_NODE:return{type:y.DocumentType,name:i.name,publicId:i.publicId,systemId:i.systemId,rootId:R};case i.ELEMENT_NODE:return $i(i,{doc:t,blockClass:s,blockSelector:o,inlineStylesheet:l,maskInputOptions:a,maskInputFn:f,dataURLOptions:h,inlineImages:p,recordCanvas:m,keepIframeSrcFn:w,newlyAddedElement:x,rootId:R,applyBackgroundColorToBlockedElements:g});case i.TEXT_NODE:return Li(i,{doc:t,needsMask:n,maskTextFn:u,rootId:R,cssCaptured:c});case i.CDATA_SECTION_NODE:return{type:y.CDATA,textContent:"",rootId:R};case i.COMMENT_NODE:return{type:y.Comment,textContent:N.textContent(i)||"",rootId:R};default:return!1}}function Ii(i,e){if(!e.hasNode(i))return;const t=e.getId(i);return t===1?void 0:t}function Li(i,e){const{needsMask:t,maskTextFn:r,rootId:s,cssCaptured:o}=e,n=N.parentNode(i),l=n&&n.tagName;let a="";const u=l==="STYLE"?!0:void 0,f=l==="SCRIPT"?!0:void 0;return f?a="SCRIPT_PLACEHOLDER":o||(a=N.textContent(i),u&&a&&(a=re(a,ht(e.doc)))),!u&&!f&&a&&t&&(a=r?r(a,N.parentElement(i)):a.replace(/[\S]/g,"*")),{type:y.Text,textContent:a||"",rootId:s}}function $i(i,e){const{doc:t,blockClass:r,blockSelector:s,inlineStylesheet:o,maskInputOptions:n={},maskInputFn:l,dataURLOptions:a={},inlineImages:u,recordCanvas:f,keepIframeSrcFn:h,newlyAddedElement:p=!1,rootId:m,applyBackgroundColorToBlockedElements:w=!1}=e,x=Mi(i,r,s),c=Ei(i);let g={};const R=i.attributes.length;for(let d=0;d<R;d++){const b=i.attributes[d];pr(c,b.name,b.value)||(g[b.name]=hr(t,c,le(b.name),b.value))}if(c==="link"&&o){const d=Array.from(t.styleSheets).find(A=>A.href===i.href);let b=null;d&&(b=Ee(d)),b&&(delete g.rel,delete g.href,g._cssText=b)}if(c==="style"&&i.sheet){let d=Ee(i.sheet);d&&(i.childNodes.length>1&&(d=ur(d,i)),g._cssText=d)}if(c==="input"||c==="textarea"||c==="select"){const d=i.value,b=i.checked;g.type!=="radio"&&g.type!=="checkbox"&&g.type!=="submit"&&g.type!=="button"&&d?g.value=sr({element:i,type:lr(i),tagName:c,value:d,maskInputOptions:n,maskInputFn:l}):b&&(g.checked=b)}if(c==="option"&&(i.selected&&!n.select?g.selected=!0:delete g.selected),c==="dialog"&&i.open&&(g.rr_open_mode=i.matches("dialog:modal")?"modal":"non-modal"),c==="canvas"&&f){if(i.__context==="2d")nr(i)||(g.rr_dataURL=i.toDataURL(a.type,a.quality));else if(!("__context"in i)){const d=i.toDataURL(a.type,a.quality),b=t.createElement("canvas");b.width=i.width,b.height=i.height;const A=b.toDataURL(a.type,a.quality);d!==A&&(g.rr_dataURL=d)}}if(c==="img"&&u){W||(W=t.createElement("canvas"),kt=W.getContext("2d"));const d=i,b=d.currentSrc||d.getAttribute("src")||"<unknown-src>",A=d.crossOrigin,I=()=>{d.removeEventListener("load",I);try{W.width=d.naturalWidth,W.height=d.naturalHeight,kt.drawImage(d,0,0),g.rr_dataURL=W.toDataURL(a.type,a.quality)}catch(k){if(d.crossOrigin!=="anonymous"){d.crossOrigin="anonymous",d.complete&&d.naturalWidth!==0?I():d.addEventListener("load",I);return}else console.warn(`Cannot inline img src=${b}! Error: ${k}`)}d.crossOrigin==="anonymous"&&(A?g.crossOrigin=A:d.removeAttribute("crossorigin"))};d.complete&&d.naturalWidth!==0?I():d.addEventListener("load",I)}if(c==="audio"||c==="video"){const d=g;d.rr_mediaState=i.paused?"paused":"played",d.rr_mediaCurrentTime=i.currentTime,d.rr_mediaPlaybackRate=i.playbackRate,d.rr_mediaMuted=i.muted,d.rr_mediaLoop=i.loop,d.rr_mediaVolume=i.volume}if(p||(i.scrollLeft&&(g.rr_scrollLeft=i.scrollLeft),i.scrollTop&&(g.rr_scrollTop=i.scrollTop)),x){const{width:d,height:b}=i.getBoundingClientRect();g=$({class:g.class,rr_width:`${d}px`,rr_height:`${b}px`},w?{rr_background_color:xi}:{})}c==="iframe"&&!h(g.src)&&(i.contentDocument||(g.rr_src=g.src),delete g.src);let _;try{customElements.get(c)&&(_=!0)}catch(d){}return{type:y.Element,tagName:c,attributes:g,childNodes:[],isSVG:Ai(i)||void 0,needBlock:x,rootId:m,isCustom:_}}function v(i){return i==null?"":i.toLowerCase()}function Ti(i,e){if(e.comment&&i.type===y.Comment)return!0;if(i.type===y.Element){if(e.script&&(i.tagName==="script"||i.tagName==="link"&&(i.attributes.rel==="preload"||i.attributes.rel==="modulepreload")&&i.attributes.as==="script"||i.tagName==="link"&&i.attributes.rel==="prefetch"&&typeof i.attributes.href=="string"&&ct(i.attributes.href)==="js"))return!0;if(e.headFavicon&&(i.tagName==="link"&&i.attributes.rel==="shortcut icon"||i.tagName==="meta"&&(v(i.attributes.name).match(/^msapplication-tile(image|color)$/)||v(i.attributes.name)==="application-name"||v(i.attributes.rel)==="icon"||v(i.attributes.rel)==="apple-touch-icon"||v(i.attributes.rel)==="shortcut icon")))return!0;if(i.tagName==="meta"){if(e.headMetaDescKeywords&&v(i.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(v(i.attributes.property).match(/^(og|twitter|fb):/)||v(i.attributes.name).match(/^(og|twitter):/)||v(i.attributes.name)==="pinterest"))return!0;if(e.headMetaRobots&&(v(i.attributes.name)==="robots"||v(i.attributes.name)==="googlebot"||v(i.attributes.name)==="bingbot"))return!0;if(e.headMetaHttpEquiv&&i.attributes["http-equiv"]!==void 0)return!0;if(e.headMetaAuthorship&&(v(i.attributes.name)==="author"||v(i.attributes.name)==="generator"||v(i.attributes.name)==="framework"||v(i.attributes.name)==="publisher"||v(i.attributes.name)==="progid"||v(i.attributes.property).match(/^article:/)||v(i.attributes.property).match(/^product:/)))return!0;if(e.headMetaVerification&&(v(i.attributes.name)==="google-site-verification"||v(i.attributes.name)==="yandex-verification"||v(i.attributes.name)==="csrf-token"||v(i.attributes.name)==="p:domain_verify"||v(i.attributes.name)==="verify-v1"||v(i.attributes.name)==="verification"||v(i.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function G(i,e){const{doc:t,mirror:r,blockClass:s,blockSelector:o,maskTextClass:n,maskTextSelector:l,skipChild:a=!1,inlineStylesheet:u=!0,maskInputOptions:f={},maskTextFn:h,maskInputFn:p,slimDOMOptions:m,dataURLOptions:w={},inlineImages:x=!1,recordCanvas:c=!1,onSerialize:g,onIframeLoad:R,iframeLoadTimeout:_=5e3,onStylesheetLoad:d,stylesheetLoadTimeout:b=5e3,keepIframeSrcFn:A=()=>!1,newlyAddedElement:I=!1,cssCaptured:k=!1,applyBackgroundColorToBlockedElements:F=!1}=e;let{needsMask:L}=e,{preserveWhiteSpace:Y=!0}=e;L||(L=dr(i,n,l,L===void 0));const K=Pi(i,{doc:t,mirror:r,blockClass:s,blockSelector:o,needsMask:L,inlineStylesheet:u,maskInputOptions:f,maskTextFn:h,maskInputFn:p,dataURLOptions:w,inlineImages:x,recordCanvas:c,keepIframeSrcFn:A,newlyAddedElement:I,cssCaptured:k,applyBackgroundColorToBlockedElements:F});if(!K)return console.warn(i,"not serialized"),null;let Q;r.hasNode(i)?Q=r.getId(i):Ti(K,m)||!Y&&K.type===y.Text&&!K.textContent.replace(/^\s+|\s+$/gm,"").length?Q=Je:Q=cr();const S=Object.assign(K,{id:Q});if(r.add(i,S),Q===Je)return null;g&&g(i);let Ue=!a;if(S.type===y.Element){Ue=Ue&&!S.needBlock,delete S.needBlock;const M=N.shadowRoot(i);M&&Se(M)&&(S.isShadowHost=!0)}if((S.type===y.Document||S.type===y.Element)&&Ue){m.headWhitespace&&S.type===y.Element&&S.tagName==="head"&&(Y=!1);const M={doc:t,mirror:r,blockClass:s,blockSelector:o,needsMask:L,maskTextClass:n,maskTextSelector:l,skipChild:a,inlineStylesheet:u,maskInputOptions:f,maskTextFn:h,maskInputFn:p,slimDOMOptions:m,dataURLOptions:w,inlineImages:x,recordCanvas:c,preserveWhiteSpace:Y,onSerialize:g,onIframeLoad:R,iframeLoadTimeout:_,onStylesheetLoad:d,stylesheetLoadTimeout:b,keepIframeSrcFn:A,cssCaptured:!1,applyBackgroundColorToBlockedElements:F};if(!(S.type===y.Element&&S.tagName==="textarea"&&S.attributes.value!==void 0)){S.type===y.Element&&S.attributes._cssText!==void 0&&typeof S.attributes._cssText=="string"&&(M.cssCaptured=!0);for(const Fe of Array.from(N.childNodes(i))){const j=G(Fe,M);j&&S.childNodes.push(j)}}let z=null;if(_e(i)&&(z=N.shadowRoot(i)))for(const Fe of Array.from(N.childNodes(z))){const j=G(Fe,M);j&&(Se(z)&&(j.isShadow=!0),S.childNodes.push(j))}}const Be=N.parentNode(i);return Be&&Zt(Be)&&Se(Be)&&(S.isShadow=!0),S.type===y.Element&&S.tagName==="iframe"&&_i(i,()=>{const M=i.contentDocument;if(M&&R){const z=G(M,{doc:M,mirror:r,blockClass:s,blockSelector:o,needsMask:L,maskTextClass:n,maskTextSelector:l,skipChild:!1,inlineStylesheet:u,maskInputOptions:f,maskTextFn:h,maskInputFn:p,slimDOMOptions:m,dataURLOptions:w,inlineImages:x,recordCanvas:c,preserveWhiteSpace:Y,onSerialize:g,onIframeLoad:R,iframeLoadTimeout:_,onStylesheetLoad:d,stylesheetLoadTimeout:b,keepIframeSrcFn:A});z&&R(i,z)}},_),S.type===y.Element&&S.tagName==="link"&&typeof S.attributes.rel=="string"&&(S.attributes.rel==="stylesheet"||S.attributes.rel==="preload"&&typeof S.attributes.href=="string"&&ct(S.attributes.href)==="css")&&ki(i,()=>{if(d){const M=G(i,{doc:t,mirror:r,blockClass:s,blockSelector:o,needsMask:L,maskTextClass:n,maskTextSelector:l,skipChild:!1,inlineStylesheet:u,maskInputOptions:f,maskTextFn:h,maskInputFn:p,slimDOMOptions:m,dataURLOptions:w,inlineImages:x,recordCanvas:c,preserveWhiteSpace:Y,onSerialize:g,onIframeLoad:R,iframeLoadTimeout:_,onStylesheetLoad:d,stylesheetLoadTimeout:b,keepIframeSrcFn:A});M&&d(i,M)}},b),S}function Di(i,e){const{mirror:t=new ke,blockClass:r="rr-block",blockSelector:s=null,maskTextClass:o="rr-mask",maskTextSelector:n=null,inlineStylesheet:l=!0,inlineImages:a=!1,recordCanvas:u=!1,maskAllInputs:f=!1,maskTextFn:h,maskInputFn:p,slimDOM:m=!1,dataURLOptions:w,preserveWhiteSpace:x,onSerialize:c,onIframeLoad:g,iframeLoadTimeout:R,onStylesheetLoad:_,stylesheetLoadTimeout:d,keepIframeSrcFn:b=()=>!1,applyBackgroundColorToBlockedElements:A=!1}=e||{};return G(i,{doc:i,mirror:t,blockClass:r,blockSelector:s,maskTextClass:o,maskTextSelector:n,skipChild:!1,inlineStylesheet:l,maskInputOptions:f===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:f===!1?{password:!0}:f,maskTextFn:h,maskInputFn:p,slimDOMOptions:m===!0||m==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:m==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:m===!1?{}:m,dataURLOptions:w,inlineImages:a,recordCanvas:u,preserveWhiteSpace:x,onSerialize:c,onIframeLoad:g,iframeLoadTimeout:R,onStylesheetLoad:_,stylesheetLoadTimeout:d,keepIframeSrcFn:b,newlyAddedElement:!1,applyBackgroundColorToBlockedElements:A})}function Ui(i,e){function t(r){e(r),(r.type===y.Document||r.type===y.Element)&&r.childNodes.forEach(t)}t(i)}function Bi(){fr=1}const Fi=/(max|min)-device-(width|height)/,It=new RegExp(Fi.source,"g"),zi={postcssPlugin:"postcss-custom-selectors",prepare(){return{postcssPlugin:"postcss-custom-selectors",AtRule:function(i){i.params.match(It)&&(i.params=i.params.replace(It,"$1-$2"))}}}},ji={postcssPlugin:"postcss-hover-classes",prepare:function(){const i=[];return{Rule:function(e){i.indexOf(e)===-1&&(i.push(e),e.selectors.forEach(function(t){t.includes(":hover")&&(e.selector+=`, `+t.replace(/:hover/g,".\\:hover"))}))}}}};function Wi(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}function Vi(i){if(i.__esModule)return i;var e=i.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(i).forEach(function(r){var s=Object.getOwnPropertyDescriptor(i,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:function(){return i[r]}})}),t}var pt={exports:{}},E=String,mr=function(){return{isColorSupported:!1,reset:E,bold:E,dim:E,italic:E,underline:E,inverse:E,hidden:E,strikethrough:E,black:E,red:E,green:E,yellow:E,blue:E,magenta:E,cyan:E,white:E,gray:E,bgBlack:E,bgRed:E,bgGreen:E,bgYellow:E,bgBlue:E,bgMagenta:E,bgCyan:E,bgWhite:E}};pt.exports=mr();pt.exports.createColors=mr;var Gi=pt.exports;const Hi={},qi=Object.freeze(Object.defineProperty({__proto__:null,default:Hi},Symbol.toStringTag,{value:"Module"})),P=Vi(qi);let Lt=Gi,$t=P,Ye=class gr extends Error{constructor(e,t,r,s,o,n){super(e),this.name="CssSyntaxError",this.reason=e,o&&(this.file=o),s&&(this.source=s),n&&(this.plugin=n),typeof t!="undefined"&&typeof r!="undefined"&&(typeof t=="number"?(this.line=t,this.column=r):(this.line=t.line,this.column=t.column,this.endLine=r.line,this.endColumn=r.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,gr)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line!="undefined"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(e){if(!this.source)return"";let t=this.source;e==null&&(e=Lt.isColorSupported),$t&&e&&(t=$t(t));let r=t.split(/\r?\n/),s=Math.max(this.line-3,0),o=Math.min(this.line+2,r.length),n=String(o).length,l,a;if(e){let{bold:u,gray:f,red:h}=Lt.createColors(!0);l=p=>u(h(p)),a=p=>f(p)}else l=a=u=>u;return r.slice(s,o).map((u,f)=>{let h=s+1+f,p=" "+(" "+h).slice(-n)+" | ";if(h===this.line){let m=a(p.replace(/\d/g," "))+u.slice(0,this.column-1).replace(/[^\t]/g," ");return l(">")+a(p)+u+` `+m+l("^")}return" "+a(p)+u}).join(` `)}toString(){let e=this.showSourceCode();return e&&(e=` `+e+` `),this.name+": "+this.message+e}};var dt=Ye;Ye.default=Ye;var ae={};ae.isClean=Symbol("isClean");ae.my=Symbol("my");const Tt={after:` `,beforeClose:` `,beforeComment:` `,beforeDecl:` `,beforeOpen:" ",beforeRule:` `,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function Ji(i){return i[0].toUpperCase()+i.slice(1)}let Ke=class{constructor(e){this.builder=e}atrule(e,t){let r="@"+e.name,s=e.params?this.rawValue(e,"params"):"";if(typeof e.raws.afterName!="undefined"?r+=e.raws.afterName:s&&(r+=" "),e.nodes)this.block(e,r+s);else{let o=(e.raws.between||"")+(t?";":"");this.builder(r+s+o,e)}}beforeAfter(e,t){let r;e.type==="decl"?r=this.raw(e,null,"beforeDecl"):e.type==="comment"?r=this.raw(e,null,"beforeComment"):t==="before"?r=this.raw(e,null,"beforeRule"):r=this.raw(e,null,"beforeClose");let s=e.parent,o=0;for(;s&&s.type!=="root";)o+=1,s=s.parent;if(r.includes(` `)){let n=this.raw(e,null,"indent");if(n.length)for(let l=0;l<o;l++)r+=n}return r}block(e,t){let r=this.raw(e,"between","beforeOpen");this.builder(t+r+"{",e,"start");let s;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&&e.nodes[t].type==="comment";)t-=1;let r=this.raw(e,"semicolon");for(let s=0;s<e.nodes.length;s++){let o=e.nodes[s],n=this.raw(o,"before");n&&this.builder(n),this.stringify(o,t!==s||r)}}comment(e){let t=this.raw(e,"left","commentLeft"),r=this.raw(e,"right","commentRight");this.builder("/*"+t+e.text+r+"*/",e)}decl(e,t){let r=this.raw(e,"between","colon"),s=e.prop+r+this.rawValue(e,"value");e.important&&(s+=e.raws.important||" !important"),t&&(s+=";"),this.builder(s,e)}document(e){this.body(e)}raw(e,t,r){let s;if(r||(r=t),t&&(s=e.raws[t],typeof s!="undefined"))return s;let o=e.parent;if(r==="before"&&(!o||o.type==="root"&&o.first===e||o&&o.type==="document"))return"";if(!o)return Tt[r];let n=e.root();if(n.rawCache||(n.rawCache={}),typeof n.rawCache[r]!="undefined")return n.rawCache[r];if(r==="before"||r==="after")return this.beforeAfter(e,r);{let l="raw"+Ji(r);this[l]?s=this[l](n,e):n.walk(a=>{if(s=a.raws[t],typeof s!="undefined")return!1})}return typeof s=="undefined"&&(s=Tt[r]),n.rawCache[r]=s,s}rawBeforeClose(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length>0&&typeof r.raws.after!="undefined")return t=r.raws.after,t.includes(` `)&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawBeforeComment(e,t){let r;return e.walkComments(s=>{if(typeof s.raws.before!="undefined")return r=s.raws.before,r.includes(` `)&&(r=r.replace(/[^\n]+$/,"")),!1}),typeof r=="undefined"?r=this.raw(t,null,"beforeDecl"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeDecl(e,t){let r;return e.walkDecls(s=>{if(typeof s.raws.before!="undefined")return r=s.raws.before,r.includes(` `)&&(r=r.replace(/[^\n]+$/,"")),!1}),typeof r=="undefined"?r=this.raw(t,null,"beforeRule"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeOpen(e){let t;return e.walk(r=>{if(r.type!=="decl"&&(t=r.raws.between,typeof t!="undefined"))return!1}),t}rawBeforeRule(e){let t;return e.walk(r=>{if(r.nodes&&(r.parent!==e||e.first!==r)&&typeof r.raws.before!="undefined")return t=r.raws.before,t.includes(` `)&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawColon(e){let t;return e.walkDecls(r=>{if(typeof r.raws.between!="undefined")return t=r.raws.between.replace(/[^\s:]/g,""),!1}),t}rawEmptyBody(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length===0&&(t=r.raws.after,typeof t!="undefined"))return!1}),t}rawIndent(e){if(e.raws.indent)return e.raws.indent;let t;return e.walk(r=>{let s=r.parent;if(s&&s!==e&&s.parent&&s.parent===e&&typeof r.raws.before!="undefined"){let o=r.raws.before.split(` `);return t=o[o.length-1],t=t.replace(/\S/g,""),!1}}),t}rawSemicolon(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length&&r.last.type==="decl"&&(t=r.raws.semicolon,typeof t!="undefined"))return!1}),t}rawValue(e,t){let r=e[t],s=e.raws[t];return s&&s.value===r?s.raw:r}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 yr=Ke;Ke.default=Ke;let Yi=yr;function Qe(i,e){new Yi(e).stringify(i)}var Pe=Qe;Qe.default=Qe;let{isClean:he,my:Ki}=ae,Qi=dt,Zi=yr,Xi=Pe;function Ze(i,e){let t=new i.constructor;for(let r in i){if(!Object.prototype.hasOwnProperty.call(i,r)||r==="proxyCache")continue;let s=i[r],o=typeof s;r==="parent"&&o==="object"?e&&(t[r]=e):r==="source"?t[r]=s:Array.isArray(s)?t[r]=s.map(n=>Ze(n,t)):(o==="object"&&s!==null&&(s=Ze(s)),t[r]=s)}return t}let Xe=class{constructor(e={}){this.raws={},this[he]=!1,this[Ki]=!0;for(let t in e)if(t==="nodes"){this.nodes=[];for(let r of e[t])typeof r.clone=="function"?this.append(r.clone()):this.append(r)}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=Ze(this);for(let r in e)t[r]=e[r];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:r,start:s}=this.rangeBy(t);return this.source.input.error(e,{column:s.column,line:s.line},{column:r.column,line:r.line},t)}return new Qi(e)}getProxyProcessor(){return{get(e,t){return t==="proxyOf"?e:t==="root"?()=>e.root().toProxy():e[t]},set(e,t,r){return e[t]===r||(e[t]=r,(t==="prop"||t==="value"||t==="name"||t==="params"||t==="important"||t==="text")&&e.markDirty()),!0}}}markDirty(){if(this[he]){this[he]=!1;let e=this;for(;e=e.parent;)e[he]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e,t){let r=this.source.start;if(e.index)r=this.positionInside(e.index,t);else if(e.word){t=this.toString();let s=t.indexOf(e.word);s!==-1&&(r=this.positionInside(s,t))}return r}positionInside(e,t){let r=t||this.toString(),s=this.source.start.column,o=this.source.start.line;for(let n=0;n<e;n++)r[n]===` `?(s=1,o+=1):s+=1;return{column:s,line:o}}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},r=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 s=this.toString(),o=s.indexOf(e.word);o!==-1&&(t=this.positionInside(o,s),r=this.positionInside(o+e.word.length,s))}else e.start?t={column:e.start.column,line:e.start.line}:e.index&&(t=this.positionInside(e.index)),e.end?r={column:e.end.column,line:e.end.line}:typeof e.endIndex=="number"?r=this.positionInside(e.endIndex):e.index&&(r=this.positionInside(e.index+1));return(r.line<t.line||r.line===t.line&&r.column<=t.column)&&(r={column:t.column+1,line:t.line}),{end:r,start:t}}raw(e,t){return new Zi().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,r=!1;for(let s of e)s===this?r=!0:r?(this.parent.insertAfter(t,s),t=s):this.parent.insertBefore(t,s);r||this.remove()}return this}root(){let e=this;for(;e.parent&&e.parent.type!=="document";)e=e.parent;return e}toJSON(e,t){let r={},s=t==null;t=t||new Map;let o=0;for(let n in this){if(!Object.prototype.hasOwnProperty.call(this,n)||n==="parent"||n==="proxyCache")continue;let l=this[n];if(Array.isArray(l))r[n]=l.map(a=>typeof a=="object"&&a.toJSON?a.toJSON(null,t):a);else if(typeof l=="object"&&l.toJSON)r[n]=l.toJSON(null,t);else if(n==="source"){let a=t.get(l.input);a==null&&(a=o,t.set(l.input,o),o++),r[n]={end:l.end,inputId:a,start:l.start}}else r[n]=l}return s&&(r.inputs=[...t.keys()].map(n=>n.toJSON())),r}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(e=Xi){e.stringify&&(e=e.stringify);let t="";return e(this,r=>{t+=r}),t}warn(e,t,r){let s={node:this};for(let o in r)s[o]=r[o];return e.warn(t,s)}get proxyOf(){return this}};var Ie=Xe;Xe.default=Xe;let es=Ie,et=class extends es{constructor(e){e&&typeof e.value!="undefined"&&typeof e.value!="string"&&(e=Z($({},e),{value:String(e.value)})),super(e),this.type="decl"}get variable(){return this.prop.startsWith("--")||this.prop[0]==="$"}};var Le=et;et.default=et;let ts="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",rs=(i,e=21)=>(t=e)=>{let r="",s=t;for(;s--;)r+=i[Math.random()*i.length|0];return r},is=(i=21)=>{let e="",t=i;for(;t--;)e+=ts[Math.random()*64|0];return e};var ss={nanoid:is,customAlphabet:rs};let{SourceMapConsumer:Dt,SourceMapGenerator:Ut}=P,{existsSync:ns,readFileSync:os}=P,{dirname:Ve,join:ls}=P;function as(i){return Buffer?Buffer.from(i,"base64").toString():window.atob(i)}let tt=class{constructor(e,t){if(t.map===!1)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");let r=t.map?t.map.prev:void 0,s=this.loadMap(t.from,r);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=Ve(this.mapFile)),s&&(this.text=s)}consumer(){return this.consumerCache||(this.consumerCache=new Dt(this.text)),this.consumerCache}decodeInline(e){let t=/^data:application\/json;charset=utf-?8;base64,/,r=/^data:application\/json;base64,/,s=/^data:application\/json;charset=utf-?8,/,o=/^data:application\/json,/;if(s.test(e)||o.test(e))return decodeURIComponent(e.substr(RegExp.lastMatch.length));if(t.test(e)||r.test(e))return as(e.substr(RegExp.lastMatch.length));let n=e.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+n)}getAnnotationURL(e){return e.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(e){return typeof e!="object"?!1:typeof e.mappings=="string"||typeof e._mappings=="string"||Array.isArray(e.sections)}loadAnnotation(e){let t=e.match(/\/\*\s*# sourceMappingURL=/gm);if(!t)return;let r=e.lastIndexOf(t.pop()),s=e.indexOf("*/",r);r>-1&&s>-1&&(this.annotation=this.getAnnotationURL(e.substring(r,s)))}loadFile(e){if(this.root=Ve(e),ns(e))return this.mapFile=e,os(e,"utf-8").toString().trim()}loadMap(e,t){if(t===!1)return!1;if(t){if(typeof t=="string")return t;if(typeof t=="function"){let r=t(e);if(r){let s=this.loadFile(r);if(!s)throw new Error("Unable to load previous source map: "+r.toString());return s}}else{if(t instanceof Dt)return Ut.fromSourceMap(t).toString();if(t instanceof Ut)return t.toString();if(this.isMap(t))return JSON.stringify(t);throw new Error("Unsupported previous source map format: "+t.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let r=this.annotation;return e&&(r=ls(Ve(e),r)),this.loadFile(r)}}}startWith(e,t){return e?e.substr(0,t.length)===t:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}};var wr=tt;tt.default=tt;let{SourceMapConsumer:us,SourceMapGenerator:fs}=P,{fileURLToPath:Bt,pathToFileURL:pe}=P,{isAbsolute:rt,resolve:it}=P,{nanoid:cs}=ss,Ge=P,Ft=dt,hs=wr,He=Symbol("fromOffsetCache"),ps=!!(us&&fs),zt=!!(it&&rt),Re=class{constructor(e,t={}){if(e===null||typeof e=="undefined"||typeof e=="object"&&!e.toString)throw new Error(`PostCSS received ${e} instead of CSS string`);if(this.css=e.toString(),this.css[0]==="\uFEFF"||this.css[0]==="\uFFFE"?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,t.from&&(!zt||/^\w+:\/\//.test(t.from)||rt(t.from)?this.file=t.from:this.file=it(t.from)),zt&&ps){let r=new hs(this.css,t);if(r.text){this.map=r;let s=r.consumer().file;!this.file&&s&&(this.file=this.mapResolve(s))}}this.file||(this.id="<input css "+cs(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,r,s={}){let o,n,l;if(t&&typeof t=="object"){let u=t,f=r;if(typeof u.offset=="number"){let h=this.fromOffset(u.offset);t=h.line,r=h.col}else t=u.line,r=u.column;if(typeof f.offset=="number"){let h=this.fromOffset(f.offset);n=h.line,l=h.col}else n=f.line,l=f.column}else if(!r){let u=this.fromOffset(t);t=u.line,r=u.col}let a=this.origin(t,r,n,l);return a?o=new Ft(e,a.endLine===void 0?a.line:{column:a.column,line:a.line},a.endLine===void 0?a.column:{column:a.endColumn,line:a.endLine},a.source,a.file,s.plugin):o=new Ft(e,n===void 0?t:{column:r,line:t},n===void 0?r:{column:l,line:n},this.css,this.file,s.plugin),o.input={column:r,endColumn:l,endLine:n,line:t,source:this.css},this.file&&(pe&&(o.input.url=pe(this.file).toString()),o.input.file=this.file),o}fromOffset(e){let t,r;if(this[He])r=this[He];else{let o=this.css.split(` `);r=new Array(o.length);let n=0;for(let l=0,a=o.length;l<a;l++)r[l]=n,n+=o[l].length+1;this[He]=r}t=r[r.length-1];let s=0;if(e>=t)s=r.length-1;else{let o=r.length-2,n;for(;s<o;)if(n=s+(o-s>>1),e<r[n])o=n-1;else if(e>=r[n+1])s=n+1;else{s=n;break}}return{col:e-r[s]+1,line:s+1}}mapResolve(e){return/^\w+:\/\//.test(e)?e:it(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,r,s){if(!this.map)return!1;let o=this.map.consumer(),n=o.originalPositionFor({column:t,line:e});if(!n.source)return!1;let l;typeof r=="number"&&(l=o.originalPositionFor({column:s,line:r}));let a;rt(n.source)?a=pe(n.source):a=new URL(n.source,this.map.consumer().sourceRoot||pe(this.map.mapFile));let u={column:n.column,endColumn:l&&l.column,endLine:l&&l.line,line:n.line,url:a.toString()};if(a.protocol==="file:")if(Bt)u.file=Bt(a);else throw new Error("file: protocol is not available in this PostCSS build");let f=o.sourceContentFor(n.source);return f&&(u.source=f),u}toJSON(){let e={};for(let t of["hasBOM","css","file","id"])this[t]!=null&&(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 $e=Re;Re.default=Re;Ge&&Ge.registerInput&&Ge.registerInput(Re);let{SourceMapConsumer:br,SourceMapGenerator:xe}=P,{dirname:ve,relative:Cr,resolve:Sr,sep:xr}=P,{pathToFileURL:jt}=P,ds=$e,ms=!!(br&&xe),gs=!!(ve&&Sr&&Cr&&xr),ys=class{constructor(e,t,r,s){this.stringify=e,this.mapOpts=r.map||{},this.root=t,this.opts=r,this.css=s,this.originalCSS=s,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let e;this.isInline()?e="data:application/json;base64,"+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation=="string"?e=this.mapOpts.annotation:typeof this.mapOpts.annotation=="function"?e=this.mapOpts.annotation(this.opts.to,this.root):e=this.outputFile()+".map";let t=` `;this.css.includes(`\r `)&&(t=`\r `),this.css+=t+"/*# sourceMappingURL="+e+" */"}applyPrevMaps(){for(let e of this.previous()){let t=this.toUrl(this.path(e.file)),r=e.root||ve(e.file),s;this.mapOpts.sourcesContent===!1?(s=new br(e.text),s.sourcesContent&&(s.sourcesContent=null)):s=e.consumer(),this.map.applySourceMap(s,t,this.toUrl(this.path(r)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1)if(this.root){let e;for(let t=this.root.nodes.length-1;t>=0;t--)e=this.root.nodes[t],e.type==="comment"&&e.text.indexOf("# sourceMappingURL=")===0&&this.root.removeChild(t)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),gs&&ms&&this.isMap())return this.generateMap();{let e="";return this.stringify(this.root,t=>{e+=t}),[e]}}generateMap(){if(this.root)this.generateString();else if(this.previous().length===1){let e=this.previous()[0].consumer();e.file=this.outputFile(),this.map=xe.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new xe({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 xe({file:this.outputFile(),ignoreInvalidMapping:!0});let e=1,t=1,r="<no source>",s={generated:{column:0,line:0},original:{column:0,line:0},source:""},o,n;this.stringify(this.root,(l,a,u)=>{if(this.css+=l,a&&u!=="end"&&(s.generated.line=e,s.generated.column=t-1,a.source&&a.source.start?(s.source=this.sourcePath(a),s.original.line=a.source.start.line,s.original.column=a.source.start.column-1,this.map.addMapping(s)):(s.source=r,s.original.line=1,s.original.column=0,this.map.addMapping(s))),o=l.match(/\n/g),o?(e+=o.length,n=l.lastIndexOf(` `),t=l.length-n):t+=l.length,a&&u!=="start"){let f=a.parent||{raws:{}};(!(a.type==="decl"||a.type==="atrule"&&!a.nodes)||a!==f.last||f.raws.semicolon)&&(a.source&&a.source.end?(s.source=this.sourcePath(a),s.original.line=a.source.end.line,s.original.column=a.source.end.column-1,s.generated.line=e,s.generated.column=t-2,this.map.addMapping(s)):(s.source=r,s.original.line=1,s.original.column=0,s.generated.line=e,s.generated.column=t-1,this.map.addMapping(s)))}})}isAnnotation(){return this.isInline()?!0:typeof this.mapOpts.annotation!="undefined"?this.mapOpts.annotation:this.previous().length?this.previous().some(e=>e.annotation):!0}isInline(){if(typeof this.mapOpts.inline!="undefined")return this.mapOpts.inline;let e=this.mapOpts.annotation;return typeof e!="undefined"&&e!==!0?!1:this.previous().length?this.previous().some(t=>t.inline):!0}isMap(){return typeof this.opts.map!="undefined"?!!this.opts.map:this.previous().length>0}isSourcesContent(){return typeof this.mapOpts.sourcesContent!="undefined"?this.mapOpts.sourcesContent:this.previous().length?this.previous().some(e=>e.withContent()):!0}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||e.charCodeAt(0)===60||/^\w+:\/\//.test(e))return e;let t=this.memoizedPaths.get(e);if(t)return t;let r=this.opts.to?ve(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(r=ve(Sr(r,this.mapOpts.annotation)));let s=Cr(r,e);return this.memoizedPaths.set(e,s),s}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 ds(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 r=t.source.input.from;if(r&&!e[r]){e[r]=!0;let s=this.usesFileUrls?this.toFileUrl(r):this.toUrl(this.path(r));this.map.setSourceContent(s,t.source.input.css)}}});else if(this.css){let t=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(t,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(jt){let r=jt(e).toString();return this.memoizedFileURLs.set(e,r),r}else 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;xr==="\\"&&(e=e.replace(/\\/g,"/"));let r=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,r),r}};var vr=ys;let ws=Ie,st=class extends ws{constructor(e){super(e),this.type="comment"}};var Te=st;st.default=st;let{isClean:Er,my:Or}=ae,Rr=Le,Nr=Te,bs=Ie,Ar,mt,gt,Mr;function _r(i){return i.map(e=>(e.nodes&&(e.nodes=_r(e.nodes)),delete e.source,e))}function kr(i){if(i[Er]=!1,i.proxyOf.nodes)for(let e of i.proxyOf.nodes)kr(e)}let D=class Pr extends bs{append(...e){for(let t of e){let r=this.normalize(t,this.last);for(let s of r)this.proxyOf.nodes.push(s)}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=this.getIterator(),r,s;for(;this.indexes[t]<this.proxyOf.nodes.length&&(r=this.indexes[t],s=e(this.proxyOf.nodes[r],r),s!==!1);)this.indexes[t]+=1;return delete this.indexes[t],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){return t==="proxyOf"?e:e[t]?t==="each"||typeof t=="string"&&t.startsWith("walk")?(...r)=>e[t](...r.map(s=>typeof s=="function"?(o,n)=>s(o.toProxy(),n):s)):t==="every"||t==="some"?r=>e[t]((s,...o)=>r(s.toProxy(),...o)):t==="root"?()=>e.root().toProxy():t==="nodes"?e.nodes.map(r=>r.toProxy()):t==="first"||t==="last"?e[t].toProxy():e[t]:e[t]},set(e,t,r){return e[t]===r||(e[t]=r,(t==="name"||t==="params"||t==="selector")&&e.markDirty()),!0}}}index(e){return typeof e=="number"?e:(e.proxyOf&&(e=e.proxyOf),this.proxyOf.nodes.indexOf(e))}insertAfter(e,t){let r=this.index(e),s=this.normalize(t,this.proxyOf.nodes[r]).reverse();r=this.index(e);for(let n of s)this.proxyOf.nodes.splice(r+1,0,n);let o;for(let n in this.indexes)o=this.indexes[n],r<o&&(this.indexes[n]=o+s.length);return this.markDirty(),this}insertBefore(e,t){let r=this.index(e),s=r===0?"prepend":!1,o=this.normalize(t,this.proxyOf.nodes[r],s).reverse();r=this.index(e);for(let l of o)this.proxyOf.nodes.splice(r,0,l);let n;for(let l in this.indexes)n=this.indexes[l],r<=n&&(this.indexes[l]=n+o.length);return this.markDirty(),this}normalize(e,t){if(typeof e=="string")e=_r(Ar(e).nodes);else if(typeof e=="undefined")e=[];else if(Array.isArray(e)){e=e.slice(0);for(let s of e)s.parent&&s.parent.removeChild(s,"ignore")}else if(e.type==="root"&&this.type!=="document"){e=e.nodes.slice(0);for(let s of e)s.parent&&s.parent.removeChild(s,"ignore")}else if(e.type)e=[e];else if(e.prop){if(typeof e.value=="undefined")throw new Error("Value field is missed in node creation");typeof e.value!="string"&&(e.value=String(e.value)),e=[new Rr(e)]}else if(e.selector)e=[new mt(e)];else if(e.name)e=[new gt(e)];else if(e.text)e=[new Nr(e)];else throw new Error("Unknown node type in node creation");return e.map(s=>(s[Or]||Pr.rebuild(s),s=s.proxyOf,s.parent&&s.parent.removeChild(s),s[Er]&&kr(s),typeof s.raws.before=="undefined"&&t&&typeof t.raws.before!="undefined"&&(s.raws.before=t.raws.before.replace(/\S/g,"")),s.parent=this.proxyOf,s))}prepend(...e){e=e.reverse();for(let t of e){let r=this.normalize(t,this.first,"prepend").reverse();for(let s of r)this.proxyOf.nodes.unshift(s);for(let s in this.indexes)this.indexes[s]=this.indexes[s]+r.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){e=this.index(e),this.proxyOf.nodes[e].parent=void 0,this.proxyOf.nodes.splice(e,1);let t;for(let r in this.indexes)t=this.indexes[r],t>=e&&(this.indexes[r]=t-1);return this.markDirty(),this}replaceValues(e,t,r){return r||(r=t,t={}),this.walkDecls(s=>{t.props&&!t.props.includes(s.prop)||t.fast&&!s.value.includes(t.fast)||(s.value=s.value.replace(e,r))}),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each((t,r)=>{let s;try{s=e(t,r)}catch(o){throw t.addToError(o)}return s!==!1&&t.walk&&(s=t.walk(e)),s})}walkAtRules(e,t){return t?e instanceof RegExp?this.walk((r,s)=>{if(r.type==="atrule"&&e.test(r.name))return t(r,s)}):this.walk((r,s)=>{if(r.type==="atrule"&&r.name===e)return t(r,s)}):(t=e,this.walk((r,s)=>{if(r.type==="atrule")return t(r,s)}))}walkComments(e){return this.walk((t,r)=>{if(t.type==="comment")return e(t,r)})}walkDecls(e,t){return t?e instanceof RegExp?this.walk((r,s)=>{if(r.type==="decl"&&e.test(r.prop))return t(r,s)}):this.walk((r,s)=>{if(r.type==="decl"&&r.prop===e)return t(r,s)}):(t=e,this.walk((r,s)=>{if(r.type==="decl")return t(r,s)}))}walkRules(e,t){return t?e instanceof RegExp?thi