@interfere/react 11.2.1 → 12.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/activity-BfYxFVcK.d.mts +36 -0
- package/dist/api-wpS4xoMY.d.mts +70 -0
- package/dist/api.d.mts +8 -7
- package/dist/api.mjs +1 -1
- package/dist/config-Rm-ct4K1.d.mts +12 -0
- package/dist/device-vFtWy12y.d.mts +35 -0
- package/dist/error-boundary.d.mts +7 -7
- package/dist/error-boundary.mjs +1 -1
- package/dist/exporter-logs-CeGwMiMo.d.mts +51 -0
- package/dist/geo-PDfIZY4L.d.mts +16 -0
- package/dist/index-D-HGWlgi.d.mts +4 -0
- package/dist/instrumentations-Bgm2EazU.d.mts +91 -0
- package/dist/internal/activity.d.mts +1 -35
- package/dist/internal/activity.mjs +1 -1
- package/dist/internal/browser-context.d.mts +44 -4
- package/dist/internal/browser-context.mjs +1 -1
- package/dist/internal/capture-boundary.d.mts +6 -5
- package/dist/internal/capture-boundary.mjs +1 -1
- package/dist/internal/capture.d.mts +3 -4
- package/dist/internal/capture.mjs +1 -1
- package/dist/internal/config.d.mts +26 -27
- package/dist/internal/config.mjs +1 -1
- package/dist/internal/consent.d.mts +16 -8
- package/dist/internal/console-patch.d.mts +6 -7
- package/dist/internal/console-patch.mjs +1 -1
- package/dist/internal/dom/actionable.d.mts +5 -7
- package/dist/internal/dom/actionable.mjs +1 -1
- package/dist/internal/hydration.d.mts +2 -3
- package/dist/internal/kernel-registry.d.mts +5 -6
- package/dist/internal/kernel.d.mts +2 -292
- package/dist/internal/kernel.mjs +1 -1
- package/dist/internal/otel/exporter-logs.d.mts +1 -12
- package/dist/internal/otel/exporter-logs.mjs +1 -1
- package/dist/internal/otel/exporter-metrics.d.mts +2 -14
- package/dist/internal/otel/exporter-metrics.mjs +1 -1
- package/dist/internal/otel/exporter.d.mts +2 -29
- package/dist/internal/otel/exporter.mjs +1 -1
- package/dist/internal/otel/http-span-route.d.mts +4 -0
- package/dist/internal/otel/http-span-route.mjs +1 -0
- package/dist/internal/otel/index.d.mts +7 -5
- package/dist/internal/otel/index.mjs +1 -1
- package/dist/internal/otel/initial-navigation.d.mts +3 -4
- package/dist/internal/otel/initial-navigation.mjs +1 -1
- package/dist/internal/otel/instrumentations.d.mts +2 -89
- package/dist/internal/otel/instrumentations.mjs +1 -1
- package/dist/internal/otel/navigation.d.mts +2 -0
- package/dist/internal/otel/navigation.mjs +1 -0
- package/dist/internal/otel/normalize-path.d.mts +9 -0
- package/dist/internal/otel/normalize-path.mjs +1 -0
- package/dist/internal/otel/page-scope-context-manager.d.mts +2 -31
- package/dist/internal/otel/page-scope-context-manager.mjs +1 -1
- package/dist/internal/otel/propagation.d.mts +1 -19
- package/dist/internal/otel/propagation.mjs +1 -1
- package/dist/internal/otel/provider.d.mts +1 -86
- package/dist/internal/otel/provider.mjs +1 -1
- package/dist/internal/otel/url-attrs.d.mts +7 -0
- package/dist/internal/otel/url-attrs.mjs +1 -0
- package/dist/internal/otel/web-vitals.d.mts +1 -33
- package/dist/internal/otel/web-vitals.mjs +1 -1
- package/dist/internal/page-lifecycle.d.mts +4 -5
- package/dist/internal/page-lifecycle.mjs +1 -1
- package/dist/internal/plugin-runtime.d.mts +1 -38
- package/dist/internal/plugin-runtime.mjs +1 -1
- package/dist/internal/react-context.d.mts +1 -43
- package/dist/internal/react-context.mjs +1 -1
- package/dist/internal/server-digest.d.mts +4 -3
- package/dist/internal/server-digest.mjs +1 -1
- package/dist/internal/sw-queue.d.mts +4 -5
- package/dist/internal/sw-queue.mjs +1 -1
- package/dist/internal/third-party-hosts.d.mts +2 -3
- package/dist/internal/third-party-hosts.mjs +1 -1
- package/dist/internal/version.d.mts +4 -5
- package/dist/internal/version.mjs +1 -1
- package/dist/internal/wrapper-singleton.d.mts +5 -6
- package/dist/internal/wrapper-singleton.mjs +1 -1
- package/dist/navigation-CkiV6lJY.d.mts +54 -0
- package/dist/page-scope-context-manager-r92ZMJok.d.mts +17 -0
- package/dist/plugins/device.d.mts +5 -0
- package/dist/plugins/device.mjs +1 -0
- package/dist/plugins/errors.d.mts +1 -1
- package/dist/plugins/errors.mjs +1 -1
- package/dist/plugins/lib/loader.d.mts +2 -11
- package/dist/plugins/lib/loader.mjs +1 -1
- package/dist/plugins/lib/types.d.mts +2 -24
- package/dist/plugins/logs.d.mts +1 -1
- package/dist/plugins/logs.mjs +1 -1
- package/dist/plugins/page-events.d.mts +5 -0
- package/dist/plugins/page-events.mjs +1 -0
- package/dist/plugins/rage-clicks.d.mts +1 -1
- package/dist/plugins/rage-clicks.mjs +1 -1
- package/dist/plugins/replay/buffer.d.mts +9 -6
- package/dist/plugins/replay/buffer.mjs +1 -1
- package/dist/plugins/replay/chunking.d.mts +18 -9
- package/dist/plugins/replay/chunking.mjs +1 -1
- package/dist/plugins/replay/compressor-host.d.mts +3 -4
- package/dist/plugins/replay/compressor-host.mjs +1 -1
- package/dist/plugins/replay/config.d.mts +1 -11
- package/dist/plugins/replay/config.mjs +1 -1
- package/dist/plugins/replay/delivery.d.mts +8 -9
- package/dist/plugins/replay/delivery.mjs +1 -1
- package/dist/plugins/replay/index.d.mts +1 -1
- package/dist/plugins/replay/index.mjs +1 -1
- package/dist/plugins/replay/recorder.d.mts +12 -6
- package/dist/plugins/replay/recorder.mjs +1 -1
- package/dist/plugins/replay/sequence.d.mts +5 -4
- package/dist/plugins/replay/sequence.mjs +1 -1
- package/dist/plugins/replay/upload.d.mts +4 -0
- package/dist/plugins/replay/upload.mjs +1 -0
- package/dist/propagation-CssinKCy.d.mts +26 -0
- package/dist/provider-CF0h4Mah.d.mts +101 -0
- package/dist/provider-DRuvRafW.d.mts +466 -0
- package/dist/provider.d.mts +2 -58
- package/dist/provider.mjs +1 -1
- package/dist/react-error-handler.d.mts +9 -11
- package/dist/react-error-handler.mjs +1 -1
- package/dist/rrweb-CE6GKCEq.mjs +150 -0
- package/dist/tracking/api.d.mts +1 -54
- package/dist/tracking/api.mjs +1 -1
- package/dist/tracking/device.d.mts +1 -32
- package/dist/tracking/device.mjs +1 -1
- package/dist/tracking/geo.d.mts +1 -13
- package/dist/tracking/geo.mjs +1 -1
- package/dist/tracking/session.d.mts +6 -7
- package/dist/tracking/session.mjs +1 -1
- package/dist/util/bot.d.mts +2 -3
- package/dist/util/bot.mjs +1 -1
- package/dist/util/global.d.mts +4 -10
- package/dist/util/global.mjs +1 -1
- package/dist/util/log.d.mts +11 -7
- package/dist/util/log.mjs +1 -1
- package/dist/util/stringify.d.mts +2 -3
- package/dist/version-XRSM9Pwm.mjs +1 -0
- package/dist/web-vitals-x8y70B5x.d.mts +34 -0
- package/package.json +67 -48
- package/dist/package.mjs +0 -1
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
var __defProp=Object.defineProperty,__defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value,__publicField=(obj,key,value)=>__defNormalProp(obj,typeof key==`symbol`?key:key+``,value),__defProp$1=Object.defineProperty,__defNormalProp$1=(obj,key,value)=>key in obj?__defProp$1(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value,__publicField$1=(obj,key,value)=>__defNormalProp$1(obj,typeof key==`symbol`?key:key+``,value),NodeType$3=(NodeType2=>(NodeType2[NodeType2.Document=0]=`Document`,NodeType2[NodeType2.DocumentType=1]=`DocumentType`,NodeType2[NodeType2.Element=2]=`Element`,NodeType2[NodeType2.Text=3]=`Text`,NodeType2[NodeType2.CDATA=4]=`CDATA`,NodeType2[NodeType2.Comment=5]=`Comment`,NodeType2))(NodeType$3||{});const testableAccessors$1={Node:[`childNodes`,`parentNode`,`parentElement`,`textContent`,`ownerDocument`],ShadowRoot:[`host`,`styleSheets`],Element:[`shadowRoot`,`querySelector`,`querySelectorAll`],MutationObserver:[]},testableMethods$1={Node:[`contains`,`getRootNode`],ShadowRoot:[`getSelection`],Element:[],MutationObserver:[`constructor`]},untaintedBasePrototype$1={},untaintedBaseIframeCleanup$1={},isAngularZonePresent$1=()=>!!globalThis.Zone;function getUntaintedPrototype$1(key){if(untaintedBasePrototype$1[key])return untaintedBasePrototype$1[key];let defaultObj=globalThis[key],defaultPrototype=defaultObj.prototype,accessorNames=key in testableAccessors$1?testableAccessors$1[key]:void 0,isUntaintedAccessors=!!(accessorNames&&accessorNames.every(accessor=>!!(Object.getOwnPropertyDescriptor(defaultPrototype,accessor)?.get)?.toString().includes(`[native code]`))),methodNames=key in testableMethods$1?testableMethods$1[key]:void 0,isUntaintedMethods=!!(methodNames&&methodNames.every(method=>typeof defaultPrototype[method]==`function`&&defaultPrototype[method]?.toString().includes(`[native code]`)));if(isUntaintedAccessors&&isUntaintedMethods&&!isAngularZonePresent$1())return untaintedBasePrototype$1[key]=defaultObj.prototype,defaultObj.prototype;try{let iframeEl=document.createElement(`iframe`);iframeEl.style.display=`none`,document.body.appendChild(iframeEl);let win=iframeEl.contentWindow;if(!win)return defaultObj.prototype;let untaintedObject=win[key].prototype;if(!untaintedObject)return iframeEl.remove(),defaultPrototype;let ua=navigator.userAgent;if(ua.includes(`Safari`)&&!ua.includes(`Chrome`))iframeEl.classList.add(`rr-block`),iframeEl.setAttribute(`__rrwebUntaintedMutationObserver`,``),untaintedBaseIframeCleanup$1[key]=()=>iframeEl.remove();else{for(let name of Object.keys(testableAccessors$1))typeof win[name]==`function`&&win[name].prototype&&(untaintedBasePrototype$1[name]??=win[name].prototype);iframeEl.remove()}return untaintedBasePrototype$1[key]=untaintedObject}catch{return defaultPrototype}}const untaintedAccessorCache$1={};function getUntaintedAccessor$1(key,instance,accessor){let cacheKey=`${key}.${String(accessor)}`;if(untaintedAccessorCache$1[cacheKey])return untaintedAccessorCache$1[cacheKey].call(instance);let untaintedPrototype=getUntaintedPrototype$1(key),untaintedAccessor=Object.getOwnPropertyDescriptor(untaintedPrototype,accessor)?.get;return untaintedAccessor?(untaintedAccessorCache$1[cacheKey]=untaintedAccessor,untaintedAccessor.call(instance)):instance[accessor]}const untaintedMethodCache$1={};function getUntaintedMethod$1(key,instance,method){let cacheKey=`${key}.${String(method)}`;if(untaintedMethodCache$1[cacheKey])return untaintedMethodCache$1[cacheKey].bind(instance);let untaintedMethod=getUntaintedPrototype$1(key)[method];return typeof untaintedMethod==`function`?(untaintedMethodCache$1[cacheKey]=untaintedMethod,untaintedMethod.bind(instance)):instance[method]}function ownerDocument$1(n2){return getUntaintedAccessor$1(`Node`,n2,`ownerDocument`)}function childNodes$1(n2){return getUntaintedAccessor$1(`Node`,n2,`childNodes`)}function parentNode$1(n2){return getUntaintedAccessor$1(`Node`,n2,`parentNode`)}function parentElement$1(n2){return getUntaintedAccessor$1(`Node`,n2,`parentElement`)}function textContent$1(n2){return getUntaintedAccessor$1(`Node`,n2,`textContent`)}function contains$1(n2,other){return getUntaintedMethod$1(`Node`,n2,`contains`)(other)}function getRootNode$1(n2){return getUntaintedMethod$1(`Node`,n2,`getRootNode`)()}function host$1(n2){return!n2||!(`host`in n2)?null:getUntaintedAccessor$1(`ShadowRoot`,n2,`host`)}function styleSheets$1(n2){return n2.styleSheets}function shadowRoot$1(n2){return!n2||!(`shadowRoot`in n2)?null:getUntaintedAccessor$1(`Element`,n2,`shadowRoot`)}function querySelector$1(n2,selectors){return getUntaintedAccessor$1(`Element`,n2,`querySelector`)(selectors)}function querySelectorAll$1(n2,selectors){return getUntaintedAccessor$1(`Element`,n2,`querySelectorAll`)(selectors)}function mutationObserverCtor$1(){return[getUntaintedPrototype$1(`MutationObserver`).constructor,untaintedBaseIframeCleanup$1.MutationObserver??(()=>{})]}let nowTimestamp$1=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(nowTimestamp$1=()=>new Date().getTime());function patch$1(source,name,replacement){try{if(!(name in source))return()=>{};let original=source[name],wrapped=replacement(original);return typeof wrapped==`function`&&(wrapped.prototype=wrapped.prototype||{},Object.defineProperties(wrapped,{__rrweb_original__:{enumerable:!1,value:original}})),source[name]=wrapped,()=>{source[name]=original}}catch{return()=>{}}}const index$1={ownerDocument:ownerDocument$1,childNodes:childNodes$1,parentNode:parentNode$1,parentElement:parentElement$1,textContent:textContent$1,contains:contains$1,getRootNode:getRootNode$1,host:host$1,styleSheets:styleSheets$1,shadowRoot:shadowRoot$1,querySelector:querySelector$1,querySelectorAll:querySelectorAll$1,nowTimestamp:nowTimestamp$1,mutationObserverCtor:mutationObserverCtor$1,patch:patch$1};function isElement(n2){return n2.nodeType===n2.ELEMENT_NODE}function isShadowRoot(n2){let hostEl=n2&&`host`in n2&&`mode`in n2&&index$1.host(n2)||null;return!!(hostEl&&`shadowRoot`in hostEl&&index$1.shadowRoot(hostEl)===n2)}function isNativeShadowDom(shadowRoot2){return Object.prototype.toString.call(shadowRoot2)===`[object ShadowRoot]`}function fixBrowserCompatibilityIssuesInCSS(cssText){return cssText.includes(` background-clip: text;`)&&!cssText.includes(` -webkit-background-clip: text;`)&&(cssText=cssText.replace(/\sbackground-clip:\s*text;/g,` -webkit-background-clip: text; background-clip: text;`)),cssText}function escapeImportStatement(rule2){let{cssText}=rule2;if(cssText.split(`"`).length<3)return cssText;let statement=[`@import`,`url(${JSON.stringify(rule2.href)})`];return rule2.layerName===``?statement.push(`layer`):rule2.layerName&&statement.push(`layer(${rule2.layerName})`),rule2.supportsText&&statement.push(`supports(${rule2.supportsText})`),rule2.media.length&&statement.push(rule2.media.mediaText),statement.join(` `)+`;`}function stringifyStylesheet(s2){try{let rules2=s2.rules||s2.cssRules;if(!rules2)return null;let sheetHref=s2.href;return!sheetHref&&s2.ownerNode&&(sheetHref=s2.ownerNode.baseURI),fixBrowserCompatibilityIssuesInCSS(Array.from(rules2,rule2=>stringifyRule(rule2,sheetHref)).join(``))}catch{return null}}function stringifyRule(rule2,sheetHref){if(isCSSImportRule(rule2)){let importStringified;try{importStringified=stringifyStylesheet(rule2.styleSheet)||escapeImportStatement(rule2)}catch{importStringified=rule2.cssText}return rule2.styleSheet.href?absolutifyURLs(importStringified,rule2.styleSheet.href):importStringified}{let ruleStringified=rule2.cssText;return isCSSStyleRule(rule2)&&rule2.selectorText.includes(`:`)&&(ruleStringified=fixSafariColons(ruleStringified)),sheetHref?absolutifyURLs(ruleStringified,sheetHref):ruleStringified}}function fixSafariColons(cssStringified){return cssStringified.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,`$1\\$2`)}function isCSSImportRule(rule2){return`styleSheet`in rule2}function isCSSStyleRule(rule2){return`selectorText`in rule2}var Mirror=class{constructor(){__publicField$1(this,`idNodeMap`,new Map),__publicField$1(this,`nodeMetaMap`,new WeakMap)}getId(n2){return n2?this.getMeta(n2)?.id??-1:-1}getNode(id){return this.idNodeMap.get(id)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(n2){return this.nodeMetaMap.get(n2)||null}removeNodeFromMap(n2){let id=this.getId(n2);this.idNodeMap.delete(id),n2.childNodes&&n2.childNodes.forEach(childNode=>this.removeNodeFromMap(childNode))}has(id){return this.idNodeMap.has(id)}hasNode(node2){return this.nodeMetaMap.has(node2)}add(n2,meta){let id=meta.id;this.idNodeMap.set(id,n2),this.nodeMetaMap.set(n2,meta)}replace(id,n2){let oldNode=this.getNode(id);if(oldNode){let meta=this.nodeMetaMap.get(oldNode);meta&&this.nodeMetaMap.set(n2,meta)}this.idNodeMap.set(id,n2)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function createMirror$2(){return new Mirror}function maskInputValue({element,maskInputOptions,tagName,type,value,maskInputFn}){let text=value||``,actualType=type&&toLowerCase(type);return(maskInputOptions[tagName.toLowerCase()]||actualType&&maskInputOptions[actualType])&&(text=maskInputFn?maskInputFn(text,element):`*`.repeat(text.length)),text}function toLowerCase(str){return str.toLowerCase()}const ORIGINAL_ATTRIBUTE_NAME=`__rrweb_original__`;function is2DCanvasBlank(canvas){let ctx=canvas.getContext(`2d`);if(!ctx)return!0;for(let x=0;x<canvas.width;x+=50)for(let y=0;y<canvas.height;y+=50){let getImageData=ctx.getImageData,originalGetImageData=ORIGINAL_ATTRIBUTE_NAME in getImageData?getImageData[ORIGINAL_ATTRIBUTE_NAME]:getImageData;if(new Uint32Array(originalGetImageData.call(ctx,x,y,Math.min(50,canvas.width-x),Math.min(50,canvas.height-y)).data.buffer).some(pixel=>pixel!==0))return!1}return!0}function isNodeMetaEqual(a2,b){return!a2||!b||a2.type!==b.type?!1:a2.type===NodeType$3.Document?a2.compatMode===b.compatMode:a2.type===NodeType$3.DocumentType?a2.name===b.name&&a2.publicId===b.publicId&&a2.systemId===b.systemId:a2.type===NodeType$3.Comment||a2.type===NodeType$3.Text||a2.type===NodeType$3.CDATA?a2.textContent===b.textContent:a2.type===NodeType$3.Element&&a2.tagName===b.tagName&&JSON.stringify(a2.attributes)===JSON.stringify(b.attributes)&&a2.isSVG===b.isSVG&&a2.needBlock===b.needBlock}function getInputType(element){let type=element.type;return element.hasAttribute(`data-rr-is-password`)?`password`:type?toLowerCase(type):null}function extractFileExtension(path,baseURL){let url;try{url=new URL(path,baseURL??window.location.href)}catch{return null}return url.pathname.match(/\.([0-9a-z]+)(?:$)/i)?.[1]??null}function extractOrigin(url){let origin=``;return origin=url.indexOf(`//`)>-1?url.split(`/`).slice(0,3).join(`/`):url.split(`/`)[0],origin=origin.split(`?`)[0],origin}const URL_IN_CSS_REF=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,URL_PROTOCOL_MATCH=/^(?:[a-z+]+:)?\/\//i,URL_WWW_MATCH=/^www\..*/i,DATA_URI=/^(data:)([^,]*),(.*)/i;function absolutifyURLs(cssText,href){return(cssText||``).replace(URL_IN_CSS_REF,(origin,quote1,path1,quote2,path2,path3)=>{let filePath=path1||path2||path3,maybeQuote=quote1||quote2||``;if(!filePath)return origin;if(URL_PROTOCOL_MATCH.test(filePath)||URL_WWW_MATCH.test(filePath)||DATA_URI.test(filePath))return`url(${maybeQuote}${filePath}${maybeQuote})`;if(filePath[0]===`/`)return`url(${maybeQuote}${extractOrigin(href)+filePath}${maybeQuote})`;let filePathNoHash=filePath.split(`#`)[0],maybeHash=filePath.substring(filePathNoHash.length),stack=href.split(`#`)[0].split(`/`),parts=filePathNoHash.split(`/`);stack.pop();for(let part of parts)if(part===`.`)continue;else part===`..`?stack.pop():stack.push(part);return`url(${maybeQuote}${stack.join(`/`)}${maybeHash}${maybeQuote})`})}function normalizeCssString(cssText,_testNoPxNorm=!1){return _testNoPxNorm?cssText.replace(/(\/\*[^*]*\*\/)|[\s;]/g,``):cssText.replace(/(\/\*[^*]*\*\/)|[\s;]/g,``).replace(/0px/g,`0`)}function splitCssText(cssText,style,_testNoPxNorm=!1){let childNodes2=Array.from(style.childNodes),splits=[],iterCount=0;if(childNodes2.length>1&&cssText&&typeof cssText==`string`){let cssTextNorm=normalizeCssString(cssText,_testNoPxNorm),normFactor=cssTextNorm.length/cssText.length;for(let i2=1;i2<childNodes2.length;i2++)if(childNodes2[i2].textContent&&typeof childNodes2[i2].textContent==`string`){let textContentNorm=normalizeCssString(childNodes2[i2].textContent,_testNoPxNorm),j=3;for(;j<textContentNorm.length&&(textContentNorm[j].match(/[a-zA-Z0-9]/)||textContentNorm.indexOf(textContentNorm.substring(0,j),1)!==-1);j++);for(;j<textContentNorm.length;j++){let startSubstring=textContentNorm.substring(0,j),cssNormSplits=cssTextNorm.split(startSubstring),splitNorm=-1;if(cssNormSplits.length===2)splitNorm=cssNormSplits[0].length;else if(cssNormSplits.length>2&&cssNormSplits[0]===``&&childNodes2[i2-1].textContent!==``)splitNorm=cssTextNorm.indexOf(startSubstring,1);else if(cssNormSplits.length===1){if(startSubstring=startSubstring.substring(0,startSubstring.length-1),cssNormSplits=cssTextNorm.split(startSubstring),cssNormSplits.length<=1)return splits.push(cssText),splits;j=101}else j===textContentNorm.length-1&&(splitNorm=cssTextNorm.indexOf(startSubstring));if(cssNormSplits.length>=2&&j>100){let prevTextContent=childNodes2[i2-1].textContent;if(prevTextContent&&typeof prevTextContent==`string`){let prevMinLength=normalizeCssString(prevTextContent).length;splitNorm=cssTextNorm.indexOf(startSubstring,prevMinLength)}splitNorm===-1&&(splitNorm=cssNormSplits[0].length)}if(splitNorm!==-1){let k=Math.floor(splitNorm/normFactor);for(;k>0&&k<cssText.length;){if(iterCount+=1,iterCount>50*childNodes2.length)return splits.push(cssText),splits;let normPart=normalizeCssString(cssText.substring(0,k),_testNoPxNorm);if(normPart.length===splitNorm){splits.push(cssText.substring(0,k)),cssText=cssText.substring(k),cssTextNorm=cssTextNorm.substring(splitNorm);break}normPart.length<splitNorm?k+=Math.max(1,Math.floor((splitNorm-normPart.length)/normFactor)):k-=Math.max(1,Math.floor((normPart.length-splitNorm)*normFactor))}break}}}}return splits.push(cssText),splits}function markCssSplits(cssText,style){return splitCssText(cssText,style).join(`/* rr_split */`)}let _id=1;const tagNameRegex=RegExp(`[^a-z0-9-_:]`);function genId(){return _id++}function getValidTagName$1(element){if(element instanceof HTMLFormElement)return`form`;let processedTagName=toLowerCase(element.tagName);return tagNameRegex.test(processedTagName)?`div`:processedTagName}let canvasService,canvasCtx;const SRCSET_NOT_SPACES=/^[^ \t\n\r\u000c]+/,SRCSET_COMMAS_OR_SPACES=/^[, \t\n\r\u000c]+/;function getAbsoluteSrcsetString(doc,attributeValue){if(attributeValue.trim()===``)return attributeValue;let pos=0;function collectCharacters(regEx){let chars2,match=regEx.exec(attributeValue.substring(pos));return match?(chars2=match[0],pos+=chars2.length,chars2):``}let output=[];for(;collectCharacters(SRCSET_COMMAS_OR_SPACES),!(pos>=attributeValue.length);){let url=collectCharacters(SRCSET_NOT_SPACES);if(url.slice(-1)===`,`)url=absoluteToDoc(doc,url.substring(0,url.length-1)),output.push(url);else{let descriptorsStr=``;url=absoluteToDoc(doc,url);let inParens=!1;for(;;){let c2=attributeValue.charAt(pos);if(c2===``){output.push((url+descriptorsStr).trim());break}if(inParens)c2===`)`&&(inParens=!1);else{if(c2===`,`){pos+=1,output.push((url+descriptorsStr).trim());break}c2===`(`&&(inParens=!0)}descriptorsStr+=c2,pos+=1}}}return output.join(`, `)}const cachedDocument=new WeakMap;function absoluteToDoc(doc,attributeValue){return!attributeValue||attributeValue.trim()===``?attributeValue:getHref(doc,attributeValue)}function isSVGElement(el){return!!(el.tagName===`svg`||el.ownerSVGElement)}function getHref(doc,customHref){let a2=cachedDocument.get(doc);if(a2||(a2=doc.createElement(`a`),cachedDocument.set(doc,a2)),!customHref)customHref=``;else if(customHref.startsWith(`blob:`)||customHref.startsWith(`data:`))return customHref;return a2.setAttribute(`href`,customHref),a2.href}function transformAttribute(doc,tagName,name,value){return value&&(name===`src`||name===`href`&&(tagName!==`use`||value[0]!==`#`)||name===`xlink:href`&&value[0]!==`#`||name===`background`&&[`table`,`td`,`th`].includes(tagName)?absoluteToDoc(doc,value):name===`srcset`?getAbsoluteSrcsetString(doc,value):name===`style`?absolutifyURLs(value,getHref(doc)):tagName===`object`&&name===`data`?absoluteToDoc(doc,value):value)}function ignoreAttribute(tagName,name,_value){return[`video`,`audio`].includes(tagName)&&name===`autoplay`}function _isBlockedElement(element,blockClass,blockSelector){try{if(typeof blockClass==`string`){if(element.classList.contains(blockClass))return!0}else for(let eIndex=element.classList.length;eIndex--;){let className=element.classList[eIndex];if(blockClass.test(className))return!0}if(blockSelector)return element.matches(blockSelector)}catch{}return!1}function classMatchesRegex(node2,regex,checkAncestors){if(!node2)return!1;if(node2.nodeType!==node2.ELEMENT_NODE)return checkAncestors?classMatchesRegex(index$1.parentNode(node2),regex,checkAncestors):!1;for(let eIndex=node2.classList.length;eIndex--;){let className=node2.classList[eIndex];if(regex.test(className))return!0}return checkAncestors?classMatchesRegex(index$1.parentNode(node2),regex,checkAncestors):!1}function needMaskingText(node2,maskTextClass,maskTextSelector,checkAncestors){let el;if(isElement(node2)){if(el=node2,!index$1.childNodes(el).length)return!1}else if(index$1.parentElement(node2)===null)return!1;else el=index$1.parentElement(node2);try{if(typeof maskTextClass==`string`){if(checkAncestors){if(el.closest(`.${maskTextClass}`))return!0}else if(el.classList.contains(maskTextClass))return!0}else if(classMatchesRegex(el,maskTextClass,checkAncestors))return!0;if(maskTextSelector){if(checkAncestors){if(el.closest(maskTextSelector))return!0}else if(el.matches(maskTextSelector))return!0}}catch{}return!1}function onceIframeLoaded(iframeEl,listener,iframeLoadTimeout){let win=iframeEl.contentWindow;if(!win)return;let fired=!1,readyState;try{readyState=win.document.readyState}catch{return}if(readyState!==`complete`){let timer=setTimeout(()=>{fired||=(listener(),!0)},iframeLoadTimeout);iframeEl.addEventListener(`load`,()=>{clearTimeout(timer),fired=!0,listener()});return}let blankUrl=`about:blank`;if(win.location.href!==blankUrl||iframeEl.src===blankUrl||iframeEl.src===``)return setTimeout(listener,0),iframeEl.addEventListener(`load`,listener);iframeEl.addEventListener(`load`,listener)}function onceStylesheetLoaded(link,listener,styleSheetLoadTimeout){let fired=!1,styleSheetLoaded;try{styleSheetLoaded=link.sheet}catch{return}if(styleSheetLoaded)return;let timer=setTimeout(()=>{fired||=(listener(),!0)},styleSheetLoadTimeout);link.addEventListener(`load`,()=>{clearTimeout(timer),fired=!0,listener()})}function serializeNode(n2,options){let{doc,mirror:mirror2,blockClass,blockSelector,needsMask,inlineStylesheet,maskInputOptions={},maskTextFn,maskInputFn,dataURLOptions={},inlineImages,recordCanvas,keepIframeSrcFn,newlyAddedElement=!1,cssCaptured=!1}=options,rootId=getRootId(doc,mirror2);switch(n2.nodeType){case n2.DOCUMENT_NODE:return n2.compatMode===`CSS1Compat`?{type:NodeType$3.Document,childNodes:[]}:{type:NodeType$3.Document,childNodes:[],compatMode:n2.compatMode};case n2.DOCUMENT_TYPE_NODE:return{type:NodeType$3.DocumentType,name:n2.name,publicId:n2.publicId,systemId:n2.systemId,rootId};case n2.ELEMENT_NODE:return serializeElementNode(n2,{doc,blockClass,blockSelector,inlineStylesheet,maskInputOptions,maskInputFn,dataURLOptions,inlineImages,recordCanvas,keepIframeSrcFn,newlyAddedElement,rootId});case n2.TEXT_NODE:return serializeTextNode(n2,{doc,needsMask,maskTextFn,rootId,cssCaptured});case n2.CDATA_SECTION_NODE:return{type:NodeType$3.CDATA,textContent:``,rootId};case n2.COMMENT_NODE:return{type:NodeType$3.Comment,textContent:index$1.textContent(n2)||``,rootId};default:return!1}}function getRootId(doc,mirror2){if(!mirror2.hasNode(doc))return;let docId=mirror2.getId(doc);return docId===1?void 0:docId}function serializeTextNode(n2,options){let{needsMask,maskTextFn,rootId,cssCaptured}=options,parent=index$1.parentNode(n2),parentTagName=parent&&parent.tagName,textContent2=``,isStyle=parentTagName===`STYLE`||void 0,isScript=parentTagName===`SCRIPT`||void 0;return isScript?textContent2=`SCRIPT_PLACEHOLDER`:cssCaptured||(textContent2=index$1.textContent(n2),isStyle&&textContent2&&(textContent2=absolutifyURLs(textContent2,getHref(options.doc)))),!isStyle&&!isScript&&textContent2&&needsMask&&(textContent2=maskTextFn?maskTextFn(textContent2,index$1.parentElement(n2)):textContent2.replace(/[\S]/g,`*`)),{type:NodeType$3.Text,textContent:textContent2||``,rootId}}function serializeElementNode(n2,options){let{doc,blockClass,blockSelector,inlineStylesheet,maskInputOptions={},maskInputFn,dataURLOptions={},inlineImages,recordCanvas,keepIframeSrcFn,newlyAddedElement=!1,rootId}=options,needBlock=_isBlockedElement(n2,blockClass,blockSelector),tagName=getValidTagName$1(n2),attributes={},len=n2.attributes.length;for(let i2=0;i2<len;i2++){let attr=n2.attributes[i2];ignoreAttribute(tagName,attr.name,attr.value)||(attributes[attr.name]=transformAttribute(doc,tagName,toLowerCase(attr.name),attr.value))}if(tagName===`link`&&inlineStylesheet){let stylesheet=Array.from(doc.styleSheets).find(s2=>s2.href===n2.href),cssText=null;stylesheet&&(cssText=stringifyStylesheet(stylesheet)),cssText&&(delete attributes.rel,delete attributes.href,attributes._cssText=cssText)}if(tagName===`style`&&n2.sheet){let cssText=stringifyStylesheet(n2.sheet);cssText&&(n2.childNodes.length>1&&(cssText=markCssSplits(cssText,n2)),attributes._cssText=cssText)}if([`input`,`textarea`,`select`].includes(tagName)){let value=n2.value,checked=n2.checked;attributes.type!==`radio`&&attributes.type!==`checkbox`&&attributes.type!==`submit`&&attributes.type!==`button`&&value?attributes.value=maskInputValue({element:n2,type:getInputType(n2),tagName,value,maskInputOptions,maskInputFn}):checked&&(attributes.checked=checked)}if(tagName===`option`&&(n2.selected&&!maskInputOptions.select?attributes.selected=!0:delete attributes.selected),tagName===`dialog`&&n2.open&&(attributes.rr_open_mode=n2.matches(`dialog:modal`)?`modal`:`non-modal`),tagName===`canvas`&&recordCanvas){if(n2.__context===`2d`)is2DCanvasBlank(n2)||(attributes.rr_dataURL=n2.toDataURL(dataURLOptions.type,dataURLOptions.quality));else if(!(`__context`in n2)){let canvasDataURL=n2.toDataURL(dataURLOptions.type,dataURLOptions.quality),blankCanvas=doc.createElement(`canvas`);blankCanvas.width=n2.width,blankCanvas.height=n2.height,canvasDataURL!==blankCanvas.toDataURL(dataURLOptions.type,dataURLOptions.quality)&&(attributes.rr_dataURL=canvasDataURL)}}if(tagName===`img`&&inlineImages){canvasService||(canvasService=doc.createElement(`canvas`),canvasCtx=canvasService.getContext(`2d`));let image=n2,imageSrc=image.currentSrc||image.getAttribute(`src`)||`<unknown-src>`,priorCrossOrigin=image.crossOrigin,recordInlineImage=()=>{image.removeEventListener(`load`,recordInlineImage);try{canvasService.width=image.naturalWidth,canvasService.height=image.naturalHeight,canvasCtx.drawImage(image,0,0),attributes.rr_dataURL=canvasService.toDataURL(dataURLOptions.type,dataURLOptions.quality)}catch(err){if(image.crossOrigin!==`anonymous`){image.crossOrigin=`anonymous`,image.complete&&image.naturalWidth!==0?recordInlineImage():image.addEventListener(`load`,recordInlineImage);return}console.warn(`Cannot inline img src=${imageSrc}! Error: ${err}`)}image.crossOrigin===`anonymous`&&(priorCrossOrigin?attributes.crossOrigin=priorCrossOrigin:image.removeAttribute(`crossorigin`))};image.complete&&image.naturalWidth!==0?recordInlineImage():image.addEventListener(`load`,recordInlineImage)}if([`audio`,`video`].includes(tagName)){let mediaAttributes=attributes;mediaAttributes.rr_mediaState=n2.paused?`paused`:`played`,mediaAttributes.rr_mediaCurrentTime=n2.currentTime,mediaAttributes.rr_mediaPlaybackRate=n2.playbackRate,mediaAttributes.rr_mediaMuted=n2.muted,mediaAttributes.rr_mediaLoop=n2.loop,mediaAttributes.rr_mediaVolume=n2.volume}if(newlyAddedElement||(n2.scrollLeft&&(attributes.rr_scrollLeft=n2.scrollLeft),n2.scrollTop&&(attributes.rr_scrollTop=n2.scrollTop)),needBlock){let{width,height}=n2.getBoundingClientRect();attributes={class:attributes.class,rr_width:`${width}px`,rr_height:`${height}px`}}tagName===`iframe`&&!keepIframeSrcFn(attributes.src)&&(n2.contentDocument||(attributes.rr_src=attributes.src),delete attributes.src);let isCustomElement;try{customElements.get(tagName)&&(isCustomElement=!0)}catch{}return{type:NodeType$3.Element,tagName,attributes,childNodes:[],isSVG:isSVGElement(n2)||void 0,needBlock,rootId,isCustom:isCustomElement}}function lowerIfExists(maybeAttr){return maybeAttr==null?``:maybeAttr.toLowerCase()}function slimDOMDefaults(_slimDOMOptions){return _slimDOMOptions===!0||_slimDOMOptions===`all`?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:_slimDOMOptions===`all`,headMetaDescKeywords:_slimDOMOptions===`all`,headTitleMutations:_slimDOMOptions===`all`}:_slimDOMOptions||{}}function slimDOMExcluded(sn,slimDOMOptions){return!!(slimDOMOptions.comment&&sn.type===NodeType$3.Comment||sn.type===NodeType$3.Element&&(slimDOMOptions.script&&(sn.tagName===`script`||sn.tagName===`link`&&(sn.attributes.rel===`preload`&&sn.attributes.as===`script`||sn.attributes.rel===`modulepreload`)||sn.tagName===`link`&&sn.attributes.rel===`prefetch`&&typeof sn.attributes.href==`string`&&extractFileExtension(sn.attributes.href)===`js`)||slimDOMOptions.headFavicon&&(sn.tagName===`link`&&sn.attributes.rel===`shortcut icon`||sn.tagName===`meta`&&(lowerIfExists(sn.attributes.name).match(/^msapplication-tile(image|color)$/)||lowerIfExists(sn.attributes.name)===`application-name`||lowerIfExists(sn.attributes.rel)===`icon`||lowerIfExists(sn.attributes.rel)===`apple-touch-icon`||lowerIfExists(sn.attributes.rel)===`shortcut icon`))||sn.tagName===`meta`&&(slimDOMOptions.headMetaDescKeywords&&lowerIfExists(sn.attributes.name).match(/^description|keywords$/)||slimDOMOptions.headMetaSocial&&(lowerIfExists(sn.attributes.property).match(/^(og|twitter|fb):/)||lowerIfExists(sn.attributes.name).match(/^(og|twitter):/)||lowerIfExists(sn.attributes.name)===`pinterest`)||slimDOMOptions.headMetaRobots&&(lowerIfExists(sn.attributes.name)===`robots`||lowerIfExists(sn.attributes.name)===`googlebot`||lowerIfExists(sn.attributes.name)===`bingbot`)||slimDOMOptions.headMetaHttpEquiv&&sn.attributes[`http-equiv`]!==void 0||slimDOMOptions.headMetaAuthorship&&(lowerIfExists(sn.attributes.name)===`author`||lowerIfExists(sn.attributes.name)===`generator`||lowerIfExists(sn.attributes.name)===`framework`||lowerIfExists(sn.attributes.name)===`publisher`||lowerIfExists(sn.attributes.name)===`progid`||lowerIfExists(sn.attributes.property).match(/^article:/)||lowerIfExists(sn.attributes.property).match(/^product:/))||slimDOMOptions.headMetaVerification&&(lowerIfExists(sn.attributes.name)===`google-site-verification`||lowerIfExists(sn.attributes.name)===`yandex-verification`||lowerIfExists(sn.attributes.name)===`csrf-token`||lowerIfExists(sn.attributes.name)===`p:domain_verify`||lowerIfExists(sn.attributes.name)===`verify-v1`||lowerIfExists(sn.attributes.name)===`verification`||lowerIfExists(sn.attributes.name)===`shopify-checkout-api-token`))))}function serializeNodeWithId(n2,options){let{doc,mirror:mirror2,blockClass,blockSelector,maskTextClass,maskTextSelector,skipChild=!1,inlineStylesheet=!0,maskInputOptions={},maskTextFn,maskInputFn,slimDOMOptions,dataURLOptions={},inlineImages=!1,recordCanvas=!1,onSerialize,onIframeLoad,iframeLoadTimeout=5e3,onStylesheetLoad,stylesheetLoadTimeout=5e3,keepIframeSrcFn=()=>!1,newlyAddedElement=!1,cssCaptured=!1}=options,{needsMask}=options,{preserveWhiteSpace=!0}=options;needsMask||=needMaskingText(n2,maskTextClass,maskTextSelector,needsMask===void 0);let _serializedNode=serializeNode(n2,{doc,mirror:mirror2,blockClass,blockSelector,needsMask,inlineStylesheet,maskInputOptions,maskTextFn,maskInputFn,dataURLOptions,inlineImages,recordCanvas,keepIframeSrcFn,newlyAddedElement,cssCaptured});if(!_serializedNode)return console.warn(n2,`not serialized`),null;let id;id=mirror2.hasNode(n2)?mirror2.getId(n2):slimDOMExcluded(_serializedNode,slimDOMOptions)||!preserveWhiteSpace&&_serializedNode.type===NodeType$3.Text&&!_serializedNode.textContent.replace(/^\s+|\s+$/gm,``).length?-2:genId();let serializedNode=Object.assign(_serializedNode,{id});if(mirror2.add(n2,serializedNode),id===-2)return null;onSerialize&&onSerialize(n2);let recordChild=!skipChild;if(serializedNode.type===NodeType$3.Element){recordChild&&=!serializedNode.needBlock,delete serializedNode.needBlock;let shadowRootEl=index$1.shadowRoot(n2);shadowRootEl&&isNativeShadowDom(shadowRootEl)&&(serializedNode.isShadowHost=!0)}if((serializedNode.type===NodeType$3.Document||serializedNode.type===NodeType$3.Element)&&recordChild){slimDOMOptions.headWhitespace&&serializedNode.type===NodeType$3.Element&&serializedNode.tagName===`head`&&(preserveWhiteSpace=!1);let bypassOptions={doc,mirror:mirror2,blockClass,blockSelector,needsMask,maskTextClass,maskTextSelector,skipChild,inlineStylesheet,maskInputOptions,maskTextFn,maskInputFn,slimDOMOptions,dataURLOptions,inlineImages,recordCanvas,preserveWhiteSpace,onSerialize,onIframeLoad,iframeLoadTimeout,onStylesheetLoad,stylesheetLoadTimeout,keepIframeSrcFn,cssCaptured:!1};if(serializedNode.type!==NodeType$3.Element||serializedNode.tagName!==`textarea`||serializedNode.attributes.value===void 0){serializedNode.type===NodeType$3.Element&&serializedNode.attributes._cssText!==void 0&&typeof serializedNode.attributes._cssText==`string`&&(bypassOptions.cssCaptured=!0);for(let childN of Array.from(index$1.childNodes(n2))){let serializedChildNode=serializeNodeWithId(childN,bypassOptions);serializedChildNode&&serializedNode.childNodes.push(serializedChildNode)}}let shadowRootEl=null;if(isElement(n2)&&(shadowRootEl=index$1.shadowRoot(n2)))for(let childN of Array.from(index$1.childNodes(shadowRootEl))){let serializedChildNode=serializeNodeWithId(childN,bypassOptions);serializedChildNode&&(isNativeShadowDom(shadowRootEl)&&(serializedChildNode.isShadow=!0),serializedNode.childNodes.push(serializedChildNode))}}let parent=index$1.parentNode(n2);return parent&&isShadowRoot(parent)&&isNativeShadowDom(parent)&&(serializedNode.isShadow=!0),serializedNode.type===NodeType$3.Element&&serializedNode.tagName===`iframe`&&onceIframeLoaded(n2,()=>{let iframeDoc=n2.contentDocument;if(iframeDoc&&onIframeLoad){let serializedIframeNode=serializeNodeWithId(iframeDoc,{doc:iframeDoc,mirror:mirror2,blockClass,blockSelector,needsMask,maskTextClass,maskTextSelector,skipChild:!1,inlineStylesheet,maskInputOptions,maskTextFn,maskInputFn,slimDOMOptions,dataURLOptions,inlineImages,recordCanvas,preserveWhiteSpace,onSerialize,onIframeLoad,iframeLoadTimeout,onStylesheetLoad,stylesheetLoadTimeout,keepIframeSrcFn});serializedIframeNode&&onIframeLoad(n2,serializedIframeNode)}},iframeLoadTimeout),serializedNode.type===NodeType$3.Element&&serializedNode.tagName===`link`&&typeof serializedNode.attributes.rel==`string`&&(serializedNode.attributes.rel===`stylesheet`||serializedNode.attributes.rel===`preload`&&typeof serializedNode.attributes.href==`string`&&extractFileExtension(serializedNode.attributes.href)===`css`)&&onceStylesheetLoaded(n2,()=>{if(onStylesheetLoad){let serializedLinkNode=serializeNodeWithId(n2,{doc,mirror:mirror2,blockClass,blockSelector,needsMask,maskTextClass,maskTextSelector,skipChild:!1,inlineStylesheet,maskInputOptions,maskTextFn,maskInputFn,slimDOMOptions,dataURLOptions,inlineImages,recordCanvas,preserveWhiteSpace,onSerialize,onIframeLoad,iframeLoadTimeout,onStylesheetLoad,stylesheetLoadTimeout,keepIframeSrcFn});serializedLinkNode&&onStylesheetLoad(n2,serializedLinkNode)}},stylesheetLoadTimeout),serializedNode}function snapshot(n2,options){let{mirror:mirror2=new Mirror,blockClass=`rr-block`,blockSelector=null,maskTextClass=`rr-mask`,maskTextSelector=null,inlineStylesheet=!0,inlineImages=!1,recordCanvas=!1,maskAllInputs=!1,maskTextFn,maskInputFn,slimDOM=!1,dataURLOptions,preserveWhiteSpace,onSerialize,onIframeLoad,iframeLoadTimeout,onStylesheetLoad,stylesheetLoadTimeout,keepIframeSrcFn=()=>!1}=options;return serializeNodeWithId(n2,{doc:n2,mirror:mirror2,blockClass,blockSelector,maskTextClass,maskTextSelector,skipChild:!1,inlineStylesheet,maskInputOptions:maskAllInputs===!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}:maskAllInputs===!1?{password:!0}:maskAllInputs,maskTextFn,maskInputFn,slimDOMOptions:slimDOMDefaults(slimDOM),dataURLOptions,inlineImages,recordCanvas,preserveWhiteSpace,onSerialize,onIframeLoad,iframeLoadTimeout,onStylesheetLoad,stylesheetLoadTimeout,keepIframeSrcFn,newlyAddedElement:!1})}const MEDIA_SELECTOR_GLOBAL=RegExp(`(max|min)-device-(width|height)`,`g`),mediaSelectorPlugin={postcssPlugin:`postcss-custom-selectors`,prepare(){return{postcssPlugin:`postcss-custom-selectors`,AtRule:function(atrule){atrule.params.match(MEDIA_SELECTOR_GLOBAL)&&(atrule.params=atrule.params.replace(MEDIA_SELECTOR_GLOBAL,`$1-$2`))}}}},pseudoClassPlugin={postcssPlugin:`postcss-hover-classes`,prepare:function(){let fixed=[];return{Rule:function(rule2){fixed.indexOf(rule2)===-1&&(fixed.push(rule2),rule2.selectors.forEach(function(selector){selector.includes(`:hover`)&&(rule2.selector+=`,
|
|
2
|
+
`+selector.replace(/:hover/g,`.\\:hover`))}))}}}};function getDefaultExportFromCjs$1(x){return x&&x.__esModule&&Object.prototype.hasOwnProperty.call(x,`default`)?x.default:x}function getAugmentedNamespace$1(n2){if(n2.__esModule)return n2;var f2=n2.default;if(typeof f2==`function`){var a2=function a22(){return this instanceof a22?Reflect.construct(f2,arguments,this.constructor):f2.apply(this,arguments)};a2.prototype=f2.prototype}else a2={};return Object.defineProperty(a2,"__esModule",{value:!0}),Object.keys(n2).forEach(function(k){var d=Object.getOwnPropertyDescriptor(n2,k);Object.defineProperty(a2,k,d.get?d:{enumerable:!0,get:function(){return n2[k]}})}),a2}var picocolors_browser$1={exports:{}},hasRequiredPicocolors_browser$1;function requirePicocolors_browser$1(){if(hasRequiredPicocolors_browser$1)return picocolors_browser$1.exports;hasRequiredPicocolors_browser$1=1;var x=String,create=function(){return{isColorSupported:!1,reset:x,bold:x,dim:x,italic:x,underline:x,inverse:x,hidden:x,strikethrough:x,black:x,red:x,green:x,yellow:x,blue:x,magenta:x,cyan:x,white:x,gray:x,bgBlack:x,bgRed:x,bgGreen:x,bgYellow:x,bgBlue:x,bgMagenta:x,bgCyan:x,bgWhite:x}};return picocolors_browser$1.exports=create(),picocolors_browser$1.exports.createColors=create,picocolors_browser$1.exports}const require$$2$1=getAugmentedNamespace$1(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:`Module`})));var cssSyntaxError$1,hasRequiredCssSyntaxError$1;function requireCssSyntaxError$1(){if(hasRequiredCssSyntaxError$1)return cssSyntaxError$1;hasRequiredCssSyntaxError$1=1;let pico=requirePicocolors_browser$1(),terminalHighlight=require$$2$1;class CssSyntaxError extends Error{constructor(message,line,column,source,file,plugin){super(message),this.name=`CssSyntaxError`,this.reason=message,file&&(this.file=file),source&&(this.source=source),plugin&&(this.plugin=plugin),line!==void 0&&column!==void 0&&(typeof line==`number`?(this.line=line,this.column=column):(this.line=line.line,this.column=line.column,this.endLine=column.line,this.endColumn=column.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,CssSyntaxError)}setMessage(){this.message=this.plugin?this.plugin+`: `:``,this.message+=this.file?this.file:`<css input>`,this.line!==void 0&&(this.message+=`:`+this.line+`:`+this.column),this.message+=`: `+this.reason}showSourceCode(color){if(!this.source)return``;let css=this.source;color??=pico.isColorSupported,terminalHighlight&&color&&(css=terminalHighlight(css));let lines=css.split(/\r?\n/),start=Math.max(this.line-3,0),end=Math.min(this.line+2,lines.length),maxWidth=String(end).length,mark,aside;if(color){let{bold,gray,red}=pico.createColors(!0);mark=text=>bold(red(text)),aside=text=>gray(text)}else mark=aside=str=>str;return lines.slice(start,end).map((line,index2)=>{let number=start+1+index2,gutter=` `+(` `+number).slice(-maxWidth)+` | `;if(number===this.line){let spacing=aside(gutter.replace(/\d/g,` `))+line.slice(0,this.column-1).replace(/[^\t]/g,` `);return mark(`>`)+aside(gutter)+line+`
|
|
3
|
+
`+spacing+mark(`^`)}return` `+aside(gutter)+line}).join(`
|
|
4
|
+
`)}toString(){let code=this.showSourceCode();return code&&=`
|
|
5
|
+
|
|
6
|
+
`+code+`
|
|
7
|
+
`,this.name+`: `+this.message+code}}return cssSyntaxError$1=CssSyntaxError,CssSyntaxError.default=CssSyntaxError,cssSyntaxError$1}var symbols$1={},hasRequiredSymbols$1;function requireSymbols$1(){return hasRequiredSymbols$1?symbols$1:(hasRequiredSymbols$1=1,symbols$1.isClean=Symbol(`isClean`),symbols$1.my=Symbol(`my`),symbols$1)}var stringifier$1,hasRequiredStringifier$1;function requireStringifier$1(){if(hasRequiredStringifier$1)return stringifier$1;hasRequiredStringifier$1=1;let DEFAULT_RAW={after:`
|
|
8
|
+
`,beforeClose:`
|
|
9
|
+
`,beforeComment:`
|
|
10
|
+
`,beforeDecl:`
|
|
11
|
+
`,beforeOpen:` `,beforeRule:`
|
|
12
|
+
`,colon:`: `,commentLeft:` `,commentRight:` `,emptyBody:``,indent:` `,semicolon:!1};function capitalize(str){return str[0].toUpperCase()+str.slice(1)}class Stringifier{constructor(builder){this.builder=builder}atrule(node2,semicolon){let name=`@`+node2.name,params=node2.params?this.rawValue(node2,`params`):``;if(node2.raws.afterName===void 0?params&&(name+=` `):name+=node2.raws.afterName,node2.nodes)this.block(node2,name+params);else{let end=(node2.raws.between||``)+(semicolon?`;`:``);this.builder(name+params+end,node2)}}beforeAfter(node2,detect){let value;value=node2.type===`decl`?this.raw(node2,null,`beforeDecl`):node2.type===`comment`?this.raw(node2,null,`beforeComment`):detect===`before`?this.raw(node2,null,`beforeRule`):this.raw(node2,null,`beforeClose`);let buf=node2.parent,depth=0;for(;buf&&buf.type!==`root`;)depth+=1,buf=buf.parent;if(value.includes(`
|
|
13
|
+
`)){let indent=this.raw(node2,null,`indent`);if(indent.length)for(let step=0;step<depth;step++)value+=indent}return value}block(node2,start){let between=this.raw(node2,`between`,`beforeOpen`);this.builder(start+between+`{`,node2,`start`);let after;node2.nodes&&node2.nodes.length?(this.body(node2),after=this.raw(node2,`after`)):after=this.raw(node2,`after`,`emptyBody`),after&&this.builder(after),this.builder(`}`,node2,`end`)}body(node2){let last=node2.nodes.length-1;for(;last>0&&node2.nodes[last].type===`comment`;)--last;let semicolon=this.raw(node2,`semicolon`);for(let i2=0;i2<node2.nodes.length;i2++){let child=node2.nodes[i2],before=this.raw(child,`before`);before&&this.builder(before),this.stringify(child,last!==i2||semicolon)}}comment(node2){let left=this.raw(node2,`left`,`commentLeft`),right=this.raw(node2,`right`,`commentRight`);this.builder(`/*`+left+node2.text+right+`*/`,node2)}decl(node2,semicolon){let between=this.raw(node2,`between`,`colon`),string=node2.prop+between+this.rawValue(node2,`value`);node2.important&&(string+=node2.raws.important||` !important`),semicolon&&(string+=`;`),this.builder(string,node2)}document(node2){this.body(node2)}raw(node2,own,detect){let value;if(detect||=own,own&&(value=node2.raws[own],value!==void 0))return value;let parent=node2.parent;if(detect===`before`&&(!parent||parent.type===`root`&&parent.first===node2||parent&&parent.type===`document`))return``;if(!parent)return DEFAULT_RAW[detect];let root2=node2.root();if(root2.rawCache||={},root2.rawCache[detect]!==void 0)return root2.rawCache[detect];if(detect===`before`||detect===`after`)return this.beforeAfter(node2,detect);{let method=`raw`+capitalize(detect);this[method]?value=this[method](root2,node2):root2.walk(i2=>{if(value=i2.raws[own],value!==void 0)return!1})}return value===void 0&&(value=DEFAULT_RAW[detect]),root2.rawCache[detect]=value,value}rawBeforeClose(root2){let value;return root2.walk(i2=>{if(i2.nodes&&i2.nodes.length>0&&i2.raws.after!==void 0)return value=i2.raws.after,value.includes(`
|
|
14
|
+
`)&&(value=value.replace(/[^\n]+$/,``)),!1}),value&&=value.replace(/\S/g,``),value}rawBeforeComment(root2,node2){let value;return root2.walkComments(i2=>{if(i2.raws.before!==void 0)return value=i2.raws.before,value.includes(`
|
|
15
|
+
`)&&(value=value.replace(/[^\n]+$/,``)),!1}),value===void 0?value=this.raw(node2,null,`beforeDecl`):value&&=value.replace(/\S/g,``),value}rawBeforeDecl(root2,node2){let value;return root2.walkDecls(i2=>{if(i2.raws.before!==void 0)return value=i2.raws.before,value.includes(`
|
|
16
|
+
`)&&(value=value.replace(/[^\n]+$/,``)),!1}),value===void 0?value=this.raw(node2,null,`beforeRule`):value&&=value.replace(/\S/g,``),value}rawBeforeOpen(root2){let value;return root2.walk(i2=>{if(i2.type!==`decl`&&(value=i2.raws.between,value!==void 0))return!1}),value}rawBeforeRule(root2){let value;return root2.walk(i2=>{if(i2.nodes&&(i2.parent!==root2||root2.first!==i2)&&i2.raws.before!==void 0)return value=i2.raws.before,value.includes(`
|
|
17
|
+
`)&&(value=value.replace(/[^\n]+$/,``)),!1}),value&&=value.replace(/\S/g,``),value}rawColon(root2){let value;return root2.walkDecls(i2=>{if(i2.raws.between!==void 0)return value=i2.raws.between.replace(/[^\s:]/g,``),!1}),value}rawEmptyBody(root2){let value;return root2.walk(i2=>{if(i2.nodes&&i2.nodes.length===0&&(value=i2.raws.after,value!==void 0))return!1}),value}rawIndent(root2){if(root2.raws.indent)return root2.raws.indent;let value;return root2.walk(i2=>{let p=i2.parent;if(p&&p!==root2&&p.parent&&p.parent===root2&&i2.raws.before!==void 0){let parts=i2.raws.before.split(`
|
|
18
|
+
`);return value=parts[parts.length-1],value=value.replace(/\S/g,``),!1}}),value}rawSemicolon(root2){let value;return root2.walk(i2=>{if(i2.nodes&&i2.nodes.length&&i2.last.type===`decl`&&(value=i2.raws.semicolon,value!==void 0))return!1}),value}rawValue(node2,prop){let value=node2[prop],raw=node2.raws[prop];return raw&&raw.value===value?raw.raw:value}root(node2){this.body(node2),node2.raws.after&&this.builder(node2.raws.after)}rule(node2){this.block(node2,this.rawValue(node2,`selector`)),node2.raws.ownSemicolon&&this.builder(node2.raws.ownSemicolon,node2,`end`)}stringify(node2,semicolon){if(!this[node2.type])throw Error(`Unknown AST node type `+node2.type+`. Maybe you need to change PostCSS stringifier.`);this[node2.type](node2,semicolon)}}return stringifier$1=Stringifier,Stringifier.default=Stringifier,stringifier$1}var stringify_1$1,hasRequiredStringify$1;function requireStringify$1(){if(hasRequiredStringify$1)return stringify_1$1;hasRequiredStringify$1=1;let Stringifier=requireStringifier$1();function stringify(node2,builder){new Stringifier(builder).stringify(node2)}return stringify_1$1=stringify,stringify.default=stringify,stringify_1$1}var node$1,hasRequiredNode$1;function requireNode$1(){if(hasRequiredNode$1)return node$1;hasRequiredNode$1=1;let{isClean,my}=requireSymbols$1(),CssSyntaxError=requireCssSyntaxError$1(),Stringifier=requireStringifier$1(),stringify=requireStringify$1();function cloneNode(obj,parent){let cloned=new obj.constructor;for(let i2 in obj){if(!Object.prototype.hasOwnProperty.call(obj,i2)||i2===`proxyCache`)continue;let value=obj[i2],type=typeof value;i2===`parent`&&type===`object`?parent&&(cloned[i2]=parent):i2===`source`?cloned[i2]=value:Array.isArray(value)?cloned[i2]=value.map(j=>cloneNode(j,cloned)):(type===`object`&&value!==null&&(value=cloneNode(value)),cloned[i2]=value)}return cloned}class Node2{constructor(defaults={}){this.raws={},this[isClean]=!1,this[my]=!0;for(let name in defaults)if(name===`nodes`){this.nodes=[];for(let node2 of defaults[name])typeof node2.clone==`function`?this.append(node2.clone()):this.append(node2)}else this[name]=defaults[name]}addToError(error){if(error.postcssNode=this,error.stack&&this.source&&/\n\s{4}at /.test(error.stack)){let s2=this.source;error.stack=error.stack.replace(/\n\s{4}at /,`$&${s2.input.from}:${s2.start.line}:${s2.start.column}$&`)}return error}after(add){return this.parent.insertAfter(this,add),this}assign(overrides={}){for(let name in overrides)this[name]=overrides[name];return this}before(add){return this.parent.insertBefore(this,add),this}cleanRaws(keepBetween){delete this.raws.before,delete this.raws.after,keepBetween||delete this.raws.between}clone(overrides={}){let cloned=cloneNode(this);for(let name in overrides)cloned[name]=overrides[name];return cloned}cloneAfter(overrides={}){let cloned=this.clone(overrides);return this.parent.insertAfter(this,cloned),cloned}cloneBefore(overrides={}){let cloned=this.clone(overrides);return this.parent.insertBefore(this,cloned),cloned}error(message,opts={}){if(this.source){let{end,start}=this.rangeBy(opts);return this.source.input.error(message,{column:start.column,line:start.line},{column:end.column,line:end.line},opts)}return new CssSyntaxError(message)}getProxyProcessor(){return{get(node2,prop){return prop===`proxyOf`?node2:prop===`root`?()=>node2.root().toProxy():node2[prop]},set(node2,prop,value){return node2[prop]===value||(node2[prop]=value,(prop===`prop`||prop===`value`||prop===`name`||prop===`params`||prop===`important`||prop===`text`)&&node2.markDirty(),!0)}}}markDirty(){if(this[isClean]){this[isClean]=!1;let next=this;for(;next=next.parent;)next[isClean]=!1}}next(){if(!this.parent)return;let index2=this.parent.index(this);return this.parent.nodes[index2+1]}positionBy(opts,stringRepresentation){let pos=this.source.start;if(opts.index)pos=this.positionInside(opts.index,stringRepresentation);else if(opts.word){stringRepresentation=this.toString();let index2=stringRepresentation.indexOf(opts.word);index2!==-1&&(pos=this.positionInside(index2,stringRepresentation))}return pos}positionInside(index2,stringRepresentation){let string=stringRepresentation||this.toString(),column=this.source.start.column,line=this.source.start.line;for(let i2=0;i2<index2;i2++)string[i2]===`
|
|
19
|
+
`?(column=1,line+=1):column+=1;return{column,line}}prev(){if(!this.parent)return;let index2=this.parent.index(this);return this.parent.nodes[index2-1]}rangeBy(opts){let start={column:this.source.start.column,line:this.source.start.line},end=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:start.column+1,line:start.line};if(opts.word){let stringRepresentation=this.toString(),index2=stringRepresentation.indexOf(opts.word);index2!==-1&&(start=this.positionInside(index2,stringRepresentation),end=this.positionInside(index2+opts.word.length,stringRepresentation))}else opts.start?start={column:opts.start.column,line:opts.start.line}:opts.index&&(start=this.positionInside(opts.index)),opts.end?end={column:opts.end.column,line:opts.end.line}:typeof opts.endIndex==`number`?end=this.positionInside(opts.endIndex):opts.index&&(end=this.positionInside(opts.index+1));return(end.line<start.line||end.line===start.line&&end.column<=start.column)&&(end={column:start.column+1,line:start.line}),{end,start}}raw(prop,defaultType){return new Stringifier().raw(this,prop,defaultType)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...nodes){if(this.parent){let bookmark=this,foundSelf=!1;for(let node2 of nodes)node2===this?foundSelf=!0:foundSelf?(this.parent.insertAfter(bookmark,node2),bookmark=node2):this.parent.insertBefore(bookmark,node2);foundSelf||this.remove()}return this}root(){let result2=this;for(;result2.parent&&result2.parent.type!==`document`;)result2=result2.parent;return result2}toJSON(_,inputs){let fixed={},emitInputs=inputs==null;inputs||=new Map;let inputsNextIndex=0;for(let name in this){if(!Object.prototype.hasOwnProperty.call(this,name)||name===`parent`||name===`proxyCache`)continue;let value=this[name];if(Array.isArray(value))fixed[name]=value.map(i2=>typeof i2==`object`&&i2.toJSON?i2.toJSON(null,inputs):i2);else if(typeof value==`object`&&value.toJSON)fixed[name]=value.toJSON(null,inputs);else if(name===`source`){let inputId=inputs.get(value.input);inputId??(inputId=inputsNextIndex,inputs.set(value.input,inputsNextIndex),inputsNextIndex++),fixed[name]={end:value.end,inputId,start:value.start}}else fixed[name]=value}return emitInputs&&(fixed.inputs=[...inputs.keys()].map(input2=>input2.toJSON())),fixed}toProxy(){return this.proxyCache||=new Proxy(this,this.getProxyProcessor()),this.proxyCache}toString(stringifier2=stringify){stringifier2.stringify&&(stringifier2=stringifier2.stringify);let result2=``;return stringifier2(this,i2=>{result2+=i2}),result2}warn(result2,text,opts){let data={node:this};for(let i2 in opts)data[i2]=opts[i2];return result2.warn(text,data)}get proxyOf(){return this}}return node$1=Node2,Node2.default=Node2,node$1}var declaration$1,hasRequiredDeclaration$1;function requireDeclaration$1(){if(hasRequiredDeclaration$1)return declaration$1;hasRequiredDeclaration$1=1;let Node2=requireNode$1();class Declaration extends Node2{constructor(defaults){defaults&&defaults.value!==void 0&&typeof defaults.value!=`string`&&(defaults={...defaults,value:String(defaults.value)}),super(defaults),this.type=`decl`}get variable(){return this.prop.startsWith(`--`)||this.prop[0]===`$`}}return declaration$1=Declaration,Declaration.default=Declaration,declaration$1}var nonSecure$1,hasRequiredNonSecure$1;function requireNonSecure$1(){return hasRequiredNonSecure$1?nonSecure$1:(hasRequiredNonSecure$1=1,nonSecure$1={nanoid:(size=21)=>{let id=``,i2=size;for(;i2--;)id+=`useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict`[Math.random()*64|0];return id},customAlphabet:(alphabet,defaultSize=21)=>(size=defaultSize)=>{let id=``,i2=size;for(;i2--;)id+=alphabet[Math.random()*alphabet.length|0];return id}},nonSecure$1)}var previousMap$1,hasRequiredPreviousMap$1;function requirePreviousMap$1(){if(hasRequiredPreviousMap$1)return previousMap$1;hasRequiredPreviousMap$1=1;let{SourceMapConsumer,SourceMapGenerator}=require$$2$1,{existsSync,readFileSync}=require$$2$1,{dirname,join}=require$$2$1;function fromBase64(str){return Buffer?Buffer.from(str,`base64`).toString():window.atob(str)}class PreviousMap{constructor(css,opts){if(opts.map===!1)return;this.loadAnnotation(css),this.inline=this.startWith(this.annotation,`data:`);let prev=opts.map?opts.map.prev:void 0,text=this.loadMap(opts.from,prev);!this.mapFile&&opts.from&&(this.mapFile=opts.from),this.mapFile&&(this.root=dirname(this.mapFile)),text&&(this.text=text)}consumer(){return this.consumerCache||=new SourceMapConsumer(this.text),this.consumerCache}decodeInline(text){let baseCharsetUri=/^data:application\/json;charset=utf-?8;base64,/,baseUri=/^data:application\/json;base64,/;if(/^data:application\/json;charset=utf-?8,/.test(text)||/^data:application\/json,/.test(text))return decodeURIComponent(text.substr(RegExp.lastMatch.length));if(baseCharsetUri.test(text)||baseUri.test(text))return fromBase64(text.substr(RegExp.lastMatch.length));let encoding=text.match(/data:application\/json;([^,]+),/)[1];throw Error(`Unsupported source map encoding `+encoding)}getAnnotationURL(sourceMapString){return sourceMapString.replace(/^\/\*\s*# sourceMappingURL=/,``).trim()}isMap(map){return typeof map==`object`?typeof map.mappings==`string`||typeof map._mappings==`string`||Array.isArray(map.sections):!1}loadAnnotation(css){let comments=css.match(/\/\*\s*# sourceMappingURL=/gm);if(!comments)return;let start=css.lastIndexOf(comments.pop()),end=css.indexOf(`*/`,start);start>-1&&end>-1&&(this.annotation=this.getAnnotationURL(css.substring(start,end)))}loadFile(path){if(this.root=dirname(path),existsSync(path))return this.mapFile=path,readFileSync(path,`utf-8`).toString().trim()}loadMap(file,prev){if(prev===!1)return!1;if(prev){if(typeof prev==`string`)return prev;if(typeof prev==`function`){let prevPath=prev(file);if(prevPath){let map=this.loadFile(prevPath);if(!map)throw Error(`Unable to load previous source map: `+prevPath.toString());return map}}else if(prev instanceof SourceMapConsumer)return SourceMapGenerator.fromSourceMap(prev).toString();else if(prev instanceof SourceMapGenerator)return prev.toString();else if(this.isMap(prev))return JSON.stringify(prev);else throw Error(`Unsupported previous source map format: `+prev.toString())}else if(this.inline)return this.decodeInline(this.annotation);else if(this.annotation){let map=this.annotation;return file&&(map=join(dirname(file),map)),this.loadFile(map)}}startWith(string,start){return string?string.substr(0,start.length)===start:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}}return previousMap$1=PreviousMap,PreviousMap.default=PreviousMap,previousMap$1}var input$1,hasRequiredInput$1;function requireInput$1(){if(hasRequiredInput$1)return input$1;hasRequiredInput$1=1;let{SourceMapConsumer,SourceMapGenerator}=require$$2$1,{fileURLToPath,pathToFileURL}=require$$2$1,{isAbsolute,resolve}=require$$2$1,{nanoid}=requireNonSecure$1(),terminalHighlight=require$$2$1,CssSyntaxError=requireCssSyntaxError$1(),PreviousMap=requirePreviousMap$1(),fromOffsetCache=Symbol(`fromOffsetCache`),sourceMapAvailable=!!(SourceMapConsumer&&SourceMapGenerator),pathAvailable=!!(resolve&&isAbsolute);class Input{constructor(css,opts={}){if(css==null||typeof css==`object`&&!css.toString)throw Error(`PostCSS received ${css} instead of CSS string`);if(this.css=css.toString(),this.css[0]===``||this.css[0]===``?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,opts.from&&(this.file=!pathAvailable||/^\w+:\/\//.test(opts.from)||isAbsolute(opts.from)?opts.from:resolve(opts.from)),pathAvailable&&sourceMapAvailable){let map=new PreviousMap(this.css,opts);if(map.text){this.map=map;let file=map.consumer().file;!this.file&&file&&(this.file=this.mapResolve(file))}}this.file||(this.id=`<input css `+nanoid(6)+`>`),this.map&&(this.map.file=this.from)}error(message,line,column,opts={}){let result2,endLine,endColumn;if(line&&typeof line==`object`){let start=line,end=column;if(typeof start.offset==`number`){let pos=this.fromOffset(start.offset);line=pos.line,column=pos.col}else line=start.line,column=start.column;if(typeof end.offset==`number`){let pos=this.fromOffset(end.offset);endLine=pos.line,endColumn=pos.col}else endLine=end.line,endColumn=end.column}else if(!column){let pos=this.fromOffset(line);line=pos.line,column=pos.col}let origin=this.origin(line,column,endLine,endColumn);return result2=origin?new CssSyntaxError(message,origin.endLine===void 0?origin.line:{column:origin.column,line:origin.line},origin.endLine===void 0?origin.column:{column:origin.endColumn,line:origin.endLine},origin.source,origin.file,opts.plugin):new CssSyntaxError(message,endLine===void 0?line:{column,line},endLine===void 0?column:{column:endColumn,line:endLine},this.css,this.file,opts.plugin),result2.input={column,endColumn,endLine,line,source:this.css},this.file&&(pathToFileURL&&(result2.input.url=pathToFileURL(this.file).toString()),result2.input.file=this.file),result2}fromOffset(offset){let lastLine,lineToIndex;if(this[fromOffsetCache])lineToIndex=this[fromOffsetCache];else{let lines=this.css.split(`
|
|
20
|
+
`);lineToIndex=Array(lines.length);let prevIndex=0;for(let i2=0,l2=lines.length;i2<l2;i2++)lineToIndex[i2]=prevIndex,prevIndex+=lines[i2].length+1;this[fromOffsetCache]=lineToIndex}lastLine=lineToIndex[lineToIndex.length-1];let min=0;if(offset>=lastLine)min=lineToIndex.length-1;else{let max=lineToIndex.length-2,mid;for(;min<max;)if(mid=min+(max-min>>1),offset<lineToIndex[mid])max=mid-1;else if(offset>=lineToIndex[mid+1])min=mid+1;else{min=mid;break}}return{col:offset-lineToIndex[min]+1,line:min+1}}mapResolve(file){return/^\w+:\/\//.test(file)?file:resolve(this.map.consumer().sourceRoot||this.map.root||`.`,file)}origin(line,column,endLine,endColumn){if(!this.map)return!1;let consumer=this.map.consumer(),from=consumer.originalPositionFor({column,line});if(!from.source)return!1;let to;typeof endLine==`number`&&(to=consumer.originalPositionFor({column:endColumn,line:endLine}));let fromUrl;fromUrl=isAbsolute(from.source)?pathToFileURL(from.source):new URL(from.source,this.map.consumer().sourceRoot||pathToFileURL(this.map.mapFile));let result2={column:from.column,endColumn:to&&to.column,endLine:to&&to.line,line:from.line,url:fromUrl.toString()};if(fromUrl.protocol===`file:`){if(fileURLToPath)result2.file=fileURLToPath(fromUrl);else throw Error(`file: protocol is not available in this PostCSS build`)}let source=consumer.sourceContentFor(from.source);return source&&(result2.source=source),result2}toJSON(){let json={};for(let name of[`hasBOM`,`css`,`file`,`id`])this[name]!=null&&(json[name]=this[name]);return this.map&&(json.map={...this.map},json.map.consumerCache&&(json.map.consumerCache=void 0)),json}get from(){return this.file||this.id}}return input$1=Input,Input.default=Input,terminalHighlight&&terminalHighlight.registerInput&&terminalHighlight.registerInput(Input),input$1}var mapGenerator$1,hasRequiredMapGenerator$1;function requireMapGenerator$1(){if(hasRequiredMapGenerator$1)return mapGenerator$1;hasRequiredMapGenerator$1=1;let{SourceMapConsumer,SourceMapGenerator}=require$$2$1,{dirname,relative,resolve,sep}=require$$2$1,{pathToFileURL}=require$$2$1,Input=requireInput$1(),sourceMapAvailable=!!(SourceMapConsumer&&SourceMapGenerator),pathAvailable=!!(dirname&&resolve&&relative&&sep);class MapGenerator{constructor(stringify,root2,opts,cssString){this.stringify=stringify,this.mapOpts=opts.map||{},this.root=root2,this.opts=opts,this.css=cssString,this.originalCSS=cssString,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let content;content=this.isInline()?`data:application/json;base64,`+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation==`string`?this.mapOpts.annotation:typeof this.mapOpts.annotation==`function`?this.mapOpts.annotation(this.opts.to,this.root):this.outputFile()+`.map`;let eol=`
|
|
21
|
+
`;this.css.includes(`\r
|
|
22
|
+
`)&&(eol=`\r
|
|
23
|
+
`),this.css+=eol+`/*# sourceMappingURL=`+content+` */`}applyPrevMaps(){for(let prev of this.previous()){let from=this.toUrl(this.path(prev.file)),root2=prev.root||dirname(prev.file),map;this.mapOpts.sourcesContent===!1?(map=new SourceMapConsumer(prev.text),map.sourcesContent&&(map.sourcesContent=null)):map=prev.consumer(),this.map.applySourceMap(map,from,this.toUrl(this.path(root2)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1){if(this.root){let node2;for(let i2=this.root.nodes.length-1;i2>=0;i2--)node2=this.root.nodes[i2],node2.type===`comment`&&node2.text.indexOf(`# sourceMappingURL=`)===0&&this.root.removeChild(i2)}else this.css&&=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,``)}}generate(){if(this.clearAnnotation(),pathAvailable&&sourceMapAvailable&&this.isMap())return this.generateMap();{let result2=``;return this.stringify(this.root,i2=>{result2+=i2}),[result2]}}generateMap(){if(this.root)this.generateString();else if(this.previous().length===1){let prev=this.previous()[0].consumer();prev.file=this.outputFile(),this.map=SourceMapGenerator.fromSourceMap(prev,{ignoreInvalidMapping:!0})}else this.map=new SourceMapGenerator({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 SourceMapGenerator({file:this.outputFile(),ignoreInvalidMapping:!0});let line=1,column=1,noSource=`<no source>`,mapping={generated:{column:0,line:0},original:{column:0,line:0},source:``},lines,last;this.stringify(this.root,(str,node2,type)=>{if(this.css+=str,node2&&type!==`end`&&(mapping.generated.line=line,mapping.generated.column=column-1,node2.source&&node2.source.start?(mapping.source=this.sourcePath(node2),mapping.original.line=node2.source.start.line,mapping.original.column=node2.source.start.column-1,this.map.addMapping(mapping)):(mapping.source=noSource,mapping.original.line=1,mapping.original.column=0,this.map.addMapping(mapping))),lines=str.match(/\n/g),lines?(line+=lines.length,last=str.lastIndexOf(`
|
|
24
|
+
`),column=str.length-last):column+=str.length,node2&&type!==`start`){let p=node2.parent||{raws:{}};(!(node2.type===`decl`||node2.type===`atrule`&&!node2.nodes)||node2!==p.last||p.raws.semicolon)&&(node2.source&&node2.source.end?(mapping.source=this.sourcePath(node2),mapping.original.line=node2.source.end.line,mapping.original.column=node2.source.end.column-1,mapping.generated.line=line,mapping.generated.column=column-2,this.map.addMapping(mapping)):(mapping.source=noSource,mapping.original.line=1,mapping.original.column=0,mapping.generated.line=line,mapping.generated.column=column-1,this.map.addMapping(mapping)))}})}isAnnotation(){return this.isInline()?!0:this.mapOpts.annotation===void 0?!this.previous().length||this.previous().some(i2=>i2.annotation):this.mapOpts.annotation}isInline(){if(this.mapOpts.inline!==void 0)return this.mapOpts.inline;let annotation=this.mapOpts.annotation;return annotation!==void 0&&annotation!==!0?!1:!this.previous().length||this.previous().some(i2=>i2.inline)}isMap(){return this.opts.map===void 0?this.previous().length>0:!!this.opts.map}isSourcesContent(){return this.mapOpts.sourcesContent===void 0?!this.previous().length||this.previous().some(i2=>i2.withContent()):this.mapOpts.sourcesContent}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):`to.css`}path(file){if(this.mapOpts.absolute||file.charCodeAt(0)===60||/^\w+:\/\//.test(file))return file;let cached=this.memoizedPaths.get(file);if(cached)return cached;let from=this.opts.to?dirname(this.opts.to):`.`;typeof this.mapOpts.annotation==`string`&&(from=dirname(resolve(from,this.mapOpts.annotation)));let path=relative(from,file);return this.memoizedPaths.set(file,path),path}previous(){if(!this.previousMaps){if(this.previousMaps=[],this.root)this.root.walk(node2=>{if(node2.source&&node2.source.input.map){let map=node2.source.input.map;this.previousMaps.includes(map)||this.previousMaps.push(map)}});else{let input2=new Input(this.originalCSS,this.opts);input2.map&&this.previousMaps.push(input2.map)}}return this.previousMaps}setSourcesContent(){let already={};if(this.root)this.root.walk(node2=>{if(node2.source){let from=node2.source.input.from;if(from&&!already[from]){already[from]=!0;let fromUrl=this.usesFileUrls?this.toFileUrl(from):this.toUrl(this.path(from));this.map.setSourceContent(fromUrl,node2.source.input.css)}}});else if(this.css){let from=this.opts.from?this.toUrl(this.path(this.opts.from)):`<no source>`;this.map.setSourceContent(from,this.css)}}sourcePath(node2){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(node2.source.input.from):this.toUrl(this.path(node2.source.input.from))}toBase64(str){return Buffer?Buffer.from(str).toString(`base64`):window.btoa(unescape(encodeURIComponent(str)))}toFileUrl(path){let cached=this.memoizedFileURLs.get(path);if(cached)return cached;if(pathToFileURL){let fileURL=pathToFileURL(path).toString();return this.memoizedFileURLs.set(path,fileURL),fileURL}throw Error("`map.absolute` option is not available in this PostCSS build")}toUrl(path){let cached=this.memoizedURLs.get(path);if(cached)return cached;sep===`\\`&&(path=path.replace(/\\/g,`/`));let url=encodeURI(path).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(path,url),url}}return mapGenerator$1=MapGenerator,mapGenerator$1}var comment$1,hasRequiredComment$1;function requireComment$1(){if(hasRequiredComment$1)return comment$1;hasRequiredComment$1=1;let Node2=requireNode$1();class Comment extends Node2{constructor(defaults){super(defaults),this.type=`comment`}}return comment$1=Comment,Comment.default=Comment,comment$1}var container$1,hasRequiredContainer$1;function requireContainer$1(){if(hasRequiredContainer$1)return container$1;hasRequiredContainer$1=1;let{isClean,my}=requireSymbols$1(),Declaration=requireDeclaration$1(),Comment=requireComment$1(),Node2=requireNode$1(),parse,Rule,AtRule,Root;function cleanSource(nodes){return nodes.map(i2=>(i2.nodes&&=cleanSource(i2.nodes),delete i2.source,i2))}function markDirtyUp(node2){if(node2[isClean]=!1,node2.proxyOf.nodes)for(let i2 of node2.proxyOf.nodes)markDirtyUp(i2)}class Container extends Node2{append(...children){for(let child of children){let nodes=this.normalize(child,this.last);for(let node2 of nodes)this.proxyOf.nodes.push(node2)}return this.markDirty(),this}cleanRaws(keepBetween){if(super.cleanRaws(keepBetween),this.nodes)for(let node2 of this.nodes)node2.cleanRaws(keepBetween)}each(callback){if(!this.proxyOf.nodes)return;let iterator=this.getIterator(),index2,result2;for(;this.indexes[iterator]<this.proxyOf.nodes.length&&(index2=this.indexes[iterator],result2=callback(this.proxyOf.nodes[index2],index2),result2!==!1);)this.indexes[iterator]+=1;return delete this.indexes[iterator],result2}every(condition){return this.nodes.every(condition)}getIterator(){this.lastEach||=0,this.indexes||={},this.lastEach+=1;let iterator=this.lastEach;return this.indexes[iterator]=0,iterator}getProxyProcessor(){return{get(node2,prop){return prop===`proxyOf`?node2:node2[prop]?prop===`each`||typeof prop==`string`&&prop.startsWith(`walk`)?(...args)=>node2[prop](...args.map(i2=>typeof i2==`function`?(child,index2)=>i2(child.toProxy(),index2):i2)):prop===`every`||prop===`some`?cb=>node2[prop]((child,...other)=>cb(child.toProxy(),...other)):prop===`root`?()=>node2.root().toProxy():prop===`nodes`?node2.nodes.map(i2=>i2.toProxy()):prop===`first`||prop===`last`?node2[prop].toProxy():node2[prop]:node2[prop]},set(node2,prop,value){return node2[prop]===value||(node2[prop]=value,(prop===`name`||prop===`params`||prop===`selector`)&&node2.markDirty(),!0)}}}index(child){return typeof child==`number`?child:(child.proxyOf&&(child=child.proxyOf),this.proxyOf.nodes.indexOf(child))}insertAfter(exist,add){let existIndex=this.index(exist),nodes=this.normalize(add,this.proxyOf.nodes[existIndex]).reverse();existIndex=this.index(exist);for(let node2 of nodes)this.proxyOf.nodes.splice(existIndex+1,0,node2);let index2;for(let id in this.indexes)index2=this.indexes[id],existIndex<index2&&(this.indexes[id]=index2+nodes.length);return this.markDirty(),this}insertBefore(exist,add){let existIndex=this.index(exist),type=existIndex===0&&`prepend`,nodes=this.normalize(add,this.proxyOf.nodes[existIndex],type).reverse();existIndex=this.index(exist);for(let node2 of nodes)this.proxyOf.nodes.splice(existIndex,0,node2);let index2;for(let id in this.indexes)index2=this.indexes[id],existIndex<=index2&&(this.indexes[id]=index2+nodes.length);return this.markDirty(),this}normalize(nodes,sample){if(typeof nodes==`string`)nodes=cleanSource(parse(nodes).nodes);else if(nodes===void 0)nodes=[];else if(Array.isArray(nodes)){nodes=nodes.slice(0);for(let i2 of nodes)i2.parent&&i2.parent.removeChild(i2,`ignore`)}else if(nodes.type===`root`&&this.type!==`document`){nodes=nodes.nodes.slice(0);for(let i2 of nodes)i2.parent&&i2.parent.removeChild(i2,`ignore`)}else if(nodes.type)nodes=[nodes];else if(nodes.prop){if(nodes.value===void 0)throw Error(`Value field is missed in node creation`);typeof nodes.value!=`string`&&(nodes.value=String(nodes.value)),nodes=[new Declaration(nodes)]}else if(nodes.selector)nodes=[new Rule(nodes)];else if(nodes.name)nodes=[new AtRule(nodes)];else if(nodes.text)nodes=[new Comment(nodes)];else throw Error(`Unknown node type in node creation`);return nodes.map(i2=>(i2[my]||Container.rebuild(i2),i2=i2.proxyOf,i2.parent&&i2.parent.removeChild(i2),i2[isClean]&&markDirtyUp(i2),i2.raws.before===void 0&&sample&&sample.raws.before!==void 0&&(i2.raws.before=sample.raws.before.replace(/\S/g,``)),i2.parent=this.proxyOf,i2))}prepend(...children){children=children.reverse();for(let child of children){let nodes=this.normalize(child,this.first,`prepend`).reverse();for(let node2 of nodes)this.proxyOf.nodes.unshift(node2);for(let id in this.indexes)this.indexes[id]=this.indexes[id]+nodes.length}return this.markDirty(),this}push(child){return child.parent=this,this.proxyOf.nodes.push(child),this}removeAll(){for(let node2 of this.proxyOf.nodes)node2.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(child){child=this.index(child),this.proxyOf.nodes[child].parent=void 0,this.proxyOf.nodes.splice(child,1);let index2;for(let id in this.indexes)index2=this.indexes[id],index2>=child&&(this.indexes[id]=index2-1);return this.markDirty(),this}replaceValues(pattern,opts,callback){return callback||(callback=opts,opts={}),this.walkDecls(decl=>{(!opts.props||opts.props.includes(decl.prop))&&(!opts.fast||decl.value.includes(opts.fast))&&(decl.value=decl.value.replace(pattern,callback))}),this.markDirty(),this}some(condition){return this.nodes.some(condition)}walk(callback){return this.each((child,i2)=>{let result2;try{result2=callback(child,i2)}catch(e2){throw child.addToError(e2)}return result2!==!1&&child.walk&&(result2=child.walk(callback)),result2})}walkAtRules(name,callback){return callback?name instanceof RegExp?this.walk((child,i2)=>{if(child.type===`atrule`&&name.test(child.name))return callback(child,i2)}):this.walk((child,i2)=>{if(child.type===`atrule`&&child.name===name)return callback(child,i2)}):(callback=name,this.walk((child,i2)=>{if(child.type===`atrule`)return callback(child,i2)}))}walkComments(callback){return this.walk((child,i2)=>{if(child.type===`comment`)return callback(child,i2)})}walkDecls(prop,callback){return callback?prop instanceof RegExp?this.walk((child,i2)=>{if(child.type===`decl`&&prop.test(child.prop))return callback(child,i2)}):this.walk((child,i2)=>{if(child.type===`decl`&&child.prop===prop)return callback(child,i2)}):(callback=prop,this.walk((child,i2)=>{if(child.type===`decl`)return callback(child,i2)}))}walkRules(selector,callback){return callback?selector instanceof RegExp?this.walk((child,i2)=>{if(child.type===`rule`&&selector.test(child.selector))return callback(child,i2)}):this.walk((child,i2)=>{if(child.type===`rule`&&child.selector===selector)return callback(child,i2)}):(callback=selector,this.walk((child,i2)=>{if(child.type===`rule`)return callback(child,i2)}))}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]}}return Container.registerParse=dependant=>{parse=dependant},Container.registerRule=dependant=>{Rule=dependant},Container.registerAtRule=dependant=>{AtRule=dependant},Container.registerRoot=dependant=>{Root=dependant},container$1=Container,Container.default=Container,Container.rebuild=node2=>{node2.type===`atrule`?Object.setPrototypeOf(node2,AtRule.prototype):node2.type===`rule`?Object.setPrototypeOf(node2,Rule.prototype):node2.type===`decl`?Object.setPrototypeOf(node2,Declaration.prototype):node2.type===`comment`?Object.setPrototypeOf(node2,Comment.prototype):node2.type===`root`&&Object.setPrototypeOf(node2,Root.prototype),node2[my]=!0,node2.nodes&&node2.nodes.forEach(child=>{Container.rebuild(child)})},container$1}var document$1$1,hasRequiredDocument$1;function requireDocument$1(){if(hasRequiredDocument$1)return document$1$1;hasRequiredDocument$1=1;let Container=requireContainer$1(),LazyResult,Processor;class Document2 extends Container{constructor(defaults){super({type:`document`,...defaults}),this.nodes||=[]}toResult(opts={}){return new LazyResult(new Processor,this,opts).stringify()}}return Document2.registerLazyResult=dependant=>{LazyResult=dependant},Document2.registerProcessor=dependant=>{Processor=dependant},document$1$1=Document2,Document2.default=Document2,document$1$1}var warnOnce$1,hasRequiredWarnOnce$1;function requireWarnOnce$1(){if(hasRequiredWarnOnce$1)return warnOnce$1;hasRequiredWarnOnce$1=1;let printed={};return warnOnce$1=function(message){printed[message]||(printed[message]=!0,typeof console<`u`&&console.warn&&console.warn(message))},warnOnce$1}var warning$1,hasRequiredWarning$1;function requireWarning$1(){if(hasRequiredWarning$1)return warning$1;hasRequiredWarning$1=1;class Warning{constructor(text,opts={}){if(this.type=`warning`,this.text=text,opts.node&&opts.node.source){let range=opts.node.rangeBy(opts);this.line=range.start.line,this.column=range.start.column,this.endLine=range.end.line,this.endColumn=range.end.column}for(let opt in opts)this[opt]=opts[opt]}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}}return warning$1=Warning,Warning.default=Warning,warning$1}var result$1,hasRequiredResult$1;function requireResult$1(){if(hasRequiredResult$1)return result$1;hasRequiredResult$1=1;let Warning=requireWarning$1();class Result{constructor(processor2,root2,opts){this.processor=processor2,this.messages=[],this.root=root2,this.opts=opts,this.css=void 0,this.map=void 0}toString(){return this.css}warn(text,opts={}){opts.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(opts.plugin=this.lastPlugin.postcssPlugin);let warning2=new Warning(text,opts);return this.messages.push(warning2),warning2}warnings(){return this.messages.filter(i2=>i2.type===`warning`)}get content(){return this.css}}return result$1=Result,Result.default=Result,result$1}var tokenize$1,hasRequiredTokenize$1;function requireTokenize$1(){if(hasRequiredTokenize$1)return tokenize$1;hasRequiredTokenize$1=1;let RE_AT_END=/[\t\n\f\r "#'()/;[\\\]{}]/g,RE_WORD_END=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,RE_BAD_BRACKET=/.[\r\n"'(/\\]/,RE_HEX_ESCAPE=/[\da-f]/i;return tokenize$1=function(input2,options={}){let css=input2.css.valueOf(),ignore=options.ignoreErrors,code,next,quote,content,escape,escaped,escapePos,prev,n2,currentToken,length=css.length,pos=0,buffer=[],returned=[];function position(){return pos}function unclosed(what){throw input2.error(`Unclosed `+what,pos)}function endOfFile(){return returned.length===0&&pos>=length}function nextToken(opts){if(returned.length)return returned.pop();if(pos>=length)return;let ignoreUnclosed=opts?opts.ignoreUnclosed:!1;switch(code=css.charCodeAt(pos),code){case 10:case 32:case 9:case 13:case 12:next=pos;do next+=1,code=css.charCodeAt(next);while(code===32||code===10||code===9||code===13||code===12);currentToken=[`space`,css.slice(pos,next)],pos=next-1;break;case 91:case 93:case 123:case 125:case 58:case 59:case 41:{let controlChar=String.fromCharCode(code);currentToken=[controlChar,controlChar,pos];break}case 40:if(prev=buffer.length?buffer.pop()[1]:``,n2=css.charCodeAt(pos+1),prev===`url`&&n2!==39&&n2!==34&&n2!==32&&n2!==10&&n2!==9&&n2!==12&&n2!==13){next=pos;do{if(escaped=!1,next=css.indexOf(`)`,next+1),next===-1){if(ignore||ignoreUnclosed){next=pos;break}unclosed(`bracket`)}for(escapePos=next;css.charCodeAt(escapePos-1)===92;)--escapePos,escaped=!escaped}while(escaped);currentToken=[`brackets`,css.slice(pos,next+1),pos,next],pos=next}else next=css.indexOf(`)`,pos+1),content=css.slice(pos,next+1),next===-1||RE_BAD_BRACKET.test(content)?currentToken=[`(`,`(`,pos]:(currentToken=[`brackets`,content,pos,next],pos=next);break;case 39:case 34:quote=code===39?`'`:`"`,next=pos;do{if(escaped=!1,next=css.indexOf(quote,next+1),next===-1){if(ignore||ignoreUnclosed){next=pos+1;break}unclosed(`string`)}for(escapePos=next;css.charCodeAt(escapePos-1)===92;)--escapePos,escaped=!escaped}while(escaped);currentToken=[`string`,css.slice(pos,next+1),pos,next],pos=next;break;case 64:RE_AT_END.lastIndex=pos+1,RE_AT_END.test(css),next=RE_AT_END.lastIndex===0?css.length-1:RE_AT_END.lastIndex-2,currentToken=[`at-word`,css.slice(pos,next+1),pos,next],pos=next;break;case 92:for(next=pos,escape=!0;css.charCodeAt(next+1)===92;)next+=1,escape=!escape;if(code=css.charCodeAt(next+1),escape&&code!==47&&code!==32&&code!==10&&code!==9&&code!==13&&code!==12&&(next+=1,RE_HEX_ESCAPE.test(css.charAt(next)))){for(;RE_HEX_ESCAPE.test(css.charAt(next+1));)next+=1;css.charCodeAt(next+1)===32&&(next+=1)}currentToken=[`word`,css.slice(pos,next+1),pos,next],pos=next;break;default:code===47&&css.charCodeAt(pos+1)===42?(next=css.indexOf(`*/`,pos+2)+1,next===0&&(ignore||ignoreUnclosed?next=css.length:unclosed(`comment`)),currentToken=[`comment`,css.slice(pos,next+1),pos,next],pos=next):(RE_WORD_END.lastIndex=pos+1,RE_WORD_END.test(css),next=RE_WORD_END.lastIndex===0?css.length-1:RE_WORD_END.lastIndex-2,currentToken=[`word`,css.slice(pos,next+1),pos,next],buffer.push(currentToken),pos=next)}return pos++,currentToken}function back(token){returned.push(token)}return{back,endOfFile,nextToken,position}},tokenize$1}var atRule$1,hasRequiredAtRule$1;function requireAtRule$1(){if(hasRequiredAtRule$1)return atRule$1;hasRequiredAtRule$1=1;let Container=requireContainer$1();class AtRule extends Container{constructor(defaults){super(defaults),this.type=`atrule`}append(...children){return this.proxyOf.nodes||(this.nodes=[]),super.append(...children)}prepend(...children){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...children)}}return atRule$1=AtRule,AtRule.default=AtRule,Container.registerAtRule(AtRule),atRule$1}var root$1,hasRequiredRoot$1;function requireRoot$1(){if(hasRequiredRoot$1)return root$1;hasRequiredRoot$1=1;let Container=requireContainer$1(),LazyResult,Processor;class Root extends Container{constructor(defaults){super(defaults),this.type=`root`,this.nodes||=[]}normalize(child,sample,type){let nodes=super.normalize(child);if(sample){if(type===`prepend`)this.nodes.length>1?sample.raws.before=this.nodes[1].raws.before:delete sample.raws.before;else if(this.first!==sample)for(let node2 of nodes)node2.raws.before=sample.raws.before}return nodes}removeChild(child,ignore){let index2=this.index(child);return!ignore&&index2===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[index2].raws.before),super.removeChild(child)}toResult(opts={}){return new LazyResult(new Processor,this,opts).stringify()}}return Root.registerLazyResult=dependant=>{LazyResult=dependant},Root.registerProcessor=dependant=>{Processor=dependant},root$1=Root,Root.default=Root,Container.registerRoot(Root),root$1}var list_1$1,hasRequiredList$1;function requireList$1(){if(hasRequiredList$1)return list_1$1;hasRequiredList$1=1;let list={comma(string){return list.split(string,[`,`],!0)},space(string){return list.split(string,[` `,`
|
|
25
|
+
`,` `])},split(string,separators,last){let array=[],current=``,split=!1,func=0,inQuote=!1,prevQuote=``,escape=!1;for(let letter of string)escape?escape=!1:letter===`\\`?escape=!0:inQuote?letter===prevQuote&&(inQuote=!1):letter===`"`||letter===`'`?(inQuote=!0,prevQuote=letter):letter===`(`?func+=1:letter===`)`?func>0&&--func:func===0&&separators.includes(letter)&&(split=!0),split?(current!==``&&array.push(current.trim()),current=``,split=!1):current+=letter;return(last||current!==``)&&array.push(current.trim()),array}};return list_1$1=list,list.default=list,list_1$1}var rule$1,hasRequiredRule$1;function requireRule$1(){if(hasRequiredRule$1)return rule$1;hasRequiredRule$1=1;let Container=requireContainer$1(),list=requireList$1();class Rule extends Container{constructor(defaults){super(defaults),this.type=`rule`,this.nodes||=[]}get selectors(){return list.comma(this.selector)}set selectors(values){let match=this.selector?this.selector.match(/,\s*/):null,sep=match?match[0]:`,`+this.raw(`between`,`beforeOpen`);this.selector=values.join(sep)}}return rule$1=Rule,Rule.default=Rule,Container.registerRule(Rule),rule$1}var parser$1,hasRequiredParser$1;function requireParser$1(){if(hasRequiredParser$1)return parser$1;hasRequiredParser$1=1;let Declaration=requireDeclaration$1(),tokenizer=requireTokenize$1(),Comment=requireComment$1(),AtRule=requireAtRule$1(),Root=requireRoot$1(),Rule=requireRule$1(),SAFE_COMMENT_NEIGHBOR={empty:!0,space:!0};function findLastWithPosition(tokens){for(let i2=tokens.length-1;i2>=0;i2--){let token=tokens[i2],pos=token[3]||token[2];if(pos)return pos}}class Parser{constructor(input2){this.input=input2,this.root=new Root,this.current=this.root,this.spaces=``,this.semicolon=!1,this.createTokenizer(),this.root.source={input:input2,start:{column:1,line:1,offset:0}}}atrule(token){let node2=new AtRule;node2.name=token[1].slice(1),node2.name===``&&this.unnamedAtrule(node2,token),this.init(node2,token[2]);let type,prev,shift,last=!1,open=!1,params=[],brackets=[];for(;!this.tokenizer.endOfFile();){if(token=this.tokenizer.nextToken(),type=token[0],type===`(`||type===`[`?brackets.push(type===`(`?`)`:`]`):type===`{`&&brackets.length>0?brackets.push(`}`):type===brackets[brackets.length-1]&&brackets.pop(),brackets.length===0){if(type===`;`){node2.source.end=this.getPosition(token[2]),node2.source.end.offset++,this.semicolon=!0;break}if(type===`{`){open=!0;break}if(type===`}`){if(params.length>0){for(shift=params.length-1,prev=params[shift];prev&&prev[0]===`space`;)prev=params[--shift];prev&&(node2.source.end=this.getPosition(prev[3]||prev[2]),node2.source.end.offset++)}this.end(token);break}params.push(token)}else params.push(token);if(this.tokenizer.endOfFile()){last=!0;break}}node2.raws.between=this.spacesAndCommentsFromEnd(params),params.length?(node2.raws.afterName=this.spacesAndCommentsFromStart(params),this.raw(node2,`params`,params),last&&(token=params[params.length-1],node2.source.end=this.getPosition(token[3]||token[2]),node2.source.end.offset++,this.spaces=node2.raws.between,node2.raws.between=``)):(node2.raws.afterName=``,node2.params=``),open&&(node2.nodes=[],this.current=node2)}checkMissedSemicolon(tokens){let colon=this.colon(tokens);if(colon===!1)return;let founded=0,token;for(let j=colon-1;j>=0&&(token=tokens[j],!(token[0]!==`space`&&(founded+=1,founded===2)));j--);throw this.input.error(`Missed semicolon`,token[0]===`word`?token[3]+1:token[2])}colon(tokens){let brackets=0,token,type,prev;for(let[i2,element]of tokens.entries()){if(token=element,type=token[0],type===`(`&&(brackets+=1),type===`)`&&--brackets,brackets===0&&type===`:`){if(!prev)this.doubleColon(token);else if(prev[0]===`word`&&prev[1]===`progid`)continue;else return i2}prev=token}return!1}comment(token){let node2=new Comment;this.init(node2,token[2]),node2.source.end=this.getPosition(token[3]||token[2]),node2.source.end.offset++;let text=token[1].slice(2,-2);if(/^\s*$/.test(text))node2.text=``,node2.raws.left=text,node2.raws.right=``;else{let match=text.match(/^(\s*)([^]*\S)(\s*)$/);node2.text=match[2],node2.raws.left=match[1],node2.raws.right=match[3]}}createTokenizer(){this.tokenizer=tokenizer(this.input)}decl(tokens,customProperty){let node2=new Declaration;this.init(node2,tokens[0][2]);let last=tokens[tokens.length-1];for(last[0]===`;`&&(this.semicolon=!0,tokens.pop()),node2.source.end=this.getPosition(last[3]||last[2]||findLastWithPosition(tokens)),node2.source.end.offset++;tokens[0][0]!==`word`;)tokens.length===1&&this.unknownWord(tokens),node2.raws.before+=tokens.shift()[1];for(node2.source.start=this.getPosition(tokens[0][2]),node2.prop=``;tokens.length;){let type=tokens[0][0];if(type===`:`||type===`space`||type===`comment`)break;node2.prop+=tokens.shift()[1]}node2.raws.between=``;let token;for(;tokens.length;){if(token=tokens.shift(),token[0]===`:`){node2.raws.between+=token[1];break}token[0]===`word`&&/\w/.test(token[1])&&this.unknownWord([token]),node2.raws.between+=token[1]}(node2.prop[0]===`_`||node2.prop[0]===`*`)&&(node2.raws.before+=node2.prop[0],node2.prop=node2.prop.slice(1));let firstSpaces=[],next;for(;tokens.length&&(next=tokens[0][0],next===`space`||next===`comment`);)firstSpaces.push(tokens.shift());this.precheckMissedSemicolon(tokens);for(let i2=tokens.length-1;i2>=0;i2--){if(token=tokens[i2],token[1].toLowerCase()===`!important`){node2.important=!0;let string=this.stringFrom(tokens,i2);string=this.spacesFromEnd(tokens)+string,string!==` !important`&&(node2.raws.important=string);break}if(token[1].toLowerCase()===`important`){let cache=tokens.slice(0),str=``;for(let j=i2;j>0;j--){let type=cache[j][0];if(str.trim().indexOf(`!`)===0&&type!==`space`)break;str=cache.pop()[1]+str}str.trim().indexOf(`!`)===0&&(node2.important=!0,node2.raws.important=str,tokens=cache)}if(token[0]!==`space`&&token[0]!==`comment`)break}tokens.some(i2=>i2[0]!==`space`&&i2[0]!==`comment`)&&(node2.raws.between+=firstSpaces.map(i2=>i2[1]).join(``),firstSpaces=[]),this.raw(node2,`value`,firstSpaces.concat(tokens),customProperty),node2.value.includes(`:`)&&!customProperty&&this.checkMissedSemicolon(tokens)}doubleColon(token){throw this.input.error(`Double colon`,{offset:token[2]},{offset:token[2]+token[1].length})}emptyRule(token){let node2=new Rule;this.init(node2,token[2]),node2.selector=``,node2.raws.between=``,this.current=node2}end(token){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||``)+this.spaces,this.spaces=``,this.current.parent?(this.current.source.end=this.getPosition(token[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(token)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||``)+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(token){if(this.spaces+=token[1],this.current.nodes){let prev=this.current.nodes[this.current.nodes.length-1];prev&&prev.type===`rule`&&!prev.raws.ownSemicolon&&(prev.raws.ownSemicolon=this.spaces,this.spaces=``)}}getPosition(offset){let pos=this.input.fromOffset(offset);return{column:pos.col,line:pos.line,offset}}init(node2,offset){this.current.push(node2),node2.source={input:this.input,start:this.getPosition(offset)},node2.raws.before=this.spaces,this.spaces=``,node2.type!==`comment`&&(this.semicolon=!1)}other(start){let end=!1,type=null,colon=!1,bracket=null,brackets=[],customProperty=start[1].startsWith(`--`),tokens=[],token=start;for(;token;){if(type=token[0],tokens.push(token),type===`(`||type===`[`)bracket||=token,brackets.push(type===`(`?`)`:`]`);else if(customProperty&&colon&&type===`{`)bracket||=token,brackets.push(`}`);else if(brackets.length===0){if(type===`;`){if(colon){this.decl(tokens,customProperty);return}break}if(type===`{`){this.rule(tokens);return}if(type===`}`){this.tokenizer.back(tokens.pop()),end=!0;break}type===`:`&&(colon=!0)}else type===brackets[brackets.length-1]&&(brackets.pop(),brackets.length===0&&(bracket=null));token=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(end=!0),brackets.length>0&&this.unclosedBracket(bracket),end&&colon){if(!customProperty)for(;tokens.length&&(token=tokens[tokens.length-1][0],token===`space`||token===`comment`);)this.tokenizer.back(tokens.pop());this.decl(tokens,customProperty)}else this.unknownWord(tokens)}parse(){let token;for(;!this.tokenizer.endOfFile();)switch(token=this.tokenizer.nextToken(),token[0]){case`space`:this.spaces+=token[1];break;case`;`:this.freeSemicolon(token);break;case`}`:this.end(token);break;case`comment`:this.comment(token);break;case`at-word`:this.atrule(token);break;case`{`:this.emptyRule(token);break;default:this.other(token)}this.endFile()}precheckMissedSemicolon(){}raw(node2,prop,tokens,customProperty){let token,type,length=tokens.length,value=``,clean=!0,next,prev;for(let i2=0;i2<length;i2+=1)token=tokens[i2],type=token[0],type===`space`&&i2===length-1&&!customProperty?clean=!1:type===`comment`?(prev=tokens[i2-1]?tokens[i2-1][0]:`empty`,next=tokens[i2+1]?tokens[i2+1][0]:`empty`,!SAFE_COMMENT_NEIGHBOR[prev]&&!SAFE_COMMENT_NEIGHBOR[next]?value.slice(-1)===`,`?clean=!1:value+=token[1]:clean=!1):value+=token[1];if(!clean){let raw=tokens.reduce((all,i2)=>all+i2[1],``);node2.raws[prop]={raw,value}}node2[prop]=value}rule(tokens){tokens.pop();let node2=new Rule;this.init(node2,tokens[0][2]),node2.raws.between=this.spacesAndCommentsFromEnd(tokens),this.raw(node2,`selector`,tokens),this.current=node2}spacesAndCommentsFromEnd(tokens){let lastTokenType,spaces=``;for(;tokens.length&&(lastTokenType=tokens[tokens.length-1][0],lastTokenType===`space`||lastTokenType===`comment`);)spaces=tokens.pop()[1]+spaces;return spaces}spacesAndCommentsFromStart(tokens){let next,spaces=``;for(;tokens.length&&(next=tokens[0][0],next===`space`||next===`comment`);)spaces+=tokens.shift()[1];return spaces}spacesFromEnd(tokens){let lastTokenType,spaces=``;for(;tokens.length&&(lastTokenType=tokens[tokens.length-1][0],lastTokenType===`space`);)spaces=tokens.pop()[1]+spaces;return spaces}stringFrom(tokens,from){let result2=``;for(let i2=from;i2<tokens.length;i2++)result2+=tokens[i2][1];return tokens.splice(from,tokens.length-from),result2}unclosedBlock(){let pos=this.current.source.start;throw this.input.error(`Unclosed block`,pos.line,pos.column)}unclosedBracket(bracket){throw this.input.error(`Unclosed bracket`,{offset:bracket[2]},{offset:bracket[2]+1})}unexpectedClose(token){throw this.input.error(`Unexpected }`,{offset:token[2]},{offset:token[2]+1})}unknownWord(tokens){throw this.input.error(`Unknown word`,{offset:tokens[0][2]},{offset:tokens[0][2]+tokens[0][1].length})}unnamedAtrule(node2,token){throw this.input.error(`At-rule without name`,{offset:token[2]},{offset:token[2]+token[1].length})}}return parser$1=Parser,parser$1}var parse_1$1,hasRequiredParse$1;function requireParse$1(){if(hasRequiredParse$1)return parse_1$1;hasRequiredParse$1=1;let Container=requireContainer$1(),Parser=requireParser$1(),Input=requireInput$1();function parse(css,opts){let input2=new Input(css,opts),parser2=new Parser(input2);try{parser2.parse()}catch(e2){throw process.env.NODE_ENV!==`production`&&e2.name===`CssSyntaxError`&&opts&&opts.from&&(/\.scss$/i.test(opts.from)?e2.message+=`
|
|
26
|
+
You tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser`:/\.sass/i.test(opts.from)?e2.message+=`
|
|
27
|
+
You tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser`:/\.less$/i.test(opts.from)&&(e2.message+=`
|
|
28
|
+
You tried to parse Less with the standard CSS parser; try again with the postcss-less parser`)),e2}return parser2.root}return parse_1$1=parse,parse.default=parse,Container.registerParse(parse),parse_1$1}var lazyResult$1,hasRequiredLazyResult$1;function requireLazyResult$1(){if(hasRequiredLazyResult$1)return lazyResult$1;hasRequiredLazyResult$1=1;let{isClean,my}=requireSymbols$1(),MapGenerator=requireMapGenerator$1(),stringify=requireStringify$1(),Container=requireContainer$1(),Document2=requireDocument$1(),warnOnce2=requireWarnOnce$1(),Result=requireResult$1(),parse=requireParse$1(),Root=requireRoot$1(),TYPE_TO_CLASS_NAME={atrule:`AtRule`,comment:`Comment`,decl:`Declaration`,document:`Document`,root:`Root`,rule:`Rule`},PLUGIN_PROPS={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},NOT_VISITORS={Once:!0,postcssPlugin:!0,prepare:!0};function isPromise(obj){return typeof obj==`object`&&typeof obj.then==`function`}function getEvents(node2){let key=!1,type=TYPE_TO_CLASS_NAME[node2.type];return node2.type===`decl`?key=node2.prop.toLowerCase():node2.type===`atrule`&&(key=node2.name.toLowerCase()),key&&node2.append?[type,type+`-`+key,0,type+`Exit`,type+`Exit-`+key]:key?[type,type+`-`+key,type+`Exit`,type+`Exit-`+key]:node2.append?[type,0,type+`Exit`]:[type,type+`Exit`]}function toStack(node2){let events;return events=node2.type===`document`?[`Document`,0,`DocumentExit`]:node2.type===`root`?[`Root`,0,`RootExit`]:getEvents(node2),{eventIndex:0,events,iterator:0,node:node2,visitorIndex:0,visitors:[]}}function cleanMarks(node2){return node2[isClean]=!1,node2.nodes&&node2.nodes.forEach(i2=>cleanMarks(i2)),node2}let postcss2={};class LazyResult{constructor(processor2,css,opts){this.stringified=!1,this.processed=!1;let root2;if(typeof css==`object`&&css&&(css.type===`root`||css.type===`document`))root2=cleanMarks(css);else if(css instanceof LazyResult||css instanceof Result)root2=cleanMarks(css.root),css.map&&(opts.map===void 0&&(opts.map={}),opts.map.inline||(opts.map.inline=!1),opts.map.prev=css.map);else{let parser2=parse;opts.syntax&&(parser2=opts.syntax.parse),opts.parser&&(parser2=opts.parser),parser2.parse&&(parser2=parser2.parse);try{root2=parser2(css,opts)}catch(error){this.processed=!0,this.error=error}root2&&!root2[my]&&Container.rebuild(root2)}this.result=new Result(processor2,root2,opts),this.helpers={...postcss2,postcss:postcss2,result:this.result},this.plugins=this.processor.plugins.map(plugin=>typeof plugin==`object`&&plugin.prepare?{...plugin,...plugin.prepare(this.result)}:plugin)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||=this.runAsync(),this.processing)}catch(onRejected){return this.async().catch(onRejected)}finally(onFinally){return this.async().then(onFinally,onFinally)}getAsyncError(){throw Error(`Use process(css).then(cb) to work with async plugins`)}handleError(error,node2){let plugin=this.result.lastPlugin;try{if(node2&&node2.addToError(error),this.error=error,error.name===`CssSyntaxError`&&!error.plugin)error.plugin=plugin.postcssPlugin,error.setMessage();else if(plugin.postcssVersion&&process.env.NODE_ENV!==`production`){let pluginName=plugin.postcssPlugin,pluginVer=plugin.postcssVersion,runtimeVer=this.result.processor.version,a2=pluginVer.split(`.`),b=runtimeVer.split(`.`);(a2[0]!==b[0]||parseInt(a2[1])>parseInt(b[1]))&&console.error(`Unknown error from PostCSS plugin. Your current PostCSS version is `+runtimeVer+`, but `+pluginName+` uses `+pluginVer+`. Perhaps this is the source of the error below.`)}}catch(err){console&&console.error&&console.error(err)}return error}prepareVisitors(){this.listeners={};let add=(plugin,type,cb)=>{this.listeners[type]||(this.listeners[type]=[]),this.listeners[type].push([plugin,cb])};for(let plugin of this.plugins)if(typeof plugin==`object`)for(let event in plugin){if(!PLUGIN_PROPS[event]&&/^[A-Z]/.test(event))throw Error(`Unknown event ${event} in ${plugin.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!NOT_VISITORS[event]){if(typeof plugin[event]==`object`)for(let filter in plugin[event])filter===`*`?add(plugin,event,plugin[event][filter]):add(plugin,event+`-`+filter.toLowerCase(),plugin[event][filter]);else typeof plugin[event]==`function`&&add(plugin,event,plugin[event])}}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let i2=0;i2<this.plugins.length;i2++){let plugin=this.plugins[i2],promise=this.runOnRoot(plugin);if(isPromise(promise))try{await promise}catch(error){throw this.handleError(error)}}if(this.prepareVisitors(),this.hasListener){let root2=this.result.root;for(;!root2[isClean];){root2[isClean]=!0;let stack=[toStack(root2)];for(;stack.length>0;){let promise=this.visitTick(stack);if(isPromise(promise))try{await promise}catch(e2){let node2=stack[stack.length-1].node;throw this.handleError(e2,node2)}}}if(this.listeners.OnceExit)for(let[plugin,visitor]of this.listeners.OnceExit){this.result.lastPlugin=plugin;try{if(root2.type===`document`){let roots=root2.nodes.map(subRoot=>visitor(subRoot,this.helpers));await Promise.all(roots)}else await visitor(root2,this.helpers)}catch(e2){throw this.handleError(e2)}}}return this.processed=!0,this.stringify()}runOnRoot(plugin){this.result.lastPlugin=plugin;try{if(typeof plugin==`object`&&plugin.Once){if(this.result.root.type===`document`){let roots=this.result.root.nodes.map(root2=>plugin.Once(root2,this.helpers));return isPromise(roots[0])?Promise.all(roots):roots}return plugin.Once(this.result.root,this.helpers)}if(typeof plugin==`function`)return plugin(this.result.root,this.result)}catch(error){throw this.handleError(error)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let opts=this.result.opts,str=stringify;opts.syntax&&(str=opts.syntax.stringify),opts.stringifier&&(str=opts.stringifier),str.stringify&&(str=str.stringify);let data=new MapGenerator(str,this.result.root,this.result.opts).generate();return this.result.css=data[0],this.result.map=data[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let plugin of this.plugins)if(isPromise(this.runOnRoot(plugin)))throw this.getAsyncError();if(this.prepareVisitors(),this.hasListener){let root2=this.result.root;for(;!root2[isClean];)root2[isClean]=!0,this.walkSync(root2);if(this.listeners.OnceExit){if(root2.type===`document`)for(let subRoot of root2.nodes)this.visitSync(this.listeners.OnceExit,subRoot);else this.visitSync(this.listeners.OnceExit,root2)}}return this.result}then(onFulfilled,onRejected){return process.env.NODE_ENV!==`production`&&(`from`in this.opts||warnOnce2("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(onFulfilled,onRejected)}toString(){return this.css}visitSync(visitors,node2){for(let[plugin,visitor]of visitors){this.result.lastPlugin=plugin;let promise;try{promise=visitor(node2,this.helpers)}catch(e2){throw this.handleError(e2,node2.proxyOf)}if(node2.type!==`root`&&node2.type!==`document`&&!node2.parent)return!0;if(isPromise(promise))throw this.getAsyncError()}}visitTick(stack){let visit2=stack[stack.length-1],{node:node2,visitors}=visit2;if(node2.type!==`root`&&node2.type!==`document`&&!node2.parent){stack.pop();return}if(visitors.length>0&&visit2.visitorIndex<visitors.length){let[plugin,visitor]=visitors[visit2.visitorIndex];visit2.visitorIndex+=1,visit2.visitorIndex===visitors.length&&(visit2.visitors=[],visit2.visitorIndex=0),this.result.lastPlugin=plugin;try{return visitor(node2.toProxy(),this.helpers)}catch(e2){throw this.handleError(e2,node2)}}if(visit2.iterator!==0){let iterator=visit2.iterator,child;for(;child=node2.nodes[node2.indexes[iterator]];)if(node2.indexes[iterator]+=1,!child[isClean]){child[isClean]=!0,stack.push(toStack(child));return}visit2.iterator=0,delete node2.indexes[iterator]}let events=visit2.events;for(;visit2.eventIndex<events.length;){let event=events[visit2.eventIndex];if(visit2.eventIndex+=1,event===0){node2.nodes&&node2.nodes.length&&(node2[isClean]=!0,visit2.iterator=node2.getIterator());return}if(this.listeners[event]){visit2.visitors=this.listeners[event];return}}stack.pop()}walkSync(node2){node2[isClean]=!0;let events=getEvents(node2);for(let event of events)if(event===0)node2.nodes&&node2.each(child=>{child[isClean]||this.walkSync(child)});else{let visitors=this.listeners[event];if(visitors&&this.visitSync(visitors,node2.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return`LazyResult`}}return LazyResult.registerPostcss=dependant=>{postcss2=dependant},lazyResult$1=LazyResult,LazyResult.default=LazyResult,Root.registerLazyResult(LazyResult),Document2.registerLazyResult(LazyResult),lazyResult$1}var noWorkResult$1,hasRequiredNoWorkResult$1;function requireNoWorkResult$1(){if(hasRequiredNoWorkResult$1)return noWorkResult$1;hasRequiredNoWorkResult$1=1;let MapGenerator=requireMapGenerator$1(),stringify=requireStringify$1(),warnOnce2=requireWarnOnce$1(),parse=requireParse$1(),Result=requireResult$1();class NoWorkResult{constructor(processor2,css,opts){css=css.toString(),this.stringified=!1,this._processor=processor2,this._css=css,this._opts=opts,this._map=void 0;let root2,str=stringify;this.result=new Result(this._processor,root2,this._opts),this.result.css=css;let self2=this;Object.defineProperty(this.result,"root",{get(){return self2.root}});let map=new MapGenerator(str,root2,this._opts,css);if(map.isMap()){let[generatedCSS,generatedMap]=map.generate();generatedCSS&&(this.result.css=generatedCSS),generatedMap&&(this.result.map=generatedMap)}else map.clearAnnotation(),this.result.css=map.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(onRejected){return this.async().catch(onRejected)}finally(onFinally){return this.async().then(onFinally,onFinally)}sync(){if(this.error)throw this.error;return this.result}then(onFulfilled,onRejected){return process.env.NODE_ENV!==`production`&&(`from`in this._opts||warnOnce2("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(onFulfilled,onRejected)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let root2,parser2=parse;try{root2=parser2(this._css,this._opts)}catch(error){this.error=error}if(this.error)throw this.error;return this._root=root2,root2}get[Symbol.toStringTag](){return`NoWorkResult`}}return noWorkResult$1=NoWorkResult,NoWorkResult.default=NoWorkResult,noWorkResult$1}var processor$1,hasRequiredProcessor$1;function requireProcessor$1(){if(hasRequiredProcessor$1)return processor$1;hasRequiredProcessor$1=1;let NoWorkResult=requireNoWorkResult$1(),LazyResult=requireLazyResult$1(),Document2=requireDocument$1(),Root=requireRoot$1();class Processor{constructor(plugins=[]){this.version=`8.4.38`,this.plugins=this.normalize(plugins)}normalize(plugins){let normalized=[];for(let i2 of plugins)if(i2.postcss===!0?i2=i2():i2.postcss&&(i2=i2.postcss),typeof i2==`object`&&Array.isArray(i2.plugins))normalized=normalized.concat(i2.plugins);else if(typeof i2==`object`&&i2.postcssPlugin)normalized.push(i2);else if(typeof i2==`function`)normalized.push(i2);else if(typeof i2==`object`&&(i2.parse||i2.stringify)){if(process.env.NODE_ENV!==`production`)throw Error(`PostCSS syntaxes cannot be used as plugins. Instead, please use one of the syntax/parser/stringifier options as outlined in your PostCSS runner documentation.`)}else throw Error(i2+` is not a PostCSS plugin`);return normalized}process(css,opts={}){return!this.plugins.length&&!opts.parser&&!opts.stringifier&&!opts.syntax?new NoWorkResult(this,css,opts):new LazyResult(this,css,opts)}use(plugin){return this.plugins=this.plugins.concat(this.normalize([plugin])),this}}return processor$1=Processor,Processor.default=Processor,Root.registerProcessor(Processor),Document2.registerProcessor(Processor),processor$1}var fromJSON_1$1,hasRequiredFromJSON$1;function requireFromJSON$1(){if(hasRequiredFromJSON$1)return fromJSON_1$1;hasRequiredFromJSON$1=1;let Declaration=requireDeclaration$1(),PreviousMap=requirePreviousMap$1(),Comment=requireComment$1(),AtRule=requireAtRule$1(),Input=requireInput$1(),Root=requireRoot$1(),Rule=requireRule$1();function fromJSON(json,inputs){if(Array.isArray(json))return json.map(n2=>fromJSON(n2));let{inputs:ownInputs,...defaults}=json;if(ownInputs){inputs=[];for(let input2 of ownInputs){let inputHydrated={...input2,__proto__:Input.prototype};inputHydrated.map&&={...inputHydrated.map,__proto__:PreviousMap.prototype},inputs.push(inputHydrated)}}if(defaults.nodes&&=json.nodes.map(n2=>fromJSON(n2,inputs)),defaults.source){let{inputId,...source}=defaults.source;defaults.source=source,inputId!=null&&(defaults.source.input=inputs[inputId])}if(defaults.type===`root`)return new Root(defaults);if(defaults.type===`decl`)return new Declaration(defaults);if(defaults.type===`rule`)return new Rule(defaults);if(defaults.type===`comment`)return new Comment(defaults);if(defaults.type===`atrule`)return new AtRule(defaults);throw Error(`Unknown node type: `+json.type)}return fromJSON_1$1=fromJSON,fromJSON.default=fromJSON,fromJSON_1$1}var postcss_1$1,hasRequiredPostcss$1;function requirePostcss$1(){if(hasRequiredPostcss$1)return postcss_1$1;hasRequiredPostcss$1=1;let CssSyntaxError=requireCssSyntaxError$1(),Declaration=requireDeclaration$1(),LazyResult=requireLazyResult$1(),Container=requireContainer$1(),Processor=requireProcessor$1(),stringify=requireStringify$1(),fromJSON=requireFromJSON$1(),Document2=requireDocument$1(),Warning=requireWarning$1(),Comment=requireComment$1(),AtRule=requireAtRule$1(),Result=requireResult$1(),Input=requireInput$1(),parse=requireParse$1(),list=requireList$1(),Rule=requireRule$1(),Root=requireRoot$1(),Node2=requireNode$1();function postcss2(...plugins){return plugins.length===1&&Array.isArray(plugins[0])&&(plugins=plugins[0]),new Processor(plugins)}return postcss2.plugin=function(name,initializer){let warningPrinted=!1;function creator(...args){console&&console.warn&&!warningPrinted&&(warningPrinted=!0,console.warn(name+`: postcss.plugin was deprecated. Migration guide:
|
|
29
|
+
https://evilmartians.com/chronicles/postcss-8-plugin-migration`),process.env.LANG&&process.env.LANG.startsWith(`cn`)&&console.warn(name+`: 里面 postcss.plugin 被弃用. 迁移指南:
|
|
30
|
+
https://www.w3ctech.com/topic/2226`));let transformer=initializer(...args);return transformer.postcssPlugin=name,transformer.postcssVersion=new Processor().version,transformer}let cache;return Object.defineProperty(creator,"postcss",{get(){return cache||=creator(),cache}}),creator.process=function(css,processOpts,pluginOpts){return postcss2([creator(pluginOpts)]).process(css,processOpts)},creator},postcss2.stringify=stringify,postcss2.parse=parse,postcss2.fromJSON=fromJSON,postcss2.list=list,postcss2.comment=defaults=>new Comment(defaults),postcss2.atRule=defaults=>new AtRule(defaults),postcss2.decl=defaults=>new Declaration(defaults),postcss2.rule=defaults=>new Rule(defaults),postcss2.root=defaults=>new Root(defaults),postcss2.document=defaults=>new Document2(defaults),postcss2.CssSyntaxError=CssSyntaxError,postcss2.Declaration=Declaration,postcss2.Container=Container,postcss2.Processor=Processor,postcss2.Document=Document2,postcss2.Comment=Comment,postcss2.Warning=Warning,postcss2.AtRule=AtRule,postcss2.Result=Result,postcss2.Input=Input,postcss2.Rule=Rule,postcss2.Root=Root,postcss2.Node=Node2,LazyResult.registerPostcss(postcss2),postcss_1$1=postcss2,postcss2.default=postcss2,postcss_1$1}const postcss$1=getDefaultExportFromCjs$1(requirePostcss$1());postcss$1.stringify,postcss$1.fromJSON,postcss$1.plugin,postcss$1.parse,postcss$1.list,postcss$1.document,postcss$1.comment,postcss$1.atRule,postcss$1.rule,postcss$1.decl,postcss$1.root,postcss$1.CssSyntaxError,postcss$1.Declaration,postcss$1.Container,postcss$1.Processor,postcss$1.Document,postcss$1.Comment,postcss$1.Warning,postcss$1.AtRule,postcss$1.Result,postcss$1.Input,postcss$1.Rule,postcss$1.Root,postcss$1.Node;const tagMap={script:`noscript`,altglyph:`altGlyph`,altglyphdef:`altGlyphDef`,altglyphitem:`altGlyphItem`,animatecolor:`animateColor`,animatemotion:`animateMotion`,animatetransform:`animateTransform`,clippath:`clipPath`,feblend:`feBlend`,fecolormatrix:`feColorMatrix`,fecomponenttransfer:`feComponentTransfer`,fecomposite:`feComposite`,feconvolvematrix:`feConvolveMatrix`,fediffuselighting:`feDiffuseLighting`,fedisplacementmap:`feDisplacementMap`,fedistantlight:`feDistantLight`,fedropshadow:`feDropShadow`,feflood:`feFlood`,fefunca:`feFuncA`,fefuncb:`feFuncB`,fefuncg:`feFuncG`,fefuncr:`feFuncR`,fegaussianblur:`feGaussianBlur`,feimage:`feImage`,femerge:`feMerge`,femergenode:`feMergeNode`,femorphology:`feMorphology`,feoffset:`feOffset`,fepointlight:`fePointLight`,fespecularlighting:`feSpecularLighting`,fespotlight:`feSpotLight`,fetile:`feTile`,feturbulence:`feTurbulence`,foreignobject:`foreignObject`,glyphref:`glyphRef`,lineargradient:`linearGradient`,radialgradient:`radialGradient`};function getTagName(n2){let tagName=tagMap[n2.tagName]?tagMap[n2.tagName]:n2.tagName;return tagName===`link`&&n2.attributes._cssText&&(tagName=`style`),tagName}function adaptCssForReplay(cssText,cache){let cachedStyle=cache?.stylesWithHoverClass.get(cssText);if(cachedStyle)return cachedStyle;let result2=cssText;try{result2=postcss$1([mediaSelectorPlugin,pseudoClassPlugin]).process(cssText).css}catch(error){console.warn(`Failed to adapt css for replay`,error)}return cache?.stylesWithHoverClass.set(cssText,result2),result2}function createCache(){return{stylesWithHoverClass:new Map}}const SANDBOXED_IFRAME_ROOT_ERROR=`rrweb-snapshot.createSandboxedIframe() requires root to be connected to a document before creating a sandboxed iframe.`,sandboxedRebuildDocuments=new WeakSet;function isSupportedSandboxedIframe(frameElement){if(!frameElement||frameElement.tagName!==`IFRAME`||!(`sandbox`in frameElement))return!1;let sandboxTokens=Array.from(frameElement.sandbox);return sandboxTokens.length===1&&sandboxTokens[0]===`allow-same-origin`}function assertRebuildTargetAllowed(options){if(options.UNSAFE_allowUnprotectedRebuild)return;let win=options.doc.defaultView;if(win&&!(sandboxedRebuildDocuments.has(options.doc)&&isSupportedSandboxedIframe(win.frameElement)))throw Error(`rrweb-snapshot.rebuild() cannot rebuild into an unprotected browser document. Use rebuildIntoSandboxedIframe() or set UNSAFE_allowUnprotectedRebuild: true only when you accept the script-execution risk.`)}function applyCssSplits(n2,cssText,hackCss,cache){let childTextNodes=[];for(let scn of n2.childNodes)scn.type===NodeType$3.Text&&childTextNodes.push(scn);let cssTextSplits=cssText.split(`/* rr_split */`);for(;cssTextSplits.length>1&&cssTextSplits.length>childTextNodes.length;)cssTextSplits.splice(-2,2,cssTextSplits.slice(-2).join(``));let adaptedCss=``;hackCss&&(adaptedCss=adaptCssForReplay(cssTextSplits.join(``),cache));let startIndex=0;for(let i2=0;i2<childTextNodes.length&&i2!==cssTextSplits.length;i2++){let childTextNode=childTextNodes[i2];if(!hackCss)childTextNode.textContent=cssTextSplits[i2];else if(i2<cssTextSplits.length-1){let endIndex=startIndex,endSearch=cssTextSplits[i2+1].length;endSearch=Math.min(endSearch,30);let found=!1;for(;endSearch>2;endSearch--){let searchBit=cssTextSplits[i2+1].substring(0,endSearch),searchIndex=adaptedCss.substring(startIndex).indexOf(searchBit);if(found=searchIndex!==-1,found){endIndex+=searchIndex;break}}found||(endIndex+=cssTextSplits[i2].length),childTextNode.textContent=adaptedCss.substring(startIndex,endIndex),startIndex=endIndex}else childTextNode.textContent=adaptedCss.substring(startIndex)}}function buildStyleNode(n2,styleEl,cssText,options){let{doc,hackCss,cache}=options;n2.childNodes.length?applyCssSplits(n2,cssText,hackCss,cache):(hackCss&&(cssText=adaptCssForReplay(cssText,cache)),styleEl.appendChild(doc.createTextNode(cssText)))}function buildNode(n2,options){let{doc,hackCss,cache}=options;switch(n2.type){case NodeType$3.Document:return doc.implementation.createDocument(null,``,null);case NodeType$3.DocumentType:return doc.implementation.createDocumentType(n2.name||`html`,n2.publicId,n2.systemId);case NodeType$3.Element:{let tagName=getTagName(n2),node2;n2.isSVG?node2=doc.createElementNS(`http://www.w3.org/2000/svg`,tagName):(n2.isCustom&&doc.defaultView?.customElements&&!doc.defaultView.customElements.get(n2.tagName)&&doc.defaultView.customElements.define(n2.tagName,class extends doc.defaultView.HTMLElement{}),node2=doc.createElement(tagName));let specialAttributes={};for(let name in n2.attributes){if(!Object.prototype.hasOwnProperty.call(n2.attributes,name))continue;let value=n2.attributes[name];if((tagName!==`option`||name!==`selected`||value!==!1)&&value!==null){if(value===!0&&(value=``),name.startsWith(`rr_`)){specialAttributes[name]=value;continue}if(typeof value==`string`){if(tagName===`style`&&name===`_cssText`){buildStyleNode(n2,node2,value,options);continue}if(tagName===`textarea`&&name===`value`){node2.appendChild(doc.createTextNode(value)),n2.childNodes=[];continue}}try{if(n2.isSVG&&name===`xlink:href`)node2.setAttributeNS(`http://www.w3.org/1999/xlink`,name,value.toString());else if(name===`onload`||name===`onclick`||name.substring(0,7)===`onmouse`)node2.setAttribute(`_`+name,value.toString());else if(tagName===`meta`&&n2.attributes[`http-equiv`]===`Content-Security-Policy`&&name===`content`){node2.setAttribute(`csp-content`,value.toString());continue}else tagName===`link`&&(n2.attributes.rel===`preload`&&n2.attributes.as===`script`||n2.attributes.rel===`modulepreload`)||tagName===`link`&&n2.attributes.rel===`prefetch`&&typeof n2.attributes.href==`string`&&extractFileExtension(n2.attributes.href)===`js`||(tagName===`img`&&n2.attributes.srcset&&n2.attributes.rr_dataURL?node2.setAttribute(`rrweb-original-srcset`,n2.attributes.srcset):node2.setAttribute(name,value.toString()))}catch{}}}for(let name in specialAttributes){let value=specialAttributes[name];if(tagName===`canvas`&&name===`rr_dataURL`){let image=doc.createElement(`img`);image.onload=()=>{let ctx=node2.getContext(`2d`);ctx&&ctx.drawImage(image,0,0,image.width,image.height)},image.src=value.toString(),node2.RRNodeType&&(node2.rr_dataURL=value.toString())}else if(tagName===`img`&&name===`rr_dataURL`){let image=node2;image.currentSrc.startsWith(`data:`)||(image.setAttribute(`rrweb-original-src`,n2.attributes.src),image.src=value.toString())}if(name===`rr_width`)node2.style.setProperty(`width`,value.toString());else if(name===`rr_height`)node2.style.setProperty(`height`,value.toString());else if(name===`rr_mediaCurrentTime`&&typeof value==`number`)node2.currentTime=value;else if(name===`rr_mediaState`)switch(value){case`played`:node2.play().catch(e2=>console.warn(`media playback error`,e2));break;case`paused`:node2.pause()}else name===`rr_mediaPlaybackRate`&&typeof value==`number`?node2.playbackRate=value:name===`rr_mediaMuted`&&typeof value==`boolean`?node2.muted=value:name===`rr_mediaLoop`&&typeof value==`boolean`?node2.loop=value:name===`rr_mediaVolume`&&typeof value==`number`?node2.volume=value:name===`rr_open_mode`&&node2.setAttribute(`rr_open_mode`,value)}if(n2.isShadowHost){if(!node2.shadowRoot)node2.attachShadow({mode:`open`});else for(;node2.shadowRoot.firstChild;)node2.shadowRoot.removeChild(node2.shadowRoot.firstChild)}return node2}case NodeType$3.Text:return n2.isStyle&&hackCss?doc.createTextNode(adaptCssForReplay(n2.textContent,cache)):doc.createTextNode(n2.textContent);case NodeType$3.CDATA:return doc.createCDATASection(n2.textContent);case NodeType$3.Comment:return doc.createComment(n2.textContent);default:return null}}function buildNodeWithSN(n2,options){let{doc,mirror:mirror2,skipChild=!1,hackCss=!0,afterAppend,cache}=options;if(mirror2.has(n2.id)){let nodeInMirror=mirror2.getNode(n2.id);if(isNodeMetaEqual(mirror2.getMeta(nodeInMirror),n2))return mirror2.getNode(n2.id)}let node2=buildNode(n2,{doc,hackCss,cache});if(!node2)return null;if(n2.rootId&&mirror2.getNode(n2.rootId)!==doc&&mirror2.replace(n2.rootId,doc),n2.type===NodeType$3.Document&&(doc.close(),doc.open(),n2.compatMode===`BackCompat`&&n2.childNodes&&n2.childNodes[0].type!==NodeType$3.DocumentType&&(n2.childNodes[0].type===NodeType$3.Element&&`xmlns`in n2.childNodes[0].attributes&&n2.childNodes[0].attributes.xmlns===`http://www.w3.org/1999/xhtml`?doc.write(`<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">`):doc.write(`<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">`)),node2=doc),mirror2.add(node2,n2),(n2.type===NodeType$3.Document||n2.type===NodeType$3.Element)&&!skipChild)for(let childN of n2.childNodes){let childNode=buildNodeWithSN(childN,{doc,mirror:mirror2,skipChild:!1,hackCss,afterAppend,cache});if(!childNode){console.warn(`Failed to rebuild`,childN);continue}if(childN.isShadow&&isElement(node2)&&node2.shadowRoot)node2.shadowRoot.appendChild(childNode);else if(n2.type===NodeType$3.Document&&childN.type==NodeType$3.Element){let htmlElement=childNode,body=null;htmlElement.childNodes.forEach(child=>{child.nodeName===`BODY`&&(body=child)}),body?(htmlElement.removeChild(body),node2.appendChild(childNode),htmlElement.appendChild(body)):node2.appendChild(childNode)}else node2.appendChild(childNode);afterAppend&&afterAppend(childNode,childN.id)}return node2}function visit(mirror2,onVisit){function walk(node2){onVisit(node2)}for(let id of mirror2.getIds())mirror2.has(id)&&walk(mirror2.getNode(id))}function handleScroll(node2,mirror2){let n2=mirror2.getMeta(node2);if(n2?.type!==NodeType$3.Element)return;let el=node2;for(let name in n2.attributes){if(!(Object.prototype.hasOwnProperty.call(n2.attributes,name)&&name.startsWith(`rr_`)))continue;let value=n2.attributes[name];name===`rr_scrollLeft`&&(el.scrollLeft=value),name===`rr_scrollTop`&&(el.scrollTop=value)}}function rebuild(n2,options){assertRebuildTargetAllowed(options);let{doc,onVisit,hackCss=!0,afterAppend,cache,mirror:mirror2=new Mirror}=options,node2=buildNodeWithSN(n2,{doc,mirror:mirror2,skipChild:!1,hackCss,afterAppend,cache});return visit(mirror2,visitedNode=>{onVisit&&onVisit(visitedNode),handleScroll(visitedNode,mirror2)}),node2}function createSandboxedIframe(options){var _a2;if(!options.root.isConnected)throw Error(SANDBOXED_IFRAME_ROOT_ERROR);let iframe=options.root.ownerDocument.createElement(`iframe`);for(let[name,value]of Object.entries(options.iframeAttributes||{}))name!==`sandbox`&&iframe.setAttribute(name,value);iframe.setAttribute(`sandbox`,`allow-same-origin`),options.root.appendChild(iframe);let doc=iframe.contentDocument;if(!doc||!iframe.contentWindow)throw(_a2=iframe.parentNode)==null||_a2.removeChild(iframe),Error(SANDBOXED_IFRAME_ROOT_ERROR);return sandboxedRebuildDocuments.add(doc),iframe}var __defProp2=Object.defineProperty,__defNormalProp2=(obj,key,value)=>key in obj?__defProp2(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value,__publicField2=(obj,key,value)=>__defNormalProp2(obj,typeof key==`symbol`?key:key+``,value),__defProp22=Object.defineProperty,__defNormalProp22=(obj,key,value)=>key in obj?__defProp22(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value,__publicField22=(obj,key,value)=>__defNormalProp22(obj,typeof key==`symbol`?key:key+``,value);Date.now().toString();let Mirror$1=class{constructor(){__publicField22(this,`idNodeMap`,new Map),__publicField22(this,`nodeMetaMap`,new WeakMap)}getId(n2){return n2?this.getMeta(n2)?.id??-1:-1}getNode(id){return this.idNodeMap.get(id)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(n2){return this.nodeMetaMap.get(n2)||null}removeNodeFromMap(n2){let id=this.getId(n2);this.idNodeMap.delete(id),n2.childNodes&&n2.childNodes.forEach(childNode=>this.removeNodeFromMap(childNode))}has(id){return this.idNodeMap.has(id)}hasNode(node2){return this.nodeMetaMap.has(node2)}add(n2,meta){let id=meta.id;this.idNodeMap.set(id,n2),this.nodeMetaMap.set(n2,meta)}replace(id,n2){let oldNode=this.getNode(id);if(oldNode){let meta=this.nodeMetaMap.get(oldNode);meta&&this.nodeMetaMap.set(n2,meta)}this.idNodeMap.set(id,n2)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function createMirror$1(){return new Mirror$1}function getDefaultExportFromCjs(x){return x&&x.__esModule&&Object.prototype.hasOwnProperty.call(x,`default`)?x.default:x}function getAugmentedNamespace(n2){if(n2.__esModule)return n2;var f2=n2.default;if(typeof f2==`function`){var a2=function a22(){return this instanceof a22?Reflect.construct(f2,arguments,this.constructor):f2.apply(this,arguments)};a2.prototype=f2.prototype}else a2={};return Object.defineProperty(a2,"__esModule",{value:!0}),Object.keys(n2).forEach(function(k){var d=Object.getOwnPropertyDescriptor(n2,k);Object.defineProperty(a2,k,d.get?d:{enumerable:!0,get:function(){return n2[k]}})}),a2}var picocolors_browser={exports:{}},hasRequiredPicocolors_browser;function requirePicocolors_browser(){if(hasRequiredPicocolors_browser)return picocolors_browser.exports;hasRequiredPicocolors_browser=1;var x=String,create=function(){return{isColorSupported:!1,reset:x,bold:x,dim:x,italic:x,underline:x,inverse:x,hidden:x,strikethrough:x,black:x,red:x,green:x,yellow:x,blue:x,magenta:x,cyan:x,white:x,gray:x,bgBlack:x,bgRed:x,bgGreen:x,bgYellow:x,bgBlue:x,bgMagenta:x,bgCyan:x,bgWhite:x}};return picocolors_browser.exports=create(),picocolors_browser.exports.createColors=create,picocolors_browser.exports}const require$$2=getAugmentedNamespace(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:`Module`})));var cssSyntaxError,hasRequiredCssSyntaxError;function requireCssSyntaxError(){if(hasRequiredCssSyntaxError)return cssSyntaxError;hasRequiredCssSyntaxError=1;let pico=requirePicocolors_browser(),terminalHighlight=require$$2;class CssSyntaxError extends Error{constructor(message,line,column,source,file,plugin){super(message),this.name=`CssSyntaxError`,this.reason=message,file&&(this.file=file),source&&(this.source=source),plugin&&(this.plugin=plugin),line!==void 0&&column!==void 0&&(typeof line==`number`?(this.line=line,this.column=column):(this.line=line.line,this.column=line.column,this.endLine=column.line,this.endColumn=column.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,CssSyntaxError)}setMessage(){this.message=this.plugin?this.plugin+`: `:``,this.message+=this.file?this.file:`<css input>`,this.line!==void 0&&(this.message+=`:`+this.line+`:`+this.column),this.message+=`: `+this.reason}showSourceCode(color){if(!this.source)return``;let css=this.source;color??=pico.isColorSupported,terminalHighlight&&color&&(css=terminalHighlight(css));let lines=css.split(/\r?\n/),start=Math.max(this.line-3,0),end=Math.min(this.line+2,lines.length),maxWidth=String(end).length,mark,aside;if(color){let{bold,gray,red}=pico.createColors(!0);mark=text=>bold(red(text)),aside=text=>gray(text)}else mark=aside=str=>str;return lines.slice(start,end).map((line,index2)=>{let number=start+1+index2,gutter=` `+(` `+number).slice(-maxWidth)+` | `;if(number===this.line){let spacing=aside(gutter.replace(/\d/g,` `))+line.slice(0,this.column-1).replace(/[^\t]/g,` `);return mark(`>`)+aside(gutter)+line+`
|
|
31
|
+
`+spacing+mark(`^`)}return` `+aside(gutter)+line}).join(`
|
|
32
|
+
`)}toString(){let code=this.showSourceCode();return code&&=`
|
|
33
|
+
|
|
34
|
+
`+code+`
|
|
35
|
+
`,this.name+`: `+this.message+code}}return cssSyntaxError=CssSyntaxError,CssSyntaxError.default=CssSyntaxError,cssSyntaxError}var symbols={},hasRequiredSymbols;function requireSymbols(){return hasRequiredSymbols?symbols:(hasRequiredSymbols=1,symbols.isClean=Symbol(`isClean`),symbols.my=Symbol(`my`),symbols)}var stringifier,hasRequiredStringifier;function requireStringifier(){if(hasRequiredStringifier)return stringifier;hasRequiredStringifier=1;let DEFAULT_RAW={after:`
|
|
36
|
+
`,beforeClose:`
|
|
37
|
+
`,beforeComment:`
|
|
38
|
+
`,beforeDecl:`
|
|
39
|
+
`,beforeOpen:` `,beforeRule:`
|
|
40
|
+
`,colon:`: `,commentLeft:` `,commentRight:` `,emptyBody:``,indent:` `,semicolon:!1};function capitalize(str){return str[0].toUpperCase()+str.slice(1)}class Stringifier{constructor(builder){this.builder=builder}atrule(node2,semicolon){let name=`@`+node2.name,params=node2.params?this.rawValue(node2,`params`):``;if(node2.raws.afterName===void 0?params&&(name+=` `):name+=node2.raws.afterName,node2.nodes)this.block(node2,name+params);else{let end=(node2.raws.between||``)+(semicolon?`;`:``);this.builder(name+params+end,node2)}}beforeAfter(node2,detect){let value;value=node2.type===`decl`?this.raw(node2,null,`beforeDecl`):node2.type===`comment`?this.raw(node2,null,`beforeComment`):detect===`before`?this.raw(node2,null,`beforeRule`):this.raw(node2,null,`beforeClose`);let buf=node2.parent,depth=0;for(;buf&&buf.type!==`root`;)depth+=1,buf=buf.parent;if(value.includes(`
|
|
41
|
+
`)){let indent=this.raw(node2,null,`indent`);if(indent.length)for(let step=0;step<depth;step++)value+=indent}return value}block(node2,start){let between=this.raw(node2,`between`,`beforeOpen`);this.builder(start+between+`{`,node2,`start`);let after;node2.nodes&&node2.nodes.length?(this.body(node2),after=this.raw(node2,`after`)):after=this.raw(node2,`after`,`emptyBody`),after&&this.builder(after),this.builder(`}`,node2,`end`)}body(node2){let last=node2.nodes.length-1;for(;last>0&&node2.nodes[last].type===`comment`;)--last;let semicolon=this.raw(node2,`semicolon`);for(let i2=0;i2<node2.nodes.length;i2++){let child=node2.nodes[i2],before=this.raw(child,`before`);before&&this.builder(before),this.stringify(child,last!==i2||semicolon)}}comment(node2){let left=this.raw(node2,`left`,`commentLeft`),right=this.raw(node2,`right`,`commentRight`);this.builder(`/*`+left+node2.text+right+`*/`,node2)}decl(node2,semicolon){let between=this.raw(node2,`between`,`colon`),string=node2.prop+between+this.rawValue(node2,`value`);node2.important&&(string+=node2.raws.important||` !important`),semicolon&&(string+=`;`),this.builder(string,node2)}document(node2){this.body(node2)}raw(node2,own,detect){let value;if(detect||=own,own&&(value=node2.raws[own],value!==void 0))return value;let parent=node2.parent;if(detect===`before`&&(!parent||parent.type===`root`&&parent.first===node2||parent&&parent.type===`document`))return``;if(!parent)return DEFAULT_RAW[detect];let root2=node2.root();if(root2.rawCache||={},root2.rawCache[detect]!==void 0)return root2.rawCache[detect];if(detect===`before`||detect===`after`)return this.beforeAfter(node2,detect);{let method=`raw`+capitalize(detect);this[method]?value=this[method](root2,node2):root2.walk(i2=>{if(value=i2.raws[own],value!==void 0)return!1})}return value===void 0&&(value=DEFAULT_RAW[detect]),root2.rawCache[detect]=value,value}rawBeforeClose(root2){let value;return root2.walk(i2=>{if(i2.nodes&&i2.nodes.length>0&&i2.raws.after!==void 0)return value=i2.raws.after,value.includes(`
|
|
42
|
+
`)&&(value=value.replace(/[^\n]+$/,``)),!1}),value&&=value.replace(/\S/g,``),value}rawBeforeComment(root2,node2){let value;return root2.walkComments(i2=>{if(i2.raws.before!==void 0)return value=i2.raws.before,value.includes(`
|
|
43
|
+
`)&&(value=value.replace(/[^\n]+$/,``)),!1}),value===void 0?value=this.raw(node2,null,`beforeDecl`):value&&=value.replace(/\S/g,``),value}rawBeforeDecl(root2,node2){let value;return root2.walkDecls(i2=>{if(i2.raws.before!==void 0)return value=i2.raws.before,value.includes(`
|
|
44
|
+
`)&&(value=value.replace(/[^\n]+$/,``)),!1}),value===void 0?value=this.raw(node2,null,`beforeRule`):value&&=value.replace(/\S/g,``),value}rawBeforeOpen(root2){let value;return root2.walk(i2=>{if(i2.type!==`decl`&&(value=i2.raws.between,value!==void 0))return!1}),value}rawBeforeRule(root2){let value;return root2.walk(i2=>{if(i2.nodes&&(i2.parent!==root2||root2.first!==i2)&&i2.raws.before!==void 0)return value=i2.raws.before,value.includes(`
|
|
45
|
+
`)&&(value=value.replace(/[^\n]+$/,``)),!1}),value&&=value.replace(/\S/g,``),value}rawColon(root2){let value;return root2.walkDecls(i2=>{if(i2.raws.between!==void 0)return value=i2.raws.between.replace(/[^\s:]/g,``),!1}),value}rawEmptyBody(root2){let value;return root2.walk(i2=>{if(i2.nodes&&i2.nodes.length===0&&(value=i2.raws.after,value!==void 0))return!1}),value}rawIndent(root2){if(root2.raws.indent)return root2.raws.indent;let value;return root2.walk(i2=>{let p=i2.parent;if(p&&p!==root2&&p.parent&&p.parent===root2&&i2.raws.before!==void 0){let parts=i2.raws.before.split(`
|
|
46
|
+
`);return value=parts[parts.length-1],value=value.replace(/\S/g,``),!1}}),value}rawSemicolon(root2){let value;return root2.walk(i2=>{if(i2.nodes&&i2.nodes.length&&i2.last.type===`decl`&&(value=i2.raws.semicolon,value!==void 0))return!1}),value}rawValue(node2,prop){let value=node2[prop],raw=node2.raws[prop];return raw&&raw.value===value?raw.raw:value}root(node2){this.body(node2),node2.raws.after&&this.builder(node2.raws.after)}rule(node2){this.block(node2,this.rawValue(node2,`selector`)),node2.raws.ownSemicolon&&this.builder(node2.raws.ownSemicolon,node2,`end`)}stringify(node2,semicolon){if(!this[node2.type])throw Error(`Unknown AST node type `+node2.type+`. Maybe you need to change PostCSS stringifier.`);this[node2.type](node2,semicolon)}}return stringifier=Stringifier,Stringifier.default=Stringifier,stringifier}var stringify_1,hasRequiredStringify;function requireStringify(){if(hasRequiredStringify)return stringify_1;hasRequiredStringify=1;let Stringifier=requireStringifier();function stringify(node2,builder){new Stringifier(builder).stringify(node2)}return stringify_1=stringify,stringify.default=stringify,stringify_1}var node,hasRequiredNode;function requireNode(){if(hasRequiredNode)return node;hasRequiredNode=1;let{isClean,my}=requireSymbols(),CssSyntaxError=requireCssSyntaxError(),Stringifier=requireStringifier(),stringify=requireStringify();function cloneNode(obj,parent){let cloned=new obj.constructor;for(let i2 in obj){if(!Object.prototype.hasOwnProperty.call(obj,i2)||i2===`proxyCache`)continue;let value=obj[i2],type=typeof value;i2===`parent`&&type===`object`?parent&&(cloned[i2]=parent):i2===`source`?cloned[i2]=value:Array.isArray(value)?cloned[i2]=value.map(j=>cloneNode(j,cloned)):(type===`object`&&value!==null&&(value=cloneNode(value)),cloned[i2]=value)}return cloned}class Node2{constructor(defaults={}){this.raws={},this[isClean]=!1,this[my]=!0;for(let name in defaults)if(name===`nodes`){this.nodes=[];for(let node2 of defaults[name])typeof node2.clone==`function`?this.append(node2.clone()):this.append(node2)}else this[name]=defaults[name]}addToError(error){if(error.postcssNode=this,error.stack&&this.source&&/\n\s{4}at /.test(error.stack)){let s2=this.source;error.stack=error.stack.replace(/\n\s{4}at /,`$&${s2.input.from}:${s2.start.line}:${s2.start.column}$&`)}return error}after(add){return this.parent.insertAfter(this,add),this}assign(overrides={}){for(let name in overrides)this[name]=overrides[name];return this}before(add){return this.parent.insertBefore(this,add),this}cleanRaws(keepBetween){delete this.raws.before,delete this.raws.after,keepBetween||delete this.raws.between}clone(overrides={}){let cloned=cloneNode(this);for(let name in overrides)cloned[name]=overrides[name];return cloned}cloneAfter(overrides={}){let cloned=this.clone(overrides);return this.parent.insertAfter(this,cloned),cloned}cloneBefore(overrides={}){let cloned=this.clone(overrides);return this.parent.insertBefore(this,cloned),cloned}error(message,opts={}){if(this.source){let{end,start}=this.rangeBy(opts);return this.source.input.error(message,{column:start.column,line:start.line},{column:end.column,line:end.line},opts)}return new CssSyntaxError(message)}getProxyProcessor(){return{get(node2,prop){return prop===`proxyOf`?node2:prop===`root`?()=>node2.root().toProxy():node2[prop]},set(node2,prop,value){return node2[prop]===value||(node2[prop]=value,(prop===`prop`||prop===`value`||prop===`name`||prop===`params`||prop===`important`||prop===`text`)&&node2.markDirty(),!0)}}}markDirty(){if(this[isClean]){this[isClean]=!1;let next=this;for(;next=next.parent;)next[isClean]=!1}}next(){if(!this.parent)return;let index2=this.parent.index(this);return this.parent.nodes[index2+1]}positionBy(opts,stringRepresentation){let pos=this.source.start;if(opts.index)pos=this.positionInside(opts.index,stringRepresentation);else if(opts.word){stringRepresentation=this.toString();let index2=stringRepresentation.indexOf(opts.word);index2!==-1&&(pos=this.positionInside(index2,stringRepresentation))}return pos}positionInside(index2,stringRepresentation){let string=stringRepresentation||this.toString(),column=this.source.start.column,line=this.source.start.line;for(let i2=0;i2<index2;i2++)string[i2]===`
|
|
47
|
+
`?(column=1,line+=1):column+=1;return{column,line}}prev(){if(!this.parent)return;let index2=this.parent.index(this);return this.parent.nodes[index2-1]}rangeBy(opts){let start={column:this.source.start.column,line:this.source.start.line},end=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:start.column+1,line:start.line};if(opts.word){let stringRepresentation=this.toString(),index2=stringRepresentation.indexOf(opts.word);index2!==-1&&(start=this.positionInside(index2,stringRepresentation),end=this.positionInside(index2+opts.word.length,stringRepresentation))}else opts.start?start={column:opts.start.column,line:opts.start.line}:opts.index&&(start=this.positionInside(opts.index)),opts.end?end={column:opts.end.column,line:opts.end.line}:typeof opts.endIndex==`number`?end=this.positionInside(opts.endIndex):opts.index&&(end=this.positionInside(opts.index+1));return(end.line<start.line||end.line===start.line&&end.column<=start.column)&&(end={column:start.column+1,line:start.line}),{end,start}}raw(prop,defaultType){return new Stringifier().raw(this,prop,defaultType)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...nodes){if(this.parent){let bookmark=this,foundSelf=!1;for(let node2 of nodes)node2===this?foundSelf=!0:foundSelf?(this.parent.insertAfter(bookmark,node2),bookmark=node2):this.parent.insertBefore(bookmark,node2);foundSelf||this.remove()}return this}root(){let result2=this;for(;result2.parent&&result2.parent.type!==`document`;)result2=result2.parent;return result2}toJSON(_,inputs){let fixed={},emitInputs=inputs==null;inputs||=new Map;let inputsNextIndex=0;for(let name in this){if(!Object.prototype.hasOwnProperty.call(this,name)||name===`parent`||name===`proxyCache`)continue;let value=this[name];if(Array.isArray(value))fixed[name]=value.map(i2=>typeof i2==`object`&&i2.toJSON?i2.toJSON(null,inputs):i2);else if(typeof value==`object`&&value.toJSON)fixed[name]=value.toJSON(null,inputs);else if(name===`source`){let inputId=inputs.get(value.input);inputId??(inputId=inputsNextIndex,inputs.set(value.input,inputsNextIndex),inputsNextIndex++),fixed[name]={end:value.end,inputId,start:value.start}}else fixed[name]=value}return emitInputs&&(fixed.inputs=[...inputs.keys()].map(input2=>input2.toJSON())),fixed}toProxy(){return this.proxyCache||=new Proxy(this,this.getProxyProcessor()),this.proxyCache}toString(stringifier2=stringify){stringifier2.stringify&&(stringifier2=stringifier2.stringify);let result2=``;return stringifier2(this,i2=>{result2+=i2}),result2}warn(result2,text,opts){let data={node:this};for(let i2 in opts)data[i2]=opts[i2];return result2.warn(text,data)}get proxyOf(){return this}}return node=Node2,Node2.default=Node2,node}var declaration,hasRequiredDeclaration;function requireDeclaration(){if(hasRequiredDeclaration)return declaration;hasRequiredDeclaration=1;let Node2=requireNode();class Declaration extends Node2{constructor(defaults){defaults&&defaults.value!==void 0&&typeof defaults.value!=`string`&&(defaults={...defaults,value:String(defaults.value)}),super(defaults),this.type=`decl`}get variable(){return this.prop.startsWith(`--`)||this.prop[0]===`$`}}return declaration=Declaration,Declaration.default=Declaration,declaration}var nonSecure,hasRequiredNonSecure;function requireNonSecure(){return hasRequiredNonSecure?nonSecure:(hasRequiredNonSecure=1,nonSecure={nanoid:(size=21)=>{let id=``,i2=size;for(;i2--;)id+=`useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict`[Math.random()*64|0];return id},customAlphabet:(alphabet,defaultSize=21)=>(size=defaultSize)=>{let id=``,i2=size;for(;i2--;)id+=alphabet[Math.random()*alphabet.length|0];return id}},nonSecure)}var previousMap,hasRequiredPreviousMap;function requirePreviousMap(){if(hasRequiredPreviousMap)return previousMap;hasRequiredPreviousMap=1;let{SourceMapConsumer,SourceMapGenerator}=require$$2,{existsSync,readFileSync}=require$$2,{dirname,join}=require$$2;function fromBase64(str){return Buffer?Buffer.from(str,`base64`).toString():window.atob(str)}class PreviousMap{constructor(css,opts){if(opts.map===!1)return;this.loadAnnotation(css),this.inline=this.startWith(this.annotation,`data:`);let prev=opts.map?opts.map.prev:void 0,text=this.loadMap(opts.from,prev);!this.mapFile&&opts.from&&(this.mapFile=opts.from),this.mapFile&&(this.root=dirname(this.mapFile)),text&&(this.text=text)}consumer(){return this.consumerCache||=new SourceMapConsumer(this.text),this.consumerCache}decodeInline(text){let baseCharsetUri=/^data:application\/json;charset=utf-?8;base64,/,baseUri=/^data:application\/json;base64,/;if(/^data:application\/json;charset=utf-?8,/.test(text)||/^data:application\/json,/.test(text))return decodeURIComponent(text.substr(RegExp.lastMatch.length));if(baseCharsetUri.test(text)||baseUri.test(text))return fromBase64(text.substr(RegExp.lastMatch.length));let encoding=text.match(/data:application\/json;([^,]+),/)[1];throw Error(`Unsupported source map encoding `+encoding)}getAnnotationURL(sourceMapString){return sourceMapString.replace(/^\/\*\s*# sourceMappingURL=/,``).trim()}isMap(map){return typeof map==`object`?typeof map.mappings==`string`||typeof map._mappings==`string`||Array.isArray(map.sections):!1}loadAnnotation(css){let comments=css.match(/\/\*\s*# sourceMappingURL=/gm);if(!comments)return;let start=css.lastIndexOf(comments.pop()),end=css.indexOf(`*/`,start);start>-1&&end>-1&&(this.annotation=this.getAnnotationURL(css.substring(start,end)))}loadFile(path){if(this.root=dirname(path),existsSync(path))return this.mapFile=path,readFileSync(path,`utf-8`).toString().trim()}loadMap(file,prev){if(prev===!1)return!1;if(prev){if(typeof prev==`string`)return prev;if(typeof prev==`function`){let prevPath=prev(file);if(prevPath){let map=this.loadFile(prevPath);if(!map)throw Error(`Unable to load previous source map: `+prevPath.toString());return map}}else if(prev instanceof SourceMapConsumer)return SourceMapGenerator.fromSourceMap(prev).toString();else if(prev instanceof SourceMapGenerator)return prev.toString();else if(this.isMap(prev))return JSON.stringify(prev);else throw Error(`Unsupported previous source map format: `+prev.toString())}else if(this.inline)return this.decodeInline(this.annotation);else if(this.annotation){let map=this.annotation;return file&&(map=join(dirname(file),map)),this.loadFile(map)}}startWith(string,start){return string?string.substr(0,start.length)===start:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}}return previousMap=PreviousMap,PreviousMap.default=PreviousMap,previousMap}var input,hasRequiredInput;function requireInput(){if(hasRequiredInput)return input;hasRequiredInput=1;let{SourceMapConsumer,SourceMapGenerator}=require$$2,{fileURLToPath,pathToFileURL}=require$$2,{isAbsolute,resolve}=require$$2,{nanoid}=requireNonSecure(),terminalHighlight=require$$2,CssSyntaxError=requireCssSyntaxError(),PreviousMap=requirePreviousMap(),fromOffsetCache=Symbol(`fromOffsetCache`),sourceMapAvailable=!!(SourceMapConsumer&&SourceMapGenerator),pathAvailable=!!(resolve&&isAbsolute);class Input{constructor(css,opts={}){if(css==null||typeof css==`object`&&!css.toString)throw Error(`PostCSS received ${css} instead of CSS string`);if(this.css=css.toString(),this.css[0]===``||this.css[0]===``?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,opts.from&&(this.file=!pathAvailable||/^\w+:\/\//.test(opts.from)||isAbsolute(opts.from)?opts.from:resolve(opts.from)),pathAvailable&&sourceMapAvailable){let map=new PreviousMap(this.css,opts);if(map.text){this.map=map;let file=map.consumer().file;!this.file&&file&&(this.file=this.mapResolve(file))}}this.file||(this.id=`<input css `+nanoid(6)+`>`),this.map&&(this.map.file=this.from)}error(message,line,column,opts={}){let result2,endLine,endColumn;if(line&&typeof line==`object`){let start=line,end=column;if(typeof start.offset==`number`){let pos=this.fromOffset(start.offset);line=pos.line,column=pos.col}else line=start.line,column=start.column;if(typeof end.offset==`number`){let pos=this.fromOffset(end.offset);endLine=pos.line,endColumn=pos.col}else endLine=end.line,endColumn=end.column}else if(!column){let pos=this.fromOffset(line);line=pos.line,column=pos.col}let origin=this.origin(line,column,endLine,endColumn);return result2=origin?new CssSyntaxError(message,origin.endLine===void 0?origin.line:{column:origin.column,line:origin.line},origin.endLine===void 0?origin.column:{column:origin.endColumn,line:origin.endLine},origin.source,origin.file,opts.plugin):new CssSyntaxError(message,endLine===void 0?line:{column,line},endLine===void 0?column:{column:endColumn,line:endLine},this.css,this.file,opts.plugin),result2.input={column,endColumn,endLine,line,source:this.css},this.file&&(pathToFileURL&&(result2.input.url=pathToFileURL(this.file).toString()),result2.input.file=this.file),result2}fromOffset(offset){let lastLine,lineToIndex;if(this[fromOffsetCache])lineToIndex=this[fromOffsetCache];else{let lines=this.css.split(`
|
|
48
|
+
`);lineToIndex=Array(lines.length);let prevIndex=0;for(let i2=0,l2=lines.length;i2<l2;i2++)lineToIndex[i2]=prevIndex,prevIndex+=lines[i2].length+1;this[fromOffsetCache]=lineToIndex}lastLine=lineToIndex[lineToIndex.length-1];let min=0;if(offset>=lastLine)min=lineToIndex.length-1;else{let max=lineToIndex.length-2,mid;for(;min<max;)if(mid=min+(max-min>>1),offset<lineToIndex[mid])max=mid-1;else if(offset>=lineToIndex[mid+1])min=mid+1;else{min=mid;break}}return{col:offset-lineToIndex[min]+1,line:min+1}}mapResolve(file){return/^\w+:\/\//.test(file)?file:resolve(this.map.consumer().sourceRoot||this.map.root||`.`,file)}origin(line,column,endLine,endColumn){if(!this.map)return!1;let consumer=this.map.consumer(),from=consumer.originalPositionFor({column,line});if(!from.source)return!1;let to;typeof endLine==`number`&&(to=consumer.originalPositionFor({column:endColumn,line:endLine}));let fromUrl;fromUrl=isAbsolute(from.source)?pathToFileURL(from.source):new URL(from.source,this.map.consumer().sourceRoot||pathToFileURL(this.map.mapFile));let result2={column:from.column,endColumn:to&&to.column,endLine:to&&to.line,line:from.line,url:fromUrl.toString()};if(fromUrl.protocol===`file:`){if(fileURLToPath)result2.file=fileURLToPath(fromUrl);else throw Error(`file: protocol is not available in this PostCSS build`)}let source=consumer.sourceContentFor(from.source);return source&&(result2.source=source),result2}toJSON(){let json={};for(let name of[`hasBOM`,`css`,`file`,`id`])this[name]!=null&&(json[name]=this[name]);return this.map&&(json.map={...this.map},json.map.consumerCache&&(json.map.consumerCache=void 0)),json}get from(){return this.file||this.id}}return input=Input,Input.default=Input,terminalHighlight&&terminalHighlight.registerInput&&terminalHighlight.registerInput(Input),input}var mapGenerator,hasRequiredMapGenerator;function requireMapGenerator(){if(hasRequiredMapGenerator)return mapGenerator;hasRequiredMapGenerator=1;let{SourceMapConsumer,SourceMapGenerator}=require$$2,{dirname,relative,resolve,sep}=require$$2,{pathToFileURL}=require$$2,Input=requireInput(),sourceMapAvailable=!!(SourceMapConsumer&&SourceMapGenerator),pathAvailable=!!(dirname&&resolve&&relative&&sep);class MapGenerator{constructor(stringify,root2,opts,cssString){this.stringify=stringify,this.mapOpts=opts.map||{},this.root=root2,this.opts=opts,this.css=cssString,this.originalCSS=cssString,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let content;content=this.isInline()?`data:application/json;base64,`+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation==`string`?this.mapOpts.annotation:typeof this.mapOpts.annotation==`function`?this.mapOpts.annotation(this.opts.to,this.root):this.outputFile()+`.map`;let eol=`
|
|
49
|
+
`;this.css.includes(`\r
|
|
50
|
+
`)&&(eol=`\r
|
|
51
|
+
`),this.css+=eol+`/*# sourceMappingURL=`+content+` */`}applyPrevMaps(){for(let prev of this.previous()){let from=this.toUrl(this.path(prev.file)),root2=prev.root||dirname(prev.file),map;this.mapOpts.sourcesContent===!1?(map=new SourceMapConsumer(prev.text),map.sourcesContent&&(map.sourcesContent=null)):map=prev.consumer(),this.map.applySourceMap(map,from,this.toUrl(this.path(root2)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1){if(this.root){let node2;for(let i2=this.root.nodes.length-1;i2>=0;i2--)node2=this.root.nodes[i2],node2.type===`comment`&&node2.text.indexOf(`# sourceMappingURL=`)===0&&this.root.removeChild(i2)}else this.css&&=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,``)}}generate(){if(this.clearAnnotation(),pathAvailable&&sourceMapAvailable&&this.isMap())return this.generateMap();{let result2=``;return this.stringify(this.root,i2=>{result2+=i2}),[result2]}}generateMap(){if(this.root)this.generateString();else if(this.previous().length===1){let prev=this.previous()[0].consumer();prev.file=this.outputFile(),this.map=SourceMapGenerator.fromSourceMap(prev,{ignoreInvalidMapping:!0})}else this.map=new SourceMapGenerator({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 SourceMapGenerator({file:this.outputFile(),ignoreInvalidMapping:!0});let line=1,column=1,noSource=`<no source>`,mapping={generated:{column:0,line:0},original:{column:0,line:0},source:``},lines,last;this.stringify(this.root,(str,node2,type)=>{if(this.css+=str,node2&&type!==`end`&&(mapping.generated.line=line,mapping.generated.column=column-1,node2.source&&node2.source.start?(mapping.source=this.sourcePath(node2),mapping.original.line=node2.source.start.line,mapping.original.column=node2.source.start.column-1,this.map.addMapping(mapping)):(mapping.source=noSource,mapping.original.line=1,mapping.original.column=0,this.map.addMapping(mapping))),lines=str.match(/\n/g),lines?(line+=lines.length,last=str.lastIndexOf(`
|
|
52
|
+
`),column=str.length-last):column+=str.length,node2&&type!==`start`){let p=node2.parent||{raws:{}};(!(node2.type===`decl`||node2.type===`atrule`&&!node2.nodes)||node2!==p.last||p.raws.semicolon)&&(node2.source&&node2.source.end?(mapping.source=this.sourcePath(node2),mapping.original.line=node2.source.end.line,mapping.original.column=node2.source.end.column-1,mapping.generated.line=line,mapping.generated.column=column-2,this.map.addMapping(mapping)):(mapping.source=noSource,mapping.original.line=1,mapping.original.column=0,mapping.generated.line=line,mapping.generated.column=column-1,this.map.addMapping(mapping)))}})}isAnnotation(){return this.isInline()?!0:this.mapOpts.annotation===void 0?!this.previous().length||this.previous().some(i2=>i2.annotation):this.mapOpts.annotation}isInline(){if(this.mapOpts.inline!==void 0)return this.mapOpts.inline;let annotation=this.mapOpts.annotation;return annotation!==void 0&&annotation!==!0?!1:!this.previous().length||this.previous().some(i2=>i2.inline)}isMap(){return this.opts.map===void 0?this.previous().length>0:!!this.opts.map}isSourcesContent(){return this.mapOpts.sourcesContent===void 0?!this.previous().length||this.previous().some(i2=>i2.withContent()):this.mapOpts.sourcesContent}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):`to.css`}path(file){if(this.mapOpts.absolute||file.charCodeAt(0)===60||/^\w+:\/\//.test(file))return file;let cached=this.memoizedPaths.get(file);if(cached)return cached;let from=this.opts.to?dirname(this.opts.to):`.`;typeof this.mapOpts.annotation==`string`&&(from=dirname(resolve(from,this.mapOpts.annotation)));let path=relative(from,file);return this.memoizedPaths.set(file,path),path}previous(){if(!this.previousMaps){if(this.previousMaps=[],this.root)this.root.walk(node2=>{if(node2.source&&node2.source.input.map){let map=node2.source.input.map;this.previousMaps.includes(map)||this.previousMaps.push(map)}});else{let input2=new Input(this.originalCSS,this.opts);input2.map&&this.previousMaps.push(input2.map)}}return this.previousMaps}setSourcesContent(){let already={};if(this.root)this.root.walk(node2=>{if(node2.source){let from=node2.source.input.from;if(from&&!already[from]){already[from]=!0;let fromUrl=this.usesFileUrls?this.toFileUrl(from):this.toUrl(this.path(from));this.map.setSourceContent(fromUrl,node2.source.input.css)}}});else if(this.css){let from=this.opts.from?this.toUrl(this.path(this.opts.from)):`<no source>`;this.map.setSourceContent(from,this.css)}}sourcePath(node2){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(node2.source.input.from):this.toUrl(this.path(node2.source.input.from))}toBase64(str){return Buffer?Buffer.from(str).toString(`base64`):window.btoa(unescape(encodeURIComponent(str)))}toFileUrl(path){let cached=this.memoizedFileURLs.get(path);if(cached)return cached;if(pathToFileURL){let fileURL=pathToFileURL(path).toString();return this.memoizedFileURLs.set(path,fileURL),fileURL}throw Error("`map.absolute` option is not available in this PostCSS build")}toUrl(path){let cached=this.memoizedURLs.get(path);if(cached)return cached;sep===`\\`&&(path=path.replace(/\\/g,`/`));let url=encodeURI(path).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(path,url),url}}return mapGenerator=MapGenerator,mapGenerator}var comment,hasRequiredComment;function requireComment(){if(hasRequiredComment)return comment;hasRequiredComment=1;let Node2=requireNode();class Comment extends Node2{constructor(defaults){super(defaults),this.type=`comment`}}return comment=Comment,Comment.default=Comment,comment}var container,hasRequiredContainer;function requireContainer(){if(hasRequiredContainer)return container;hasRequiredContainer=1;let{isClean,my}=requireSymbols(),Declaration=requireDeclaration(),Comment=requireComment(),Node2=requireNode(),parse,Rule,AtRule,Root;function cleanSource(nodes){return nodes.map(i2=>(i2.nodes&&=cleanSource(i2.nodes),delete i2.source,i2))}function markDirtyUp(node2){if(node2[isClean]=!1,node2.proxyOf.nodes)for(let i2 of node2.proxyOf.nodes)markDirtyUp(i2)}class Container extends Node2{append(...children){for(let child of children){let nodes=this.normalize(child,this.last);for(let node2 of nodes)this.proxyOf.nodes.push(node2)}return this.markDirty(),this}cleanRaws(keepBetween){if(super.cleanRaws(keepBetween),this.nodes)for(let node2 of this.nodes)node2.cleanRaws(keepBetween)}each(callback){if(!this.proxyOf.nodes)return;let iterator=this.getIterator(),index2,result2;for(;this.indexes[iterator]<this.proxyOf.nodes.length&&(index2=this.indexes[iterator],result2=callback(this.proxyOf.nodes[index2],index2),result2!==!1);)this.indexes[iterator]+=1;return delete this.indexes[iterator],result2}every(condition){return this.nodes.every(condition)}getIterator(){this.lastEach||=0,this.indexes||={},this.lastEach+=1;let iterator=this.lastEach;return this.indexes[iterator]=0,iterator}getProxyProcessor(){return{get(node2,prop){return prop===`proxyOf`?node2:node2[prop]?prop===`each`||typeof prop==`string`&&prop.startsWith(`walk`)?(...args)=>node2[prop](...args.map(i2=>typeof i2==`function`?(child,index2)=>i2(child.toProxy(),index2):i2)):prop===`every`||prop===`some`?cb=>node2[prop]((child,...other)=>cb(child.toProxy(),...other)):prop===`root`?()=>node2.root().toProxy():prop===`nodes`?node2.nodes.map(i2=>i2.toProxy()):prop===`first`||prop===`last`?node2[prop].toProxy():node2[prop]:node2[prop]},set(node2,prop,value){return node2[prop]===value||(node2[prop]=value,(prop===`name`||prop===`params`||prop===`selector`)&&node2.markDirty(),!0)}}}index(child){return typeof child==`number`?child:(child.proxyOf&&(child=child.proxyOf),this.proxyOf.nodes.indexOf(child))}insertAfter(exist,add){let existIndex=this.index(exist),nodes=this.normalize(add,this.proxyOf.nodes[existIndex]).reverse();existIndex=this.index(exist);for(let node2 of nodes)this.proxyOf.nodes.splice(existIndex+1,0,node2);let index2;for(let id in this.indexes)index2=this.indexes[id],existIndex<index2&&(this.indexes[id]=index2+nodes.length);return this.markDirty(),this}insertBefore(exist,add){let existIndex=this.index(exist),type=existIndex===0&&`prepend`,nodes=this.normalize(add,this.proxyOf.nodes[existIndex],type).reverse();existIndex=this.index(exist);for(let node2 of nodes)this.proxyOf.nodes.splice(existIndex,0,node2);let index2;for(let id in this.indexes)index2=this.indexes[id],existIndex<=index2&&(this.indexes[id]=index2+nodes.length);return this.markDirty(),this}normalize(nodes,sample){if(typeof nodes==`string`)nodes=cleanSource(parse(nodes).nodes);else if(nodes===void 0)nodes=[];else if(Array.isArray(nodes)){nodes=nodes.slice(0);for(let i2 of nodes)i2.parent&&i2.parent.removeChild(i2,`ignore`)}else if(nodes.type===`root`&&this.type!==`document`){nodes=nodes.nodes.slice(0);for(let i2 of nodes)i2.parent&&i2.parent.removeChild(i2,`ignore`)}else if(nodes.type)nodes=[nodes];else if(nodes.prop){if(nodes.value===void 0)throw Error(`Value field is missed in node creation`);typeof nodes.value!=`string`&&(nodes.value=String(nodes.value)),nodes=[new Declaration(nodes)]}else if(nodes.selector)nodes=[new Rule(nodes)];else if(nodes.name)nodes=[new AtRule(nodes)];else if(nodes.text)nodes=[new Comment(nodes)];else throw Error(`Unknown node type in node creation`);return nodes.map(i2=>(i2[my]||Container.rebuild(i2),i2=i2.proxyOf,i2.parent&&i2.parent.removeChild(i2),i2[isClean]&&markDirtyUp(i2),i2.raws.before===void 0&&sample&&sample.raws.before!==void 0&&(i2.raws.before=sample.raws.before.replace(/\S/g,``)),i2.parent=this.proxyOf,i2))}prepend(...children){children=children.reverse();for(let child of children){let nodes=this.normalize(child,this.first,`prepend`).reverse();for(let node2 of nodes)this.proxyOf.nodes.unshift(node2);for(let id in this.indexes)this.indexes[id]=this.indexes[id]+nodes.length}return this.markDirty(),this}push(child){return child.parent=this,this.proxyOf.nodes.push(child),this}removeAll(){for(let node2 of this.proxyOf.nodes)node2.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(child){child=this.index(child),this.proxyOf.nodes[child].parent=void 0,this.proxyOf.nodes.splice(child,1);let index2;for(let id in this.indexes)index2=this.indexes[id],index2>=child&&(this.indexes[id]=index2-1);return this.markDirty(),this}replaceValues(pattern,opts,callback){return callback||(callback=opts,opts={}),this.walkDecls(decl=>{(!opts.props||opts.props.includes(decl.prop))&&(!opts.fast||decl.value.includes(opts.fast))&&(decl.value=decl.value.replace(pattern,callback))}),this.markDirty(),this}some(condition){return this.nodes.some(condition)}walk(callback){return this.each((child,i2)=>{let result2;try{result2=callback(child,i2)}catch(e2){throw child.addToError(e2)}return result2!==!1&&child.walk&&(result2=child.walk(callback)),result2})}walkAtRules(name,callback){return callback?name instanceof RegExp?this.walk((child,i2)=>{if(child.type===`atrule`&&name.test(child.name))return callback(child,i2)}):this.walk((child,i2)=>{if(child.type===`atrule`&&child.name===name)return callback(child,i2)}):(callback=name,this.walk((child,i2)=>{if(child.type===`atrule`)return callback(child,i2)}))}walkComments(callback){return this.walk((child,i2)=>{if(child.type===`comment`)return callback(child,i2)})}walkDecls(prop,callback){return callback?prop instanceof RegExp?this.walk((child,i2)=>{if(child.type===`decl`&&prop.test(child.prop))return callback(child,i2)}):this.walk((child,i2)=>{if(child.type===`decl`&&child.prop===prop)return callback(child,i2)}):(callback=prop,this.walk((child,i2)=>{if(child.type===`decl`)return callback(child,i2)}))}walkRules(selector,callback){return callback?selector instanceof RegExp?this.walk((child,i2)=>{if(child.type===`rule`&&selector.test(child.selector))return callback(child,i2)}):this.walk((child,i2)=>{if(child.type===`rule`&&child.selector===selector)return callback(child,i2)}):(callback=selector,this.walk((child,i2)=>{if(child.type===`rule`)return callback(child,i2)}))}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]}}return Container.registerParse=dependant=>{parse=dependant},Container.registerRule=dependant=>{Rule=dependant},Container.registerAtRule=dependant=>{AtRule=dependant},Container.registerRoot=dependant=>{Root=dependant},container=Container,Container.default=Container,Container.rebuild=node2=>{node2.type===`atrule`?Object.setPrototypeOf(node2,AtRule.prototype):node2.type===`rule`?Object.setPrototypeOf(node2,Rule.prototype):node2.type===`decl`?Object.setPrototypeOf(node2,Declaration.prototype):node2.type===`comment`?Object.setPrototypeOf(node2,Comment.prototype):node2.type===`root`&&Object.setPrototypeOf(node2,Root.prototype),node2[my]=!0,node2.nodes&&node2.nodes.forEach(child=>{Container.rebuild(child)})},container}var document$1,hasRequiredDocument;function requireDocument(){if(hasRequiredDocument)return document$1;hasRequiredDocument=1;let Container=requireContainer(),LazyResult,Processor;class Document2 extends Container{constructor(defaults){super({type:`document`,...defaults}),this.nodes||=[]}toResult(opts={}){return new LazyResult(new Processor,this,opts).stringify()}}return Document2.registerLazyResult=dependant=>{LazyResult=dependant},Document2.registerProcessor=dependant=>{Processor=dependant},document$1=Document2,Document2.default=Document2,document$1}var warnOnce,hasRequiredWarnOnce;function requireWarnOnce(){if(hasRequiredWarnOnce)return warnOnce;hasRequiredWarnOnce=1;let printed={};return warnOnce=function(message){printed[message]||(printed[message]=!0,typeof console<`u`&&console.warn&&console.warn(message))},warnOnce}var warning,hasRequiredWarning;function requireWarning(){if(hasRequiredWarning)return warning;hasRequiredWarning=1;class Warning{constructor(text,opts={}){if(this.type=`warning`,this.text=text,opts.node&&opts.node.source){let range=opts.node.rangeBy(opts);this.line=range.start.line,this.column=range.start.column,this.endLine=range.end.line,this.endColumn=range.end.column}for(let opt in opts)this[opt]=opts[opt]}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}}return warning=Warning,Warning.default=Warning,warning}var result,hasRequiredResult;function requireResult(){if(hasRequiredResult)return result;hasRequiredResult=1;let Warning=requireWarning();class Result{constructor(processor2,root2,opts){this.processor=processor2,this.messages=[],this.root=root2,this.opts=opts,this.css=void 0,this.map=void 0}toString(){return this.css}warn(text,opts={}){opts.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(opts.plugin=this.lastPlugin.postcssPlugin);let warning2=new Warning(text,opts);return this.messages.push(warning2),warning2}warnings(){return this.messages.filter(i2=>i2.type===`warning`)}get content(){return this.css}}return result=Result,Result.default=Result,result}var tokenize,hasRequiredTokenize;function requireTokenize(){if(hasRequiredTokenize)return tokenize;hasRequiredTokenize=1;let RE_AT_END=/[\t\n\f\r "#'()/;[\\\]{}]/g,RE_WORD_END=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,RE_BAD_BRACKET=/.[\r\n"'(/\\]/,RE_HEX_ESCAPE=/[\da-f]/i;return tokenize=function(input2,options={}){let css=input2.css.valueOf(),ignore=options.ignoreErrors,code,next,quote,content,escape,escaped,escapePos,prev,n2,currentToken,length=css.length,pos=0,buffer=[],returned=[];function position(){return pos}function unclosed(what){throw input2.error(`Unclosed `+what,pos)}function endOfFile(){return returned.length===0&&pos>=length}function nextToken(opts){if(returned.length)return returned.pop();if(pos>=length)return;let ignoreUnclosed=opts?opts.ignoreUnclosed:!1;switch(code=css.charCodeAt(pos),code){case 10:case 32:case 9:case 13:case 12:next=pos;do next+=1,code=css.charCodeAt(next);while(code===32||code===10||code===9||code===13||code===12);currentToken=[`space`,css.slice(pos,next)],pos=next-1;break;case 91:case 93:case 123:case 125:case 58:case 59:case 41:{let controlChar=String.fromCharCode(code);currentToken=[controlChar,controlChar,pos];break}case 40:if(prev=buffer.length?buffer.pop()[1]:``,n2=css.charCodeAt(pos+1),prev===`url`&&n2!==39&&n2!==34&&n2!==32&&n2!==10&&n2!==9&&n2!==12&&n2!==13){next=pos;do{if(escaped=!1,next=css.indexOf(`)`,next+1),next===-1){if(ignore||ignoreUnclosed){next=pos;break}unclosed(`bracket`)}for(escapePos=next;css.charCodeAt(escapePos-1)===92;)--escapePos,escaped=!escaped}while(escaped);currentToken=[`brackets`,css.slice(pos,next+1),pos,next],pos=next}else next=css.indexOf(`)`,pos+1),content=css.slice(pos,next+1),next===-1||RE_BAD_BRACKET.test(content)?currentToken=[`(`,`(`,pos]:(currentToken=[`brackets`,content,pos,next],pos=next);break;case 39:case 34:quote=code===39?`'`:`"`,next=pos;do{if(escaped=!1,next=css.indexOf(quote,next+1),next===-1){if(ignore||ignoreUnclosed){next=pos+1;break}unclosed(`string`)}for(escapePos=next;css.charCodeAt(escapePos-1)===92;)--escapePos,escaped=!escaped}while(escaped);currentToken=[`string`,css.slice(pos,next+1),pos,next],pos=next;break;case 64:RE_AT_END.lastIndex=pos+1,RE_AT_END.test(css),next=RE_AT_END.lastIndex===0?css.length-1:RE_AT_END.lastIndex-2,currentToken=[`at-word`,css.slice(pos,next+1),pos,next],pos=next;break;case 92:for(next=pos,escape=!0;css.charCodeAt(next+1)===92;)next+=1,escape=!escape;if(code=css.charCodeAt(next+1),escape&&code!==47&&code!==32&&code!==10&&code!==9&&code!==13&&code!==12&&(next+=1,RE_HEX_ESCAPE.test(css.charAt(next)))){for(;RE_HEX_ESCAPE.test(css.charAt(next+1));)next+=1;css.charCodeAt(next+1)===32&&(next+=1)}currentToken=[`word`,css.slice(pos,next+1),pos,next],pos=next;break;default:code===47&&css.charCodeAt(pos+1)===42?(next=css.indexOf(`*/`,pos+2)+1,next===0&&(ignore||ignoreUnclosed?next=css.length:unclosed(`comment`)),currentToken=[`comment`,css.slice(pos,next+1),pos,next],pos=next):(RE_WORD_END.lastIndex=pos+1,RE_WORD_END.test(css),next=RE_WORD_END.lastIndex===0?css.length-1:RE_WORD_END.lastIndex-2,currentToken=[`word`,css.slice(pos,next+1),pos,next],buffer.push(currentToken),pos=next)}return pos++,currentToken}function back(token){returned.push(token)}return{back,endOfFile,nextToken,position}},tokenize}var atRule,hasRequiredAtRule;function requireAtRule(){if(hasRequiredAtRule)return atRule;hasRequiredAtRule=1;let Container=requireContainer();class AtRule extends Container{constructor(defaults){super(defaults),this.type=`atrule`}append(...children){return this.proxyOf.nodes||(this.nodes=[]),super.append(...children)}prepend(...children){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...children)}}return atRule=AtRule,AtRule.default=AtRule,Container.registerAtRule(AtRule),atRule}var root,hasRequiredRoot;function requireRoot(){if(hasRequiredRoot)return root;hasRequiredRoot=1;let Container=requireContainer(),LazyResult,Processor;class Root extends Container{constructor(defaults){super(defaults),this.type=`root`,this.nodes||=[]}normalize(child,sample,type){let nodes=super.normalize(child);if(sample){if(type===`prepend`)this.nodes.length>1?sample.raws.before=this.nodes[1].raws.before:delete sample.raws.before;else if(this.first!==sample)for(let node2 of nodes)node2.raws.before=sample.raws.before}return nodes}removeChild(child,ignore){let index2=this.index(child);return!ignore&&index2===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[index2].raws.before),super.removeChild(child)}toResult(opts={}){return new LazyResult(new Processor,this,opts).stringify()}}return Root.registerLazyResult=dependant=>{LazyResult=dependant},Root.registerProcessor=dependant=>{Processor=dependant},root=Root,Root.default=Root,Container.registerRoot(Root),root}var list_1,hasRequiredList;function requireList(){if(hasRequiredList)return list_1;hasRequiredList=1;let list={comma(string){return list.split(string,[`,`],!0)},space(string){return list.split(string,[` `,`
|
|
53
|
+
`,` `])},split(string,separators,last){let array=[],current=``,split=!1,func=0,inQuote=!1,prevQuote=``,escape=!1;for(let letter of string)escape?escape=!1:letter===`\\`?escape=!0:inQuote?letter===prevQuote&&(inQuote=!1):letter===`"`||letter===`'`?(inQuote=!0,prevQuote=letter):letter===`(`?func+=1:letter===`)`?func>0&&--func:func===0&&separators.includes(letter)&&(split=!0),split?(current!==``&&array.push(current.trim()),current=``,split=!1):current+=letter;return(last||current!==``)&&array.push(current.trim()),array}};return list_1=list,list.default=list,list_1}var rule,hasRequiredRule;function requireRule(){if(hasRequiredRule)return rule;hasRequiredRule=1;let Container=requireContainer(),list=requireList();class Rule extends Container{constructor(defaults){super(defaults),this.type=`rule`,this.nodes||=[]}get selectors(){return list.comma(this.selector)}set selectors(values){let match=this.selector?this.selector.match(/,\s*/):null,sep=match?match[0]:`,`+this.raw(`between`,`beforeOpen`);this.selector=values.join(sep)}}return rule=Rule,Rule.default=Rule,Container.registerRule(Rule),rule}var parser,hasRequiredParser;function requireParser(){if(hasRequiredParser)return parser;hasRequiredParser=1;let Declaration=requireDeclaration(),tokenizer=requireTokenize(),Comment=requireComment(),AtRule=requireAtRule(),Root=requireRoot(),Rule=requireRule(),SAFE_COMMENT_NEIGHBOR={empty:!0,space:!0};function findLastWithPosition(tokens){for(let i2=tokens.length-1;i2>=0;i2--){let token=tokens[i2],pos=token[3]||token[2];if(pos)return pos}}class Parser{constructor(input2){this.input=input2,this.root=new Root,this.current=this.root,this.spaces=``,this.semicolon=!1,this.createTokenizer(),this.root.source={input:input2,start:{column:1,line:1,offset:0}}}atrule(token){let node2=new AtRule;node2.name=token[1].slice(1),node2.name===``&&this.unnamedAtrule(node2,token),this.init(node2,token[2]);let type,prev,shift,last=!1,open=!1,params=[],brackets=[];for(;!this.tokenizer.endOfFile();){if(token=this.tokenizer.nextToken(),type=token[0],type===`(`||type===`[`?brackets.push(type===`(`?`)`:`]`):type===`{`&&brackets.length>0?brackets.push(`}`):type===brackets[brackets.length-1]&&brackets.pop(),brackets.length===0){if(type===`;`){node2.source.end=this.getPosition(token[2]),node2.source.end.offset++,this.semicolon=!0;break}if(type===`{`){open=!0;break}if(type===`}`){if(params.length>0){for(shift=params.length-1,prev=params[shift];prev&&prev[0]===`space`;)prev=params[--shift];prev&&(node2.source.end=this.getPosition(prev[3]||prev[2]),node2.source.end.offset++)}this.end(token);break}params.push(token)}else params.push(token);if(this.tokenizer.endOfFile()){last=!0;break}}node2.raws.between=this.spacesAndCommentsFromEnd(params),params.length?(node2.raws.afterName=this.spacesAndCommentsFromStart(params),this.raw(node2,`params`,params),last&&(token=params[params.length-1],node2.source.end=this.getPosition(token[3]||token[2]),node2.source.end.offset++,this.spaces=node2.raws.between,node2.raws.between=``)):(node2.raws.afterName=``,node2.params=``),open&&(node2.nodes=[],this.current=node2)}checkMissedSemicolon(tokens){let colon=this.colon(tokens);if(colon===!1)return;let founded=0,token;for(let j=colon-1;j>=0&&(token=tokens[j],!(token[0]!==`space`&&(founded+=1,founded===2)));j--);throw this.input.error(`Missed semicolon`,token[0]===`word`?token[3]+1:token[2])}colon(tokens){let brackets=0,token,type,prev;for(let[i2,element]of tokens.entries()){if(token=element,type=token[0],type===`(`&&(brackets+=1),type===`)`&&--brackets,brackets===0&&type===`:`){if(!prev)this.doubleColon(token);else if(prev[0]===`word`&&prev[1]===`progid`)continue;else return i2}prev=token}return!1}comment(token){let node2=new Comment;this.init(node2,token[2]),node2.source.end=this.getPosition(token[3]||token[2]),node2.source.end.offset++;let text=token[1].slice(2,-2);if(/^\s*$/.test(text))node2.text=``,node2.raws.left=text,node2.raws.right=``;else{let match=text.match(/^(\s*)([^]*\S)(\s*)$/);node2.text=match[2],node2.raws.left=match[1],node2.raws.right=match[3]}}createTokenizer(){this.tokenizer=tokenizer(this.input)}decl(tokens,customProperty){let node2=new Declaration;this.init(node2,tokens[0][2]);let last=tokens[tokens.length-1];for(last[0]===`;`&&(this.semicolon=!0,tokens.pop()),node2.source.end=this.getPosition(last[3]||last[2]||findLastWithPosition(tokens)),node2.source.end.offset++;tokens[0][0]!==`word`;)tokens.length===1&&this.unknownWord(tokens),node2.raws.before+=tokens.shift()[1];for(node2.source.start=this.getPosition(tokens[0][2]),node2.prop=``;tokens.length;){let type=tokens[0][0];if(type===`:`||type===`space`||type===`comment`)break;node2.prop+=tokens.shift()[1]}node2.raws.between=``;let token;for(;tokens.length;){if(token=tokens.shift(),token[0]===`:`){node2.raws.between+=token[1];break}token[0]===`word`&&/\w/.test(token[1])&&this.unknownWord([token]),node2.raws.between+=token[1]}(node2.prop[0]===`_`||node2.prop[0]===`*`)&&(node2.raws.before+=node2.prop[0],node2.prop=node2.prop.slice(1));let firstSpaces=[],next;for(;tokens.length&&(next=tokens[0][0],next===`space`||next===`comment`);)firstSpaces.push(tokens.shift());this.precheckMissedSemicolon(tokens);for(let i2=tokens.length-1;i2>=0;i2--){if(token=tokens[i2],token[1].toLowerCase()===`!important`){node2.important=!0;let string=this.stringFrom(tokens,i2);string=this.spacesFromEnd(tokens)+string,string!==` !important`&&(node2.raws.important=string);break}if(token[1].toLowerCase()===`important`){let cache=tokens.slice(0),str=``;for(let j=i2;j>0;j--){let type=cache[j][0];if(str.trim().indexOf(`!`)===0&&type!==`space`)break;str=cache.pop()[1]+str}str.trim().indexOf(`!`)===0&&(node2.important=!0,node2.raws.important=str,tokens=cache)}if(token[0]!==`space`&&token[0]!==`comment`)break}tokens.some(i2=>i2[0]!==`space`&&i2[0]!==`comment`)&&(node2.raws.between+=firstSpaces.map(i2=>i2[1]).join(``),firstSpaces=[]),this.raw(node2,`value`,firstSpaces.concat(tokens),customProperty),node2.value.includes(`:`)&&!customProperty&&this.checkMissedSemicolon(tokens)}doubleColon(token){throw this.input.error(`Double colon`,{offset:token[2]},{offset:token[2]+token[1].length})}emptyRule(token){let node2=new Rule;this.init(node2,token[2]),node2.selector=``,node2.raws.between=``,this.current=node2}end(token){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||``)+this.spaces,this.spaces=``,this.current.parent?(this.current.source.end=this.getPosition(token[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(token)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||``)+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(token){if(this.spaces+=token[1],this.current.nodes){let prev=this.current.nodes[this.current.nodes.length-1];prev&&prev.type===`rule`&&!prev.raws.ownSemicolon&&(prev.raws.ownSemicolon=this.spaces,this.spaces=``)}}getPosition(offset){let pos=this.input.fromOffset(offset);return{column:pos.col,line:pos.line,offset}}init(node2,offset){this.current.push(node2),node2.source={input:this.input,start:this.getPosition(offset)},node2.raws.before=this.spaces,this.spaces=``,node2.type!==`comment`&&(this.semicolon=!1)}other(start){let end=!1,type=null,colon=!1,bracket=null,brackets=[],customProperty=start[1].startsWith(`--`),tokens=[],token=start;for(;token;){if(type=token[0],tokens.push(token),type===`(`||type===`[`)bracket||=token,brackets.push(type===`(`?`)`:`]`);else if(customProperty&&colon&&type===`{`)bracket||=token,brackets.push(`}`);else if(brackets.length===0){if(type===`;`){if(colon){this.decl(tokens,customProperty);return}break}if(type===`{`){this.rule(tokens);return}if(type===`}`){this.tokenizer.back(tokens.pop()),end=!0;break}type===`:`&&(colon=!0)}else type===brackets[brackets.length-1]&&(brackets.pop(),brackets.length===0&&(bracket=null));token=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(end=!0),brackets.length>0&&this.unclosedBracket(bracket),end&&colon){if(!customProperty)for(;tokens.length&&(token=tokens[tokens.length-1][0],token===`space`||token===`comment`);)this.tokenizer.back(tokens.pop());this.decl(tokens,customProperty)}else this.unknownWord(tokens)}parse(){let token;for(;!this.tokenizer.endOfFile();)switch(token=this.tokenizer.nextToken(),token[0]){case`space`:this.spaces+=token[1];break;case`;`:this.freeSemicolon(token);break;case`}`:this.end(token);break;case`comment`:this.comment(token);break;case`at-word`:this.atrule(token);break;case`{`:this.emptyRule(token);break;default:this.other(token)}this.endFile()}precheckMissedSemicolon(){}raw(node2,prop,tokens,customProperty){let token,type,length=tokens.length,value=``,clean=!0,next,prev;for(let i2=0;i2<length;i2+=1)token=tokens[i2],type=token[0],type===`space`&&i2===length-1&&!customProperty?clean=!1:type===`comment`?(prev=tokens[i2-1]?tokens[i2-1][0]:`empty`,next=tokens[i2+1]?tokens[i2+1][0]:`empty`,!SAFE_COMMENT_NEIGHBOR[prev]&&!SAFE_COMMENT_NEIGHBOR[next]?value.slice(-1)===`,`?clean=!1:value+=token[1]:clean=!1):value+=token[1];if(!clean){let raw=tokens.reduce((all,i2)=>all+i2[1],``);node2.raws[prop]={raw,value}}node2[prop]=value}rule(tokens){tokens.pop();let node2=new Rule;this.init(node2,tokens[0][2]),node2.raws.between=this.spacesAndCommentsFromEnd(tokens),this.raw(node2,`selector`,tokens),this.current=node2}spacesAndCommentsFromEnd(tokens){let lastTokenType,spaces=``;for(;tokens.length&&(lastTokenType=tokens[tokens.length-1][0],lastTokenType===`space`||lastTokenType===`comment`);)spaces=tokens.pop()[1]+spaces;return spaces}spacesAndCommentsFromStart(tokens){let next,spaces=``;for(;tokens.length&&(next=tokens[0][0],next===`space`||next===`comment`);)spaces+=tokens.shift()[1];return spaces}spacesFromEnd(tokens){let lastTokenType,spaces=``;for(;tokens.length&&(lastTokenType=tokens[tokens.length-1][0],lastTokenType===`space`);)spaces=tokens.pop()[1]+spaces;return spaces}stringFrom(tokens,from){let result2=``;for(let i2=from;i2<tokens.length;i2++)result2+=tokens[i2][1];return tokens.splice(from,tokens.length-from),result2}unclosedBlock(){let pos=this.current.source.start;throw this.input.error(`Unclosed block`,pos.line,pos.column)}unclosedBracket(bracket){throw this.input.error(`Unclosed bracket`,{offset:bracket[2]},{offset:bracket[2]+1})}unexpectedClose(token){throw this.input.error(`Unexpected }`,{offset:token[2]},{offset:token[2]+1})}unknownWord(tokens){throw this.input.error(`Unknown word`,{offset:tokens[0][2]},{offset:tokens[0][2]+tokens[0][1].length})}unnamedAtrule(node2,token){throw this.input.error(`At-rule without name`,{offset:token[2]},{offset:token[2]+token[1].length})}}return parser=Parser,parser}var parse_1,hasRequiredParse;function requireParse(){if(hasRequiredParse)return parse_1;hasRequiredParse=1;let Container=requireContainer(),Parser=requireParser(),Input=requireInput();function parse(css,opts){let input2=new Input(css,opts),parser2=new Parser(input2);try{parser2.parse()}catch(e2){throw process.env.NODE_ENV!==`production`&&e2.name===`CssSyntaxError`&&opts&&opts.from&&(/\.scss$/i.test(opts.from)?e2.message+=`
|
|
54
|
+
You tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser`:/\.sass/i.test(opts.from)?e2.message+=`
|
|
55
|
+
You tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser`:/\.less$/i.test(opts.from)&&(e2.message+=`
|
|
56
|
+
You tried to parse Less with the standard CSS parser; try again with the postcss-less parser`)),e2}return parser2.root}return parse_1=parse,parse.default=parse,Container.registerParse(parse),parse_1}var lazyResult,hasRequiredLazyResult;function requireLazyResult(){if(hasRequiredLazyResult)return lazyResult;hasRequiredLazyResult=1;let{isClean,my}=requireSymbols(),MapGenerator=requireMapGenerator(),stringify=requireStringify(),Container=requireContainer(),Document2=requireDocument(),warnOnce2=requireWarnOnce(),Result=requireResult(),parse=requireParse(),Root=requireRoot(),TYPE_TO_CLASS_NAME={atrule:`AtRule`,comment:`Comment`,decl:`Declaration`,document:`Document`,root:`Root`,rule:`Rule`},PLUGIN_PROPS={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},NOT_VISITORS={Once:!0,postcssPlugin:!0,prepare:!0};function isPromise(obj){return typeof obj==`object`&&typeof obj.then==`function`}function getEvents(node2){let key=!1,type=TYPE_TO_CLASS_NAME[node2.type];return node2.type===`decl`?key=node2.prop.toLowerCase():node2.type===`atrule`&&(key=node2.name.toLowerCase()),key&&node2.append?[type,type+`-`+key,0,type+`Exit`,type+`Exit-`+key]:key?[type,type+`-`+key,type+`Exit`,type+`Exit-`+key]:node2.append?[type,0,type+`Exit`]:[type,type+`Exit`]}function toStack(node2){let events;return events=node2.type===`document`?[`Document`,0,`DocumentExit`]:node2.type===`root`?[`Root`,0,`RootExit`]:getEvents(node2),{eventIndex:0,events,iterator:0,node:node2,visitorIndex:0,visitors:[]}}function cleanMarks(node2){return node2[isClean]=!1,node2.nodes&&node2.nodes.forEach(i2=>cleanMarks(i2)),node2}let postcss2={};class LazyResult{constructor(processor2,css,opts){this.stringified=!1,this.processed=!1;let root2;if(typeof css==`object`&&css&&(css.type===`root`||css.type===`document`))root2=cleanMarks(css);else if(css instanceof LazyResult||css instanceof Result)root2=cleanMarks(css.root),css.map&&(opts.map===void 0&&(opts.map={}),opts.map.inline||(opts.map.inline=!1),opts.map.prev=css.map);else{let parser2=parse;opts.syntax&&(parser2=opts.syntax.parse),opts.parser&&(parser2=opts.parser),parser2.parse&&(parser2=parser2.parse);try{root2=parser2(css,opts)}catch(error){this.processed=!0,this.error=error}root2&&!root2[my]&&Container.rebuild(root2)}this.result=new Result(processor2,root2,opts),this.helpers={...postcss2,postcss:postcss2,result:this.result},this.plugins=this.processor.plugins.map(plugin=>typeof plugin==`object`&&plugin.prepare?{...plugin,...plugin.prepare(this.result)}:plugin)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||=this.runAsync(),this.processing)}catch(onRejected){return this.async().catch(onRejected)}finally(onFinally){return this.async().then(onFinally,onFinally)}getAsyncError(){throw Error(`Use process(css).then(cb) to work with async plugins`)}handleError(error,node2){let plugin=this.result.lastPlugin;try{if(node2&&node2.addToError(error),this.error=error,error.name===`CssSyntaxError`&&!error.plugin)error.plugin=plugin.postcssPlugin,error.setMessage();else if(plugin.postcssVersion&&process.env.NODE_ENV!==`production`){let pluginName=plugin.postcssPlugin,pluginVer=plugin.postcssVersion,runtimeVer=this.result.processor.version,a2=pluginVer.split(`.`),b=runtimeVer.split(`.`);(a2[0]!==b[0]||parseInt(a2[1])>parseInt(b[1]))&&console.error(`Unknown error from PostCSS plugin. Your current PostCSS version is `+runtimeVer+`, but `+pluginName+` uses `+pluginVer+`. Perhaps this is the source of the error below.`)}}catch(err){console&&console.error&&console.error(err)}return error}prepareVisitors(){this.listeners={};let add=(plugin,type,cb)=>{this.listeners[type]||(this.listeners[type]=[]),this.listeners[type].push([plugin,cb])};for(let plugin of this.plugins)if(typeof plugin==`object`)for(let event in plugin){if(!PLUGIN_PROPS[event]&&/^[A-Z]/.test(event))throw Error(`Unknown event ${event} in ${plugin.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!NOT_VISITORS[event]){if(typeof plugin[event]==`object`)for(let filter in plugin[event])filter===`*`?add(plugin,event,plugin[event][filter]):add(plugin,event+`-`+filter.toLowerCase(),plugin[event][filter]);else typeof plugin[event]==`function`&&add(plugin,event,plugin[event])}}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let i2=0;i2<this.plugins.length;i2++){let plugin=this.plugins[i2],promise=this.runOnRoot(plugin);if(isPromise(promise))try{await promise}catch(error){throw this.handleError(error)}}if(this.prepareVisitors(),this.hasListener){let root2=this.result.root;for(;!root2[isClean];){root2[isClean]=!0;let stack=[toStack(root2)];for(;stack.length>0;){let promise=this.visitTick(stack);if(isPromise(promise))try{await promise}catch(e2){let node2=stack[stack.length-1].node;throw this.handleError(e2,node2)}}}if(this.listeners.OnceExit)for(let[plugin,visitor]of this.listeners.OnceExit){this.result.lastPlugin=plugin;try{if(root2.type===`document`){let roots=root2.nodes.map(subRoot=>visitor(subRoot,this.helpers));await Promise.all(roots)}else await visitor(root2,this.helpers)}catch(e2){throw this.handleError(e2)}}}return this.processed=!0,this.stringify()}runOnRoot(plugin){this.result.lastPlugin=plugin;try{if(typeof plugin==`object`&&plugin.Once){if(this.result.root.type===`document`){let roots=this.result.root.nodes.map(root2=>plugin.Once(root2,this.helpers));return isPromise(roots[0])?Promise.all(roots):roots}return plugin.Once(this.result.root,this.helpers)}if(typeof plugin==`function`)return plugin(this.result.root,this.result)}catch(error){throw this.handleError(error)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let opts=this.result.opts,str=stringify;opts.syntax&&(str=opts.syntax.stringify),opts.stringifier&&(str=opts.stringifier),str.stringify&&(str=str.stringify);let data=new MapGenerator(str,this.result.root,this.result.opts).generate();return this.result.css=data[0],this.result.map=data[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let plugin of this.plugins)if(isPromise(this.runOnRoot(plugin)))throw this.getAsyncError();if(this.prepareVisitors(),this.hasListener){let root2=this.result.root;for(;!root2[isClean];)root2[isClean]=!0,this.walkSync(root2);if(this.listeners.OnceExit){if(root2.type===`document`)for(let subRoot of root2.nodes)this.visitSync(this.listeners.OnceExit,subRoot);else this.visitSync(this.listeners.OnceExit,root2)}}return this.result}then(onFulfilled,onRejected){return process.env.NODE_ENV!==`production`&&(`from`in this.opts||warnOnce2("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(onFulfilled,onRejected)}toString(){return this.css}visitSync(visitors,node2){for(let[plugin,visitor]of visitors){this.result.lastPlugin=plugin;let promise;try{promise=visitor(node2,this.helpers)}catch(e2){throw this.handleError(e2,node2.proxyOf)}if(node2.type!==`root`&&node2.type!==`document`&&!node2.parent)return!0;if(isPromise(promise))throw this.getAsyncError()}}visitTick(stack){let visit2=stack[stack.length-1],{node:node2,visitors}=visit2;if(node2.type!==`root`&&node2.type!==`document`&&!node2.parent){stack.pop();return}if(visitors.length>0&&visit2.visitorIndex<visitors.length){let[plugin,visitor]=visitors[visit2.visitorIndex];visit2.visitorIndex+=1,visit2.visitorIndex===visitors.length&&(visit2.visitors=[],visit2.visitorIndex=0),this.result.lastPlugin=plugin;try{return visitor(node2.toProxy(),this.helpers)}catch(e2){throw this.handleError(e2,node2)}}if(visit2.iterator!==0){let iterator=visit2.iterator,child;for(;child=node2.nodes[node2.indexes[iterator]];)if(node2.indexes[iterator]+=1,!child[isClean]){child[isClean]=!0,stack.push(toStack(child));return}visit2.iterator=0,delete node2.indexes[iterator]}let events=visit2.events;for(;visit2.eventIndex<events.length;){let event=events[visit2.eventIndex];if(visit2.eventIndex+=1,event===0){node2.nodes&&node2.nodes.length&&(node2[isClean]=!0,visit2.iterator=node2.getIterator());return}if(this.listeners[event]){visit2.visitors=this.listeners[event];return}}stack.pop()}walkSync(node2){node2[isClean]=!0;let events=getEvents(node2);for(let event of events)if(event===0)node2.nodes&&node2.each(child=>{child[isClean]||this.walkSync(child)});else{let visitors=this.listeners[event];if(visitors&&this.visitSync(visitors,node2.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return`LazyResult`}}return LazyResult.registerPostcss=dependant=>{postcss2=dependant},lazyResult=LazyResult,LazyResult.default=LazyResult,Root.registerLazyResult(LazyResult),Document2.registerLazyResult(LazyResult),lazyResult}var noWorkResult,hasRequiredNoWorkResult;function requireNoWorkResult(){if(hasRequiredNoWorkResult)return noWorkResult;hasRequiredNoWorkResult=1;let MapGenerator=requireMapGenerator(),stringify=requireStringify(),warnOnce2=requireWarnOnce(),parse=requireParse(),Result=requireResult();class NoWorkResult{constructor(processor2,css,opts){css=css.toString(),this.stringified=!1,this._processor=processor2,this._css=css,this._opts=opts,this._map=void 0;let root2,str=stringify;this.result=new Result(this._processor,root2,this._opts),this.result.css=css;let self2=this;Object.defineProperty(this.result,"root",{get(){return self2.root}});let map=new MapGenerator(str,root2,this._opts,css);if(map.isMap()){let[generatedCSS,generatedMap]=map.generate();generatedCSS&&(this.result.css=generatedCSS),generatedMap&&(this.result.map=generatedMap)}else map.clearAnnotation(),this.result.css=map.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(onRejected){return this.async().catch(onRejected)}finally(onFinally){return this.async().then(onFinally,onFinally)}sync(){if(this.error)throw this.error;return this.result}then(onFulfilled,onRejected){return process.env.NODE_ENV!==`production`&&(`from`in this._opts||warnOnce2("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(onFulfilled,onRejected)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let root2,parser2=parse;try{root2=parser2(this._css,this._opts)}catch(error){this.error=error}if(this.error)throw this.error;return this._root=root2,root2}get[Symbol.toStringTag](){return`NoWorkResult`}}return noWorkResult=NoWorkResult,NoWorkResult.default=NoWorkResult,noWorkResult}var processor,hasRequiredProcessor;function requireProcessor(){if(hasRequiredProcessor)return processor;hasRequiredProcessor=1;let NoWorkResult=requireNoWorkResult(),LazyResult=requireLazyResult(),Document2=requireDocument(),Root=requireRoot();class Processor{constructor(plugins=[]){this.version=`8.4.38`,this.plugins=this.normalize(plugins)}normalize(plugins){let normalized=[];for(let i2 of plugins)if(i2.postcss===!0?i2=i2():i2.postcss&&(i2=i2.postcss),typeof i2==`object`&&Array.isArray(i2.plugins))normalized=normalized.concat(i2.plugins);else if(typeof i2==`object`&&i2.postcssPlugin)normalized.push(i2);else if(typeof i2==`function`)normalized.push(i2);else if(typeof i2==`object`&&(i2.parse||i2.stringify)){if(process.env.NODE_ENV!==`production`)throw Error(`PostCSS syntaxes cannot be used as plugins. Instead, please use one of the syntax/parser/stringifier options as outlined in your PostCSS runner documentation.`)}else throw Error(i2+` is not a PostCSS plugin`);return normalized}process(css,opts={}){return!this.plugins.length&&!opts.parser&&!opts.stringifier&&!opts.syntax?new NoWorkResult(this,css,opts):new LazyResult(this,css,opts)}use(plugin){return this.plugins=this.plugins.concat(this.normalize([plugin])),this}}return processor=Processor,Processor.default=Processor,Root.registerProcessor(Processor),Document2.registerProcessor(Processor),processor}var fromJSON_1,hasRequiredFromJSON;function requireFromJSON(){if(hasRequiredFromJSON)return fromJSON_1;hasRequiredFromJSON=1;let Declaration=requireDeclaration(),PreviousMap=requirePreviousMap(),Comment=requireComment(),AtRule=requireAtRule(),Input=requireInput(),Root=requireRoot(),Rule=requireRule();function fromJSON(json,inputs){if(Array.isArray(json))return json.map(n2=>fromJSON(n2));let{inputs:ownInputs,...defaults}=json;if(ownInputs){inputs=[];for(let input2 of ownInputs){let inputHydrated={...input2,__proto__:Input.prototype};inputHydrated.map&&={...inputHydrated.map,__proto__:PreviousMap.prototype},inputs.push(inputHydrated)}}if(defaults.nodes&&=json.nodes.map(n2=>fromJSON(n2,inputs)),defaults.source){let{inputId,...source}=defaults.source;defaults.source=source,inputId!=null&&(defaults.source.input=inputs[inputId])}if(defaults.type===`root`)return new Root(defaults);if(defaults.type===`decl`)return new Declaration(defaults);if(defaults.type===`rule`)return new Rule(defaults);if(defaults.type===`comment`)return new Comment(defaults);if(defaults.type===`atrule`)return new AtRule(defaults);throw Error(`Unknown node type: `+json.type)}return fromJSON_1=fromJSON,fromJSON.default=fromJSON,fromJSON_1}var postcss_1,hasRequiredPostcss;function requirePostcss(){if(hasRequiredPostcss)return postcss_1;hasRequiredPostcss=1;let CssSyntaxError=requireCssSyntaxError(),Declaration=requireDeclaration(),LazyResult=requireLazyResult(),Container=requireContainer(),Processor=requireProcessor(),stringify=requireStringify(),fromJSON=requireFromJSON(),Document2=requireDocument(),Warning=requireWarning(),Comment=requireComment(),AtRule=requireAtRule(),Result=requireResult(),Input=requireInput(),parse=requireParse(),list=requireList(),Rule=requireRule(),Root=requireRoot(),Node2=requireNode();function postcss2(...plugins){return plugins.length===1&&Array.isArray(plugins[0])&&(plugins=plugins[0]),new Processor(plugins)}return postcss2.plugin=function(name,initializer){let warningPrinted=!1;function creator(...args){console&&console.warn&&!warningPrinted&&(warningPrinted=!0,console.warn(name+`: postcss.plugin was deprecated. Migration guide:
|
|
57
|
+
https://evilmartians.com/chronicles/postcss-8-plugin-migration`),process.env.LANG&&process.env.LANG.startsWith(`cn`)&&console.warn(name+`: 里面 postcss.plugin 被弃用. 迁移指南:
|
|
58
|
+
https://www.w3ctech.com/topic/2226`));let transformer=initializer(...args);return transformer.postcssPlugin=name,transformer.postcssVersion=new Processor().version,transformer}let cache;return Object.defineProperty(creator,"postcss",{get(){return cache||=creator(),cache}}),creator.process=function(css,processOpts,pluginOpts){return postcss2([creator(pluginOpts)]).process(css,processOpts)},creator},postcss2.stringify=stringify,postcss2.parse=parse,postcss2.fromJSON=fromJSON,postcss2.list=list,postcss2.comment=defaults=>new Comment(defaults),postcss2.atRule=defaults=>new AtRule(defaults),postcss2.decl=defaults=>new Declaration(defaults),postcss2.rule=defaults=>new Rule(defaults),postcss2.root=defaults=>new Root(defaults),postcss2.document=defaults=>new Document2(defaults),postcss2.CssSyntaxError=CssSyntaxError,postcss2.Declaration=Declaration,postcss2.Container=Container,postcss2.Processor=Processor,postcss2.Document=Document2,postcss2.Comment=Comment,postcss2.Warning=Warning,postcss2.AtRule=AtRule,postcss2.Result=Result,postcss2.Input=Input,postcss2.Rule=Rule,postcss2.Root=Root,postcss2.Node=Node2,LazyResult.registerPostcss(postcss2),postcss_1=postcss2,postcss2.default=postcss2,postcss_1}const postcss=getDefaultExportFromCjs(requirePostcss());postcss.stringify,postcss.fromJSON,postcss.plugin,postcss.parse,postcss.list,postcss.document,postcss.comment,postcss.atRule,postcss.rule,postcss.decl,postcss.root,postcss.CssSyntaxError,postcss.Declaration,postcss.Container,postcss.Processor,postcss.Document,postcss.Comment,postcss.Warning,postcss.AtRule,postcss.Result,postcss.Input,postcss.Rule,postcss.Root,postcss.Node;var NodeType$1=(NodeType2=>(NodeType2[NodeType2.Document=0]=`Document`,NodeType2[NodeType2.DocumentType=1]=`DocumentType`,NodeType2[NodeType2.Element=2]=`Element`,NodeType2[NodeType2.Text=3]=`Text`,NodeType2[NodeType2.CDATA=4]=`CDATA`,NodeType2[NodeType2.Comment=5]=`Comment`,NodeType2))(NodeType$1||{});function parseCSSText(cssText){let res={},listDelimiter=/;(?![^(]*\))/g,propertyDelimiter=/:(.+)/;return cssText.replace(/\/\*.*?\*\//g,``).split(listDelimiter).forEach(function(item){if(item){let tmp=item.split(propertyDelimiter);tmp.length>1&&(res[camelize(tmp[0].trim())]=tmp[1].trim())}}),res}function toCSSText(style){let properties=[];for(let name in style){let value=style[name];if(typeof value!=`string`)continue;let normalizedName=hyphenate(name);properties.push(`${normalizedName}: ${value};`)}return properties.join(` `)}const camelizeRE=/-([a-z])/g,CUSTOM_PROPERTY_REGEX=/^--[a-zA-Z0-9-]+$/,camelize=str=>CUSTOM_PROPERTY_REGEX.test(str)?str:str.replace(camelizeRE,(_,c2)=>c2?c2.toUpperCase():``),hyphenateRE=/\B([A-Z])/g,hyphenate=str=>str.replace(hyphenateRE,`-$1`).toLowerCase();var BaseRRNode=class BaseRRNode{constructor(..._args){__publicField2(this,`parentElement`,null),__publicField2(this,`parentNode`,null),__publicField2(this,`ownerDocument`),__publicField2(this,`firstChild`,null),__publicField2(this,`lastChild`,null),__publicField2(this,`previousSibling`,null),__publicField2(this,`nextSibling`,null),__publicField2(this,`ELEMENT_NODE`,1),__publicField2(this,`TEXT_NODE`,3),__publicField2(this,`nodeType`),__publicField2(this,`nodeName`),__publicField2(this,`RRNodeType`)}get childNodes(){let childNodes2=[],childIterator=this.firstChild;for(;childIterator;)childNodes2.push(childIterator),childIterator=childIterator.nextSibling;return childNodes2}contains(node2){if(!(node2 instanceof BaseRRNode)||node2.ownerDocument!==this.ownerDocument)return!1;if(node2===this)return!0;for(;node2.parentNode;){if(node2.parentNode===this)return!0;node2=node2.parentNode}return!1}appendChild(_newChild){throw Error(`RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.`)}insertBefore(_newChild,_refChild){throw Error(`RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.`)}removeChild(_node){throw Error(`RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.`)}toString(){return`RRNode`}},BaseRRDocument=class BaseRRDocument extends BaseRRNode{constructor(...args){super(args),__publicField2(this,`nodeType`,9),__publicField2(this,`nodeName`,`#document`),__publicField2(this,`compatMode`,`CSS1Compat`),__publicField2(this,`RRNodeType`,NodeType$1.Document),__publicField2(this,`textContent`,null),this.ownerDocument=this}get documentElement(){return this.childNodes.find(node2=>node2.RRNodeType===NodeType$1.Element&&node2.tagName===`HTML`)||null}get body(){return this.documentElement?.childNodes.find(node2=>node2.RRNodeType===NodeType$1.Element&&node2.tagName===`BODY`)||null}get head(){return this.documentElement?.childNodes.find(node2=>node2.RRNodeType===NodeType$1.Element&&node2.tagName===`HEAD`)||null}get implementation(){return this}get firstElementChild(){return this.documentElement}appendChild(newChild){let nodeType=newChild.RRNodeType;if((nodeType===NodeType$1.Element||nodeType===NodeType$1.DocumentType)&&this.childNodes.some(s2=>s2.RRNodeType===nodeType))throw Error(`RRDomException: Failed to execute 'appendChild' on 'RRNode': Only one ${nodeType===NodeType$1.Element?`RRElement`:`RRDoctype`} on RRDocument allowed.`);let child=appendChild(this,newChild);return child.parentElement=null,child}insertBefore(newChild,refChild){let nodeType=newChild.RRNodeType;if((nodeType===NodeType$1.Element||nodeType===NodeType$1.DocumentType)&&this.childNodes.some(s2=>s2.RRNodeType===nodeType))throw Error(`RRDomException: Failed to execute 'insertBefore' on 'RRNode': Only one ${nodeType===NodeType$1.Element?`RRElement`:`RRDoctype`} on RRDocument allowed.`);let child=insertBefore(this,newChild,refChild);return child.parentElement=null,child}removeChild(node2){return removeChild(this,node2)}open(){this.firstChild=null,this.lastChild=null}close(){}write(content){let publicId;if(content===`<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">`?publicId=`-//W3C//DTD XHTML 1.0 Transitional//EN`:content===`<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">`&&(publicId=`-//W3C//DTD HTML 4.0 Transitional//EN`),publicId){let doctype=this.createDocumentType(`html`,publicId,``);this.open(),this.appendChild(doctype)}}createDocument(_namespace,_qualifiedName,_doctype){return new BaseRRDocument}createDocumentType(qualifiedName,publicId,systemId){let doctype=new BaseRRDocumentType(qualifiedName,publicId,systemId);return doctype.ownerDocument=this,doctype}createElement(tagName){let element=new BaseRRElement(tagName);return element.ownerDocument=this,element}createElementNS(_namespaceURI,qualifiedName){return this.createElement(qualifiedName)}createTextNode(data){let text=new BaseRRText(data);return text.ownerDocument=this,text}createComment(data){let comment2=new BaseRRComment(data);return comment2.ownerDocument=this,comment2}createCDATASection(data){let CDATASection=new BaseRRCDATASection(data);return CDATASection.ownerDocument=this,CDATASection}toString(){return`RRDocument`}},BaseRRDocumentType=class extends BaseRRNode{constructor(qualifiedName,publicId,systemId){super(),__publicField2(this,`nodeType`,10),__publicField2(this,`RRNodeType`,NodeType$1.DocumentType),__publicField2(this,`name`),__publicField2(this,`publicId`),__publicField2(this,`systemId`),__publicField2(this,`textContent`,null),this.name=qualifiedName,this.publicId=publicId,this.systemId=systemId,this.nodeName=qualifiedName}toString(){return`RRDocumentType`}},BaseRRElement=class extends BaseRRNode{constructor(tagName){super(),__publicField2(this,`nodeType`,1),__publicField2(this,`RRNodeType`,NodeType$1.Element),__publicField2(this,`tagName`),__publicField2(this,`attributes`,{}),__publicField2(this,`shadowRoot`,null),__publicField2(this,`scrollLeft`),__publicField2(this,`scrollTop`),this.tagName=tagName.toUpperCase(),this.nodeName=tagName.toUpperCase()}get textContent(){let result2=``;return this.childNodes.forEach(node2=>result2+=node2.textContent),result2}set textContent(textContent2){this.firstChild=null,this.lastChild=null,this.appendChild(this.ownerDocument.createTextNode(textContent2))}get classList(){return new ClassList(this.attributes.class,newClassName=>{this.attributes.class=newClassName})}get id(){return this.attributes.id||``}get className(){return this.attributes.class||``}get style(){let style=this.attributes.style?parseCSSText(this.attributes.style):{},hyphenateRE2=/\B([A-Z])/g;return style.setProperty=(name,value,priority)=>{if(hyphenateRE2.test(name))return;let normalizedName=camelize(name);value?style[normalizedName]=value:delete style[normalizedName],priority===`important`&&(style[normalizedName]+=` !important`),this.attributes.style=toCSSText(style)},style.removeProperty=name=>{if(hyphenateRE2.test(name))return``;let normalizedName=camelize(name),value=style[normalizedName]||``;return delete style[normalizedName],this.attributes.style=toCSSText(style),value},style}getAttribute(name){return this.attributes[name]===void 0?null:this.attributes[name]}setAttribute(name,attribute){this.attributes[name]=attribute}setAttributeNS(_namespace,qualifiedName,value){this.setAttribute(qualifiedName,value)}removeAttribute(name){delete this.attributes[name]}appendChild(newChild){return appendChild(this,newChild)}insertBefore(newChild,refChild){return insertBefore(this,newChild,refChild)}removeChild(node2){return removeChild(this,node2)}attachShadow(_init){let shadowRoot2=this.ownerDocument.createElement(`SHADOWROOT`);return this.shadowRoot=shadowRoot2,shadowRoot2}dispatchEvent(_event){return!0}toString(){let attributeString=``;for(let attribute in this.attributes)attributeString+=`${attribute}="${this.attributes[attribute]}" `;return`${this.tagName} ${attributeString}`}},BaseRRMediaElement=class extends BaseRRElement{constructor(){super(...arguments),__publicField2(this,`currentTime`),__publicField2(this,`volume`),__publicField2(this,`paused`),__publicField2(this,`muted`),__publicField2(this,`playbackRate`),__publicField2(this,`loop`)}attachShadow(_init){throw Error(`RRDomException: Failed to execute 'attachShadow' on 'RRElement': This RRElement does not support attachShadow`)}play(){this.paused=!1}pause(){this.paused=!0}},BaseRRDialogElement=class extends BaseRRElement{constructor(){super(...arguments),__publicField2(this,`tagName`,`DIALOG`),__publicField2(this,`nodeName`,`DIALOG`)}get isModal(){return this.getAttribute(`rr_open_mode`)===`modal`}get open(){return this.getAttribute(`open`)!==null}close(){this.removeAttribute(`open`),this.removeAttribute(`rr_open_mode`)}show(){this.setAttribute(`open`,``),this.setAttribute(`rr_open_mode`,`non-modal`)}showModal(){this.setAttribute(`open`,``),this.setAttribute(`rr_open_mode`,`modal`)}},BaseRRText=class extends BaseRRNode{constructor(data){super(),__publicField2(this,`nodeType`,3),__publicField2(this,`nodeName`,`#text`),__publicField2(this,`RRNodeType`,NodeType$1.Text),__publicField2(this,`data`),this.data=data}get textContent(){return this.data}set textContent(textContent2){this.data=textContent2}toString(){return`RRText text=${JSON.stringify(this.data)}`}},BaseRRComment=class extends BaseRRNode{constructor(data){super(),__publicField2(this,`nodeType`,8),__publicField2(this,`nodeName`,`#comment`),__publicField2(this,`RRNodeType`,NodeType$1.Comment),__publicField2(this,`data`),this.data=data}get textContent(){return this.data}set textContent(textContent2){this.data=textContent2}toString(){return`RRComment text=${JSON.stringify(this.data)}`}},BaseRRCDATASection=class extends BaseRRNode{constructor(data){super(),__publicField2(this,`nodeName`,`#cdata-section`),__publicField2(this,`nodeType`,4),__publicField2(this,`RRNodeType`,NodeType$1.CDATA),__publicField2(this,`data`),this.data=data}get textContent(){return this.data}set textContent(textContent2){this.data=textContent2}toString(){return`RRCDATASection data=${JSON.stringify(this.data)}`}},ClassList=class{constructor(classText,onChange){if(__publicField2(this,`onChange`),__publicField2(this,`classes`,[]),__publicField2(this,`add`,(...classNames)=>{for(let item of classNames){let className=String(item);this.classes.indexOf(className)>=0||this.classes.push(className)}this.onChange&&this.onChange(this.classes.join(` `))}),__publicField2(this,`remove`,(...classNames)=>{this.classes=this.classes.filter(item=>classNames.indexOf(item)===-1),this.onChange&&this.onChange(this.classes.join(` `))}),classText){let classes=classText.trim().split(/\s+/);this.classes.push(...classes)}this.onChange=onChange}};function appendChild(parent,newChild){return newChild.parentNode&&newChild.parentNode.removeChild(newChild),parent.lastChild?(parent.lastChild.nextSibling=newChild,newChild.previousSibling=parent.lastChild):(parent.firstChild=newChild,newChild.previousSibling=null),parent.lastChild=newChild,newChild.nextSibling=null,newChild.parentNode=parent,newChild.parentElement=parent,newChild.ownerDocument=parent.ownerDocument,newChild}function insertBefore(parent,newChild,refChild){if(!refChild)return appendChild(parent,newChild);if(refChild.parentNode!==parent)throw Error(`Failed to execute 'insertBefore' on 'RRNode': The RRNode before which the new node is to be inserted is not a child of this RRNode.`);return newChild===refChild?newChild:(newChild.parentNode&&newChild.parentNode.removeChild(newChild),newChild.previousSibling=refChild.previousSibling,refChild.previousSibling=newChild,newChild.nextSibling=refChild,newChild.previousSibling?newChild.previousSibling.nextSibling=newChild:parent.firstChild=newChild,newChild.parentElement=parent,newChild.parentNode=parent,newChild.ownerDocument=parent.ownerDocument,newChild)}function removeChild(parent,child){if(child.parentNode!==parent)throw Error(`Failed to execute 'removeChild' on 'RRNode': The RRNode to be removed is not a child of this RRNode.`);return child.previousSibling?child.previousSibling.nextSibling=child.nextSibling:parent.firstChild=child.nextSibling,child.nextSibling?child.nextSibling.previousSibling=child.previousSibling:parent.lastChild=child.previousSibling,child.previousSibling=null,child.nextSibling=null,child.parentElement=null,child.parentNode=null,child}var NodeType$2=(NodeType2=>(NodeType2[NodeType2.PLACEHOLDER=0]=`PLACEHOLDER`,NodeType2[NodeType2.ELEMENT_NODE=1]=`ELEMENT_NODE`,NodeType2[NodeType2.ATTRIBUTE_NODE=2]=`ATTRIBUTE_NODE`,NodeType2[NodeType2.TEXT_NODE=3]=`TEXT_NODE`,NodeType2[NodeType2.CDATA_SECTION_NODE=4]=`CDATA_SECTION_NODE`,NodeType2[NodeType2.ENTITY_REFERENCE_NODE=5]=`ENTITY_REFERENCE_NODE`,NodeType2[NodeType2.ENTITY_NODE=6]=`ENTITY_NODE`,NodeType2[NodeType2.PROCESSING_INSTRUCTION_NODE=7]=`PROCESSING_INSTRUCTION_NODE`,NodeType2[NodeType2.COMMENT_NODE=8]=`COMMENT_NODE`,NodeType2[NodeType2.DOCUMENT_NODE=9]=`DOCUMENT_NODE`,NodeType2[NodeType2.DOCUMENT_TYPE_NODE=10]=`DOCUMENT_TYPE_NODE`,NodeType2[NodeType2.DOCUMENT_FRAGMENT_NODE=11]=`DOCUMENT_FRAGMENT_NODE`,NodeType2))(NodeType$2||{});const NAMESPACES={svg:`http://www.w3.org/2000/svg`,"xlink:href":`http://www.w3.org/1999/xlink`,xmlns:`http://www.w3.org/2000/xmlns/`},SVGTagMap={altglyph:`altGlyph`,altglyphdef:`altGlyphDef`,altglyphitem:`altGlyphItem`,animatecolor:`animateColor`,animatemotion:`animateMotion`,animatetransform:`animateTransform`,clippath:`clipPath`,feblend:`feBlend`,fecolormatrix:`feColorMatrix`,fecomponenttransfer:`feComponentTransfer`,fecomposite:`feComposite`,feconvolvematrix:`feConvolveMatrix`,fediffuselighting:`feDiffuseLighting`,fedisplacementmap:`feDisplacementMap`,fedistantlight:`feDistantLight`,fedropshadow:`feDropShadow`,feflood:`feFlood`,fefunca:`feFuncA`,fefuncb:`feFuncB`,fefuncg:`feFuncG`,fefuncr:`feFuncR`,fegaussianblur:`feGaussianBlur`,feimage:`feImage`,femerge:`feMerge`,femergenode:`feMergeNode`,femorphology:`feMorphology`,feoffset:`feOffset`,fepointlight:`fePointLight`,fespecularlighting:`feSpecularLighting`,fespotlight:`feSpotLight`,fetile:`feTile`,feturbulence:`feTurbulence`,foreignobject:`foreignObject`,glyphref:`glyphRef`,lineargradient:`linearGradient`,radialgradient:`radialGradient`};let createdNodeSet=null;function diff(oldTree,newTree,replayer,rrnodeMirror=newTree.mirror||newTree.ownerDocument.mirror){oldTree=diffBeforeUpdatingChildren(oldTree,newTree,replayer,rrnodeMirror),diffChildren(oldTree,newTree,replayer,rrnodeMirror),diffAfterUpdatingChildren(oldTree,newTree,replayer)}function diffBeforeUpdatingChildren(oldTree,newTree,replayer,rrnodeMirror){var _a2;if(replayer.afterAppend&&!createdNodeSet&&(createdNodeSet=new WeakSet,setTimeout(()=>{createdNodeSet=null},0)),!sameNodeType(oldTree,newTree)){let calibratedOldTree=createOrGetNode(newTree,replayer.mirror,rrnodeMirror);(_a2=oldTree.parentNode)==null||_a2.replaceChild(calibratedOldTree,oldTree),oldTree=calibratedOldTree}switch(newTree.RRNodeType){case NodeType$1.Document:if(!nodeMatching(oldTree,newTree,replayer.mirror,rrnodeMirror)){let newMeta=rrnodeMirror.getMeta(newTree);newMeta&&(replayer.mirror.removeNodeFromMap(oldTree),oldTree.close(),oldTree.open(),replayer.mirror.add(oldTree,newMeta),createdNodeSet?.add(oldTree))}break;case NodeType$1.Element:{let oldElement=oldTree,newRRElement=newTree;switch(newRRElement.tagName){case`IFRAME`:{let oldContentDocument=oldTree.contentDocument;if(!oldContentDocument)break;diff(oldContentDocument,newTree.contentDocument,replayer,rrnodeMirror);break}}newRRElement.shadowRoot&&(oldElement.shadowRoot||oldElement.attachShadow({mode:`open`}),diffChildren(oldElement.shadowRoot,newRRElement.shadowRoot,replayer,rrnodeMirror)),diffProps(oldElement,newRRElement,rrnodeMirror);break}}return oldTree}function diffAfterUpdatingChildren(oldTree,newTree,replayer){var _a2;switch(newTree.RRNodeType){case NodeType$1.Document:{let scrollData=newTree.scrollData;scrollData&&replayer.applyScroll(scrollData,!0);break}case NodeType$1.Element:{let oldElement=oldTree,newRRElement=newTree;switch(newRRElement.scrollData&&replayer.applyScroll(newRRElement.scrollData,!0),newRRElement.inputData&&replayer.applyInput(newRRElement.inputData),newRRElement.tagName){case`AUDIO`:case`VIDEO`:{let oldMediaElement=oldTree,newMediaRRElement=newRRElement;newMediaRRElement.paused!==void 0&&(newMediaRRElement.paused?oldMediaElement.pause():oldMediaElement.play()),newMediaRRElement.muted!==void 0&&(oldMediaElement.muted=newMediaRRElement.muted),newMediaRRElement.volume!==void 0&&(oldMediaElement.volume=newMediaRRElement.volume),newMediaRRElement.currentTime!==void 0&&(oldMediaElement.currentTime=newMediaRRElement.currentTime),newMediaRRElement.playbackRate!==void 0&&(oldMediaElement.playbackRate=newMediaRRElement.playbackRate),newMediaRRElement.loop!==void 0&&(oldMediaElement.loop=newMediaRRElement.loop);break}case`CANVAS`:{let rrCanvasElement=newTree;if(rrCanvasElement.rr_dataURL!==null){let image=document.createElement(`img`);image.onload=()=>{let ctx=oldElement.getContext(`2d`);ctx&&ctx.drawImage(image,0,0,image.width,image.height)},image.src=rrCanvasElement.rr_dataURL}rrCanvasElement.canvasMutations.forEach(canvasMutation2=>replayer.applyCanvas(canvasMutation2.event,canvasMutation2.mutation,oldTree));break}case`STYLE`:{let styleSheet=oldElement.sheet;styleSheet&&newTree.rules.forEach(data=>replayer.applyStyleSheetMutation(data,styleSheet));break}case`DIALOG`:{let dialog=oldElement,rrDialog=newRRElement,wasOpen=dialog.open,wasModal=dialog.matches(`dialog:modal`),shouldBeOpen=rrDialog.open,shouldBeModal=rrDialog.isModal,modalChanged=wasModal!==shouldBeModal,openChanged=wasOpen!==shouldBeOpen;if((modalChanged||wasOpen&&openChanged)&&dialog.close(),shouldBeOpen&&(openChanged||modalChanged))try{shouldBeModal?dialog.showModal():dialog.show()}catch(e2){console.warn(e2)}break}}break}case NodeType$1.Text:case NodeType$1.Comment:case NodeType$1.CDATA:oldTree.textContent!==newTree.data&&(oldTree.textContent=newTree.data)}createdNodeSet?.has(oldTree)&&(createdNodeSet.delete(oldTree),(_a2=replayer.afterAppend)==null||_a2.call(replayer,oldTree,replayer.mirror.getId(oldTree)))}function diffProps(oldTree,newTree,rrnodeMirror){let oldAttributes=oldTree.attributes,newAttributes=newTree.attributes;for(let name in newAttributes){let newValue=newAttributes[name];if(rrnodeMirror.getMeta(newTree)?.isSVG&&NAMESPACES[name])oldTree.setAttributeNS(NAMESPACES[name],name,newValue);else if(newTree.tagName===`CANVAS`&&name===`rr_dataURL`){let image=document.createElement(`img`);image.src=newValue,image.onload=()=>{let ctx=oldTree.getContext(`2d`);ctx&&ctx.drawImage(image,0,0,image.width,image.height)}}else if(newTree.tagName===`IFRAME`&&name===`srcdoc`)continue;else try{oldTree.setAttribute(name,newValue)}catch(err){console.warn(err)}}for(let{name}of Array.from(oldAttributes))name in newAttributes||oldTree.removeAttribute(name);newTree.scrollLeft&&(oldTree.scrollLeft=newTree.scrollLeft),newTree.scrollTop&&(oldTree.scrollTop=newTree.scrollTop)}function diffChildren(oldTree,newTree,replayer,rrnodeMirror){let oldChildren=Array.from(oldTree.childNodes),newChildren=newTree.childNodes;if(oldChildren.length===0&&newChildren.length===0)return;let oldStartIndex=0,oldEndIndex=oldChildren.length-1,newStartIndex=0,newEndIndex=newChildren.length-1,oldStartNode=oldChildren[oldStartIndex],oldEndNode=oldChildren[oldEndIndex],newStartNode=newChildren[newStartIndex],newEndNode=newChildren[newEndIndex],oldIdToIndex,indexInOld;for(;oldStartIndex<=oldEndIndex&&newStartIndex<=newEndIndex;)if(oldStartNode===void 0)oldStartNode=oldChildren[++oldStartIndex];else if(oldEndNode===void 0)oldEndNode=oldChildren[--oldEndIndex];else if(nodeMatching(oldStartNode,newStartNode,replayer.mirror,rrnodeMirror))oldStartNode=oldChildren[++oldStartIndex],newStartNode=newChildren[++newStartIndex];else if(nodeMatching(oldEndNode,newEndNode,replayer.mirror,rrnodeMirror))oldEndNode=oldChildren[--oldEndIndex],newEndNode=newChildren[--newEndIndex];else if(nodeMatching(oldStartNode,newEndNode,replayer.mirror,rrnodeMirror)){try{oldTree.insertBefore(oldStartNode,oldEndNode.nextSibling)}catch(e2){console.warn(e2)}oldStartNode=oldChildren[++oldStartIndex],newEndNode=newChildren[--newEndIndex]}else if(nodeMatching(oldEndNode,newStartNode,replayer.mirror,rrnodeMirror)){try{oldTree.insertBefore(oldEndNode,oldStartNode)}catch(e2){console.warn(e2)}oldEndNode=oldChildren[--oldEndIndex],newStartNode=newChildren[++newStartIndex]}else{if(!oldIdToIndex){oldIdToIndex={};for(let i2=oldStartIndex;i2<=oldEndIndex;i2++){let oldChild2=oldChildren[i2];oldChild2&&replayer.mirror.hasNode(oldChild2)&&(oldIdToIndex[replayer.mirror.getId(oldChild2)]=i2)}}indexInOld=oldIdToIndex[rrnodeMirror.getId(newStartNode)];let nodeToMove=oldChildren[indexInOld];if(indexInOld!==void 0&&nodeToMove&&nodeMatching(nodeToMove,newStartNode,replayer.mirror,rrnodeMirror)){try{oldTree.insertBefore(nodeToMove,oldStartNode)}catch(e2){console.warn(e2)}oldChildren[indexInOld]=void 0}else{let newNode=createOrGetNode(newStartNode,replayer.mirror,rrnodeMirror);oldTree.nodeName===`#document`&&oldStartNode&&(newNode.nodeType===newNode.DOCUMENT_TYPE_NODE&&oldStartNode.nodeType===oldStartNode.DOCUMENT_TYPE_NODE||newNode.nodeType===newNode.ELEMENT_NODE&&oldStartNode.nodeType===oldStartNode.ELEMENT_NODE)&&(oldTree.removeChild(oldStartNode),replayer.mirror.removeNodeFromMap(oldStartNode),oldStartNode=oldChildren[++oldStartIndex]);try{oldTree.insertBefore(newNode,oldStartNode||null)}catch(e2){console.warn(e2)}}newStartNode=newChildren[++newStartIndex]}if(oldStartIndex>oldEndIndex){let referenceRRNode=newChildren[newEndIndex+1],referenceNode=null;for(referenceRRNode&&(referenceNode=replayer.mirror.getNode(rrnodeMirror.getId(referenceRRNode)));newStartIndex<=newEndIndex;++newStartIndex){let newNode=createOrGetNode(newChildren[newStartIndex],replayer.mirror,rrnodeMirror);try{oldTree.insertBefore(newNode,referenceNode)}catch(e2){console.warn(e2)}}}else if(newStartIndex>newEndIndex)for(;oldStartIndex<=oldEndIndex;oldStartIndex++){let node2=oldChildren[oldStartIndex];if(node2&&node2.parentNode===oldTree)try{oldTree.removeChild(node2),replayer.mirror.removeNodeFromMap(node2)}catch(e2){console.warn(e2)}}let oldChild=oldTree.firstChild,newChild=newTree.firstChild;for(;oldChild!==null&&newChild!==null;)diff(oldChild,newChild,replayer,rrnodeMirror),oldChild=oldChild.nextSibling,newChild=newChild.nextSibling}function createOrGetNode(rrNode,domMirror,rrnodeMirror){let nodeId=rrnodeMirror.getId(rrNode),sn=rrnodeMirror.getMeta(rrNode),node2=null;if(nodeId>-1&&(node2=domMirror.getNode(nodeId)),node2!==null&&sameNodeType(node2,rrNode))return node2;switch(rrNode.RRNodeType){case NodeType$1.Document:node2=new Document;break;case NodeType$1.DocumentType:node2=document.implementation.createDocumentType(rrNode.name,rrNode.publicId,rrNode.systemId);break;case NodeType$1.Element:{let tagName=rrNode.tagName.toLowerCase();tagName=SVGTagMap[tagName]||tagName,node2=sn&&`isSVG`in sn&&sn?.isSVG?document.createElementNS(NAMESPACES.svg,tagName):document.createElement(rrNode.tagName);break}case NodeType$1.Text:node2=document.createTextNode(rrNode.data);break;case NodeType$1.Comment:node2=document.createComment(rrNode.data);break;case NodeType$1.CDATA:node2=document.createCDATASection(rrNode.data)}sn&&domMirror.add(node2,{...sn});try{createdNodeSet?.add(node2)}catch{}return node2}function sameNodeType(node1,node2){return node1.nodeType===node2.nodeType?node1.nodeType!==node1.ELEMENT_NODE||node1.tagName.toUpperCase()===node2.tagName:!1}function nodeMatching(node1,node2,domMirror,rrdomMirror){let node1Id=domMirror.getId(node1),node2Id=rrdomMirror.getId(node2);return node1Id===-1||node1Id!==node2Id?!1:sameNodeType(node1,node2)}var RRDocument=class RRDocument extends BaseRRDocument{constructor(mirror2){super(),__publicField2(this,`UNSERIALIZED_STARTING_ID`,-2),__publicField2(this,`_unserializedId`,this.UNSERIALIZED_STARTING_ID),__publicField2(this,`mirror`,createMirror()),__publicField2(this,`scrollData`,null),mirror2&&(this.mirror=mirror2)}get unserializedId(){return this._unserializedId--}createDocument(_namespace,_qualifiedName,_doctype){return new RRDocument}createDocumentType(qualifiedName,publicId,systemId){let documentTypeNode=new RRDocumentType(qualifiedName,publicId,systemId);return documentTypeNode.ownerDocument=this,documentTypeNode}createElement(tagName){let upperTagName=tagName.toUpperCase(),element;switch(upperTagName){case`AUDIO`:case`VIDEO`:element=new RRMediaElement(upperTagName);break;case`IFRAME`:element=new RRIFrameElement(upperTagName,this.mirror);break;case`CANVAS`:element=new RRCanvasElement(upperTagName);break;case`STYLE`:element=new RRStyleElement(upperTagName);break;case`DIALOG`:element=new RRDialogElement(upperTagName);break;default:element=new RRElement(upperTagName)}return element.ownerDocument=this,element}createComment(data){let commentNode=new RRComment(data);return commentNode.ownerDocument=this,commentNode}createCDATASection(data){let sectionNode=new RRCDATASection(data);return sectionNode.ownerDocument=this,sectionNode}createTextNode(data){let textNode=new RRText(data);return textNode.ownerDocument=this,textNode}destroyTree(){this.firstChild=null,this.lastChild=null,this.mirror.reset()}open(){super.open(),this._unserializedId=this.UNSERIALIZED_STARTING_ID}};const RRDocumentType=BaseRRDocumentType;var RRElement=class extends BaseRRElement{constructor(){super(...arguments),__publicField2(this,`inputData`,null),__publicField2(this,`scrollData`,null)}},RRMediaElement=class extends BaseRRMediaElement{},RRDialogElement=class extends BaseRRDialogElement{},RRCanvasElement=class extends RRElement{constructor(){super(...arguments),__publicField2(this,`rr_dataURL`,null),__publicField2(this,`canvasMutations`,[])}getContext(){return null}},RRStyleElement=class extends RRElement{constructor(){super(...arguments),__publicField2(this,`rules`,[])}},RRIFrameElement=class extends RRElement{constructor(upperTagName,mirror2){super(upperTagName),__publicField2(this,`contentDocument`,new RRDocument),this.contentDocument.mirror=mirror2}};const RRText=BaseRRText,RRComment=BaseRRComment,RRCDATASection=BaseRRCDATASection;function getValidTagName(element){return element instanceof HTMLFormElement?`FORM`:element.tagName.toUpperCase()}function buildFromNode(node2,rrdom,domMirror,parentRRNode){let rrNode;switch(node2.nodeType){case NodeType$2.DOCUMENT_NODE:parentRRNode&&parentRRNode.nodeName===`IFRAME`?rrNode=parentRRNode.contentDocument:(rrNode=rrdom,rrNode.compatMode=node2.compatMode);break;case NodeType$2.DOCUMENT_TYPE_NODE:{let documentType=node2;rrNode=rrdom.createDocumentType(documentType.name,documentType.publicId,documentType.systemId);break}case NodeType$2.ELEMENT_NODE:{let elementNode=node2,tagName=getValidTagName(elementNode);rrNode=rrdom.createElement(tagName);let rrElement=rrNode;for(let{name,value}of Array.from(elementNode.attributes))rrElement.attributes[name]=value;elementNode.scrollLeft&&(rrElement.scrollLeft=elementNode.scrollLeft),elementNode.scrollTop&&(rrElement.scrollTop=elementNode.scrollTop);break}case NodeType$2.TEXT_NODE:rrNode=rrdom.createTextNode(node2.textContent||``);break;case NodeType$2.CDATA_SECTION_NODE:rrNode=rrdom.createCDATASection(node2.data);break;case NodeType$2.COMMENT_NODE:rrNode=rrdom.createComment(node2.textContent||``);break;case NodeType$2.DOCUMENT_FRAGMENT_NODE:rrNode=parentRRNode.attachShadow({mode:`open`});break;default:return null}let sn=domMirror.getMeta(node2);return rrdom instanceof RRDocument&&(sn||(sn=getDefaultSN(rrNode,rrdom.unserializedId),domMirror.add(node2,sn)),rrdom.mirror.add(rrNode,{...sn})),rrNode}function buildFromDom(dom,domMirror=createMirror$1(),rrdom=new RRDocument){function walk2(node2,parentRRNode){let rrNode=buildFromNode(node2,rrdom,domMirror,parentRRNode);if(rrNode!==null){if(parentRRNode?.nodeName!==`IFRAME`&&node2.nodeType!==NodeType$2.DOCUMENT_FRAGMENT_NODE&&(parentRRNode?.appendChild(rrNode),rrNode.parentNode=parentRRNode,rrNode.parentElement=parentRRNode),node2.nodeName===`IFRAME`){let iframeDoc=node2.contentDocument;iframeDoc&&walk2(iframeDoc,rrNode)}else(node2.nodeType===NodeType$2.DOCUMENT_NODE||node2.nodeType===NodeType$2.ELEMENT_NODE||node2.nodeType===NodeType$2.DOCUMENT_FRAGMENT_NODE)&&(node2.nodeType===NodeType$2.ELEMENT_NODE&&node2.shadowRoot&&walk2(node2.shadowRoot,rrNode),node2.childNodes.forEach(childNode=>walk2(childNode,rrNode)))}}return walk2(dom,null),rrdom}function createMirror(){return new Mirror22}var Mirror22=class{constructor(){__publicField2(this,`idNodeMap`,new Map),__publicField2(this,`nodeMetaMap`,new WeakMap)}getId(n2){return n2?this.getMeta(n2)?.id??-1:-1}getNode(id){return this.idNodeMap.get(id)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(n2){return this.nodeMetaMap.get(n2)||null}removeNodeFromMap(n2){let id=this.getId(n2);this.idNodeMap.delete(id),n2.childNodes&&n2.childNodes.forEach(childNode=>this.removeNodeFromMap(childNode))}has(id){return this.idNodeMap.has(id)}hasNode(node2){return this.nodeMetaMap.has(node2)}add(n2,meta){let id=meta.id;this.idNodeMap.set(id,n2),this.nodeMetaMap.set(n2,meta)}replace(id,n2){let oldNode=this.getNode(id);if(oldNode){let meta=this.nodeMetaMap.get(oldNode);meta&&this.nodeMetaMap.set(n2,meta)}this.idNodeMap.set(id,n2)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function getDefaultSN(node2,id){switch(node2.RRNodeType){case NodeType$1.Document:return{id,type:node2.RRNodeType,childNodes:[]};case NodeType$1.DocumentType:{let doctype=node2;return{id,type:node2.RRNodeType,name:doctype.name,publicId:doctype.publicId,systemId:doctype.systemId}}case NodeType$1.Element:return{id,type:node2.RRNodeType,tagName:node2.tagName.toLowerCase(),attributes:{},childNodes:[]};case NodeType$1.Text:return{id,type:node2.RRNodeType,textContent:node2.textContent||``};case NodeType$1.Comment:return{id,type:node2.RRNodeType,textContent:node2.textContent||``};case NodeType$1.CDATA:return{id,type:node2.RRNodeType,textContent:``}}}const testableAccessors={Node:[`childNodes`,`parentNode`,`parentElement`,`textContent`,`ownerDocument`],ShadowRoot:[`host`,`styleSheets`],Element:[`shadowRoot`,`querySelector`,`querySelectorAll`],MutationObserver:[]},testableMethods={Node:[`contains`,`getRootNode`],ShadowRoot:[`getSelection`],Element:[],MutationObserver:[`constructor`]},untaintedBasePrototype={},untaintedBaseIframeCleanup={},isAngularZonePresent=()=>!!globalThis.Zone;function getUntaintedPrototype(key){if(untaintedBasePrototype[key])return untaintedBasePrototype[key];let defaultObj=globalThis[key],defaultPrototype=defaultObj.prototype,accessorNames=key in testableAccessors?testableAccessors[key]:void 0,isUntaintedAccessors=!!(accessorNames&&accessorNames.every(accessor=>!!(Object.getOwnPropertyDescriptor(defaultPrototype,accessor)?.get)?.toString().includes(`[native code]`))),methodNames=key in testableMethods?testableMethods[key]:void 0,isUntaintedMethods=!!(methodNames&&methodNames.every(method=>typeof defaultPrototype[method]==`function`&&defaultPrototype[method]?.toString().includes(`[native code]`)));if(isUntaintedAccessors&&isUntaintedMethods&&!isAngularZonePresent())return untaintedBasePrototype[key]=defaultObj.prototype,defaultObj.prototype;try{let iframeEl=document.createElement(`iframe`);iframeEl.style.display=`none`,document.body.appendChild(iframeEl);let win=iframeEl.contentWindow;if(!win)return defaultObj.prototype;let untaintedObject=win[key].prototype;if(!untaintedObject)return iframeEl.remove(),defaultPrototype;let ua=navigator.userAgent;if(ua.includes(`Safari`)&&!ua.includes(`Chrome`))iframeEl.classList.add(`rr-block`),iframeEl.setAttribute(`__rrwebUntaintedMutationObserver`,``),untaintedBaseIframeCleanup[key]=()=>iframeEl.remove();else{for(let name of Object.keys(testableAccessors))typeof win[name]==`function`&&win[name].prototype&&(untaintedBasePrototype[name]??=win[name].prototype);iframeEl.remove()}return untaintedBasePrototype[key]=untaintedObject}catch{return defaultPrototype}}const untaintedAccessorCache={};function getUntaintedAccessor(key,instance,accessor){let cacheKey=`${key}.${String(accessor)}`;if(untaintedAccessorCache[cacheKey])return untaintedAccessorCache[cacheKey].call(instance);let untaintedPrototype=getUntaintedPrototype(key),untaintedAccessor=Object.getOwnPropertyDescriptor(untaintedPrototype,accessor)?.get;return untaintedAccessor?(untaintedAccessorCache[cacheKey]=untaintedAccessor,untaintedAccessor.call(instance)):instance[accessor]}const untaintedMethodCache={};function getUntaintedMethod(key,instance,method){let cacheKey=`${key}.${String(method)}`;if(untaintedMethodCache[cacheKey])return untaintedMethodCache[cacheKey].bind(instance);let untaintedMethod=getUntaintedPrototype(key)[method];return typeof untaintedMethod==`function`?(untaintedMethodCache[cacheKey]=untaintedMethod,untaintedMethod.bind(instance)):instance[method]}function ownerDocument(n2){return getUntaintedAccessor(`Node`,n2,`ownerDocument`)}function childNodes(n2){return getUntaintedAccessor(`Node`,n2,`childNodes`)}function parentNode(n2){return getUntaintedAccessor(`Node`,n2,`parentNode`)}function parentElement(n2){return getUntaintedAccessor(`Node`,n2,`parentElement`)}function textContent(n2){return getUntaintedAccessor(`Node`,n2,`textContent`)}function contains(n2,other){return getUntaintedMethod(`Node`,n2,`contains`)(other)}function getRootNode(n2){return getUntaintedMethod(`Node`,n2,`getRootNode`)()}function host(n2){return!n2||!(`host`in n2)?null:getUntaintedAccessor(`ShadowRoot`,n2,`host`)}function styleSheets(n2){return n2.styleSheets}function shadowRoot(n2){return!n2||!(`shadowRoot`in n2)?null:getUntaintedAccessor(`Element`,n2,`shadowRoot`)}function querySelector(n2,selectors){return getUntaintedAccessor(`Element`,n2,`querySelector`)(selectors)}function querySelectorAll(n2,selectors){return getUntaintedAccessor(`Element`,n2,`querySelectorAll`)(selectors)}function mutationObserverCtor(){return[getUntaintedPrototype(`MutationObserver`).constructor,untaintedBaseIframeCleanup.MutationObserver??(()=>{})]}let nowTimestamp=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(nowTimestamp=()=>new Date().getTime());function patch(source,name,replacement){try{if(!(name in source))return()=>{};let original=source[name],wrapped=replacement(original);return typeof wrapped==`function`&&(wrapped.prototype=wrapped.prototype||{},Object.defineProperties(wrapped,{__rrweb_original__:{enumerable:!1,value:original}})),source[name]=wrapped,()=>{source[name]=original}}catch{return()=>{}}}const index={ownerDocument,childNodes,parentNode,parentElement,textContent,contains,getRootNode,host,styleSheets,shadowRoot,querySelector,querySelectorAll,nowTimestamp,mutationObserverCtor,patch};function on(type,fn,target=document){let options={capture:!0,passive:!0};return target.addEventListener(type,fn,options),()=>target.removeEventListener(type,fn,options)}const DEPARTED_MIRROR_ACCESS_WARNING=`Please stop import mirror directly. Instead of that,\r
|
|
59
|
+
now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
|
|
60
|
+
or you can use record.mirror to access the mirror instance during recording.`;let _mirror={map:{},getId(){return console.error(DEPARTED_MIRROR_ACCESS_WARNING),-1},getNode(){return console.error(DEPARTED_MIRROR_ACCESS_WARNING),null},removeNodeFromMap(){console.error(DEPARTED_MIRROR_ACCESS_WARNING)},has(){return console.error(DEPARTED_MIRROR_ACCESS_WARNING),!1},reset(){console.error(DEPARTED_MIRROR_ACCESS_WARNING)}};typeof window<`u`&&window.Proxy&&window.Reflect&&(_mirror=new Proxy(_mirror,{get(target,prop,receiver){return prop===`map`&&console.error(DEPARTED_MIRROR_ACCESS_WARNING),Reflect.get(target,prop,receiver)}}));function throttle(func,wait,options={}){let timeout=null,previous=0;return function(...args){let now=Date.now();!previous&&options.leading===!1&&(previous=now);let remaining=wait-(now-previous),context=this;remaining<=0||remaining>wait?(timeout&&=(clearTimeout(timeout),null),previous=now,func.apply(context,args)):!timeout&&options.trailing!==!1&&(timeout=setTimeout(()=>{previous=options.leading===!1?0:Date.now(),timeout=null,func.apply(context,args)},remaining))}}function hookSetter(target,key,d,isRevoked,win=window){let original=win.Object.getOwnPropertyDescriptor(target,key);return win.Object.defineProperty(target,key,isRevoked?d:{set(value){setTimeout(()=>{d.set.call(this,value)},0),original&&original.set&&original.set.call(this,value)}}),()=>hookSetter(target,key,original||{},!0)}function getWindowScroll(win){let doc=win.document;return{left:doc.scrollingElement?doc.scrollingElement.scrollLeft:win.pageXOffset===void 0?doc.documentElement.scrollLeft||doc?.body&&index.parentElement(doc.body)?.scrollLeft||doc?.body?.scrollLeft||0:win.pageXOffset,top:doc.scrollingElement?doc.scrollingElement.scrollTop:win.pageYOffset===void 0?doc?.documentElement.scrollTop||doc?.body&&index.parentElement(doc.body)?.scrollTop||doc?.body?.scrollTop||0:win.pageYOffset}}function getWindowHeight(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function getWindowWidth(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function closestElementOfNode(node2){return node2?node2.nodeType===node2.ELEMENT_NODE?node2:index.parentElement(node2):null}function isBlocked(node2,blockClass,blockSelector,checkAncestors){if(!node2)return!1;let el=closestElementOfNode(node2);if(!el)return!1;try{if(typeof blockClass==`string`){if(el.classList.contains(blockClass)||checkAncestors&&el.closest(`.`+blockClass)!==null)return!0}else if(classMatchesRegex(el,blockClass,checkAncestors))return!0}catch{}return!!(blockSelector&&(el.matches(blockSelector)||checkAncestors&&el.closest(blockSelector)!==null))}function isSerialized(n2,mirror2){return mirror2.getId(n2)!==-1}function isIgnored(n2,mirror2,slimDOMOptions){return n2.tagName===`TITLE`&&slimDOMOptions.headTitleMutations?!0:mirror2.getId(n2)===-2}function isAncestorRemoved(target,mirror2){if(isShadowRoot(target))return!1;let id=mirror2.getId(target);if(!mirror2.has(id))return!0;let parent=index.parentNode(target);return parent&&parent.nodeType===target.DOCUMENT_NODE?!1:!parent||isAncestorRemoved(parent,mirror2)}function legacy_isTouchEvent(event){return!!event.changedTouches}function polyfill$1(win=window){`NodeList`in win&&!win.NodeList.prototype.forEach&&(win.NodeList.prototype.forEach=Array.prototype.forEach),`DOMTokenList`in win&&!win.DOMTokenList.prototype.forEach&&(win.DOMTokenList.prototype.forEach=Array.prototype.forEach)}function queueToResolveTrees(queue){let queueNodeMap={},putIntoMap=(m,parent)=>{let nodeInTree={value:m,parent,children:[]};return queueNodeMap[m.node.id]=nodeInTree,nodeInTree},queueNodeTrees=[];for(let mutation of queue){let{nextId,parentId}=mutation;if(nextId&&nextId in queueNodeMap){let nextInTree=queueNodeMap[nextId];if(nextInTree.parent){let idx=nextInTree.parent.children.indexOf(nextInTree);nextInTree.parent.children.splice(idx,0,putIntoMap(mutation,nextInTree.parent))}else{let idx=queueNodeTrees.indexOf(nextInTree);queueNodeTrees.splice(idx,0,putIntoMap(mutation,null))}continue}if(parentId in queueNodeMap){let parentInTree=queueNodeMap[parentId];parentInTree.children.push(putIntoMap(mutation,parentInTree));continue}queueNodeTrees.push(putIntoMap(mutation,null))}return queueNodeTrees}function iterateResolveTree(tree,cb){cb(tree.value);for(let i2=tree.children.length-1;i2>=0;i2--)iterateResolveTree(tree.children[i2],cb)}function isSerializedIframe(n2,mirror2){return!!(n2.nodeName===`IFRAME`&&mirror2.getMeta(n2))}function isSerializedStylesheet(n2,mirror2){return!!(n2.nodeName===`LINK`&&n2.nodeType===n2.ELEMENT_NODE&&n2.getAttribute&&n2.getAttribute(`rel`)===`stylesheet`&&mirror2.getMeta(n2))}function getBaseDimension(node2,rootIframe){let frameElement=node2.ownerDocument?.defaultView?.frameElement;if(!frameElement||frameElement===rootIframe)return{x:0,y:0,relativeScale:1,absoluteScale:1};let frameDimension=frameElement.getBoundingClientRect(),frameBaseDimension=getBaseDimension(frameElement,rootIframe),relativeScale=frameDimension.height/frameElement.clientHeight;return{x:frameDimension.x*frameBaseDimension.relativeScale+frameBaseDimension.x,y:frameDimension.y*frameBaseDimension.relativeScale+frameBaseDimension.y,relativeScale,absoluteScale:frameBaseDimension.absoluteScale*relativeScale}}function hasShadowRoot(n2){return n2?n2 instanceof BaseRRNode&&`shadowRoot`in n2?!!n2.shadowRoot:!!index.shadowRoot(n2):!1}function getNestedRule(rules2,position){let rule2=rules2?.[position[0]];return rule2?position.length===1?rule2:getNestedRule(rule2.cssRules,position.slice(1)):null}function getPositionsAndIndex(nestedIndex){let positions=[...nestedIndex];return{positions,index:positions.pop()}}function uniqueTextMutations(mutations){let idSet=new Set,uniqueMutations=[];for(let i2=mutations.length;i2--;){let mutation=mutations[i2];idSet.has(mutation.id)||(uniqueMutations.push(mutation),idSet.add(mutation.id))}return uniqueMutations}var StyleSheetMirror=class{constructor(){__publicField(this,`id`,1),__publicField(this,`styleIDMap`,new WeakMap),__publicField(this,`idStyleMap`,new Map)}getId(stylesheet){return this.styleIDMap.get(stylesheet)??-1}has(stylesheet){return this.styleIDMap.has(stylesheet)}add(stylesheet,id){if(this.has(stylesheet))return this.getId(stylesheet);let newId;return newId=id===void 0?this.id++:id,this.styleIDMap.set(stylesheet,newId),this.idStyleMap.set(newId,stylesheet),newId}getStyle(id){return this.idStyleMap.get(id)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function getShadowHost(n2){let shadowHost=null;return`getRootNode`in n2&&index.getRootNode(n2)?.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&index.host(index.getRootNode(n2))&&(shadowHost=index.host(index.getRootNode(n2))),shadowHost}function getRootShadowHost(n2){let rootShadowHost=n2,shadowHost;for(;shadowHost=getShadowHost(rootShadowHost);)rootShadowHost=shadowHost;return rootShadowHost}function shadowHostInDom(n2){let doc=index.ownerDocument(n2);if(!doc)return!1;let shadowHost=getRootShadowHost(n2);return index.contains(doc,shadowHost)}function inDom(n2){let doc=index.ownerDocument(n2);return doc?index.contains(doc,n2)||shadowHostInDom(n2):!1}const utils=Object.freeze(Object.defineProperty({__proto__:null,StyleSheetMirror,get _mirror(){return _mirror},closestElementOfNode,getBaseDimension,getNestedRule,getPositionsAndIndex,getRootShadowHost,getShadowHost,getWindowHeight,getWindowScroll,getWindowWidth,hasShadowRoot,hookSetter,inDom,isAncestorRemoved,isBlocked,isIgnored,isSerialized,isSerializedIframe,isSerializedStylesheet,iterateResolveTree,legacy_isTouchEvent,get nowTimestamp(){return nowTimestamp},on,polyfill:polyfill$1,queueToResolveTrees,shadowHostInDom,throttle,uniqueTextMutations},Symbol.toStringTag,{value:`Module`}));var EventType=(EventType2=>(EventType2[EventType2.DomContentLoaded=0]=`DomContentLoaded`,EventType2[EventType2.Load=1]=`Load`,EventType2[EventType2.FullSnapshot=2]=`FullSnapshot`,EventType2[EventType2.IncrementalSnapshot=3]=`IncrementalSnapshot`,EventType2[EventType2.Meta=4]=`Meta`,EventType2[EventType2.Custom=5]=`Custom`,EventType2[EventType2.Plugin=6]=`Plugin`,EventType2[EventType2.Asset=7]=`Asset`,EventType2))(EventType||{}),IncrementalSource=(IncrementalSource2=>(IncrementalSource2[IncrementalSource2.Mutation=0]=`Mutation`,IncrementalSource2[IncrementalSource2.MouseMove=1]=`MouseMove`,IncrementalSource2[IncrementalSource2.MouseInteraction=2]=`MouseInteraction`,IncrementalSource2[IncrementalSource2.Scroll=3]=`Scroll`,IncrementalSource2[IncrementalSource2.ViewportResize=4]=`ViewportResize`,IncrementalSource2[IncrementalSource2.Input=5]=`Input`,IncrementalSource2[IncrementalSource2.TouchMove=6]=`TouchMove`,IncrementalSource2[IncrementalSource2.MediaInteraction=7]=`MediaInteraction`,IncrementalSource2[IncrementalSource2.StyleSheetRule=8]=`StyleSheetRule`,IncrementalSource2[IncrementalSource2.CanvasMutation=9]=`CanvasMutation`,IncrementalSource2[IncrementalSource2.Font=10]=`Font`,IncrementalSource2[IncrementalSource2.Log=11]=`Log`,IncrementalSource2[IncrementalSource2.Drag=12]=`Drag`,IncrementalSource2[IncrementalSource2.StyleDeclaration=13]=`StyleDeclaration`,IncrementalSource2[IncrementalSource2.Selection=14]=`Selection`,IncrementalSource2[IncrementalSource2.AdoptedStyleSheet=15]=`AdoptedStyleSheet`,IncrementalSource2[IncrementalSource2.CustomElement=16]=`CustomElement`,IncrementalSource2))(IncrementalSource||{}),MouseInteractions=(MouseInteractions2=>(MouseInteractions2[MouseInteractions2.MouseUp=0]=`MouseUp`,MouseInteractions2[MouseInteractions2.MouseDown=1]=`MouseDown`,MouseInteractions2[MouseInteractions2.Click=2]=`Click`,MouseInteractions2[MouseInteractions2.ContextMenu=3]=`ContextMenu`,MouseInteractions2[MouseInteractions2.DblClick=4]=`DblClick`,MouseInteractions2[MouseInteractions2.Focus=5]=`Focus`,MouseInteractions2[MouseInteractions2.Blur=6]=`Blur`,MouseInteractions2[MouseInteractions2.TouchStart=7]=`TouchStart`,MouseInteractions2[MouseInteractions2.TouchMove_Departed=8]=`TouchMove_Departed`,MouseInteractions2[MouseInteractions2.TouchEnd=9]=`TouchEnd`,MouseInteractions2[MouseInteractions2.TouchCancel=10]=`TouchCancel`,MouseInteractions2))(MouseInteractions||{}),PointerTypes=(PointerTypes2=>(PointerTypes2[PointerTypes2.Mouse=0]=`Mouse`,PointerTypes2[PointerTypes2.Pen=1]=`Pen`,PointerTypes2[PointerTypes2.Touch=2]=`Touch`,PointerTypes2))(PointerTypes||{}),CanvasContext=(CanvasContext2=>(CanvasContext2[CanvasContext2[`2D`]=0]=`2D`,CanvasContext2[CanvasContext2.WebGL=1]=`WebGL`,CanvasContext2[CanvasContext2.WebGL2=2]=`WebGL2`,CanvasContext2))(CanvasContext||{}),MediaInteractions=(MediaInteractions2=>(MediaInteractions2[MediaInteractions2.Play=0]=`Play`,MediaInteractions2[MediaInteractions2.Pause=1]=`Pause`,MediaInteractions2[MediaInteractions2.Seeked=2]=`Seeked`,MediaInteractions2[MediaInteractions2.VolumeChange=3]=`VolumeChange`,MediaInteractions2[MediaInteractions2.RateChange=4]=`RateChange`,MediaInteractions2))(MediaInteractions||{}),ReplayerEvents=(ReplayerEvents2=>(ReplayerEvents2.Start=`start`,ReplayerEvents2.Pause=`pause`,ReplayerEvents2.Resume=`resume`,ReplayerEvents2.Resize=`resize`,ReplayerEvents2.Finish=`finish`,ReplayerEvents2.FullsnapshotRebuilded=`fullsnapshot-rebuilded`,ReplayerEvents2.LoadStylesheetStart=`load-stylesheet-start`,ReplayerEvents2.LoadStylesheetEnd=`load-stylesheet-end`,ReplayerEvents2.SkipStart=`skip-start`,ReplayerEvents2.SkipEnd=`skip-end`,ReplayerEvents2.MouseInteraction=`mouse-interaction`,ReplayerEvents2.EventCast=`event-cast`,ReplayerEvents2.CustomEvent=`custom-event`,ReplayerEvents2.Flush=`flush`,ReplayerEvents2.StateChange=`state-change`,ReplayerEvents2.PlayBack=`play-back`,ReplayerEvents2.Destroy=`destroy`,ReplayerEvents2))(ReplayerEvents||{}),NodeType=(NodeType2=>(NodeType2[NodeType2.Document=0]=`Document`,NodeType2[NodeType2.DocumentType=1]=`DocumentType`,NodeType2[NodeType2.Element=2]=`Element`,NodeType2[NodeType2.Text=3]=`Text`,NodeType2[NodeType2.CDATA=4]=`CDATA`,NodeType2[NodeType2.Comment=5]=`Comment`,NodeType2))(NodeType||{});function isNodeInLinkedList(n2){return`__ln`in n2}var DoubleLinkedList=class{constructor(){__publicField(this,`length`,0),__publicField(this,`head`,null),__publicField(this,`tail`,null)}get(position){if(position>=this.length)throw Error(`Position outside of list range`);let current=this.head;for(let index2=0;index2<position;index2++)current=current?.next||null;return current}addNode(n2){let node2={value:n2,previous:null,next:null};if(n2.__ln=node2,n2.previousSibling&&isNodeInLinkedList(n2.previousSibling)){let current=n2.previousSibling.__ln.next;node2.next=current,node2.previous=n2.previousSibling.__ln,n2.previousSibling.__ln.next=node2,current&&(current.previous=node2)}else if(n2.nextSibling&&isNodeInLinkedList(n2.nextSibling)&&n2.nextSibling.__ln.previous){let current=n2.nextSibling.__ln.previous;node2.previous=current,node2.next=n2.nextSibling.__ln,n2.nextSibling.__ln.previous=node2,current&&(current.next=node2)}else this.head&&(this.head.previous=node2),node2.next=this.head,this.head=node2;node2.next===null&&(this.tail=node2),this.length++}removeNode(n2){let current=n2.__ln;this.head&&(current.previous?(current.previous.next=current.next,current.next?current.next.previous=current.previous:this.tail=current.previous):(this.head=current.next,this.head?this.head.previous=null:this.tail=null),n2.__ln&&delete n2.__ln,this.length--)}};const moveKey=(id,parentId)=>`${id}@${parentId}`;var MutationBuffer=class{constructor(){__publicField(this,`frozen`,!1),__publicField(this,`locked`,!1),__publicField(this,`texts`,[]),__publicField(this,`attributes`,[]),__publicField(this,`attributeMap`,new WeakMap),__publicField(this,`removes`,[]),__publicField(this,`mapRemoves`,[]),__publicField(this,`movedMap`,{}),__publicField(this,`addedSet`,new Set),__publicField(this,`movedSet`,new Set),__publicField(this,`droppedSet`,new Set),__publicField(this,`removesSubTreeCache`,new Set),__publicField(this,`mutationCb`),__publicField(this,`blockClass`),__publicField(this,`blockSelector`),__publicField(this,`maskTextClass`),__publicField(this,`maskTextSelector`),__publicField(this,`inlineStylesheet`),__publicField(this,`maskInputOptions`),__publicField(this,`maskTextFn`),__publicField(this,`maskInputFn`),__publicField(this,`keepIframeSrcFn`),__publicField(this,`recordCanvas`),__publicField(this,`inlineImages`),__publicField(this,`slimDOMOptions`),__publicField(this,`dataURLOptions`),__publicField(this,`doc`),__publicField(this,`mirror`),__publicField(this,`iframeManager`),__publicField(this,`stylesheetManager`),__publicField(this,`shadowDomManager`),__publicField(this,`canvasManager`),__publicField(this,`processedNodeManager`),__publicField(this,`unattachedDoc`),__publicField(this,`processMutations`,mutations=>{mutations.forEach(this.processMutation),this.emit()}),__publicField(this,`emit`,()=>{if(this.frozen||this.locked)return;let adds=[],addedIds=new Set,addList=new DoubleLinkedList,getNextId=n2=>{let ns=n2,nextId=-2;for(;nextId===-2;)ns&&=ns.nextSibling,nextId=ns&&this.mirror.getId(ns);return nextId},pushAdd=n2=>{let parent=index.parentNode(n2);if(!parent||!inDom(n2))return;let cssCaptured=!1;if(n2.nodeType===Node.TEXT_NODE){let parentTag=parent.tagName;if(parentTag===`TEXTAREA`)return;parentTag===`STYLE`&&this.addedSet.has(parent)&&(cssCaptured=!0)}let parentId=isShadowRoot(parent)?this.mirror.getId(getShadowHost(n2)):this.mirror.getId(parent),nextId=getNextId(n2);if(parentId===-1||nextId===-1)return addList.addNode(n2);let sn=serializeNodeWithId(n2,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:currentN=>{isSerializedIframe(currentN,this.mirror)&&this.iframeManager.addIframe(currentN),isSerializedStylesheet(currentN,this.mirror)&&this.stylesheetManager.trackLinkElement(currentN),hasShadowRoot(n2)&&this.shadowDomManager.addShadowRoot(index.shadowRoot(n2),this.doc)},onIframeLoad:(iframe,childSn)=>{this.iframeManager.attachIframe(iframe,childSn),this.shadowDomManager.observeAttachShadow(iframe)},onStylesheetLoad:(link,childSn)=>{this.stylesheetManager.attachLinkElement(link,childSn)},cssCaptured});sn&&(adds.push({parentId,nextId,node:sn}),addedIds.add(sn.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let n2 of this.movedSet)(!isParentRemoved(this.removesSubTreeCache,n2,this.mirror)||this.movedSet.has(index.parentNode(n2)))&&pushAdd(n2);for(let n2 of this.addedSet)!isAncestorInSet(this.droppedSet,n2)&&!isParentRemoved(this.removesSubTreeCache,n2,this.mirror)||isAncestorInSet(this.movedSet,n2)?pushAdd(n2):this.droppedSet.add(n2);let candidate=null;for(;addList.length;){let node2=null;if(candidate){let parentId=this.mirror.getId(index.parentNode(candidate.value)),nextId=getNextId(candidate.value);parentId!==-1&&nextId!==-1&&(node2=candidate)}if(!node2){let tailNode=addList.tail;for(;tailNode;){let _node=tailNode;if(tailNode=tailNode.previous,_node){let parentId=this.mirror.getId(index.parentNode(_node.value));if(getNextId(_node.value)===-1)continue;if(parentId!==-1){node2=_node;break}{let unhandledNode=_node.value,parent=index.parentNode(unhandledNode);if(parent&&parent.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let shadowHost=index.host(parent);if(this.mirror.getId(shadowHost)!==-1){node2=_node;break}}}}}}if(!node2){for(;addList.head;)addList.removeNode(addList.head.value);break}candidate=node2.previous,addList.removeNode(node2.value),pushAdd(node2.value)}let payload={texts:this.texts.map(text=>{let n2=text.node,parent=index.parentNode(n2);return parent&&parent.tagName===`TEXTAREA`&&this.genTextAreaValueMutation(parent),{id:this.mirror.getId(n2),value:text.value}}).filter(text=>!addedIds.has(text.id)).filter(text=>this.mirror.has(text.id)),attributes:this.attributes.map(attribute=>{let{attributes}=attribute;if(typeof attributes.style==`string`){let diffAsStr=JSON.stringify(attribute.styleDiff),unchangedAsStr=JSON.stringify(attribute._unchangedStyles);diffAsStr.length<attributes.style.length&&(diffAsStr+unchangedAsStr).split(`var(`).length===attributes.style.split(`var(`).length&&(attributes.style=attribute.styleDiff)}return{id:this.mirror.getId(attribute.node),attributes}}).filter(attribute=>!addedIds.has(attribute.id)).filter(attribute=>this.mirror.has(attribute.id)),removes:this.removes,adds};(payload.texts.length||payload.attributes.length||payload.removes.length||payload.adds.length)&&(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},this.mutationCb(payload))}),__publicField(this,`genTextAreaValueMutation`,textarea=>{let item=this.attributeMap.get(textarea);item||(item={node:textarea,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(item),this.attributeMap.set(textarea,item));let value=Array.from(index.childNodes(textarea),cn=>index.textContent(cn)||``).join(``);item.attributes.value=maskInputValue({element:textarea,maskInputOptions:this.maskInputOptions,tagName:textarea.tagName,type:getInputType(textarea),value,maskInputFn:this.maskInputFn})}),__publicField(this,`processMutation`,m=>{if(!isIgnored(m.target,this.mirror,this.slimDOMOptions))switch(m.type){case`characterData`:{let value=index.textContent(m.target);!isBlocked(m.target,this.blockClass,this.blockSelector,!1)&&value!==m.oldValue&&this.texts.push({value:needMaskingText(m.target,this.maskTextClass,this.maskTextSelector,!0)&&value?this.maskTextFn?this.maskTextFn(value,closestElementOfNode(m.target)):value.replace(/[\S]/g,`*`):value,node:m.target});break}case`attributes`:{let target=m.target,attributeName=m.attributeName,value=m.target.getAttribute(attributeName);if(attributeName===`value`){let type=getInputType(target);value=maskInputValue({element:target,maskInputOptions:this.maskInputOptions,tagName:target.tagName,type,value,maskInputFn:this.maskInputFn})}if(isBlocked(m.target,this.blockClass,this.blockSelector,!1)||value===m.oldValue)return;let item=this.attributeMap.get(m.target);if(target.tagName===`IFRAME`&&attributeName===`src`&&!this.keepIframeSrcFn(value)){if(!target.contentDocument)attributeName=`rr_src`;else return}if(item||(item={node:m.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(item),this.attributeMap.set(m.target,item)),attributeName===`type`&&target.tagName===`INPUT`&&(m.oldValue||``).toLowerCase()===`password`&&target.setAttribute(`data-rr-is-password`,`true`),!ignoreAttribute(target.tagName,attributeName)){if(item.attributes[attributeName]=transformAttribute(this.doc,toLowerCase(target.tagName),toLowerCase(attributeName),value),attributeName===`style`){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}let old=this.unattachedDoc.createElement(`span`);m.oldValue&&old.setAttribute(`style`,m.oldValue);for(let pname of Array.from(target.style)){let newValue=target.style.getPropertyValue(pname),newPriority=target.style.getPropertyPriority(pname);newValue!==old.style.getPropertyValue(pname)||newPriority!==old.style.getPropertyPriority(pname)?newPriority===``?item.styleDiff[pname]=newValue:item.styleDiff[pname]=[newValue,newPriority]:item._unchangedStyles[pname]=[newValue,newPriority]}for(let pname of Array.from(old.style))target.style.getPropertyValue(pname)===``&&(item.styleDiff[pname]=!1)}else attributeName===`open`&&target.tagName===`DIALOG`&&(target.matches(`dialog:modal`)?item.attributes.rr_open_mode=`modal`:item.attributes.rr_open_mode=`non-modal`)}break}case`childList`:if(isBlocked(m.target,this.blockClass,this.blockSelector,!0))return;if(m.target.tagName===`TEXTAREA`){this.genTextAreaValueMutation(m.target);return}m.addedNodes.forEach(n2=>this.genAdds(n2,m.target)),m.removedNodes.forEach(n2=>{let nodeId=this.mirror.getId(n2),parentId=isShadowRoot(m.target)?this.mirror.getId(index.host(m.target)):this.mirror.getId(m.target);isBlocked(m.target,this.blockClass,this.blockSelector,!1)||isIgnored(n2,this.mirror,this.slimDOMOptions)||!isSerialized(n2,this.mirror)||(this.addedSet.has(n2)?(deepDelete(this.addedSet,n2),this.droppedSet.add(n2)):this.addedSet.has(m.target)&&nodeId===-1||isAncestorRemoved(m.target,this.mirror)||(this.movedSet.has(n2)&&this.movedMap[moveKey(nodeId,parentId)]?deepDelete(this.movedSet,n2):(this.removes.push({parentId,id:nodeId,isShadow:isShadowRoot(m.target)&&isNativeShadowDom(m.target)?!0:void 0}),processRemoves(n2,this.removesSubTreeCache))),this.mapRemoves.push(n2))})}}),__publicField(this,`genAdds`,(n2,target)=>{if(!this.processedNodeManager.inOtherBuffer(n2,this)&&!(this.addedSet.has(n2)||this.movedSet.has(n2))){if(this.mirror.hasNode(n2)){if(isIgnored(n2,this.mirror,this.slimDOMOptions))return;this.movedSet.add(n2);let targetId=null;target&&this.mirror.hasNode(target)&&(targetId=this.mirror.getId(target)),targetId&&targetId!==-1&&(this.movedMap[moveKey(this.mirror.getId(n2),targetId)]=!0)}else this.addedSet.add(n2),this.droppedSet.delete(n2);isBlocked(n2,this.blockClass,this.blockSelector,!1)||(index.childNodes(n2).forEach(childN=>this.genAdds(childN)),hasShadowRoot(n2)&&index.childNodes(index.shadowRoot(n2)).forEach(childN=>{this.processedNodeManager.add(childN,this),this.genAdds(childN,n2)}))}})}init(options){[`mutationCb`,`blockClass`,`blockSelector`,`maskTextClass`,`maskTextSelector`,`inlineStylesheet`,`maskInputOptions`,`maskTextFn`,`maskInputFn`,`keepIframeSrcFn`,`recordCanvas`,`inlineImages`,`slimDOMOptions`,`dataURLOptions`,`doc`,`mirror`,`iframeManager`,`stylesheetManager`,`shadowDomManager`,`canvasManager`,`processedNodeManager`].forEach(key=>{this[key]=options[key]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}};function deepDelete(addsSet,n2){addsSet.delete(n2),index.childNodes(n2).forEach(childN=>deepDelete(addsSet,childN))}function processRemoves(n2,cache){let queue=[n2];for(;queue.length;){let next=queue.pop();cache.has(next)||(cache.add(next),index.childNodes(next).forEach(n22=>queue.push(n22)))}}function isParentRemoved(removes,n2,mirror2){return removes.size!==0&&_isParentRemoved(removes,n2)}function _isParentRemoved(removes,n2,_mirror2){let node2=index.parentNode(n2);return node2?removes.has(node2):!1}function isAncestorInSet(set,n2){return set.size!==0&&_isAncestorInSet(set,n2)}function _isAncestorInSet(set,n2){let parent=index.parentNode(n2);return parent?set.has(parent)?!0:_isAncestorInSet(set,parent):!1}let errorHandler;function registerErrorHandler(handler){errorHandler=handler}function unregisterErrorHandler(){errorHandler=void 0}const callbackWrapper=cb=>errorHandler?(...rest)=>{try{return cb(...rest)}catch(error){if(errorHandler&&errorHandler(error)===!0)return;throw error}}:cb,mutationBuffers=[];function getEventTarget(event){try{if(`composedPath`in event){let path=event.composedPath();if(path.length)return path[0]}else if(`path`in event&&event.path.length)return event.path[0]}catch{}return event&&event.target}function initMutationObserver(options,rootEl){let mutationBuffer=new MutationBuffer;mutationBuffers.push(mutationBuffer),mutationBuffer.init(options);let[ObserverCtor,iframeCleanup]=mutationObserverCtor(),observer=new ObserverCtor(callbackWrapper(mutationBuffer.processMutations.bind(mutationBuffer)));return observer.observe(rootEl,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),[observer,iframeCleanup]}function initMoveObserver({mousemoveCb,sampling,doc,mirror:mirror2}){if(sampling.mousemove===!1)return()=>{};let threshold=typeof sampling.mousemove==`number`?sampling.mousemove:50,callbackThreshold=typeof sampling.mousemoveCallback==`number`?sampling.mousemoveCallback:500,positions=[],timeBaseline,wrappedCb=throttle(callbackWrapper(source=>{let totalOffset=Date.now()-timeBaseline;mousemoveCb(positions.map(p=>(p.timeOffset-=totalOffset,p)),source),positions=[],timeBaseline=null}),callbackThreshold),updatePosition=callbackWrapper(throttle(callbackWrapper(evt=>{let target=getEventTarget(evt),{clientX,clientY}=legacy_isTouchEvent(evt)?evt.changedTouches[0]:evt;timeBaseline||=nowTimestamp(),positions.push({x:clientX,y:clientY,id:mirror2.getId(target),timeOffset:nowTimestamp()-timeBaseline}),wrappedCb(typeof DragEvent<`u`&&evt instanceof DragEvent?IncrementalSource.Drag:evt instanceof MouseEvent?IncrementalSource.MouseMove:IncrementalSource.TouchMove)}),threshold,{trailing:!1})),handlers=[on(`mousemove`,updatePosition,doc),on(`touchmove`,updatePosition,doc),on(`drag`,updatePosition,doc)];return callbackWrapper(()=>{handlers.forEach(h=>h())})}function initMouseInteractionObserver({mouseInteractionCb,doc,mirror:mirror2,blockClass,blockSelector,sampling}){if(sampling.mouseInteraction===!1)return()=>{};let disableMap=sampling.mouseInteraction===!0||sampling.mouseInteraction===void 0?{}:sampling.mouseInteraction,handlers=[],currentPointerType=null,getHandler=eventKey=>event=>{let target=getEventTarget(event);if(isBlocked(target,blockClass,blockSelector,!0))return;let pointerType=null,thisEventKey=eventKey;if(`pointerType`in event){switch(event.pointerType){case`mouse`:pointerType=PointerTypes.Mouse;break;case`touch`:pointerType=PointerTypes.Touch;break;case`pen`:pointerType=PointerTypes.Pen}pointerType===PointerTypes.Touch?MouseInteractions[eventKey]===MouseInteractions.MouseDown?thisEventKey=`TouchStart`:MouseInteractions[eventKey]===MouseInteractions.MouseUp&&(thisEventKey=`TouchEnd`):PointerTypes.Pen}else legacy_isTouchEvent(event)&&(pointerType=PointerTypes.Touch);pointerType===null?MouseInteractions[eventKey]===MouseInteractions.Click&&(pointerType=currentPointerType,currentPointerType=null):(currentPointerType=pointerType,(thisEventKey.startsWith(`Touch`)&&pointerType===PointerTypes.Touch||thisEventKey.startsWith(`Mouse`)&&pointerType===PointerTypes.Mouse)&&(pointerType=null));let e2=legacy_isTouchEvent(event)?event.changedTouches[0]:event;if(!e2)return;let id=mirror2.getId(target),{clientX,clientY}=e2;callbackWrapper(mouseInteractionCb)({type:MouseInteractions[thisEventKey],id,x:clientX,y:clientY,...pointerType!==null&&{pointerType}})};return Object.keys(MouseInteractions).filter(key=>Number.isNaN(Number(key))&&!key.endsWith(`_Departed`)&&disableMap[key]!==!1).forEach(eventKey=>{let eventName=toLowerCase(eventKey),handler=getHandler(eventKey);if(window.PointerEvent)switch(MouseInteractions[eventKey]){case MouseInteractions.MouseDown:case MouseInteractions.MouseUp:eventName=eventName.replace(`mouse`,`pointer`);break;case MouseInteractions.TouchStart:case MouseInteractions.TouchEnd:return}handlers.push(on(eventName,handler,doc))}),callbackWrapper(()=>{handlers.forEach(h=>h())})}function initScrollObserver({scrollCb,doc,mirror:mirror2,blockClass,blockSelector,sampling}){return on(`scroll`,callbackWrapper(throttle(callbackWrapper(evt=>{let target=getEventTarget(evt);if(!target||isBlocked(target,blockClass,blockSelector,!0))return;let id=mirror2.getId(target);if(target===doc&&doc.defaultView){let scrollLeftTop=getWindowScroll(doc.defaultView);scrollCb({id,x:scrollLeftTop.left,y:scrollLeftTop.top})}else scrollCb({id,x:target.scrollLeft,y:target.scrollTop})}),sampling.scroll||100)),doc)}function initViewportResizeObserver({viewportResizeCb},{win}){let lastH=-1,lastW=-1;return on(`resize`,callbackWrapper(throttle(callbackWrapper(()=>{let height=getWindowHeight(),width=getWindowWidth();(lastH!==height||lastW!==width)&&(viewportResizeCb({width:Number(width),height:Number(height)}),lastH=height,lastW=width)}),200)),win)}const INPUT_TAGS=[`INPUT`,`TEXTAREA`,`SELECT`],lastInputValueMap=new WeakMap;function initInputObserver({inputCb,doc,mirror:mirror2,blockClass,blockSelector,ignoreClass,ignoreSelector,maskInputOptions,maskInputFn,sampling,userTriggeredOnInput}){function eventHandler(event){let target=getEventTarget(event),userTriggered=event.isTrusted,tagName=target&&target.tagName;if(target&&tagName===`OPTION`&&(target=index.parentElement(target)),!target||!tagName||INPUT_TAGS.indexOf(tagName)<0||isBlocked(target,blockClass,blockSelector,!0)||target.classList.contains(ignoreClass)||ignoreSelector&&target.matches(ignoreSelector))return;let text=target.value,isChecked=!1,type=getInputType(target)||``;type===`radio`||type===`checkbox`?isChecked=target.checked:(maskInputOptions[tagName.toLowerCase()]||maskInputOptions[type])&&(text=maskInputValue({element:target,maskInputOptions,tagName,type,value:text,maskInputFn})),cbWithDedup(target,userTriggeredOnInput?{text,isChecked,userTriggered}:{text,isChecked});let name=target.name;type===`radio`&&name&&isChecked&&doc.querySelectorAll(`input[type="radio"][name="${name}"]`).forEach(el=>{if(el!==target){let text2=el.value;cbWithDedup(el,userTriggeredOnInput?{text:text2,isChecked:!isChecked,userTriggered:!1}:{text:text2,isChecked:!isChecked})}})}function cbWithDedup(target,v2){let lastInputValue=lastInputValueMap.get(target);if(!lastInputValue||lastInputValue.text!==v2.text||lastInputValue.isChecked!==v2.isChecked){lastInputValueMap.set(target,v2);let id=mirror2.getId(target);callbackWrapper(inputCb)({...v2,id})}}let handlers=(sampling.input===`last`?[`change`]:[`input`,`change`]).map(eventName=>on(eventName,callbackWrapper(eventHandler),doc)),currentWindow=doc.defaultView;if(!currentWindow)return()=>{handlers.forEach(h=>h())};let propertyDescriptor=currentWindow.Object.getOwnPropertyDescriptor(currentWindow.HTMLInputElement.prototype,`value`),hookProperties=[[currentWindow.HTMLInputElement.prototype,`value`],[currentWindow.HTMLInputElement.prototype,`checked`],[currentWindow.HTMLSelectElement.prototype,`value`],[currentWindow.HTMLTextAreaElement.prototype,`value`],[currentWindow.HTMLSelectElement.prototype,`selectedIndex`],[currentWindow.HTMLOptionElement.prototype,`selected`]];return propertyDescriptor&&propertyDescriptor.set&&handlers.push(...hookProperties.map(p=>hookSetter(p[0],p[1],{set(){callbackWrapper(eventHandler)({target:this,isTrusted:!1})}},!1,currentWindow))),callbackWrapper(()=>{handlers.forEach(h=>h())})}function getNestedCSSRulePositions(rule2){let positions=[];function recurse(childRule,pos){if(hasNestedCSSRule(`CSSGroupingRule`)&&childRule.parentRule instanceof CSSGroupingRule||hasNestedCSSRule(`CSSMediaRule`)&&childRule.parentRule instanceof CSSMediaRule||hasNestedCSSRule(`CSSSupportsRule`)&&childRule.parentRule instanceof CSSSupportsRule||hasNestedCSSRule(`CSSConditionRule`)&&childRule.parentRule instanceof CSSConditionRule){let index2=Array.from(childRule.parentRule.cssRules).indexOf(childRule);return pos.unshift(index2),recurse(childRule.parentRule,pos)}if(childRule.parentStyleSheet){let index2=Array.from(childRule.parentStyleSheet.cssRules).indexOf(childRule);pos.unshift(index2)}return pos}return recurse(rule2,positions)}function getIdAndStyleId(sheet,mirror2,styleMirror){let id,styleId;return sheet?(sheet.ownerNode?id=mirror2.getId(sheet.ownerNode):styleId=styleMirror.getId(sheet),{styleId,id}):{}}function initStyleSheetObserver({styleSheetRuleCb,mirror:mirror2,stylesheetManager},{win}){if(!win.CSSStyleSheet||!win.CSSStyleSheet.prototype)return()=>{};let insertRule=win.CSSStyleSheet.prototype.insertRule;win.CSSStyleSheet.prototype.insertRule=new Proxy(insertRule,{apply:callbackWrapper((target,thisArg,argumentsList)=>{let[rule2,index2]=argumentsList,{id,styleId}=getIdAndStyleId(thisArg,mirror2,stylesheetManager.styleMirror);return(id&&id!==-1||styleId&&styleId!==-1)&&styleSheetRuleCb({id,styleId,adds:[{rule:rule2,index:index2}]}),target.apply(thisArg,argumentsList)})}),win.CSSStyleSheet.prototype.addRule=function(selector,styleBlock,index2=this.cssRules.length){let rule2=`${selector} { ${styleBlock} }`;return win.CSSStyleSheet.prototype.insertRule.apply(this,[rule2,index2])};let deleteRule=win.CSSStyleSheet.prototype.deleteRule;win.CSSStyleSheet.prototype.deleteRule=new Proxy(deleteRule,{apply:callbackWrapper((target,thisArg,argumentsList)=>{let[index2]=argumentsList,{id,styleId}=getIdAndStyleId(thisArg,mirror2,stylesheetManager.styleMirror);return(id&&id!==-1||styleId&&styleId!==-1)&&styleSheetRuleCb({id,styleId,removes:[{index:index2}]}),target.apply(thisArg,argumentsList)})}),win.CSSStyleSheet.prototype.removeRule=function(index2){return win.CSSStyleSheet.prototype.deleteRule.apply(this,[index2])};let replace;win.CSSStyleSheet.prototype.replace&&(replace=win.CSSStyleSheet.prototype.replace,win.CSSStyleSheet.prototype.replace=new Proxy(replace,{apply:callbackWrapper((target,thisArg,argumentsList)=>{let[text]=argumentsList,{id,styleId}=getIdAndStyleId(thisArg,mirror2,stylesheetManager.styleMirror);return(id&&id!==-1||styleId&&styleId!==-1)&&styleSheetRuleCb({id,styleId,replace:text}),target.apply(thisArg,argumentsList)})}));let replaceSync;win.CSSStyleSheet.prototype.replaceSync&&(replaceSync=win.CSSStyleSheet.prototype.replaceSync,win.CSSStyleSheet.prototype.replaceSync=new Proxy(replaceSync,{apply:callbackWrapper((target,thisArg,argumentsList)=>{let[text]=argumentsList,{id,styleId}=getIdAndStyleId(thisArg,mirror2,stylesheetManager.styleMirror);return(id&&id!==-1||styleId&&styleId!==-1)&&styleSheetRuleCb({id,styleId,replaceSync:text}),target.apply(thisArg,argumentsList)})}));let supportedNestedCSSRuleTypes={};canMonkeyPatchNestedCSSRule(`CSSGroupingRule`)?supportedNestedCSSRuleTypes.CSSGroupingRule=win.CSSGroupingRule:(canMonkeyPatchNestedCSSRule(`CSSMediaRule`)&&(supportedNestedCSSRuleTypes.CSSMediaRule=win.CSSMediaRule),canMonkeyPatchNestedCSSRule(`CSSConditionRule`)&&(supportedNestedCSSRuleTypes.CSSConditionRule=win.CSSConditionRule),canMonkeyPatchNestedCSSRule(`CSSSupportsRule`)&&(supportedNestedCSSRuleTypes.CSSSupportsRule=win.CSSSupportsRule));let unmodifiedFunctions={};return Object.entries(supportedNestedCSSRuleTypes).forEach(([typeKey,type])=>{unmodifiedFunctions[typeKey]={insertRule:type.prototype.insertRule,deleteRule:type.prototype.deleteRule},type.prototype.insertRule=new Proxy(unmodifiedFunctions[typeKey].insertRule,{apply:callbackWrapper((target,thisArg,argumentsList)=>{let[rule2,index2]=argumentsList,{id,styleId}=getIdAndStyleId(thisArg.parentStyleSheet,mirror2,stylesheetManager.styleMirror);return(id&&id!==-1||styleId&&styleId!==-1)&&styleSheetRuleCb({id,styleId,adds:[{rule:rule2,index:[...getNestedCSSRulePositions(thisArg),index2||0]}]}),target.apply(thisArg,argumentsList)})}),type.prototype.deleteRule=new Proxy(unmodifiedFunctions[typeKey].deleteRule,{apply:callbackWrapper((target,thisArg,argumentsList)=>{let[index2]=argumentsList,{id,styleId}=getIdAndStyleId(thisArg.parentStyleSheet,mirror2,stylesheetManager.styleMirror);return(id&&id!==-1||styleId&&styleId!==-1)&&styleSheetRuleCb({id,styleId,removes:[{index:[...getNestedCSSRulePositions(thisArg),index2]}]}),target.apply(thisArg,argumentsList)})})}),callbackWrapper(()=>{win.CSSStyleSheet.prototype.insertRule=insertRule,win.CSSStyleSheet.prototype.deleteRule=deleteRule,replace&&(win.CSSStyleSheet.prototype.replace=replace),replaceSync&&(win.CSSStyleSheet.prototype.replaceSync=replaceSync),Object.entries(supportedNestedCSSRuleTypes).forEach(([typeKey,type])=>{type.prototype.insertRule=unmodifiedFunctions[typeKey].insertRule,type.prototype.deleteRule=unmodifiedFunctions[typeKey].deleteRule})})}function initAdoptedStyleSheetObserver({mirror:mirror2,stylesheetManager},host2){let hostId=null;hostId=host2.nodeName===`#document`?mirror2.getId(host2):mirror2.getId(index.host(host2));let patchTarget=host2.nodeName===`#document`?host2.defaultView?.Document:host2.ownerDocument?.defaultView?.ShadowRoot,originalPropertyDescriptor=patchTarget?.prototype?Object.getOwnPropertyDescriptor(patchTarget?.prototype,`adoptedStyleSheets`):void 0;return hostId===null||hostId===-1||!patchTarget||!originalPropertyDescriptor?()=>{}:(Object.defineProperty(host2,"adoptedStyleSheets",{configurable:originalPropertyDescriptor.configurable,enumerable:originalPropertyDescriptor.enumerable,get(){return originalPropertyDescriptor.get?.call(this)},set(sheets){let result2=originalPropertyDescriptor.set?.call(this,sheets);if(hostId!==null&&hostId!==-1)try{stylesheetManager.adoptStyleSheets(sheets,hostId)}catch{}return result2}}),callbackWrapper(()=>{Object.defineProperty(host2,"adoptedStyleSheets",{configurable:originalPropertyDescriptor.configurable,enumerable:originalPropertyDescriptor.enumerable,get:originalPropertyDescriptor.get,set:originalPropertyDescriptor.set})}))}function initStyleDeclarationObserver({styleDeclarationCb,mirror:mirror2,ignoreCSSAttributes,stylesheetManager},{win}){let setProperty=win.CSSStyleDeclaration.prototype.setProperty;win.CSSStyleDeclaration.prototype.setProperty=new Proxy(setProperty,{apply:callbackWrapper((target,thisArg,argumentsList)=>{let[property,value,priority]=argumentsList;if(ignoreCSSAttributes.has(property))return setProperty.apply(thisArg,[property,value,priority]);let{id,styleId}=getIdAndStyleId(thisArg.parentRule?.parentStyleSheet,mirror2,stylesheetManager.styleMirror);return(id&&id!==-1||styleId&&styleId!==-1)&&styleDeclarationCb({id,styleId,set:{property,value,priority},index:getNestedCSSRulePositions(thisArg.parentRule)}),target.apply(thisArg,argumentsList)})});let removeProperty=win.CSSStyleDeclaration.prototype.removeProperty;return win.CSSStyleDeclaration.prototype.removeProperty=new Proxy(removeProperty,{apply:callbackWrapper((target,thisArg,argumentsList)=>{let[property]=argumentsList;if(ignoreCSSAttributes.has(property))return removeProperty.apply(thisArg,[property]);let{id,styleId}=getIdAndStyleId(thisArg.parentRule?.parentStyleSheet,mirror2,stylesheetManager.styleMirror);return(id&&id!==-1||styleId&&styleId!==-1)&&styleDeclarationCb({id,styleId,remove:{property},index:getNestedCSSRulePositions(thisArg.parentRule)}),target.apply(thisArg,argumentsList)})}),callbackWrapper(()=>{win.CSSStyleDeclaration.prototype.setProperty=setProperty,win.CSSStyleDeclaration.prototype.removeProperty=removeProperty})}function initMediaInteractionObserver({mediaInteractionCb,blockClass,blockSelector,mirror:mirror2,sampling,doc}){let handler=callbackWrapper(type=>throttle(callbackWrapper(event=>{let target=getEventTarget(event);if(!target||isBlocked(target,blockClass,blockSelector,!0))return;let{currentTime,volume,muted,playbackRate,loop}=target;mediaInteractionCb({type,id:mirror2.getId(target),currentTime,volume,muted,playbackRate,loop})}),sampling.media||500)),handlers=[on(`play`,handler(MediaInteractions.Play),doc),on(`pause`,handler(MediaInteractions.Pause),doc),on(`seeked`,handler(MediaInteractions.Seeked),doc),on(`volumechange`,handler(MediaInteractions.VolumeChange),doc),on(`ratechange`,handler(MediaInteractions.RateChange),doc)];return callbackWrapper(()=>{handlers.forEach(h=>h())})}function initFontObserver({fontCb,doc}){let win=doc.defaultView;if(!win)return()=>{};let handlers=[],fontMap=new WeakMap,originalFontFace=win.FontFace;win.FontFace=function(family,source,descriptors){let fontFace=new originalFontFace(family,source,descriptors);return fontMap.set(fontFace,{family,buffer:typeof source!=`string`,descriptors,fontSource:typeof source==`string`?source:JSON.stringify(Array.from(new Uint8Array(source)))}),fontFace};let restoreHandler=patch(doc.fonts,`add`,function(original){return function(fontFace){return setTimeout(callbackWrapper(()=>{let p=fontMap.get(fontFace);p&&(fontCb(p),fontMap.delete(fontFace))}),0),original.apply(this,[fontFace])}});return handlers.push(()=>{win.FontFace=originalFontFace}),handlers.push(restoreHandler),callbackWrapper(()=>{handlers.forEach(h=>h())})}function initSelectionObserver(param){let{doc,mirror:mirror2,blockClass,blockSelector,selectionCb}=param,collapsed=!0,updateSelection=callbackWrapper(()=>{let selection=doc.getSelection();if(!selection||collapsed&&selection?.isCollapsed)return;collapsed=selection.isCollapsed||!1;let ranges=[],count=selection.rangeCount||0;for(let i2=0;i2<count;i2++){let{startContainer,startOffset,endContainer,endOffset}=selection.getRangeAt(i2);isBlocked(startContainer,blockClass,blockSelector,!0)||isBlocked(endContainer,blockClass,blockSelector,!0)||ranges.push({start:mirror2.getId(startContainer),startOffset,end:mirror2.getId(endContainer),endOffset})}selectionCb({ranges})});return updateSelection(),on(`selectionchange`,updateSelection)}function initCustomElementObserver({doc,customElementCb}){let win=doc.defaultView;return!win||!win.customElements?()=>{}:patch(win.customElements,`define`,function(original){return function(name,constructor,options){try{customElementCb({define:{name}})}catch{console.warn(`Custom element callback failed for ${name}`)}return original.apply(this,[name,constructor,options])}})}function mergeHooks(o2,hooks){let{mutationCb,mousemoveCb,mouseInteractionCb,scrollCb,viewportResizeCb,inputCb,mediaInteractionCb,styleSheetRuleCb,styleDeclarationCb,canvasMutationCb,fontCb,selectionCb,customElementCb}=o2;o2.mutationCb=(...p)=>{hooks.mutation&&hooks.mutation(...p),mutationCb(...p)},o2.mousemoveCb=(...p)=>{hooks.mousemove&&hooks.mousemove(...p),mousemoveCb(...p)},o2.mouseInteractionCb=(...p)=>{hooks.mouseInteraction&&hooks.mouseInteraction(...p),mouseInteractionCb(...p)},o2.scrollCb=(...p)=>{hooks.scroll&&hooks.scroll(...p),scrollCb(...p)},o2.viewportResizeCb=(...p)=>{hooks.viewportResize&&hooks.viewportResize(...p),viewportResizeCb(...p)},o2.inputCb=(...p)=>{hooks.input&&hooks.input(...p),inputCb(...p)},o2.mediaInteractionCb=(...p)=>{hooks.mediaInteaction&&hooks.mediaInteaction(...p),mediaInteractionCb(...p)},o2.styleSheetRuleCb=(...p)=>{hooks.styleSheetRule&&hooks.styleSheetRule(...p),styleSheetRuleCb(...p)},o2.styleDeclarationCb=(...p)=>{hooks.styleDeclaration&&hooks.styleDeclaration(...p),styleDeclarationCb(...p)},o2.canvasMutationCb=(...p)=>{hooks.canvasMutation&&hooks.canvasMutation(...p),canvasMutationCb(...p)},o2.fontCb=(...p)=>{hooks.font&&hooks.font(...p),fontCb(...p)},o2.selectionCb=(...p)=>{hooks.selection&&hooks.selection(...p),selectionCb(...p)},o2.customElementCb=(...c2)=>{hooks.customElement&&hooks.customElement(...c2),customElementCb(...c2)}}function initObservers(o2,hooks={}){let currentWindow=o2.doc.defaultView;if(!currentWindow)return()=>{};mergeHooks(o2,hooks);let mutationObserver,cleanupMutationIframe=()=>{};o2.recordDOM&&([mutationObserver,cleanupMutationIframe]=initMutationObserver(o2,o2.doc));let mousemoveHandler=initMoveObserver(o2),mouseInteractionHandler=initMouseInteractionObserver(o2),scrollHandler=initScrollObserver(o2),viewportResizeHandler=initViewportResizeObserver(o2,{win:currentWindow}),inputHandler=initInputObserver(o2),mediaInteractionHandler=initMediaInteractionObserver(o2),styleSheetObserver=()=>{},adoptedStyleSheetObserver=()=>{},styleDeclarationObserver=()=>{},fontObserver=()=>{};o2.recordDOM&&(styleSheetObserver=initStyleSheetObserver(o2,{win:currentWindow}),adoptedStyleSheetObserver=initAdoptedStyleSheetObserver(o2,o2.doc),styleDeclarationObserver=initStyleDeclarationObserver(o2,{win:currentWindow}),o2.collectFonts&&(fontObserver=initFontObserver(o2)));let selectionObserver=initSelectionObserver(o2),customElementObserver=initCustomElementObserver(o2),pluginHandlers=[];for(let plugin of o2.plugins)pluginHandlers.push(plugin.observer(plugin.callback,currentWindow,plugin.options));return callbackWrapper(()=>{mutationBuffers.forEach(b=>b.reset()),mutationObserver?.disconnect(),cleanupMutationIframe(),mousemoveHandler(),mouseInteractionHandler(),scrollHandler(),viewportResizeHandler(),inputHandler(),mediaInteractionHandler(),styleSheetObserver(),adoptedStyleSheetObserver(),styleDeclarationObserver(),fontObserver(),selectionObserver(),customElementObserver(),pluginHandlers.forEach(h=>h())})}function hasNestedCSSRule(prop){return window[prop]!==void 0}function canMonkeyPatchNestedCSSRule(prop){return!!(window[prop]!==void 0&&window[prop].prototype&&`insertRule`in window[prop].prototype&&`deleteRule`in window[prop].prototype)}for(var CrossOriginIframeMirror=class{constructor(generateIdFn){__publicField(this,`iframeIdToRemoteIdMap`,new WeakMap),__publicField(this,`iframeRemoteIdToIdMap`,new WeakMap),this.generateIdFn=generateIdFn}getId(iframe,remoteId,idToRemoteMap,remoteToIdMap){let idToRemoteIdMap=idToRemoteMap||this.getIdToRemoteIdMap(iframe),remoteIdToIdMap=remoteToIdMap||this.getRemoteIdToIdMap(iframe),id=idToRemoteIdMap.get(remoteId);return id||(id=this.generateIdFn(),idToRemoteIdMap.set(remoteId,id),remoteIdToIdMap.set(id,remoteId)),id}getIds(iframe,remoteId){let idToRemoteIdMap=this.getIdToRemoteIdMap(iframe),remoteIdToIdMap=this.getRemoteIdToIdMap(iframe);return remoteId.map(id=>this.getId(iframe,id,idToRemoteIdMap,remoteIdToIdMap))}getRemoteId(iframe,id,map){let remoteIdToIdMap=map||this.getRemoteIdToIdMap(iframe);return typeof id==`number`?remoteIdToIdMap.get(id)||-1:id}getRemoteIds(iframe,ids){let remoteIdToIdMap=this.getRemoteIdToIdMap(iframe);return ids.map(id=>this.getRemoteId(iframe,id,remoteIdToIdMap))}reset(iframe){if(!iframe){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(iframe),this.iframeRemoteIdToIdMap.delete(iframe)}getIdToRemoteIdMap(iframe){let idToRemoteIdMap=this.iframeIdToRemoteIdMap.get(iframe);return idToRemoteIdMap||(idToRemoteIdMap=new Map,this.iframeIdToRemoteIdMap.set(iframe,idToRemoteIdMap)),idToRemoteIdMap}getRemoteIdToIdMap(iframe){let remoteIdToIdMap=this.iframeRemoteIdToIdMap.get(iframe);return remoteIdToIdMap||(remoteIdToIdMap=new Map,this.iframeRemoteIdToIdMap.set(iframe,remoteIdToIdMap)),remoteIdToIdMap}},IframeManager=class{constructor(options){__publicField(this,`iframes`,new WeakMap),__publicField(this,`crossOriginIframeMap`,new WeakMap),__publicField(this,`crossOriginIframeMirror`,new CrossOriginIframeMirror(genId)),__publicField(this,`crossOriginIframeStyleMirror`),__publicField(this,`crossOriginIframeRootIdMap`,new WeakMap),__publicField(this,`mirror`),__publicField(this,`mutationCb`),__publicField(this,`wrappedEmit`),__publicField(this,`loadListener`),__publicField(this,`stylesheetManager`),__publicField(this,`recordCrossOriginIframes`),this.mutationCb=options.mutationCb,this.wrappedEmit=options.wrappedEmit,this.stylesheetManager=options.stylesheetManager,this.recordCrossOriginIframes=options.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new CrossOriginIframeMirror(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=options.mirror,this.recordCrossOriginIframes&&window.addEventListener(`message`,this.handleMessage.bind(this))}addIframe(iframeEl){this.iframes.set(iframeEl,!0),iframeEl.contentWindow&&this.crossOriginIframeMap.set(iframeEl.contentWindow,iframeEl)}addLoadListener(cb){this.loadListener=cb}attachIframe(iframeEl,childSn){var _a2,_b;this.mutationCb({adds:[{parentId:this.mirror.getId(iframeEl),nextId:null,node:childSn}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&((_a2=iframeEl.contentWindow)==null||_a2.addEventListener(`message`,this.handleMessage.bind(this))),(_b=this.loadListener)==null||_b.call(this,iframeEl),iframeEl.contentDocument&&iframeEl.contentDocument.adoptedStyleSheets&&iframeEl.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(iframeEl.contentDocument.adoptedStyleSheets,this.mirror.getId(iframeEl.contentDocument))}handleMessage(message){let crossOriginMessageEvent=message;if(crossOriginMessageEvent.data.type!==`rrweb`||crossOriginMessageEvent.origin!==crossOriginMessageEvent.data.origin||!message.source)return;let iframeEl=this.crossOriginIframeMap.get(message.source);if(!iframeEl)return;let transformedEvent=this.transformCrossOriginEvent(iframeEl,crossOriginMessageEvent.data.event);transformedEvent&&this.wrappedEmit(transformedEvent,crossOriginMessageEvent.data.isCheckout)}transformCrossOriginEvent(iframeEl,e2){var _a2;switch(e2.type){case EventType.FullSnapshot:{this.crossOriginIframeMirror.reset(iframeEl),this.crossOriginIframeStyleMirror.reset(iframeEl),this.replaceIdOnNode(e2.data.node,iframeEl);let rootId=e2.data.node.id;return this.crossOriginIframeRootIdMap.set(iframeEl,rootId),this.patchRootIdOnNode(e2.data.node,rootId),{timestamp:e2.timestamp,type:EventType.IncrementalSnapshot,data:{source:IncrementalSource.Mutation,adds:[{parentId:this.mirror.getId(iframeEl),nextId:null,node:e2.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case EventType.Meta:case EventType.Load:case EventType.DomContentLoaded:return!1;case EventType.Plugin:return e2;case EventType.Custom:return this.replaceIds(e2.data.payload,iframeEl,[`id`,`parentId`,`previousId`,`nextId`]),e2;case EventType.IncrementalSnapshot:switch(e2.data.source){case IncrementalSource.Mutation:return e2.data.adds.forEach(n2=>{this.replaceIds(n2,iframeEl,[`parentId`,`nextId`,`previousId`]),this.replaceIdOnNode(n2.node,iframeEl);let rootId=this.crossOriginIframeRootIdMap.get(iframeEl);rootId&&this.patchRootIdOnNode(n2.node,rootId)}),e2.data.removes.forEach(n2=>{this.replaceIds(n2,iframeEl,[`parentId`,`id`])}),e2.data.attributes.forEach(n2=>{this.replaceIds(n2,iframeEl,[`id`])}),e2.data.texts.forEach(n2=>{this.replaceIds(n2,iframeEl,[`id`])}),e2;case IncrementalSource.Drag:case IncrementalSource.TouchMove:case IncrementalSource.MouseMove:return e2.data.positions.forEach(p=>{this.replaceIds(p,iframeEl,[`id`])}),e2;case IncrementalSource.ViewportResize:return!1;case IncrementalSource.MediaInteraction:case IncrementalSource.MouseInteraction:case IncrementalSource.Scroll:case IncrementalSource.CanvasMutation:case IncrementalSource.Input:return this.replaceIds(e2.data,iframeEl,[`id`]),e2;case IncrementalSource.StyleSheetRule:case IncrementalSource.StyleDeclaration:return this.replaceIds(e2.data,iframeEl,[`id`]),this.replaceStyleIds(e2.data,iframeEl,[`styleId`]),e2;case IncrementalSource.Font:return e2;case IncrementalSource.Selection:return e2.data.ranges.forEach(range=>{this.replaceIds(range,iframeEl,[`start`,`end`])}),e2;case IncrementalSource.AdoptedStyleSheet:return this.replaceIds(e2.data,iframeEl,[`id`]),this.replaceStyleIds(e2.data,iframeEl,[`styleIds`]),(_a2=e2.data.styles)==null||_a2.forEach(style=>{this.replaceStyleIds(style,iframeEl,[`styleId`])}),e2}}return!1}replace(iframeMirror,obj,iframeEl,keys){for(let key of keys)(Array.isArray(obj[key])||typeof obj[key]==`number`)&&(obj[key]=Array.isArray(obj[key])?iframeMirror.getIds(iframeEl,obj[key]):iframeMirror.getId(iframeEl,obj[key]));return obj}replaceIds(obj,iframeEl,keys){return this.replace(this.crossOriginIframeMirror,obj,iframeEl,keys)}replaceStyleIds(obj,iframeEl,keys){return this.replace(this.crossOriginIframeStyleMirror,obj,iframeEl,keys)}replaceIdOnNode(node2,iframeEl){this.replaceIds(node2,iframeEl,[`id`,`rootId`]),`childNodes`in node2&&node2.childNodes.forEach(child=>{this.replaceIdOnNode(child,iframeEl)})}patchRootIdOnNode(node2,rootId){node2.type!==NodeType.Document&&!node2.rootId&&(node2.rootId=rootId),`childNodes`in node2&&node2.childNodes.forEach(child=>{this.patchRootIdOnNode(child,rootId)})}},ShadowDomManager=class{constructor(options){__publicField(this,`shadowDoms`,new WeakSet),__publicField(this,`mutationCb`),__publicField(this,`scrollCb`),__publicField(this,`bypassOptions`),__publicField(this,`mirror`),__publicField(this,`restoreHandlers`,[]),this.mutationCb=options.mutationCb,this.scrollCb=options.scrollCb,this.bypassOptions=options.bypassOptions,this.mirror=options.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(shadowRoot2,doc){if(!isNativeShadowDom(shadowRoot2)||this.shadowDoms.has(shadowRoot2))return;this.shadowDoms.add(shadowRoot2);let[observer]=initMutationObserver({...this.bypassOptions,doc,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},shadowRoot2);this.restoreHandlers.push(()=>observer.disconnect()),this.restoreHandlers.push(initScrollObserver({...this.bypassOptions,scrollCb:this.scrollCb,doc:shadowRoot2,mirror:this.mirror})),setTimeout(()=>{shadowRoot2.adoptedStyleSheets&&shadowRoot2.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(shadowRoot2.adoptedStyleSheets,this.mirror.getId(index.host(shadowRoot2))),this.restoreHandlers.push(initAdoptedStyleSheetObserver({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},shadowRoot2))},0)}observeAttachShadow(iframeElement){iframeElement.contentWindow&&iframeElement.contentDocument&&typeof iframeElement.contentWindow.Element==`function`&&this.patchAttachShadow(iframeElement.contentWindow.Element,iframeElement.contentDocument)}patchAttachShadow(element,doc){let manager=this;this.restoreHandlers.push(patch(element.prototype,`attachShadow`,function(original){return function(option){let sRoot=original.call(this,option),shadowRootEl=index.shadowRoot(this);return shadowRootEl&&inDom(this)&&manager.addShadowRoot(shadowRootEl,doc),sRoot}}))}reset(){this.restoreHandlers.forEach(handler=>{try{handler()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}},chars=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,lookup=typeof Uint8Array>`u`?[]:new Uint8Array(256),i$1=0;i$1<chars.length;i$1++)lookup[chars.charCodeAt(i$1)]=i$1;var encode=function(arraybuffer){var bytes=new Uint8Array(arraybuffer),i2,len=bytes.length,base64=``;for(i2=0;i2<len;i2+=3)base64+=chars[bytes[i2]>>2],base64+=chars[(bytes[i2]&3)<<4|bytes[i2+1]>>4],base64+=chars[(bytes[i2+1]&15)<<2|bytes[i2+2]>>6],base64+=chars[bytes[i2+2]&63];return len%3==2?base64=base64.substring(0,base64.length-1)+`=`:len%3==1&&(base64=base64.substring(0,base64.length-2)+`==`),base64},decode=function(base64){var bufferLength=base64.length*.75,len=base64.length,i2,p=0,encoded1,encoded2,encoded3,encoded4;base64[base64.length-1]===`=`&&(bufferLength--,base64[base64.length-2]===`=`&&bufferLength--);var arraybuffer=new ArrayBuffer(bufferLength),bytes=new Uint8Array(arraybuffer);for(i2=0;i2<len;i2+=4)encoded1=lookup[base64.charCodeAt(i2)],encoded2=lookup[base64.charCodeAt(i2+1)],encoded3=lookup[base64.charCodeAt(i2+2)],encoded4=lookup[base64.charCodeAt(i2+3)],bytes[p++]=encoded1<<2|encoded2>>4,bytes[p++]=(encoded2&15)<<4|encoded3>>2,bytes[p++]=(encoded3&3)<<6|encoded4&63;return arraybuffer};const canvasVarMap=new Map;function variableListFor$1(ctx,ctor){let contextMap=canvasVarMap.get(ctx);return contextMap||(contextMap=new Map,canvasVarMap.set(ctx,contextMap)),contextMap.has(ctor)||contextMap.set(ctor,[]),contextMap.get(ctor)}const saveWebGLVar=(value,win,ctx)=>{if(!value||!(isInstanceOfWebGLObject(value,win)||typeof value==`object`))return;let name=value.constructor.name,list=variableListFor$1(ctx,name),index2=list.indexOf(value);return index2===-1&&(index2=list.length,list.push(value)),index2};function serializeArg(value,win,ctx){if(value instanceof Array)return value.map(arg=>serializeArg(arg,win,ctx));if(value===null)return value;if(value instanceof Float32Array||value instanceof Float64Array||value instanceof Int32Array||value instanceof Uint32Array||value instanceof Uint8Array||value instanceof Uint16Array||value instanceof Int16Array||value instanceof Int8Array||value instanceof Uint8ClampedArray)return{rr_type:value.constructor.name,args:[Object.values(value)]};if(value instanceof ArrayBuffer)return{rr_type:value.constructor.name,base64:encode(value)};if(value instanceof DataView)return{rr_type:value.constructor.name,args:[serializeArg(value.buffer,win,ctx),value.byteOffset,value.byteLength]};if(value instanceof HTMLImageElement){let name=value.constructor.name,{src}=value;return{rr_type:name,src}}return value instanceof HTMLCanvasElement?{rr_type:`HTMLImageElement`,src:value.toDataURL()}:value instanceof ImageData?{rr_type:value.constructor.name,args:[serializeArg(value.data,win,ctx),value.width,value.height]}:isInstanceOfWebGLObject(value,win)||typeof value==`object`?{rr_type:value.constructor.name,index:saveWebGLVar(value,win,ctx)}:value}const serializeArgs=(args,win,ctx)=>args.map(arg=>serializeArg(arg,win,ctx)),isInstanceOfWebGLObject=(value,win)=>!![`WebGLActiveInfo`,`WebGLBuffer`,`WebGLFramebuffer`,`WebGLProgram`,`WebGLRenderbuffer`,`WebGLShader`,`WebGLShaderPrecisionFormat`,`WebGLTexture`,`WebGLUniformLocation`,`WebGLVertexArrayObject`,`WebGLVertexArrayObjectOES`].filter(name=>typeof win[name]==`function`).find(name=>value instanceof win[name]);function initCanvas2DMutationObserver(cb,win,blockClass,blockSelector){let handlers=[],props2D=Object.getOwnPropertyNames(win.CanvasRenderingContext2D.prototype);for(let prop of props2D)try{if(typeof win.CanvasRenderingContext2D.prototype[prop]!=`function`)continue;let restoreHandler=patch(win.CanvasRenderingContext2D.prototype,prop,function(original){return function(...args){return isBlocked(this.canvas,blockClass,blockSelector,!0)||setTimeout(()=>{let recordArgs=serializeArgs(args,win,this);cb(this.canvas,{type:CanvasContext[`2D`],property:prop,args:recordArgs})},0),original.apply(this,args)}});handlers.push(restoreHandler)}catch{let hookHandler=hookSetter(win.CanvasRenderingContext2D.prototype,prop,{set(v2){cb(this.canvas,{type:CanvasContext[`2D`],property:prop,args:[v2],setter:!0})}});handlers.push(hookHandler)}return()=>{handlers.forEach(h=>h())}}function getNormalizedContextName(contextType){return contextType===`experimental-webgl`?`webgl`:contextType}function initCanvasContextObserver(win,blockClass,blockSelector,setPreserveDrawingBufferToTrue){let handlers=[];try{let restoreHandler=patch(win.HTMLCanvasElement.prototype,`getContext`,function(original){return function(contextType,...args){if(!isBlocked(this,blockClass,blockSelector,!0)){let ctxName=getNormalizedContextName(contextType);if(`__context`in this||(this.__context=ctxName),setPreserveDrawingBufferToTrue&&[`webgl`,`webgl2`].includes(ctxName)){if(args[0]&&typeof args[0]==`object`){let contextAttributes=args[0];contextAttributes.preserveDrawingBuffer||=!0}else args.splice(0,1,{preserveDrawingBuffer:!0})}}return original.apply(this,[contextType,...args])}});handlers.push(restoreHandler)}catch{console.error(`failed to patch HTMLCanvasElement.prototype.getContext`)}return()=>{handlers.forEach(h=>h())}}function patchGLPrototype(prototype,type,cb,blockClass,blockSelector,win){let handlers=[],props=Object.getOwnPropertyNames(prototype);for(let prop of props)if(![`isContextLost`,`canvas`,`drawingBufferWidth`,`drawingBufferHeight`].includes(prop))try{if(typeof prototype[prop]!=`function`)continue;let restoreHandler=patch(prototype,prop,function(original){return function(...args){let result2=original.apply(this,args);if(saveWebGLVar(result2,win,this),`tagName`in this.canvas&&!isBlocked(this.canvas,blockClass,blockSelector,!0)){let recordArgs=serializeArgs(args,win,this),mutation={type,property:prop,args:recordArgs};cb(this.canvas,mutation)}return result2}});handlers.push(restoreHandler)}catch{let hookHandler=hookSetter(prototype,prop,{set(v2){cb(this.canvas,{type,property:prop,args:[v2],setter:!0})}});handlers.push(hookHandler)}return handlers}function initCanvasWebGLMutationObserver(cb,win,blockClass,blockSelector){let handlers=[];return win.WebGLRenderingContext!==void 0&&handlers.push(...patchGLPrototype(win.WebGLRenderingContext.prototype,CanvasContext.WebGL,cb,blockClass,blockSelector,win)),win.WebGL2RenderingContext!==void 0&&handlers.push(...patchGLPrototype(win.WebGL2RenderingContext.prototype,CanvasContext.WebGL2,cb,blockClass,blockSelector,win)),()=>{handlers.forEach(h=>h())}}const blob=typeof self<`u`&&self.Blob&&new Blob([`(function() {
|
|
61
|
+
"use strict";
|
|
62
|
+
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
63
|
+
var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);
|
|
64
|
+
for (var i = 0; i < chars.length; i++) {
|
|
65
|
+
lookup[chars.charCodeAt(i)] = i;
|
|
66
|
+
}
|
|
67
|
+
var encode = function(arraybuffer) {
|
|
68
|
+
var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = "";
|
|
69
|
+
for (i2 = 0; i2 < len; i2 += 3) {
|
|
70
|
+
base64 += chars[bytes[i2] >> 2];
|
|
71
|
+
base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4];
|
|
72
|
+
base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6];
|
|
73
|
+
base64 += chars[bytes[i2 + 2] & 63];
|
|
74
|
+
}
|
|
75
|
+
if (len % 3 === 2) {
|
|
76
|
+
base64 = base64.substring(0, base64.length - 1) + "=";
|
|
77
|
+
} else if (len % 3 === 1) {
|
|
78
|
+
base64 = base64.substring(0, base64.length - 2) + "==";
|
|
79
|
+
}
|
|
80
|
+
return base64;
|
|
81
|
+
};
|
|
82
|
+
const lastBlobMap = /* @__PURE__ */ new Map();
|
|
83
|
+
const transparentBlobMap = /* @__PURE__ */ new Map();
|
|
84
|
+
async function getTransparentBlobFor(width, height, dataURLOptions) {
|
|
85
|
+
const id = \`\${width}-\${height}\`;
|
|
86
|
+
if ("OffscreenCanvas" in globalThis) {
|
|
87
|
+
if (transparentBlobMap.has(id)) return transparentBlobMap.get(id);
|
|
88
|
+
const offscreen = new OffscreenCanvas(width, height);
|
|
89
|
+
offscreen.getContext("2d");
|
|
90
|
+
const blob = await offscreen.convertToBlob(dataURLOptions);
|
|
91
|
+
const arrayBuffer = await blob.arrayBuffer();
|
|
92
|
+
const base64 = encode(arrayBuffer);
|
|
93
|
+
transparentBlobMap.set(id, base64);
|
|
94
|
+
return base64;
|
|
95
|
+
} else {
|
|
96
|
+
return "";
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
const worker = self;
|
|
100
|
+
worker.onmessage = async function(e) {
|
|
101
|
+
if ("OffscreenCanvas" in globalThis) {
|
|
102
|
+
const { id, bitmap, width, height, dataURLOptions } = e.data;
|
|
103
|
+
const transparentBase64 = getTransparentBlobFor(
|
|
104
|
+
width,
|
|
105
|
+
height,
|
|
106
|
+
dataURLOptions
|
|
107
|
+
);
|
|
108
|
+
const offscreen = new OffscreenCanvas(width, height);
|
|
109
|
+
const ctx = offscreen.getContext("2d");
|
|
110
|
+
ctx.drawImage(bitmap, 0, 0);
|
|
111
|
+
bitmap.close();
|
|
112
|
+
const blob = await offscreen.convertToBlob(dataURLOptions);
|
|
113
|
+
const type = blob.type;
|
|
114
|
+
const arrayBuffer = await blob.arrayBuffer();
|
|
115
|
+
const base64 = encode(arrayBuffer);
|
|
116
|
+
if (!lastBlobMap.has(id) && await transparentBase64 === base64) {
|
|
117
|
+
lastBlobMap.set(id, base64);
|
|
118
|
+
return worker.postMessage({ id });
|
|
119
|
+
}
|
|
120
|
+
if (lastBlobMap.get(id) === base64) return worker.postMessage({ id });
|
|
121
|
+
worker.postMessage({
|
|
122
|
+
id,
|
|
123
|
+
type,
|
|
124
|
+
base64,
|
|
125
|
+
width,
|
|
126
|
+
height
|
|
127
|
+
});
|
|
128
|
+
lastBlobMap.set(id, base64);
|
|
129
|
+
} else {
|
|
130
|
+
return worker.postMessage({ id: e.data.id });
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
})();
|
|
134
|
+
//# sourceMappingURL=image-bitmap-data-url-worker-IJpC7g_b.js.map
|
|
135
|
+
`],{type:`text/javascript;charset=utf-8`});function WorkerWrapper(options){let objURL;try{if(objURL=blob&&(self.URL||self.webkitURL).createObjectURL(blob),!objURL)throw``;let worker=new Worker(objURL,{name:options?.name});return worker.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(objURL)}),worker}catch{return new Worker(`data:text/javascript;charset=utf-8,(function()%20%7B%0A%20%20%22use%20strict%22%3B%0A%20%20var%20chars%20%3D%20%22ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789%2B%2F%22%3B%0A%20%20var%20lookup%20%3D%20typeof%20Uint8Array%20%3D%3D%3D%20%22undefined%22%20%3F%20%5B%5D%20%3A%20new%20Uint8Array(256)%3B%0A%20%20for%20(var%20i%20%3D%200%3B%20i%20%3C%20chars.length%3B%20i%2B%2B)%20%7B%0A%20%20%20%20lookup%5Bchars.charCodeAt(i)%5D%20%3D%20i%3B%0A%20%20%7D%0A%20%20var%20encode%20%3D%20function(arraybuffer)%20%7B%0A%20%20%20%20var%20bytes%20%3D%20new%20Uint8Array(arraybuffer)%2C%20i2%2C%20len%20%3D%20bytes.length%2C%20base64%20%3D%20%22%22%3B%0A%20%20%20%20for%20(i2%20%3D%200%3B%20i2%20%3C%20len%3B%20i2%20%2B%3D%203)%20%7B%0A%20%20%20%20%20%20base64%20%2B%3D%20chars%5Bbytes%5Bi2%5D%20%3E%3E%202%5D%3B%0A%20%20%20%20%20%20base64%20%2B%3D%20chars%5B(bytes%5Bi2%5D%20%26%203)%20%3C%3C%204%20%7C%20bytes%5Bi2%20%2B%201%5D%20%3E%3E%204%5D%3B%0A%20%20%20%20%20%20base64%20%2B%3D%20chars%5B(bytes%5Bi2%20%2B%201%5D%20%26%2015)%20%3C%3C%202%20%7C%20bytes%5Bi2%20%2B%202%5D%20%3E%3E%206%5D%3B%0A%20%20%20%20%20%20base64%20%2B%3D%20chars%5Bbytes%5Bi2%20%2B%202%5D%20%26%2063%5D%3B%0A%20%20%20%20%7D%0A%20%20%20%20if%20(len%20%25%203%20%3D%3D%3D%202)%20%7B%0A%20%20%20%20%20%20base64%20%3D%20base64.substring(0%2C%20base64.length%20-%201)%20%2B%20%22%3D%22%3B%0A%20%20%20%20%7D%20else%20if%20(len%20%25%203%20%3D%3D%3D%201)%20%7B%0A%20%20%20%20%20%20base64%20%3D%20base64.substring(0%2C%20base64.length%20-%202)%20%2B%20%22%3D%3D%22%3B%0A%20%20%20%20%7D%0A%20%20%20%20return%20base64%3B%0A%20%20%7D%3B%0A%20%20const%20lastBlobMap%20%3D%20%2F*%20%40__PURE__%20*%2F%20new%20Map()%3B%0A%20%20const%20transparentBlobMap%20%3D%20%2F*%20%40__PURE__%20*%2F%20new%20Map()%3B%0A%20%20async%20function%20getTransparentBlobFor(width%2C%20height%2C%20dataURLOptions)%20%7B%0A%20%20%20%20const%20id%20%3D%20%60%24%7Bwidth%7D-%24%7Bheight%7D%60%3B%0A%20%20%20%20if%20(%22OffscreenCanvas%22%20in%20globalThis)%20%7B%0A%20%20%20%20%20%20if%20(transparentBlobMap.has(id))%20return%20transparentBlobMap.get(id)%3B%0A%20%20%20%20%20%20const%20offscreen%20%3D%20new%20OffscreenCanvas(width%2C%20height)%3B%0A%20%20%20%20%20%20offscreen.getContext(%222d%22)%3B%0A%20%20%20%20%20%20const%20blob%20%3D%20await%20offscreen.convertToBlob(dataURLOptions)%3B%0A%20%20%20%20%20%20const%20arrayBuffer%20%3D%20await%20blob.arrayBuffer()%3B%0A%20%20%20%20%20%20const%20base64%20%3D%20encode(arrayBuffer)%3B%0A%20%20%20%20%20%20transparentBlobMap.set(id%2C%20base64)%3B%0A%20%20%20%20%20%20return%20base64%3B%0A%20%20%20%20%7D%20else%20%7B%0A%20%20%20%20%20%20return%20%22%22%3B%0A%20%20%20%20%7D%0A%20%20%7D%0A%20%20const%20worker%20%3D%20self%3B%0A%20%20worker.onmessage%20%3D%20async%20function(e)%20%7B%0A%20%20%20%20if%20(%22OffscreenCanvas%22%20in%20globalThis)%20%7B%0A%20%20%20%20%20%20const%20%7B%20id%2C%20bitmap%2C%20width%2C%20height%2C%20dataURLOptions%20%7D%20%3D%20e.data%3B%0A%20%20%20%20%20%20const%20transparentBase64%20%3D%20getTransparentBlobFor(%0A%20%20%20%20%20%20%20%20width%2C%0A%20%20%20%20%20%20%20%20height%2C%0A%20%20%20%20%20%20%20%20dataURLOptions%0A%20%20%20%20%20%20)%3B%0A%20%20%20%20%20%20const%20offscreen%20%3D%20new%20OffscreenCanvas(width%2C%20height)%3B%0A%20%20%20%20%20%20const%20ctx%20%3D%20offscreen.getContext(%222d%22)%3B%0A%20%20%20%20%20%20ctx.drawImage(bitmap%2C%200%2C%200)%3B%0A%20%20%20%20%20%20bitmap.close()%3B%0A%20%20%20%20%20%20const%20blob%20%3D%20await%20offscreen.convertToBlob(dataURLOptions)%3B%0A%20%20%20%20%20%20const%20type%20%3D%20blob.type%3B%0A%20%20%20%20%20%20const%20arrayBuffer%20%3D%20await%20blob.arrayBuffer()%3B%0A%20%20%20%20%20%20const%20base64%20%3D%20encode(arrayBuffer)%3B%0A%20%20%20%20%20%20if%20(!lastBlobMap.has(id)%20%26%26%20await%20transparentBase64%20%3D%3D%3D%20base64)%20%7B%0A%20%20%20%20%20%20%20%20lastBlobMap.set(id%2C%20base64)%3B%0A%20%20%20%20%20%20%20%20return%20worker.postMessage(%7B%20id%20%7D)%3B%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20if%20(lastBlobMap.get(id)%20%3D%3D%3D%20base64)%20return%20worker.postMessage(%7B%20id%20%7D)%3B%0A%20%20%20%20%20%20worker.postMessage(%7B%0A%20%20%20%20%20%20%20%20id%2C%0A%20%20%20%20%20%20%20%20type%2C%0A%20%20%20%20%20%20%20%20base64%2C%0A%20%20%20%20%20%20%20%20width%2C%0A%20%20%20%20%20%20%20%20height%0A%20%20%20%20%20%20%7D)%3B%0A%20%20%20%20%20%20lastBlobMap.set(id%2C%20base64)%3B%0A%20%20%20%20%7D%20else%20%7B%0A%20%20%20%20%20%20return%20worker.postMessage(%7B%20id%3A%20e.data.id%20%7D)%3B%0A%20%20%20%20%7D%0A%20%20%7D%3B%0A%7D)()%3B%0A%2F%2F%23%20sourceMappingURL%3Dimage-bitmap-data-url-worker-IJpC7g_b.js.map%0A`,{name:options?.name})}finally{objURL&&(self.URL||self.webkitURL).revokeObjectURL(objURL)}}var CanvasManager=class{constructor(options){__publicField(this,`pendingCanvasMutations`,new Map),__publicField(this,`rafStamps`,{latestId:0,invokeId:null}),__publicField(this,`mirror`),__publicField(this,`mutationCb`),__publicField(this,`resetObservers`),__publicField(this,`frozen`,!1),__publicField(this,`locked`,!1),__publicField(this,`processMutation`,(target,mutation)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(target)||this.pendingCanvasMutations.set(target,[]),this.pendingCanvasMutations.get(target).push(mutation)});let{sampling=`all`,win,blockClass,blockSelector,recordCanvas,dataURLOptions}=options;this.mutationCb=options.mutationCb,this.mirror=options.mirror,recordCanvas&&sampling===`all`&&this.initCanvasMutationObserver(win,blockClass,blockSelector),recordCanvas&&typeof sampling==`number`&&this.initCanvasFPSObserver(sampling,win,blockClass,blockSelector,{dataURLOptions})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(fps,win,blockClass,blockSelector,options){let canvasContextReset=initCanvasContextObserver(win,blockClass,blockSelector,!0),snapshotInProgressMap=new Map,worker=new WorkerWrapper;worker.onmessage=e2=>{let{id}=e2.data;if(snapshotInProgressMap.set(id,!1),!(`base64`in e2.data))return;let{base64,type,width,height}=e2.data;this.mutationCb({id,type:CanvasContext[`2D`],commands:[{property:`clearRect`,args:[0,0,width,height]},{property:`drawImage`,args:[{rr_type:`ImageBitmap`,args:[{rr_type:`Blob`,data:[{rr_type:`ArrayBuffer`,base64}],type}]},0,0]}]})};let timeBetweenSnapshots=1e3/fps,lastSnapshotTime=0,rafId,getCanvas=()=>{let matchedCanvas=[];return win.document.querySelectorAll(`canvas`).forEach(canvas=>{isBlocked(canvas,blockClass,blockSelector,!0)||matchedCanvas.push(canvas)}),matchedCanvas},takeCanvasSnapshots=timestamp=>{if(lastSnapshotTime&×tamp-lastSnapshotTime<timeBetweenSnapshots){rafId=requestAnimationFrame(takeCanvasSnapshots);return}lastSnapshotTime=timestamp,getCanvas().forEach(async canvas=>{let id=this.mirror.getId(canvas);if(snapshotInProgressMap.get(id)||canvas.width===0||canvas.height===0)return;if(snapshotInProgressMap.set(id,!0),[`webgl`,`webgl2`].includes(canvas.__context)){let context=canvas.getContext(canvas.__context);context?.getContextAttributes()?.preserveDrawingBuffer===!1&&context.clear(context.COLOR_BUFFER_BIT)}let bitmap=await createImageBitmap(canvas);worker.postMessage({id,bitmap,width:canvas.width,height:canvas.height,dataURLOptions:options.dataURLOptions},[bitmap])}),rafId=requestAnimationFrame(takeCanvasSnapshots)};rafId=requestAnimationFrame(takeCanvasSnapshots),this.resetObservers=()=>{canvasContextReset(),cancelAnimationFrame(rafId)}}initCanvasMutationObserver(win,blockClass,blockSelector){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let canvasContextReset=initCanvasContextObserver(win,blockClass,blockSelector,!1),canvas2DReset=initCanvas2DMutationObserver(this.processMutation.bind(this),win,blockClass,blockSelector),canvasWebGL1and2Reset=initCanvasWebGLMutationObserver(this.processMutation.bind(this),win,blockClass,blockSelector);this.resetObservers=()=>{canvasContextReset(),canvas2DReset(),canvasWebGL1and2Reset()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let setLatestRAFTimestamp=timestamp=>{this.rafStamps.latestId=timestamp,requestAnimationFrame(setLatestRAFTimestamp)};requestAnimationFrame(setLatestRAFTimestamp)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((_values,canvas)=>{let id=this.mirror.getId(canvas);this.flushPendingCanvasMutationFor(canvas,id)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(canvas,id){if(this.frozen||this.locked)return;let valuesWithType=this.pendingCanvasMutations.get(canvas);if(!valuesWithType||id===-1)return;let values=valuesWithType.map(value=>{let{type:type2,...rest}=value;return rest}),{type}=valuesWithType[0];this.mutationCb({id,type,commands:values}),this.pendingCanvasMutations.delete(canvas)}},StylesheetManager=class{constructor(options){__publicField(this,`trackedLinkElements`,new WeakSet),__publicField(this,`mutationCb`),__publicField(this,`adoptedStyleSheetCb`),__publicField(this,`styleMirror`,new StyleSheetMirror),this.mutationCb=options.mutationCb,this.adoptedStyleSheetCb=options.adoptedStyleSheetCb}attachLinkElement(linkEl,childSn){`_cssText`in childSn.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:childSn.id,attributes:childSn.attributes}]}),this.trackLinkElement(linkEl)}trackLinkElement(linkEl){this.trackedLinkElements.has(linkEl)||(this.trackedLinkElements.add(linkEl),this.trackStylesheetInLinkElement(linkEl))}adoptStyleSheets(sheets,hostId){if(sheets.length===0)return;let adoptedStyleSheetData={id:hostId,styleIds:[]},styles=[];for(let sheet of sheets){let styleId;this.styleMirror.has(sheet)?styleId=this.styleMirror.getId(sheet):(styleId=this.styleMirror.add(sheet),styles.push({styleId,rules:Array.from(sheet.rules||CSSRule,(r2,index2)=>({rule:stringifyRule(r2,sheet.href),index:index2}))})),adoptedStyleSheetData.styleIds.push(styleId)}styles.length>0&&(adoptedStyleSheetData.styles=styles),this.adoptedStyleSheetCb(adoptedStyleSheetData)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(_linkEl){}},ProcessedNodeManager=class{constructor(){__publicField(this,`nodeMap`,new WeakMap),__publicField(this,`active`,!1)}inOtherBuffer(node2,thisBuffer){let buffers=this.nodeMap.get(node2);return buffers&&Array.from(buffers).some(buffer=>buffer!==thisBuffer)}add(node2,buffer){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(node2,(this.nodeMap.get(node2)||new Set).add(buffer))}destroy(){}};let wrappedEmit,takeFullSnapshot$1,canvasManager,recording=!1;try{if(Array.from([1],x=>x*2)[0]!==2){let cleanFrame=document.createElement(`iframe`);document.body.appendChild(cleanFrame),Array.from=cleanFrame.contentWindow?.Array.from||Array.from,document.body.removeChild(cleanFrame)}}catch(err){console.debug(`Unable to override Array.from`,err)}const mirror=createMirror$2();function record(options={}){let{emit,checkoutEveryNms,checkoutEveryNth,blockClass=`rr-block`,blockSelector=null,ignoreClass=`rr-ignore`,ignoreSelector=null,maskTextClass=`rr-mask`,maskTextSelector=null,inlineStylesheet=!0,maskAllInputs,maskInputOptions:_maskInputOptions,slimDOMOptions:_slimDOMOptions,maskInputFn,maskTextFn,hooks,packFn,sampling={},dataURLOptions={},mousemoveWait,recordDOM=!0,recordCanvas=!1,recordCrossOriginIframes=!1,recordAfter=options.recordAfter===`DOMContentLoaded`?options.recordAfter:`load`,userTriggeredOnInput=!1,collectFonts=!1,inlineImages=!1,plugins,keepIframeSrcFn=()=>!1,ignoreCSSAttributes=new Set([]),errorHandler:errorHandler2}=options;registerErrorHandler(errorHandler2);let inEmittingFrame=!recordCrossOriginIframes||window.parent===window,passEmitsToParent=!1;if(!inEmittingFrame)try{window.parent.document&&(passEmitsToParent=!1)}catch{passEmitsToParent=!0}if(inEmittingFrame&&!emit)throw Error(`emit function is required`);if(!inEmittingFrame&&!passEmitsToParent)return()=>{};mousemoveWait!==void 0&&sampling.mousemove===void 0&&(sampling.mousemove=mousemoveWait),mirror.reset();let maskInputOptions=maskAllInputs===!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}:_maskInputOptions===void 0?{password:!0}:_maskInputOptions,slimDOMOptions=slimDOMDefaults(_slimDOMOptions);polyfill$1();let lastFullSnapshotEvent,incrementalSnapshotCount=0,eventProcessor=e2=>{for(let plugin of plugins||[])plugin.eventProcessor&&(e2=plugin.eventProcessor(e2));return packFn&&!passEmitsToParent&&(e2=packFn(e2)),e2};wrappedEmit=(r2,isCheckout)=>{let e2=r2;if(e2.timestamp=nowTimestamp(),mutationBuffers[0]?.isFrozen()&&e2.type!==EventType.FullSnapshot&&(e2.type!==EventType.IncrementalSnapshot||e2.data.source!==IncrementalSource.Mutation)&&mutationBuffers.forEach(buf=>buf.unfreeze()),inEmittingFrame)emit?.(eventProcessor(e2),isCheckout);else if(passEmitsToParent){let message={type:`rrweb`,event:eventProcessor(e2),origin:window.location.origin,isCheckout};window.parent.postMessage(message,`*`)}if(e2.type===EventType.FullSnapshot)lastFullSnapshotEvent=e2,incrementalSnapshotCount=0;else if(e2.type===EventType.IncrementalSnapshot){if(e2.data.source===IncrementalSource.Mutation&&e2.data.isAttachIframe)return;incrementalSnapshotCount++;let exceedCount=checkoutEveryNth&&incrementalSnapshotCount>=checkoutEveryNth,exceedTime=checkoutEveryNms&&e2.timestamp-lastFullSnapshotEvent.timestamp>checkoutEveryNms;(exceedCount||exceedTime)&&takeFullSnapshot$1(!0)}};let wrappedMutationEmit=m=>{wrappedEmit({type:EventType.IncrementalSnapshot,data:{source:IncrementalSource.Mutation,...m}})},wrappedScrollEmit=p=>wrappedEmit({type:EventType.IncrementalSnapshot,data:{source:IncrementalSource.Scroll,...p}}),wrappedCanvasMutationEmit=p=>wrappedEmit({type:EventType.IncrementalSnapshot,data:{source:IncrementalSource.CanvasMutation,...p}}),stylesheetManager=new StylesheetManager({mutationCb:wrappedMutationEmit,adoptedStyleSheetCb:a2=>wrappedEmit({type:EventType.IncrementalSnapshot,data:{source:IncrementalSource.AdoptedStyleSheet,...a2}})}),iframeManager=new IframeManager({mirror,mutationCb:wrappedMutationEmit,stylesheetManager,recordCrossOriginIframes,wrappedEmit});for(let plugin of plugins||[])plugin.getMirror&&plugin.getMirror({nodeMirror:mirror,crossOriginIframeMirror:iframeManager.crossOriginIframeMirror,crossOriginIframeStyleMirror:iframeManager.crossOriginIframeStyleMirror});let processedNodeManager=new ProcessedNodeManager;canvasManager=new CanvasManager({recordCanvas,mutationCb:wrappedCanvasMutationEmit,win:window,blockClass,blockSelector,mirror,sampling:sampling.canvas,dataURLOptions});let shadowDomManager=new ShadowDomManager({mutationCb:wrappedMutationEmit,scrollCb:wrappedScrollEmit,bypassOptions:{blockClass,blockSelector,maskTextClass,maskTextSelector,inlineStylesheet,maskInputOptions,dataURLOptions,maskTextFn,maskInputFn,recordCanvas,inlineImages,sampling,slimDOMOptions,iframeManager,stylesheetManager,canvasManager,keepIframeSrcFn,processedNodeManager},mirror});takeFullSnapshot$1=(isCheckout=!1)=>{if(!recordDOM)return;wrappedEmit({type:EventType.Meta,data:{href:window.location.href,width:getWindowWidth(),height:getWindowHeight()}},isCheckout),stylesheetManager.reset(),shadowDomManager.init(),mutationBuffers.forEach(buf=>buf.lock());let node2=snapshot(document,{mirror,blockClass,blockSelector,maskTextClass,maskTextSelector,inlineStylesheet,maskAllInputs:maskInputOptions,maskTextFn,maskInputFn,slimDOM:slimDOMOptions,dataURLOptions,recordCanvas,inlineImages,onSerialize:n2=>{isSerializedIframe(n2,mirror)&&iframeManager.addIframe(n2),isSerializedStylesheet(n2,mirror)&&stylesheetManager.trackLinkElement(n2),hasShadowRoot(n2)&&shadowDomManager.addShadowRoot(index.shadowRoot(n2),document)},onIframeLoad:(iframe,childSn)=>{iframeManager.attachIframe(iframe,childSn),shadowDomManager.observeAttachShadow(iframe)},onStylesheetLoad:(linkEl,childSn)=>{stylesheetManager.attachLinkElement(linkEl,childSn)},keepIframeSrcFn});if(!node2)return console.warn(`Failed to snapshot the document`);wrappedEmit({type:EventType.FullSnapshot,data:{node:node2,initialOffset:getWindowScroll(window)}},isCheckout),mutationBuffers.forEach(buf=>buf.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&stylesheetManager.adoptStyleSheets(document.adoptedStyleSheets,mirror.getId(document))};try{let handlers=[],observe=doc=>callbackWrapper(initObservers)({mutationCb:wrappedMutationEmit,mousemoveCb:(positions,source)=>wrappedEmit({type:EventType.IncrementalSnapshot,data:{source,positions}}),mouseInteractionCb:d=>wrappedEmit({type:EventType.IncrementalSnapshot,data:{source:IncrementalSource.MouseInteraction,...d}}),scrollCb:wrappedScrollEmit,viewportResizeCb:d=>wrappedEmit({type:EventType.IncrementalSnapshot,data:{source:IncrementalSource.ViewportResize,...d}}),inputCb:v2=>wrappedEmit({type:EventType.IncrementalSnapshot,data:{source:IncrementalSource.Input,...v2}}),mediaInteractionCb:p=>wrappedEmit({type:EventType.IncrementalSnapshot,data:{source:IncrementalSource.MediaInteraction,...p}}),styleSheetRuleCb:r2=>wrappedEmit({type:EventType.IncrementalSnapshot,data:{source:IncrementalSource.StyleSheetRule,...r2}}),styleDeclarationCb:r2=>wrappedEmit({type:EventType.IncrementalSnapshot,data:{source:IncrementalSource.StyleDeclaration,...r2}}),canvasMutationCb:wrappedCanvasMutationEmit,fontCb:p=>wrappedEmit({type:EventType.IncrementalSnapshot,data:{source:IncrementalSource.Font,...p}}),selectionCb:p=>{wrappedEmit({type:EventType.IncrementalSnapshot,data:{source:IncrementalSource.Selection,...p}})},customElementCb:c2=>{wrappedEmit({type:EventType.IncrementalSnapshot,data:{source:IncrementalSource.CustomElement,...c2}})},blockClass,ignoreClass,ignoreSelector,maskTextClass,maskTextSelector,maskInputOptions,inlineStylesheet,sampling,recordDOM,recordCanvas,inlineImages,userTriggeredOnInput,collectFonts,doc,maskInputFn,maskTextFn,keepIframeSrcFn,blockSelector,slimDOMOptions,dataURLOptions,mirror,iframeManager,stylesheetManager,shadowDomManager,processedNodeManager,canvasManager,ignoreCSSAttributes,plugins:(plugins?.filter(p=>p.observer))?.map(p=>({observer:p.observer,options:p.options,callback:payload=>wrappedEmit({type:EventType.Plugin,data:{plugin:p.name,payload}})}))||[]},hooks);iframeManager.addLoadListener(iframeEl=>{try{handlers.push(observe(iframeEl.contentDocument))}catch(error){console.warn(error)}});let init=()=>{takeFullSnapshot$1(),handlers.push(observe(document)),recording=!0};return[`interactive`,`complete`].includes(document.readyState)?init():(handlers.push(on(`DOMContentLoaded`,()=>{wrappedEmit({type:EventType.DomContentLoaded,data:{}}),recordAfter===`DOMContentLoaded`&&init()})),handlers.push(on(`load`,()=>{wrappedEmit({type:EventType.Load,data:{}}),recordAfter===`load`&&init()},window))),()=>{handlers.forEach(handler=>{try{handler()}catch(error){String(error).toLowerCase().includes(`cross-origin`)||console.warn(error)}}),processedNodeManager.destroy(),recording=!1,unregisterErrorHandler()}}catch(error){console.warn(error)}}record.addCustomEvent=(tag,payload)=>{if(!recording)throw Error(`please add custom event after start recording`);wrappedEmit({type:EventType.Custom,data:{tag,payload}})},record.freezePage=()=>{mutationBuffers.forEach(buf=>buf.freeze())},record.takeFullSnapshot=isCheckout=>{if(!recording)throw Error(`please take full snapshot after start recording`);takeFullSnapshot$1(isCheckout)},record.mirror=mirror;function mitt$1(n2){return{all:n2||=new Map,on:function(t2,e2){var i2=n2.get(t2);i2?i2.push(e2):n2.set(t2,[e2])},off:function(t2,e2){var i2=n2.get(t2);i2&&(e2?i2.splice(i2.indexOf(e2)>>>0,1):n2.set(t2,[]))},emit:function(t2,e2){var i2=n2.get(t2);i2&&i2.slice().map(function(n3){n3(e2)}),(i2=n2.get(`*`))&&i2.slice().map(function(n3){n3(t2,e2)})}}}function polyfill(w=window,d=document){if(`scrollBehavior`in d.documentElement.style&&w.__forceSmoothScrollPolyfill__!==!0)return;let Element2=w.HTMLElement||w.Element,original={scroll:w.scroll||w.scrollTo,scrollBy:w.scrollBy,elementScroll:Element2.prototype.scroll||scrollElement,scrollIntoView:Element2.prototype.scrollIntoView},now=w.performance&&w.performance.now?w.performance.now.bind(w.performance):Date.now;function isMicrosoftBrowser(userAgent){return new RegExp([`MSIE `,`Trident/`,`Edge/`].join(`|`)).test(userAgent)}let ROUNDING_TOLERANCE=+!!isMicrosoftBrowser(w.navigator.userAgent);function scrollElement(x,y){this.scrollLeft=x,this.scrollTop=y}function ease(k){return .5*(1-Math.cos(Math.PI*k))}function shouldBailOut(firstArg){if(typeof firstArg!=`object`||!firstArg||firstArg.behavior===void 0||firstArg.behavior===`auto`||firstArg.behavior===`instant`)return!0;if(typeof firstArg==`object`&&firstArg.behavior===`smooth`)return!1;throw TypeError(`behavior member of ScrollOptions `+firstArg.behavior+` is not a valid value for enumeration ScrollBehavior.`)}function hasScrollableSpace(el,axis){if(axis===`Y`)return el.clientHeight+ROUNDING_TOLERANCE<el.scrollHeight;if(axis===`X`)return el.clientWidth+ROUNDING_TOLERANCE<el.scrollWidth}function canOverflow(el,axis){let overflowValue=w.getComputedStyle(el,null)[`overflow`+axis];return overflowValue===`auto`||overflowValue===`scroll`}function isScrollable(el){let isScrollableY=hasScrollableSpace(el,`Y`)&&canOverflow(el,`Y`),isScrollableX=hasScrollableSpace(el,`X`)&&canOverflow(el,`X`);return isScrollableY||isScrollableX}function findScrollableParent(el){for(;el!==d.body&&isScrollable(el)===!1;)el=el.parentNode||el.host;return el}function step(context){let time=now(),value,currentX,currentY,elapsed=(time-context.startTime)/468;elapsed=elapsed>1?1:elapsed,value=ease(elapsed),currentX=context.startX+(context.x-context.startX)*value,currentY=context.startY+(context.y-context.startY)*value,context.method.call(context.scrollable,currentX,currentY),(currentX!==context.x||currentY!==context.y)&&w.requestAnimationFrame(step.bind(w,context))}function smoothScroll(el,x,y){let scrollable,startX,startY,method,startTime=now();el===d.body?(scrollable=w,startX=w.scrollX||w.pageXOffset,startY=w.scrollY||w.pageYOffset,method=original.scroll):(scrollable=el,startX=el.scrollLeft,startY=el.scrollTop,method=scrollElement),step({scrollable,method,startTime,startX,startY,x,y})}w.scroll=w.scrollTo=function(){if(arguments[0]!==void 0){if(shouldBailOut(arguments[0])===!0){original.scroll.call(w,arguments[0].left===void 0?typeof arguments[0]==`object`?w.scrollX||w.pageXOffset:arguments[0]:arguments[0].left,arguments[0].top===void 0?arguments[1]===void 0?w.scrollY||w.pageYOffset:arguments[1]:arguments[0].top);return}smoothScroll.call(w,d.body,arguments[0].left===void 0?w.scrollX||w.pageXOffset:~~arguments[0].left,arguments[0].top===void 0?w.scrollY||w.pageYOffset:~~arguments[0].top)}},w.scrollBy=function(){if(arguments[0]!==void 0){if(shouldBailOut(arguments[0])){original.scrollBy.call(w,arguments[0].left===void 0?typeof arguments[0]==`object`?0:arguments[0]:arguments[0].left,arguments[0].top===void 0?arguments[1]===void 0?0:arguments[1]:arguments[0].top);return}smoothScroll.call(w,d.body,~~arguments[0].left+(w.scrollX||w.pageXOffset),~~arguments[0].top+(w.scrollY||w.pageYOffset))}},Element2.prototype.scroll=Element2.prototype.scrollTo=function(){if(arguments[0]===void 0)return;if(shouldBailOut(arguments[0])===!0){if(typeof arguments[0]==`number`&&arguments[1]===void 0)throw SyntaxError(`Value could not be converted`);original.elementScroll.call(this,arguments[0].left===void 0?typeof arguments[0]==`object`?this.scrollLeft:~~arguments[0]:~~arguments[0].left,arguments[0].top===void 0?arguments[1]===void 0?this.scrollTop:~~arguments[1]:~~arguments[0].top);return}let left=arguments[0].left,top=arguments[0].top;smoothScroll.call(this,this,left===void 0?this.scrollLeft:~~left,top===void 0?this.scrollTop:~~top)},Element2.prototype.scrollBy=function(){if(arguments[0]!==void 0){if(shouldBailOut(arguments[0])===!0){original.elementScroll.call(this,arguments[0].left===void 0?~~arguments[0]+this.scrollLeft:~~arguments[0].left+this.scrollLeft,arguments[0].top===void 0?~~arguments[1]+this.scrollTop:~~arguments[0].top+this.scrollTop);return}this.scroll({left:~~arguments[0].left+this.scrollLeft,top:~~arguments[0].top+this.scrollTop,behavior:arguments[0].behavior})}},Element2.prototype.scrollIntoView=function(){if(shouldBailOut(arguments[0])===!0){original.scrollIntoView.call(this,arguments[0]===void 0||arguments[0]);return}let scrollableParent=findScrollableParent(this),parentRects=scrollableParent.getBoundingClientRect(),clientRects=this.getBoundingClientRect();scrollableParent===d.body?w.scrollBy({left:clientRects.left,top:clientRects.top,behavior:`smooth`}):(smoothScroll.call(this,scrollableParent,scrollableParent.scrollLeft+clientRects.left-parentRects.left,scrollableParent.scrollTop+clientRects.top-parentRects.top),w.getComputedStyle(scrollableParent).position!==`fixed`&&w.scrollBy({left:parentRects.left,top:parentRects.top,behavior:`smooth`}))}}var Timer=class{constructor(actions=[],config){__publicField(this,`timeOffset`,0),__publicField(this,`speed`),__publicField(this,`actions`),__publicField(this,`raf`,null),__publicField(this,`lastTimestamp`),this.actions=actions,this.speed=config.speed}addAction(action){let rafWasActive=this.raf===!0;if(!this.actions.length||this.actions[this.actions.length-1].delay<=action.delay)this.actions.push(action);else{let index2=this.findActionIndex(action);this.actions.splice(index2,0,action)}rafWasActive&&(this.raf=requestAnimationFrame(this.rafCheck.bind(this)))}start(){this.timeOffset=0,this.lastTimestamp=performance.now(),this.raf=requestAnimationFrame(this.rafCheck.bind(this))}updateLiveTime(){this.raf===!0&&this.rafCheck()}rafCheck(){let time=performance.now();for(this.timeOffset+=(time-this.lastTimestamp)*this.speed,this.lastTimestamp=time;this.actions.length;){let action=this.actions[0];if(this.timeOffset>=action.delay)this.actions.shift(),action.doAction();else break}this.raf=this.actions.length>0?requestAnimationFrame(this.rafCheck.bind(this)):!0}clear(){this.raf&&=(this.raf!==!0&&cancelAnimationFrame(this.raf),null),this.actions.length=0}setSpeed(speed){this.speed=speed}isActive(){return this.raf!==null}findActionIndex(action){let start=0,end=this.actions.length-1;for(;start<=end;){let mid=Math.floor((start+end)/2);if(this.actions[mid].delay<action.delay)start=mid+1;else if(this.actions[mid].delay>action.delay)end=mid-1;else return mid+1}return start}};function addDelay(event,baselineTime){if(event.type===EventType.IncrementalSnapshot&&event.data.source===IncrementalSource.MouseMove&&event.data.positions&&event.data.positions.length){let firstOffset=event.data.positions[0].timeOffset,firstTimestamp=event.timestamp+firstOffset;return event.delay=firstTimestamp-baselineTime,firstTimestamp-baselineTime}return event.delay=event.timestamp-baselineTime,event.delay}
|
|
136
|
+
/*! *****************************************************************************
|
|
137
|
+
Copyright (c) Microsoft Corporation.
|
|
138
|
+
|
|
139
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
140
|
+
purpose with or without fee is hereby granted.
|
|
141
|
+
|
|
142
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
143
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
144
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
145
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
146
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
147
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
148
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
149
|
+
***************************************************************************** */
|
|
150
|
+
function t(t2,n2){var e2=typeof Symbol==`function`&&t2[Symbol.iterator];if(!e2)return t2;var r2,o2,i2=e2.call(t2),a2=[];try{for(;(n2===void 0||n2-->0)&&!(r2=i2.next()).done;)a2.push(r2.value)}catch(t3){o2={error:t3}}finally{try{r2&&!r2.done&&(e2=i2.return)&&e2.call(i2)}finally{if(o2)throw o2.error}}return a2}var n;(function(t2){t2[t2.NotStarted=0]=`NotStarted`,t2[t2.Running=1]=`Running`,t2[t2.Stopped=2]=`Stopped`})(n||={});var e={type:`xstate.init`};function r(t2){return t2===void 0?[]:[].concat(t2)}function o(t2){return{type:`xstate.assign`,assignment:t2}}function i(t2,n2){return typeof(t2=typeof t2==`string`&&n2&&n2[t2]?n2[t2]:t2)==`string`?{type:t2}:typeof t2==`function`?{type:t2.name,exec:t2}:t2}function a(t2){return function(n2){return t2===n2}}function u(t2){return typeof t2==`string`?{type:t2}:t2}function c(t2,n2){return{value:t2,context:n2,actions:[],changed:!1,matches:a(t2)}}function f(t2,n2,e2){var r2=n2,o2=!1;return[t2.filter(function(t3){if(t3.type===`xstate.assign`){o2=!0;var n3=Object.assign({},r2);return typeof t3.assignment==`function`?n3=t3.assignment(r2,e2):Object.keys(t3.assignment).forEach(function(o3){n3[o3]=typeof t3.assignment[o3]==`function`?t3.assignment[o3](r2,e2):t3.assignment[o3]}),r2=n3,!1}return!0}),r2,o2]}function s(n2,o2){o2===void 0&&(o2={});var s2=t(f(r(n2.states[n2.initial].entry).map(function(t2){return i(t2,o2.actions)}),n2.context,e),2),l2=s2[0],v2=s2[1],y={config:n2,_options:o2,initialState:{value:n2.initial,actions:l2,context:v2,matches:a(n2.initial)},transition:function(e2,o3){var s3,l3,v3=typeof e2==`string`?{value:e2,context:n2.context}:e2,p=v3.value,g=v3.context,d=u(o3),x=n2.states[p];if(x.on){var m=r(x.on[d.type]);try{for(var h=function(t2){var n3=typeof Symbol==`function`&&Symbol.iterator,e3=n3&&t2[n3],r2=0;if(e3)return e3.call(t2);if(t2&&typeof t2.length==`number`)return{next:function(){return t2&&r2>=t2.length&&(t2=void 0),{value:t2&&t2[r2++],done:!t2}}};throw TypeError(n3?`Object is not iterable.`:`Symbol.iterator is not defined.`)}(m),b=h.next();!b.done;b=h.next()){var S=b.value;if(S===void 0)return c(p,g);var w=typeof S==`string`?{target:S}:S,j=w.target,E=w.actions,R=E===void 0?[]:E,N=w.cond,O=N===void 0?function(){return!0}:N,_=j===void 0,k=j??p,T=n2.states[k];if(O(g,d)){var q=t(f((_?r(R):[].concat(x.exit,R,T.entry).filter(function(t2){return t2})).map(function(t2){return i(t2,y._options.actions)}),g,d),3),z=q[0],A=q[1],B=q[2],C=j??p;return{value:C,context:A,actions:z,changed:j!==p||z.length>0||B,matches:a(C)}}}}catch(t2){s3={error:t2}}finally{try{b&&!b.done&&(l3=h.return)&&l3.call(h)}finally{if(s3)throw s3.error}}}return c(p,g)}};return y}var l=function(t2,n2){return t2.actions.forEach(function(e2){var r2=e2.exec;return r2&&r2(t2.context,n2)})};function v(t2){var r2=t2.initialState,o2=n.NotStarted,i2=new Set,c2={_machine:t2,send:function(e2){o2===n.Running&&(r2=t2.transition(r2,e2),l(r2,u(e2)),i2.forEach(function(t3){return t3(r2)}))},subscribe:function(t3){return i2.add(t3),t3(r2),{unsubscribe:function(){return i2.delete(t3)}}},start:function(i3){if(i3){var u2=typeof i3==`object`?i3:{context:t2.config.context,value:i3};r2={value:u2.value,actions:[],context:u2.context,matches:a(u2.value)}}return o2=n.Running,l(r2,e),c2},stop:function(){return o2=n.Stopped,i2.clear(),c2},get state(){return r2},get status(){return o2}};return c2}function discardPriorSnapshots(events,baselineTime){for(let idx=events.length-1;idx>=0;idx--){let event=events[idx];if(event.type===EventType.Meta&&event.timestamp<=baselineTime)return events.slice(idx)}return events}function createPlayerService(context,{getCastFn,applyEventsSynchronously,emitter}){return v(s({id:`player`,context,initial:`paused`,states:{playing:{on:{PAUSE:{target:`paused`,actions:[`pause`]},CAST_EVENT:{target:`playing`,actions:`castEvent`},END:{target:`paused`,actions:[`resetLastPlayedEvent`,`pause`]},ADD_EVENT:{target:`playing`,actions:[`addEvent`]}}},paused:{on:{PLAY:{target:`playing`,actions:[`recordTimeOffset`,`play`]},CAST_EVENT:{target:`paused`,actions:`castEvent`},TO_LIVE:{target:`live`,actions:[`startLive`]},ADD_EVENT:{target:`paused`,actions:[`addEvent`]}}},live:{on:{ADD_EVENT:{target:`live`,actions:[`addEvent`]},CAST_EVENT:{target:`live`,actions:[`castEvent`]}}}}},{actions:{castEvent:o({lastPlayedEvent:(ctx,event)=>event.type===`CAST_EVENT`?event.payload.event:ctx.lastPlayedEvent}),recordTimeOffset:o((ctx,event)=>{let timeOffset=ctx.timeOffset;return`payload`in event&&`timeOffset`in event.payload&&(timeOffset=event.payload.timeOffset),{...ctx,timeOffset,baselineTime:ctx.events[0].timestamp+timeOffset}}),play(ctx){let{timer,events,baselineTime,lastPlayedEvent}=ctx;timer.clear();for(let event of events)addDelay(event,baselineTime);let neededEvents=discardPriorSnapshots(events,baselineTime),lastPlayedTimestamp=lastPlayedEvent?.timestamp;lastPlayedEvent?.type===EventType.IncrementalSnapshot&&lastPlayedEvent.data.source===IncrementalSource.MouseMove&&(lastPlayedTimestamp=lastPlayedEvent.timestamp+lastPlayedEvent.data.positions[0]?.timeOffset),baselineTime<(lastPlayedTimestamp||0)&&emitter.emit(ReplayerEvents.PlayBack);let syncEvents=[];for(let event of neededEvents)if(!(lastPlayedTimestamp&&lastPlayedTimestamp<baselineTime&&(event.timestamp<=lastPlayedTimestamp||event===lastPlayedEvent))){if(event.timestamp<baselineTime)syncEvents.push(event);else{let castFn=getCastFn(event,!1);timer.addAction({doAction:()=>{castFn()},delay:event.delay})}}applyEventsSynchronously(syncEvents),emitter.emit(ReplayerEvents.Flush),timer.start()},pause(ctx){ctx.timer.clear()},resetLastPlayedEvent:o(ctx=>({...ctx,lastPlayedEvent:null})),startLive:o({baselineTime:(ctx,event)=>(ctx.timer.start(),event.type===`TO_LIVE`&&event.payload.baselineTime?event.payload.baselineTime:Date.now())}),addEvent:o((ctx,machineEvent)=>{let{baselineTime,timer,events}=ctx;if(machineEvent.type===`ADD_EVENT`){let{event}=machineEvent.payload;addDelay(event,baselineTime);let end=events.length-1;if(!events[end]||events[end].timestamp<=event.timestamp)events.push(event);else{let insertionIndex=-1,start=0;for(;start<=end;){let mid=Math.floor((start+end)/2);events[mid].timestamp<=event.timestamp?start=mid+1:end=mid-1}insertionIndex===-1&&(insertionIndex=start),events.splice(insertionIndex,0,event)}let isSync=event.timestamp<baselineTime,castFn=getCastFn(event,isSync);isSync?castFn():timer.isActive()&&timer.addAction({doAction:()=>{castFn()},delay:event.delay})}return{...ctx,events}})}}))}function createSpeedService(context){return v(s({id:`speed`,context,initial:`normal`,states:{normal:{on:{FAST_FORWARD:{target:`skipping`,actions:[`recordSpeed`,`setSpeed`]},SET_SPEED:{target:`normal`,actions:[`setSpeed`]}}},skipping:{on:{BACK_TO_NORMAL:{target:`normal`,actions:[`restoreSpeed`]},SET_SPEED:{target:`normal`,actions:[`setSpeed`]}}}}},{actions:{setSpeed:(ctx,event)=>{`payload`in event&&ctx.timer.setSpeed(event.payload.speed)},recordSpeed:o({normalSpeed:ctx=>ctx.timer.speed}),restoreSpeed:ctx=>{ctx.timer.setSpeed(ctx.normalSpeed)}}}))}const rules=blockClass=>[`.${blockClass} { background: currentColor }`,`noscript { display: none !important; }`],webGLVarMap=new Map;function variableListFor(ctx,ctor){let contextMap=webGLVarMap.get(ctx);return contextMap||(contextMap=new Map,webGLVarMap.set(ctx,contextMap)),contextMap.has(ctor)||contextMap.set(ctor,[]),contextMap.get(ctor)}function deserializeArg(imageMap,ctx,preload){return async arg=>{if(arg&&typeof arg==`object`&&`rr_type`in arg){if(preload&&(preload.isUnchanged=!1),arg.rr_type===`ImageBitmap`&&`args`in arg){let args=await deserializeArg(imageMap,ctx,preload)(arg.args);return await createImageBitmap.apply(null,args)}if(`index`in arg){if(preload||ctx===null)return arg;let{rr_type:name,index:index2}=arg;return variableListFor(ctx,name)[index2]}if(`args`in arg){let{rr_type:name,args}=arg,ctor=window[name];return new ctor(...await Promise.all(args.map(deserializeArg(imageMap,ctx,preload))))}if(`base64`in arg)return decode(arg.base64);if(`src`in arg){let image=imageMap.get(arg.src);if(image)return image;{let image2=new Image;return image2.src=arg.src,imageMap.set(arg.src,image2),image2}}if(`data`in arg&&arg.rr_type===`Blob`){let blobContents=await Promise.all(arg.data.map(deserializeArg(imageMap,ctx,preload)));return new Blob(blobContents,{type:arg.type})}}else if(Array.isArray(arg))return await Promise.all(arg.map(deserializeArg(imageMap,ctx,preload)));return arg}}function getContext(target,type){try{return type===CanvasContext.WebGL?target.getContext(`webgl`)||target.getContext(`experimental-webgl`):target.getContext(`webgl2`)}catch{return null}}const WebGLVariableConstructorsNames=[`WebGLActiveInfo`,`WebGLBuffer`,`WebGLFramebuffer`,`WebGLProgram`,`WebGLRenderbuffer`,`WebGLShader`,`WebGLShaderPrecisionFormat`,`WebGLTexture`,`WebGLUniformLocation`,`WebGLVertexArrayObject`];function saveToWebGLVarMap(ctx,result2){if(!result2?.constructor)return;let{name}=result2.constructor;if(!WebGLVariableConstructorsNames.includes(name))return;let variables=variableListFor(ctx,name);variables.includes(result2)||variables.push(result2)}async function webglMutation({mutation,target,type,imageMap,errorHandler:errorHandler2}){try{let ctx=getContext(target,type);if(!ctx)return;if(mutation.setter){ctx[mutation.property]=mutation.args[0];return}let original=ctx[mutation.property],args=await Promise.all(mutation.args.map(deserializeArg(imageMap,ctx)));saveToWebGLVarMap(ctx,original.apply(ctx,args))}catch(error){errorHandler2(mutation,error)}}async function canvasMutation$1({event,mutations,target,imageMap,errorHandler:errorHandler2}){let ctx=target.getContext(`2d`);if(!ctx){errorHandler2(mutations[0],Error(`Canvas context is null`));return}let mutationArgsPromises=mutations.map(async mutation=>Promise.all(mutation.args.map(deserializeArg(imageMap,ctx))));(await Promise.all(mutationArgsPromises)).forEach((args2,index2)=>{let mutation=mutations[index2];try{if(mutation.setter){ctx[mutation.property]=mutation.args[0];return}let original=ctx[mutation.property];mutation.property===`drawImage`&&typeof mutation.args[0]==`string`?(imageMap.get(event),original.apply(ctx,mutation.args)):original.apply(ctx,args2)}catch(error){errorHandler2(mutation,error)}})}async function canvasMutation({event,mutation,target,imageMap,canvasEventMap,errorHandler:errorHandler2}){try{let precomputedMutation=canvasEventMap.get(event)||mutation,commands=`commands`in precomputedMutation?precomputedMutation.commands:[precomputedMutation];if([CanvasContext.WebGL,CanvasContext.WebGL2].includes(mutation.type)){for(let i2=0;i2<commands.length;i2++){let command=commands[i2];await webglMutation({mutation:command,type:mutation.type,target,imageMap,errorHandler:errorHandler2})}return}await canvasMutation$1({event,mutations:commands,target,imageMap,errorHandler:errorHandler2})}catch(error){errorHandler2(mutation,error)}}var MediaManager=class{constructor(options){__publicField(this,`mediaMap`,new Map),__publicField(this,`warn`),__publicField(this,`service`),__publicField(this,`speedService`),__publicField(this,`emitter`),__publicField(this,`getCurrentTime`),__publicField(this,`metadataCallbackMap`,new Map),this.warn=options.warn,this.service=options.service,this.speedService=options.speedService,this.emitter=options.emitter,this.getCurrentTime=options.getCurrentTime,this.emitter.on(ReplayerEvents.Start,this.start.bind(this)),this.emitter.on(ReplayerEvents.SkipStart,this.start.bind(this)),this.emitter.on(ReplayerEvents.Pause,this.pause.bind(this)),this.emitter.on(ReplayerEvents.Finish,this.pause.bind(this)),this.speedService.subscribe(()=>{this.syncAllMediaElements()})}syncAllMediaElements(options={pause:!1}){this.mediaMap.forEach((_mediaState,target)=>{this.syncTargetWithState(target),options.pause&&target.pause()})}start(){this.syncAllMediaElements()}pause(){this.syncAllMediaElements({pause:!0})}seekTo({time,target,mediaState}){if(mediaState.isPlaying){let mediaPlaybackOffset=(time-mediaState.lastInteractionTimeOffset)/1e3*mediaState.playbackRate,duration=`duration`in target&&target.duration;if(Number.isNaN(duration)){this.waitForMetadata(target);return}let seekToTime=mediaState.currentTimeAtLastInteraction+mediaPlaybackOffset;target.loop&&duration!==!1&&(seekToTime%=duration),target.currentTime=seekToTime}else target.pause(),target.currentTime=mediaState.currentTimeAtLastInteraction}waitForMetadata(target){if(this.metadataCallbackMap.has(target)||!(`addEventListener`in target))return;let onLoadedMetadata=()=>{this.metadataCallbackMap.delete(target);let mediaState=this.mediaMap.get(target);mediaState&&this.seekTo({time:this.getCurrentTime(),target,mediaState})};this.metadataCallbackMap.set(target,onLoadedMetadata),target.addEventListener(`loadedmetadata`,onLoadedMetadata,{once:!0})}getMediaStateFromMutation({target,timeOffset,mutation}){let lastState=this.mediaMap.get(target),{type,playbackRate,currentTime,muted,volume,loop}=mutation;return{isPlaying:type===MediaInteractions.Play||type!==MediaInteractions.Pause&&(lastState?.isPlaying||target.getAttribute(`autoplay`)!==null),currentTimeAtLastInteraction:currentTime??lastState?.currentTimeAtLastInteraction??0,lastInteractionTimeOffset:timeOffset,playbackRate:playbackRate??lastState?.playbackRate??1,volume:volume??lastState?.volume??1,muted:muted??lastState?.muted??target.getAttribute(`muted`)===null,loop:loop??lastState?.loop??target.getAttribute(`loop`)===null}}syncTargetWithState(target){let mediaState=this.mediaMap.get(target);if(!mediaState)return;let{muted,loop,volume,isPlaying}=mediaState,playerIsPaused=this.service.state.matches(`paused`),playbackRate=mediaState.playbackRate*this.speedService.state.context.timer.speed;try{this.seekTo({time:this.getCurrentTime(),target,mediaState}),target.volume!==volume&&(target.volume=volume),target.muted=muted,target.loop=loop,target.playbackRate!==playbackRate&&(target.playbackRate=playbackRate),isPlaying&&!playerIsPaused?target.play():target.pause()}catch(error){this.warn(`Failed to replay media interactions: ${error.message||error}`)}}addMediaElements(node2,timeOffset,mirror2){if(![`AUDIO`,`VIDEO`].includes(node2.nodeName))return;let target=node2,serializedNode=mirror2.getMeta(target);if(!serializedNode||!(`attributes`in serializedNode))return;let playerIsPaused=this.service.state.matches(`paused`),mediaAttributes=serializedNode.attributes,isPlaying=!1;isPlaying=mediaAttributes.rr_mediaState?mediaAttributes.rr_mediaState===`played`:target.getAttribute(`autoplay`)!==null,isPlaying&&playerIsPaused&&target.pause();let playbackRate=1;typeof mediaAttributes.rr_mediaPlaybackRate==`number`&&(playbackRate=mediaAttributes.rr_mediaPlaybackRate);let muted=!1;muted=typeof mediaAttributes.rr_mediaMuted==`boolean`?mediaAttributes.rr_mediaMuted:target.getAttribute(`muted`)!==null;let loop=!1;loop=typeof mediaAttributes.rr_mediaLoop==`boolean`?mediaAttributes.rr_mediaLoop:target.getAttribute(`loop`)!==null;let volume=1;typeof mediaAttributes.rr_mediaVolume==`number`&&(volume=mediaAttributes.rr_mediaVolume);let currentTimeAtLastInteraction=0;typeof mediaAttributes.rr_mediaCurrentTime==`number`&&(currentTimeAtLastInteraction=mediaAttributes.rr_mediaCurrentTime),this.mediaMap.set(target,{isPlaying,currentTimeAtLastInteraction,lastInteractionTimeOffset:timeOffset,playbackRate,volume,muted,loop}),this.syncTargetWithState(target)}mediaMutation({target,timeOffset,mutation}){this.mediaMap.set(target,this.getMediaStateFromMutation({target,timeOffset,mutation})),this.syncTargetWithState(target)}isSupportedMediaElement(node2){return[`AUDIO`,`VIDEO`].includes(node2.nodeName)}reset(){this.mediaMap.clear()}};function applyDialogToTopLevel(node2,attributeMutation){if(node2.nodeName!==`DIALOG`||node2 instanceof BaseRRNode)return;let dialog=node2,oldIsOpen=dialog.open,oldIsModalState=oldIsOpen&&dialog.matches(`dialog:modal`),rrOpenMode=dialog.getAttribute(`rr_open_mode`),newIsOpen=typeof attributeMutation?.attributes.open==`string`||typeof dialog.getAttribute(`open`)==`string`,newIsModalState=rrOpenMode===`modal`;if(!oldIsOpen||oldIsModalState&&rrOpenMode===`non-modal`||!oldIsModalState&&newIsModalState){if(!dialog.isConnected){console.warn(`dialog is not attached to the dom`,dialog);return}oldIsOpen&&dialog.close(),newIsOpen&&(newIsModalState?dialog.showModal():dialog.show())}}function removeDialogFromTopLevel(node2,attributeMutation){if(node2.nodeName!==`DIALOG`||node2 instanceof BaseRRNode)return;let dialog=node2;if(!dialog.isConnected){console.warn(`dialog is not attached to the dom`,dialog);return}attributeMutation.attributes.open===null&&(dialog.removeAttribute(`open`),dialog.removeAttribute(`rr_open_mode`))}const mitt=mitt$1,REPLAY_CONSOLE_PREFIX=`[replayer]`,defaultMouseTailConfig={duration:500,lineCap:`round`,lineWidth:3,strokeStyle:`red`};function indicatesTouchDevice(e2){return e2.type==EventType.IncrementalSnapshot&&(e2.data.source==IncrementalSource.TouchMove||e2.data.source==IncrementalSource.MouseInteraction&&e2.data.type==MouseInteractions.TouchStart)}var Replayer=class{constructor(events,config){if(__publicField(this,`wrapper`),__publicField(this,`iframe`),__publicField(this,`UNSAFE_replayCanvas`,!1),__publicField(this,`service`),__publicField(this,`speedService`),__publicField(this,`config`),__publicField(this,`usingVirtualDom`,!1),__publicField(this,`virtualDom`,new RRDocument),__publicField(this,`mouse`),__publicField(this,`mouseTail`,null),__publicField(this,`tailPositions`,[]),__publicField(this,`emitter`,mitt()),__publicField(this,`nextUserInteractionEvent`),__publicField(this,`legacy_missingNodeRetryMap`,{}),__publicField(this,`cache`,createCache()),__publicField(this,`imageMap`,new Map),__publicField(this,`canvasEventMap`,new Map),__publicField(this,`mirror`,createMirror$2()),__publicField(this,`styleMirror`,new StyleSheetMirror),__publicField(this,`mediaManager`),__publicField(this,`firstFullSnapshot`,null),__publicField(this,`newDocumentQueue`,[]),__publicField(this,`mousePos`,null),__publicField(this,`touchActive`,null),__publicField(this,`lastMouseDownEvent`,null),__publicField(this,`lastHoveredRootNode`),__publicField(this,`lastSelectionData`,null),__publicField(this,`constructedStyleMutations`,[]),__publicField(this,`adoptedStyleSheets`,[]),__publicField(this,`handleResize`,dimension=>{this.iframe.style.display=`inherit`;for(let el of[this.mouseTail,this.iframe])el&&(el.setAttribute(`width`,String(dimension.width)),el.setAttribute(`height`,String(dimension.height)))}),__publicField(this,`applyEventsSynchronously`,events=>{for(let event of events){switch(event.type){case EventType.DomContentLoaded:case EventType.Load:case EventType.Custom:continue;case EventType.FullSnapshot:case EventType.Meta:case EventType.Plugin:case EventType.IncrementalSnapshot:}this.getCastFn(event,!0)()}}),__publicField(this,`getCastFn`,(event,isSync=!1)=>{let castFn;switch(event.type){case EventType.DomContentLoaded:case EventType.Load:break;case EventType.Custom:castFn=()=>{this.emitter.emit(ReplayerEvents.CustomEvent,event)};break;case EventType.Meta:castFn=()=>this.emitter.emit(ReplayerEvents.Resize,{width:event.data.width,height:event.data.height});break;case EventType.FullSnapshot:castFn=()=>{var _a2;if(this.firstFullSnapshot){if(this.firstFullSnapshot===event){this.firstFullSnapshot=!0;return}}else this.firstFullSnapshot=!0;this.mediaManager.reset(),this.styleMirror.reset(),this.rebuildFullSnapshot(event,isSync),(_a2=this.iframe.contentWindow)==null||_a2.scrollTo(event.data.initialOffset)};break;case EventType.IncrementalSnapshot:castFn=()=>{if(this.applyIncremental(event,isSync),!isSync&&(event===this.nextUserInteractionEvent&&(this.nextUserInteractionEvent=null,this.backToNormal()),this.config.skipInactive&&!this.nextUserInteractionEvent)){for(let _event of this.service.state.context.events)if(!(_event.timestamp<=event.timestamp)&&this.isUserInteraction(_event)){_event.delay-event.delay>this.config.inactivePeriodThreshold*this.speedService.state.context.timer.speed&&(this.nextUserInteractionEvent=_event);break}if(this.nextUserInteractionEvent){let skipTime=this.nextUserInteractionEvent.delay-event.delay,payload={speed:Math.min(Math.round(skipTime/5e3),this.config.maxSpeed)};this.speedService.send({type:`FAST_FORWARD`,payload}),this.emitter.emit(ReplayerEvents.SkipStart,payload)}}}}return()=>{castFn&&castFn();for(let plugin of this.config.plugins||[])plugin.handler&&plugin.handler(event,isSync,{replayer:this});this.service.send({type:`CAST_EVENT`,payload:{event}});let lastIndex=this.service.state.context.events.length-1;if(!this.config.liveMode&&event===this.service.state.context.events[lastIndex]){let finish=()=>{lastIndex<this.service.state.context.events.length-1||(this.backToNormal(),this.service.send(`END`),this.emitter.emit(ReplayerEvents.Finish))},finishBuffer=50;event.type===EventType.IncrementalSnapshot&&event.data.source===IncrementalSource.MouseMove&&event.data.positions.length&&(finishBuffer+=Math.max(0,-event.data.positions[0].timeOffset)),setTimeout(finish,finishBuffer)}this.emitter.emit(ReplayerEvents.EventCast,event)}}),!config?.liveMode&&events.length<2)throw Error(`Replayer need at least 2 events.`);let defaultConfig={speed:1,maxSpeed:360,root:document.body,loadTimeout:0,skipInactive:!1,inactivePeriodThreshold:1e4,showWarning:!0,showDebug:!1,blockClass:`rr-block`,liveMode:!1,insertStyleRules:[],triggerFocus:!0,UNSAFE_replayCanvas:!1,pauseAnimation:!0,mouseTail:defaultMouseTailConfig,useVirtualDom:!0,logger:console};this.config=Object.assign({},defaultConfig,config),this.handleResize=this.handleResize.bind(this),this.getCastFn=this.getCastFn.bind(this),this.applyEventsSynchronously=this.applyEventsSynchronously.bind(this),this.emitter.on(ReplayerEvents.Resize,this.handleResize),this.setupDom();for(let plugin of this.config.plugins||[])plugin.getMirror&&plugin.getMirror({nodeMirror:this.mirror});this.emitter.on(ReplayerEvents.Flush,()=>{if(this.usingVirtualDom){let replayerHandler={mirror:this.mirror,applyCanvas:(canvasEvent,canvasMutationData,target)=>{canvasMutation({event:canvasEvent,mutation:canvasMutationData,target,imageMap:this.imageMap,canvasEventMap:this.canvasEventMap,errorHandler:this.warnCanvasMutationFailed.bind(this)})},applyInput:this.applyInput.bind(this),applyScroll:this.applyScroll.bind(this),applyStyleSheetMutation:(data,styleSheet)=>{data.source===IncrementalSource.StyleSheetRule?this.applyStyleSheetRule(data,styleSheet):data.source===IncrementalSource.StyleDeclaration&&this.applyStyleDeclaration(data,styleSheet)},afterAppend:(node2,id)=>{for(let plugin of this.config.plugins||[])plugin.onBuild&&plugin.onBuild(node2,{id,replayer:this})}};if(this.iframe.contentDocument)try{diff(this.iframe.contentDocument,this.virtualDom,replayerHandler,this.virtualDom.mirror)}catch(e2){console.warn(e2)}if(this.virtualDom.destroyTree(),this.usingVirtualDom=!1,Object.keys(this.legacy_missingNodeRetryMap).length)for(let key in this.legacy_missingNodeRetryMap)try{let value=this.legacy_missingNodeRetryMap[key],realNode=createOrGetNode(value.node,this.mirror,this.virtualDom.mirror);diff(realNode,value.node,replayerHandler,this.virtualDom.mirror),value.node=realNode}catch(error){this.warn(error)}this.constructedStyleMutations.forEach(data=>{this.applyStyleSheetMutation(data)}),this.constructedStyleMutations=[],this.adoptedStyleSheets.forEach(data=>{this.applyAdoptedStyleSheet(data)}),this.adoptedStyleSheets=[]}if(this.mousePos&&=(this.moveAndHover(this.mousePos.x,this.mousePos.y,this.mousePos.id,!0,this.mousePos.debugData),null),this.touchActive===!0?this.mouse.classList.add(`touch-active`):this.touchActive===!1&&this.mouse.classList.remove(`touch-active`),this.touchActive=null,this.lastMouseDownEvent){let[target,event]=this.lastMouseDownEvent;target.dispatchEvent(event)}this.lastMouseDownEvent=null,this.lastSelectionData&&=(this.applySelection(this.lastSelectionData),null)}),this.emitter.on(ReplayerEvents.PlayBack,()=>{this.firstFullSnapshot=null,this.mirror.reset(),this.styleMirror.reset(),this.mediaManager.reset()});let timer=new Timer([],{speed:this.config.speed});this.service=createPlayerService({events:events.map(e2=>config&&config.unpackFn?config.unpackFn(e2):e2).sort((a1,a2)=>a1.timestamp-a2.timestamp),timer,timeOffset:0,baselineTime:0,lastPlayedEvent:null},{getCastFn:this.getCastFn,applyEventsSynchronously:this.applyEventsSynchronously,emitter:this.emitter}),this.service.start(),this.service.subscribe(state=>{this.emitter.emit(ReplayerEvents.StateChange,{player:state})}),this.speedService=createSpeedService({normalSpeed:-1,timer}),this.speedService.start(),this.speedService.subscribe(state=>{this.emitter.emit(ReplayerEvents.StateChange,{speed:state})}),this.mediaManager=new MediaManager({warn:this.warn.bind(this),service:this.service,speedService:this.speedService,emitter:this.emitter,getCurrentTime:this.getCurrentTime.bind(this)});let firstMeta=this.service.state.context.events.find(e2=>e2.type===EventType.Meta),firstFullsnapshot=this.service.state.context.events.find(e2=>e2.type===EventType.FullSnapshot);if(firstMeta){let{width,height}=firstMeta.data;setTimeout(()=>{this.emitter.emit(ReplayerEvents.Resize,{width,height})},0)}firstFullsnapshot&&setTimeout(()=>{var _a2;this.firstFullSnapshot||(this.firstFullSnapshot=firstFullsnapshot,this.rebuildFullSnapshot(firstFullsnapshot),(_a2=this.iframe.contentWindow)==null||_a2.scrollTo(firstFullsnapshot.data.initialOffset))},1),this.service.state.context.events.find(indicatesTouchDevice)&&this.mouse.classList.add(`touch-device`)}get timer(){return this.service.state.context.timer}on(event,handler){return this.emitter.on(event,handler),this}off(event,handler){return this.emitter.off(event,handler),this}setConfig(config){Object.keys(config).forEach(key=>{config[key],this.config[key]=config[key]}),this.config.skipInactive||this.backToNormal(),config.speed!==void 0&&this.speedService.send({type:`SET_SPEED`,payload:{speed:config.speed}}),config.mouseTail!==void 0&&(config.mouseTail===!1?this.mouseTail&&(this.mouseTail.style.display=`none`):(this.mouseTail||(this.mouseTail=document.createElement(`canvas`),this.mouseTail.width=Number.parseFloat(this.iframe.width),this.mouseTail.height=Number.parseFloat(this.iframe.height),this.mouseTail.classList.add(`replayer-mouse-tail`),this.wrapper.insertBefore(this.mouseTail,this.iframe)),this.mouseTail.style.display=`inherit`))}getMetaData(){let firstEvent=this.service.state.context.events[0],lastEvent=this.service.state.context.events[this.service.state.context.events.length-1];return{startTime:firstEvent.timestamp,endTime:lastEvent.timestamp,totalTime:lastEvent.timestamp-firstEvent.timestamp}}getCurrentTime(){return this.config.liveMode&&this.timer.updateLiveTime(),this.timer.timeOffset+this.getTimeOffset()}getTimeOffset(){let{baselineTime,events}=this.service.state.context;return baselineTime-events[0].timestamp}getMirror(){return this.mirror}play(timeOffset=0){var _b;this.service.state.matches(`paused`)||this.service.send({type:`PAUSE`}),this.service.send({type:`PLAY`,payload:{timeOffset}}),(_b=this.iframe.contentDocument?.getElementsByTagName(`html`)[0])==null||_b.classList.remove(`rrweb-paused`),this.emitter.emit(ReplayerEvents.Start)}pause(timeOffset){var _b;timeOffset===void 0&&this.service.state.matches(`playing`)&&this.service.send({type:`PAUSE`}),typeof timeOffset==`number`&&(this.play(timeOffset),this.service.send({type:`PAUSE`})),(_b=this.iframe.contentDocument?.getElementsByTagName(`html`)[0])==null||_b.classList.add(`rrweb-paused`),this.emitter.emit(ReplayerEvents.Pause)}resume(timeOffset=0){this.warn(`The 'resume' was deprecated in 1.0. Please use 'play' method which has the same interface.`),this.play(timeOffset),this.emitter.emit(ReplayerEvents.Resume)}destroy(){this.pause(),this.mirror.reset(),this.styleMirror.reset(),this.mediaManager.reset(),this.config.root.removeChild(this.wrapper),this.emitter.emit(ReplayerEvents.Destroy)}startLive(baselineTime){this.service.send({type:`TO_LIVE`,payload:{baselineTime}})}addEvent(rawEvent){let event=this.config.unpackFn?this.config.unpackFn(rawEvent):rawEvent;indicatesTouchDevice(event)&&this.mouse.classList.add(`touch-device`),Promise.resolve().then(()=>this.service.send({type:`ADD_EVENT`,payload:{event}}))}enableInteract(){this.iframe.setAttribute(`scrolling`,`auto`),this.iframe.style.pointerEvents=`auto`}disableInteract(){this.iframe.setAttribute(`scrolling`,`no`),this.iframe.style.pointerEvents=`none`}resetCache(){this.cache=createCache()}setupDom(){this.wrapper=document.createElement(`div`),this.wrapper.classList.add(`replayer-wrapper`),this.config.root.appendChild(this.wrapper),this.mouse=document.createElement(`div`),this.mouse.classList.add(`replayer-mouse`),this.wrapper.appendChild(this.mouse),this.config.mouseTail!==!1&&(this.mouseTail=document.createElement(`canvas`),this.mouseTail.classList.add(`replayer-mouse-tail`),this.mouseTail.style.display=`inherit`,this.wrapper.appendChild(this.mouseTail)),this.config.UNSAFE_replayCanvas?(this.iframe=document.createElement(`iframe`),this.iframe.setAttribute(`sandbox`,`allow-same-origin allow-scripts`),this.wrapper.appendChild(this.iframe),this.UNSAFE_replayCanvas=!0):(this.iframe=createSandboxedIframe({root:this.wrapper}),this.UNSAFE_replayCanvas=!1),this.iframe.style.display=`none`,this.disableInteract(),this.iframe.contentWindow&&this.iframe.contentDocument&&(polyfill(this.iframe.contentWindow,this.iframe.contentDocument),polyfill$1(this.iframe.contentWindow))}rebuildFullSnapshot(event,isSync=!1){if(!this.iframe.contentDocument)return this.warn(`Looks like your replayer has been destroyed.`);Object.keys(this.legacy_missingNodeRetryMap).length&&this.warn(`Found unresolved missing node map`,this.legacy_missingNodeRetryMap),this.legacy_missingNodeRetryMap={};let collectedIframes=[],collectedDialogs=new Set,afterAppend=(builtNode,id)=>{if(builtNode.nodeName===`DIALOG`&&collectedDialogs.add(builtNode),this.collectIframeAndAttachDocument(collectedIframes,builtNode),this.mediaManager.isSupportedMediaElement(builtNode)){let{events}=this.service.state.context;this.mediaManager.addMediaElements(builtNode,event.timestamp-events[0].timestamp,this.mirror)}for(let plugin of this.config.plugins||[])plugin.onBuild&&plugin.onBuild(builtNode,{id,replayer:this})};this.usingVirtualDom&&=(this.virtualDom.destroyTree(),!1),this.mirror.reset(),rebuild(event.data.node,{doc:this.iframe.contentDocument,afterAppend,cache:this.cache,mirror:this.mirror,UNSAFE_allowUnprotectedRebuild:this.UNSAFE_replayCanvas}),afterAppend(this.iframe.contentDocument,event.data.node.id);for(let{mutationInQueue,builtNode}of collectedIframes)this.attachDocumentToIframe(mutationInQueue,builtNode),this.newDocumentQueue=this.newDocumentQueue.filter(m=>m!==mutationInQueue);let{documentElement,head}=this.iframe.contentDocument;this.insertStyleRules(documentElement,head),collectedDialogs.forEach(d=>applyDialogToTopLevel(d)),this.service.state.matches(`playing`)||this.iframe.contentDocument.getElementsByTagName(`html`)[0].classList.add(`rrweb-paused`),this.emitter.emit(ReplayerEvents.FullsnapshotRebuilded,event),isSync||this.waitForStylesheetLoad(),this.config.UNSAFE_replayCanvas&&this.preloadAllImages()}insertStyleRules(documentElement,head){var _a2;let injectStylesRules=rules(this.config.blockClass).concat(this.config.insertStyleRules);if(this.config.pauseAnimation&&injectStylesRules.push(`html.rrweb-paused *, html.rrweb-paused *:before, html.rrweb-paused *:after { animation-play-state: paused !important; }`),injectStylesRules.length){if(this.usingVirtualDom){let styleEl=this.virtualDom.createElement(`style`);this.virtualDom.mirror.add(styleEl,getDefaultSN(styleEl,this.virtualDom.unserializedId)),documentElement.insertBefore(styleEl,head),styleEl.rules.push({source:IncrementalSource.StyleSheetRule,adds:injectStylesRules.map((cssText,index2)=>({rule:cssText,index:index2}))})}else{let styleEl=document.createElement(`style`);documentElement.insertBefore(styleEl,head);for(let idx=0;idx<injectStylesRules.length;idx++)(_a2=styleEl.sheet)==null||_a2.insertRule(injectStylesRules[idx],idx)}}}attachDocumentToIframe(mutation,iframeEl){let mirror2=this.usingVirtualDom?this.virtualDom.mirror:this.mirror,collectedIframes=[],collectedDialogs=new Set,afterAppend=(builtNode,id)=>{builtNode.nodeName===`DIALOG`&&collectedDialogs.add(builtNode),this.collectIframeAndAttachDocument(collectedIframes,builtNode);let sn=mirror2.getMeta(builtNode);if(sn?.type===NodeType.Element&&sn?.tagName.toUpperCase()===`HTML`){let{documentElement,head}=iframeEl.contentDocument;this.insertStyleRules(documentElement,head)}if(!this.usingVirtualDom)for(let plugin of this.config.plugins||[])plugin.onBuild&&plugin.onBuild(builtNode,{id,replayer:this})};buildNodeWithSN(mutation.node,{doc:iframeEl.contentDocument,mirror:mirror2,hackCss:!0,skipChild:!1,afterAppend,cache:this.cache}),afterAppend(iframeEl.contentDocument,mutation.node.id);for(let{mutationInQueue,builtNode}of collectedIframes)this.attachDocumentToIframe(mutationInQueue,builtNode),this.newDocumentQueue=this.newDocumentQueue.filter(m=>m!==mutationInQueue);collectedDialogs.forEach(d=>applyDialogToTopLevel(d))}collectIframeAndAttachDocument(collected,builtNode){if(isSerializedIframe(builtNode,this.mirror)){let mutationInQueue=this.newDocumentQueue.find(m=>m.parentId===this.mirror.getId(builtNode));mutationInQueue&&collected.push({mutationInQueue,builtNode})}}waitForStylesheetLoad(){let head=this.iframe.contentDocument?.head;if(head){let unloadSheets=new Set,timer,beforeLoadState=this.service.state,stateHandler=()=>{beforeLoadState=this.service.state};this.emitter.on(ReplayerEvents.Start,stateHandler),this.emitter.on(ReplayerEvents.Pause,stateHandler);let unsubscribe=()=>{this.emitter.off(ReplayerEvents.Start,stateHandler),this.emitter.off(ReplayerEvents.Pause,stateHandler)};head.querySelectorAll(`link[rel="stylesheet"]`).forEach(css=>{css.sheet||(unloadSheets.add(css),css.addEventListener(`load`,()=>{unloadSheets.delete(css),unloadSheets.size===0&&timer!==-1&&(beforeLoadState.matches(`playing`)&&this.play(this.getCurrentTime()),this.emitter.emit(ReplayerEvents.LoadStylesheetEnd),timer&&clearTimeout(timer),unsubscribe())}))}),unloadSheets.size>0&&(this.service.send({type:`PAUSE`}),this.emitter.emit(ReplayerEvents.LoadStylesheetStart),timer=setTimeout(()=>{beforeLoadState.matches(`playing`)&&this.play(this.getCurrentTime()),timer=-1,unsubscribe()},this.config.loadTimeout))}}async preloadAllImages(){let promises=[];for(let event of this.service.state.context.events)event.type===EventType.IncrementalSnapshot&&event.data.source===IncrementalSource.CanvasMutation&&(promises.push(this.deserializeAndPreloadCanvasEvents(event.data,event)),(`commands`in event.data?event.data.commands:[event.data]).forEach(c2=>{this.preloadImages(c2,event)}));return Promise.all(promises)}preloadImages(data,event){if(data.property===`drawImage`&&typeof data.args[0]==`string`&&!this.imageMap.has(event)){let canvas=document.createElement(`canvas`),ctx=canvas.getContext(`2d`),imgd=ctx?.createImageData(canvas.width,canvas.height);ctx?.putImageData(imgd,0,0)}}async deserializeAndPreloadCanvasEvents(data,event){if(!this.canvasEventMap.has(event)){let status={isUnchanged:!0};if(`commands`in data){let commands=await Promise.all(data.commands.map(async c2=>{let args=await Promise.all(c2.args.map(deserializeArg(this.imageMap,null,status)));return{...c2,args}}));status.isUnchanged===!1&&this.canvasEventMap.set(event,{...data,commands})}else{let args=await Promise.all(data.args.map(deserializeArg(this.imageMap,null,status)));status.isUnchanged===!1&&this.canvasEventMap.set(event,{...data,args})}}}applyIncremental(e2,isSync){var _b,_c;let{data:d}=e2;switch(d.source){case IncrementalSource.Mutation:try{this.applyMutation(d,isSync)}catch(error){this.warn(`Exception in mutation ${error.message||error}`,d)}break;case IncrementalSource.Drag:case IncrementalSource.TouchMove:case IncrementalSource.MouseMove:if(isSync){let lastPosition=d.positions[d.positions.length-1];this.mousePos={x:lastPosition.x,y:lastPosition.y,id:lastPosition.id,debugData:d}}else d.positions.forEach(p=>{let action={doAction:()=>{this.moveAndHover(p.x,p.y,p.id,isSync,d)},delay:p.timeOffset+e2.timestamp-this.service.state.context.baselineTime};this.timer.addAction(action)}),this.timer.addAction({doAction(){},delay:e2.delay-d.positions[0]?.timeOffset});break;case IncrementalSource.MouseInteraction:{if(d.id===-1)break;let event=new Event(toLowerCase(MouseInteractions[d.type])),target=this.mirror.getNode(d.id);if(!target)return this.debugNodeNotFound(d,d.id);this.emitter.emit(ReplayerEvents.MouseInteraction,{type:d.type,target});let{triggerFocus}=this.config;switch(d.type){case MouseInteractions.Blur:`blur`in target&&target.blur();break;case MouseInteractions.Focus:triggerFocus&&target.focus&&target.focus({preventScroll:!0});break;case MouseInteractions.Click:case MouseInteractions.TouchStart:case MouseInteractions.TouchEnd:case MouseInteractions.MouseDown:case MouseInteractions.MouseUp:isSync?(d.type===MouseInteractions.TouchStart?this.touchActive=!0:d.type===MouseInteractions.TouchEnd&&(this.touchActive=!1),d.type===MouseInteractions.MouseDown?this.lastMouseDownEvent=[target,event]:d.type===MouseInteractions.MouseUp&&(this.lastMouseDownEvent=null),this.mousePos={x:d.x||0,y:d.y||0,id:d.id,debugData:d}):(d.type===MouseInteractions.TouchStart&&(this.tailPositions.length=0),this.moveAndHover(d.x||0,d.y||0,d.id,isSync,d),d.type===MouseInteractions.Click?(this.mouse.classList.remove(`active`),this.mouse.offsetWidth,this.mouse.classList.add(`active`)):d.type===MouseInteractions.TouchStart?(this.mouse.offsetWidth,this.mouse.classList.add(`touch-active`)):d.type===MouseInteractions.TouchEnd?this.mouse.classList.remove(`touch-active`):target.dispatchEvent(event));break;case MouseInteractions.TouchCancel:isSync?this.touchActive=!1:this.mouse.classList.remove(`touch-active`);break;default:target.dispatchEvent(event)}break}case IncrementalSource.Scroll:if(d.id===-1)break;if(this.usingVirtualDom){let target=this.virtualDom.mirror.getNode(d.id);if(!target)return this.debugNodeNotFound(d,d.id);target.scrollData=d;break}this.applyScroll(d,isSync);break;case IncrementalSource.ViewportResize:this.emitter.emit(ReplayerEvents.Resize,{width:d.width,height:d.height});break;case IncrementalSource.Input:if(d.id===-1)break;if(this.usingVirtualDom){let target=this.virtualDom.mirror.getNode(d.id);if(!target)return this.debugNodeNotFound(d,d.id);target.inputData=d;break}this.applyInput(d);break;case IncrementalSource.MediaInteraction:{let target=this.usingVirtualDom?this.virtualDom.mirror.getNode(d.id):this.mirror.getNode(d.id);if(!target)return this.debugNodeNotFound(d,d.id);let mediaEl=target,{events}=this.service.state.context;this.mediaManager.mediaMutation({target:mediaEl,timeOffset:e2.timestamp-events[0].timestamp,mutation:d});break}case IncrementalSource.StyleSheetRule:case IncrementalSource.StyleDeclaration:this.usingVirtualDom?d.styleId?this.constructedStyleMutations.push(d):d.id&&((_b=this.virtualDom.mirror.getNode(d.id))==null||_b.rules.push(d)):this.applyStyleSheetMutation(d);break;case IncrementalSource.CanvasMutation:if(!this.config.UNSAFE_replayCanvas)return;if(this.usingVirtualDom){let target=this.virtualDom.mirror.getNode(d.id);if(!target)return this.debugNodeNotFound(d,d.id);target.canvasMutations.push({event:e2,mutation:d})}else{let target=this.mirror.getNode(d.id);if(!target)return this.debugNodeNotFound(d,d.id);canvasMutation({event:e2,mutation:d,target,imageMap:this.imageMap,canvasEventMap:this.canvasEventMap,errorHandler:this.warnCanvasMutationFailed.bind(this)})}break;case IncrementalSource.Font:try{let fontFace=new FontFace(d.family,d.buffer?new Uint8Array(JSON.parse(d.fontSource)):d.fontSource,d.descriptors);(_c=this.iframe.contentDocument)==null||_c.fonts.add(fontFace)}catch(error){this.warn(error)}break;case IncrementalSource.Selection:if(isSync){this.lastSelectionData=d;break}this.applySelection(d);break;case IncrementalSource.AdoptedStyleSheet:this.usingVirtualDom?this.adoptedStyleSheets.push(d):this.applyAdoptedStyleSheet(d)}}applyMutation(d,isSync){if(this.config.useVirtualDom&&!this.usingVirtualDom&&isSync&&(this.usingVirtualDom=!0,buildFromDom(this.iframe.contentDocument,this.mirror,this.virtualDom),Object.keys(this.legacy_missingNodeRetryMap).length))for(let key in this.legacy_missingNodeRetryMap)try{let value=this.legacy_missingNodeRetryMap[key],virtualNode=buildFromNode(value.node,this.virtualDom,this.mirror);virtualNode&&(value.node=virtualNode)}catch(error){this.warn(error)}let mirror2=this.usingVirtualDom?this.virtualDom.mirror:this.mirror;d.removes=d.removes.filter(mutation=>mirror2.getNode(mutation.id)?!0:(this.warnNodeNotFound(d,mutation.id),!1)),d.removes.forEach(mutation=>{let target=mirror2.getNode(mutation.id);if(!target)return;let parent=mirror2.getNode(mutation.parentId);if(!parent)return this.warnNodeNotFound(d,mutation.parentId);if(mutation.isShadow&&hasShadowRoot(parent)&&(parent=parent.shadowRoot),mirror2.removeNodeFromMap(target),parent)try{parent.removeChild(target),this.usingVirtualDom&&target.nodeName===`#text`&&parent.nodeName===`STYLE`&&parent.rules?.length>0&&(parent.rules=[])}catch(error){if(error instanceof DOMException)this.warn(`parent could not remove child in mutation`,parent,target,d);else throw error}});let legacy_missingNodeMap={...this.legacy_missingNodeRetryMap},queue=[],nextNotInDOM=mutation=>{let next=null;return mutation.nextId&&(next=mirror2.getNode(mutation.nextId)),mutation.nextId!==null&&mutation.nextId!==void 0&&mutation.nextId!==-1&&!next},appendNode=mutation=>{if(!this.iframe.contentDocument)return this.warn(`Looks like your replayer has been destroyed.`);let parent=mirror2.getNode(mutation.parentId);if(!parent)return mutation.node.type===NodeType.Document?this.newDocumentQueue.push(mutation):queue.push(mutation);mutation.node.isShadow&&(hasShadowRoot(parent)||parent.attachShadow({mode:`open`}),parent=parent.shadowRoot);let previous=null,next=null;if(mutation.previousId&&(previous=mirror2.getNode(mutation.previousId)),mutation.nextId&&(next=mirror2.getNode(mutation.nextId)),nextNotInDOM(mutation))return queue.push(mutation);if(mutation.node.rootId&&!mirror2.getNode(mutation.node.rootId))return;let targetDoc=mutation.node.rootId?mirror2.getNode(mutation.node.rootId):this.usingVirtualDom?this.virtualDom:this.iframe.contentDocument;if(isSerializedIframe(parent,mirror2)){this.attachDocumentToIframe(mutation,parent);return}let afterAppend=(node2,id)=>{if(!this.usingVirtualDom){applyDialogToTopLevel(node2);for(let plugin of this.config.plugins||[])plugin.onBuild&&plugin.onBuild(node2,{id,replayer:this})}},target=buildNodeWithSN(mutation.node,{doc:targetDoc,mirror:mirror2,skipChild:!0,hackCss:!0,cache:this.cache,afterAppend});if(mutation.previousId===-1||mutation.nextId===-1){legacy_missingNodeMap[mutation.node.id]={node:target,mutation};return}let parentSn=mirror2.getMeta(parent);if(parentSn&&parentSn.type===NodeType.Element&&mutation.node.type===NodeType.Text){let prospectiveSiblings=Array.isArray(parent.childNodes)?parent.childNodes:Array.from(parent.childNodes);if(parentSn.tagName===`textarea`)for(let c2 of prospectiveSiblings)c2.nodeType===parent.TEXT_NODE&&parent.removeChild(c2);else if(parentSn.tagName===`style`&&prospectiveSiblings.length===1)for(let cssText of prospectiveSiblings)cssText.nodeType===parent.TEXT_NODE&&!mirror2.hasNode(cssText)&&(target.textContent=cssText.textContent,parent.removeChild(cssText))}else if(parentSn?.type===NodeType.Document){let parentDoc=parent;mutation.node.type===NodeType.DocumentType&&parentDoc.childNodes[0]?.nodeType===Node.DOCUMENT_TYPE_NODE&&parentDoc.removeChild(parentDoc.childNodes[0]),target.nodeName===`HTML`&&parentDoc.documentElement&&parentDoc.removeChild(parentDoc.documentElement)}if(previous&&previous.nextSibling&&previous.nextSibling.parentNode?parent.insertBefore(target,previous.nextSibling):next&&next.parentNode?parent.contains(next)?parent.insertBefore(target,next):parent.insertBefore(target,null):parent.appendChild(target),afterAppend(target,mutation.node.id),this.usingVirtualDom&&target.nodeName===`#text`&&parent.nodeName===`STYLE`&&parent.rules?.length>0&&(parent.rules=[]),isSerializedIframe(target,this.mirror)){let targetId=this.mirror.getId(target),mutationInQueue=this.newDocumentQueue.find(m=>m.parentId===targetId);mutationInQueue&&(this.attachDocumentToIframe(mutationInQueue,target),this.newDocumentQueue=this.newDocumentQueue.filter(m=>m!==mutationInQueue))}(mutation.previousId||mutation.nextId)&&this.legacy_resolveMissingNode(legacy_missingNodeMap,parent,target,mutation)};d.adds.forEach(mutation=>{appendNode(mutation)});let startTime=Date.now();for(;queue.length;){let resolveTrees=queueToResolveTrees(queue);if(queue.length=0,Date.now()-startTime>500){this.warn(`Timeout in the loop, please check the resolve tree data:`,resolveTrees);break}for(let tree of resolveTrees)mirror2.getNode(tree.value.parentId)?iterateResolveTree(tree,mutation=>{appendNode(mutation)}):this.debug(`Drop resolve tree since there is no parent for the root node.`,tree)}Object.keys(legacy_missingNodeMap).length&&Object.assign(this.legacy_missingNodeRetryMap,legacy_missingNodeMap),uniqueTextMutations(d.texts).forEach(mutation=>{let target=mirror2.getNode(mutation.id);if(!target)return d.removes.find(r2=>r2.id===mutation.id)?void 0:this.warnNodeNotFound(d,mutation.id);let parentEl=target.parentElement;if(target.textContent=mutation.value&&parentEl&&parentEl.tagName===`STYLE`?adaptCssForReplay(mutation.value,this.cache):mutation.value,this.usingVirtualDom){let parent=target.parentNode;parent?.rules?.length>0&&(parent.rules=[])}}),d.attributes.forEach(mutation=>{let target=mirror2.getNode(mutation.id);if(!target)return d.removes.find(r2=>r2.id===mutation.id)?void 0:this.warnNodeNotFound(d,mutation.id);for(let attributeName in mutation.attributes)if(typeof attributeName==`string`){let value=mutation.attributes[attributeName];if(value===null)target.removeAttribute(attributeName),attributeName===`open`&&removeDialogFromTopLevel(target,mutation);else if(typeof value==`string`)try{if(attributeName===`_cssText`&&(target.nodeName===`LINK`||target.nodeName===`STYLE`))try{let newSn=mirror2.getMeta(target),newNode=buildNodeWithSN({...newSn,attributes:{...newSn.attributes,...mutation.attributes}},{doc:target.ownerDocument,mirror:mirror2,skipChild:!0,hackCss:!0,cache:this.cache});Object.assign(newSn.attributes,mutation.attributes);let siblingNode=target.nextSibling,parentNode2=target.parentNode;if(newNode&&parentNode2){parentNode2.removeChild(target),parentNode2.insertBefore(newNode,siblingNode),mirror2.replace(mutation.id,newNode);break}}catch{}if(attributeName===`value`&&target.nodeName===`TEXTAREA`){let textarea=target;textarea.childNodes.forEach(c2=>textarea.removeChild(c2));let tn=target.ownerDocument?.createTextNode(value);tn&&textarea.appendChild(tn)}else target.setAttribute(attributeName,value);attributeName===`rr_open_mode`&&target.nodeName===`DIALOG`&&applyDialogToTopLevel(target,mutation)}catch(error){this.warn(`An error occurred may due to the checkout feature.`,error)}else if(attributeName===`style`){let styleValues=value,targetEl=target;for(let s2 in styleValues)if(styleValues[s2]===!1)targetEl.style.removeProperty(s2);else if(styleValues[s2]instanceof Array){let svp=styleValues[s2];targetEl.style.setProperty(s2,svp[0],svp[1])}else{let svs=styleValues[s2];targetEl.style.setProperty(s2,svs)}}}})}applyScroll(d,isSync){var _a2,_b;let target=this.mirror.getNode(d.id);if(!target)return this.debugNodeNotFound(d,d.id);let sn=this.mirror.getMeta(target);if(target===this.iframe.contentDocument)(_a2=this.iframe.contentWindow)==null||_a2.scrollTo({top:d.y,left:d.x,behavior:isSync?`auto`:`smooth`});else if(sn?.type===NodeType.Document)(_b=target.defaultView)==null||_b.scrollTo({top:d.y,left:d.x,behavior:isSync?`auto`:`smooth`});else try{target.scrollTo({top:d.y,left:d.x,behavior:isSync?`auto`:`smooth`})}catch{}}applyInput(d){let target=this.mirror.getNode(d.id);if(!target)return this.debugNodeNotFound(d,d.id);try{target.checked=d.isChecked,target.value=d.text}catch{}}applySelection(d){try{let selectionSet=new Set,ranges=d.ranges.map(({start,startOffset,end,endOffset})=>{let startContainer=this.mirror.getNode(start),endContainer=this.mirror.getNode(end);if(!startContainer||!endContainer)return;let result2=new Range;result2.setStart(startContainer,startOffset),result2.setEnd(endContainer,endOffset);let selection=startContainer.ownerDocument?.getSelection();return selection&&selectionSet.add(selection),{range:result2,selection}});selectionSet.forEach(s2=>s2.removeAllRanges()),ranges.forEach(r2=>r2&&r2.selection?.addRange(r2.range))}catch{}}applyStyleSheetMutation(data){let styleSheet=null;data.styleId?styleSheet=this.styleMirror.getStyle(data.styleId):data.id&&(styleSheet=this.mirror.getNode(data.id)?.sheet||null),styleSheet&&(data.source===IncrementalSource.StyleSheetRule?this.applyStyleSheetRule(data,styleSheet):data.source===IncrementalSource.StyleDeclaration&&this.applyStyleDeclaration(data,styleSheet))}applyStyleSheetRule(data,styleSheet){var _a2,_b,_c,_d;if((_a2=data.adds)==null||_a2.forEach(({rule:rule2,index:nestedIndex})=>{try{if(Array.isArray(nestedIndex)){let{positions,index:index2}=getPositionsAndIndex(nestedIndex);getNestedRule(styleSheet.cssRules,positions)?.insertRule(rule2,index2)}else{let index2=nestedIndex===void 0?void 0:Math.min(nestedIndex,styleSheet.cssRules.length);styleSheet?.insertRule(rule2,index2)}}catch{}}),(_b=data.removes)==null||_b.forEach(({index:nestedIndex})=>{try{if(Array.isArray(nestedIndex)){let{positions,index:index2}=getPositionsAndIndex(nestedIndex);getNestedRule(styleSheet.cssRules,positions)?.deleteRule(index2||0)}else styleSheet?.deleteRule(nestedIndex)}catch{}}),typeof data.replace==`string`)try{(_c=styleSheet.replace)==null||_c.call(styleSheet,data.replace)}catch{}if(typeof data.replaceSync==`string`)try{(_d=styleSheet.replaceSync)==null||_d.call(styleSheet,data.replaceSync)}catch{}}applyStyleDeclaration(data,styleSheet){if(data.set){let rule2=getNestedRule(styleSheet.rules,data.index);rule2?.style&&rule2.style.setProperty(data.set.property,data.set.value,data.set.priority)}if(data.remove){let rule2=getNestedRule(styleSheet.rules,data.index);rule2?.style&&rule2.style.removeProperty(data.remove.property)}}applyAdoptedStyleSheet(data){var _a2;let targetHost=this.mirror.getNode(data.id);if(!targetHost)return;(_a2=data.styles)==null||_a2.forEach(style=>{let newStyleSheet=null,hostWindow=null;if(hasShadowRoot(targetHost)?hostWindow=targetHost.ownerDocument?.defaultView||null:targetHost.nodeName===`#document`&&(hostWindow=targetHost.defaultView),hostWindow)try{newStyleSheet=new hostWindow.CSSStyleSheet,this.styleMirror.add(newStyleSheet,style.styleId),this.applyStyleSheetRule({source:IncrementalSource.StyleSheetRule,adds:style.rules},newStyleSheet)}catch{}});let count=0,adoptStyleSheets=(targetHost2,styleIds)=>{let stylesToAdopt=styleIds.map(styleId=>this.styleMirror.getStyle(styleId)).filter(style=>style!==null);hasShadowRoot(targetHost2)?targetHost2.shadowRoot.adoptedStyleSheets=stylesToAdopt:targetHost2.nodeName===`#document`&&(targetHost2.adoptedStyleSheets=stylesToAdopt),stylesToAdopt.length!==styleIds.length&&count<10&&(setTimeout(()=>adoptStyleSheets(targetHost2,styleIds),0+100*count),count++)};adoptStyleSheets(targetHost,data.styleIds)}legacy_resolveMissingNode(map,parent,target,targetMutation){let{previousId,nextId}=targetMutation,previousInMap=previousId&&map[previousId],nextInMap=nextId&&map[nextId];if(previousInMap){let{node:node2,mutation}=previousInMap;parent.insertBefore(node2,target),delete map[mutation.node.id],delete this.legacy_missingNodeRetryMap[mutation.node.id],(mutation.previousId||mutation.nextId)&&this.legacy_resolveMissingNode(map,parent,node2,mutation)}if(nextInMap){let{node:node2,mutation}=nextInMap;parent.insertBefore(node2,target.nextSibling),delete map[mutation.node.id],delete this.legacy_missingNodeRetryMap[mutation.node.id],(mutation.previousId||mutation.nextId)&&this.legacy_resolveMissingNode(map,parent,node2,mutation)}}moveAndHover(x,y,id,isSync,debugData){let target=this.mirror.getNode(id);if(!target)return this.debugNodeNotFound(debugData,id);let base=getBaseDimension(target,this.iframe),_x=x*base.absoluteScale+base.x,_y=y*base.absoluteScale+base.y;this.mouse.style.left=`${_x}px`,this.mouse.style.top=`${_y}px`,isSync||this.drawMouseTail({x:_x,y:_y}),this.hoverElements(target)}drawMouseTail(position){if(!this.mouseTail)return;let{lineCap,lineWidth,strokeStyle,duration}=this.config.mouseTail===!0?defaultMouseTailConfig:Object.assign({},defaultMouseTailConfig,this.config.mouseTail),draw=()=>{if(!this.mouseTail)return;let ctx=this.mouseTail.getContext(`2d`);ctx&&this.tailPositions.length&&(ctx.clearRect(0,0,this.mouseTail.width,this.mouseTail.height),ctx.beginPath(),ctx.lineWidth=lineWidth,ctx.lineCap=lineCap,ctx.strokeStyle=strokeStyle,ctx.moveTo(this.tailPositions[0].x,this.tailPositions[0].y),this.tailPositions.forEach(p=>ctx.lineTo(p.x,p.y)),ctx.stroke())};this.tailPositions.push(position),draw(),setTimeout(()=>{this.tailPositions=this.tailPositions.filter(p=>p!==position),draw()},duration/this.speedService.state.context.timer.speed)}hoverElements(el){var _a2;(_a2=this.lastHoveredRootNode||this.iframe.contentDocument)==null||_a2.querySelectorAll(`.\\:hover`).forEach(hoveredEl=>{hoveredEl.classList.remove(`:hover`)}),this.lastHoveredRootNode=el.getRootNode();let currentEl=el;for(;currentEl;)currentEl.classList&¤tEl.classList.add(`:hover`),currentEl=currentEl.parentElement}isUserInteraction(event){return event.type===EventType.IncrementalSnapshot&&event.data.source>IncrementalSource.Mutation&&event.data.source<=IncrementalSource.Input}backToNormal(){this.nextUserInteractionEvent=null,!this.speedService.state.matches(`normal`)&&(this.speedService.send({type:`BACK_TO_NORMAL`}),this.emitter.emit(ReplayerEvents.SkipEnd,{speed:this.speedService.state.context.normalSpeed}))}warnNodeNotFound(d,id){this.warn(`Node with id '${id}' not found. `,d)}warnCanvasMutationFailed(d,error){this.warn(`Has error on canvas update`,error,`canvas mutation:`,d)}debugNodeNotFound(d,id){this.debug(`Node with id '${id}' not found. `,d)}warn(...args){this.config.showWarning&&this.config.logger.warn(REPLAY_CONSOLE_PREFIX,...args)}debug(...args){this.config.showDebug&&this.config.logger.log(REPLAY_CONSOLE_PREFIX,...args)}};const{addCustomEvent}=record,{freezePage}=record,{takeFullSnapshot}=record;export{EventType,IncrementalSource,MouseInteractions,Replayer,ReplayerEvents,addCustomEvent,canvasMutation,freezePage,_mirror as mirror,record,takeFullSnapshot,utils};
|