@adora-so/adora-js 0.0.2 → 0.0.4

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/dist/index.mjs CHANGED
@@ -1,54 +1,4 @@
1
- var Nl=Object.defineProperty;var Ml=(s,e,t)=>e in s?Nl(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var fe=(s,e,t)=>Ml(s,typeof e!="symbol"?e+"":e,t);var kl={"Content-Type":"application/json"},Pl=/\{[^{}]+\}/g,is=class extends Request{constructor(e,t){super(e,t);for(let r in t)r in this||(this[r]=t[r])}};function as(s){let{baseUrl:e="",fetch:t=globalThis.fetch,querySerializer:r,bodySerializer:n,headers:o,...i}={...s};e.endsWith("/")&&(e=e.substring(0,e.length-1)),o=uo(kl,o);let l=[];async function a(u,c){let{fetch:d=t,headers:p,params:m={},parseAs:g="json",querySerializer:f,bodySerializer:h=n??Ll,...E}=c||{},S=typeof r=="function"?r:lo(r);f&&(S=typeof f=="function"?f:lo({...typeof r=="object"?r:{},...f}));let w={redirect:"follow",...i,...E,headers:uo(o,p,m.header)};w.body&&(w.body=h(w.body)),w.body instanceof FormData&&w.headers.delete("Content-Type");let I=new is(Fl(u,{baseUrl:e,params:m,querySerializer:S}),w),_={baseUrl:e,fetch:d,parseAs:g,querySerializer:S,bodySerializer:h};for(let v of l)if(v&&typeof v=="object"&&typeof v.onRequest=="function"){I.schemaPath=u,I.params=m;let x=await v.onRequest(I,_);if(x){if(!(x instanceof Request))throw new Error("Middleware must return new Request() when modifying the request");I=x}}let y=await d(I);for(let v=l.length-1;v>=0;v--){let x=l[v];if(x&&typeof x=="object"&&typeof x.onResponse=="function"){let O=await x.onResponse(y,_);if(O){if(!(O instanceof Response))throw new Error("Middleware must return new Response() when modifying the response");y=O}}}if(y.status===204||y.headers.get("Content-Length")==="0")return y.ok?{data:{},response:y}:{error:{},response:y};if(y.ok)return g==="stream"?{data:y.body,response:y}:{data:await y[g](),response:y};let R=await y.text();try{R=JSON.parse(R)}catch{}return{error:R,response:y}}return{async GET(u,c){return a(u,{...c,method:"GET"})},async PUT(u,c){return a(u,{...c,method:"PUT"})},async POST(u,c){return a(u,{...c,method:"POST"})},async DELETE(u,c){return a(u,{...c,method:"DELETE"})},async OPTIONS(u,c){return a(u,{...c,method:"OPTIONS"})},async HEAD(u,c){return a(u,{...c,method:"HEAD"})},async PATCH(u,c){return a(u,{...c,method:"PATCH"})},async TRACE(u,c){return a(u,{...c,method:"TRACE"})},use(...u){for(let c of u)if(c){if(typeof c!="object"||!("onRequest"in c||"onResponse"in c))throw new Error("Middleware must be an object with one of `onRequest()` or `onResponse()`");l.push(c)}},eject(...u){for(let c of u){let d=l.indexOf(c);d!==-1&&l.splice(d,1)}}}}function Gt(s,e,t){if(e==null)return"";if(typeof e=="object")throw new Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");return`${s}=${t?.allowReserved===!0?e:encodeURIComponent(e)}`}function co(s,e,t){if(!e||typeof e!="object")return"";let r=[],n={simple:",",label:".",matrix:";"}[t.style]||"&";if(t.style!=="deepObject"&&t.explode===!1){for(let l in e)r.push(l,t.allowReserved===!0?e[l]:encodeURIComponent(e[l]));let i=r.join(",");switch(t.style){case"form":return`${s}=${i}`;case"label":return`.${i}`;case"matrix":return`;${s}=${i}`;default:return i}}for(let i in e){let l=t.style==="deepObject"?`${s}[${i}]`:i;r.push(Gt(l,e[i],t))}let o=r.join(n);return t.style==="label"||t.style==="matrix"?`${n}${o}`:o}function ho(s,e,t){if(!Array.isArray(e))return"";if(t.explode===!1){let o={form:",",spaceDelimited:"%20",pipeDelimited:"|"}[t.style]||",",i=(t.allowReserved===!0?e:e.map(l=>encodeURIComponent(l))).join(o);switch(t.style){case"simple":return i;case"label":return`.${i}`;case"matrix":return`;${s}=${i}`;default:return`${s}=${i}`}}let r={simple:",",label:".",matrix:";"}[t.style]||"&",n=[];for(let o of e)t.style==="simple"||t.style==="label"?n.push(t.allowReserved===!0?o:encodeURIComponent(o)):n.push(Gt(s,o,t));return t.style==="label"||t.style==="matrix"?`${r}${n.join(r)}`:n.join(r)}function lo(s){return function(t){let r=[];if(t&&typeof t=="object")for(let n in t){let o=t[n];if(o!=null){if(Array.isArray(o)){r.push(ho(n,o,{style:"form",explode:!0,...s?.array,allowReserved:s?.allowReserved||!1}));continue}if(typeof o=="object"){r.push(co(n,o,{style:"deepObject",explode:!0,...s?.object,allowReserved:s?.allowReserved||!1}));continue}r.push(Gt(n,o,s))}}return r.join("&")}}function $l(s,e){let t=s;for(let r of s.match(Pl)??[]){let n=r.substring(1,r.length-1),o=!1,i="simple";if(n.endsWith("*")&&(o=!0,n=n.substring(0,n.length-1)),n.startsWith(".")?(i="label",n=n.substring(1)):n.startsWith(";")&&(i="matrix",n=n.substring(1)),!e||e[n]===void 0||e[n]===null)continue;let l=e[n];if(Array.isArray(l)){t=t.replace(r,ho(n,l,{style:i,explode:o}));continue}if(typeof l=="object"){t=t.replace(r,co(n,l,{style:i,explode:o}));continue}if(i==="matrix"){t=t.replace(r,`;${Gt(n,l)}`);continue}t=t.replace(r,i==="label"?`.${l}`:l)}return t}function Ll(s){return JSON.stringify(s)}function Fl(s,e){let t=`${e.baseUrl}${s}`;e.params?.path&&(t=$l(t,e.params.path));let r=e.querySerializer(e.params.query??{});return r.startsWith("?")&&(r=r.substring(1)),r&&(t+=`?${r}`),t}function uo(...s){let e=new Headers;for(let t of s){if(!t||typeof t!="object")continue;let r=t instanceof Headers?t.entries():Object.entries(t);for(let[n,o]of r)if(o===null)e.delete(n);else if(Array.isArray(o))for(let i of o)e.append(n,i);else o!==void 0&&e.set(n,o)}return e}var we=(s=>(s[s.DomContentLoaded=0]="DomContentLoaded",s[s.Load=1]="Load",s[s.FullSnapshot=2]="FullSnapshot",s[s.IncrementalSnapshot=3]="IncrementalSnapshot",s[s.Meta=4]="Meta",s[s.Custom=5]="Custom",s[s.Plugin=6]="Plugin",s))(we||{}),pt=(s=>(s[s.Mutation=0]="Mutation",s[s.MouseMove=1]="MouseMove",s[s.MouseInteraction=2]="MouseInteraction",s[s.Scroll=3]="Scroll",s[s.ViewportResize=4]="ViewportResize",s[s.Input=5]="Input",s[s.TouchMove=6]="TouchMove",s[s.MediaInteraction=7]="MediaInteraction",s[s.StyleSheetRule=8]="StyleSheetRule",s[s.CanvasMutation=9]="CanvasMutation",s[s.Font=10]="Font",s[s.Log=11]="Log",s[s.Drag=12]="Drag",s[s.StyleDeclaration=13]="StyleDeclaration",s[s.Selection=14]="Selection",s[s.AdoptedStyleSheet=15]="AdoptedStyleSheet",s[s.CustomElement=16]="CustomElement",s))(pt||{}),ls=(s=>(s[s.MouseUp=0]="MouseUp",s[s.MouseDown=1]="MouseDown",s[s.Click=2]="Click",s[s.ContextMenu=3]="ContextMenu",s[s.DblClick=4]="DblClick",s[s.Focus=5]="Focus",s[s.Blur=6]="Blur",s[s.TouchStart=7]="TouchStart",s[s.TouchMove_Departed=8]="TouchMove_Departed",s[s.TouchEnd=9]="TouchEnd",s[s.TouchCancel=10]="TouchCancel",s))(ls||{});var Ul="Adora.URLChange",fo="Adora.Cohort",zl="Adora.AddCohort",Hl="Adora.Click";var us=["onclick","ondblclick","onmousedown","onmousemove","onmouseout","onmouseover","onmouseup","onchange","onfocus","onblur","onscroll","onselect","onsubmit","onkeydown","onkeypress","onkeyup","onload","onunload"];function po({dom0EventHandlers:s,delay:e,timestamp:t}){return{type:we.Custom,data:{tag:Hl,payload:{dom0EventHandlers:s}},delay:e,timestamp:t}}function mt({payload:s,delay:e,timestamp:t}){return{type:we.Custom,data:{tag:zl,payload:s},delay:e,timestamp:t}}function mo({href:s,delay:e,timestamp:t}){return{type:we.Custom,data:{tag:Ul,payload:{href:s}},delay:e,timestamp:t}}function he(s){throw new Error(`This code path should be unreachable: ${s}`)}import{uuidv7 as Jm}from"uuidv7";var ig=1e3*60*30;var ag=10080*60*1e3;var yo="https://c.adora-cdn.com";var Oe=class{constructor(e){fe(this,"backendClient");fe(this,"eventPostBackendClient");this.backendClient=ds({baseUrl:e??yo})}getOrCreateEventPostClient(e){return!e.eventPostUrl||!e.eventPostToken?{path:e.sessionId,client:this.backendClient}:(this.eventPostBackendClient||(this.eventPostBackendClient=ds({baseUrl:e.eventPostUrl})),{path:e.sessionId,client:this.eventPostBackendClient})}async sessionPreload({orgId:e}){return this.backendClient.POST("/sessions/preload",{body:{orgId:e},mode:"cors"}).catch(()=>{})}async startSession({bypassSampling:e,orgId:t,language:r,domain:n,userCohorts:o,uid:i,devicePixelRatio:l,adoraUserId:a,userAgent:u,documentReferrer:c,snippetVersion:d}){return this.backendClient.POST("/sessions/start",{body:{bypassSampling:e,orgId:t,language:r,domain:n,devicePixelRatio:l,userCohorts:o||{},userAgent:u,uid:typeof i=="number"?i.toString():i!=="null"&&i!=="undefined"?i:void 0,adoraUserId:a,documentReferrer:c,snippetVersion:d},mode:"cors"}).catch(()=>{})}async gzipWithCompressionStream(e){let t=JSON.stringify(e),n=new TextEncoder().encode(t),o=new CompressionStream("gzip"),l=new ReadableStream({start(u){u.enqueue(n),u.close()}}).pipeThrough(o);return new Response(l).arrayBuffer()}async saveSessionEvents({sessionId:e,events:t,metadata:r,eventPostUrl:n,eventPostToken:o,fastpathToken:i}){let{path:l,client:a}=this.getOrCreateEventPostClient({sessionId:e,eventPostToken:o,eventPostUrl:n}),u={events:t.slice(),metadata:r,fastpathToken:i},c={params:{path:{sessionId:l}},headers:o?{token:o}:void 0};if(typeof CompressionStream<"u"){let d=await this.gzipWithCompressionStream(u);return a.POSTGzipped("/sessions/{sessionId}/events",{...c,body:d}).catch(()=>{})}return a.POST("/sessions/{sessionId}/events",{...c,body:u}).catch(()=>{})}async refreshEventToken(e){return await this.backendClient.POST("/sessions/{sessionId}/events/token",{params:{path:{sessionId:e.sessionId}},body:{},mode:"cors"}).catch(()=>{})}async syncSession(e){return await this.backendClient.POST("/sessions/{sessionId}/sync",{params:{path:{sessionId:e.sessionId}}}).catch(()=>{})}};import{makeRe as Ql,minimatch as eu}from"minimatch";function tu(s){return s.endsWith("$")&&(s=s.substring(0,s.length-1)),(s.endsWith("+?")||s.endsWith("*?"))&&(s=s.substring(0,s.length-1)),s}function Je(s,e){let t=e.replace||e.path;switch(e.type){case"regexp":{let r=(e.path.startsWith("^")?"":"^")+e.path+(!e.path.endsWith("$")&&!e.partial?"$":""),n=new RegExp(r);return n.test(s)?e.partial?s.replace(n,t):t:void 0}case"wildcard":case void 0:if(e.partial){let r=Ql(e.path,{partial:e.partial,dot:!0});if(!r)throw new Error("unable to make regexp");let n=new RegExp(tu(r.source));return n.test(s)?s.replace(n,t):void 0}return eu(s,e.path,{dot:!0})?t:void 0;default:he(e.type)}}var hs;(function(s){s.GOAL_SURVEY_FINISHED="goal_survey_finished",s.WELCOME_DIALOG_FINISHED="welcome_dialog_finished"})(hs||(hs={}));var fs;(function(s){s.EXPLORE_AND_VISUALIZE="Explore and visualize",s.MEASURE_AND_OPTIMIZE="Measure and optimize",s.IDENTIFY_FRICTION="Identify friction",s.DIAGNOSE_ISSUES="Diagnose issues"})(fs||(fs={}));var ps;(function(s){s.SKIPPED="skipped",s.COMPLETED="completed"})(ps||(ps={}));var ms;(function(s){s.NONE="none",s.NEW_USER_GOAL_SURVEY="new_user_goal_survey",s.EXISTING_USER_WELCOME_DIALOG="existing_user_welcome_dialog"})(ms||(ms={}));var ds=s=>({...as(s),POSTGzipped:async(t,r)=>{if(!r?.body)throw new Error("Body is required for gzipped requests");let n={...r.headers,"Content-Type":"application/json","Content-Encoding":"gzip"},o=t;r.params?.path&&Object.entries(r.params.path).forEach(([a,u])=>{o=o.replace(`{${a}}`,u)});let i=await fetch(`${s.baseUrl}${o}`,{method:"POST",headers:n,body:r.body});if(!i.ok){let a=await i.text();try{a=JSON.parse(a)}catch{}return{data:void 0,error:a,response:i}}return{data:await i.json(),error:void 0,response:i}}});import{strictDeepEqual as zp}from"fast-equals";import ss from"js-cookie";import{uuidv7 as Hp}from"uuidv7";var jt=class{constructor(e,t){this.storage=t;this.eventStorageKey=e==="adoraSessionScript"?"adoraEventsScript":"adoraEventsExtension"}getEvents(){let e=this.storage.getItem(this.eventStorageKey);return e?JSON.parse(e):null}setEvents(e){this.storage.setItem(this.eventStorageKey,JSON.stringify(e))}removeEvents(){this.storage.removeItem(this.eventStorageKey)}};function gs(s){return`${s}-rate-limit-timestamp`}var Le=class{constructor(e,t){this.sessionType=e;this.storage=t}get lastRateLimitedTimestamp(){let e=this.storage.getItem(gs(this.sessionType));if(ru(e))return e}clearLastRateLimitedTimestamp(){this.storage.removeItem(gs(this.sessionType))}setLastRateLimitedTimestamp(e){this.storage.setItem(gs(this.sessionType),e.toString())}getSession(){let e=this.storage.getItem(this.sessionType);return e?JSON.parse(e):null}setSession(e){this.storage.setItem(this.sessionType,JSON.stringify(e))}removeSession(){this.storage.removeItem(this.sessionType)}};function ru(s){return!isNaN(Number(s))}function b(s,...e){(typeof window=="object"&&window.enableAdoraDebugLogs||typeof window=="object"&&window.localStorage.getItem("enableAdoraDebugLogs"))&&console.log(s,...e)}var De=class{getItem(e){if(!ys())return null;try{return window.sessionStorage.getItem(e)}catch{return null}}setItem(e,t){if(!ys())return null;try{return window.sessionStorage.setItem(e,t)}catch{return null}}removeItem(e){if(!ys())return null;try{return window.sessionStorage.removeItem(e)}catch{return null}}};function ys(){return typeof window.sessionStorage=="object"}var Kt="v0.0.1";var wo=async(s,e,t)=>{let r=new Le(s,new De),n=new Oe(t.backendUrl),o=await su(n,t,e);return o.type==="success"&&r.setSession(o.storedSession),o};async function su(s,e,t){try{b("starting session over network",{uid:e.uid,userCohorts:e.userCohorts||{}});let r=await s.startSession({bypassSampling:e.bypassSampling,orgId:e.orgId,language:e.language||navigator.language,domain:new URL(window.location.href).hostname,userCohorts:e.userCohorts||{},uid:e.uid,devicePixelRatio:window.devicePixelRatio,adoraUserId:t,documentReferrer:document.referrer,snippetVersion:Kt});if(!r)return{type:"error",code:void 0};if(r.error)return{type:"error",code:r.error.code};if(r.response.status!==201)return b("session not created, aborting"),{type:"error",code:"code"in r.data?r.data.code:void 0};if(r.data&&"scheduledDowntime"in r.data)return b("scheduled downtime, exiting"),{type:"error",code:void 0};if(!r.data||!("session"in r.data))return b("malformed session, exiting"),{type:"error",code:void 0};let{session:n,organization:o,eventPostUrl:i,eventPostToken:l}=r.data;return{type:"success",storedSession:{id:n.id,createdAt:n.createdAt,status:n.status,lastSyncedAt:n.lastSyncedAt,domain:n.domain,requestIp:n.requestIp,country:n.country,userAgent:n.userAgent,language:n.language,initialUserCohorts:n.initialUserCohorts,devicePixelRatio:n.devicePixelRatio,organization:o,documentReferrer:n.documentReferrer,canvasRecordingEnabled:n.canvasRecordingEnabled||!1,adoraUserId:t,settings:e,eventPostUrl:i,eventPostToken:l,limitedCanvasRecording:n.limitedCanvasRecording||!1,compressionType:n.compressionType}}}catch{return{type:"error",code:void 0}}}import*as dt from"web-vitals";var So="__STATSIG__",nu="statsig@@",vo=s=>{try{if(!s[So])return;let e=s[So];if(!iu(e))return;let t={};return Object.values(e.instances).forEach(r=>{r._logger?._lastExposureTimeMap&&Object.keys(r._logger?._lastExposureTimeMap).forEach(n=>{let o=ou(n);if(!o)return;let i=r.getExperiment(o);uu(i)&&(t[nu+i.name]=i.groupName)})}),t}catch{return}},ou=s=>{let e=s.split("|");if(e.length>3)return e[3]};function iu(s){if(!s||typeof s!="object"||!("instances"in s)||typeof s.instances!="object"||!s.instances)return!1;let e=Object.values(s.instances);for(let t of e)if(!au(t))return!1;return!0}function au(s){return!s||typeof s!="object"?!1:"_logger"in s&&typeof s._logger=="object"&&lu(s._logger)&&"_sdkKey"in s&&typeof s._sdkKey=="string"&&"getExperiment"in s&&typeof s.getExperiment=="function"}function lu(s){return!s||typeof s!="object"?!1:"_lastExposureTimeMap"in s&&typeof s._lastExposureTimeMap=="object"}function uu(s){return!s||typeof s!="object"?!1:"name"in s&&typeof s.name=="string"&&"groupName"in s&&typeof s.groupName=="string"}function Jt(s,e){if(!e.windowGetters)return;let t={};if(e.windowGetters.forEach(({key:r,paths:n})=>{let o=cu(s,n);o&&(t[r]=o)}),Object.keys(t).length!==0)return t}function cu(s,e){if(typeof s>"u")return;let t=s;for(let n=0;n<e.length-1;n++)if(t=t[e[n]],typeof t!="object")return;let r=t[e[e.length-1]];if(typeof r=="string")return r;if(typeof r=="boolean"||typeof r=="number")return r.toString()}function ws(s){return vo(s)}var du=Object.defineProperty,hu=(s,e,t)=>e in s?du(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,C=(s,e,t)=>hu(s,typeof e!="symbol"?e+"":e,t),Co,fu=Object.defineProperty,pu=(s,e,t)=>e in s?fu(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,bo=(s,e,t)=>pu(s,typeof e!="symbol"?e+"":e,t),q=(s=>(s[s.Document=0]="Document",s[s.DocumentType=1]="DocumentType",s[s.Element=2]="Element",s[s.Text=3]="Text",s[s.CDATA=4]="CDATA",s[s.Comment=5]="Comment",s))(q||{}),Eo={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Ro={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Zt={};function Rn(s){if(Zt[s])return Zt[s];let e=globalThis[s],t=e.prototype,r=s in Eo?Eo[s]:void 0,n=!!(r&&r.every(l=>{var a,u;return!!((u=(a=Object.getOwnPropertyDescriptor(t,l))==null?void 0:a.get)!=null&&u.toString().includes("[native code]"))})),o=s in Ro?Ro[s]:void 0,i=!!(o&&o.every(l=>{var a;return typeof t[l]=="function"&&((a=t[l])==null?void 0:a.toString().includes("[native code]"))}));if(n&&i)return Zt[s]=e.prototype,e.prototype;try{let l=document.createElement("iframe");document.body.appendChild(l);let a=l.contentWindow;if(!a)return e.prototype;let u=a[s].prototype;return document.body.removeChild(l),u?Zt[s]=u:t}catch{return t}}var Ss={};function Ue(s,e,t){var r;let n=`${s}.${String(t)}`;if(Ss[n])return Ss[n].call(e);let o=Rn(s),i=(r=Object.getOwnPropertyDescriptor(o,t))==null?void 0:r.get;return i?(Ss[n]=i,i.call(e)):e[t]}var vs={};function Si(s,e,t){let r=`${s}.${String(t)}`;if(vs[r])return vs[r].bind(e);let o=Rn(s)[t];return typeof o!="function"?e[t]:(vs[r]=o,o.bind(e))}function mu(s){return Ue("Node",s,"childNodes")}function gu(s){return Ue("Node",s,"parentNode")}function yu(s){return Ue("Node",s,"parentElement")}function wu(s){return Ue("Node",s,"textContent")}function Su(s,e){return Si("Node",s,"contains")(e)}function vu(s){return Si("Node",s,"getRootNode")()}function Cu(s){return!s||!("host"in s)?null:Ue("ShadowRoot",s,"host")}function bu(s){return s.styleSheets}function Eu(s){return!s||!("shadowRoot"in s)?null:Ue("Element",s,"shadowRoot")}function Ru(s,e){return Ue("Element",s,"querySelector")(e)}function Iu(s,e){return Ue("Element",s,"querySelectorAll")(e)}function xu(){return Rn("MutationObserver").constructor}var ne={childNodes:mu,parentNode:gu,parentElement:yu,textContent:wu,contains:Su,getRootNode:vu,host:Cu,styleSheets:bu,shadowRoot:Eu,querySelector:Ru,querySelectorAll:Iu,mutationObserver:xu};function vi(s){return s.nodeType===s.ELEMENT_NODE}function Ct(s){let e=s&&"host"in s&&"mode"in s&&ne.host(s)||null;return!!(e&&"shadowRoot"in e&&ne.shadowRoot(e)===s)}function bt(s){return Object.prototype.toString.call(s)==="[object ShadowRoot]"}function Au(s){return s.includes(" background-clip: text;")&&!s.includes(" -webkit-background-clip: text;")&&(s=s.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),s}function _u(s){let{cssText:e}=s;if(e.split('"').length<3)return e;let t=["@import",`url(${JSON.stringify(s.href)})`];return s.layerName===""?t.push("layer"):s.layerName&&t.push(`layer(${s.layerName})`),s.supportsText&&t.push(`supports(${s.supportsText})`),s.media.length&&t.push(s.media.mediaText),t.join(" ")+";"}function ks(s){try{let e=s.rules||s.cssRules;if(!e)return null;let t=s.href;!t&&s.ownerNode&&s.ownerNode.ownerDocument&&(t=s.ownerNode.ownerDocument.location.href);let r=Array.from(e,n=>Ci(n,t)).join("");return Au(r)}catch{return null}}function Ci(s,e){if(Du(s)){let t;try{t=ks(s.styleSheet)||_u(s)}catch{t=s.cssText}return s.styleSheet.href?xr(t,s.styleSheet.href):t}else{let t=s.cssText;return Tu(s)&&s.selectorText.includes(":")&&(t=Ou(t)),e?xr(t,e):t}}function Ou(s){let e=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return s.replace(e,"$1\\$2")}function Du(s){return"styleSheet"in s}function Tu(s){return"selectorText"in s}var Rr=class{constructor(){bo(this,"idNodeMap",new Map),bo(this,"nodeMetaMap",new WeakMap)}getId(e){var t;return e?((t=this.getMeta(e))==null?void 0:t.id)??-1:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){let t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach(r=>this.removeNodeFromMap(r))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){let r=t.id;this.idNodeMap.set(r,e),this.nodeMetaMap.set(e,t)}replace(e,t){let r=this.getNode(e);if(r){let n=this.nodeMetaMap.get(r);n&&this.nodeMetaMap.set(t,n)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function Nu(){return new Rr}function Ir({element:s,maskInputOptions:e,tagName:t,type:r,value:n,maskInputFn:o}){let i=n||"",l=r&&Be(r);return(e[t.toLowerCase()]||l&&e[l])&&(o?i=o(i,s):i="*".repeat(i.length)),i}function Be(s){return s.toLowerCase()}var Io="__rrweb_original__";function Mu(s){let e=s.getContext("2d");if(!e)return!0;let t=50;for(let r=0;r<s.width;r+=t)for(let n=0;n<s.height;n+=t){let o=e.getImageData,i=Io in o?o[Io]:o;if(new Uint32Array(i.call(e,r,n,Math.min(t,s.width-r),Math.min(t,s.height-n)).data.buffer).some(a=>a!==0))return!1}return!0}function In(s){let e=s.type;return s.hasAttribute("data-rr-is-password")?"password":e?Be(e):null}function bi(s,e){let t;try{t=new URL(s,e??window.location.href)}catch{return null}let r=/\.([0-9a-z]+)(?:$)/i,n=t.pathname.match(r);return n?.[1]??null}function ku(s){let e="";return s.indexOf("//")>-1?e=s.split("/").slice(0,3).join("/"):e=s.split("/")[0],e=e.split("?")[0],e}var Pu=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,$u=/^(?:[a-z+]+:)?\/\//i,Lu=/^www\..*/i,Fu=/^(data:)([^,]*),(.*)/i;function xr(s,e){return(s||"").replace(Pu,(t,r,n,o,i,l)=>{let a=n||i||l,u=r||o||"";if(!a)return t;if($u.test(a)||Lu.test(a))return`url(${u}${a}${u})`;if(Fu.test(a))return`url(${u}${a}${u})`;if(a[0]==="/")return`url(${u}${ku(e)+a}${u})`;let c=e.split("/"),d=a.split("/");c.pop();for(let p of d)p!=="."&&(p===".."?c.pop():c.push(p));return`url(${u}${c.join("/")}${u})`})}function Cs(s){return s.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"")}function Uu(s,e){let t=Array.from(e.childNodes),r=[];if(t.length>1&&s&&typeof s=="string"){let n=Cs(s);for(let o=1;o<t.length;o++)if(t[o].textContent&&typeof t[o].textContent=="string"){let i=Cs(t[o].textContent);for(let l=3;l<i.length;l++){let a=i.substring(0,l);if(n.split(a).length===2){let u=n.indexOf(a);for(let c=u;c<s.length;c++)if(Cs(s.substring(0,c)).length===u){r.push(s.substring(0,c)),s=s.substring(c);break}break}}}}return r.push(s),r}function zu(s,e){return Uu(s,e).join("/* rr_split */")}var Hu=1,Bu=new RegExp("[^a-z0-9-_:]"),Rt=-2;function Ei(){return Hu++}function Wu(s){if(s instanceof HTMLFormElement)return"form";let e=Be(s.tagName);return Bu.test(e)?"div":e}var Ze,xo,Vu=/^[^ \t\n\r\u000c]+/,Yu=/^[, \t\n\r\u000c]+/;function Gu(s,e){if(e.trim()==="")return e;let t=0;function r(o){let i,l=o.exec(e.substring(t));return l?(i=l[0],t+=i.length,i):""}let n=[];for(;r(Yu),!(t>=e.length);){let o=r(Vu);if(o.slice(-1)===",")o=Qe(s,o.substring(0,o.length-1)),n.push(o);else{let i="";o=Qe(s,o);let l=!1;for(;;){let a=e.charAt(t);if(a===""){n.push((o+i).trim());break}else if(l)a===")"&&(l=!1);else if(a===","){t+=1,n.push((o+i).trim());break}else a==="("&&(l=!0);i+=a,t+=1}}}return n.join(", ")}var Ao=new WeakMap;function Qe(s,e){return!e||e.trim()===""?e:xn(s,e)}function ju(s){return!!(s.tagName==="svg"||s.ownerSVGElement)}function xn(s,e){let t=Ao.get(s);if(t||(t=s.createElement("a"),Ao.set(s,t)),!e)e="";else if(e.startsWith("blob:")||e.startsWith("data:"))return e;return t.setAttribute("href",e),t.href}function Ri(s,e,t,r){return r&&(t==="src"||t==="href"&&!(e==="use"&&r[0]==="#")||t==="xlink:href"&&r[0]!=="#"||t==="background"&&(e==="table"||e==="td"||e==="th")?Qe(s,r):t==="srcset"?Gu(s,r):t==="style"?xr(r,xn(s)):e==="object"&&t==="data"?Qe(s,r):r)}function Ii(s,e,t){return(s==="video"||s==="audio")&&e==="autoplay"}function Ku(s,e,t,r){try{if(typeof e=="string"){if(s.classList.contains(e))return!0}else for(let n=s.classList.length;n--;){let o=s.classList[n];if(e.test(o))return!0}if(t)return s.matches(t);if(r&&s.tagName==="IMG"){let n=s.getAttribute("src");if(n&&r.test(n))return!0}}catch{}return!1}function Ar(s,e,t){if(!s)return!1;if(s.nodeType!==s.ELEMENT_NODE)return t?Ar(ne.parentNode(s),e,t):!1;for(let r=s.classList.length;r--;){let n=s.classList[r];if(e.test(n))return!0}return t?Ar(ne.parentNode(s),e,t):!1}function xi(s,e,t,r){let n;if(vi(s)){if(n=s,!ne.childNodes(n).length)return!1}else{if(ne.parentElement(s)===null)return!1;n=ne.parentElement(s)}try{if(typeof e=="string"){if(r){if(n.closest(`.${e}`))return!0}else if(n.classList.contains(e))return!0}else if(Ar(n,e,r))return!0;if(t){if(r){if(n.closest(t))return!0}else if(n.matches(t))return!0}if(n.getAttribute("contenteditable")||n.closest('[contenteditable="true"]'))return!0}catch{}return!1}function Ju(s,e,t){let r=s.contentWindow;if(!r)return;let n=!1,o;try{o=r.document.readyState}catch{return}if(o!=="complete"){let l=setTimeout(()=>{n||(e(),n=!0)},t);s.addEventListener("load",()=>{clearTimeout(l),n=!0,e()});return}let i="about:blank";if(r.location.href!==i||s.src===i||s.src==="")return setTimeout(e,0),s.addEventListener("load",e);s.addEventListener("load",e)}function Zu(s,e,t){let r=!1,n;try{n=s.sheet}catch{return}if(n)return;let o=setTimeout(()=>{r||(e(),r=!0)},t);s.addEventListener("load",()=>{clearTimeout(o),r=!0,e()})}function Xu(s,e){let{doc:t,mirror:r,blockClass:n,blockSelector:o,needsMask:i,inlineStylesheet:l,maskInputOptions:a={},maskTextFn:u,maskInputFn:c,maskAnchorHrefFn:d,blockImgSrcPattern:p,blockImgSrcFillOptions:m,dataURLOptions:g={},inlineImages:f,recordCanvas:h,keepIframeSrcFn:E,newlyAddedElement:S=!1,cssCaptured:w=!1}=e,I=qu(t,r);switch(s.nodeType){case s.DOCUMENT_NODE:return s.compatMode!=="CSS1Compat"?{type:q.Document,childNodes:[],compatMode:s.compatMode}:{type:q.Document,childNodes:[]};case s.DOCUMENT_TYPE_NODE:return{type:q.DocumentType,name:s.name,publicId:s.publicId,systemId:s.systemId,rootId:I};case s.ELEMENT_NODE:return ec(s,{doc:t,blockClass:n,blockSelector:o,inlineStylesheet:l,maskInputOptions:a,maskInputFn:c,maskAnchorHrefFn:d,blockImgSrcPattern:p,blockImgSrcFillOptions:m,dataURLOptions:g,inlineImages:f,recordCanvas:h,keepIframeSrcFn:E,newlyAddedElement:S,rootId:I});case s.TEXT_NODE:return Qu(s,{doc:t,needsMask:i,maskTextFn:u,rootId:I,cssCaptured:w});case s.CDATA_SECTION_NODE:return{type:q.CDATA,textContent:"",rootId:I};case s.COMMENT_NODE:return{type:q.Comment,textContent:ne.textContent(s)||"",rootId:I};default:return!1}}function qu(s,e){if(!e.hasNode(s))return;let t=e.getId(s);return t===1?void 0:t}function Qu(s,e){let{needsMask:t,maskTextFn:r,rootId:n,cssCaptured:o}=e,i=ne.parentNode(s),l=i&&i.tagName,a="",u=l==="STYLE"?!0:void 0,c=l==="SCRIPT"?!0:void 0;return c?a="SCRIPT_PLACEHOLDER":o||(a=ne.textContent(s),u&&a&&(a=xr(a,xn(e.doc)))),!u&&!c&&a&&t&&(a=r?r(a,ne.parentElement(s)):a.replace(/[\S]/g,"*")),{type:q.Text,textContent:a||"",rootId:n}}function ec(s,e){let{doc:t,blockClass:r,blockSelector:n,inlineStylesheet:o,maskInputOptions:i={},maskInputFn:l,maskAnchorHrefFn:a,blockImgSrcPattern:u,blockImgSrcFillOptions:c,dataURLOptions:d={},inlineImages:p,recordCanvas:m,keepIframeSrcFn:g,newlyAddedElement:f=!1,rootId:h}=e,E=Ku(s,r,n,u),S=Wu(s),w={},I=s.attributes.length;for(let y=0;y<I;y++){let R=s.attributes[y];Ii(S,R.name,R.value)||(w[R.name]=Ri(t,S,Be(R.name),R.value))}if(S==="a"&&a&&typeof w.href=="string"&&(w.href=a(w.href,s)),S==="link"&&o){let y=Array.from(t.styleSheets).find(v=>v.href===s.href);if(!y&&s.href.includes(".css")){let v=window.location.origin,x=s.href.replace(window.location.href,""),O=v+"/"+x;y=Array.from(t.styleSheets).find(le=>le.href===O)}let R=null;y&&(R=ks(y)),R&&(delete w.rel,delete w.href,w._cssText=R)}if(S==="style"&&s.sheet){let y=ks(s.sheet);y&&(s.childNodes.length>1&&(y=zu(y,s)),w._cssText=y)}if(S==="input"||S==="textarea"||S==="select"){let y=s.value,R=s.checked;w.type!=="radio"&&w.type!=="checkbox"&&w.type!=="submit"&&w.type!=="button"&&y?w.value=Ir({element:s,type:In(s),tagName:S,value:y,maskInputOptions:i,maskInputFn:l}):R&&(w.checked=R)}if(S==="option"&&(s.selected&&!i.select?w.selected=!0:delete w.selected),S==="dialog"&&s.open&&(w.rr_open_mode=s.matches("dialog:modal")?"modal":"non-modal"),S==="canvas"&&m){if(s.__context==="2d")Mu(s)||(w.rr_dataURL=s.toDataURL(d.type,d.quality));else if(!("__context"in s)){let y=s.toDataURL(d.type,d.quality),R=t.createElement("canvas");R.width=s.width,R.height=s.height;let v=R.toDataURL(d.type,d.quality);y!==v&&(w.rr_dataURL=y)}}if(S==="img"&&p){Ze||(Ze=t.createElement("canvas"),xo=Ze.getContext("2d"));let y=s,R=y.currentSrc||y.getAttribute("src")||"<unknown-src>",v=y.crossOrigin,x=()=>{y.removeEventListener("load",x);try{Ze.width=y.naturalWidth,Ze.height=y.naturalHeight,xo.drawImage(y,0,0),w.rr_dataURL=Ze.toDataURL(d.type,d.quality)}catch(O){if(y.crossOrigin!=="anonymous"){y.crossOrigin="anonymous",y.complete&&y.naturalWidth!==0?x():y.addEventListener("load",x);return}else console.warn(`Cannot inline img src=${R}! Error: ${O}`)}y.crossOrigin==="anonymous"&&(v?w.crossOrigin=v:y.removeAttribute("crossorigin"))};y.complete&&y.naturalWidth!==0?x():y.addEventListener("load",x)}if(S==="audio"||S==="video"){let y=w;y.rr_mediaState=s.paused?"paused":"played",y.rr_mediaCurrentTime=s.currentTime,y.rr_mediaPlaybackRate=s.playbackRate,y.rr_mediaMuted=s.muted,y.rr_mediaLoop=s.loop,y.rr_mediaVolume=s.volume}if(f||(s.scrollLeft&&(w.rr_scrollLeft=s.scrollLeft),s.scrollTop&&(w.rr_scrollTop=s.scrollTop)),E){let{width:y,height:R}=s.getBoundingClientRect();w={class:w.class,rr_width:`${y}px`,rr_height:`${R}px`}}E&&S==="img"&&(w={...w,src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP89v3nfwAJuAPnyTr4jAAAAABJRU5ErkJggg==",rr_fill:c.backgroundColor,rr_stroke:c.strokeColor,rr_stroke_width:c.strokeWidth}),S==="iframe"&&!g(w.src)&&(s.contentDocument||(w.rr_src=w.src),delete w.src);let _;try{customElements.get(S)&&(_=!0)}catch{}return{type:q.Element,tagName:S,attributes:w,childNodes:[],isSVG:ju(s)||void 0,needBlock:E,rootId:h,isCustom:_}}function z(s){return s==null?"":s.toLowerCase()}function tc(s,e){if(e.comment&&s.type===q.Comment)return!0;if(s.type===q.Element){if(e.script&&(s.tagName==="script"||s.tagName==="link"&&(s.attributes.rel==="preload"||s.attributes.rel==="modulepreload")&&s.attributes.as==="script"||s.tagName==="link"&&s.attributes.rel==="prefetch"&&typeof s.attributes.href=="string"&&bi(s.attributes.href)==="js"))return!0;if(e.headFavicon&&(s.tagName==="link"&&s.attributes.rel==="shortcut icon"||s.tagName==="meta"&&(z(s.attributes.name).match(/^msapplication-tile(image|color)$/)||z(s.attributes.name)==="application-name"||z(s.attributes.rel)==="icon"||z(s.attributes.rel)==="apple-touch-icon"||z(s.attributes.rel)==="shortcut icon")))return!0;if(s.tagName==="meta"){if(e.headMetaDescKeywords&&z(s.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(z(s.attributes.property).match(/^(og|twitter|fb):/)||z(s.attributes.name).match(/^(og|twitter):/)||z(s.attributes.name)==="pinterest"))return!0;if(e.headMetaRobots&&(z(s.attributes.name)==="robots"||z(s.attributes.name)==="googlebot"||z(s.attributes.name)==="bingbot"))return!0;if(e.headMetaHttpEquiv&&s.attributes["http-equiv"]!==void 0)return!0;if(e.headMetaAuthorship&&(z(s.attributes.name)==="author"||z(s.attributes.name)==="generator"||z(s.attributes.name)==="framework"||z(s.attributes.name)==="publisher"||z(s.attributes.name)==="progid"||z(s.attributes.property).match(/^article:/)||z(s.attributes.property).match(/^product:/)))return!0;if(e.headMetaVerification&&(z(s.attributes.name)==="google-site-verification"||z(s.attributes.name)==="yandex-verification"||z(s.attributes.name)==="csrf-token"||z(s.attributes.name)==="p:domain_verify"||z(s.attributes.name)==="verify-v1"||z(s.attributes.name)==="verification"||z(s.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function et(s,e){if(s.nodeName.toLowerCase().includes("grammarly"))return null;let{doc:t,mirror:r,blockClass:n,blockSelector:o,maskTextClass:i,maskTextSelector:l,skipChild:a=!1,inlineStylesheet:u=!0,maskInputOptions:c={},maskTextFn:d,maskInputFn:p,maskAnchorHrefFn:m,blockImgSrcPattern:g,blockImgSrcFillOptions:f,slimDOMOptions:h,dataURLOptions:E={},inlineImages:S=!1,recordCanvas:w=!1,onSerialize:I,onIframeLoad:_,iframeLoadTimeout:y=5e3,onStylesheetLoad:R,stylesheetLoadTimeout:v=5e3,keepIframeSrcFn:x=()=>!1,newlyAddedElement:O=!1,cssCaptured:le=!1}=e,{needsMask:Y}=e,{preserveWhiteSpace:ue=!0}=e;Y||(Y=xi(s,i,l,Y===void 0));let X=Xu(s,{doc:t,mirror:r,blockClass:n,blockSelector:o,needsMask:Y,inlineStylesheet:u,maskInputOptions:c,maskTextFn:d,maskInputFn:p,maskAnchorHrefFn:m,blockImgSrcPattern:g,blockImgSrcFillOptions:f,dataURLOptions:E,inlineImages:S,recordCanvas:w,keepIframeSrcFn:x,newlyAddedElement:O,cssCaptured:le});if(!X)return console.warn(s,"not serialized"),null;let j;r.hasNode(s)?j=r.getId(s):tc(X,h)||!ue&&X.type===q.Text&&!X.textContent.replace(/^\s+|\s+$/gm,"").length?j=Rt:j=Ei();let A=Object.assign(X,{id:j});if(r.add(s,A),j===Rt)return null;I&&I(s);let G=!a;if(A.type===q.Element){G=G&&!A.needBlock,delete A.needBlock;let F=ne.shadowRoot(s);F&&bt(F)&&(A.isShadowHost=!0)}if((A.type===q.Document||A.type===q.Element)&&G){h.headWhitespace&&A.type===q.Element&&A.tagName==="head"&&(ue=!1);let F={doc:t,mirror:r,blockClass:n,blockSelector:o,needsMask:Y,maskTextClass:i,maskTextSelector:l,skipChild:a,inlineStylesheet:u,maskInputOptions:c,maskTextFn:d,maskInputFn:p,maskAnchorHrefFn:m,blockImgSrcPattern:g,blockImgSrcFillOptions:f,slimDOMOptions:h,dataURLOptions:E,inlineImages:S,recordCanvas:w,preserveWhiteSpace:ue,onSerialize:I,onIframeLoad:_,iframeLoadTimeout:y,onStylesheetLoad:R,stylesheetLoadTimeout:v,keepIframeSrcFn:x,cssCaptured:!1};if(!(A.type===q.Element&&A.tagName==="textarea"&&A.attributes.value!==void 0)){A.type===q.Element&&A.attributes._cssText!==void 0&&typeof A.attributes._cssText=="string"&&(F.cssCaptured=!0);for(let Q of Array.from(ne.childNodes(s))){let re=et(Q,F);re&&A.childNodes.push(re)}}let te=null;if(vi(s)&&(te=ne.shadowRoot(s)))for(let Q of Array.from(ne.childNodes(te))){let re=et(Q,F);re&&(bt(te)&&(re.isShadow=!0),A.childNodes.push(re))}}let ee=ne.parentNode(s);return ee&&Ct(ee)&&bt(ee)&&(A.isShadow=!0),A.type===q.Element&&A.tagName==="iframe"&&Ju(s,()=>{let F=s.contentDocument;if(F&&_){let te=et(F,{doc:F,mirror:r,blockClass:n,blockSelector:o,needsMask:Y,maskTextClass:i,maskTextSelector:l,skipChild:!1,inlineStylesheet:u,maskInputOptions:c,maskTextFn:d,maskInputFn:p,maskAnchorHrefFn:m,blockImgSrcPattern:g,blockImgSrcFillOptions:f,slimDOMOptions:h,dataURLOptions:E,inlineImages:S,recordCanvas:w,preserveWhiteSpace:ue,onSerialize:I,onIframeLoad:_,iframeLoadTimeout:y,onStylesheetLoad:R,stylesheetLoadTimeout:v,keepIframeSrcFn:x});te&&_(s,te)}},y),A.type===q.Element&&A.tagName==="link"&&typeof A.attributes.rel=="string"&&(A.attributes.rel==="stylesheet"||A.attributes.rel==="preload"&&typeof A.attributes.href=="string"&&bi(A.attributes.href)==="css")&&Zu(s,()=>{if(R){let F=et(s,{doc:t,mirror:r,blockClass:n,blockSelector:o,needsMask:Y,maskTextClass:i,maskTextSelector:l,skipChild:!1,inlineStylesheet:u,maskInputOptions:c,maskTextFn:d,maskInputFn:p,maskAnchorHrefFn:m,blockImgSrcPattern:g,blockImgSrcFillOptions:f,slimDOMOptions:h,dataURLOptions:E,inlineImages:S,recordCanvas:w,preserveWhiteSpace:ue,onSerialize:I,onIframeLoad:_,iframeLoadTimeout:y,onStylesheetLoad:R,stylesheetLoadTimeout:v,keepIframeSrcFn:x});F&&R(s,F)}},v),A}function rc(s,e){let{mirror:t=new Rr,blockClass:r="rr-block",blockSelector:n=null,maskTextClass:o="rr-mask",maskTextSelector:i=null,inlineStylesheet:l=!0,inlineImages:a=!1,recordCanvas:u=!1,maskAllInputs:c=!1,maskTextFn:d,maskInputFn:p,maskAnchorHrefFn:m,blockImgSrcPattern:g=null,blockImgSrcFillOptions:f={backgroundColor:"#F6F7F9",strokeColor:"#E9EBEF",strokeWidth:"1px"},slimDOM:h=!1,dataURLOptions:E,preserveWhiteSpace:S,onSerialize:w,onIframeLoad:I,iframeLoadTimeout:_,onStylesheetLoad:y,stylesheetLoadTimeout:R,keepIframeSrcFn:v=()=>!1}=e||{};return et(s,{doc:s,mirror:t,blockClass:r,blockSelector:n,maskTextClass:o,maskTextSelector:i,skipChild:!1,inlineStylesheet:l,maskInputOptions:c===!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}:c===!1?{password:!0}:c,maskTextFn:d,maskInputFn:p,maskAnchorHrefFn:m,blockImgSrcPattern:g,blockImgSrcFillOptions:f,slimDOMOptions:h===!0||h==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:h==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:h===!1?{}:h,dataURLOptions:E,inlineImages:a,recordCanvas:u,preserveWhiteSpace:S,onSerialize:w,onIframeLoad:I,iframeLoadTimeout:_,onStylesheetLoad:y,stylesheetLoadTimeout:R,keepIframeSrcFn:v,newlyAddedElement:!1})}function sc(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function nc(s){if(s.__esModule)return s;var e=s.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(s).forEach(function(r){var n=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return s[r]}})}),t}var An={exports:{}},H=String,Ai=function(){return{isColorSupported:!1,reset:H,bold:H,dim:H,italic:H,underline:H,inverse:H,hidden:H,strikethrough:H,black:H,red:H,green:H,yellow:H,blue:H,magenta:H,cyan:H,white:H,gray:H,bgBlack:H,bgRed:H,bgGreen:H,bgYellow:H,bgBlue:H,bgMagenta:H,bgCyan:H,bgWhite:H}};An.exports=Ai();An.exports.createColors=Ai;var oc=An.exports,ic={},ac=Object.freeze(Object.defineProperty({__proto__:null,default:ic},Symbol.toStringTag,{value:"Module"})),ve=nc(ac),_o=oc,Oo=ve,Ps=class _i extends Error{constructor(e,t,r,n,o,i){super(e),this.name="CssSyntaxError",this.reason=e,o&&(this.file=o),n&&(this.source=n),i&&(this.plugin=i),typeof t<"u"&&typeof r<"u"&&(typeof t=="number"?(this.line=t,this.column=r):(this.line=t.line,this.column=t.column,this.endLine=r.line,this.endColumn=r.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,_i)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(e){if(!this.source)return"";let t=this.source;e==null&&(e=_o.isColorSupported),Oo&&e&&(t=Oo(t));let r=t.split(/\r?\n/),n=Math.max(this.line-3,0),o=Math.min(this.line+2,r.length),i=String(o).length,l,a;if(e){let{bold:u,gray:c,red:d}=_o.createColors(!0);l=p=>u(d(p)),a=p=>c(p)}else l=a=u=>u;return r.slice(n,o).map((u,c)=>{let d=n+1+c,p=" "+(" "+d).slice(-i)+" | ";if(d===this.line){let m=a(p.replace(/\d/g," "))+u.slice(0,this.column-1).replace(/[^\t]/g," ");return l(">")+a(p)+u+`
2
- `+m+l("^")}return" "+a(p)+u}).join(`
3
- `)}toString(){let e=this.showSourceCode();return e&&(e=`
4
-
5
- `+e+`
6
- `),this.name+": "+this.message+e}},_n=Ps;Ps.default=Ps;var kt={};kt.isClean=Symbol("isClean");kt.my=Symbol("my");var Do={after:`
7
- `,beforeClose:`
8
- `,beforeComment:`
9
- `,beforeDecl:`
10
- `,beforeOpen:" ",beforeRule:`
11
- `,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function lc(s){return s[0].toUpperCase()+s.slice(1)}var $s=class{constructor(e){this.builder=e}atrule(e,t){let r="@"+e.name,n=e.params?this.rawValue(e,"params"):"";if(typeof e.raws.afterName<"u"?r+=e.raws.afterName:n&&(r+=" "),e.nodes)this.block(e,r+n);else{let o=(e.raws.between||"")+(t?";":"");this.builder(r+n+o,e)}}beforeAfter(e,t){let r;e.type==="decl"?r=this.raw(e,null,"beforeDecl"):e.type==="comment"?r=this.raw(e,null,"beforeComment"):t==="before"?r=this.raw(e,null,"beforeRule"):r=this.raw(e,null,"beforeClose");let n=e.parent,o=0;for(;n&&n.type!=="root";)o+=1,n=n.parent;if(r.includes(`
12
- `)){let i=this.raw(e,null,"indent");if(i.length)for(let l=0;l<o;l++)r+=i}return r}block(e,t){let r=this.raw(e,"between","beforeOpen");this.builder(t+r+"{",e,"start");let n;e.nodes&&e.nodes.length?(this.body(e),n=this.raw(e,"after")):n=this.raw(e,"after","emptyBody"),n&&this.builder(n),this.builder("}",e,"end")}body(e){let t=e.nodes.length-1;for(;t>0&&e.nodes[t].type==="comment";)t-=1;let r=this.raw(e,"semicolon");for(let n=0;n<e.nodes.length;n++){let o=e.nodes[n],i=this.raw(o,"before");i&&this.builder(i),this.stringify(o,t!==n||r)}}comment(e){let t=this.raw(e,"left","commentLeft"),r=this.raw(e,"right","commentRight");this.builder("/*"+t+e.text+r+"*/",e)}decl(e,t){let r=this.raw(e,"between","colon"),n=e.prop+r+this.rawValue(e,"value");e.important&&(n+=e.raws.important||" !important"),t&&(n+=";"),this.builder(n,e)}document(e){this.body(e)}raw(e,t,r){let n;if(r||(r=t),t&&(n=e.raws[t],typeof n<"u"))return n;let o=e.parent;if(r==="before"&&(!o||o.type==="root"&&o.first===e||o&&o.type==="document"))return"";if(!o)return Do[r];let i=e.root();if(i.rawCache||(i.rawCache={}),typeof i.rawCache[r]<"u")return i.rawCache[r];if(r==="before"||r==="after")return this.beforeAfter(e,r);{let l="raw"+lc(r);this[l]?n=this[l](i,e):i.walk(a=>{if(n=a.raws[t],typeof n<"u")return!1})}return typeof n>"u"&&(n=Do[r]),i.rawCache[r]=n,n}rawBeforeClose(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length>0&&typeof r.raws.after<"u")return t=r.raws.after,t.includes(`
13
- `)&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawBeforeComment(e,t){let r;return e.walkComments(n=>{if(typeof n.raws.before<"u")return r=n.raws.before,r.includes(`
14
- `)&&(r=r.replace(/[^\n]+$/,"")),!1}),typeof r>"u"?r=this.raw(t,null,"beforeDecl"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeDecl(e,t){let r;return e.walkDecls(n=>{if(typeof n.raws.before<"u")return r=n.raws.before,r.includes(`
15
- `)&&(r=r.replace(/[^\n]+$/,"")),!1}),typeof r>"u"?r=this.raw(t,null,"beforeRule"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeOpen(e){let t;return e.walk(r=>{if(r.type!=="decl"&&(t=r.raws.between,typeof t<"u"))return!1}),t}rawBeforeRule(e){let t;return e.walk(r=>{if(r.nodes&&(r.parent!==e||e.first!==r)&&typeof r.raws.before<"u")return t=r.raws.before,t.includes(`
16
- `)&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawColon(e){let t;return e.walkDecls(r=>{if(typeof r.raws.between<"u")return t=r.raws.between.replace(/[^\s:]/g,""),!1}),t}rawEmptyBody(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length===0&&(t=r.raws.after,typeof t<"u"))return!1}),t}rawIndent(e){if(e.raws.indent)return e.raws.indent;let t;return e.walk(r=>{let n=r.parent;if(n&&n!==e&&n.parent&&n.parent===e&&typeof r.raws.before<"u"){let o=r.raws.before.split(`
17
- `);return t=o[o.length-1],t=t.replace(/\S/g,""),!1}}),t}rawSemicolon(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length&&r.last.type==="decl"&&(t=r.raws.semicolon,typeof t<"u"))return!1}),t}rawValue(e,t){let r=e[t],n=e.raws[t];return n&&n.value===r?n.raw:r}root(e){this.body(e),e.raws.after&&this.builder(e.raws.after)}rule(e){this.block(e,this.rawValue(e,"selector")),e.raws.ownSemicolon&&this.builder(e.raws.ownSemicolon,e,"end")}stringify(e,t){if(!this[e.type])throw new Error("Unknown AST node type "+e.type+". Maybe you need to change PostCSS stringifier.");this[e.type](e,t)}},Oi=$s;$s.default=$s;var uc=Oi;function Ls(s,e){new uc(e).stringify(s)}var zr=Ls;Ls.default=Ls;var{isClean:Xt,my:cc}=kt,dc=_n,hc=Oi,fc=zr;function Fs(s,e){let t=new s.constructor;for(let r in s){if(!Object.prototype.hasOwnProperty.call(s,r)||r==="proxyCache")continue;let n=s[r],o=typeof n;r==="parent"&&o==="object"?e&&(t[r]=e):r==="source"?t[r]=n:Array.isArray(n)?t[r]=n.map(i=>Fs(i,t)):(o==="object"&&n!==null&&(n=Fs(n)),t[r]=n)}return t}var Us=class{constructor(e={}){this.raws={},this[Xt]=!1,this[cc]=!0;for(let t in e)if(t==="nodes"){this.nodes=[];for(let r of e[t])typeof r.clone=="function"?this.append(r.clone()):this.append(r)}else this[t]=e[t]}addToError(e){if(e.postcssNode=this,e.stack&&this.source&&/\n\s{4}at /.test(e.stack)){let t=this.source;e.stack=e.stack.replace(/\n\s{4}at /,`$&${t.input.from}:${t.start.line}:${t.start.column}$&`)}return e}after(e){return this.parent.insertAfter(this,e),this}assign(e={}){for(let t in e)this[t]=e[t];return this}before(e){return this.parent.insertBefore(this,e),this}cleanRaws(e){delete this.raws.before,delete this.raws.after,e||delete this.raws.between}clone(e={}){let t=Fs(this);for(let r in e)t[r]=e[r];return t}cloneAfter(e={}){let t=this.clone(e);return this.parent.insertAfter(this,t),t}cloneBefore(e={}){let t=this.clone(e);return this.parent.insertBefore(this,t),t}error(e,t={}){if(this.source){let{end:r,start:n}=this.rangeBy(t);return this.source.input.error(e,{column:n.column,line:n.line},{column:r.column,line:r.line},t)}return new dc(e)}getProxyProcessor(){return{get(e,t){return t==="proxyOf"?e:t==="root"?()=>e.root().toProxy():e[t]},set(e,t,r){return e[t]===r||(e[t]=r,(t==="prop"||t==="value"||t==="name"||t==="params"||t==="important"||t==="text")&&e.markDirty()),!0}}}markDirty(){if(this[Xt]){this[Xt]=!1;let e=this;for(;e=e.parent;)e[Xt]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e,t){let r=this.source.start;if(e.index)r=this.positionInside(e.index,t);else if(e.word){t=this.toString();let n=t.indexOf(e.word);n!==-1&&(r=this.positionInside(n,t))}return r}positionInside(e,t){let r=t||this.toString(),n=this.source.start.column,o=this.source.start.line;for(let i=0;i<e;i++)r[i]===`
18
- `?(n=1,o+=1):n+=1;return{column:n,line:o}}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}rangeBy(e){let t={column:this.source.start.column,line:this.source.start.line},r=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:t.column+1,line:t.line};if(e.word){let n=this.toString(),o=n.indexOf(e.word);o!==-1&&(t=this.positionInside(o,n),r=this.positionInside(o+e.word.length,n))}else e.start?t={column:e.start.column,line:e.start.line}:e.index&&(t=this.positionInside(e.index)),e.end?r={column:e.end.column,line:e.end.line}:typeof e.endIndex=="number"?r=this.positionInside(e.endIndex):e.index&&(r=this.positionInside(e.index+1));return(r.line<t.line||r.line===t.line&&r.column<=t.column)&&(r={column:t.column+1,line:t.line}),{end:r,start:t}}raw(e,t){return new hc().raw(this,e,t)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...e){if(this.parent){let t=this,r=!1;for(let n of e)n===this?r=!0:r?(this.parent.insertAfter(t,n),t=n):this.parent.insertBefore(t,n);r||this.remove()}return this}root(){let e=this;for(;e.parent&&e.parent.type!=="document";)e=e.parent;return e}toJSON(e,t){let r={},n=t==null;t=t||new Map;let o=0;for(let i in this){if(!Object.prototype.hasOwnProperty.call(this,i)||i==="parent"||i==="proxyCache")continue;let l=this[i];if(Array.isArray(l))r[i]=l.map(a=>typeof a=="object"&&a.toJSON?a.toJSON(null,t):a);else if(typeof l=="object"&&l.toJSON)r[i]=l.toJSON(null,t);else if(i==="source"){let a=t.get(l.input);a==null&&(a=o,t.set(l.input,o),o++),r[i]={end:l.end,inputId:a,start:l.start}}else r[i]=l}return n&&(r.inputs=[...t.keys()].map(i=>i.toJSON())),r}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(e=fc){e.stringify&&(e=e.stringify);let t="";return e(this,r=>{t+=r}),t}warn(e,t,r){let n={node:this};for(let o in r)n[o]=r[o];return e.warn(t,n)}get proxyOf(){return this}},Hr=Us;Us.default=Us;var pc=Hr,zs=class extends pc{constructor(e){e&&typeof e.value<"u"&&typeof e.value!="string"&&(e={...e,value:String(e.value)}),super(e),this.type="decl"}get variable(){return this.prop.startsWith("--")||this.prop[0]==="$"}},Br=zs;zs.default=zs;var mc="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",gc=(s,e=21)=>(t=e)=>{let r="",n=t;for(;n--;)r+=s[Math.random()*s.length|0];return r},yc=(s=21)=>{let e="",t=s;for(;t--;)e+=mc[Math.random()*64|0];return e},wc={nanoid:yc,customAlphabet:gc},{SourceMapConsumer:To,SourceMapGenerator:No}=ve,{existsSync:Sc,readFileSync:vc}=ve,{dirname:bs,join:Cc}=ve;function bc(s){return Buffer?Buffer.from(s,"base64").toString():window.atob(s)}var Hs=class{constructor(e,t){if(t.map===!1)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");let r=t.map?t.map.prev:void 0,n=this.loadMap(t.from,r);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=bs(this.mapFile)),n&&(this.text=n)}consumer(){return this.consumerCache||(this.consumerCache=new To(this.text)),this.consumerCache}decodeInline(e){let t=/^data:application\/json;charset=utf-?8;base64,/,r=/^data:application\/json;base64,/,n=/^data:application\/json;charset=utf-?8,/,o=/^data:application\/json,/;if(n.test(e)||o.test(e))return decodeURIComponent(e.substr(RegExp.lastMatch.length));if(t.test(e)||r.test(e))return bc(e.substr(RegExp.lastMatch.length));let i=e.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+i)}getAnnotationURL(e){return e.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(e){return typeof e!="object"?!1:typeof e.mappings=="string"||typeof e._mappings=="string"||Array.isArray(e.sections)}loadAnnotation(e){let t=e.match(/\/\*\s*# sourceMappingURL=/gm);if(!t)return;let r=e.lastIndexOf(t.pop()),n=e.indexOf("*/",r);r>-1&&n>-1&&(this.annotation=this.getAnnotationURL(e.substring(r,n)))}loadFile(e){if(this.root=bs(e),Sc(e))return this.mapFile=e,vc(e,"utf-8").toString().trim()}loadMap(e,t){if(t===!1)return!1;if(t){if(typeof t=="string")return t;if(typeof t=="function"){let r=t(e);if(r){let n=this.loadFile(r);if(!n)throw new Error("Unable to load previous source map: "+r.toString());return n}}else{if(t instanceof To)return No.fromSourceMap(t).toString();if(t instanceof No)return t.toString();if(this.isMap(t))return JSON.stringify(t);throw new Error("Unsupported previous source map format: "+t.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let r=this.annotation;return e&&(r=Cc(bs(e),r)),this.loadFile(r)}}}startWith(e,t){return e?e.substr(0,t.length)===t:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}},Di=Hs;Hs.default=Hs;var{SourceMapConsumer:Ec,SourceMapGenerator:Rc}=ve,{fileURLToPath:Mo,pathToFileURL:qt}=ve,{isAbsolute:Bs,resolve:Ws}=ve,{nanoid:Ic}=wc,Es=ve,ko=_n,xc=Di,Rs=Symbol("fromOffsetCache"),Ac=!!(Ec&&Rc),Po=!!(Ws&&Bs),_r=class{constructor(e,t={}){if(e===null||typeof e>"u"||typeof e=="object"&&!e.toString)throw new Error(`PostCSS received ${e} instead of CSS string`);if(this.css=e.toString(),this.css[0]==="\uFEFF"||this.css[0]==="\uFFFE"?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,t.from&&(!Po||/^\w+:\/\//.test(t.from)||Bs(t.from)?this.file=t.from:this.file=Ws(t.from)),Po&&Ac){let r=new xc(this.css,t);if(r.text){this.map=r;let n=r.consumer().file;!this.file&&n&&(this.file=this.mapResolve(n))}}this.file||(this.id="<input css "+Ic(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,r,n={}){let o,i,l;if(t&&typeof t=="object"){let u=t,c=r;if(typeof u.offset=="number"){let d=this.fromOffset(u.offset);t=d.line,r=d.col}else t=u.line,r=u.column;if(typeof c.offset=="number"){let d=this.fromOffset(c.offset);i=d.line,l=d.col}else i=c.line,l=c.column}else if(!r){let u=this.fromOffset(t);t=u.line,r=u.col}let a=this.origin(t,r,i,l);return a?o=new ko(e,a.endLine===void 0?a.line:{column:a.column,line:a.line},a.endLine===void 0?a.column:{column:a.endColumn,line:a.endLine},a.source,a.file,n.plugin):o=new ko(e,i===void 0?t:{column:r,line:t},i===void 0?r:{column:l,line:i},this.css,this.file,n.plugin),o.input={column:r,endColumn:l,endLine:i,line:t,source:this.css},this.file&&(qt&&(o.input.url=qt(this.file).toString()),o.input.file=this.file),o}fromOffset(e){let t,r;if(this[Rs])r=this[Rs];else{let o=this.css.split(`
19
- `);r=new Array(o.length);let i=0;for(let l=0,a=o.length;l<a;l++)r[l]=i,i+=o[l].length+1;this[Rs]=r}t=r[r.length-1];let n=0;if(e>=t)n=r.length-1;else{let o=r.length-2,i;for(;n<o;)if(i=n+(o-n>>1),e<r[i])o=i-1;else if(e>=r[i+1])n=i+1;else{n=i;break}}return{col:e-r[n]+1,line:n+1}}mapResolve(e){return/^\w+:\/\//.test(e)?e:Ws(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,r,n){if(!this.map)return!1;let o=this.map.consumer(),i=o.originalPositionFor({column:t,line:e});if(!i.source)return!1;let l;typeof r=="number"&&(l=o.originalPositionFor({column:n,line:r}));let a;Bs(i.source)?a=qt(i.source):a=new URL(i.source,this.map.consumer().sourceRoot||qt(this.map.mapFile));let u={column:i.column,endColumn:l&&l.column,endLine:l&&l.line,line:i.line,url:a.toString()};if(a.protocol==="file:")if(Mo)u.file=Mo(a);else throw new Error("file: protocol is not available in this PostCSS build");let c=o.sourceContentFor(i.source);return c&&(u.source=c),u}toJSON(){let e={};for(let t of["hasBOM","css","file","id"])this[t]!=null&&(e[t]=this[t]);return this.map&&(e.map={...this.map},e.map.consumerCache&&(e.map.consumerCache=void 0)),e}get from(){return this.file||this.id}},Wr=_r;_r.default=_r;Es&&Es.registerInput&&Es.registerInput(_r);var{SourceMapConsumer:Ti,SourceMapGenerator:wr}=ve,{dirname:Sr,relative:Ni,resolve:Mi,sep:ki}=ve,{pathToFileURL:$o}=ve,_c=Wr,Oc=!!(Ti&&wr),Dc=!!(Sr&&Mi&&Ni&&ki),Tc=class{constructor(e,t,r,n){this.stringify=e,this.mapOpts=r.map||{},this.root=t,this.opts=r,this.css=n,this.originalCSS=n,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let e;this.isInline()?e="data:application/json;base64,"+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation=="string"?e=this.mapOpts.annotation:typeof this.mapOpts.annotation=="function"?e=this.mapOpts.annotation(this.opts.to,this.root):e=this.outputFile()+".map";let t=`
20
- `;this.css.includes(`\r
21
- `)&&(t=`\r
22
- `),this.css+=t+"/*# sourceMappingURL="+e+" */"}applyPrevMaps(){for(let e of this.previous()){let t=this.toUrl(this.path(e.file)),r=e.root||Sr(e.file),n;this.mapOpts.sourcesContent===!1?(n=new Ti(e.text),n.sourcesContent&&(n.sourcesContent=null)):n=e.consumer(),this.map.applySourceMap(n,t,this.toUrl(this.path(r)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1)if(this.root){let e;for(let t=this.root.nodes.length-1;t>=0;t--)e=this.root.nodes[t],e.type==="comment"&&e.text.indexOf("# sourceMappingURL=")===0&&this.root.removeChild(t)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),Dc&&Oc&&this.isMap())return this.generateMap();{let e="";return this.stringify(this.root,t=>{e+=t}),[e]}}generateMap(){if(this.root)this.generateString();else if(this.previous().length===1){let e=this.previous()[0].consumer();e.file=this.outputFile(),this.map=wr.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new wr({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 wr({file:this.outputFile(),ignoreInvalidMapping:!0});let e=1,t=1,r="<no source>",n={generated:{column:0,line:0},original:{column:0,line:0},source:""},o,i;this.stringify(this.root,(l,a,u)=>{if(this.css+=l,a&&u!=="end"&&(n.generated.line=e,n.generated.column=t-1,a.source&&a.source.start?(n.source=this.sourcePath(a),n.original.line=a.source.start.line,n.original.column=a.source.start.column-1,this.map.addMapping(n)):(n.source=r,n.original.line=1,n.original.column=0,this.map.addMapping(n))),o=l.match(/\n/g),o?(e+=o.length,i=l.lastIndexOf(`
23
- `),t=l.length-i):t+=l.length,a&&u!=="start"){let c=a.parent||{raws:{}};(!(a.type==="decl"||a.type==="atrule"&&!a.nodes)||a!==c.last||c.raws.semicolon)&&(a.source&&a.source.end?(n.source=this.sourcePath(a),n.original.line=a.source.end.line,n.original.column=a.source.end.column-1,n.generated.line=e,n.generated.column=t-2,this.map.addMapping(n)):(n.source=r,n.original.line=1,n.original.column=0,n.generated.line=e,n.generated.column=t-1,this.map.addMapping(n)))}})}isAnnotation(){return this.isInline()?!0:typeof this.mapOpts.annotation<"u"?this.mapOpts.annotation:this.previous().length?this.previous().some(e=>e.annotation):!0}isInline(){if(typeof this.mapOpts.inline<"u")return this.mapOpts.inline;let e=this.mapOpts.annotation;return typeof e<"u"&&e!==!0?!1:this.previous().length?this.previous().some(t=>t.inline):!0}isMap(){return typeof this.opts.map<"u"?!!this.opts.map:this.previous().length>0}isSourcesContent(){return typeof this.mapOpts.sourcesContent<"u"?this.mapOpts.sourcesContent:this.previous().length?this.previous().some(e=>e.withContent()):!0}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(e){if(this.mapOpts.absolute||e.charCodeAt(0)===60||/^\w+:\/\//.test(e))return e;let t=this.memoizedPaths.get(e);if(t)return t;let r=this.opts.to?Sr(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(r=Sr(Mi(r,this.mapOpts.annotation)));let n=Ni(r,e);return this.memoizedPaths.set(e,n),n}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(e=>{if(e.source&&e.source.input.map){let t=e.source.input.map;this.previousMaps.includes(t)||this.previousMaps.push(t)}});else{let e=new _c(this.originalCSS,this.opts);e.map&&this.previousMaps.push(e.map)}return this.previousMaps}setSourcesContent(){let e={};if(this.root)this.root.walk(t=>{if(t.source){let r=t.source.input.from;if(r&&!e[r]){e[r]=!0;let n=this.usesFileUrls?this.toFileUrl(r):this.toUrl(this.path(r));this.map.setSourceContent(n,t.source.input.css)}}});else if(this.css){let t=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(t,this.css)}}sourcePath(e){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(e.source.input.from):this.toUrl(this.path(e.source.input.from))}toBase64(e){return Buffer?Buffer.from(e).toString("base64"):window.btoa(unescape(encodeURIComponent(e)))}toFileUrl(e){let t=this.memoizedFileURLs.get(e);if(t)return t;if($o){let r=$o(e).toString();return this.memoizedFileURLs.set(e,r),r}else throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(e){let t=this.memoizedURLs.get(e);if(t)return t;ki==="\\"&&(e=e.replace(/\\/g,"/"));let r=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,r),r}},Pi=Tc,Nc=Hr,Vs=class extends Nc{constructor(e){super(e),this.type="comment"}},Vr=Vs;Vs.default=Vs;var{isClean:$i,my:Li}=kt,Fi=Br,Ui=Vr,Mc=Hr,zi,On,Dn,Hi;function Bi(s){return s.map(e=>(e.nodes&&(e.nodes=Bi(e.nodes)),delete e.source,e))}function Wi(s){if(s[$i]=!1,s.proxyOf.nodes)for(let e of s.proxyOf.nodes)Wi(e)}var Ne=class Vi extends Mc{append(...e){for(let t of e){let r=this.normalize(t,this.last);for(let n of r)this.proxyOf.nodes.push(n)}return this.markDirty(),this}cleanRaws(e){if(super.cleanRaws(e),this.nodes)for(let t of this.nodes)t.cleanRaws(e)}each(e){if(!this.proxyOf.nodes)return;let t=this.getIterator(),r,n;for(;this.indexes[t]<this.proxyOf.nodes.length&&(r=this.indexes[t],n=e(this.proxyOf.nodes[r],r),n!==!1);)this.indexes[t]+=1;return delete this.indexes[t],n}every(e){return this.nodes.every(e)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let e=this.lastEach;return this.indexes[e]=0,e}getProxyProcessor(){return{get(e,t){return t==="proxyOf"?e:e[t]?t==="each"||typeof t=="string"&&t.startsWith("walk")?(...r)=>e[t](...r.map(n=>typeof n=="function"?(o,i)=>n(o.toProxy(),i):n)):t==="every"||t==="some"?r=>e[t]((n,...o)=>r(n.toProxy(),...o)):t==="root"?()=>e.root().toProxy():t==="nodes"?e.nodes.map(r=>r.toProxy()):t==="first"||t==="last"?e[t].toProxy():e[t]:e[t]},set(e,t,r){return e[t]===r||(e[t]=r,(t==="name"||t==="params"||t==="selector")&&e.markDirty()),!0}}}index(e){return typeof e=="number"?e:(e.proxyOf&&(e=e.proxyOf),this.proxyOf.nodes.indexOf(e))}insertAfter(e,t){let r=this.index(e),n=this.normalize(t,this.proxyOf.nodes[r]).reverse();r=this.index(e);for(let i of n)this.proxyOf.nodes.splice(r+1,0,i);let o;for(let i in this.indexes)o=this.indexes[i],r<o&&(this.indexes[i]=o+n.length);return this.markDirty(),this}insertBefore(e,t){let r=this.index(e),n=r===0?"prepend":!1,o=this.normalize(t,this.proxyOf.nodes[r],n).reverse();r=this.index(e);for(let l of o)this.proxyOf.nodes.splice(r,0,l);let i;for(let l in this.indexes)i=this.indexes[l],r<=i&&(this.indexes[l]=i+o.length);return this.markDirty(),this}normalize(e,t){if(typeof e=="string")e=Bi(zi(e).nodes);else if(typeof e>"u")e=[];else if(Array.isArray(e)){e=e.slice(0);for(let n of e)n.parent&&n.parent.removeChild(n,"ignore")}else if(e.type==="root"&&this.type!=="document"){e=e.nodes.slice(0);for(let n of e)n.parent&&n.parent.removeChild(n,"ignore")}else if(e.type)e=[e];else if(e.prop){if(typeof e.value>"u")throw new Error("Value field is missed in node creation");typeof e.value!="string"&&(e.value=String(e.value)),e=[new Fi(e)]}else if(e.selector)e=[new On(e)];else if(e.name)e=[new Dn(e)];else if(e.text)e=[new Ui(e)];else throw new Error("Unknown node type in node creation");return e.map(n=>(n[Li]||Vi.rebuild(n),n=n.proxyOf,n.parent&&n.parent.removeChild(n),n[$i]&&Wi(n),typeof n.raws.before>"u"&&t&&typeof t.raws.before<"u"&&(n.raws.before=t.raws.before.replace(/\S/g,"")),n.parent=this.proxyOf,n))}prepend(...e){e=e.reverse();for(let t of e){let r=this.normalize(t,this.first,"prepend").reverse();for(let n of r)this.proxyOf.nodes.unshift(n);for(let n in this.indexes)this.indexes[n]=this.indexes[n]+r.length}return this.markDirty(),this}push(e){return e.parent=this,this.proxyOf.nodes.push(e),this}removeAll(){for(let e of this.proxyOf.nodes)e.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(e){e=this.index(e),this.proxyOf.nodes[e].parent=void 0,this.proxyOf.nodes.splice(e,1);let t;for(let r in this.indexes)t=this.indexes[r],t>=e&&(this.indexes[r]=t-1);return this.markDirty(),this}replaceValues(e,t,r){return r||(r=t,t={}),this.walkDecls(n=>{t.props&&!t.props.includes(n.prop)||t.fast&&!n.value.includes(t.fast)||(n.value=n.value.replace(e,r))}),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each((t,r)=>{let n;try{n=e(t,r)}catch(o){throw t.addToError(o)}return n!==!1&&t.walk&&(n=t.walk(e)),n})}walkAtRules(e,t){return t?e instanceof RegExp?this.walk((r,n)=>{if(r.type==="atrule"&&e.test(r.name))return t(r,n)}):this.walk((r,n)=>{if(r.type==="atrule"&&r.name===e)return t(r,n)}):(t=e,this.walk((r,n)=>{if(r.type==="atrule")return t(r,n)}))}walkComments(e){return this.walk((t,r)=>{if(t.type==="comment")return e(t,r)})}walkDecls(e,t){return t?e instanceof RegExp?this.walk((r,n)=>{if(r.type==="decl"&&e.test(r.prop))return t(r,n)}):this.walk((r,n)=>{if(r.type==="decl"&&r.prop===e)return t(r,n)}):(t=e,this.walk((r,n)=>{if(r.type==="decl")return t(r,n)}))}walkRules(e,t){return t?e instanceof RegExp?this.walk((r,n)=>{if(r.type==="rule"&&e.test(r.selector))return t(r,n)}):this.walk((r,n)=>{if(r.type==="rule"&&r.selector===e)return t(r,n)}):(t=e,this.walk((r,n)=>{if(r.type==="rule")return t(r,n)}))}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]}};Ne.registerParse=s=>{zi=s};Ne.registerRule=s=>{On=s};Ne.registerAtRule=s=>{Dn=s};Ne.registerRoot=s=>{Hi=s};var We=Ne;Ne.default=Ne;Ne.rebuild=s=>{s.type==="atrule"?Object.setPrototypeOf(s,Dn.prototype):s.type==="rule"?Object.setPrototypeOf(s,On.prototype):s.type==="decl"?Object.setPrototypeOf(s,Fi.prototype):s.type==="comment"?Object.setPrototypeOf(s,Ui.prototype):s.type==="root"&&Object.setPrototypeOf(s,Hi.prototype),s[Li]=!0,s.nodes&&s.nodes.forEach(e=>{Ne.rebuild(e)})};var kc=We,Yi,Gi,It=class extends kc{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(e={}){return new Yi(new Gi,this,e).stringify()}};It.registerLazyResult=s=>{Yi=s};It.registerProcessor=s=>{Gi=s};var Tn=It;It.default=It;var Ys=class{constructor(e,t={}){if(this.type="warning",this.text=e,t.node&&t.node.source){let r=t.node.rangeBy(t);this.line=r.start.line,this.column=r.start.column,this.endLine=r.end.line,this.endColumn=r.end.column}for(let r in t)this[r]=t[r]}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}},ji=Ys;Ys.default=Ys;var Pc=ji,Gs=class{constructor(e,t,r){this.processor=e,this.messages=[],this.root=t,this.opts=r,this.css=void 0,this.map=void 0}toString(){return this.css}warn(e,t={}){t.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(t.plugin=this.lastPlugin.postcssPlugin);let r=new Pc(e,t);return this.messages.push(r),r}warnings(){return this.messages.filter(e=>e.type==="warning")}get content(){return this.css}},Nn=Gs;Gs.default=Gs;var Is=39,Lo=34,Qt=92,Fo=47,er=10,gt=32,tr=12,rr=9,sr=13,$c=91,Lc=93,Fc=40,Uc=41,zc=123,Hc=125,Bc=59,Wc=42,Vc=58,Yc=64,nr=/[\t\n\f\r "#'()/;[\\\]{}]/g,or=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,Gc=/.[\r\n"'(/\\]/,Uo=/[\da-f]/i,jc=function(e,t={}){let r=e.css.valueOf(),n=t.ignoreErrors,o,i,l,a,u,c,d,p,m,g,f=r.length,h=0,E=[],S=[];function w(){return h}function I(v){throw e.error("Unclosed "+v,h)}function _(){return S.length===0&&h>=f}function y(v){if(S.length)return S.pop();if(h>=f)return;let x=v?v.ignoreUnclosed:!1;switch(o=r.charCodeAt(h),o){case er:case gt:case rr:case sr:case tr:{i=h;do i+=1,o=r.charCodeAt(i);while(o===gt||o===er||o===rr||o===sr||o===tr);g=["space",r.slice(h,i)],h=i-1;break}case $c:case Lc:case zc:case Hc:case Vc:case Bc:case Uc:{let O=String.fromCharCode(o);g=[O,O,h];break}case Fc:{if(p=E.length?E.pop()[1]:"",m=r.charCodeAt(h+1),p==="url"&&m!==Is&&m!==Lo&&m!==gt&&m!==er&&m!==rr&&m!==tr&&m!==sr){i=h;do{if(c=!1,i=r.indexOf(")",i+1),i===-1)if(n||x){i=h;break}else I("bracket");for(d=i;r.charCodeAt(d-1)===Qt;)d-=1,c=!c}while(c);g=["brackets",r.slice(h,i+1),h,i],h=i}else i=r.indexOf(")",h+1),a=r.slice(h,i+1),i===-1||Gc.test(a)?g=["(","(",h]:(g=["brackets",a,h,i],h=i);break}case Is:case Lo:{l=o===Is?"'":'"',i=h;do{if(c=!1,i=r.indexOf(l,i+1),i===-1)if(n||x){i=h+1;break}else I("string");for(d=i;r.charCodeAt(d-1)===Qt;)d-=1,c=!c}while(c);g=["string",r.slice(h,i+1),h,i],h=i;break}case Yc:{nr.lastIndex=h+1,nr.test(r),nr.lastIndex===0?i=r.length-1:i=nr.lastIndex-2,g=["at-word",r.slice(h,i+1),h,i],h=i;break}case Qt:{for(i=h,u=!0;r.charCodeAt(i+1)===Qt;)i+=1,u=!u;if(o=r.charCodeAt(i+1),u&&o!==Fo&&o!==gt&&o!==er&&o!==rr&&o!==sr&&o!==tr&&(i+=1,Uo.test(r.charAt(i)))){for(;Uo.test(r.charAt(i+1));)i+=1;r.charCodeAt(i+1)===gt&&(i+=1)}g=["word",r.slice(h,i+1),h,i],h=i;break}default:{o===Fo&&r.charCodeAt(h+1)===Wc?(i=r.indexOf("*/",h+2)+1,i===0&&(n||x?i=r.length:I("comment")),g=["comment",r.slice(h,i+1),h,i],h=i):(or.lastIndex=h+1,or.test(r),or.lastIndex===0?i=r.length-1:i=or.lastIndex-2,g=["word",r.slice(h,i+1),h,i],E.push(g),h=i);break}}return h++,g}function R(v){S.push(v)}return{back:R,endOfFile:_,nextToken:y,position:w}},Ki=We,Or=class extends Ki{constructor(e){super(e),this.type="atrule"}append(...e){return this.proxyOf.nodes||(this.nodes=[]),super.append(...e)}prepend(...e){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...e)}},Mn=Or;Or.default=Or;Ki.registerAtRule(Or);var Ji=We,Zi,Xi,rt=class extends Ji{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}normalize(e,t,r){let n=super.normalize(e);if(t){if(r==="prepend")this.nodes.length>1?t.raws.before=this.nodes[1].raws.before:delete t.raws.before;else if(this.first!==t)for(let o of n)o.raws.before=t.raws.before}return n}removeChild(e,t){let r=this.index(e);return!t&&r===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[r].raws.before),super.removeChild(e)}toResult(e={}){return new Zi(new Xi,this,e).stringify()}};rt.registerLazyResult=s=>{Zi=s};rt.registerProcessor=s=>{Xi=s};var Pt=rt;rt.default=rt;Ji.registerRoot(rt);var xt={comma(s){return xt.split(s,[","],!0)},space(s){let e=[" ",`
24
- `," "];return xt.split(s,e)},split(s,e,t){let r=[],n="",o=!1,i=0,l=!1,a="",u=!1;for(let c of s)u?u=!1:c==="\\"?u=!0:l?c===a&&(l=!1):c==='"'||c==="'"?(l=!0,a=c):c==="("?i+=1:c===")"?i>0&&(i-=1):i===0&&e.includes(c)&&(o=!0),o?(n!==""&&r.push(n.trim()),n="",o=!1):n+=c;return(t||n!=="")&&r.push(n.trim()),r}},qi=xt;xt.default=xt;var Qi=We,Kc=qi,Dr=class extends Qi{constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return Kc.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\s*/):null,r=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(r)}},kn=Dr;Dr.default=Dr;Qi.registerRule(Dr);var Jc=Br,Zc=jc,Xc=Vr,qc=Mn,Qc=Pt,zo=kn,Ho={empty:!0,space:!0};function ed(s){for(let e=s.length-1;e>=0;e--){let t=s[e],r=t[3]||t[2];if(r)return r}}var td=class{constructor(e){this.input=e,this.root=new Qc,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}atrule(e){let t=new qc;t.name=e[1].slice(1),t.name===""&&this.unnamedAtrule(t,e),this.init(t,e[2]);let r,n,o,i=!1,l=!1,a=[],u=[];for(;!this.tokenizer.endOfFile();){if(e=this.tokenizer.nextToken(),r=e[0],r==="("||r==="["?u.push(r==="("?")":"]"):r==="{"&&u.length>0?u.push("}"):r===u[u.length-1]&&u.pop(),u.length===0)if(r===";"){t.source.end=this.getPosition(e[2]),t.source.end.offset++,this.semicolon=!0;break}else if(r==="{"){l=!0;break}else if(r==="}"){if(a.length>0){for(o=a.length-1,n=a[o];n&&n[0]==="space";)n=a[--o];n&&(t.source.end=this.getPosition(n[3]||n[2]),t.source.end.offset++)}this.end(e);break}else a.push(e);else a.push(e);if(this.tokenizer.endOfFile()){i=!0;break}}t.raws.between=this.spacesAndCommentsFromEnd(a),a.length?(t.raws.afterName=this.spacesAndCommentsFromStart(a),this.raw(t,"params",a),i&&(e=a[a.length-1],t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++,this.spaces=t.raws.between,t.raws.between="")):(t.raws.afterName="",t.params=""),l&&(t.nodes=[],this.current=t)}checkMissedSemicolon(e){let t=this.colon(e);if(t===!1)return;let r=0,n;for(let o=t-1;o>=0&&(n=e[o],!(n[0]!=="space"&&(r+=1,r===2)));o--);throw this.input.error("Missed semicolon",n[0]==="word"?n[3]+1:n[2])}colon(e){let t=0,r,n,o;for(let[i,l]of e.entries()){if(r=l,n=r[0],n==="("&&(t+=1),n===")"&&(t-=1),t===0&&n===":")if(!o)this.doubleColon(r);else{if(o[0]==="word"&&o[1]==="progid")continue;return i}o=r}return!1}comment(e){let t=new Xc;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;let r=e[1].slice(2,-2);if(/^\s*$/.test(r))t.text="",t.raws.left=r,t.raws.right="";else{let n=r.match(/^(\s*)([^]*\S)(\s*)$/);t.text=n[2],t.raws.left=n[1],t.raws.right=n[3]}}createTokenizer(){this.tokenizer=Zc(this.input)}decl(e,t){let r=new Jc;this.init(r,e[0][2]);let n=e[e.length-1];for(n[0]===";"&&(this.semicolon=!0,e.pop()),r.source.end=this.getPosition(n[3]||n[2]||ed(e)),r.source.end.offset++;e[0][0]!=="word";)e.length===1&&this.unknownWord(e),r.raws.before+=e.shift()[1];for(r.source.start=this.getPosition(e[0][2]),r.prop="";e.length;){let u=e[0][0];if(u===":"||u==="space"||u==="comment")break;r.prop+=e.shift()[1]}r.raws.between="";let o;for(;e.length;)if(o=e.shift(),o[0]===":"){r.raws.between+=o[1];break}else o[0]==="word"&&/\w/.test(o[1])&&this.unknownWord([o]),r.raws.between+=o[1];(r.prop[0]==="_"||r.prop[0]==="*")&&(r.raws.before+=r.prop[0],r.prop=r.prop.slice(1));let i=[],l;for(;e.length&&(l=e[0][0],!(l!=="space"&&l!=="comment"));)i.push(e.shift());this.precheckMissedSemicolon(e);for(let u=e.length-1;u>=0;u--){if(o=e[u],o[1].toLowerCase()==="!important"){r.important=!0;let c=this.stringFrom(e,u);c=this.spacesFromEnd(e)+c,c!==" !important"&&(r.raws.important=c);break}else if(o[1].toLowerCase()==="important"){let c=e.slice(0),d="";for(let p=u;p>0;p--){let m=c[p][0];if(d.trim().indexOf("!")===0&&m!=="space")break;d=c.pop()[1]+d}d.trim().indexOf("!")===0&&(r.important=!0,r.raws.important=d,e=c)}if(o[0]!=="space"&&o[0]!=="comment")break}e.some(u=>u[0]!=="space"&&u[0]!=="comment")&&(r.raws.between+=i.map(u=>u[1]).join(""),i=[]),this.raw(r,"value",i.concat(e),t),r.value.includes(":")&&!t&&this.checkMissedSemicolon(e)}doubleColon(e){throw this.input.error("Double colon",{offset:e[2]},{offset:e[2]+e[1].length})}emptyRule(e){let t=new zo;this.init(t,e[2]),t.selector="",t.raws.between="",this.current=t}end(e){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(e[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(e)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(e){if(this.spaces+=e[1],this.current.nodes){let t=this.current.nodes[this.current.nodes.length-1];t&&t.type==="rule"&&!t.raws.ownSemicolon&&(t.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(e){let t=this.input.fromOffset(e);return{column:t.col,line:t.line,offset:e}}init(e,t){this.current.push(e),e.source={input:this.input,start:this.getPosition(t)},e.raws.before=this.spaces,this.spaces="",e.type!=="comment"&&(this.semicolon=!1)}other(e){let t=!1,r=null,n=!1,o=null,i=[],l=e[1].startsWith("--"),a=[],u=e;for(;u;){if(r=u[0],a.push(u),r==="("||r==="[")o||(o=u),i.push(r==="("?")":"]");else if(l&&n&&r==="{")o||(o=u),i.push("}");else if(i.length===0)if(r===";")if(n){this.decl(a,l);return}else break;else if(r==="{"){this.rule(a);return}else if(r==="}"){this.tokenizer.back(a.pop()),t=!0;break}else r===":"&&(n=!0);else r===i[i.length-1]&&(i.pop(),i.length===0&&(o=null));u=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),i.length>0&&this.unclosedBracket(o),t&&n){if(!l)for(;a.length&&(u=a[a.length-1][0],!(u!=="space"&&u!=="comment"));)this.tokenizer.back(a.pop());this.decl(a,l)}else this.unknownWord(a)}parse(){let e;for(;!this.tokenizer.endOfFile();)switch(e=this.tokenizer.nextToken(),e[0]){case"space":this.spaces+=e[1];break;case";":this.freeSemicolon(e);break;case"}":this.end(e);break;case"comment":this.comment(e);break;case"at-word":this.atrule(e);break;case"{":this.emptyRule(e);break;default:this.other(e);break}this.endFile()}precheckMissedSemicolon(){}raw(e,t,r,n){let o,i,l=r.length,a="",u=!0,c,d;for(let p=0;p<l;p+=1)o=r[p],i=o[0],i==="space"&&p===l-1&&!n?u=!1:i==="comment"?(d=r[p-1]?r[p-1][0]:"empty",c=r[p+1]?r[p+1][0]:"empty",!Ho[d]&&!Ho[c]?a.slice(-1)===","?u=!1:a+=o[1]:u=!1):a+=o[1];if(!u){let p=r.reduce((m,g)=>m+g[1],"");e.raws[t]={raw:p,value:a}}e[t]=a}rule(e){e.pop();let t=new zo;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t}spacesAndCommentsFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],!(t!=="space"&&t!=="comment"));)r=e.pop()[1]+r;return r}spacesAndCommentsFromStart(e){let t,r="";for(;e.length&&(t=e[0][0],!(t!=="space"&&t!=="comment"));)r+=e.shift()[1];return r}spacesFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],t==="space");)r=e.pop()[1]+r;return r}stringFrom(e,t){let r="";for(let n=t;n<e.length;n++)r+=e[n][1];return e.splice(t,e.length-t),r}unclosedBlock(){let e=this.current.source.start;throw this.input.error("Unclosed block",e.line,e.column)}unclosedBracket(e){throw this.input.error("Unclosed bracket",{offset:e[2]},{offset:e[2]+1})}unexpectedClose(e){throw this.input.error("Unexpected }",{offset:e[2]},{offset:e[2]+1})}unknownWord(e){throw this.input.error("Unknown word",{offset:e[0][2]},{offset:e[0][2]+e[0][1].length})}unnamedAtrule(e,t){throw this.input.error("At-rule without name",{offset:t[2]},{offset:t[2]+t[1].length})}},rd=td,sd=We,nd=rd,od=Wr;function Tr(s,e){let t=new od(s,e),r=new nd(t);try{r.parse()}catch(n){throw n}return r.root}var Pn=Tr;Tr.default=Tr;sd.registerParse(Tr);var{isClean:Ie,my:id}=kt,ad=Pi,ld=zr,ud=We,cd=Tn;var Bo=Nn,dd=Pn,hd=Pt,fd={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},pd={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},md={Once:!0,postcssPlugin:!0,prepare:!0},st=0;function yt(s){return typeof s=="object"&&typeof s.then=="function"}function ea(s){let e=!1,t=fd[s.type];return s.type==="decl"?e=s.prop.toLowerCase():s.type==="atrule"&&(e=s.name.toLowerCase()),e&&s.append?[t,t+"-"+e,st,t+"Exit",t+"Exit-"+e]:e?[t,t+"-"+e,t+"Exit",t+"Exit-"+e]:s.append?[t,st,t+"Exit"]:[t,t+"Exit"]}function Wo(s){let e;return s.type==="document"?e=["Document",st,"DocumentExit"]:s.type==="root"?e=["Root",st,"RootExit"]:e=ea(s),{eventIndex:0,events:e,iterator:0,node:s,visitorIndex:0,visitors:[]}}function js(s){return s[Ie]=!1,s.nodes&&s.nodes.forEach(e=>js(e)),s}var Ks={},nt=class ta{constructor(e,t,r){this.stringified=!1,this.processed=!1;let n;if(typeof t=="object"&&t!==null&&(t.type==="root"||t.type==="document"))n=js(t);else if(t instanceof ta||t instanceof Bo)n=js(t.root),t.map&&(typeof r.map>"u"&&(r.map={}),r.map.inline||(r.map.inline=!1),r.map.prev=t.map);else{let o=dd;r.syntax&&(o=r.syntax.parse),r.parser&&(o=r.parser),o.parse&&(o=o.parse);try{n=o(t,r)}catch(i){this.processed=!0,this.error=i}n&&!n[id]&&ud.rebuild(n)}this.result=new Bo(e,n,r),this.helpers={...Ks,postcss:Ks,result:this.result},this.plugins=this.processor.plugins.map(o=>typeof o=="object"&&o.prepare?{...o,...o.prepare(this.result)}:o)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(e,t){let r=this.result.lastPlugin;try{t&&t.addToError(e),this.error=e,e.name==="CssSyntaxError"&&!e.plugin?(e.plugin=r.postcssPlugin,e.setMessage()):r.postcssVersion}catch(n){console&&console.error&&console.error(n)}return e}prepareVisitors(){this.listeners={};let e=(t,r,n)=>{this.listeners[r]||(this.listeners[r]=[]),this.listeners[r].push([t,n])};for(let t of this.plugins)if(typeof t=="object")for(let r in t){if(!pd[r]&&/^[A-Z]/.test(r))throw new Error(`Unknown event ${r} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!md[r])if(typeof t[r]=="object")for(let n in t[r])n==="*"?e(t,r,t[r][n]):e(t,r+"-"+n.toLowerCase(),t[r][n]);else typeof t[r]=="function"&&e(t,r,t[r])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let e=0;e<this.plugins.length;e++){let t=this.plugins[e],r=this.runOnRoot(t);if(yt(r))try{await r}catch(n){throw this.handleError(n)}}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[Ie];){e[Ie]=!0;let t=[Wo(e)];for(;t.length>0;){let r=this.visitTick(t);if(yt(r))try{await r}catch(n){let o=t[t.length-1].node;throw this.handleError(n,o)}}}if(this.listeners.OnceExit)for(let[t,r]of this.listeners.OnceExit){this.result.lastPlugin=t;try{if(e.type==="document"){let n=e.nodes.map(o=>r(o,this.helpers));await Promise.all(n)}else await r(e,this.helpers)}catch(n){throw this.handleError(n)}}}return this.processed=!0,this.stringify()}runOnRoot(e){this.result.lastPlugin=e;try{if(typeof e=="object"&&e.Once){if(this.result.root.type==="document"){let t=this.result.root.nodes.map(r=>e.Once(r,this.helpers));return yt(t[0])?Promise.all(t):t}return e.Once(this.result.root,this.helpers)}else if(typeof e=="function")return e(this.result.root,this.result)}catch(t){throw this.handleError(t)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let e=this.result.opts,t=ld;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let n=new ad(t,this.result.root,this.result.opts).generate();return this.result.css=n[0],this.result.map=n[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let e of this.plugins){let t=this.runOnRoot(e);if(yt(t))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[Ie];)e[Ie]=!0,this.walkSync(e);if(this.listeners.OnceExit)if(e.type==="document")for(let t of e.nodes)this.visitSync(this.listeners.OnceExit,t);else this.visitSync(this.listeners.OnceExit,e)}return this.result}then(e,t){return this.async().then(e,t)}toString(){return this.css}visitSync(e,t){for(let[r,n]of e){this.result.lastPlugin=r;let o;try{o=n(t,this.helpers)}catch(i){throw this.handleError(i,t.proxyOf)}if(t.type!=="root"&&t.type!=="document"&&!t.parent)return!0;if(yt(o))throw this.getAsyncError()}}visitTick(e){let t=e[e.length-1],{node:r,visitors:n}=t;if(r.type!=="root"&&r.type!=="document"&&!r.parent){e.pop();return}if(n.length>0&&t.visitorIndex<n.length){let[i,l]=n[t.visitorIndex];t.visitorIndex+=1,t.visitorIndex===n.length&&(t.visitors=[],t.visitorIndex=0),this.result.lastPlugin=i;try{return l(r.toProxy(),this.helpers)}catch(a){throw this.handleError(a,r)}}if(t.iterator!==0){let i=t.iterator,l;for(;l=r.nodes[r.indexes[i]];)if(r.indexes[i]+=1,!l[Ie]){l[Ie]=!0,e.push(Wo(l));return}t.iterator=0,delete r.indexes[i]}let o=t.events;for(;t.eventIndex<o.length;){let i=o[t.eventIndex];if(t.eventIndex+=1,i===st){r.nodes&&r.nodes.length&&(r[Ie]=!0,t.iterator=r.getIterator());return}else if(this.listeners[i]){t.visitors=this.listeners[i];return}}e.pop()}walkSync(e){e[Ie]=!0;let t=ea(e);for(let r of t)if(r===st)e.nodes&&e.each(n=>{n[Ie]||this.walkSync(n)});else{let n=this.listeners[r];if(n&&this.visitSync(n,e.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}};nt.registerPostcss=s=>{Ks=s};var ra=nt;nt.default=nt;hd.registerLazyResult(nt);cd.registerLazyResult(nt);var gd=Pi,yd=zr;var wd=Pn,Sd=Nn,Js=class{constructor(e,t,r){t=t.toString(),this.stringified=!1,this._processor=e,this._css=t,this._opts=r,this._map=void 0;let n,o=yd;this.result=new Sd(this._processor,n,this._opts),this.result.css=t;let i=this;Object.defineProperty(this.result,"root",{get(){return i.root}});let l=new gd(o,n,this._opts,t);if(l.isMap()){let[a,u]=l.generate();a&&(this.result.css=a),u&&(this.result.map=u)}else l.clearAnnotation(),this.result.css=l.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}sync(){if(this.error)throw this.error;return this.result}then(e,t){return this.async().then(e,t)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let e,t=wd;try{e=t(this._css,this._opts)}catch(r){this.error=r}if(this.error)throw this.error;return this._root=e,e}get[Symbol.toStringTag](){return"NoWorkResult"}},vd=Js;Js.default=Js;var Cd=vd,bd=ra,Ed=Tn,Rd=Pt,At=class{constructor(e=[]){this.version="8.4.38",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let r of e)if(r.postcss===!0?r=r():r.postcss&&(r=r.postcss),typeof r=="object"&&Array.isArray(r.plugins))t=t.concat(r.plugins);else if(typeof r=="object"&&r.postcssPlugin)t.push(r);else if(typeof r=="function")t.push(r);else if(!(typeof r=="object"&&(r.parse||r.stringify)))throw new Error(r+" is not a PostCSS plugin");return t}process(e,t={}){return!this.plugins.length&&!t.parser&&!t.stringifier&&!t.syntax?new Cd(this,e,t):new bd(this,e,t)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}},Id=At;At.default=At;Rd.registerProcessor(At);Ed.registerProcessor(At);var xd=Br,Ad=Di,_d=Vr,Od=Mn,Dd=Wr,Td=Pt,Nd=kn;function _t(s,e){if(Array.isArray(s))return s.map(n=>_t(n));let{inputs:t,...r}=s;if(t){e=[];for(let n of t){let o={...n,__proto__:Dd.prototype};o.map&&(o.map={...o.map,__proto__:Ad.prototype}),e.push(o)}}if(r.nodes&&(r.nodes=s.nodes.map(n=>_t(n,e))),r.source){let{inputId:n,...o}=r.source;r.source=o,n!=null&&(r.source.input=e[n])}if(r.type==="root")return new Td(r);if(r.type==="decl")return new xd(r);if(r.type==="rule")return new Nd(r);if(r.type==="comment")return new _d(r);if(r.type==="atrule")return new Od(r);throw new Error("Unknown node type: "+s.type)}var Md=_t;_t.default=_t;var kd=_n,sa=Br,Pd=ra,$d=We,$n=Id,Ld=zr,Fd=Md,na=Tn,Ud=ji,oa=Vr,ia=Mn,zd=Nn,Hd=Wr,Bd=Pn,Wd=qi,aa=kn,la=Pt,Vd=Hr;function $(...s){return s.length===1&&Array.isArray(s[0])&&(s=s[0]),new $n(s)}$.plugin=function(e,t){let r=!1;function n(...i){console&&console.warn&&!r&&(r=!0,console.warn(e+`: postcss.plugin was deprecated. Migration guide:
25
- https://evilmartians.com/chronicles/postcss-8-plugin-migration`),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(e+`: \u91CC\u9762 postcss.plugin \u88AB\u5F03\u7528. \u8FC1\u79FB\u6307\u5357:
26
- https://www.w3ctech.com/topic/2226`));let l=t(...i);return l.postcssPlugin=e,l.postcssVersion=new $n().version,l}let o;return Object.defineProperty(n,"postcss",{get(){return o||(o=n()),o}}),n.process=function(i,l,a){return $([n(a)]).process(i,l)},n};$.stringify=Ld;$.parse=Bd;$.fromJSON=Fd;$.list=Wd;$.comment=s=>new oa(s);$.atRule=s=>new ia(s);$.decl=s=>new sa(s);$.rule=s=>new aa(s);$.root=s=>new la(s);$.document=s=>new na(s);$.CssSyntaxError=kd;$.Declaration=sa;$.Container=$d;$.Processor=$n;$.Document=na;$.Comment=oa;$.Warning=Ud;$.AtRule=ia;$.Result=zd;$.Input=Hd;$.Rule=aa;$.Root=la;$.Node=Vd;Pd.registerPostcss($);var Yd=$;$.default=$;var W=sc(Yd);W.stringify;W.fromJSON;W.plugin;W.parse;W.list;W.document;W.comment;W.atRule;W.rule;W.decl;W.root;W.CssSyntaxError;W.Declaration;W.Container;W.Processor;W.Document;W.Comment;W.Warning;W.AtRule;W.Result;W.Input;W.Rule;W.Root;W.Node;var Gd=Object.defineProperty,jd=(s,e,t)=>e in s?Gd(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,pe=(s,e,t)=>jd(s,typeof e!="symbol"?e+"":e,t);function Kd(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function Jd(s){if(s.__esModule)return s;var e=s.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(s).forEach(function(r){var n=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return s[r]}})}),t}var Ln={exports:{}},B=String,ua=function(){return{isColorSupported:!1,reset:B,bold:B,dim:B,italic:B,underline:B,inverse:B,hidden:B,strikethrough:B,black:B,red:B,green:B,yellow:B,blue:B,magenta:B,cyan:B,white:B,gray:B,bgBlack:B,bgRed:B,bgGreen:B,bgYellow:B,bgBlue:B,bgMagenta:B,bgCyan:B,bgWhite:B}};Ln.exports=ua();Ln.exports.createColors=ua;var Zd=Ln.exports,Xd={},qd=Object.freeze(Object.defineProperty({__proto__:null,default:Xd},Symbol.toStringTag,{value:"Module"})),Ce=Jd(qd),Vo=Zd,Yo=Ce,Zs=class ca extends Error{constructor(e,t,r,n,o,i){super(e),this.name="CssSyntaxError",this.reason=e,o&&(this.file=o),n&&(this.source=n),i&&(this.plugin=i),typeof t<"u"&&typeof r<"u"&&(typeof t=="number"?(this.line=t,this.column=r):(this.line=t.line,this.column=t.column,this.endLine=r.line,this.endColumn=r.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,ca)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(e){if(!this.source)return"";let t=this.source;e==null&&(e=Vo.isColorSupported),Yo&&e&&(t=Yo(t));let r=t.split(/\r?\n/),n=Math.max(this.line-3,0),o=Math.min(this.line+2,r.length),i=String(o).length,l,a;if(e){let{bold:u,gray:c,red:d}=Vo.createColors(!0);l=p=>u(d(p)),a=p=>c(p)}else l=a=u=>u;return r.slice(n,o).map((u,c)=>{let d=n+1+c,p=" "+(" "+d).slice(-i)+" | ";if(d===this.line){let m=a(p.replace(/\d/g," "))+u.slice(0,this.column-1).replace(/[^\t]/g," ");return l(">")+a(p)+u+`
27
- `+m+l("^")}return" "+a(p)+u}).join(`
28
- `)}toString(){let e=this.showSourceCode();return e&&(e=`
29
-
30
- `+e+`
31
- `),this.name+": "+this.message+e}},Fn=Zs;Zs.default=Zs;var $t={};$t.isClean=Symbol("isClean");$t.my=Symbol("my");var Go={after:`
32
- `,beforeClose:`
33
- `,beforeComment:`
34
- `,beforeDecl:`
35
- `,beforeOpen:" ",beforeRule:`
36
- `,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function Qd(s){return s[0].toUpperCase()+s.slice(1)}var Xs=class{constructor(e){this.builder=e}atrule(e,t){let r="@"+e.name,n=e.params?this.rawValue(e,"params"):"";if(typeof e.raws.afterName<"u"?r+=e.raws.afterName:n&&(r+=" "),e.nodes)this.block(e,r+n);else{let o=(e.raws.between||"")+(t?";":"");this.builder(r+n+o,e)}}beforeAfter(e,t){let r;e.type==="decl"?r=this.raw(e,null,"beforeDecl"):e.type==="comment"?r=this.raw(e,null,"beforeComment"):t==="before"?r=this.raw(e,null,"beforeRule"):r=this.raw(e,null,"beforeClose");let n=e.parent,o=0;for(;n&&n.type!=="root";)o+=1,n=n.parent;if(r.includes(`
37
- `)){let i=this.raw(e,null,"indent");if(i.length)for(let l=0;l<o;l++)r+=i}return r}block(e,t){let r=this.raw(e,"between","beforeOpen");this.builder(t+r+"{",e,"start");let n;e.nodes&&e.nodes.length?(this.body(e),n=this.raw(e,"after")):n=this.raw(e,"after","emptyBody"),n&&this.builder(n),this.builder("}",e,"end")}body(e){let t=e.nodes.length-1;for(;t>0&&e.nodes[t].type==="comment";)t-=1;let r=this.raw(e,"semicolon");for(let n=0;n<e.nodes.length;n++){let o=e.nodes[n],i=this.raw(o,"before");i&&this.builder(i),this.stringify(o,t!==n||r)}}comment(e){let t=this.raw(e,"left","commentLeft"),r=this.raw(e,"right","commentRight");this.builder("/*"+t+e.text+r+"*/",e)}decl(e,t){let r=this.raw(e,"between","colon"),n=e.prop+r+this.rawValue(e,"value");e.important&&(n+=e.raws.important||" !important"),t&&(n+=";"),this.builder(n,e)}document(e){this.body(e)}raw(e,t,r){let n;if(r||(r=t),t&&(n=e.raws[t],typeof n<"u"))return n;let o=e.parent;if(r==="before"&&(!o||o.type==="root"&&o.first===e||o&&o.type==="document"))return"";if(!o)return Go[r];let i=e.root();if(i.rawCache||(i.rawCache={}),typeof i.rawCache[r]<"u")return i.rawCache[r];if(r==="before"||r==="after")return this.beforeAfter(e,r);{let l="raw"+Qd(r);this[l]?n=this[l](i,e):i.walk(a=>{if(n=a.raws[t],typeof n<"u")return!1})}return typeof n>"u"&&(n=Go[r]),i.rawCache[r]=n,n}rawBeforeClose(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length>0&&typeof r.raws.after<"u")return t=r.raws.after,t.includes(`
38
- `)&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawBeforeComment(e,t){let r;return e.walkComments(n=>{if(typeof n.raws.before<"u")return r=n.raws.before,r.includes(`
39
- `)&&(r=r.replace(/[^\n]+$/,"")),!1}),typeof r>"u"?r=this.raw(t,null,"beforeDecl"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeDecl(e,t){let r;return e.walkDecls(n=>{if(typeof n.raws.before<"u")return r=n.raws.before,r.includes(`
40
- `)&&(r=r.replace(/[^\n]+$/,"")),!1}),typeof r>"u"?r=this.raw(t,null,"beforeRule"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeOpen(e){let t;return e.walk(r=>{if(r.type!=="decl"&&(t=r.raws.between,typeof t<"u"))return!1}),t}rawBeforeRule(e){let t;return e.walk(r=>{if(r.nodes&&(r.parent!==e||e.first!==r)&&typeof r.raws.before<"u")return t=r.raws.before,t.includes(`
41
- `)&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawColon(e){let t;return e.walkDecls(r=>{if(typeof r.raws.between<"u")return t=r.raws.between.replace(/[^\s:]/g,""),!1}),t}rawEmptyBody(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length===0&&(t=r.raws.after,typeof t<"u"))return!1}),t}rawIndent(e){if(e.raws.indent)return e.raws.indent;let t;return e.walk(r=>{let n=r.parent;if(n&&n!==e&&n.parent&&n.parent===e&&typeof r.raws.before<"u"){let o=r.raws.before.split(`
42
- `);return t=o[o.length-1],t=t.replace(/\S/g,""),!1}}),t}rawSemicolon(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length&&r.last.type==="decl"&&(t=r.raws.semicolon,typeof t<"u"))return!1}),t}rawValue(e,t){let r=e[t],n=e.raws[t];return n&&n.value===r?n.raw:r}root(e){this.body(e),e.raws.after&&this.builder(e.raws.after)}rule(e){this.block(e,this.rawValue(e,"selector")),e.raws.ownSemicolon&&this.builder(e.raws.ownSemicolon,e,"end")}stringify(e,t){if(!this[e.type])throw new Error("Unknown AST node type "+e.type+". Maybe you need to change PostCSS stringifier.");this[e.type](e,t)}},da=Xs;Xs.default=Xs;var eh=da;function qs(s,e){new eh(e).stringify(s)}var Yr=qs;qs.default=qs;var{isClean:ir,my:th}=$t,rh=Fn,sh=da,nh=Yr;function Qs(s,e){let t=new s.constructor;for(let r in s){if(!Object.prototype.hasOwnProperty.call(s,r)||r==="proxyCache")continue;let n=s[r],o=typeof n;r==="parent"&&o==="object"?e&&(t[r]=e):r==="source"?t[r]=n:Array.isArray(n)?t[r]=n.map(i=>Qs(i,t)):(o==="object"&&n!==null&&(n=Qs(n)),t[r]=n)}return t}var en=class{constructor(e={}){this.raws={},this[ir]=!1,this[th]=!0;for(let t in e)if(t==="nodes"){this.nodes=[];for(let r of e[t])typeof r.clone=="function"?this.append(r.clone()):this.append(r)}else this[t]=e[t]}addToError(e){if(e.postcssNode=this,e.stack&&this.source&&/\n\s{4}at /.test(e.stack)){let t=this.source;e.stack=e.stack.replace(/\n\s{4}at /,`$&${t.input.from}:${t.start.line}:${t.start.column}$&`)}return e}after(e){return this.parent.insertAfter(this,e),this}assign(e={}){for(let t in e)this[t]=e[t];return this}before(e){return this.parent.insertBefore(this,e),this}cleanRaws(e){delete this.raws.before,delete this.raws.after,e||delete this.raws.between}clone(e={}){let t=Qs(this);for(let r in e)t[r]=e[r];return t}cloneAfter(e={}){let t=this.clone(e);return this.parent.insertAfter(this,t),t}cloneBefore(e={}){let t=this.clone(e);return this.parent.insertBefore(this,t),t}error(e,t={}){if(this.source){let{end:r,start:n}=this.rangeBy(t);return this.source.input.error(e,{column:n.column,line:n.line},{column:r.column,line:r.line},t)}return new rh(e)}getProxyProcessor(){return{get(e,t){return t==="proxyOf"?e:t==="root"?()=>e.root().toProxy():e[t]},set(e,t,r){return e[t]===r||(e[t]=r,(t==="prop"||t==="value"||t==="name"||t==="params"||t==="important"||t==="text")&&e.markDirty()),!0}}}markDirty(){if(this[ir]){this[ir]=!1;let e=this;for(;e=e.parent;)e[ir]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e,t){let r=this.source.start;if(e.index)r=this.positionInside(e.index,t);else if(e.word){t=this.toString();let n=t.indexOf(e.word);n!==-1&&(r=this.positionInside(n,t))}return r}positionInside(e,t){let r=t||this.toString(),n=this.source.start.column,o=this.source.start.line;for(let i=0;i<e;i++)r[i]===`
43
- `?(n=1,o+=1):n+=1;return{column:n,line:o}}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}rangeBy(e){let t={column:this.source.start.column,line:this.source.start.line},r=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:t.column+1,line:t.line};if(e.word){let n=this.toString(),o=n.indexOf(e.word);o!==-1&&(t=this.positionInside(o,n),r=this.positionInside(o+e.word.length,n))}else e.start?t={column:e.start.column,line:e.start.line}:e.index&&(t=this.positionInside(e.index)),e.end?r={column:e.end.column,line:e.end.line}:typeof e.endIndex=="number"?r=this.positionInside(e.endIndex):e.index&&(r=this.positionInside(e.index+1));return(r.line<t.line||r.line===t.line&&r.column<=t.column)&&(r={column:t.column+1,line:t.line}),{end:r,start:t}}raw(e,t){return new sh().raw(this,e,t)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...e){if(this.parent){let t=this,r=!1;for(let n of e)n===this?r=!0:r?(this.parent.insertAfter(t,n),t=n):this.parent.insertBefore(t,n);r||this.remove()}return this}root(){let e=this;for(;e.parent&&e.parent.type!=="document";)e=e.parent;return e}toJSON(e,t){let r={},n=t==null;t=t||new Map;let o=0;for(let i in this){if(!Object.prototype.hasOwnProperty.call(this,i)||i==="parent"||i==="proxyCache")continue;let l=this[i];if(Array.isArray(l))r[i]=l.map(a=>typeof a=="object"&&a.toJSON?a.toJSON(null,t):a);else if(typeof l=="object"&&l.toJSON)r[i]=l.toJSON(null,t);else if(i==="source"){let a=t.get(l.input);a==null&&(a=o,t.set(l.input,o),o++),r[i]={end:l.end,inputId:a,start:l.start}}else r[i]=l}return n&&(r.inputs=[...t.keys()].map(i=>i.toJSON())),r}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(e=nh){e.stringify&&(e=e.stringify);let t="";return e(this,r=>{t+=r}),t}warn(e,t,r){let n={node:this};for(let o in r)n[o]=r[o];return e.warn(t,n)}get proxyOf(){return this}},Gr=en;en.default=en;var oh=Gr,tn=class extends oh{constructor(e){e&&typeof e.value<"u"&&typeof e.value!="string"&&(e={...e,value:String(e.value)}),super(e),this.type="decl"}get variable(){return this.prop.startsWith("--")||this.prop[0]==="$"}},jr=tn;tn.default=tn;var ih="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",ah=(s,e=21)=>(t=e)=>{let r="",n=t;for(;n--;)r+=s[Math.random()*s.length|0];return r},lh=(s=21)=>{let e="",t=s;for(;t--;)e+=ih[Math.random()*64|0];return e},uh={nanoid:lh,customAlphabet:ah},{SourceMapConsumer:jo,SourceMapGenerator:Ko}=Ce,{existsSync:ch,readFileSync:dh}=Ce,{dirname:xs,join:hh}=Ce;function fh(s){return Buffer?Buffer.from(s,"base64").toString():window.atob(s)}var rn=class{constructor(e,t){if(t.map===!1)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");let r=t.map?t.map.prev:void 0,n=this.loadMap(t.from,r);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=xs(this.mapFile)),n&&(this.text=n)}consumer(){return this.consumerCache||(this.consumerCache=new jo(this.text)),this.consumerCache}decodeInline(e){let t=/^data:application\/json;charset=utf-?8;base64,/,r=/^data:application\/json;base64,/,n=/^data:application\/json;charset=utf-?8,/,o=/^data:application\/json,/;if(n.test(e)||o.test(e))return decodeURIComponent(e.substr(RegExp.lastMatch.length));if(t.test(e)||r.test(e))return fh(e.substr(RegExp.lastMatch.length));let i=e.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+i)}getAnnotationURL(e){return e.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(e){return typeof e!="object"?!1:typeof e.mappings=="string"||typeof e._mappings=="string"||Array.isArray(e.sections)}loadAnnotation(e){let t=e.match(/\/\*\s*# sourceMappingURL=/gm);if(!t)return;let r=e.lastIndexOf(t.pop()),n=e.indexOf("*/",r);r>-1&&n>-1&&(this.annotation=this.getAnnotationURL(e.substring(r,n)))}loadFile(e){if(this.root=xs(e),ch(e))return this.mapFile=e,dh(e,"utf-8").toString().trim()}loadMap(e,t){if(t===!1)return!1;if(t){if(typeof t=="string")return t;if(typeof t=="function"){let r=t(e);if(r){let n=this.loadFile(r);if(!n)throw new Error("Unable to load previous source map: "+r.toString());return n}}else{if(t instanceof jo)return Ko.fromSourceMap(t).toString();if(t instanceof Ko)return t.toString();if(this.isMap(t))return JSON.stringify(t);throw new Error("Unsupported previous source map format: "+t.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let r=this.annotation;return e&&(r=hh(xs(e),r)),this.loadFile(r)}}}startWith(e,t){return e?e.substr(0,t.length)===t:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}},ha=rn;rn.default=rn;var{SourceMapConsumer:ph,SourceMapGenerator:mh}=Ce,{fileURLToPath:Jo,pathToFileURL:ar}=Ce,{isAbsolute:sn,resolve:nn}=Ce,{nanoid:gh}=uh,As=Ce,Zo=Fn,yh=ha,_s=Symbol("fromOffsetCache"),wh=!!(ph&&mh),Xo=!!(nn&&sn),Nr=class{constructor(e,t={}){if(e===null||typeof e>"u"||typeof e=="object"&&!e.toString)throw new Error(`PostCSS received ${e} instead of CSS string`);if(this.css=e.toString(),this.css[0]==="\uFEFF"||this.css[0]==="\uFFFE"?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,t.from&&(!Xo||/^\w+:\/\//.test(t.from)||sn(t.from)?this.file=t.from:this.file=nn(t.from)),Xo&&wh){let r=new yh(this.css,t);if(r.text){this.map=r;let n=r.consumer().file;!this.file&&n&&(this.file=this.mapResolve(n))}}this.file||(this.id="<input css "+gh(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,r,n={}){let o,i,l;if(t&&typeof t=="object"){let u=t,c=r;if(typeof u.offset=="number"){let d=this.fromOffset(u.offset);t=d.line,r=d.col}else t=u.line,r=u.column;if(typeof c.offset=="number"){let d=this.fromOffset(c.offset);i=d.line,l=d.col}else i=c.line,l=c.column}else if(!r){let u=this.fromOffset(t);t=u.line,r=u.col}let a=this.origin(t,r,i,l);return a?o=new Zo(e,a.endLine===void 0?a.line:{column:a.column,line:a.line},a.endLine===void 0?a.column:{column:a.endColumn,line:a.endLine},a.source,a.file,n.plugin):o=new Zo(e,i===void 0?t:{column:r,line:t},i===void 0?r:{column:l,line:i},this.css,this.file,n.plugin),o.input={column:r,endColumn:l,endLine:i,line:t,source:this.css},this.file&&(ar&&(o.input.url=ar(this.file).toString()),o.input.file=this.file),o}fromOffset(e){let t,r;if(this[_s])r=this[_s];else{let o=this.css.split(`
44
- `);r=new Array(o.length);let i=0;for(let l=0,a=o.length;l<a;l++)r[l]=i,i+=o[l].length+1;this[_s]=r}t=r[r.length-1];let n=0;if(e>=t)n=r.length-1;else{let o=r.length-2,i;for(;n<o;)if(i=n+(o-n>>1),e<r[i])o=i-1;else if(e>=r[i+1])n=i+1;else{n=i;break}}return{col:e-r[n]+1,line:n+1}}mapResolve(e){return/^\w+:\/\//.test(e)?e:nn(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,r,n){if(!this.map)return!1;let o=this.map.consumer(),i=o.originalPositionFor({column:t,line:e});if(!i.source)return!1;let l;typeof r=="number"&&(l=o.originalPositionFor({column:n,line:r}));let a;sn(i.source)?a=ar(i.source):a=new URL(i.source,this.map.consumer().sourceRoot||ar(this.map.mapFile));let u={column:i.column,endColumn:l&&l.column,endLine:l&&l.line,line:i.line,url:a.toString()};if(a.protocol==="file:")if(Jo)u.file=Jo(a);else throw new Error("file: protocol is not available in this PostCSS build");let c=o.sourceContentFor(i.source);return c&&(u.source=c),u}toJSON(){let e={};for(let t of["hasBOM","css","file","id"])this[t]!=null&&(e[t]=this[t]);return this.map&&(e.map={...this.map},e.map.consumerCache&&(e.map.consumerCache=void 0)),e}get from(){return this.file||this.id}},Kr=Nr;Nr.default=Nr;As&&As.registerInput&&As.registerInput(Nr);var{SourceMapConsumer:fa,SourceMapGenerator:vr}=Ce,{dirname:Cr,relative:pa,resolve:ma,sep:ga}=Ce,{pathToFileURL:qo}=Ce,Sh=Kr,vh=!!(fa&&vr),Ch=!!(Cr&&ma&&pa&&ga),bh=class{constructor(e,t,r,n){this.stringify=e,this.mapOpts=r.map||{},this.root=t,this.opts=r,this.css=n,this.originalCSS=n,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let e;this.isInline()?e="data:application/json;base64,"+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation=="string"?e=this.mapOpts.annotation:typeof this.mapOpts.annotation=="function"?e=this.mapOpts.annotation(this.opts.to,this.root):e=this.outputFile()+".map";let t=`
45
- `;this.css.includes(`\r
46
- `)&&(t=`\r
47
- `),this.css+=t+"/*# sourceMappingURL="+e+" */"}applyPrevMaps(){for(let e of this.previous()){let t=this.toUrl(this.path(e.file)),r=e.root||Cr(e.file),n;this.mapOpts.sourcesContent===!1?(n=new fa(e.text),n.sourcesContent&&(n.sourcesContent=null)):n=e.consumer(),this.map.applySourceMap(n,t,this.toUrl(this.path(r)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1)if(this.root){let e;for(let t=this.root.nodes.length-1;t>=0;t--)e=this.root.nodes[t],e.type==="comment"&&e.text.indexOf("# sourceMappingURL=")===0&&this.root.removeChild(t)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),Ch&&vh&&this.isMap())return this.generateMap();{let e="";return this.stringify(this.root,t=>{e+=t}),[e]}}generateMap(){if(this.root)this.generateString();else if(this.previous().length===1){let e=this.previous()[0].consumer();e.file=this.outputFile(),this.map=vr.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new vr({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 vr({file:this.outputFile(),ignoreInvalidMapping:!0});let e=1,t=1,r="<no source>",n={generated:{column:0,line:0},original:{column:0,line:0},source:""},o,i;this.stringify(this.root,(l,a,u)=>{if(this.css+=l,a&&u!=="end"&&(n.generated.line=e,n.generated.column=t-1,a.source&&a.source.start?(n.source=this.sourcePath(a),n.original.line=a.source.start.line,n.original.column=a.source.start.column-1,this.map.addMapping(n)):(n.source=r,n.original.line=1,n.original.column=0,this.map.addMapping(n))),o=l.match(/\n/g),o?(e+=o.length,i=l.lastIndexOf(`
48
- `),t=l.length-i):t+=l.length,a&&u!=="start"){let c=a.parent||{raws:{}};(!(a.type==="decl"||a.type==="atrule"&&!a.nodes)||a!==c.last||c.raws.semicolon)&&(a.source&&a.source.end?(n.source=this.sourcePath(a),n.original.line=a.source.end.line,n.original.column=a.source.end.column-1,n.generated.line=e,n.generated.column=t-2,this.map.addMapping(n)):(n.source=r,n.original.line=1,n.original.column=0,n.generated.line=e,n.generated.column=t-1,this.map.addMapping(n)))}})}isAnnotation(){return this.isInline()?!0:typeof this.mapOpts.annotation<"u"?this.mapOpts.annotation:this.previous().length?this.previous().some(e=>e.annotation):!0}isInline(){if(typeof this.mapOpts.inline<"u")return this.mapOpts.inline;let e=this.mapOpts.annotation;return typeof e<"u"&&e!==!0?!1:this.previous().length?this.previous().some(t=>t.inline):!0}isMap(){return typeof this.opts.map<"u"?!!this.opts.map:this.previous().length>0}isSourcesContent(){return typeof this.mapOpts.sourcesContent<"u"?this.mapOpts.sourcesContent:this.previous().length?this.previous().some(e=>e.withContent()):!0}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(e){if(this.mapOpts.absolute||e.charCodeAt(0)===60||/^\w+:\/\//.test(e))return e;let t=this.memoizedPaths.get(e);if(t)return t;let r=this.opts.to?Cr(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(r=Cr(ma(r,this.mapOpts.annotation)));let n=pa(r,e);return this.memoizedPaths.set(e,n),n}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(e=>{if(e.source&&e.source.input.map){let t=e.source.input.map;this.previousMaps.includes(t)||this.previousMaps.push(t)}});else{let e=new Sh(this.originalCSS,this.opts);e.map&&this.previousMaps.push(e.map)}return this.previousMaps}setSourcesContent(){let e={};if(this.root)this.root.walk(t=>{if(t.source){let r=t.source.input.from;if(r&&!e[r]){e[r]=!0;let n=this.usesFileUrls?this.toFileUrl(r):this.toUrl(this.path(r));this.map.setSourceContent(n,t.source.input.css)}}});else if(this.css){let t=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(t,this.css)}}sourcePath(e){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(e.source.input.from):this.toUrl(this.path(e.source.input.from))}toBase64(e){return Buffer?Buffer.from(e).toString("base64"):window.btoa(unescape(encodeURIComponent(e)))}toFileUrl(e){let t=this.memoizedFileURLs.get(e);if(t)return t;if(qo){let r=qo(e).toString();return this.memoizedFileURLs.set(e,r),r}else throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(e){let t=this.memoizedURLs.get(e);if(t)return t;ga==="\\"&&(e=e.replace(/\\/g,"/"));let r=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,r),r}},ya=bh,Eh=Gr,on=class extends Eh{constructor(e){super(e),this.type="comment"}},Jr=on;on.default=on;var{isClean:wa,my:Sa}=$t,va=jr,Ca=Jr,Rh=Gr,ba,Un,zn,Ea;function Ra(s){return s.map(e=>(e.nodes&&(e.nodes=Ra(e.nodes)),delete e.source,e))}function Ia(s){if(s[wa]=!1,s.proxyOf.nodes)for(let e of s.proxyOf.nodes)Ia(e)}var Me=class xa extends Rh{append(...e){for(let t of e){let r=this.normalize(t,this.last);for(let n of r)this.proxyOf.nodes.push(n)}return this.markDirty(),this}cleanRaws(e){if(super.cleanRaws(e),this.nodes)for(let t of this.nodes)t.cleanRaws(e)}each(e){if(!this.proxyOf.nodes)return;let t=this.getIterator(),r,n;for(;this.indexes[t]<this.proxyOf.nodes.length&&(r=this.indexes[t],n=e(this.proxyOf.nodes[r],r),n!==!1);)this.indexes[t]+=1;return delete this.indexes[t],n}every(e){return this.nodes.every(e)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let e=this.lastEach;return this.indexes[e]=0,e}getProxyProcessor(){return{get(e,t){return t==="proxyOf"?e:e[t]?t==="each"||typeof t=="string"&&t.startsWith("walk")?(...r)=>e[t](...r.map(n=>typeof n=="function"?(o,i)=>n(o.toProxy(),i):n)):t==="every"||t==="some"?r=>e[t]((n,...o)=>r(n.toProxy(),...o)):t==="root"?()=>e.root().toProxy():t==="nodes"?e.nodes.map(r=>r.toProxy()):t==="first"||t==="last"?e[t].toProxy():e[t]:e[t]},set(e,t,r){return e[t]===r||(e[t]=r,(t==="name"||t==="params"||t==="selector")&&e.markDirty()),!0}}}index(e){return typeof e=="number"?e:(e.proxyOf&&(e=e.proxyOf),this.proxyOf.nodes.indexOf(e))}insertAfter(e,t){let r=this.index(e),n=this.normalize(t,this.proxyOf.nodes[r]).reverse();r=this.index(e);for(let i of n)this.proxyOf.nodes.splice(r+1,0,i);let o;for(let i in this.indexes)o=this.indexes[i],r<o&&(this.indexes[i]=o+n.length);return this.markDirty(),this}insertBefore(e,t){let r=this.index(e),n=r===0?"prepend":!1,o=this.normalize(t,this.proxyOf.nodes[r],n).reverse();r=this.index(e);for(let l of o)this.proxyOf.nodes.splice(r,0,l);let i;for(let l in this.indexes)i=this.indexes[l],r<=i&&(this.indexes[l]=i+o.length);return this.markDirty(),this}normalize(e,t){if(typeof e=="string")e=Ra(ba(e).nodes);else if(typeof e>"u")e=[];else if(Array.isArray(e)){e=e.slice(0);for(let n of e)n.parent&&n.parent.removeChild(n,"ignore")}else if(e.type==="root"&&this.type!=="document"){e=e.nodes.slice(0);for(let n of e)n.parent&&n.parent.removeChild(n,"ignore")}else if(e.type)e=[e];else if(e.prop){if(typeof e.value>"u")throw new Error("Value field is missed in node creation");typeof e.value!="string"&&(e.value=String(e.value)),e=[new va(e)]}else if(e.selector)e=[new Un(e)];else if(e.name)e=[new zn(e)];else if(e.text)e=[new Ca(e)];else throw new Error("Unknown node type in node creation");return e.map(n=>(n[Sa]||xa.rebuild(n),n=n.proxyOf,n.parent&&n.parent.removeChild(n),n[wa]&&Ia(n),typeof n.raws.before>"u"&&t&&typeof t.raws.before<"u"&&(n.raws.before=t.raws.before.replace(/\S/g,"")),n.parent=this.proxyOf,n))}prepend(...e){e=e.reverse();for(let t of e){let r=this.normalize(t,this.first,"prepend").reverse();for(let n of r)this.proxyOf.nodes.unshift(n);for(let n in this.indexes)this.indexes[n]=this.indexes[n]+r.length}return this.markDirty(),this}push(e){return e.parent=this,this.proxyOf.nodes.push(e),this}removeAll(){for(let e of this.proxyOf.nodes)e.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(e){e=this.index(e),this.proxyOf.nodes[e].parent=void 0,this.proxyOf.nodes.splice(e,1);let t;for(let r in this.indexes)t=this.indexes[r],t>=e&&(this.indexes[r]=t-1);return this.markDirty(),this}replaceValues(e,t,r){return r||(r=t,t={}),this.walkDecls(n=>{t.props&&!t.props.includes(n.prop)||t.fast&&!n.value.includes(t.fast)||(n.value=n.value.replace(e,r))}),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each((t,r)=>{let n;try{n=e(t,r)}catch(o){throw t.addToError(o)}return n!==!1&&t.walk&&(n=t.walk(e)),n})}walkAtRules(e,t){return t?e instanceof RegExp?this.walk((r,n)=>{if(r.type==="atrule"&&e.test(r.name))return t(r,n)}):this.walk((r,n)=>{if(r.type==="atrule"&&r.name===e)return t(r,n)}):(t=e,this.walk((r,n)=>{if(r.type==="atrule")return t(r,n)}))}walkComments(e){return this.walk((t,r)=>{if(t.type==="comment")return e(t,r)})}walkDecls(e,t){return t?e instanceof RegExp?this.walk((r,n)=>{if(r.type==="decl"&&e.test(r.prop))return t(r,n)}):this.walk((r,n)=>{if(r.type==="decl"&&r.prop===e)return t(r,n)}):(t=e,this.walk((r,n)=>{if(r.type==="decl")return t(r,n)}))}walkRules(e,t){return t?e instanceof RegExp?this.walk((r,n)=>{if(r.type==="rule"&&e.test(r.selector))return t(r,n)}):this.walk((r,n)=>{if(r.type==="rule"&&r.selector===e)return t(r,n)}):(t=e,this.walk((r,n)=>{if(r.type==="rule")return t(r,n)}))}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]}};Me.registerParse=s=>{ba=s};Me.registerRule=s=>{Un=s};Me.registerAtRule=s=>{zn=s};Me.registerRoot=s=>{Ea=s};var Ve=Me;Me.default=Me;Me.rebuild=s=>{s.type==="atrule"?Object.setPrototypeOf(s,zn.prototype):s.type==="rule"?Object.setPrototypeOf(s,Un.prototype):s.type==="decl"?Object.setPrototypeOf(s,va.prototype):s.type==="comment"?Object.setPrototypeOf(s,Ca.prototype):s.type==="root"&&Object.setPrototypeOf(s,Ea.prototype),s[Sa]=!0,s.nodes&&s.nodes.forEach(e=>{Me.rebuild(e)})};var Ih=Ve,Aa,_a,Ot=class extends Ih{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(e={}){return new Aa(new _a,this,e).stringify()}};Ot.registerLazyResult=s=>{Aa=s};Ot.registerProcessor=s=>{_a=s};var Hn=Ot;Ot.default=Ot;var an=class{constructor(e,t={}){if(this.type="warning",this.text=e,t.node&&t.node.source){let r=t.node.rangeBy(t);this.line=r.start.line,this.column=r.start.column,this.endLine=r.end.line,this.endColumn=r.end.column}for(let r in t)this[r]=t[r]}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}},Oa=an;an.default=an;var xh=Oa,ln=class{constructor(e,t,r){this.processor=e,this.messages=[],this.root=t,this.opts=r,this.css=void 0,this.map=void 0}toString(){return this.css}warn(e,t={}){t.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(t.plugin=this.lastPlugin.postcssPlugin);let r=new xh(e,t);return this.messages.push(r),r}warnings(){return this.messages.filter(e=>e.type==="warning")}get content(){return this.css}},Bn=ln;ln.default=ln;var Os=39,Qo=34,lr=92,ei=47,ur=10,wt=32,cr=12,dr=9,hr=13,Ah=91,_h=93,Oh=40,Dh=41,Th=123,Nh=125,Mh=59,kh=42,Ph=58,$h=64,fr=/[\t\n\f\r "#'()/;[\\\]{}]/g,pr=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,Lh=/.[\r\n"'(/\\]/,ti=/[\da-f]/i,Fh=function(e,t={}){let r=e.css.valueOf(),n=t.ignoreErrors,o,i,l,a,u,c,d,p,m,g,f=r.length,h=0,E=[],S=[];function w(){return h}function I(v){throw e.error("Unclosed "+v,h)}function _(){return S.length===0&&h>=f}function y(v){if(S.length)return S.pop();if(h>=f)return;let x=v?v.ignoreUnclosed:!1;switch(o=r.charCodeAt(h),o){case ur:case wt:case dr:case hr:case cr:{i=h;do i+=1,o=r.charCodeAt(i);while(o===wt||o===ur||o===dr||o===hr||o===cr);g=["space",r.slice(h,i)],h=i-1;break}case Ah:case _h:case Th:case Nh:case Ph:case Mh:case Dh:{let O=String.fromCharCode(o);g=[O,O,h];break}case Oh:{if(p=E.length?E.pop()[1]:"",m=r.charCodeAt(h+1),p==="url"&&m!==Os&&m!==Qo&&m!==wt&&m!==ur&&m!==dr&&m!==cr&&m!==hr){i=h;do{if(c=!1,i=r.indexOf(")",i+1),i===-1)if(n||x){i=h;break}else I("bracket");for(d=i;r.charCodeAt(d-1)===lr;)d-=1,c=!c}while(c);g=["brackets",r.slice(h,i+1),h,i],h=i}else i=r.indexOf(")",h+1),a=r.slice(h,i+1),i===-1||Lh.test(a)?g=["(","(",h]:(g=["brackets",a,h,i],h=i);break}case Os:case Qo:{l=o===Os?"'":'"',i=h;do{if(c=!1,i=r.indexOf(l,i+1),i===-1)if(n||x){i=h+1;break}else I("string");for(d=i;r.charCodeAt(d-1)===lr;)d-=1,c=!c}while(c);g=["string",r.slice(h,i+1),h,i],h=i;break}case $h:{fr.lastIndex=h+1,fr.test(r),fr.lastIndex===0?i=r.length-1:i=fr.lastIndex-2,g=["at-word",r.slice(h,i+1),h,i],h=i;break}case lr:{for(i=h,u=!0;r.charCodeAt(i+1)===lr;)i+=1,u=!u;if(o=r.charCodeAt(i+1),u&&o!==ei&&o!==wt&&o!==ur&&o!==dr&&o!==hr&&o!==cr&&(i+=1,ti.test(r.charAt(i)))){for(;ti.test(r.charAt(i+1));)i+=1;r.charCodeAt(i+1)===wt&&(i+=1)}g=["word",r.slice(h,i+1),h,i],h=i;break}default:{o===ei&&r.charCodeAt(h+1)===kh?(i=r.indexOf("*/",h+2)+1,i===0&&(n||x?i=r.length:I("comment")),g=["comment",r.slice(h,i+1),h,i],h=i):(pr.lastIndex=h+1,pr.test(r),pr.lastIndex===0?i=r.length-1:i=pr.lastIndex-2,g=["word",r.slice(h,i+1),h,i],E.push(g),h=i);break}}return h++,g}function R(v){S.push(v)}return{back:R,endOfFile:_,nextToken:y,position:w}},Da=Ve,Mr=class extends Da{constructor(e){super(e),this.type="atrule"}append(...e){return this.proxyOf.nodes||(this.nodes=[]),super.append(...e)}prepend(...e){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...e)}},Wn=Mr;Mr.default=Mr;Da.registerAtRule(Mr);var Ta=Ve,Na,Ma,ot=class extends Ta{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}normalize(e,t,r){let n=super.normalize(e);if(t){if(r==="prepend")this.nodes.length>1?t.raws.before=this.nodes[1].raws.before:delete t.raws.before;else if(this.first!==t)for(let o of n)o.raws.before=t.raws.before}return n}removeChild(e,t){let r=this.index(e);return!t&&r===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[r].raws.before),super.removeChild(e)}toResult(e={}){return new Na(new Ma,this,e).stringify()}};ot.registerLazyResult=s=>{Na=s};ot.registerProcessor=s=>{Ma=s};var Lt=ot;ot.default=ot;Ta.registerRoot(ot);var Dt={comma(s){return Dt.split(s,[","],!0)},space(s){let e=[" ",`
49
- `," "];return Dt.split(s,e)},split(s,e,t){let r=[],n="",o=!1,i=0,l=!1,a="",u=!1;for(let c of s)u?u=!1:c==="\\"?u=!0:l?c===a&&(l=!1):c==='"'||c==="'"?(l=!0,a=c):c==="("?i+=1:c===")"?i>0&&(i-=1):i===0&&e.includes(c)&&(o=!0),o?(n!==""&&r.push(n.trim()),n="",o=!1):n+=c;return(t||n!=="")&&r.push(n.trim()),r}},ka=Dt;Dt.default=Dt;var Pa=Ve,Uh=ka,kr=class extends Pa{constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return Uh.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\s*/):null,r=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(r)}},Vn=kr;kr.default=kr;Pa.registerRule(kr);var zh=jr,Hh=Fh,Bh=Jr,Wh=Wn,Vh=Lt,ri=Vn,si={empty:!0,space:!0};function Yh(s){for(let e=s.length-1;e>=0;e--){let t=s[e],r=t[3]||t[2];if(r)return r}}var Gh=class{constructor(e){this.input=e,this.root=new Vh,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}atrule(e){let t=new Wh;t.name=e[1].slice(1),t.name===""&&this.unnamedAtrule(t,e),this.init(t,e[2]);let r,n,o,i=!1,l=!1,a=[],u=[];for(;!this.tokenizer.endOfFile();){if(e=this.tokenizer.nextToken(),r=e[0],r==="("||r==="["?u.push(r==="("?")":"]"):r==="{"&&u.length>0?u.push("}"):r===u[u.length-1]&&u.pop(),u.length===0)if(r===";"){t.source.end=this.getPosition(e[2]),t.source.end.offset++,this.semicolon=!0;break}else if(r==="{"){l=!0;break}else if(r==="}"){if(a.length>0){for(o=a.length-1,n=a[o];n&&n[0]==="space";)n=a[--o];n&&(t.source.end=this.getPosition(n[3]||n[2]),t.source.end.offset++)}this.end(e);break}else a.push(e);else a.push(e);if(this.tokenizer.endOfFile()){i=!0;break}}t.raws.between=this.spacesAndCommentsFromEnd(a),a.length?(t.raws.afterName=this.spacesAndCommentsFromStart(a),this.raw(t,"params",a),i&&(e=a[a.length-1],t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++,this.spaces=t.raws.between,t.raws.between="")):(t.raws.afterName="",t.params=""),l&&(t.nodes=[],this.current=t)}checkMissedSemicolon(e){let t=this.colon(e);if(t===!1)return;let r=0,n;for(let o=t-1;o>=0&&(n=e[o],!(n[0]!=="space"&&(r+=1,r===2)));o--);throw this.input.error("Missed semicolon",n[0]==="word"?n[3]+1:n[2])}colon(e){let t=0,r,n,o;for(let[i,l]of e.entries()){if(r=l,n=r[0],n==="("&&(t+=1),n===")"&&(t-=1),t===0&&n===":")if(!o)this.doubleColon(r);else{if(o[0]==="word"&&o[1]==="progid")continue;return i}o=r}return!1}comment(e){let t=new Bh;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;let r=e[1].slice(2,-2);if(/^\s*$/.test(r))t.text="",t.raws.left=r,t.raws.right="";else{let n=r.match(/^(\s*)([^]*\S)(\s*)$/);t.text=n[2],t.raws.left=n[1],t.raws.right=n[3]}}createTokenizer(){this.tokenizer=Hh(this.input)}decl(e,t){let r=new zh;this.init(r,e[0][2]);let n=e[e.length-1];for(n[0]===";"&&(this.semicolon=!0,e.pop()),r.source.end=this.getPosition(n[3]||n[2]||Yh(e)),r.source.end.offset++;e[0][0]!=="word";)e.length===1&&this.unknownWord(e),r.raws.before+=e.shift()[1];for(r.source.start=this.getPosition(e[0][2]),r.prop="";e.length;){let u=e[0][0];if(u===":"||u==="space"||u==="comment")break;r.prop+=e.shift()[1]}r.raws.between="";let o;for(;e.length;)if(o=e.shift(),o[0]===":"){r.raws.between+=o[1];break}else o[0]==="word"&&/\w/.test(o[1])&&this.unknownWord([o]),r.raws.between+=o[1];(r.prop[0]==="_"||r.prop[0]==="*")&&(r.raws.before+=r.prop[0],r.prop=r.prop.slice(1));let i=[],l;for(;e.length&&(l=e[0][0],!(l!=="space"&&l!=="comment"));)i.push(e.shift());this.precheckMissedSemicolon(e);for(let u=e.length-1;u>=0;u--){if(o=e[u],o[1].toLowerCase()==="!important"){r.important=!0;let c=this.stringFrom(e,u);c=this.spacesFromEnd(e)+c,c!==" !important"&&(r.raws.important=c);break}else if(o[1].toLowerCase()==="important"){let c=e.slice(0),d="";for(let p=u;p>0;p--){let m=c[p][0];if(d.trim().indexOf("!")===0&&m!=="space")break;d=c.pop()[1]+d}d.trim().indexOf("!")===0&&(r.important=!0,r.raws.important=d,e=c)}if(o[0]!=="space"&&o[0]!=="comment")break}e.some(u=>u[0]!=="space"&&u[0]!=="comment")&&(r.raws.between+=i.map(u=>u[1]).join(""),i=[]),this.raw(r,"value",i.concat(e),t),r.value.includes(":")&&!t&&this.checkMissedSemicolon(e)}doubleColon(e){throw this.input.error("Double colon",{offset:e[2]},{offset:e[2]+e[1].length})}emptyRule(e){let t=new ri;this.init(t,e[2]),t.selector="",t.raws.between="",this.current=t}end(e){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(e[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(e)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(e){if(this.spaces+=e[1],this.current.nodes){let t=this.current.nodes[this.current.nodes.length-1];t&&t.type==="rule"&&!t.raws.ownSemicolon&&(t.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(e){let t=this.input.fromOffset(e);return{column:t.col,line:t.line,offset:e}}init(e,t){this.current.push(e),e.source={input:this.input,start:this.getPosition(t)},e.raws.before=this.spaces,this.spaces="",e.type!=="comment"&&(this.semicolon=!1)}other(e){let t=!1,r=null,n=!1,o=null,i=[],l=e[1].startsWith("--"),a=[],u=e;for(;u;){if(r=u[0],a.push(u),r==="("||r==="[")o||(o=u),i.push(r==="("?")":"]");else if(l&&n&&r==="{")o||(o=u),i.push("}");else if(i.length===0)if(r===";")if(n){this.decl(a,l);return}else break;else if(r==="{"){this.rule(a);return}else if(r==="}"){this.tokenizer.back(a.pop()),t=!0;break}else r===":"&&(n=!0);else r===i[i.length-1]&&(i.pop(),i.length===0&&(o=null));u=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),i.length>0&&this.unclosedBracket(o),t&&n){if(!l)for(;a.length&&(u=a[a.length-1][0],!(u!=="space"&&u!=="comment"));)this.tokenizer.back(a.pop());this.decl(a,l)}else this.unknownWord(a)}parse(){let e;for(;!this.tokenizer.endOfFile();)switch(e=this.tokenizer.nextToken(),e[0]){case"space":this.spaces+=e[1];break;case";":this.freeSemicolon(e);break;case"}":this.end(e);break;case"comment":this.comment(e);break;case"at-word":this.atrule(e);break;case"{":this.emptyRule(e);break;default:this.other(e);break}this.endFile()}precheckMissedSemicolon(){}raw(e,t,r,n){let o,i,l=r.length,a="",u=!0,c,d;for(let p=0;p<l;p+=1)o=r[p],i=o[0],i==="space"&&p===l-1&&!n?u=!1:i==="comment"?(d=r[p-1]?r[p-1][0]:"empty",c=r[p+1]?r[p+1][0]:"empty",!si[d]&&!si[c]?a.slice(-1)===","?u=!1:a+=o[1]:u=!1):a+=o[1];if(!u){let p=r.reduce((m,g)=>m+g[1],"");e.raws[t]={raw:p,value:a}}e[t]=a}rule(e){e.pop();let t=new ri;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t}spacesAndCommentsFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],!(t!=="space"&&t!=="comment"));)r=e.pop()[1]+r;return r}spacesAndCommentsFromStart(e){let t,r="";for(;e.length&&(t=e[0][0],!(t!=="space"&&t!=="comment"));)r+=e.shift()[1];return r}spacesFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],t==="space");)r=e.pop()[1]+r;return r}stringFrom(e,t){let r="";for(let n=t;n<e.length;n++)r+=e[n][1];return e.splice(t,e.length-t),r}unclosedBlock(){let e=this.current.source.start;throw this.input.error("Unclosed block",e.line,e.column)}unclosedBracket(e){throw this.input.error("Unclosed bracket",{offset:e[2]},{offset:e[2]+1})}unexpectedClose(e){throw this.input.error("Unexpected }",{offset:e[2]},{offset:e[2]+1})}unknownWord(e){throw this.input.error("Unknown word",{offset:e[0][2]},{offset:e[0][2]+e[0][1].length})}unnamedAtrule(e,t){throw this.input.error("At-rule without name",{offset:t[2]},{offset:t[2]+t[1].length})}},jh=Gh,Kh=Ve,Jh=jh,Zh=Kr;function Pr(s,e){let t=new Zh(s,e),r=new Jh(t);try{r.parse()}catch(n){throw n}return r.root}var Yn=Pr;Pr.default=Pr;Kh.registerParse(Pr);var{isClean:xe,my:Xh}=$t,qh=ya,Qh=Yr,ef=Ve,tf=Hn;var ni=Bn,rf=Yn,sf=Lt,nf={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},of={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},af={Once:!0,postcssPlugin:!0,prepare:!0},it=0;function St(s){return typeof s=="object"&&typeof s.then=="function"}function $a(s){let e=!1,t=nf[s.type];return s.type==="decl"?e=s.prop.toLowerCase():s.type==="atrule"&&(e=s.name.toLowerCase()),e&&s.append?[t,t+"-"+e,it,t+"Exit",t+"Exit-"+e]:e?[t,t+"-"+e,t+"Exit",t+"Exit-"+e]:s.append?[t,it,t+"Exit"]:[t,t+"Exit"]}function oi(s){let e;return s.type==="document"?e=["Document",it,"DocumentExit"]:s.type==="root"?e=["Root",it,"RootExit"]:e=$a(s),{eventIndex:0,events:e,iterator:0,node:s,visitorIndex:0,visitors:[]}}function un(s){return s[xe]=!1,s.nodes&&s.nodes.forEach(e=>un(e)),s}var cn={},at=class La{constructor(e,t,r){this.stringified=!1,this.processed=!1;let n;if(typeof t=="object"&&t!==null&&(t.type==="root"||t.type==="document"))n=un(t);else if(t instanceof La||t instanceof ni)n=un(t.root),t.map&&(typeof r.map>"u"&&(r.map={}),r.map.inline||(r.map.inline=!1),r.map.prev=t.map);else{let o=rf;r.syntax&&(o=r.syntax.parse),r.parser&&(o=r.parser),o.parse&&(o=o.parse);try{n=o(t,r)}catch(i){this.processed=!0,this.error=i}n&&!n[Xh]&&ef.rebuild(n)}this.result=new ni(e,n,r),this.helpers={...cn,postcss:cn,result:this.result},this.plugins=this.processor.plugins.map(o=>typeof o=="object"&&o.prepare?{...o,...o.prepare(this.result)}:o)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(e,t){let r=this.result.lastPlugin;try{t&&t.addToError(e),this.error=e,e.name==="CssSyntaxError"&&!e.plugin?(e.plugin=r.postcssPlugin,e.setMessage()):r.postcssVersion}catch(n){console&&console.error&&console.error(n)}return e}prepareVisitors(){this.listeners={};let e=(t,r,n)=>{this.listeners[r]||(this.listeners[r]=[]),this.listeners[r].push([t,n])};for(let t of this.plugins)if(typeof t=="object")for(let r in t){if(!of[r]&&/^[A-Z]/.test(r))throw new Error(`Unknown event ${r} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!af[r])if(typeof t[r]=="object")for(let n in t[r])n==="*"?e(t,r,t[r][n]):e(t,r+"-"+n.toLowerCase(),t[r][n]);else typeof t[r]=="function"&&e(t,r,t[r])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let e=0;e<this.plugins.length;e++){let t=this.plugins[e],r=this.runOnRoot(t);if(St(r))try{await r}catch(n){throw this.handleError(n)}}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[xe];){e[xe]=!0;let t=[oi(e)];for(;t.length>0;){let r=this.visitTick(t);if(St(r))try{await r}catch(n){let o=t[t.length-1].node;throw this.handleError(n,o)}}}if(this.listeners.OnceExit)for(let[t,r]of this.listeners.OnceExit){this.result.lastPlugin=t;try{if(e.type==="document"){let n=e.nodes.map(o=>r(o,this.helpers));await Promise.all(n)}else await r(e,this.helpers)}catch(n){throw this.handleError(n)}}}return this.processed=!0,this.stringify()}runOnRoot(e){this.result.lastPlugin=e;try{if(typeof e=="object"&&e.Once){if(this.result.root.type==="document"){let t=this.result.root.nodes.map(r=>e.Once(r,this.helpers));return St(t[0])?Promise.all(t):t}return e.Once(this.result.root,this.helpers)}else if(typeof e=="function")return e(this.result.root,this.result)}catch(t){throw this.handleError(t)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let e=this.result.opts,t=Qh;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let n=new qh(t,this.result.root,this.result.opts).generate();return this.result.css=n[0],this.result.map=n[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let e of this.plugins){let t=this.runOnRoot(e);if(St(t))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[xe];)e[xe]=!0,this.walkSync(e);if(this.listeners.OnceExit)if(e.type==="document")for(let t of e.nodes)this.visitSync(this.listeners.OnceExit,t);else this.visitSync(this.listeners.OnceExit,e)}return this.result}then(e,t){return this.async().then(e,t)}toString(){return this.css}visitSync(e,t){for(let[r,n]of e){this.result.lastPlugin=r;let o;try{o=n(t,this.helpers)}catch(i){throw this.handleError(i,t.proxyOf)}if(t.type!=="root"&&t.type!=="document"&&!t.parent)return!0;if(St(o))throw this.getAsyncError()}}visitTick(e){let t=e[e.length-1],{node:r,visitors:n}=t;if(r.type!=="root"&&r.type!=="document"&&!r.parent){e.pop();return}if(n.length>0&&t.visitorIndex<n.length){let[i,l]=n[t.visitorIndex];t.visitorIndex+=1,t.visitorIndex===n.length&&(t.visitors=[],t.visitorIndex=0),this.result.lastPlugin=i;try{return l(r.toProxy(),this.helpers)}catch(a){throw this.handleError(a,r)}}if(t.iterator!==0){let i=t.iterator,l;for(;l=r.nodes[r.indexes[i]];)if(r.indexes[i]+=1,!l[xe]){l[xe]=!0,e.push(oi(l));return}t.iterator=0,delete r.indexes[i]}let o=t.events;for(;t.eventIndex<o.length;){let i=o[t.eventIndex];if(t.eventIndex+=1,i===it){r.nodes&&r.nodes.length&&(r[xe]=!0,t.iterator=r.getIterator());return}else if(this.listeners[i]){t.visitors=this.listeners[i];return}}e.pop()}walkSync(e){e[xe]=!0;let t=$a(e);for(let r of t)if(r===it)e.nodes&&e.each(n=>{n[xe]||this.walkSync(n)});else{let n=this.listeners[r];if(n&&this.visitSync(n,e.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}};at.registerPostcss=s=>{cn=s};var Fa=at;at.default=at;sf.registerLazyResult(at);tf.registerLazyResult(at);var lf=ya,uf=Yr;var cf=Yn,df=Bn,dn=class{constructor(e,t,r){t=t.toString(),this.stringified=!1,this._processor=e,this._css=t,this._opts=r,this._map=void 0;let n,o=uf;this.result=new df(this._processor,n,this._opts),this.result.css=t;let i=this;Object.defineProperty(this.result,"root",{get(){return i.root}});let l=new lf(o,n,this._opts,t);if(l.isMap()){let[a,u]=l.generate();a&&(this.result.css=a),u&&(this.result.map=u)}else l.clearAnnotation(),this.result.css=l.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}sync(){if(this.error)throw this.error;return this.result}then(e,t){return this.async().then(e,t)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let e,t=cf;try{e=t(this._css,this._opts)}catch(r){this.error=r}if(this.error)throw this.error;return this._root=e,e}get[Symbol.toStringTag](){return"NoWorkResult"}},hf=dn;dn.default=dn;var ff=hf,pf=Fa,mf=Hn,gf=Lt,Tt=class{constructor(e=[]){this.version="8.4.38",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let r of e)if(r.postcss===!0?r=r():r.postcss&&(r=r.postcss),typeof r=="object"&&Array.isArray(r.plugins))t=t.concat(r.plugins);else if(typeof r=="object"&&r.postcssPlugin)t.push(r);else if(typeof r=="function")t.push(r);else if(!(typeof r=="object"&&(r.parse||r.stringify)))throw new Error(r+" is not a PostCSS plugin");return t}process(e,t={}){return!this.plugins.length&&!t.parser&&!t.stringifier&&!t.syntax?new ff(this,e,t):new pf(this,e,t)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}},yf=Tt;Tt.default=Tt;gf.registerProcessor(Tt);mf.registerProcessor(Tt);var wf=jr,Sf=ha,vf=Jr,Cf=Wn,bf=Kr,Ef=Lt,Rf=Vn;function Nt(s,e){if(Array.isArray(s))return s.map(n=>Nt(n));let{inputs:t,...r}=s;if(t){e=[];for(let n of t){let o={...n,__proto__:bf.prototype};o.map&&(o.map={...o.map,__proto__:Sf.prototype}),e.push(o)}}if(r.nodes&&(r.nodes=s.nodes.map(n=>Nt(n,e))),r.source){let{inputId:n,...o}=r.source;r.source=o,n!=null&&(r.source.input=e[n])}if(r.type==="root")return new Ef(r);if(r.type==="decl")return new wf(r);if(r.type==="rule")return new Rf(r);if(r.type==="comment")return new vf(r);if(r.type==="atrule")return new Cf(r);throw new Error("Unknown node type: "+s.type)}var If=Nt;Nt.default=Nt;var xf=Fn,Ua=jr,Af=Fa,_f=Ve,Gn=yf,Of=Yr,Df=If,za=Hn,Tf=Oa,Ha=Jr,Ba=Wn,Nf=Bn,Mf=Kr,kf=Yn,Pf=ka,Wa=Vn,Va=Lt,$f=Gr;function L(...s){return s.length===1&&Array.isArray(s[0])&&(s=s[0]),new Gn(s)}L.plugin=function(e,t){let r=!1;function n(...i){console&&console.warn&&!r&&(r=!0,console.warn(e+`: postcss.plugin was deprecated. Migration guide:
50
- https://evilmartians.com/chronicles/postcss-8-plugin-migration`),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(e+`: \u91CC\u9762 postcss.plugin \u88AB\u5F03\u7528. \u8FC1\u79FB\u6307\u5357:
51
- https://www.w3ctech.com/topic/2226`));let l=t(...i);return l.postcssPlugin=e,l.postcssVersion=new Gn().version,l}let o;return Object.defineProperty(n,"postcss",{get(){return o||(o=n()),o}}),n.process=function(i,l,a){return L([n(a)]).process(i,l)},n};L.stringify=Of;L.parse=kf;L.fromJSON=Df;L.list=Pf;L.comment=s=>new Ha(s);L.atRule=s=>new Ba(s);L.decl=s=>new Ua(s);L.rule=s=>new Wa(s);L.root=s=>new Va(s);L.document=s=>new za(s);L.CssSyntaxError=xf;L.Declaration=Ua;L.Container=_f;L.Processor=Gn;L.Document=za;L.Comment=Ha;L.Warning=Tf;L.AtRule=Ba;L.Result=Nf;L.Input=Mf;L.Rule=Wa;L.Root=Va;L.Node=$f;Af.registerPostcss(L);var Lf=L;L.default=L;var V=Kd(Lf);V.stringify;V.fromJSON;V.plugin;V.parse;V.list;V.document;V.comment;V.atRule;V.rule;V.decl;V.root;V.CssSyntaxError;V.Declaration;V.Container;V.Processor;V.Document;V.Comment;V.Warning;V.AtRule;V.Result;V.Input;V.Rule;V.Root;V.Node;var hn=class s{constructor(...e){pe(this,"parentElement",null),pe(this,"parentNode",null),pe(this,"ownerDocument"),pe(this,"firstChild",null),pe(this,"lastChild",null),pe(this,"previousSibling",null),pe(this,"nextSibling",null),pe(this,"ELEMENT_NODE",1),pe(this,"TEXT_NODE",3),pe(this,"nodeType"),pe(this,"nodeName"),pe(this,"RRNodeType")}get childNodes(){let e=[],t=this.firstChild;for(;t;)e.push(t),t=t.nextSibling;return e}contains(e){if(e instanceof s){if(e.ownerDocument!==this.ownerDocument)return!1;if(e===this)return!0}else return!1;for(;e.parentNode;){if(e.parentNode===this)return!0;e=e.parentNode}return!1}appendChild(e){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(e,t){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}},ii={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},ai={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},mr={};function jn(s){if(mr[s])return mr[s];let e=globalThis[s],t=e.prototype,r=s in ii?ii[s]:void 0,n=!!(r&&r.every(l=>{var a,u;return!!((u=(a=Object.getOwnPropertyDescriptor(t,l))==null?void 0:a.get)!=null&&u.toString().includes("[native code]"))})),o=s in ai?ai[s]:void 0,i=!!(o&&o.every(l=>{var a;return typeof t[l]=="function"&&((a=t[l])==null?void 0:a.toString().includes("[native code]"))}));if(n&&i)return mr[s]=e.prototype,e.prototype;try{let l=document.createElement("iframe");document.body.appendChild(l);let a=l.contentWindow;if(!a)return e.prototype;let u=a[s].prototype;return document.body.removeChild(l),u?mr[s]=u:t}catch{return t}}var Ds={};function ze(s,e,t){var r;let n=`${s}.${String(t)}`;if(Ds[n])return Ds[n].call(e);let o=jn(s),i=(r=Object.getOwnPropertyDescriptor(o,t))==null?void 0:r.get;return i?(Ds[n]=i,i.call(e)):e[t]}var Ts={};function Ya(s,e,t){let r=`${s}.${String(t)}`;if(Ts[r])return Ts[r].bind(e);let o=jn(s)[t];return typeof o!="function"?e[t]:(Ts[r]=o,o.bind(e))}function Ff(s){return ze("Node",s,"childNodes")}function Uf(s){return ze("Node",s,"parentNode")}function zf(s){return ze("Node",s,"parentElement")}function Hf(s){return ze("Node",s,"textContent")}function Bf(s,e){return Ya("Node",s,"contains")(e)}function Wf(s){return Ya("Node",s,"getRootNode")()}function Vf(s){return!s||!("host"in s)?null:ze("ShadowRoot",s,"host")}function Yf(s){return s.styleSheets}function Gf(s){return!s||!("shadowRoot"in s)?null:ze("Element",s,"shadowRoot")}function jf(s,e){return ze("Element",s,"querySelector")(e)}function Kf(s,e){return ze("Element",s,"querySelectorAll")(e)}function Ga(){return jn("MutationObserver").constructor}var D={childNodes:Ff,parentNode:Uf,parentElement:zf,textContent:Hf,contains:Bf,getRootNode:Wf,host:Vf,styleSheets:Yf,shadowRoot:Gf,querySelector:jf,querySelectorAll:Kf,mutationObserver:Ga};function oe(s,e,t=document){let r={capture:!0,passive:!0};return t.addEventListener(s,e,r),()=>t.removeEventListener(s,e,r)}var Xe=`Please stop import mirror directly. Instead of that,\r
1
+ var hn=Object.defineProperty;var fn=(e,t,r)=>t in e?hn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var de=(e,t,r)=>fn(e,typeof t!="symbol"?t+"":t,r);var pn={"Content-Type":"application/json"},gn=/\{[^{}]+\}/g,Yt=class extends Request{constructor(t,r){super(t,r);for(let o in r)o in this||(this[o]=r[o])}};function Vt(e){let{baseUrl:t="",fetch:r=globalThis.fetch,querySerializer:o,bodySerializer:n,headers:s,...a}={...e};t.endsWith("/")&&(t=t.substring(0,t.length-1)),s=Ur(pn,s);let c=[];async function i(u,d){let{fetch:l=r,headers:g,params:f={},parseAs:p="json",querySerializer:h,bodySerializer:C=n??yn,...I}=d||{},v=typeof o=="function"?o:Fr(o);h&&(v=typeof h=="function"?h:Fr({...typeof o=="object"?o:{},...h}));let y={redirect:"follow",...a,...I,headers:Ur(s,g,f.header)};y.body&&(y.body=C(y.body)),y.body instanceof FormData&&y.headers.delete("Content-Type");let _=new Yt(Sn(u,{baseUrl:t,params:f,querySerializer:v}),y),A={baseUrl:t,fetch:l,parseAs:p,querySerializer:v,bodySerializer:C};for(let w of c)if(w&&typeof w=="object"&&typeof w.onRequest=="function"){_.schemaPath=u,_.params=f;let D=await w.onRequest(_,A);if(D){if(!(D instanceof Request))throw new Error("Middleware must return new Request() when modifying the request");_=D}}let m=await l(_);for(let w=c.length-1;w>=0;w--){let D=c[w];if(D&&typeof D=="object"&&typeof D.onResponse=="function"){let L=await D.onResponse(m,A);if(L){if(!(L instanceof Response))throw new Error("Middleware must return new Response() when modifying the response");m=L}}}if(m.status===204||m.headers.get("Content-Length")==="0")return m.ok?{data:{},response:m}:{error:{},response:m};if(m.ok)return p==="stream"?{data:m.body,response:m}:{data:await m[p](),response:m};let E=await m.text();try{E=JSON.parse(E)}catch{}return{error:E,response:m}}return{async GET(u,d){return i(u,{...d,method:"GET"})},async PUT(u,d){return i(u,{...d,method:"PUT"})},async POST(u,d){return i(u,{...d,method:"POST"})},async DELETE(u,d){return i(u,{...d,method:"DELETE"})},async OPTIONS(u,d){return i(u,{...d,method:"OPTIONS"})},async HEAD(u,d){return i(u,{...d,method:"HEAD"})},async PATCH(u,d){return i(u,{...d,method:"PATCH"})},async TRACE(u,d){return i(u,{...d,method:"TRACE"})},use(...u){for(let d of u)if(d){if(typeof d!="object"||!("onRequest"in d||"onResponse"in d))throw new Error("Middleware must be an object with one of `onRequest()` or `onResponse()`");c.push(d)}},eject(...u){for(let d of u){let l=c.indexOf(d);l!==-1&&c.splice(l,1)}}}}function ct(e,t,r){if(t==null)return"";if(typeof t=="object")throw new Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");return`${e}=${r?.allowReserved===!0?t:encodeURIComponent(t)}`}function Hr(e,t,r){if(!t||typeof t!="object")return"";let o=[],n={simple:",",label:".",matrix:";"}[r.style]||"&";if(r.style!=="deepObject"&&r.explode===!1){for(let c in t)o.push(c,r.allowReserved===!0?t[c]:encodeURIComponent(t[c]));let a=o.join(",");switch(r.style){case"form":return`${e}=${a}`;case"label":return`.${a}`;case"matrix":return`;${e}=${a}`;default:return a}}for(let a in t){let c=r.style==="deepObject"?`${e}[${a}]`:a;o.push(ct(c,t[a],r))}let s=o.join(n);return r.style==="label"||r.style==="matrix"?`${n}${s}`:s}function Yr(e,t,r){if(!Array.isArray(t))return"";if(r.explode===!1){let s={form:",",spaceDelimited:"%20",pipeDelimited:"|"}[r.style]||",",a=(r.allowReserved===!0?t:t.map(c=>encodeURIComponent(c))).join(s);switch(r.style){case"simple":return a;case"label":return`.${a}`;case"matrix":return`;${e}=${a}`;default:return`${e}=${a}`}}let o={simple:",",label:".",matrix:";"}[r.style]||"&",n=[];for(let s of t)r.style==="simple"||r.style==="label"?n.push(r.allowReserved===!0?s:encodeURIComponent(s)):n.push(ct(e,s,r));return r.style==="label"||r.style==="matrix"?`${o}${n.join(o)}`:n.join(o)}function Fr(e){return function(r){let o=[];if(r&&typeof r=="object")for(let n in r){let s=r[n];if(s!=null){if(Array.isArray(s)){o.push(Yr(n,s,{style:"form",explode:!0,...e?.array,allowReserved:e?.allowReserved||!1}));continue}if(typeof s=="object"){o.push(Hr(n,s,{style:"deepObject",explode:!0,...e?.object,allowReserved:e?.allowReserved||!1}));continue}o.push(ct(n,s,e))}}return o.join("&")}}function mn(e,t){let r=e;for(let o of e.match(gn)??[]){let n=o.substring(1,o.length-1),s=!1,a="simple";if(n.endsWith("*")&&(s=!0,n=n.substring(0,n.length-1)),n.startsWith(".")?(a="label",n=n.substring(1)):n.startsWith(";")&&(a="matrix",n=n.substring(1)),!t||t[n]===void 0||t[n]===null)continue;let c=t[n];if(Array.isArray(c)){r=r.replace(o,Yr(n,c,{style:a,explode:s}));continue}if(typeof c=="object"){r=r.replace(o,Hr(n,c,{style:a,explode:s}));continue}if(a==="matrix"){r=r.replace(o,`;${ct(n,c)}`);continue}r=r.replace(o,a==="label"?`.${c}`:c)}return r}function yn(e){return JSON.stringify(e)}function Sn(e,t){let r=`${t.baseUrl}${e}`;t.params?.path&&(r=mn(r,t.params.path));let o=t.querySerializer(t.params.query??{});return o.startsWith("?")&&(o=o.substring(1)),o&&(r+=`?${o}`),r}function Ur(...e){let t=new Headers;for(let r of e){if(!r||typeof r!="object")continue;let o=r instanceof Headers?r.entries():Object.entries(r);for(let[n,s]of o)if(s===null)t.delete(n);else if(Array.isArray(s))for(let a of s)t.append(n,a);else s!==void 0&&t.set(n,s)}return t}var Q=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(Q||{}),De=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(De||{}),Wt=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(Wt||{});var vn="Adora.URLChange",Vr="Adora.Cohort",bn="Adora.AddCohort",Cn="Adora.Click";var Bt=["onclick","ondblclick","onmousedown","onmousemove","onmouseout","onmouseover","onmouseup","onchange","onfocus","onblur","onscroll","onselect","onsubmit","onkeydown","onkeypress","onkeyup","onload","onunload"];function Wr({dom0EventHandlers:e,delay:t,timestamp:r}){return{type:Q.Custom,data:{tag:Cn,payload:{dom0EventHandlers:e}},delay:t,timestamp:r}}function $e({payload:e,delay:t,timestamp:r}){return{type:Q.Custom,data:{tag:bn,payload:e},delay:t,timestamp:r}}function Br({href:e,delay:t,timestamp:r}){return{type:Q.Custom,data:{tag:vn,payload:{href:e}},delay:t,timestamp:r}}function ae(e){throw new Error(`This code path should be unreachable: ${e}`)}import{uuidv7 as Za}from"uuidv7";var id=1e3*60*30;var ad=10080*60*1e3;var Gr="https://c.adora-cdn.com";var ve=class{constructor(t){de(this,"backendClient");de(this,"eventPostBackendClient");this.backendClient=Gt({baseUrl:t??Gr})}getOrCreateEventPostClient(t){return!t.eventPostUrl||!t.eventPostToken?{path:t.sessionId,client:this.backendClient}:(this.eventPostBackendClient||(this.eventPostBackendClient=Gt({baseUrl:t.eventPostUrl})),{path:t.sessionId,client:this.eventPostBackendClient})}async sessionPreload({orgId:t}){return this.backendClient.POST("/sessions/preload",{body:{orgId:t},mode:"cors"}).catch(()=>{})}async startSession({bypassSampling:t,orgId:r,language:o,domain:n,userCohorts:s,uid:a,devicePixelRatio:c,adoraUserId:i,userAgent:u,documentReferrer:d,snippetVersion:l}){return this.backendClient.POST("/sessions/start",{body:{bypassSampling:t,orgId:r,language:o,domain:n,devicePixelRatio:c,userCohorts:s||{},userAgent:u,uid:typeof a=="number"?a.toString():a!=="null"&&a!=="undefined"?a:void 0,adoraUserId:i,documentReferrer:d,snippetVersion:l},mode:"cors"}).catch(()=>{})}async gzipWithCompressionStream(t){let r=JSON.stringify(t),n=new TextEncoder().encode(r),s=new CompressionStream("gzip"),c=new ReadableStream({start(u){u.enqueue(n),u.close()}}).pipeThrough(s);return new Response(c).arrayBuffer()}async saveSessionEvents({sessionId:t,events:r,metadata:o,eventPostUrl:n,eventPostToken:s,fastpathToken:a}){let{path:c,client:i}=this.getOrCreateEventPostClient({sessionId:t,eventPostToken:s,eventPostUrl:n}),u={events:r.slice(),metadata:o,fastpathToken:a},d={params:{path:{sessionId:c}},headers:s?{token:s}:void 0};if(typeof CompressionStream<"u"){let l=await this.gzipWithCompressionStream(u);return i.POSTGzipped("/sessions/{sessionId}/events",{...d,body:l}).catch(()=>{})}return i.POST("/sessions/{sessionId}/events",{...d,body:u}).catch(()=>{})}async refreshEventToken(t){return await this.backendClient.POST("/sessions/{sessionId}/events/token",{params:{path:{sessionId:t.sessionId}},body:{},mode:"cors"}).catch(()=>{})}async syncSession(t){return await this.backendClient.POST("/sessions/{sessionId}/sync",{params:{path:{sessionId:t.sessionId}}}).catch(()=>{})}};import{makeRe as Mn,minimatch as kn}from"minimatch";function Ln(e){return e.endsWith("$")&&(e=e.substring(0,e.length-1)),(e.endsWith("+?")||e.endsWith("*?"))&&(e=e.substring(0,e.length-1)),e}function Le(e,t){let r=t.replace||t.path;switch(t.type){case"regexp":{let o=(t.path.startsWith("^")?"":"^")+t.path+(!t.path.endsWith("$")&&!t.partial?"$":""),n=new RegExp(o);return n.test(e)?t.partial?e.replace(n,r):r:void 0}case"wildcard":case void 0:if(t.partial){let o=Mn(t.path,{partial:t.partial,dot:!0});if(!o)throw new Error("unable to make regexp");let n=new RegExp(Ln(o.source));return n.test(e)?e.replace(n,r):void 0}return kn(e,t.path,{dot:!0})?r:void 0;default:ae(t.type)}}var Kt;(function(e){e.GOAL_SURVEY_FINISHED="goal_survey_finished",e.WELCOME_DIALOG_FINISHED="welcome_dialog_finished"})(Kt||(Kt={}));var jt;(function(e){e.EXPLORE_AND_VISUALIZE="Explore and visualize",e.MEASURE_AND_OPTIMIZE="Measure and optimize",e.IDENTIFY_FRICTION="Identify friction",e.DIAGNOSE_ISSUES="Diagnose issues"})(jt||(jt={}));var $t;(function(e){e.SKIPPED="skipped",e.COMPLETED="completed"})($t||($t={}));var Zt;(function(e){e.NONE="none",e.NEW_USER_GOAL_SURVEY="new_user_goal_survey",e.EXISTING_USER_WELCOME_DIALOG="existing_user_welcome_dialog"})(Zt||(Zt={}));var Gt=e=>({...Vt(e),POSTGzipped:async(r,o)=>{if(!o?.body)throw new Error("Body is required for gzipped requests");let n={...o.headers,"Content-Type":"application/json","Content-Encoding":"gzip"},s=r;o.params?.path&&Object.entries(o.params.path).forEach(([i,u])=>{s=s.replace(`{${i}}`,u)});let a=await fetch(`${e.baseUrl}${s}`,{method:"POST",headers:n,body:o.body});if(!a.ok){let i=await a.text();try{i=JSON.parse(i)}catch{}return{data:void 0,error:i,response:a}}return{data:await a.json(),error:void 0,response:a}}});import{strictDeepEqual as Yi}from"fast-equals";import Ft from"js-cookie";import{uuidv7 as Vi}from"uuidv7";var ut=class{constructor(t,r){this.storage=r;this.eventStorageKey=t==="adoraSessionScript"?"adoraEventsScript":"adoraEventsExtension"}getEvents(){let t=this.storage.getItem(this.eventStorageKey);return t?JSON.parse(t):null}setEvents(t){this.storage.setItem(this.eventStorageKey,JSON.stringify(t))}removeEvents(){this.storage.removeItem(this.eventStorageKey)}};function Jt(e){return`${e}-rate-limit-timestamp`}var Ie=class{constructor(t,r){this.sessionType=t;this.storage=r}get lastRateLimitedTimestamp(){let t=this.storage.getItem(Jt(this.sessionType));if(Pn(t))return t}clearLastRateLimitedTimestamp(){this.storage.removeItem(Jt(this.sessionType))}setLastRateLimitedTimestamp(t){this.storage.setItem(Jt(this.sessionType),t.toString())}getSession(){let t=this.storage.getItem(this.sessionType);return t?JSON.parse(t):null}setSession(t){this.storage.setItem(this.sessionType,JSON.stringify(t))}removeSession(){this.storage.removeItem(this.sessionType)}};function Pn(e){return!isNaN(Number(e))}function b(e,...t){(typeof window=="object"&&window.enableAdoraDebugLogs||typeof window=="object"&&window.localStorage.getItem("enableAdoraDebugLogs"))&&console.log(e,...t)}var be=class{getItem(t){if(!Xt())return null;try{return window.sessionStorage.getItem(t)}catch{return null}}setItem(t,r){if(!Xt())return null;try{return window.sessionStorage.setItem(t,r)}catch{return null}}removeItem(t){if(!Xt())return null;try{return window.sessionStorage.removeItem(t)}catch{return null}}};function Xt(){return typeof window.sessionStorage=="object"}var lt="v0.0.1";var Kr=async(e,t,r)=>{let o=new Ie(e,new be),n=new ve(r.backendUrl),s=await Fn(n,r,t);return s.type==="success"&&o.setSession(s.storedSession),s};async function Fn(e,t,r){try{b("starting session over network",{uid:t.uid,userCohorts:t.userCohorts||{}});let o=await e.startSession({bypassSampling:t.bypassSampling,orgId:t.orgId,language:t.language||navigator.language,domain:new URL(window.location.href).hostname,userCohorts:t.userCohorts||{},uid:t.uid,devicePixelRatio:window.devicePixelRatio,adoraUserId:r,documentReferrer:document.referrer,snippetVersion:lt});if(!o)return{type:"error",code:void 0};if(o.error)return{type:"error",code:o.error.code};if(o.response.status!==201)return b("session not created, aborting"),{type:"error",code:"code"in o.data?o.data.code:void 0};if(o.data&&"scheduledDowntime"in o.data)return b("scheduled downtime, exiting"),{type:"error",code:void 0};if(!o.data||!("session"in o.data))return b("malformed session, exiting"),{type:"error",code:void 0};let{session:n,organization:s,eventPostUrl:a,eventPostToken:c}=o.data;return{type:"success",storedSession:{id:n.id,createdAt:n.createdAt,status:n.status,lastSyncedAt:n.lastSyncedAt,domain:n.domain,requestIp:n.requestIp,country:n.country,userAgent:n.userAgent,language:n.language,initialUserCohorts:n.initialUserCohorts,devicePixelRatio:n.devicePixelRatio,organization:s,documentReferrer:n.documentReferrer,canvasRecordingEnabled:n.canvasRecordingEnabled||!1,adoraUserId:r,settings:t,eventPostUrl:a,eventPostToken:c,limitedCanvasRecording:n.limitedCanvasRecording||!1,compressionType:n.compressionType}}}catch{return{type:"error",code:void 0}}}import*as Ge from"web-vitals";var jr="__STATSIG__",Un="statsig@@",$r=e=>{try{if(!e[jr])return;let t=e[jr];if(!Yn(t))return;let r={};return Object.values(t.instances).forEach(o=>{o._logger?._lastExposureTimeMap&&Object.keys(o._logger?._lastExposureTimeMap).forEach(n=>{let s=Hn(n);if(!s)return;let a=o.getExperiment(s);Bn(a)&&(r[Un+a.name]=a.groupName)})}),r}catch{return}},Hn=e=>{let t=e.split("|");if(t.length>3)return t[3]};function Yn(e){if(!e||typeof e!="object"||!("instances"in e)||typeof e.instances!="object"||!e.instances)return!1;let t=Object.values(e.instances);for(let r of t)if(!Vn(r))return!1;return!0}function Vn(e){return!e||typeof e!="object"?!1:"_logger"in e&&typeof e._logger=="object"&&Wn(e._logger)&&"_sdkKey"in e&&typeof e._sdkKey=="string"&&"getExperiment"in e&&typeof e.getExperiment=="function"}function Wn(e){return!e||typeof e!="object"?!1:"_lastExposureTimeMap"in e&&typeof e._lastExposureTimeMap=="object"}function Bn(e){return!e||typeof e!="object"?!1:"name"in e&&typeof e.name=="string"&&"groupName"in e&&typeof e.groupName=="string"}function ht(e,t){if(!t.windowGetters)return;let r={};if(t.windowGetters.forEach(({key:o,paths:n})=>{let s=zn(e,n);s&&(r[o]=s)}),Object.keys(r).length!==0)return r}function zn(e,t){if(typeof e>"u")return;let r=e;for(let n=0;n<t.length-1;n++)if(r=r[t[n]],typeof r!="object")return;let o=r[t[t.length-1]];if(typeof o=="string")return o;if(typeof o=="boolean"||typeof o=="number")return o.toString()}function qt(e){return $r(e)}var Gn=Object.defineProperty,Kn=(e,t,r)=>t in e?Gn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,S=(e,t,r)=>Kn(e,typeof t!="symbol"?t+"":t,r),Zr,jn=Object.defineProperty,$n=(e,t,r)=>t in e?jn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Jr=(e,t,r)=>$n(e,typeof t!="symbol"?t+"":t,r),K=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(K||{}),Xr={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},qr={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},ft={};function vr(e){if(ft[e])return ft[e];let t=globalThis[e],r=t.prototype,o=e in Xr?Xr[e]:void 0,n=!!(o&&o.every(c=>{var i,u;return!!((u=(i=Object.getOwnPropertyDescriptor(r,c))==null?void 0:i.get)!=null&&u.toString().includes("[native code]"))})),s=e in qr?qr[e]:void 0,a=!!(s&&s.every(c=>{var i;return typeof r[c]=="function"&&((i=r[c])==null?void 0:i.toString().includes("[native code]"))}));if(n&&a)return ft[e]=t.prototype,t.prototype;try{let c=document.createElement("iframe");document.body.appendChild(c);let i=c.contentWindow;if(!i)return t.prototype;let u=i[e].prototype;return document.body.removeChild(c),u?ft[e]=u:r}catch{return r}}var Qt={};function Re(e,t,r){var o;let n=`${e}.${String(r)}`;if(Qt[n])return Qt[n].call(t);let s=vr(e),a=(o=Object.getOwnPropertyDescriptor(s,r))==null?void 0:o.get;return a?(Qt[n]=a,a.call(t)):t[r]}var er={};function mo(e,t,r){let o=`${e}.${String(r)}`;if(er[o])return er[o].bind(t);let s=vr(e)[r];return typeof s!="function"?t[r]:(er[o]=s,s.bind(t))}function Zn(e){return Re("Node",e,"childNodes")}function Jn(e){return Re("Node",e,"parentNode")}function Xn(e){return Re("Node",e,"parentElement")}function qn(e){return Re("Node",e,"textContent")}function Qn(e,t){return mo("Node",e,"contains")(t)}function es(e){return mo("Node",e,"getRootNode")()}function ts(e){return!e||!("host"in e)?null:Re("ShadowRoot",e,"host")}function rs(e){return e.styleSheets}function os(e){return!e||!("shadowRoot"in e)?null:Re("Element",e,"shadowRoot")}function ns(e,t){return Re("Element",e,"querySelector")(t)}function ss(e,t){return Re("Element",e,"querySelectorAll")(t)}function is(){return vr("MutationObserver").constructor}var q={childNodes:Zn,parentNode:Jn,parentElement:Xn,textContent:qn,contains:Qn,getRootNode:es,host:ts,styleSheets:rs,shadowRoot:os,querySelector:ns,querySelectorAll:ss,mutationObserver:is};function yo(e){return e.nodeType===e.ELEMENT_NODE}function Je(e){let t=e&&"host"in e&&"mode"in e&&q.host(e)||null;return!!(t&&"shadowRoot"in t&&q.shadowRoot(t)===e)}function Xe(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function as(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),e}function ds(e){let{cssText:t}=e;if(t.split('"').length<3)return t;let r=["@import",`url(${JSON.stringify(e.href)})`];return e.layerName===""?r.push("layer"):e.layerName&&r.push(`layer(${e.layerName})`),e.supportsText&&r.push(`supports(${e.supportsText})`),e.media.length&&r.push(e.media.mediaText),r.join(" ")+";"}function ir(e){try{let t=e.rules||e.cssRules;if(!t)return null;let r=e.href;!r&&e.ownerNode&&e.ownerNode.ownerDocument&&(r=e.ownerNode.ownerDocument.location.href);let o=Array.from(t,n=>So(n,r)).join("");return as(o)}catch{return null}}function So(e,t){if(us(e)){let r;try{r=ir(e.styleSheet)||ds(e)}catch{r=e.cssText}return e.styleSheet.href?Ct(r,e.styleSheet.href):r}else{let r=e.cssText;return ls(e)&&e.selectorText.includes(":")&&(r=cs(r)),t?Ct(r,t):r}}function cs(e){let t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function us(e){return"styleSheet"in e}function ls(e){return"selectorText"in e}var vt=class{constructor(){Jr(this,"idNodeMap",new Map),Jr(this,"nodeMetaMap",new WeakMap)}getId(t){var r;return t?((r=this.getMeta(t))==null?void 0:r.id)??-1:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){let r=this.getId(t);this.idNodeMap.delete(r),t.childNodes&&t.childNodes.forEach(o=>this.removeNodeFromMap(o))}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,r){let o=r.id;this.idNodeMap.set(o,t),this.nodeMetaMap.set(t,r)}replace(t,r){let o=this.getNode(t);if(o){let n=this.nodeMetaMap.get(o);n&&this.nodeMetaMap.set(r,n)}this.idNodeMap.set(t,r)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function hs(){return new vt}function bt({element:e,maskInputOptions:t,tagName:r,type:o,value:n,maskInputFn:s}){let a=n||"",c=o&&Ne(o);return(t[r.toLowerCase()]||c&&t[c])&&(s?a=s(a,e):a="*".repeat(a.length)),a}function Ne(e){return e.toLowerCase()}var Qr="__rrweb_original__";function fs(e){let t=e.getContext("2d");if(!t)return!0;let r=50;for(let o=0;o<e.width;o+=r)for(let n=0;n<e.height;n+=r){let s=t.getImageData,a=Qr in s?s[Qr]:s;if(new Uint32Array(a.call(t,o,n,Math.min(r,e.width-o),Math.min(r,e.height-n)).data.buffer).some(i=>i!==0))return!1}return!0}function br(e){let t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?Ne(t):null}function vo(e,t){let r;try{r=new URL(e,t??window.location.href)}catch{return null}let o=/\.([0-9a-z]+)(?:$)/i,n=r.pathname.match(o);return n?.[1]??null}function ps(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var gs=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,ms=/^(?:[a-z+]+:)?\/\//i,ys=/^www\..*/i,Ss=/^(data:)([^,]*),(.*)/i;function Ct(e,t){return(e||"").replace(gs,(r,o,n,s,a,c)=>{let i=n||a||c,u=o||s||"";if(!i)return r;if(ms.test(i)||ys.test(i))return`url(${u}${i}${u})`;if(Ss.test(i))return`url(${u}${i}${u})`;if(i[0]==="/")return`url(${u}${ps(t)+i}${u})`;let d=t.split("/"),l=i.split("/");d.pop();for(let g of l)g!=="."&&(g===".."?d.pop():d.push(g));return`url(${u}${d.join("/")}${u})`})}function tr(e){return e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"")}function vs(e,t){let r=Array.from(t.childNodes),o=[];if(r.length>1&&e&&typeof e=="string"){let n=tr(e);for(let s=1;s<r.length;s++)if(r[s].textContent&&typeof r[s].textContent=="string"){let a=tr(r[s].textContent);for(let c=3;c<a.length;c++){let i=a.substring(0,c);if(n.split(i).length===2){let u=n.indexOf(i);for(let d=u;d<e.length;d++)if(tr(e.substring(0,d)).length===u){o.push(e.substring(0,d)),e=e.substring(d);break}break}}}}return o.push(e),o}function bs(e,t){return vs(e,t).join("/* rr_split */")}var Cs=1,ws=new RegExp("[^a-z0-9-_:]"),Qe=-2;function bo(){return Cs++}function Es(e){if(e instanceof HTMLFormElement)return"form";let t=Ne(e.tagName);return ws.test(t)?"div":t}var Pe,eo,Is=/^[^ \t\n\r\u000c]+/,_s=/^[, \t\n\r\u000c]+/;function Rs(e,t){if(t.trim()==="")return t;let r=0;function o(s){let a,c=s.exec(t.substring(r));return c?(a=c[0],r+=a.length,a):""}let n=[];for(;o(_s),!(r>=t.length);){let s=o(Is);if(s.slice(-1)===",")s=He(e,s.substring(0,s.length-1)),n.push(s);else{let a="";s=He(e,s);let c=!1;for(;;){let i=t.charAt(r);if(i===""){n.push((s+a).trim());break}else if(c)i===")"&&(c=!1);else if(i===","){r+=1,n.push((s+a).trim());break}else i==="("&&(c=!0);a+=i,r+=1}}}return n.join(", ")}var to=new WeakMap;function He(e,t){return!t||t.trim()===""?t:Cr(e,t)}function As(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function Cr(e,t){let r=to.get(e);if(r||(r=e.createElement("a"),to.set(e,r)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return r.setAttribute("href",t),r.href}function Co(e,t,r,o){return o&&(r==="src"||r==="href"&&!(t==="use"&&o[0]==="#")||r==="xlink:href"&&o[0]!=="#"||r==="background"&&(t==="table"||t==="td"||t==="th")?He(e,o):r==="srcset"?Rs(e,o):r==="style"?Ct(o,Cr(e)):t==="object"&&r==="data"?He(e,o):o)}function wo(e,t,r){return(e==="video"||e==="audio")&&t==="autoplay"}function Ds(e,t,r,o){try{if(typeof t=="string"){if(e.classList.contains(t))return!0}else for(let n=e.classList.length;n--;){let s=e.classList[n];if(t.test(s))return!0}if(r)return e.matches(r);if(o&&e.tagName==="IMG"){let n=e.getAttribute("src");if(n&&o.test(n))return!0}}catch{}return!1}function wt(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return r?wt(q.parentNode(e),t,r):!1;for(let o=e.classList.length;o--;){let n=e.classList[o];if(t.test(n))return!0}return r?wt(q.parentNode(e),t,r):!1}function Eo(e,t,r,o){let n;if(yo(e)){if(n=e,!q.childNodes(n).length)return!1}else{if(q.parentElement(e)===null)return!1;n=q.parentElement(e)}try{if(typeof t=="string"){if(o){if(n.closest(`.${t}`))return!0}else if(n.classList.contains(t))return!0}else if(wt(n,t,o))return!0;if(r){if(o){if(n.closest(r))return!0}else if(n.matches(r))return!0}if(n.getAttribute("contenteditable")||n.closest('[contenteditable="true"]'))return!0}catch{}return!1}function Ts(e,t,r){let o=e.contentWindow;if(!o)return;let n=!1,s;try{s=o.document.readyState}catch{return}if(s!=="complete"){let c=setTimeout(()=>{n||(t(),n=!0)},r);e.addEventListener("load",()=>{clearTimeout(c),n=!0,t()});return}let a="about:blank";if(o.location.href!==a||e.src===a||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}function Ns(e,t,r){let o=!1,n;try{n=e.sheet}catch{return}if(n)return;let s=setTimeout(()=>{o||(t(),o=!0)},r);e.addEventListener("load",()=>{clearTimeout(s),o=!0,t()})}function Os(e,t){let{doc:r,mirror:o,blockClass:n,blockSelector:s,needsMask:a,inlineStylesheet:c,maskInputOptions:i={},maskTextFn:u,maskInputFn:d,maskAnchorHrefFn:l,blockImgSrcPattern:g,blockImgSrcFillOptions:f,dataURLOptions:p={},inlineImages:h,recordCanvas:C,keepIframeSrcFn:I,newlyAddedElement:v=!1,cssCaptured:y=!1}=t,_=xs(r,o);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:K.Document,childNodes:[],compatMode:e.compatMode}:{type:K.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:K.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:_};case e.ELEMENT_NODE:return ks(e,{doc:r,blockClass:n,blockSelector:s,inlineStylesheet:c,maskInputOptions:i,maskInputFn:d,maskAnchorHrefFn:l,blockImgSrcPattern:g,blockImgSrcFillOptions:f,dataURLOptions:p,inlineImages:h,recordCanvas:C,keepIframeSrcFn:I,newlyAddedElement:v,rootId:_});case e.TEXT_NODE:return Ms(e,{doc:r,needsMask:a,maskTextFn:u,rootId:_,cssCaptured:y});case e.CDATA_SECTION_NODE:return{type:K.CDATA,textContent:"",rootId:_};case e.COMMENT_NODE:return{type:K.Comment,textContent:q.textContent(e)||"",rootId:_};default:return!1}}function xs(e,t){if(!t.hasNode(e))return;let r=t.getId(e);return r===1?void 0:r}function Ms(e,t){let{needsMask:r,maskTextFn:o,rootId:n,cssCaptured:s}=t,a=q.parentNode(e),c=a&&a.tagName,i="",u=c==="STYLE"?!0:void 0,d=c==="SCRIPT"?!0:void 0;return d?i="SCRIPT_PLACEHOLDER":s||(i=q.textContent(e),u&&i&&(i=Ct(i,Cr(t.doc)))),!u&&!d&&i&&r&&(i=o?o(i,q.parentElement(e)):i.replace(/[\S]/g,"*")),{type:K.Text,textContent:i||"",rootId:n}}function ks(e,t){let{doc:r,blockClass:o,blockSelector:n,inlineStylesheet:s,maskInputOptions:a={},maskInputFn:c,maskAnchorHrefFn:i,blockImgSrcPattern:u,blockImgSrcFillOptions:d,dataURLOptions:l={},inlineImages:g,recordCanvas:f,keepIframeSrcFn:p,newlyAddedElement:h=!1,rootId:C}=t,I=Ds(e,o,n,u),v=Es(e),y={},_=e.attributes.length;for(let m=0;m<_;m++){let E=e.attributes[m];wo(v,E.name,E.value)||(y[E.name]=Co(r,v,Ne(E.name),E.value))}if(v==="a"&&i&&typeof y.href=="string"&&(y.href=i(y.href,e)),v==="link"&&s){let m=Array.from(r.styleSheets).find(w=>w.href===e.href);if(!m&&e.href.includes(".css")){let w=window.location.origin,D=e.href.replace(window.location.href,""),L=w+"/"+D;m=Array.from(r.styleSheets).find(oe=>oe.href===L)}let E=null;m&&(E=ir(m)),E&&(delete y.rel,delete y.href,y._cssText=E)}if(v==="style"&&e.sheet){let m=ir(e.sheet);m&&(e.childNodes.length>1&&(m=bs(m,e)),y._cssText=m)}if(v==="input"||v==="textarea"||v==="select"){let m=e.value,E=e.checked;y.type!=="radio"&&y.type!=="checkbox"&&y.type!=="submit"&&y.type!=="button"&&m?y.value=bt({element:e,type:br(e),tagName:v,value:m,maskInputOptions:a,maskInputFn:c}):E&&(y.checked=E)}if(v==="option"&&(e.selected&&!a.select?y.selected=!0:delete y.selected),v==="dialog"&&e.open&&(y.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"),v==="canvas"&&f){if(e.__context==="2d")fs(e)||(y.rr_dataURL=e.toDataURL(l.type,l.quality));else if(!("__context"in e)){let m=e.toDataURL(l.type,l.quality),E=r.createElement("canvas");E.width=e.width,E.height=e.height;let w=E.toDataURL(l.type,l.quality);m!==w&&(y.rr_dataURL=m)}}if(v==="img"&&g){Pe||(Pe=r.createElement("canvas"),eo=Pe.getContext("2d"));let m=e,E=m.currentSrc||m.getAttribute("src")||"<unknown-src>",w=m.crossOrigin,D=()=>{m.removeEventListener("load",D);try{Pe.width=m.naturalWidth,Pe.height=m.naturalHeight,eo.drawImage(m,0,0),y.rr_dataURL=Pe.toDataURL(l.type,l.quality)}catch(L){if(m.crossOrigin!=="anonymous"){m.crossOrigin="anonymous",m.complete&&m.naturalWidth!==0?D():m.addEventListener("load",D);return}else console.warn(`Cannot inline img src=${E}! Error: ${L}`)}m.crossOrigin==="anonymous"&&(w?y.crossOrigin=w:m.removeAttribute("crossorigin"))};m.complete&&m.naturalWidth!==0?D():m.addEventListener("load",D)}if(v==="audio"||v==="video"){let m=y;m.rr_mediaState=e.paused?"paused":"played",m.rr_mediaCurrentTime=e.currentTime,m.rr_mediaPlaybackRate=e.playbackRate,m.rr_mediaMuted=e.muted,m.rr_mediaLoop=e.loop,m.rr_mediaVolume=e.volume}if(h||(e.scrollLeft&&(y.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(y.rr_scrollTop=e.scrollTop)),I){let{width:m,height:E}=e.getBoundingClientRect();y={class:y.class,rr_width:`${m}px`,rr_height:`${E}px`}}I&&v==="img"&&(y={...y,src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP89v3nfwAJuAPnyTr4jAAAAABJRU5ErkJggg==",rr_fill:d.backgroundColor,rr_stroke:d.strokeColor,rr_stroke_width:d.strokeWidth}),v==="iframe"&&!p(y.src)&&(e.contentDocument||(y.rr_src=y.src),delete y.src);let A;try{customElements.get(v)&&(A=!0)}catch{}return{type:K.Element,tagName:v,attributes:y,childNodes:[],isSVG:As(e)||void 0,needBlock:I,rootId:C,isCustom:A}}function U(e){return e==null?"":e.toLowerCase()}function Ls(e,t){if(t.comment&&e.type===K.Comment)return!0;if(e.type===K.Element){if(t.script&&(e.tagName==="script"||e.tagName==="link"&&(e.attributes.rel==="preload"||e.attributes.rel==="modulepreload")&&e.attributes.as==="script"||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&vo(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(U(e.attributes.name).match(/^msapplication-tile(image|color)$/)||U(e.attributes.name)==="application-name"||U(e.attributes.rel)==="icon"||U(e.attributes.rel)==="apple-touch-icon"||U(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&U(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(U(e.attributes.property).match(/^(og|twitter|fb):/)||U(e.attributes.name).match(/^(og|twitter):/)||U(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(U(e.attributes.name)==="robots"||U(e.attributes.name)==="googlebot"||U(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(U(e.attributes.name)==="author"||U(e.attributes.name)==="generator"||U(e.attributes.name)==="framework"||U(e.attributes.name)==="publisher"||U(e.attributes.name)==="progid"||U(e.attributes.property).match(/^article:/)||U(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(U(e.attributes.name)==="google-site-verification"||U(e.attributes.name)==="yandex-verification"||U(e.attributes.name)==="csrf-token"||U(e.attributes.name)==="p:domain_verify"||U(e.attributes.name)==="verify-v1"||U(e.attributes.name)==="verification"||U(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function Ye(e,t){if(e.nodeName.toLowerCase().includes("grammarly"))return null;let{doc:r,mirror:o,blockClass:n,blockSelector:s,maskTextClass:a,maskTextSelector:c,skipChild:i=!1,inlineStylesheet:u=!0,maskInputOptions:d={},maskTextFn:l,maskInputFn:g,maskAnchorHrefFn:f,blockImgSrcPattern:p,blockImgSrcFillOptions:h,slimDOMOptions:C,dataURLOptions:I={},inlineImages:v=!1,recordCanvas:y=!1,onSerialize:_,onIframeLoad:A,iframeLoadTimeout:m=5e3,onStylesheetLoad:E,stylesheetLoadTimeout:w=5e3,keepIframeSrcFn:D=()=>!1,newlyAddedElement:L=!1,cssCaptured:oe=!1}=t,{needsMask:H}=t,{preserveWhiteSpace:ne=!0}=t;H||(H=Eo(e,a,c,H===void 0));let G=Os(e,{doc:r,mirror:o,blockClass:n,blockSelector:s,needsMask:H,inlineStylesheet:u,maskInputOptions:d,maskTextFn:l,maskInputFn:g,maskAnchorHrefFn:f,blockImgSrcPattern:p,blockImgSrcFillOptions:h,dataURLOptions:I,inlineImages:v,recordCanvas:y,keepIframeSrcFn:D,newlyAddedElement:L,cssCaptured:oe});if(!G)return console.warn(e,"not serialized"),null;let V;o.hasNode(e)?V=o.getId(e):Ls(G,C)||!ne&&G.type===K.Text&&!G.textContent.replace(/^\s+|\s+$/gm,"").length?V=Qe:V=bo();let R=Object.assign(G,{id:V});if(o.add(e,R),V===Qe)return null;_&&_(e);let Y=!i;if(R.type===K.Element){Y=Y&&!R.needBlock,delete R.needBlock;let P=q.shadowRoot(e);P&&Xe(P)&&(R.isShadowHost=!0)}if((R.type===K.Document||R.type===K.Element)&&Y){C.headWhitespace&&R.type===K.Element&&R.tagName==="head"&&(ne=!1);let P={doc:r,mirror:o,blockClass:n,blockSelector:s,needsMask:H,maskTextClass:a,maskTextSelector:c,skipChild:i,inlineStylesheet:u,maskInputOptions:d,maskTextFn:l,maskInputFn:g,maskAnchorHrefFn:f,blockImgSrcPattern:p,blockImgSrcFillOptions:h,slimDOMOptions:C,dataURLOptions:I,inlineImages:v,recordCanvas:y,preserveWhiteSpace:ne,onSerialize:_,onIframeLoad:A,iframeLoadTimeout:m,onStylesheetLoad:E,stylesheetLoadTimeout:w,keepIframeSrcFn:D,cssCaptured:!1};if(!(R.type===K.Element&&R.tagName==="textarea"&&R.attributes.value!==void 0)){R.type===K.Element&&R.attributes._cssText!==void 0&&typeof R.attributes._cssText=="string"&&(P.cssCaptured=!0);for(let j of Array.from(q.childNodes(e))){let J=Ye(j,P);J&&R.childNodes.push(J)}}let Z=null;if(yo(e)&&(Z=q.shadowRoot(e)))for(let j of Array.from(q.childNodes(Z))){let J=Ye(j,P);J&&(Xe(Z)&&(J.isShadow=!0),R.childNodes.push(J))}}let $=q.parentNode(e);return $&&Je($)&&Xe($)&&(R.isShadow=!0),R.type===K.Element&&R.tagName==="iframe"&&Ts(e,()=>{let P=e.contentDocument;if(P&&A){let Z=Ye(P,{doc:P,mirror:o,blockClass:n,blockSelector:s,needsMask:H,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:u,maskInputOptions:d,maskTextFn:l,maskInputFn:g,maskAnchorHrefFn:f,blockImgSrcPattern:p,blockImgSrcFillOptions:h,slimDOMOptions:C,dataURLOptions:I,inlineImages:v,recordCanvas:y,preserveWhiteSpace:ne,onSerialize:_,onIframeLoad:A,iframeLoadTimeout:m,onStylesheetLoad:E,stylesheetLoadTimeout:w,keepIframeSrcFn:D});Z&&A(e,Z)}},m),R.type===K.Element&&R.tagName==="link"&&typeof R.attributes.rel=="string"&&(R.attributes.rel==="stylesheet"||R.attributes.rel==="preload"&&typeof R.attributes.href=="string"&&vo(R.attributes.href)==="css")&&Ns(e,()=>{if(E){let P=Ye(e,{doc:r,mirror:o,blockClass:n,blockSelector:s,needsMask:H,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:u,maskInputOptions:d,maskTextFn:l,maskInputFn:g,maskAnchorHrefFn:f,blockImgSrcPattern:p,blockImgSrcFillOptions:h,slimDOMOptions:C,dataURLOptions:I,inlineImages:v,recordCanvas:y,preserveWhiteSpace:ne,onSerialize:_,onIframeLoad:A,iframeLoadTimeout:m,onStylesheetLoad:E,stylesheetLoadTimeout:w,keepIframeSrcFn:D});P&&E(e,P)}},w),R}function Ps(e,t){let{mirror:r=new vt,blockClass:o="rr-block",blockSelector:n=null,maskTextClass:s="rr-mask",maskTextSelector:a=null,inlineStylesheet:c=!0,inlineImages:i=!1,recordCanvas:u=!1,maskAllInputs:d=!1,maskTextFn:l,maskInputFn:g,maskAnchorHrefFn:f,blockImgSrcPattern:p=null,blockImgSrcFillOptions:h={backgroundColor:"#F6F7F9",strokeColor:"#E9EBEF",strokeWidth:"1px"},slimDOM:C=!1,dataURLOptions:I,preserveWhiteSpace:v,onSerialize:y,onIframeLoad:_,iframeLoadTimeout:A,onStylesheetLoad:m,stylesheetLoadTimeout:E,keepIframeSrcFn:w=()=>!1}=t||{};return Ye(e,{doc:e,mirror:r,blockClass:o,blockSelector:n,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:d===!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}:d===!1?{password:!0}:d,maskTextFn:l,maskInputFn:g,maskAnchorHrefFn:f,blockImgSrcPattern:p,blockImgSrcFillOptions:h,slimDOMOptions:C===!0||C==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:C==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:C===!1?{}:C,dataURLOptions:I,inlineImages:i,recordCanvas:u,preserveWhiteSpace:v,onSerialize:y,onIframeLoad:_,iframeLoadTimeout:A,onStylesheetLoad:m,stylesheetLoadTimeout:E,keepIframeSrcFn:w,newlyAddedElement:!1})}var ar=class e{constructor(...t){__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 t=[],r=this.firstChild;for(;r;)t.push(r),r=r.nextSibling;return t}contains(t){if(t instanceof e){if(t.ownerDocument!==this.ownerDocument)return!1;if(t===this)return!0}else return!1;for(;t.parentNode;){if(t.parentNode===this)return!0;t=t.parentNode}return!1}appendChild(t){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(t,r){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(t){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}},ro={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},oo={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},pt={};function wr(e){if(pt[e])return pt[e];let t=globalThis[e],r=t.prototype,o=e in ro?ro[e]:void 0,n=!!(o&&o.every(c=>{var i,u;return!!((u=(i=Object.getOwnPropertyDescriptor(r,c))==null?void 0:i.get)!=null&&u.toString().includes("[native code]"))})),s=e in oo?oo[e]:void 0,a=!!(s&&s.every(c=>{var i;return typeof r[c]=="function"&&((i=r[c])==null?void 0:i.toString().includes("[native code]"))}));if(n&&a)return pt[e]=t.prototype,t.prototype;try{let c=document.createElement("iframe");document.body.appendChild(c);let i=c.contentWindow;if(!i)return t.prototype;let u=i[e].prototype;return document.body.removeChild(c),u?pt[e]=u:r}catch{return r}}var rr={};function Ae(e,t,r){var o;let n=`${e}.${String(r)}`;if(rr[n])return rr[n].call(t);let s=wr(e),a=(o=Object.getOwnPropertyDescriptor(s,r))==null?void 0:o.get;return a?(rr[n]=a,a.call(t)):t[r]}var or={};function Io(e,t,r){let o=`${e}.${String(r)}`;if(or[o])return or[o].bind(t);let s=wr(e)[r];return typeof s!="function"?t[r]:(or[o]=s,s.bind(t))}function Fs(e){return Ae("Node",e,"childNodes")}function Us(e){return Ae("Node",e,"parentNode")}function Hs(e){return Ae("Node",e,"parentElement")}function Ys(e){return Ae("Node",e,"textContent")}function Vs(e,t){return Io("Node",e,"contains")(t)}function Ws(e){return Io("Node",e,"getRootNode")()}function Bs(e){return!e||!("host"in e)?null:Ae("ShadowRoot",e,"host")}function zs(e){return e.styleSheets}function Gs(e){return!e||!("shadowRoot"in e)?null:Ae("Element",e,"shadowRoot")}function Ks(e,t){return Ae("Element",e,"querySelector")(t)}function js(e,t){return Ae("Element",e,"querySelectorAll")(t)}function _o(){return wr("MutationObserver").constructor}var T={childNodes:Fs,parentNode:Us,parentElement:Hs,textContent:Ys,contains:Vs,getRootNode:Ws,host:Bs,styleSheets:zs,shadowRoot:Gs,querySelector:Ks,querySelectorAll:js,mutationObserver:_o};function ee(e,t,r=document){let o={capture:!0,passive:!0};return r.addEventListener(e,t,o),()=>r.removeEventListener(e,t,o)}var Fe=`Please stop import mirror directly. Instead of that,\r
52
2
  now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
53
- or you can use record.mirror to access the mirror instance during recording.`,li={map:{},getId(){return console.error(Xe),-1},getNode(){return console.error(Xe),null},removeNodeFromMap(){console.error(Xe)},has(){return console.error(Xe),!1},reset(){console.error(Xe)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(li=new Proxy(li,{get(s,e,t){return e==="map"&&console.error(Xe),Reflect.get(s,e,t)}}));function Mt(s,e,t={}){let r=null,n=0;return function(...o){let i=Date.now();!n&&t.leading===!1&&(n=i);let l=e-(i-n),a=this;l<=0||l>e?(r&&(clearTimeout(r),r=null),n=i,s.apply(a,o)):!r&&t.trailing!==!1&&(r=setTimeout(()=>{n=t.leading===!1?0:Date.now(),r=null,s.apply(a,o)},l))}}function Zr(s,e,t,r,n=window){let o=n.Object.getOwnPropertyDescriptor(s,e);return n.Object.defineProperty(s,e,r?t:{set(i){setTimeout(()=>{t.set.call(this,i)},0),o&&o.set&&o.set.call(this,i)}}),()=>Zr(s,e,o||{},!0)}function ut(s,e,t){try{if(!(e in s))return()=>{};let r=s[e],n=t(r);return typeof n=="function"&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__rrweb_original__:{enumerable:!1,value:r}})),s[e]=n,()=>{s[e]=r}}catch{return()=>{}}}var $r=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||($r=()=>new Date().getTime());function ja(s){var e,t,r,n;let o=s.document;return{left:o.scrollingElement?o.scrollingElement.scrollLeft:s.pageXOffset!==void 0?s.pageXOffset:o.documentElement.scrollLeft||o?.body&&((e=D.parentElement(o.body))==null?void 0:e.scrollLeft)||((t=o?.body)==null?void 0:t.scrollLeft)||0,top:o.scrollingElement?o.scrollingElement.scrollTop:s.pageYOffset!==void 0?s.pageYOffset:o?.documentElement.scrollTop||o?.body&&((r=D.parentElement(o.body))==null?void 0:r.scrollTop)||((n=o?.body)==null?void 0:n.scrollTop)||0}}function Ka(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Ja(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Za(s){return s?s.nodeType===s.ELEMENT_NODE?s:D.parentElement(s):null}function ie(s,e,t,r){if(!s)return!1;let n=Za(s);if(!n)return!1;try{if(typeof e=="string"){if(n.classList.contains(e)||r&&n.closest("."+e)!==null)return!0}else if(Ar(n,e,r))return!0}catch{}return!!(t&&(n.matches(t)||r&&n.closest(t)!==null))}function Jf(s,e){return e.getId(s)!==-1}function Ns(s,e,t){return s.tagName==="TITLE"&&t.headTitleMutations?!0:e.getId(s)===Rt}function Xa(s,e){if(Ct(s))return!1;let t=e.getId(s);if(!e.has(t))return!0;let r=D.parentNode(s);return r&&r.nodeType===s.DOCUMENT_NODE?!1:r?Xa(r,e):!0}function fn(s){return!!s.changedTouches}function Zf(s=window){"NodeList"in s&&!s.NodeList.prototype.forEach&&(s.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in s&&!s.DOMTokenList.prototype.forEach&&(s.DOMTokenList.prototype.forEach=Array.prototype.forEach)}function qa(s,e){return!!(s.nodeName==="IFRAME"&&e.getMeta(s))}function Qa(s,e){return!!(s.nodeName==="LINK"&&s.nodeType===s.ELEMENT_NODE&&s.getAttribute&&s.getAttribute("rel")==="stylesheet"&&e.getMeta(s))}function pn(s){return s?s instanceof hn&&"shadowRoot"in s?!!s.shadowRoot:!!D.shadowRoot(s):!1}var mn=class{constructor(){C(this,"id",1),C(this,"styleIDMap",new WeakMap),C(this,"idStyleMap",new Map)}getId(e){return this.styleIDMap.get(e)??-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let r;return t===void 0?r=this.id++:r=t,this.styleIDMap.set(e,r),this.idStyleMap.set(r,e),r}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function el(s){var e;let t=null;return"getRootNode"in s&&((e=D.getRootNode(s))==null?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&D.host(D.getRootNode(s))&&(t=D.host(D.getRootNode(s))),t}function Xf(s){let e=s,t;for(;t=el(e);)e=t;return e}function qf(s){let e=s.ownerDocument;if(!e)return!1;let t=Xf(s);return D.contains(e,t)}function tl(s){let e=s.ownerDocument;return e?D.contains(e,s)||qf(s):!1}var k=(s=>(s[s.DomContentLoaded=0]="DomContentLoaded",s[s.Load=1]="Load",s[s.FullSnapshot=2]="FullSnapshot",s[s.IncrementalSnapshot=3]="IncrementalSnapshot",s[s.Meta=4]="Meta",s[s.Custom=5]="Custom",s[s.Plugin=6]="Plugin",s))(k||{}),T=(s=>(s[s.Mutation=0]="Mutation",s[s.MouseMove=1]="MouseMove",s[s.MouseInteraction=2]="MouseInteraction",s[s.Scroll=3]="Scroll",s[s.ViewportResize=4]="ViewportResize",s[s.Input=5]="Input",s[s.TouchMove=6]="TouchMove",s[s.MediaInteraction=7]="MediaInteraction",s[s.StyleSheetRule=8]="StyleSheetRule",s[s.CanvasMutation=9]="CanvasMutation",s[s.Font=10]="Font",s[s.Log=11]="Log",s[s.Drag=12]="Drag",s[s.StyleDeclaration=13]="StyleDeclaration",s[s.Selection=14]="Selection",s[s.AdoptedStyleSheet=15]="AdoptedStyleSheet",s[s.CustomElement=16]="CustomElement",s))(T||{}),de=(s=>(s[s.MouseUp=0]="MouseUp",s[s.MouseDown=1]="MouseDown",s[s.Click=2]="Click",s[s.ContextMenu=3]="ContextMenu",s[s.DblClick=4]="DblClick",s[s.Focus=5]="Focus",s[s.Blur=6]="Blur",s[s.TouchStart=7]="TouchStart",s[s.TouchMove_Departed=8]="TouchMove_Departed",s[s.TouchEnd=9]="TouchEnd",s[s.TouchCancel=10]="TouchCancel",s))(de||{}),Te=(s=>(s[s.Mouse=0]="Mouse",s[s.Pen=1]="Pen",s[s.Touch=2]="Touch",s))(Te||{}),lt=(s=>(s[s["2D"]=0]="2D",s[s.WebGL=1]="WebGL",s[s.WebGL2=2]="WebGL2",s))(lt||{}),qe=(s=>(s[s.Play=0]="Play",s[s.Pause=1]="Pause",s[s.Seeked=2]="Seeked",s[s.VolumeChange=3]="VolumeChange",s[s.RateChange=4]="RateChange",s))(qe||{});function ui(s){return"__ln"in s}var gn=class{constructor(){C(this,"length",0),C(this,"head",null),C(this,"tail",null)}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let r=0;r<e;r++)t=t?.next||null;return t}addNode(e){let t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&ui(e.previousSibling)){let r=e.previousSibling.__ln.next;t.next=r,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,r&&(r.previous=t)}else if(e.nextSibling&&ui(e.nextSibling)&&e.nextSibling.__ln.previous){let r=e.nextSibling.__ln.previous;t.previous=r,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,r&&(r.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;t.next===null&&(this.tail=t),this.length++}removeNode(e){let t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}},ci=(s,e)=>`${s}@${e}`,yn=class{constructor(){C(this,"frozen",!1),C(this,"locked",!1),C(this,"texts",[]),C(this,"attributes",[]),C(this,"attributeMap",new WeakMap),C(this,"removes",[]),C(this,"mapRemoves",[]),C(this,"movedMap",{}),C(this,"addedSet",new Set),C(this,"movedSet",new Set),C(this,"droppedSet",new Set),C(this,"mutationCb"),C(this,"blockClass"),C(this,"blockSelector"),C(this,"maskTextClass"),C(this,"maskTextSelector"),C(this,"inlineStylesheet"),C(this,"maskInputOptions"),C(this,"maskTextFn"),C(this,"maskInputFn"),C(this,"maskAnchorHrefFn"),C(this,"blockImgSrcPattern"),C(this,"blockImgSrcFillOptions"),C(this,"keepIframeSrcFn"),C(this,"recordCanvas"),C(this,"inlineImages"),C(this,"slimDOMOptions"),C(this,"dataURLOptions"),C(this,"doc"),C(this,"mirror"),C(this,"iframeManager"),C(this,"stylesheetManager"),C(this,"shadowDomManager"),C(this,"canvasManager"),C(this,"processedNodeManager"),C(this,"unattachedDoc"),C(this,"processMutations",e=>{e.forEach(this.processMutation),this.emit()}),C(this,"emit",()=>{if(this.frozen||this.locked)return;let e=[],t=new Set,r=new gn,n=a=>{let u=a,c=Rt;for(;c===Rt;)u=u&&u.nextSibling,c=u&&this.mirror.getId(u);return c},o=a=>{let u=D.parentNode(a);if(!u||!tl(a))return;let c=!1;if(a.nodeType===Node.TEXT_NODE){let g=u.tagName;if(g==="TEXTAREA")return;g==="STYLE"&&this.addedSet.has(u)&&(c=!0)}let d=Ct(u)?this.mirror.getId(el(a)):this.mirror.getId(u),p=n(a);if(d===-1||p===-1)return r.addNode(a);let m=et(a,{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,maskAnchorHrefFn:this.maskAnchorHrefFn,blockImgSrcPattern:this.blockImgSrcPattern,blockImgSrcFillOptions:this.blockImgSrcFillOptions,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:g=>{qa(g,this.mirror)&&this.iframeManager.addIframe(g),Qa(g,this.mirror)&&this.stylesheetManager.trackLinkElement(g),pn(a)&&this.shadowDomManager.addShadowRoot(D.shadowRoot(a),this.doc)},onIframeLoad:(g,f)=>{this.iframeManager.attachIframe(g,f),this.shadowDomManager.observeAttachShadow(g)},onStylesheetLoad:(g,f)=>{this.stylesheetManager.attachLinkElement(g,f)},cssCaptured:c});m&&(e.push({parentId:d,nextId:p,node:m}),t.add(m.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let a of this.movedSet)di(this.removes,a,this.mirror)&&!this.movedSet.has(D.parentNode(a))||o(a);for(let a of this.addedSet)!hi(this.droppedSet,a)&&!di(this.removes,a,this.mirror)||hi(this.movedSet,a)?o(a):this.droppedSet.add(a);let i=null;for(;r.length;){let a=null;if(i){let u=this.mirror.getId(D.parentNode(i.value)),c=n(i.value);u!==-1&&c!==-1&&(a=i)}if(!a){let u=r.tail;for(;u;){let c=u;if(u=u.previous,c){let d=this.mirror.getId(D.parentNode(c.value));if(n(c.value)===-1)continue;if(d!==-1){a=c;break}else{let m=c.value,g=D.parentNode(m);if(g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let f=D.host(g);if(this.mirror.getId(f)!==-1){a=c;break}}}}}}if(!a){for(;r.head;)r.removeNode(r.head.value);break}i=a.previous,r.removeNode(a.value),o(a.value)}let l={texts:this.texts.map(a=>{let u=a.node,c=D.parentNode(u);return c&&c.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(c),{id:this.mirror.getId(u),value:a.value}}).filter(a=>!t.has(a.id)).filter(a=>this.mirror.has(a.id)),attributes:this.attributes.map(a=>{let{attributes:u}=a;if(typeof u.style=="string"){let c=JSON.stringify(a.styleDiff),d=JSON.stringify(a._unchangedStyles);c.length<u.style.length&&(c+d).split("var(").length===u.style.split("var(").length&&(u.style=a.styleDiff)}return{id:this.mirror.getId(a.node),attributes:u}}).filter(a=>!t.has(a.id)).filter(a=>this.mirror.has(a.id)),removes:this.removes,adds:e};!l.texts.length&&!l.attributes.length&&!l.removes.length&&!l.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(l))}),C(this,"genTextAreaValueMutation",e=>{let t=this.attributeMap.get(e);t||(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(t),this.attributeMap.set(e,t));let r=t.attributes.value=Array.from(D.childNodes(e),n=>D.textContent(n)||"").join("");t.attributes.value=Ir({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:null,value:r,maskInputFn:this.maskInputFn})}),C(this,"processMutation",e=>{if(!Ns(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":{let t=D.textContent(e.target);!ie(e.target,this.blockClass,this.blockSelector,!1)&&t!==e.oldValue&&this.texts.push({value:xi(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,Za(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{let t=e.target,r=e.attributeName,n=e.target.getAttribute(r);if(r==="value"){let l=In(t);n=Ir({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:l,value:n,maskInputFn:this.maskInputFn})}let o=ie(e.target,this.blockClass,this.blockSelector,!1);if(o&&r==="style"){let l=e.target,{width:a,height:u}=l.getBoundingClientRect(),c=this.attributeMap.get(e.target);c||(c={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(c),this.attributeMap.set(e.target,c)),c.attributes.rr_width=`${a}px`,c.attributes.rr_height=`${u}px`}if(o||n===e.oldValue)return;let i=this.attributeMap.get(e.target);if(t.tagName==="IFRAME"&&r==="src"&&!this.keepIframeSrcFn(n))if(!t.contentDocument)r="rr_src";else return;if(i||(i={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(i),this.attributeMap.set(e.target,i)),r==="type"&&t.tagName==="INPUT"&&(e.oldValue||"").toLowerCase()==="password"&&t.setAttribute("data-rr-is-password","true"),!Ii(t.tagName,r))if(i.attributes[r]=Ri(this.doc,Be(t.tagName),Be(r),n),r==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}let l=this.unattachedDoc.createElement("span");e.oldValue&&l.setAttribute("style",e.oldValue);for(let a of Array.from(t.style)){let u=t.style.getPropertyValue(a),c=t.style.getPropertyPriority(a);u!==l.style.getPropertyValue(a)||c!==l.style.getPropertyPriority(a)?c===""?i.styleDiff[a]=u:i.styleDiff[a]=[u,c]:i._unchangedStyles[a]=[u,c]}for(let a of Array.from(l.style))t.style.getPropertyValue(a)===""&&(i.styleDiff[a]=!1)}else r==="open"&&t.tagName==="DIALOG"&&(t.matches("dialog:modal")?i.attributes.rr_open_mode="modal":i.attributes.rr_open_mode="non-modal");break}case"childList":{if(ie(e.target,this.blockClass,this.blockSelector,!0))return;if(e.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(e.target);return}e.addedNodes.forEach(t=>this.genAdds(t,e.target)),e.removedNodes.forEach(t=>{let r=this.mirror.getId(t),n=Ct(e.target)?this.mirror.getId(D.host(e.target)):this.mirror.getId(e.target);ie(e.target,this.blockClass,this.blockSelector,!1)||Ns(t,this.mirror,this.slimDOMOptions)||!Jf(t,this.mirror)||(this.addedSet.has(t)?(wn(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&r===-1||Xa(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[ci(r,n)]?wn(this.movedSet,t):this.removes.push({parentId:n,id:r,isShadow:Ct(e.target)&&bt(e.target)?!0:void 0})),this.mapRemoves.push(t))});break}}}),C(this,"genAdds",(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!(this.addedSet.has(e)||this.movedSet.has(e))){if(this.mirror.hasNode(e)){if(Ns(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);let r=null;t&&this.mirror.hasNode(t)&&(r=this.mirror.getId(t)),r&&r!==-1&&(this.movedMap[ci(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);ie(e,this.blockClass,this.blockSelector,!1)||(D.childNodes(e).forEach(r=>this.genAdds(r)),pn(e)&&D.childNodes(D.shadowRoot(e)).forEach(r=>{this.processedNodeManager.add(r,this),this.genAdds(r,e)}))}})}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","maskAnchorHrefFn","blockImgSrcPattern","blockImgSrcFillOptions","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(t=>{this[t]=e[t]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}};function wn(s,e){s.delete(e),D.childNodes(e).forEach(t=>wn(s,t))}function di(s,e,t){return s.length===0?!1:Qf(s,e,t)}function Qf(s,e,t){let r=D.parentNode(e);for(;r;){let n=t.getId(r);if(s.some(o=>o.id===n))return!0;r=D.parentNode(r)}return!1}function hi(s,e){return s.size===0?!1:rl(s,e)}function rl(s,e){let t=D.parentNode(e);return t?s.has(t)?!0:rl(s,t):!1}var Et;function ep(s){Et=s}function tp(){Et=void 0}var M=s=>Et?(...t)=>{try{return s(...t)}catch(r){if(Et&&Et(r)===!0)return;throw r}}:s,He=[];function Ft(s){try{if("composedPath"in s){let e=s.composedPath();if(e.length)return e[0]}else if("path"in s&&s.path.length)return s.path[0]}catch{}return s&&s.target}function sl(s,e){let t=new yn;He.push(t),t.init(s);let r=new(Ga())(M(t.processMutations.bind(t)));return r.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),r}function rp({mousemoveCb:s,sampling:e,doc:t,mirror:r}){if(e.mousemove===!1)return()=>{};let n=typeof e.mousemove=="number"?e.mousemove:50,o=typeof e.mousemoveCallback=="number"?e.mousemoveCallback:500,i=[],l,a=Mt(M(d=>{let p=Date.now()-l;s(i.map(m=>(m.timeOffset-=p,m)),d),i=[],l=null}),o),u=M(Mt(M(d=>{let p=Ft(d),{clientX:m,clientY:g}=fn(d)?d.changedTouches[0]:d;l||(l=$r()),i.push({x:m,y:g,id:r.getId(p),timeOffset:$r()-l}),a(typeof DragEvent<"u"&&d instanceof DragEvent?T.Drag:d instanceof MouseEvent?T.MouseMove:T.TouchMove)}),n,{trailing:!1})),c=[oe("mousemove",u,t),oe("touchmove",u,t),oe("drag",u,t)];return M(()=>{c.forEach(d=>d())})}function sp({mouseInteractionCb:s,doc:e,mirror:t,blockClass:r,blockSelector:n,sampling:o}){if(o.mouseInteraction===!1)return()=>{};let i=o.mouseInteraction===!0||o.mouseInteraction===void 0?{}:o.mouseInteraction,l=[],a=null,u=c=>d=>{let p=Ft(d);if(ie(p,r,n,!0))return;let m=null,g=c;if("pointerType"in d){switch(d.pointerType){case"mouse":m=Te.Mouse;break;case"touch":m=Te.Touch;break;case"pen":m=Te.Pen;break}m===Te.Touch?de[c]===de.MouseDown?g="TouchStart":de[c]===de.MouseUp&&(g="TouchEnd"):Te.Pen}else fn(d)&&(m=Te.Touch);m!==null?(a=m,(g.startsWith("Touch")&&m===Te.Touch||g.startsWith("Mouse")&&m===Te.Mouse)&&(m=null)):de[c]===de.Click&&(m=a,a=null);let f=fn(d)?d.changedTouches[0]:d;if(!f)return;let h=t.getId(p),{clientX:E,clientY:S}=f;M(s)({type:de[g],id:h,x:E,y:S,...m!==null&&{pointerType:m}})};return Object.keys(de).filter(c=>Number.isNaN(Number(c))&&!c.endsWith("_Departed")&&i[c]!==!1).forEach(c=>{let d=Be(c),p=u(c);if(window.PointerEvent)switch(de[c]){case de.MouseDown:case de.MouseUp:d=d.replace("mouse","pointer");break;case de.TouchStart:case de.TouchEnd:return}l.push(oe(d,p,e))}),M(()=>{l.forEach(c=>c())})}function nl({scrollCb:s,doc:e,mirror:t,blockClass:r,blockSelector:n,sampling:o}){let i=M(Mt(M(l=>{let a=Ft(l);if(!a||ie(a,r,n,!0))return;let u=t.getId(a);if(a===e&&e.defaultView){let c=ja(e.defaultView);s({id:u,x:c.left,y:c.top})}else s({id:u,x:a.scrollLeft,y:a.scrollTop})}),o.scroll||100));return oe("scroll",i,e)}function np({viewportResizeCb:s},{win:e}){let t=-1,r=-1,n=M(Mt(M(()=>{let o=Ka(),i=Ja();(t!==o||r!==i)&&(s({width:Number(i),height:Number(o)}),t=o,r=i)}),200));return oe("resize",n,e)}var op=["INPUT","TEXTAREA","SELECT"],fi=new WeakMap;function ip({inputCb:s,doc:e,mirror:t,blockClass:r,blockSelector:n,ignoreClass:o,ignoreSelector:i,maskInputOptions:l,maskInputFn:a,sampling:u,userTriggeredOnInput:c}){function d(S){let w=Ft(S),I=S.isTrusted,_=w&&w.tagName;if(w&&_==="OPTION"&&(w=D.parentElement(w)),!w||!_||op.indexOf(_)<0||ie(w,r,n,!0)||w.classList.contains(o)||i&&w.matches(i))return;let y=w.value,R=!1,v=In(w)||"";v==="radio"||v==="checkbox"?R=w.checked:(l[_.toLowerCase()]||l[v])&&(y=Ir({element:w,maskInputOptions:l,tagName:_,type:v,value:y,maskInputFn:a})),p(w,c?{text:y,isChecked:R,userTriggered:I}:{text:y,isChecked:R});let x=w.name;v==="radio"&&x&&R&&e.querySelectorAll(`input[type="radio"][name="${ap(x)}"]`).forEach(O=>{if(O!==w){let le=O.value;p(O,c?{text:le,isChecked:!R,userTriggered:!1}:{text:le,isChecked:!R})}})}function p(S,w){let I=fi.get(S);if(!I||I.text!==w.text||I.isChecked!==w.isChecked){fi.set(S,w);let _=t.getId(S);M(s)({...w,id:_})}}let g=(u.input==="last"?["change"]:["input","change"]).map(S=>oe(S,M(d),e)),f=e.defaultView;if(!f)return()=>{g.forEach(S=>S())};let h=f.Object.getOwnPropertyDescriptor(f.HTMLInputElement.prototype,"value"),E=[[f.HTMLInputElement.prototype,"value"],[f.HTMLInputElement.prototype,"checked"],[f.HTMLSelectElement.prototype,"value"],[f.HTMLTextAreaElement.prototype,"value"],[f.HTMLSelectElement.prototype,"selectedIndex"],[f.HTMLOptionElement.prototype,"selected"]];return h&&h.set&&g.push(...E.map(S=>Zr(S[0],S[1],{set(){M(d)({target:this,isTrusted:!1})}},!1,f))),M(()=>{g.forEach(S=>S())})}function Lr(s){let e=[];function t(r,n){if(gr("CSSGroupingRule")&&r.parentRule instanceof CSSGroupingRule||gr("CSSMediaRule")&&r.parentRule instanceof CSSMediaRule||gr("CSSSupportsRule")&&r.parentRule instanceof CSSSupportsRule||gr("CSSConditionRule")&&r.parentRule instanceof CSSConditionRule){let i=Array.from(r.parentRule.cssRules).indexOf(r);n.unshift(i)}else if(r.parentStyleSheet){let i=Array.from(r.parentStyleSheet.cssRules).indexOf(r);n.unshift(i)}return n}return t(s,e)}function ap(s){return s.replace(/["\\]/g,"\\$&")}function Fe(s,e,t){let r,n;return s?(s.ownerNode?r=e.getId(s.ownerNode):n=t.getId(s),{styleId:n,id:r}):{}}function lp({styleSheetRuleCb:s,mirror:e,stylesheetManager:t},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};let n=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(n,{apply:M((c,d,p)=>{let[m,g]=p,{id:f,styleId:h}=Fe(d,e,t.styleMirror);return(f&&f!==-1||h&&h!==-1)&&s({id:f,styleId:h,adds:[{rule:m,index:g}]}),c.apply(d,p)})}),r.CSSStyleSheet.prototype.addRule=function(c,d,p=this.cssRules.length){let m=`${c} { ${d} }`;return r.CSSStyleSheet.prototype.insertRule.apply(this,[m,p])};let o=r.CSSStyleSheet.prototype.deleteRule;r.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:M((c,d,p)=>{let[m]=p,{id:g,styleId:f}=Fe(d,e,t.styleMirror);return(g&&g!==-1||f&&f!==-1)&&s({id:g,styleId:f,removes:[{index:m}]}),c.apply(d,p)})}),r.CSSStyleSheet.prototype.removeRule=function(c){return r.CSSStyleSheet.prototype.deleteRule.apply(this,[c])};let i;r.CSSStyleSheet.prototype.replace&&(i=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(i,{apply:M((c,d,p)=>{let[m]=p,{id:g,styleId:f}=Fe(d,e,t.styleMirror);return(g&&g!==-1||f&&f!==-1)&&s({id:g,styleId:f,replace:m}),c.apply(d,p)})}));let l;r.CSSStyleSheet.prototype.replaceSync&&(l=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:M((c,d,p)=>{let[m]=p,{id:g,styleId:f}=Fe(d,e,t.styleMirror);return(g&&g!==-1||f&&f!==-1)&&s({id:g,styleId:f,replaceSync:m}),c.apply(d,p)})}));let a={};yr("CSSGroupingRule")?a.CSSGroupingRule=r.CSSGroupingRule:(yr("CSSMediaRule")&&(a.CSSMediaRule=r.CSSMediaRule),yr("CSSConditionRule")&&(a.CSSConditionRule=r.CSSConditionRule),yr("CSSSupportsRule")&&(a.CSSSupportsRule=r.CSSSupportsRule));let u={};return Object.entries(a).forEach(([c,d])=>{u[c]={insertRule:d.prototype.insertRule,deleteRule:d.prototype.deleteRule},d.prototype.insertRule=new Proxy(u[c].insertRule,{apply:M((p,m,g)=>{let[f,h]=g,{id:E,styleId:S}=Fe(m.parentStyleSheet,e,t.styleMirror);return(E&&E!==-1||S&&S!==-1)&&s({id:E,styleId:S,adds:[{rule:f,index:[...Lr(m),h||0]}]}),p.apply(m,g)})}),d.prototype.deleteRule=new Proxy(u[c].deleteRule,{apply:M((p,m,g)=>{let[f]=g,{id:h,styleId:E}=Fe(m.parentStyleSheet,e,t.styleMirror);return(h&&h!==-1||E&&E!==-1)&&s({id:h,styleId:E,removes:[{index:[...Lr(m),f]}]}),p.apply(m,g)})})}),M(()=>{r.CSSStyleSheet.prototype.insertRule=n,r.CSSStyleSheet.prototype.deleteRule=o,i&&(r.CSSStyleSheet.prototype.replace=i),l&&(r.CSSStyleSheet.prototype.replaceSync=l),Object.entries(a).forEach(([c,d])=>{d.prototype.insertRule=u[c].insertRule,d.prototype.deleteRule=u[c].deleteRule})})}function ol({mirror:s,stylesheetManager:e},t){var r,n,o;let i=null;t.nodeName==="#document"?i=s.getId(t):i=s.getId(D.host(t));let l=t.nodeName==="#document"?(r=t.defaultView)==null?void 0:r.Document:(o=(n=t.ownerDocument)==null?void 0:n.defaultView)==null?void 0:o.ShadowRoot,a=l?.prototype?Object.getOwnPropertyDescriptor(l?.prototype,"adoptedStyleSheets"):void 0;return i===null||i===-1||!l||!a?()=>{}:(Object.defineProperty(t,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get(){var u;return(u=a.get)==null?void 0:u.call(this)},set(u){var c;let d=(c=a.set)==null?void 0:c.call(this,u);if(i!==null&&i!==-1)try{e.adoptStyleSheets(u,i)}catch{}return d}}),M(()=>{Object.defineProperty(t,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set})}))}function up({styleDeclarationCb:s,mirror:e,ignoreCSSAttributes:t,stylesheetManager:r},{win:n}){let o=n.CSSStyleDeclaration.prototype.setProperty;n.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:M((l,a,u)=>{var c;let[d,p,m]=u;if(t.has(d))return o.apply(a,[d,p,m]);let{id:g,styleId:f}=Fe((c=a.parentRule)==null?void 0:c.parentStyleSheet,e,r.styleMirror);return(g&&g!==-1||f&&f!==-1)&&s({id:g,styleId:f,set:{property:d,value:p,priority:m},index:Lr(a.parentRule)}),l.apply(a,u)})});let i=n.CSSStyleDeclaration.prototype.removeProperty;return n.CSSStyleDeclaration.prototype.removeProperty=new Proxy(i,{apply:M((l,a,u)=>{var c;let[d]=u;if(t.has(d))return i.apply(a,[d]);let{id:p,styleId:m}=Fe((c=a.parentRule)==null?void 0:c.parentStyleSheet,e,r.styleMirror);return(p&&p!==-1||m&&m!==-1)&&s({id:p,styleId:m,remove:{property:d},index:Lr(a.parentRule)}),l.apply(a,u)})}),M(()=>{n.CSSStyleDeclaration.prototype.setProperty=o,n.CSSStyleDeclaration.prototype.removeProperty=i})}function cp({mediaInteractionCb:s,blockClass:e,blockSelector:t,mirror:r,sampling:n,doc:o}){let i=M(a=>Mt(M(u=>{let c=Ft(u);if(!c||ie(c,e,t,!0))return;let{currentTime:d,volume:p,muted:m,playbackRate:g,loop:f}=c;s({type:a,id:r.getId(c),currentTime:d,volume:p,muted:m,playbackRate:g,loop:f})}),n.media||500)),l=[oe("play",i(qe.Play),o),oe("pause",i(qe.Pause),o),oe("seeked",i(qe.Seeked),o),oe("volumechange",i(qe.VolumeChange),o),oe("ratechange",i(qe.RateChange),o)];return M(()=>{l.forEach(a=>a())})}function dp({fontCb:s,doc:e}){let t=e.defaultView;if(!t)return()=>{};let r=[],n=new WeakMap,o=t.FontFace;t.FontFace=function(a,u,c){let d=new o(a,u,c);return n.set(d,{family:a,buffer:typeof u!="string",descriptors:c,fontSource:typeof u=="string"?u:JSON.stringify(Array.from(new Uint8Array(u)))}),d};let i=ut(e.fonts,"add",function(l){return function(a){return setTimeout(M(()=>{let u=n.get(a);u&&(s(u),n.delete(a))}),0),l.apply(this,[a])}});return r.push(()=>{t.FontFace=o}),r.push(i),M(()=>{r.forEach(l=>l())})}function hp(s){let{doc:e,mirror:t,blockClass:r,blockSelector:n,selectionCb:o}=s,i=!0,l=M(()=>{let a=e.getSelection();if(!a||i&&a?.isCollapsed)return;i=a.isCollapsed||!1;let u=[],c=a.rangeCount||0;for(let d=0;d<c;d++){let p=a.getRangeAt(d),{startContainer:m,startOffset:g,endContainer:f,endOffset:h}=p;ie(m,r,n,!0)||ie(f,r,n,!0)||u.push({start:t.getId(m),startOffset:g,end:t.getId(f),endOffset:h})}o({ranges:u})});return l(),oe("selectionchange",l)}function fp({doc:s,customElementCb:e}){let t=s.defaultView;return!t||!t.customElements?()=>{}:ut(t.customElements,"define",function(n){return function(o,i,l){try{e({define:{name:o}})}catch{console.warn(`Custom element callback failed for ${o}`)}return n.apply(this,[o,i,l])}})}function pp(s,e){let{mutationCb:t,mousemoveCb:r,mouseInteractionCb:n,scrollCb:o,viewportResizeCb:i,inputCb:l,mediaInteractionCb:a,styleSheetRuleCb:u,styleDeclarationCb:c,canvasMutationCb:d,fontCb:p,selectionCb:m,customElementCb:g}=s;s.mutationCb=(...f)=>{e.mutation&&e.mutation(...f),t(...f)},s.mousemoveCb=(...f)=>{e.mousemove&&e.mousemove(...f),r(...f)},s.mouseInteractionCb=(...f)=>{e.mouseInteraction&&e.mouseInteraction(...f),n(...f)},s.scrollCb=(...f)=>{e.scroll&&e.scroll(...f),o(...f)},s.viewportResizeCb=(...f)=>{e.viewportResize&&e.viewportResize(...f),i(...f)},s.inputCb=(...f)=>{e.input&&e.input(...f),l(...f)},s.mediaInteractionCb=(...f)=>{e.mediaInteaction&&e.mediaInteaction(...f),a(...f)},s.styleSheetRuleCb=(...f)=>{e.styleSheetRule&&e.styleSheetRule(...f),u(...f)},s.styleDeclarationCb=(...f)=>{e.styleDeclaration&&e.styleDeclaration(...f),c(...f)},s.canvasMutationCb=(...f)=>{e.canvasMutation&&e.canvasMutation(...f),d(...f)},s.fontCb=(...f)=>{e.font&&e.font(...f),p(...f)},s.selectionCb=(...f)=>{e.selection&&e.selection(...f),m(...f)},s.customElementCb=(...f)=>{e.customElement&&e.customElement(...f),g(...f)}}function mp(s,e={}){let t=s.doc.defaultView;if(!t)return()=>{};pp(s,e);let r;s.recordDOM&&(r=sl(s,s.doc));let n=rp(s),o=sp(s),i=nl(s),l=np(s,{win:t}),a=ip(s),u=cp(s),c=()=>{},d=()=>{},p=()=>{},m=()=>{};s.recordDOM&&(c=lp(s,{win:t}),d=ol(s,s.doc),p=up(s,{win:t}),s.collectFonts&&(m=dp(s)));let g=hp(s),f=fp(s),h=[];for(let E of s.plugins)h.push(E.observer(E.callback,t,E.options));return M(()=>{He.forEach(E=>E.reset()),r?.disconnect(),n(),o(),i(),l(),a(),u(),c(),d(),p(),m(),g(),f(),h.forEach(E=>E())})}function gr(s){return typeof window[s]<"u"}function yr(s){return!!(typeof window[s]<"u"&&window[s].prototype&&"insertRule"in window[s].prototype&&"deleteRule"in window[s].prototype)}var Fr=class{constructor(e){C(this,"iframeIdToRemoteIdMap",new WeakMap),C(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,r,n){let o=r||this.getIdToRemoteIdMap(e),i=n||this.getRemoteIdToIdMap(e),l=o.get(t);return l||(l=this.generateIdFn(),o.set(t,l),i.set(l,t)),l}getIds(e,t){let r=this.getIdToRemoteIdMap(e),n=this.getRemoteIdToIdMap(e);return t.map(o=>this.getId(e,o,r,n))}getRemoteId(e,t,r){let n=r||this.getRemoteIdToIdMap(e);if(typeof t!="number")return t;let o=n.get(t);return o||-1}getRemoteIds(e,t){let r=this.getRemoteIdToIdMap(e);return t.map(n=>this.getRemoteId(e,n,r))}reset(e){if(!e){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}},Sn=class{constructor(e){C(this,"iframes",new WeakMap),C(this,"crossOriginIframeMap",new WeakMap),C(this,"crossOriginIframeMirror",new Fr(Ei)),C(this,"crossOriginIframeStyleMirror"),C(this,"crossOriginIframeRootIdMap",new WeakMap),C(this,"mirror"),C(this,"mutationCb"),C(this,"wrappedEmit"),C(this,"loadListener"),C(this,"stylesheetManager"),C(this,"recordCrossOriginIframes"),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Fr(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var r,n;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&((r=e.contentWindow)==null||r.addEventListener("message",this.handleMessage.bind(this))),(n=this.loadListener)==null||n.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){let t=e;if(t.data.type!=="rrweb"||t.origin!==t.data.origin||!e.source)return;let n=this.crossOriginIframeMap.get(e.source);if(!n)return;let o=this.transformCrossOriginEvent(n,t.data.event);o&&this.wrappedEmit(o,t.data.isCheckout)}transformCrossOriginEvent(e,t){var r;switch(t.type){case k.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);let n=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,n),this.patchRootIdOnNode(t.data.node,n),{timestamp:t.timestamp,type:k.IncrementalSnapshot,data:{source:T.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case k.Meta:case k.Load:case k.DomContentLoaded:return!1;case k.Plugin:return t;case k.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case k.IncrementalSnapshot:switch(t.data.source){case T.Mutation:return t.data.adds.forEach(n=>{this.replaceIds(n,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(n.node,e);let o=this.crossOriginIframeRootIdMap.get(e);o&&this.patchRootIdOnNode(n.node,o)}),t.data.removes.forEach(n=>{this.replaceIds(n,e,["parentId","id"])}),t.data.attributes.forEach(n=>{this.replaceIds(n,e,["id"])}),t.data.texts.forEach(n=>{this.replaceIds(n,e,["id"])}),t;case T.Drag:case T.TouchMove:case T.MouseMove:return t.data.positions.forEach(n=>{this.replaceIds(n,e,["id"])}),t;case T.ViewportResize:return!1;case T.MediaInteraction:case T.MouseInteraction:case T.Scroll:case T.CanvasMutation:case T.Input:return this.replaceIds(t.data,e,["id"]),t;case T.StyleSheetRule:case T.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case T.Font:return t;case T.Selection:return t.data.ranges.forEach(n=>{this.replaceIds(n,e,["start","end"])}),t;case T.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),(r=t.data.styles)==null||r.forEach(n=>{this.replaceStyleIds(n,e,["styleId"])}),t}}return!1}replace(e,t,r,n){for(let o of n)!Array.isArray(t[o])&&typeof t[o]!="number"||(Array.isArray(t[o])?t[o]=e.getIds(r,t[o]):t[o]=e.getId(r,t[o]));return t}replaceIds(e,t,r){return this.replace(this.crossOriginIframeMirror,e,t,r)}replaceStyleIds(e,t,r){return this.replace(this.crossOriginIframeStyleMirror,e,t,r)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(r=>{this.replaceIdOnNode(r,t)})}patchRootIdOnNode(e,t){e.type!==q.Document&&!e.rootId&&(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(r=>{this.patchRootIdOnNode(r,t)})}},vn=class{constructor(e){C(this,"shadowDoms",new WeakSet),C(this,"mutationCb"),C(this,"scrollCb"),C(this,"bypassOptions"),C(this,"mirror"),C(this,"restoreHandlers",[]),this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){if(!bt(e)||this.shadowDoms.has(e))return;this.shadowDoms.add(e);let r=sl({...this.bypassOptions,doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},e);this.restoreHandlers.push(()=>r.disconnect()),this.restoreHandlers.push(nl({...this.bypassOptions,scrollCb:this.scrollCb,doc:e,mirror:this.mirror})),setTimeout(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(D.host(e))),this.restoreHandlers.push(ol({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))},0)}observeAttachShadow(e){!e.contentWindow||!e.contentDocument||this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){let r=this;this.restoreHandlers.push(ut(e.prototype,"attachShadow",function(n){return function(o){let i=n.call(this,o),l=D.shadowRoot(this);return l&&tl(this)&&r.addShadowRoot(l,t),i}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}},tt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",gp=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(vt=0;vt<tt.length;vt++)gp[tt.charCodeAt(vt)]=vt;var vt,yp=function(s){var e=new Uint8Array(s),t,r=e.length,n="";for(t=0;t<r;t+=3)n+=tt[e[t]>>2],n+=tt[(e[t]&3)<<4|e[t+1]>>4],n+=tt[(e[t+1]&15)<<2|e[t+2]>>6],n+=tt[e[t+2]&63];return r%3===2?n=n.substring(0,n.length-1)+"=":r%3===1&&(n=n.substring(0,n.length-2)+"=="),n},pi=new Map;function wp(s,e){let t=pi.get(s);return t||(t=new Map,pi.set(s,t)),t.has(e)||t.set(e,[]),t.get(e)}var il=(s,e,t)=>{if(!s||!(ll(s,e)||typeof s=="object"))return;let r=s.constructor.name,n=wp(t,r),o=n.indexOf(s);return o===-1&&(o=n.length,n.push(s)),o};function br(s,e,t){if(s instanceof Array)return s.map(r=>br(r,e,t));if(s===null)return s;if(s instanceof Float32Array||s instanceof Float64Array||s instanceof Int32Array||s instanceof Uint32Array||s instanceof Uint8Array||s instanceof Uint16Array||s instanceof Int16Array||s instanceof Int8Array||s instanceof Uint8ClampedArray)return{rr_type:s.constructor.name,args:[Object.values(s)]};if(s instanceof ArrayBuffer){let r=s.constructor.name,n=yp(s);return{rr_type:r,base64:n}}else{if(s instanceof DataView)return{rr_type:s.constructor.name,args:[br(s.buffer,e,t),s.byteOffset,s.byteLength]};if(s instanceof HTMLImageElement){let r=s.constructor.name,{src:n}=s;return{rr_type:r,src:n}}else if(s instanceof HTMLCanvasElement){let r="HTMLImageElement",n=s.toDataURL();return{rr_type:r,src:n}}else{if(s instanceof ImageData)return{rr_type:s.constructor.name,args:[br(s.data,e,t),s.width,s.height]};if(ll(s,e)||typeof s=="object"){let r=s.constructor.name,n=il(s,e,t);return{rr_type:r,index:n}}}}return s}var al=(s,e,t)=>s.map(r=>br(r,e,t)),ll=(s,e)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(n=>typeof e[n]=="function").find(n=>s instanceof e[n]);function Sp(s,e,t,r){let n=[],o=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(let i of o)try{if(typeof e.CanvasRenderingContext2D.prototype[i]!="function")continue;let l=ut(e.CanvasRenderingContext2D.prototype,i,function(a){return function(...u){return ie(this.canvas,t,r,!0)||setTimeout(()=>{let c=al(u,e,this);s(this.canvas,{type:lt["2D"],property:i,args:c})},0),a.apply(this,u)}});n.push(l)}catch{let l=Zr(e.CanvasRenderingContext2D.prototype,i,{set(a){s(this.canvas,{type:lt["2D"],property:i,args:[a],setter:!0})}});n.push(l)}return()=>{n.forEach(i=>i())}}function vp(s){return s==="experimental-webgl"?"webgl":s}function mi(s,e,t,r){let n=[];try{let o=ut(s.HTMLCanvasElement.prototype,"getContext",function(i){return function(l,...a){if(!ie(this,e,t,!0)){let u=vp(l);if("__context"in this||(this.__context=u),r&&["webgl","webgl2"].includes(u))if(a[0]&&typeof a[0]=="object"){let c=a[0];c.preserveDrawingBuffer||(c.preserveDrawingBuffer=!0)}else a.splice(0,1,{preserveDrawingBuffer:!0})}return i.apply(this,[l,...a])}});n.push(o)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{n.forEach(o=>o())}}function gi(s,e,t,r,n,o){let i=[],l=Object.getOwnPropertyNames(s);for(let a of l)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(a))try{if(typeof s[a]!="function")continue;let u=ut(s,a,function(c){return function(...d){let p=c.apply(this,d);if(il(p,o,this),"tagName"in this.canvas&&!ie(this.canvas,r,n,!0)){let m=al(d,o,this),g={type:e,property:a,args:m};t(this.canvas,g)}return p}});i.push(u)}catch{let u=Zr(s,a,{set(c){t(this.canvas,{type:e,property:a,args:[c],setter:!0})}});i.push(u)}return i}function Cp(s,e,t,r){let n=[];return n.push(...gi(e.WebGLRenderingContext.prototype,lt.WebGL,s,t,r,e)),typeof e.WebGL2RenderingContext<"u"&&n.push(...gi(e.WebGL2RenderingContext.prototype,lt.WebGL2,s,t,r,e)),()=>{n.forEach(o=>o())}}var ul="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",bp=s=>Uint8Array.from(atob(s),e=>e.charCodeAt(0)),yi=typeof window<"u"&&window.Blob&&new Blob([bp(ul)],{type:"text/javascript;charset=utf-8"});function Ep(s){let e;try{if(e=yi&&(window.URL||window.webkitURL).createObjectURL(yi),!e)throw"";let t=new Worker(e,{name:s?.name});return t.addEventListener("error",()=>{(window.URL||window.webkitURL).revokeObjectURL(e)}),t}catch{return new Worker("data:text/javascript;base64,"+ul,{name:s?.name})}finally{e&&(window.URL||window.webkitURL).revokeObjectURL(e)}}var Cn=class{constructor(e){C(this,"pendingCanvasMutations",new Map),C(this,"rafStamps",{latestId:0,invokeId:null}),C(this,"mirror"),C(this,"mutationCb"),C(this,"resetObservers"),C(this,"frozen",!1),C(this,"locked",!1),C(this,"processMutation",(a,u)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(a)||this.pendingCanvasMutations.set(a,[]),this.pendingCanvasMutations.get(a).push(u)});let{sampling:t="all",win:r,blockClass:n,blockSelector:o,recordCanvas:i,dataURLOptions:l}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,i&&t==="all"&&this.initCanvasMutationObserver(r,n,o),i&&typeof t=="number"&&this.initCanvasFPSObserver(t,r,n,o,{dataURLOptions:l})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(e,t,r,n,o){let i=mi(t,r,n,!0),l=new Map,a=new Ep;a.onmessage=g=>{let{id:f}=g.data;if(l.set(f,!1),!("base64"in g.data))return;let{base64:h,type:E,width:S,height:w}=g.data;this.mutationCb({id:f,type:lt["2D"],commands:[{property:"clearRect",args:[0,0,S,w]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:h}],type:E}]},0,0]}]})};let u=1e3/e,c=0,d,p=()=>{let g=[];return t.document.querySelectorAll("canvas").forEach(f=>{ie(f,r,n,!0)||g.push(f)}),g},m=g=>{if(c&&g-c<u){d=requestAnimationFrame(m);return}c=g,p().forEach(async f=>{var h;let E=this.mirror.getId(f);if(l.get(E)||f.width===0||f.height===0)return;if(l.set(E,!0),["webgl","webgl2"].includes(f.__context)){let w=f.getContext(f.__context);((h=w?.getContextAttributes())==null?void 0:h.preserveDrawingBuffer)===!1&&w.clear(w.COLOR_BUFFER_BIT)}let S=await createImageBitmap(f);a.postMessage({id:E,bitmap:S,width:f.width,height:f.height,dataURLOptions:o.dataURLOptions},[S])}),d=requestAnimationFrame(m)};d=requestAnimationFrame(m),this.resetObservers=()=>{i(),cancelAnimationFrame(d)}}initCanvasMutationObserver(e,t,r){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let n=mi(e,t,r,!1),o=Sp(this.processMutation.bind(this),e,t,r),i=Cp(this.processMutation.bind(this),e,t,r);this.resetObservers=()=>{n(),o(),i()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{let r=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,r)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;let r=this.pendingCanvasMutations.get(e);if(!r||t===-1)return;let n=r.map(i=>{let{type:l,...a}=i;return a}),{type:o}=r[0];this.mutationCb({id:t,type:o,commands:n}),this.pendingCanvasMutations.delete(e)}},bn=class{constructor(e){C(this,"trackedLinkElements",new WeakSet),C(this,"mutationCb"),C(this,"adoptedStyleSheetCb"),C(this,"styleMirror",new mn),this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(e.length===0)return;let r={id:t,styleIds:[]},n=[];for(let o of e){let i;this.styleMirror.has(o)?i=this.styleMirror.getId(o):(i=this.styleMirror.add(o),n.push({styleId:i,rules:Array.from(o.rules||CSSRule,(l,a)=>({rule:Ci(l,o.href),index:a}))})),r.styleIds.push(i)}n.length>0&&(r.styles=n),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}},En=class{constructor(){C(this,"nodeMap",new WeakMap),C(this,"active",!1)}inOtherBuffer(e,t){let r=this.nodeMap.get(e);return r&&Array.from(r).some(n=>n!==t)}add(e,t){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}destroy(){}},Z,Er,Ms,Ur=!1;try{if(Array.from([1],s=>s*2)[0]!==2){let s=document.createElement("iframe");document.body.appendChild(s),Array.from=((Co=s.contentWindow)==null?void 0:Co.Array.from)||Array.from,document.body.removeChild(s)}}catch(s){console.debug("Unable to override Array.from",s)}var Se=Nu();function ke(s={}){let{emit:e,checkoutEveryNms:t,checkoutEveryNth:r,blockClass:n="rr-block",blockSelector:o=null,ignoreClass:i="rr-ignore",ignoreSelector:l=null,maskTextClass:a="rr-mask",maskTextSelector:u=null,inlineStylesheet:c=!0,maskAllInputs:d,maskInputOptions:p,slimDOMOptions:m,maskInputFn:g,maskTextFn:f,maskAnchorHrefFn:h,blockImgSrcPattern:E=null,blockImgSrcFillOptions:S={backgroundColor:"#F6F7F9",strokeColor:"#E9EBEF",strokeWidth:"1px"},hooks:w,packFn:I,sampling:_={},dataURLOptions:y={},mousemoveWait:R,recordDOM:v=!0,recordCanvas:x=!1,recordCrossOriginIframes:O=!1,recordAfter:le=s.recordAfter==="DOMContentLoaded"?s.recordAfter:"load",userTriggeredOnInput:Y=!1,collectFonts:ue=!1,inlineImages:X=!1,plugins:j,keepIframeSrcFn:A=()=>!1,ignoreCSSAttributes:G=new Set([]),errorHandler:ee}=s;ep(ee);let F=O?window.parent===window:!0,te=!1;if(!F)try{window.parent.document&&(te=!1)}catch{te=!0}if(F&&!e)throw new Error("emit function is required");if(!F&&!te)return()=>{};R!==void 0&&_.mousemove===void 0&&(_.mousemove=R),Se.reset();let Q=d===!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}:p!==void 0?p:{password:!0},re=m===!0||m==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:m==="all",headMetaDescKeywords:m==="all",headTitleMutations:m==="all"}:m||{};Zf();let _e,ce=0,se=N=>{for(let ye of j||[])ye.eventProcessor&&(N=ye.eventProcessor(N));return I&&!te&&(N=I(N)),N};Z=(N,ye)=>{var K;let J=N;if(J.timestamp=$r(),(K=He[0])!=null&&K.isFrozen()&&J.type!==k.FullSnapshot&&!(J.type===k.IncrementalSnapshot&&J.data.source===T.Mutation)&&He.forEach(Re=>Re.unfreeze()),F)e?.(se(J),ye);else if(te){let Re={type:"rrweb",event:se(J),origin:window.location.origin,isCheckout:ye};window.parent.postMessage(Re,"*")}if(J.type===k.FullSnapshot)_e=J,ce=0;else if(J.type===k.IncrementalSnapshot){if(J.data.source===T.Mutation&&J.data.isAttachIframe)return;ce++;let Re=r&&ce>=r,U=t&&J.timestamp-_e.timestamp>t;(Re||U)&&Er(!0)}};let Ge=N=>{Z({type:k.IncrementalSnapshot,data:{source:T.Mutation,...N}})},ft=N=>Z({type:k.IncrementalSnapshot,data:{source:T.Scroll,...N}}),je=N=>Z({type:k.IncrementalSnapshot,data:{source:T.CanvasMutation,...N}}),ns=N=>Z({type:k.IncrementalSnapshot,data:{source:T.AdoptedStyleSheet,...N}}),be=new bn({mutationCb:Ge,adoptedStyleSheetCb:ns}),Ee=new Sn({mirror:Se,mutationCb:Ge,stylesheetManager:be,recordCrossOriginIframes:O,wrappedEmit:Z});for(let N of j||[])N.getMirror&&N.getMirror({nodeMirror:Se,crossOriginIframeMirror:Ee.crossOriginIframeMirror,crossOriginIframeStyleMirror:Ee.crossOriginIframeStyleMirror});let Ke=new En;Ms=new Cn({recordCanvas:x,mutationCb:je,win:window,blockClass:n,blockSelector:o,mirror:Se,sampling:_.canvas,dataURLOptions:y});let Yt=new vn({mutationCb:Ge,scrollCb:ft,bypassOptions:{blockClass:n,blockSelector:o,maskTextClass:a,maskTextSelector:u,inlineStylesheet:c,maskInputOptions:Q,dataURLOptions:y,maskTextFn:f,maskInputFn:g,maskAnchorHrefFn:h,blockImgSrcPattern:E,blockImgSrcFillOptions:S,recordCanvas:x,inlineImages:X,sampling:_,slimDOMOptions:re,iframeManager:Ee,stylesheetManager:be,canvasManager:Ms,keepIframeSrcFn:A,processedNodeManager:Ke},mirror:Se});Er=(N=!1)=>{if(!v)return;Z({type:k.Meta,data:{href:window.location.href,width:Ja(),height:Ka()}},N),be.reset(),Yt.init(),He.forEach(K=>K.lock());let ye=rc(document,{mirror:Se,blockClass:n,blockSelector:o,maskTextClass:a,maskTextSelector:u,inlineStylesheet:c,maskAllInputs:Q,maskTextFn:f,maskInputFn:g,maskAnchorHrefFn:h,blockImgSrcPattern:E,blockImgSrcFillOptions:S,slimDOM:re,dataURLOptions:y,recordCanvas:x,inlineImages:X,onSerialize:K=>{qa(K,Se)&&Ee.addIframe(K),Qa(K,Se)&&be.trackLinkElement(K),pn(K)&&Yt.addShadowRoot(D.shadowRoot(K),document)},onIframeLoad:(K,J)=>{Ee.attachIframe(K,J),Yt.observeAttachShadow(K)},onStylesheetLoad:(K,J)=>{be.attachLinkElement(K,J)},keepIframeSrcFn:A});if(!ye)return console.warn("Failed to snapshot the document");Z({type:k.FullSnapshot,data:{node:ye,initialOffset:ja(window)}},N),He.forEach(K=>K.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&be.adoptStyleSheets(document.adoptedStyleSheets,Se.getId(document))};try{let N=[],ye=J=>{var Re;return M(mp)({mutationCb:Ge,mousemoveCb:(U,os)=>Z({type:k.IncrementalSnapshot,data:{source:os,positions:U}}),mouseInteractionCb:U=>Z({type:k.IncrementalSnapshot,data:{source:T.MouseInteraction,...U}}),scrollCb:ft,viewportResizeCb:U=>Z({type:k.IncrementalSnapshot,data:{source:T.ViewportResize,...U}}),inputCb:U=>Z({type:k.IncrementalSnapshot,data:{source:T.Input,...U}}),mediaInteractionCb:U=>Z({type:k.IncrementalSnapshot,data:{source:T.MediaInteraction,...U}}),styleSheetRuleCb:U=>Z({type:k.IncrementalSnapshot,data:{source:T.StyleSheetRule,...U}}),styleDeclarationCb:U=>Z({type:k.IncrementalSnapshot,data:{source:T.StyleDeclaration,...U}}),canvasMutationCb:je,fontCb:U=>Z({type:k.IncrementalSnapshot,data:{source:T.Font,...U}}),selectionCb:U=>{Z({type:k.IncrementalSnapshot,data:{source:T.Selection,...U}})},customElementCb:U=>{Z({type:k.IncrementalSnapshot,data:{source:T.CustomElement,...U}})},blockClass:n,ignoreClass:i,ignoreSelector:l,maskTextClass:a,maskTextSelector:u,maskInputOptions:Q,inlineStylesheet:c,sampling:_,recordDOM:v,recordCanvas:x,inlineImages:X,userTriggeredOnInput:Y,collectFonts:ue,doc:J,maskInputFn:g,maskTextFn:f,maskAnchorHrefFn:h,blockImgSrcPattern:E,blockImgSrcFillOptions:S,keepIframeSrcFn:A,blockSelector:o,slimDOMOptions:re,dataURLOptions:y,mirror:Se,iframeManager:Ee,stylesheetManager:be,shadowDomManager:Yt,processedNodeManager:Ke,canvasManager:Ms,ignoreCSSAttributes:G,plugins:((Re=j?.filter(U=>U.observer))==null?void 0:Re.map(U=>({observer:U.observer,options:U.options,callback:os=>Z({type:k.Plugin,data:{plugin:U.name,payload:os}})})))||[]},w)};Ee.addLoadListener(J=>{try{N.push(ye(J.contentDocument))}catch(Re){console.warn(Re)}});let K=()=>{Er(),N.push(ye(document)),Ur=!0};return document.readyState==="interactive"||document.readyState==="complete"?K():(N.push(oe("DOMContentLoaded",()=>{Z({type:k.DomContentLoaded,data:{}}),le==="DOMContentLoaded"&&K()})),N.push(oe("load",()=>{Z({type:k.Load,data:{}}),le==="load"&&K()},window))),()=>{N.forEach(J=>J()),Ke.destroy(),Ur=!1,tp()}}catch(N){console.warn(N)}}ke.addCustomEvent=(s,e)=>{if(!Ur)throw new Error("please add custom event after start recording");Z({type:k.Custom,data:{tag:s,payload:e}})};ke.freezePage=()=>{He.forEach(s=>s.freeze())};ke.takeFullSnapshot=s=>{if(!Ur)throw new Error("please take full snapshot after start recording");Er(s)};ke.mirror=Se;var wi;(function(s){s[s.NotStarted=0]="NotStarted",s[s.Running=1]="Running",s[s.Stopped=2]="Stopped"})(wi||(wi={}));function Xr(s,e){if(!e)return;let t=new URL(s),r={};for(let[n,o]of t.searchParams)e.includes(n)&&(r[n]=o);return Object.keys(r).length>0?r:void 0}import{minimatch as xp}from"minimatch";function Kn(s){throw new Error(`This code path should be unreachable: ${s}`)}function Rp(s){return(s.startsWith("http://")||s.startsWith("https://"))&&(s=s.replace(/^https?:\/\//,"")),s.endsWith("/")&&(s=s.substring(0,s.length-1)),s=s.replace(/:\d+$/,""),s}function Ip(s,e){if(!e||e==="")return!1;if(e==="*")return!0;let t=Rp(e);return s===t}function me({urlStr:s,pathConfig:e}){let t=new URL(s),r=t.pathname,n=t.hostname,o=e.rules.filter(l=>Ip(n,l.domain));if(o.length>0){let l=o.find(a=>a.path==="**");if(!l)return e.defaultAction==="allow"?t:void 0;for(let a of o){if(a.path==="**")continue;let u=Je(r,a);if(u!==void 0)switch(a.action){case"allow":return t;case"block":return;case"replace":return t.pathname=u,t;default:Kn(a.action)}}return l.action==="allow"?t:void 0}let i=e.rules.filter(l=>!l.domain);for(let l of i){let a=Je(r,l);if(a!==void 0)switch(l.action){case"allow":return t;case"block":return;case"replace":return t.pathname=a,t;default:Kn(l.action)}}return e.defaultAction==="allow"?t:void 0}function Ut(s,e,t){let r=me({urlStr:s,pathConfig:t});r||(r=new URL(s));let n=Ap(r.pathname,e.rules||[]),o=[];for(let i of r.searchParams.keys()){let l=_p(i,n?.rules||[]);switch(l){case"accept":break;case"delete":o.push(i);break;case"anonymize":r.searchParams.set(i,"*");break;default:he(l)}}for(let i of o)r.searchParams.delete(i);if(r.pathname.includes("%3F")){let i=r.pathname.split("/");i[i.length-1]=i[i.length-1].split("%3F")[0],r.pathname=i.join("/")}return r.hash.includes("=")&&(r.hash=""),r.toString()}function Ap(s,e){for(let t of e)if(Je(s,{path:t.path}))return t}function _p(s,e){for(let t of e)if(xp(s,t.param))return t.anonymizeValue?"anonymize":"accept";return"delete"}var Jn=class{constructor(e,t,r){this.org=e;this.recorder=t;this.events=[];this._estimatedByteSize=0;this.events=r,this._estimatedByteSize=this.calculateTotalSize()}get estimatedByteSize(){return this._estimatedByteSize}calculateTotalSize(){try{let e=JSON.stringify(this.events,this.getCircularReplacer());return Op(e)}catch(e){return b(`Error calculating event size: ${e}. Falling back to approximation.`),this.events.length*500}}getCircularReplacer(){let e=new WeakSet;return(t,r)=>{if(typeof r=="object"&&r!==null){if(e.has(r))return;e.add(r)}return r}}clearEvents(){this.events=[],this._estimatedByteSize=this.calculateTotalSize()}pushEvent({eventHref:e,event:t}){if(!me({urlStr:e,pathConfig:this.org.pathConfig})){b(`URL not accepted: ${e}`);return}if(!this.recorder.isRecording){b("Dropping event - recorder is not recording");return}this.events.push(t),this._estimatedByteSize=this.calculateTotalSize()}getEvents(){return this.events}},qr=class{constructor(e,t,r,n,o){this.org=e;this.eventStorage=t;this.getHref=r;this.eventStore=new Jn(e,n,o)}get estimatedSerializedByteSize(){return this.eventStore.estimatedByteSize}clear(){this.eventStore.clearEvents(),this.eventStorage.removeEvents()}getEvents(){return this.eventStore.getEvents()}onVisibilityChange(e){e||this.eventStorage.setEvents(this.getEvents())}append(e){let t=this.getHref();if(e.type===we.Meta)e.data.href=Ut(e.data.href,this.org.allowedQueryParams,this.org.pathConfig),this.lastHref=this.getHref();else if(this.lastHref&&t!=this.lastHref){b(`URL changed from ${this.lastHref} to ${t}, adding artificial meta event for ${this.getHref()}`),this.eventStore.pushEvent({eventHref:t,event:mo({href:Ut(t,this.org.allowedQueryParams,this.org.pathConfig),delay:e.delay,timestamp:e.timestamp})});let r=Xr(t,this.org.customQueryParamsCohorts);r&&this.eventStore.pushEvent({eventHref:t,event:mt({payload:{userCohorts:r,source:"query_params"},timestamp:e.timestamp,delay:e.delay})}),this.lastHref=this.getHref()}if(e.type===we.IncrementalSnapshot&&e.data.source===pt.MouseInteraction&&e.data.type===ls.Click){let r=ke.mirror.getNode(e.data.id);if(r){let n=Dp(r),o=po({dom0EventHandlers:n,delay:e.delay,timestamp:e.timestamp});this.eventStore.pushEvent({eventHref:t,event:o})}}this.eventStore.pushEvent({eventHref:t,event:e})}};function Op(s){return new Blob([s]).size}function Dp(s){let e=[];for(let t=0;t<us.length;t++){let n=us[t];typeof s[n]=="function"&&e.push(n)}return e}var ge=Uint8Array,ae=Uint16Array,Wt=Uint32Array,to=new ge([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),ro=new ge([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),cl=new ge([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),pl=function(s,e){for(var t=new ae(31),r=0;r<31;++r)t[r]=e+=1<<s[r-1];for(var n=new Wt(t[30]),r=1;r<30;++r)for(var o=t[r];o<t[r+1];++o)n[o]=o-t[r]<<5|r;return[t,n]},ml=pl(to,2),Tp=ml[0],Xn=ml[1];Tp[28]=258,Xn[258]=28;var gl=pl(ro,0),Tw=gl[0],dl=gl[1],qn=new ae(32768);for(P=0;P<32768;++P)Pe=(P&43690)>>>1|(P&21845)<<1,Pe=(Pe&52428)>>>2|(Pe&13107)<<2,Pe=(Pe&61680)>>>4|(Pe&3855)<<4,qn[P]=((Pe&65280)>>>8|(Pe&255)<<8)>>>1;var Pe,P,Bt=function(s,e,t){for(var r=s.length,n=0,o=new ae(e);n<r;++n)++o[s[n]-1];var i=new ae(e);for(n=0;n<e;++n)i[n]=i[n-1]+o[n-1]<<1;var l;if(t){l=new ae(1<<e);var a=15-e;for(n=0;n<r;++n)if(s[n])for(var u=n<<4|s[n],c=e-s[n],d=i[s[n]-1]++<<c,p=d|(1<<c)-1;d<=p;++d)l[qn[d]>>>a]=u}else for(l=new ae(r),n=0;n<r;++n)l[n]=qn[i[s[n]-1]++]>>>15-s[n];return l},Ye=new ge(288);for(P=0;P<144;++P)Ye[P]=8;var P;for(P=144;P<256;++P)Ye[P]=9;var P;for(P=256;P<280;++P)Ye[P]=7;var P;for(P=280;P<288;++P)Ye[P]=8;var P,Qr=new ge(32);for(P=0;P<32;++P)Qr[P]=5;var P,Np=Bt(Ye,9,0);var Mp=Bt(Qr,5,0);var yl=function(s){return(s/8>>0)+(s&7&&1)},wl=function(s,e,t){(t==null||t>s.length)&&(t=s.length);var r=new(s instanceof ae?ae:s instanceof Wt?Wt:ge)(t-e);return r.set(s.subarray(e,t)),r};var $e=function(s,e,t){t<<=e&7;var r=e/8>>0;s[r]|=t,s[r+1]|=t>>>8},zt=function(s,e,t){t<<=e&7;var r=e/8>>0;s[r]|=t,s[r+1]|=t>>>8,s[r+2]|=t>>>16},Zn=function(s,e){for(var t=[],r=0;r<s.length;++r)s[r]&&t.push({s:r,f:s[r]});var n=t.length,o=t.slice();if(!n)return[new ge(0),0];if(n==1){var i=new ge(t[0].s+1);return i[t[0].s]=1,[i,1]}t.sort(function(_,y){return _.f-y.f}),t.push({s:-1,f:25001});var l=t[0],a=t[1],u=0,c=1,d=2;for(t[0]={s:-1,f:l.f+a.f,l,r:a};c!=n-1;)l=t[t[u].f<t[d].f?u++:d++],a=t[u!=c&&t[u].f<t[d].f?u++:d++],t[c++]={s:-1,f:l.f+a.f,l,r:a};for(var p=o[0].s,r=1;r<n;++r)o[r].s>p&&(p=o[r].s);var m=new ae(p+1),g=Qn(t[c-1],m,0);if(g>e){var r=0,f=0,h=g-e,E=1<<h;for(o.sort(function(y,R){return m[R.s]-m[y.s]||y.f-R.f});r<n;++r){var S=o[r].s;if(m[S]>e)f+=E-(1<<g-m[S]),m[S]=e;else break}for(f>>>=h;f>0;){var w=o[r].s;m[w]<e?f-=1<<e-m[w]++-1:++r}for(;r>=0&&f;--r){var I=o[r].s;m[I]==e&&(--m[I],++f)}g=e}return[new ge(m),g]},Qn=function(s,e,t){return s.s==-1?Math.max(Qn(s.l,e,t+1),Qn(s.r,e,t+1)):e[s.s]=t},hl=function(s){for(var e=s.length;e&&!s[--e];);for(var t=new ae(++e),r=0,n=s[0],o=1,i=function(a){t[r++]=a},l=1;l<=e;++l)if(s[l]==n&&l!=e)++o;else{if(!n&&o>2){for(;o>138;o-=138)i(32754);o>2&&(i(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(i(n),--o;o>6;o-=6)i(8304);o>2&&(i(o-3<<5|8208),o=0)}for(;o--;)i(n);o=1,n=s[l]}return[t.subarray(0,r),e]},Ht=function(s,e){for(var t=0,r=0;r<e.length;++r)t+=s[r]*e[r];return t},eo=function(s,e,t){var r=t.length,n=yl(e+2);s[n]=r&255,s[n+1]=r>>>8,s[n+2]=s[n]^255,s[n+3]=s[n+1]^255;for(var o=0;o<r;++o)s[n+o+4]=t[o];return(n+4+r)*8},fl=function(s,e,t,r,n,o,i,l,a,u,c){$e(e,c++,t),++n[256];for(var d=Zn(n,15),p=d[0],m=d[1],g=Zn(o,15),f=g[0],h=g[1],E=hl(p),S=E[0],w=E[1],I=hl(f),_=I[0],y=I[1],R=new ae(19),v=0;v<S.length;++v)R[S[v]&31]++;for(var v=0;v<_.length;++v)R[_[v]&31]++;for(var x=Zn(R,7),O=x[0],le=x[1],Y=19;Y>4&&!O[cl[Y-1]];--Y);var ue=u+5<<3,X=Ht(n,Ye)+Ht(o,Qr)+i,j=Ht(n,p)+Ht(o,f)+i+14+3*Y+Ht(R,O)+(2*R[16]+3*R[17]+7*R[18]);if(ue<=X&&ue<=j)return eo(e,c,s.subarray(a,a+u));var A,G,ee,F;if($e(e,c,1+(j<X)),c+=2,j<X){A=Bt(p,m,0),G=p,ee=Bt(f,h,0),F=f;var te=Bt(O,le,0);$e(e,c,w-257),$e(e,c+5,y-1),$e(e,c+10,Y-4),c+=14;for(var v=0;v<Y;++v)$e(e,c+3*v,O[cl[v]]);c+=3*Y;for(var Q=[S,_],re=0;re<2;++re)for(var _e=Q[re],v=0;v<_e.length;++v){var ce=_e[v]&31;$e(e,c,te[ce]),c+=O[ce],ce>15&&($e(e,c,_e[v]>>>5&127),c+=_e[v]>>>12)}}else A=Np,G=Ye,ee=Mp,F=Qr;for(var v=0;v<l;++v)if(r[v]>255){var ce=r[v]>>>18&31;zt(e,c,A[ce+257]),c+=G[ce+257],ce>7&&($e(e,c,r[v]>>>23&31),c+=to[ce]);var se=r[v]&31;zt(e,c,ee[se]),c+=F[se],se>3&&(zt(e,c,r[v]>>>5&8191),c+=ro[se])}else zt(e,c,A[r[v]]),c+=G[r[v]];return zt(e,c,A[256]),c+G[256]},kp=new Wt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Pp=function(s,e,t,r,n,o){var i=s.length,l=new ge(r+i+5*(1+Math.floor(i/7e3))+n),a=l.subarray(r,l.length-n),u=0;if(!e||i<8)for(var c=0;c<=i;c+=65535){var d=c+65535;d<i?u=eo(a,u,s.subarray(c,d)):(a[c]=o,u=eo(a,u,s.subarray(c,i)))}else{for(var p=kp[e-1],m=p>>>13,g=p&8191,f=(1<<t)-1,h=new ae(32768),E=new ae(f+1),S=Math.ceil(t/3),w=2*S,I=function(N){return(s[N]^s[N+1]<<S^s[N+2]<<w)&f},_=new Wt(25e3),y=new ae(288),R=new ae(32),v=0,x=0,c=0,O=0,le=0,Y=0;c<i;++c){var ue=I(c),X=c&32767,j=E[ue];if(h[X]=j,E[ue]=X,le<=c){var A=i-c;if((v>7e3||O>24576)&&A>423){u=fl(s,a,0,_,y,R,x,O,Y,c-Y,u),O=v=x=0,Y=c;for(var G=0;G<286;++G)y[G]=0;for(var G=0;G<30;++G)R[G]=0}var ee=2,F=0,te=g,Q=X-j&32767;if(A>2&&ue==I(c-Q))for(var re=Math.min(m,A)-1,_e=Math.min(32767,c),ce=Math.min(258,A);Q<=_e&&--te&&X!=j;){if(s[c+ee]==s[c+ee-Q]){for(var se=0;se<ce&&s[c+se]==s[c+se-Q];++se);if(se>ee){if(ee=se,F=Q,se>re)break;for(var Ge=Math.min(Q,se-2),ft=0,G=0;G<Ge;++G){var je=c-Q+G+32768&32767,ns=h[je],be=je-ns+32768&32767;be>ft&&(ft=be,j=je)}}}X=j,j=h[X],Q+=X-j+32768&32767}if(F){_[O++]=268435456|Xn[ee]<<18|dl[F];var Ee=Xn[ee]&31,Ke=dl[F]&31;x+=to[Ee]+ro[Ke],++y[257+Ee],++R[Ke],le=c+ee,++v}else _[O++]=s[c],++y[s[c]]}}u=fl(s,a,o,_,y,R,x,O,Y,c-Y,u)}return wl(l,0,r+yl(u)+n)},$p=function(){var s=1,e=0;return{p:function(t){for(var r=s,n=e,o=t.length,i=0;i!=o;){for(var l=Math.min(i+5552,o);i<l;++i)r+=t[i],n+=r;r%=65521,n%=65521}s=r,e=n},d:function(){return(s>>>8<<16|(e&255)<<8|e>>>8)+((s&255)<<23)*2}}},Lp=function(s,e,t,r,n){return Pp(s,e.level==null?6:e.level,e.mem==null?Math.ceil(Math.max(8,Math.min(13,Math.log(s.length)))*1.5):12+e.mem,t,r,!n)},Fp=function(s,e,t){for(;t;++e)s[e]=t,t>>>=8},Up=function(s,e){var t=e.level,r=t==0?0:t<6?1:t==9?3:2;s[0]=120,s[1]=r<<6|(r?32-2*r:1)};function Sl(s,e){e===void 0&&(e={});var t=$p();t.p(s);var r=Lp(s,e,2,4);return Up(r,e),Fp(r,r.length-4,t.d()),r}function so(s,e){var t=s.length;if(!e&&typeof TextEncoder<"u")return new TextEncoder().encode(s);for(var r=new ge(s.length+(s.length>>>1)),n=0,o=function(u){r[n++]=u},i=0;i<t;++i){if(n+5>r.length){var l=new ge(n+8+(t-i<<1));l.set(r),r=l}var a=s.charCodeAt(i);a<128||e?o(a):a<2048?(o(192|a>>>6),o(128|a&63)):a>55295&&a<57344?(a=65536+(a&1047552)|s.charCodeAt(++i)&1023,o(240|a>>>18),o(128|a>>>12&63),o(128|a>>>6&63),o(128|a&63)):(o(224|a>>>12),o(128|a>>>6&63),o(128|a&63))}return wl(r,0,n)}function no(s,e){var t="";if(!e&&typeof TextDecoder<"u")return new TextDecoder().decode(s);for(var r=0;r<s.length;){var n=s[r++];n<128||e?t+=String.fromCharCode(n):n<224?t+=String.fromCharCode((n&31)<<6|s[r++]&63):n<240?t+=String.fromCharCode((n&15)<<12|(s[r++]&63)<<6|s[r++]&63):(n=((n&15)<<18|(s[r++]&63)<<12|(s[r++]&63)<<6|s[r++]&63)-65536,t+=String.fromCharCode(55296|n>>10,56320|n&1023))}return t}var oo="v1";var io=s=>{let e={...s,v:oo};return no(Sl(so(JSON.stringify(e))),!0)};function vl(s){let e=new URL(s),t={};for(let[r,n]of e.searchParams)switch(r){case"utm_source":case"utm_medium":case"utm_campaign":case"utm_term":case"utm_content":t[`UTM@@${r}`]=n;break}return Object.keys(t).length>0?t:void 0}var Cl=3*1024*1024,bl=5e3,es=class{constructor(e,t,r,n,o,i,l){this.window=e;this.storage=t;this.eventHolder=r;this.recorder=n;this.api=o;this.organization=i;this.windowGetters=l;this.lastSendTime=-1;this.lastAutoCohorts=void 0;this.fastpathToken=void 0;n.setOnEvent(a=>this.onEvent(a))}onEvent(e){if(e.type===we.FullSnapshot){let o,i=Jt(this.window,this.organization.cohortsBootstrapConfig),l=vl(this.windowGetters.getHref()),a=Xr(this.windowGetters.getHref(),this.organization.customQueryParamsCohorts),u=ws(this.window);this.lastAutoCohorts=u,(l||i||u||a)&&(o=mt({payload:{userCohorts:{...i||{},...u||{},...l||{},...a||{}},source:"window_getters"},delay:e.delay,timestamp:e.timestamp}));let c=o?[...this.eventHolder.getEvents(),o,e]:[...this.eventHolder.getEvents(),e];this.clearAndSaveEvents(c);return}else if(e.type===we.IncrementalSnapshot&&e.data.source===pt.Mutation){let o=ws(this.window);o&&(!this.lastAutoCohorts||Object.keys(o).length!==Object.keys(this.lastAutoCohorts).length)&&(b("auto cohorts different, appending new event",o),this.eventHolder.append(mt({payload:{userCohorts:o,source:"window_getters"},delay:e.delay,timestamp:e.timestamp}))),this.lastAutoCohorts=o}this.eventHolder.append(e);let t=this.eventHolder.estimatedSerializedByteSize,n=Date.now()-this.lastSendTime;t>Cl&&n>=bl&&(b(`MAX_EVENT_BYTE_SIZE and timeSinceLastSend exceeded: ${t} > ${Cl} and ${n} >= ${bl}`),this.clearAndSaveEvents())}async clearAndSaveEvents(e){let t=this.windowGetters.getHref();if(!me({urlStr:t,pathConfig:this.organization.pathConfig}))return;let r=e||this.eventHolder.getEvents();if(r.length!==0){this.eventHolder.clear();try{b("saving events...");let n=await this.prepareAndSendEvents(r);switch(b("save events result",n.type),n.type){case"success":break;case"recreate-session":await this.recreateSession(n.session);break;case"no-session":case"unknown-failure":case"rate-limit-exceeded":this.storage.removeSession(),this.eventHolder.clear();break;default:he(n)}}catch(n){throw b("error saving events",n),this.storage.removeSession(),n}}}async prepareAndSendEvents(e){this.lastSendTime=Date.now();let t=this.storage.getSession();if(!t)return{type:"no-session"};if(t.eventPostUrl&&t.eventPostToken){let o=JSON.parse(atob(t.eventPostToken.split(".")[1]));if(o&&Date.now()>o.lastEventAt-10*1e3){b("refreshing token as it is about to expire");let i=await this.refreshToken(t);if(i.type!=="success")return i;if(t=this.storage.getSession(),!t)return{type:"no-session"}}}let r=t.compressionType==="RRWEB_PACK"?e.map(o=>io(o)):e,n=await this.api.saveSessionEvents({sessionId:t.id,events:r,metadata:{url:Ut(this.windowGetters.getHref(),this.organization.allowedQueryParams,this.organization.pathConfig)},eventPostUrl:t.eventPostUrl,eventPostToken:t.eventPostToken,fastpathToken:this.fastpathToken});if(!n)return{type:"unknown-failure"};if(n.error)switch(n.error.code){case"SessionNotFound":case"SessionAlreadySynced":return{type:"recreate-session",session:t};case"RateLimitExceeded":return{type:"rate-limit-exceeded"}}if(!n.data)return{type:"unknown-failure"};if(n.data&&"code"in n.data)switch(n.data.code){case"TOKEN_REFRESH":{b("refreshing token as it expired on the worker");let o=await this.refreshToken(t);return o.type!=="success"?o:this.prepareAndSendEvents(e)}default:he(n.data.code)}if(this.fastpathToken=n.data.fastpathToken,n.response.status<200||n.response.status>201)throw new Error(`got status ${n.response.status}`);return{type:"success"}}async refreshToken(e){let t=await this.api.refreshEventToken({sessionId:e.id});if(!t)return{type:"unknown-failure"};if(t.error)switch(t.error.code){case"SessionNotFound":case"SessionAlreadySynced":return{type:"recreate-session",session:e};case"RateLimitExceeded":return{type:"rate-limit-exceeded"}}return t.data?(this.storage.setSession({...e,eventPostToken:t.data.token}),{type:"success"}):{type:"unknown-failure"}}async recreateSession(e){b("recreating sessions");let t,r=this.recorder.isRecording;this.recorder.setRecording(!1),this.storage.removeSession(),this.fastpathToken=void 0;let n,o;try{b("recreating session...");let l=await this.api.startSession({orgId:e.settings.orgId,language:e.settings.language||this.windowGetters.getLanguage(),domain:new URL(this.windowGetters.getHref()).hostname,userCohorts:e.settings.userCohorts||{},uid:e.settings.uid,devicePixelRatio:this.windowGetters.getDevicePixelRatio(),adoraUserId:e.adoraUserId,documentReferrer:e.documentReferrer,snippetVersion:Kt});if(!l||l.error)return;if(l.response.status!==201){b("session not created, aborting");return}if(!l.data||!("session"in l.data)){b("malformed session, exiting");return}l?.data&&"eventPostUrl"in l.data&&l.data.eventPostUrl&&"eventPostToken"in l.data&&l.data.eventPostToken&&(n=l.data.eventPostUrl,o=l.data.eventPostToken),t=l.data}catch{}if(!t)return;let i={id:t.session.id,createdAt:t.session.createdAt,status:t.session.status,lastSyncedAt:t.session.lastSyncedAt,domain:t.session.domain,requestIp:t.session.requestIp,country:t.session.country,userAgent:t.session.userAgent,language:t.session.language,initialUserCohorts:t.session.initialUserCohorts,devicePixelRatio:t.session.devicePixelRatio,organization:t.organization,settings:e.settings,adoraUserId:e.adoraUserId,documentReferrer:e.documentReferrer,canvasRecordingEnabled:e.canvasRecordingEnabled,eventPostUrl:n,eventPostToken:o,limitedCanvasRecording:e.limitedCanvasRecording,compressionType:e.compressionType};this.storage.setSession(i),this.eventHolder.clear(),r&&this.recorder.setRecording(!0)}};var ct,El=()=>{if(ct!==void 0)return ct;try{return ct=document.createElement("canvas").toDataURL("image/webp").indexOf("data:image/webp")===0,b("adora script - isWebpSupported? - ",ct),ct}catch{return ct=!1,!1}};var ts=class{constructor(e,t,r,n){this.limitedCanvasRecording=e;this.canvasRecordingEnabled=t;this.org=r;this.rrwebRecorder=n;this.startable=!0;b("new recorder")}setOnEvent(e){this.onEvent=e}get args(){let e=this.org.blockedCSSClasses.length>0?`|(${this.org.blockedCSSClasses.join(")|(")})`:"",t=this.org.maskedCSSClasses&&this.org.maskedCSSClasses?.length>0?`|(${this.org.maskedCSSClasses?.join(")|(")})`:"",r=El()?"image/webp":this.limitedCanvasRecording?"image/jpeg":"image/png";return{emit:n=>{if(!this.onEvent)throw new Error("onEvent must be assigned before starting recording");this.onEvent(n)},userTriggeredOnInput:!0,blockClass:new RegExp(`(adora-block)|(rr-block|fs-exclude|ph-no-capture)${e}`),maskTextClass:new RegExp(`(adora-mask)|(rr-mask|fs-mask)${t}`),maskAllInputs:!0,maskInputFn:(n,o)=>Rl(this.org,o)?n:"*".repeat(n.length),maskTextFn:(n,o)=>o&&this.org.maskByDefault&&o.closest('button,a,div[role="button"],div[role*="menuitem"],input[type="button"],input[type="submit"],input[type="reset"]')||o&&Rl(this.org,o)?n:n.replace(/[\S]/g,"*"),maskTextSelector:this.org?.maskByDefault?"*":"",recordCanvas:this.canvasRecordingEnabled,sampling:this.canvasRecordingEnabled?{canvas:this.limitedCanvasRecording?1:2}:void 0,dataURLOptions:this.canvasRecordingEnabled?{type:r,quality:.6}:{}}}recordChangeCustomCohort(e){b("sending custom cohort change",e),this.rrwebRecorder.addCustomEvent(fo,e)}recordCLS(e){this.rrwebRecorder.addCustomEvent("CLS",e)}recordFID(e){this.rrwebRecorder.addCustomEvent("FID",e)}recordLCP(e){this.rrwebRecorder.addCustomEvent("LCP",e)}recordVisibilityChange(e){this.rrwebRecorder.addCustomEvent("Adora.VisibilityChange",{visibilityState:e})}recordFocusChange(e){this.rrwebRecorder.addCustomEvent("Adora.FocusChange",{focusState:e})}get isRecording(){return this.rrwebRecorder.isRecording}setRecording(e){if(b("setRecording",`requested status: ${e}`,`current status ${this.rrwebRecorder.isRecording}`),this.rrwebRecorder.isRecording!==e){if(e){this.startRecording();return}this.stopRecording()}}startRecording(){if(this.isRecording)throw new Error("recording already in progress!");if(!this.startable){b("recorder is not startable, returning");return}this.rrwebRecorder.record(this.args)}stopRecording(){this.rrwebRecorder.stop()}stopFutureRecordings(){this.startable=!1}};function Rl(s,e){if(e.classList.contains("adora-unmask"))return!0;for(let t of s.unmaskSelectors)if(Array.from(document.querySelectorAll(t)).find(r=>r===e))return!0;return!1}var rs=class{constructor(){this._isRecording=!1}get isRecording(){return this._isRecording}record(e){if(b("record",{stopFn:typeof this.stopFn,isRecording:this._isRecording}),this.stopFn!==void 0&&this.stop(),this._isRecording=!0,this.stopFn=ke(e),!this.stopFn)throw new Error("recorder could not successfully start")}stop(){this._isRecording=!1,this.stopFn&&(this.stopFn(),this.stopFn=void 0)}addCustomEvent(e,t){if(!this._isRecording)return b("WARNING! attempting to add custom event with recording off"),!1;try{ke.addCustomEvent(e,t)}catch(r){return b("trying to record an event even though",r),!1}return!0}};var Il=5e3;function xl({sessionType:s}){b("initialize recording");let e=new Le(s,new De),t=e.getSession();if(!t)return;let r=new Oe(t.settings.backendUrl),n=new jt(s,new De),o=n.getEvents();n.removeEvents();let i=()=>window.location.href,l=()=>window.navigator.language,a=()=>window.devicePixelRatio,u=new rs,c=new ts(t.limitedCanvasRecording??!1,t.canvasRecordingEnabled??!1,t.organization,u),d=new qr(t.organization,n,i,c,o||[]),p=new es(window,e,d,c,r,t.organization,{getHref:i,getLanguage:l,getDevicePixelRatio:a}),m=window.location.href;me({urlStr:m,pathConfig:t.organization.pathConfig})?(b("starting recording..."),c.setRecording(!0)):b("recording did not start as current URL is blocked");let g=Jt(window,t.organization.cohortsBootstrapConfig);c.isRecording&&(c.recordChangeCustomCohort({uid:t.settings.uid,userCohorts:t.settings.userCohorts?{...g,...t.settings.userCohorts}:{}}),e.setSession(t)),dt.onCLS(I=>{c.isRecording&&c.recordCLS(I)}),dt.onFID(I=>{c.isRecording&&c.recordFID(I)}),dt.onLCP(I=>{c.isRecording&&c.recordLCP(I)});let f=()=>{p.clearAndSaveEvents(d.getEvents())},h=window.setInterval(f,Il);window.addEventListener("blur",()=>{c.recordFocusChange("blur")}),window.addEventListener("focus",()=>{c.recordFocusChange("focus")}),document.addEventListener("visibilitychange",()=>{if(b(`detected a visibility change to ${document.visibilityState}`),c.isRecording&&c.recordVisibilityChange(document.visibilityState),document.visibilityState==="hidden"){h&&(b("clearing the saveInterval"),clearInterval(h),h=void 0),d.onVisibilityChange(!1);return}h||(b("resuming the saveInterval"),h=window.setInterval(f,Il))});let E=m,S=new MutationObserver(function(){if(d&&window.location.href!==E){let I=me({urlStr:window.location.href,pathConfig:t.organization.pathConfig});b(`url changed detected, status: ${!!I}`),c.setRecording(!!I),E=window.location.href}});return S.observe(document,{subtree:!0,childList:!0}),{recorder:c,eventSync:p,urlChangeObserverDispose:()=>{S.disconnect()}}}var Al=s=>xl(s);var ht=!1,_l="_adora_user_id",Ol="_adora_rate_limited",Ae,Vt,ao="stopped",Dl=()=>{b("startRecording",`adoraIsRunning: ${ht}`),ao==="started"&&(Ae=Al({sessionType:"adoraSessionScript"}))},Tl=1e3*60*30,LS=async({userCohorts:s,...e})=>{let t=e;if(ao="started",b("adora start",{adoraIsRunning:ht,uid:t.uid,userCohorts:s||{}}),typeof window.sessionStorage!="object"){b("SSR detected");return}if(s){t.userCohorts={};for(let[a,u]of Object.entries(s))u!==void 0?(b("setting user cohorts key",{key:a,value:u}),t.userCohorts[a]=u):b("found undefined user cohorts key",{key:a})}let r=new Le("adoraSessionScript",new De),n=r.getSession();if(n){b("session detected; finding if changes should be written");let a=!1;if(t.uid&&n.settings.uid!==t.uid&&(b("detected uid change"),n.settings.uid=t.uid,r.setSession(n),a=!0),t.userCohorts&&Object.keys(t.userCohorts).length>0){b("detected user cohorts");let u=structuredClone(n.settings.userCohorts);zp(u,t.userCohorts)||(b("detected user cohorts have been changed"),n.settings.userCohorts=t.userCohorts,r.setSession(n),a=!0)}a&&Ae?.recorder&&Ae?.recorder.isRecording&&(b("writing cohort change to recorder"),Ae?.recorder.recordChangeCustomCohort({uid:n.settings.uid,userCohorts:n.settings.userCohorts?{...n.settings.userCohorts}:{}}))}if(ht===!0)return;ht=!0;let o=r.lastRateLimitedTimestamp;if(o!==void 0){if(Date.now()-o<Tl){b("exiting as the session has been rate limited recently");return}r.clearLastRateLimitedTimestamp()}if(ss.get(Ol)){b("exiting as the domain has been rate limited recently");return}if(n){b("start recording for existing session"),Dl();return}let i=!1,l=async(a,u)=>{if(b("start status",{started:i}),i)return;i=!0;let c=await wo("adoraSessionScript",u,t);if(c.type==="error"){c.code==="RateLimitExceeded"&&(b("setting expiration on local storage"),r.setLastRateLimitedTimestamp(Date.now()),a&&(b("setting expiration cookie"),ss.set(Ol,a,{expires:new Date(Date.now()+Tl),domain:a})));return}Dl()};b("launching session preload");try{let a=await new Oe(t.backendUrl).sessionPreload({orgId:t.orgId});b("session preload resolved");let u=window.location.href;if(a){if(a.error){b("error preloading",a.error);return}if("scheduledDowntime"in a.data){b("scheduled downtime; exiting");return}let{organization:c}=a.data;b("session preload success");let d=ss.get(_l),p;b("existing adora user id cookie:",d);for(let m of c.cookieDomains)(window.location.hostname.toLowerCase()===m||window.location.hostname.toLowerCase().endsWith("."+m))&&(p=m,d||(d=Hp(),ss.set(_l,d,{domain:m,expires:new Date(Date.now()+365*24*60*60*1e3)}),b("setting adoraUserId cookie on domain",d)));b("using adora user id:",d),me({urlStr:u,pathConfig:c.pathConfig})?(b("at an unblocked URL, starting adora"),await l(p,d)):(b("at an blocked URL, waiting for unblocked URL to start adora"),Vt&&Vt.disconnect(),Vt=new MutationObserver(function(m,g){if(u!=window.location.href){let f=window.location.href,h=me({urlStr:f,pathConfig:c.pathConfig});if(b(`url changed detected during blocked state, status: ${!!h}`),h){b("disconnecting observer"),g.disconnect(),b("scheduling adora to start"),l(p,d);return}u=f}}),Vt.observe(document,{subtree:!0,childList:!0}))}}catch(a){b("Error in adoraStart:",a)}},FS=async()=>{ao="stopped",b("adora stop",{adoraIsRunning:ht}),Ae&&(Ae.recorder.setRecording(!1),Ae.recorder.stopFutureRecordings(),Ae.urlChangeObserverDispose(),await Ae.eventSync.clearAndSaveEvents()),Vt?.disconnect(),ht=!1,Ae=void 0};export{ht as adoraIsRunning,LS as adoraStart,FS as adoraStop};
3
+ or you can use record.mirror to access the mirror instance during recording.`,no={map:{},getId(){return console.error(Fe),-1},getNode(){return console.error(Fe),null},removeNodeFromMap(){console.error(Fe)},has(){return console.error(Fe),!1},reset(){console.error(Fe)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(no=new Proxy(no,{get(e,t,r){return t==="map"&&console.error(Fe),Reflect.get(e,t,r)}}));function et(e,t,r={}){let o=null,n=0;return function(...s){let a=Date.now();!n&&r.leading===!1&&(n=a);let c=t-(a-n),i=this;c<=0||c>t?(o&&(clearTimeout(o),o=null),n=a,e.apply(i,s)):!o&&r.trailing!==!1&&(o=setTimeout(()=>{n=r.leading===!1?0:Date.now(),o=null,e.apply(i,s)},c))}}function At(e,t,r,o,n=window){let s=n.Object.getOwnPropertyDescriptor(e,t);return n.Object.defineProperty(e,t,o?r:{set(a){setTimeout(()=>{r.set.call(this,a)},0),s&&s.set&&s.set.call(this,a)}}),()=>At(e,t,s||{},!0)}function Be(e,t,r){try{if(!(t in e))return()=>{};let o=e[t],n=r(o);return typeof n=="function"&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__rrweb_original__:{enumerable:!1,value:o}})),e[t]=n,()=>{e[t]=o}}catch{return()=>{}}}var Et=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(Et=()=>new Date().getTime());function Ro(e){var t,r,o,n;let s=e.document;return{left:s.scrollingElement?s.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:s.documentElement.scrollLeft||s?.body&&((t=T.parentElement(s.body))==null?void 0:t.scrollLeft)||((r=s?.body)==null?void 0:r.scrollLeft)||0,top:s.scrollingElement?s.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:s?.documentElement.scrollTop||s?.body&&((o=T.parentElement(s.body))==null?void 0:o.scrollTop)||((n=s?.body)==null?void 0:n.scrollTop)||0}}function Ao(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Do(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function To(e){return e?e.nodeType===e.ELEMENT_NODE?e:T.parentElement(e):null}function te(e,t,r,o){if(!e)return!1;let n=To(e);if(!n)return!1;try{if(typeof t=="string"){if(n.classList.contains(t)||o&&n.closest("."+t)!==null)return!0}else if(wt(n,t,o))return!0}catch{}return!!(r&&(n.matches(r)||o&&n.closest(r)!==null))}function $s(e,t){return t.getId(e)!==-1}function nr(e,t,r){return e.tagName==="TITLE"&&r.headTitleMutations?!0:t.getId(e)===Qe}function No(e,t){if(Je(e))return!1;let r=t.getId(e);if(!t.has(r))return!0;let o=T.parentNode(e);return o&&o.nodeType===e.DOCUMENT_NODE?!1:o?No(o,t):!0}function dr(e){return!!e.changedTouches}function Zs(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach)}function Oo(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function xo(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function cr(e){return e?e instanceof ar&&"shadowRoot"in e?!!e.shadowRoot:!!T.shadowRoot(e):!1}var ur=class{constructor(){S(this,"id",1),S(this,"styleIDMap",new WeakMap),S(this,"idStyleMap",new Map)}getId(t){return this.styleIDMap.get(t)??-1}has(t){return this.styleIDMap.has(t)}add(t,r){if(this.has(t))return this.getId(t);let o;return r===void 0?o=this.id++:o=r,this.styleIDMap.set(t,o),this.idStyleMap.set(o,t),o}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function Mo(e){var t;let r=null;return"getRootNode"in e&&((t=T.getRootNode(e))==null?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&T.host(T.getRootNode(e))&&(r=T.host(T.getRootNode(e))),r}function Js(e){let t=e,r;for(;r=Mo(t);)t=r;return t}function Xs(e){let t=e.ownerDocument;if(!t)return!1;let r=Js(e);return T.contains(t,r)}function ko(e){let t=e.ownerDocument;return t?T.contains(t,e)||Xs(e):!1}var M=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(M||{}),N=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(N||{}),ie=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(ie||{}),Ce=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(Ce||{}),We=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(We||{}),Ue=(e=>(e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e))(Ue||{});function so(e){return"__ln"in e}var lr=class{constructor(){S(this,"length",0),S(this,"head",null),S(this,"tail",null)}get(t){if(t>=this.length)throw new Error("Position outside of list range");let r=this.head;for(let o=0;o<t;o++)r=r?.next||null;return r}addNode(t){let r={value:t,previous:null,next:null};if(t.__ln=r,t.previousSibling&&so(t.previousSibling)){let o=t.previousSibling.__ln.next;r.next=o,r.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=r,o&&(o.previous=r)}else if(t.nextSibling&&so(t.nextSibling)&&t.nextSibling.__ln.previous){let o=t.nextSibling.__ln.previous;r.previous=o,r.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=r,o&&(o.next=r)}else this.head&&(this.head.previous=r),r.next=this.head,this.head=r;r.next===null&&(this.tail=r),this.length++}removeNode(t){let r=t.__ln;this.head&&(r.previous?(r.previous.next=r.next,r.next?r.next.previous=r.previous:this.tail=r.previous):(this.head=r.next,this.head?this.head.previous=null:this.tail=null),t.__ln&&delete t.__ln,this.length--)}},io=(e,t)=>`${e}@${t}`,hr=class{constructor(){S(this,"frozen",!1),S(this,"locked",!1),S(this,"texts",[]),S(this,"attributes",[]),S(this,"attributeMap",new WeakMap),S(this,"removes",[]),S(this,"mapRemoves",[]),S(this,"movedMap",{}),S(this,"addedSet",new Set),S(this,"movedSet",new Set),S(this,"droppedSet",new Set),S(this,"mutationCb"),S(this,"blockClass"),S(this,"blockSelector"),S(this,"maskTextClass"),S(this,"maskTextSelector"),S(this,"inlineStylesheet"),S(this,"maskInputOptions"),S(this,"maskTextFn"),S(this,"maskInputFn"),S(this,"maskAnchorHrefFn"),S(this,"blockImgSrcPattern"),S(this,"blockImgSrcFillOptions"),S(this,"keepIframeSrcFn"),S(this,"recordCanvas"),S(this,"inlineImages"),S(this,"slimDOMOptions"),S(this,"dataURLOptions"),S(this,"doc"),S(this,"mirror"),S(this,"iframeManager"),S(this,"stylesheetManager"),S(this,"shadowDomManager"),S(this,"canvasManager"),S(this,"processedNodeManager"),S(this,"unattachedDoc"),S(this,"processMutations",t=>{t.forEach(this.processMutation),this.emit()}),S(this,"emit",()=>{if(this.frozen||this.locked)return;let t=[],r=new Set,o=new lr,n=i=>{let u=i,d=Qe;for(;d===Qe;)u=u&&u.nextSibling,d=u&&this.mirror.getId(u);return d},s=i=>{let u=T.parentNode(i);if(!u||!ko(i))return;let d=!1;if(i.nodeType===Node.TEXT_NODE){let p=u.tagName;if(p==="TEXTAREA")return;p==="STYLE"&&this.addedSet.has(u)&&(d=!0)}let l=Je(u)?this.mirror.getId(Mo(i)):this.mirror.getId(u),g=n(i);if(l===-1||g===-1)return o.addNode(i);let f=Ye(i,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,maskAnchorHrefFn:this.maskAnchorHrefFn,blockImgSrcPattern:this.blockImgSrcPattern,blockImgSrcFillOptions:this.blockImgSrcFillOptions,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:p=>{Oo(p,this.mirror)&&this.iframeManager.addIframe(p),xo(p,this.mirror)&&this.stylesheetManager.trackLinkElement(p),cr(i)&&this.shadowDomManager.addShadowRoot(T.shadowRoot(i),this.doc)},onIframeLoad:(p,h)=>{this.iframeManager.attachIframe(p,h),this.shadowDomManager.observeAttachShadow(p)},onStylesheetLoad:(p,h)=>{this.stylesheetManager.attachLinkElement(p,h)},cssCaptured:d});f&&(t.push({parentId:l,nextId:g,node:f}),r.add(f.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let i of this.movedSet)ao(this.removes,i,this.mirror)&&!this.movedSet.has(T.parentNode(i))||s(i);for(let i of this.addedSet)!co(this.droppedSet,i)&&!ao(this.removes,i,this.mirror)||co(this.movedSet,i)?s(i):this.droppedSet.add(i);let a=null;for(;o.length;){let i=null;if(a){let u=this.mirror.getId(T.parentNode(a.value)),d=n(a.value);u!==-1&&d!==-1&&(i=a)}if(!i){let u=o.tail;for(;u;){let d=u;if(u=u.previous,d){let l=this.mirror.getId(T.parentNode(d.value));if(n(d.value)===-1)continue;if(l!==-1){i=d;break}else{let f=d.value,p=T.parentNode(f);if(p&&p.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let h=T.host(p);if(this.mirror.getId(h)!==-1){i=d;break}}}}}}if(!i){for(;o.head;)o.removeNode(o.head.value);break}a=i.previous,o.removeNode(i.value),s(i.value)}let c={texts:this.texts.map(i=>{let u=i.node,d=T.parentNode(u);return d&&d.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(d),{id:this.mirror.getId(u),value:i.value}}).filter(i=>!r.has(i.id)).filter(i=>this.mirror.has(i.id)),attributes:this.attributes.map(i=>{let{attributes:u}=i;if(typeof u.style=="string"){let d=JSON.stringify(i.styleDiff),l=JSON.stringify(i._unchangedStyles);d.length<u.style.length&&(d+l).split("var(").length===u.style.split("var(").length&&(u.style=i.styleDiff)}return{id:this.mirror.getId(i.node),attributes:u}}).filter(i=>!r.has(i.id)).filter(i=>this.mirror.has(i.id)),removes:this.removes,adds:t};!c.texts.length&&!c.attributes.length&&!c.removes.length&&!c.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(c))}),S(this,"genTextAreaValueMutation",t=>{let r=this.attributeMap.get(t);r||(r={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(r),this.attributeMap.set(t,r));let o=r.attributes.value=Array.from(T.childNodes(t),n=>T.textContent(n)||"").join("");r.attributes.value=bt({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:null,value:o,maskInputFn:this.maskInputFn})}),S(this,"processMutation",t=>{if(!nr(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{let r=T.textContent(t.target);!te(t.target,this.blockClass,this.blockSelector,!1)&&r!==t.oldValue&&this.texts.push({value:Eo(t.target,this.maskTextClass,this.maskTextSelector,!0)&&r?this.maskTextFn?this.maskTextFn(r,To(t.target)):r.replace(/[\S]/g,"*"):r,node:t.target});break}case"attributes":{let r=t.target,o=t.attributeName,n=t.target.getAttribute(o);if(o==="value"){let c=br(r);n=bt({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:c,value:n,maskInputFn:this.maskInputFn})}let s=te(t.target,this.blockClass,this.blockSelector,!1);if(s&&o==="style"){let c=t.target,{width:i,height:u}=c.getBoundingClientRect(),d=this.attributeMap.get(t.target);d||(d={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(d),this.attributeMap.set(t.target,d)),d.attributes.rr_width=`${i}px`,d.attributes.rr_height=`${u}px`}if(s||n===t.oldValue)return;let a=this.attributeMap.get(t.target);if(r.tagName==="IFRAME"&&o==="src"&&!this.keepIframeSrcFn(n))if(!r.contentDocument)o="rr_src";else return;if(a||(a={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(a),this.attributeMap.set(t.target,a)),o==="type"&&r.tagName==="INPUT"&&(t.oldValue||"").toLowerCase()==="password"&&r.setAttribute("data-rr-is-password","true"),!wo(r.tagName,o))if(a.attributes[o]=Co(this.doc,Ne(r.tagName),Ne(o),n),o==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}let c=this.unattachedDoc.createElement("span");t.oldValue&&c.setAttribute("style",t.oldValue);for(let i of Array.from(r.style)){let u=r.style.getPropertyValue(i),d=r.style.getPropertyPriority(i);u!==c.style.getPropertyValue(i)||d!==c.style.getPropertyPriority(i)?d===""?a.styleDiff[i]=u:a.styleDiff[i]=[u,d]:a._unchangedStyles[i]=[u,d]}for(let i of Array.from(c.style))r.style.getPropertyValue(i)===""&&(a.styleDiff[i]=!1)}else o==="open"&&r.tagName==="DIALOG"&&(r.matches("dialog:modal")?a.attributes.rr_open_mode="modal":a.attributes.rr_open_mode="non-modal");break}case"childList":{if(te(t.target,this.blockClass,this.blockSelector,!0))return;if(t.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(t.target);return}t.addedNodes.forEach(r=>this.genAdds(r,t.target)),t.removedNodes.forEach(r=>{let o=this.mirror.getId(r),n=Je(t.target)?this.mirror.getId(T.host(t.target)):this.mirror.getId(t.target);te(t.target,this.blockClass,this.blockSelector,!1)||nr(r,this.mirror,this.slimDOMOptions)||!$s(r,this.mirror)||(this.addedSet.has(r)?(fr(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(t.target)&&o===-1||No(t.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[io(o,n)]?fr(this.movedSet,r):this.removes.push({parentId:n,id:o,isShadow:Je(t.target)&&Xe(t.target)?!0:void 0})),this.mapRemoves.push(r))});break}}}),S(this,"genAdds",(t,r)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!(this.addedSet.has(t)||this.movedSet.has(t))){if(this.mirror.hasNode(t)){if(nr(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);let o=null;r&&this.mirror.hasNode(r)&&(o=this.mirror.getId(r)),o&&o!==-1&&(this.movedMap[io(this.mirror.getId(t),o)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);te(t,this.blockClass,this.blockSelector,!1)||(T.childNodes(t).forEach(o=>this.genAdds(o)),cr(t)&&T.childNodes(T.shadowRoot(t)).forEach(o=>{this.processedNodeManager.add(o,this),this.genAdds(o,t)}))}})}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","maskAnchorHrefFn","blockImgSrcPattern","blockImgSrcFillOptions","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(r=>{this[r]=t[r]})}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 fr(e,t){e.delete(t),T.childNodes(t).forEach(r=>fr(e,r))}function ao(e,t,r){return e.length===0?!1:qs(e,t,r)}function qs(e,t,r){let o=T.parentNode(t);for(;o;){let n=r.getId(o);if(e.some(s=>s.id===n))return!0;o=T.parentNode(o)}return!1}function co(e,t){return e.size===0?!1:Lo(e,t)}function Lo(e,t){let r=T.parentNode(t);return r?e.has(r)?!0:Lo(e,r):!1}var qe;function Qs(e){qe=e}function ei(){qe=void 0}var x=e=>qe?(...r)=>{try{return e(...r)}catch(o){if(qe&&qe(o)===!0)return;throw o}}:e,Te=[];function tt(e){try{if("composedPath"in e){let t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch{}return e&&e.target}function Po(e,t){let r=new hr;Te.push(r),r.init(e);let o=new(_o())(x(r.processMutations.bind(r)));return o.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),o}function ti({mousemoveCb:e,sampling:t,doc:r,mirror:o}){if(t.mousemove===!1)return()=>{};let n=typeof t.mousemove=="number"?t.mousemove:50,s=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500,a=[],c,i=et(x(l=>{let g=Date.now()-c;e(a.map(f=>(f.timeOffset-=g,f)),l),a=[],c=null}),s),u=x(et(x(l=>{let g=tt(l),{clientX:f,clientY:p}=dr(l)?l.changedTouches[0]:l;c||(c=Et()),a.push({x:f,y:p,id:o.getId(g),timeOffset:Et()-c}),i(typeof DragEvent<"u"&&l instanceof DragEvent?N.Drag:l instanceof MouseEvent?N.MouseMove:N.TouchMove)}),n,{trailing:!1})),d=[ee("mousemove",u,r),ee("touchmove",u,r),ee("drag",u,r)];return x(()=>{d.forEach(l=>l())})}function ri({mouseInteractionCb:e,doc:t,mirror:r,blockClass:o,blockSelector:n,sampling:s}){if(s.mouseInteraction===!1)return()=>{};let a=s.mouseInteraction===!0||s.mouseInteraction===void 0?{}:s.mouseInteraction,c=[],i=null,u=d=>l=>{let g=tt(l);if(te(g,o,n,!0))return;let f=null,p=d;if("pointerType"in l){switch(l.pointerType){case"mouse":f=Ce.Mouse;break;case"touch":f=Ce.Touch;break;case"pen":f=Ce.Pen;break}f===Ce.Touch?ie[d]===ie.MouseDown?p="TouchStart":ie[d]===ie.MouseUp&&(p="TouchEnd"):Ce.Pen}else dr(l)&&(f=Ce.Touch);f!==null?(i=f,(p.startsWith("Touch")&&f===Ce.Touch||p.startsWith("Mouse")&&f===Ce.Mouse)&&(f=null)):ie[d]===ie.Click&&(f=i,i=null);let h=dr(l)?l.changedTouches[0]:l;if(!h)return;let C=r.getId(g),{clientX:I,clientY:v}=h;x(e)({type:ie[p],id:C,x:I,y:v,...f!==null&&{pointerType:f}})};return Object.keys(ie).filter(d=>Number.isNaN(Number(d))&&!d.endsWith("_Departed")&&a[d]!==!1).forEach(d=>{let l=Ne(d),g=u(d);if(window.PointerEvent)switch(ie[d]){case ie.MouseDown:case ie.MouseUp:l=l.replace("mouse","pointer");break;case ie.TouchStart:case ie.TouchEnd:return}c.push(ee(l,g,t))}),x(()=>{c.forEach(d=>d())})}function Fo({scrollCb:e,doc:t,mirror:r,blockClass:o,blockSelector:n,sampling:s}){let a=x(et(x(c=>{let i=tt(c);if(!i||te(i,o,n,!0))return;let u=r.getId(i);if(i===t&&t.defaultView){let d=Ro(t.defaultView);e({id:u,x:d.left,y:d.top})}else e({id:u,x:i.scrollLeft,y:i.scrollTop})}),s.scroll||100));return ee("scroll",a,t)}function oi({viewportResizeCb:e},{win:t}){let r=-1,o=-1,n=x(et(x(()=>{let s=Ao(),a=Do();(r!==s||o!==a)&&(e({width:Number(a),height:Number(s)}),r=s,o=a)}),200));return ee("resize",n,t)}var ni=["INPUT","TEXTAREA","SELECT"],uo=new WeakMap;function si({inputCb:e,doc:t,mirror:r,blockClass:o,blockSelector:n,ignoreClass:s,ignoreSelector:a,maskInputOptions:c,maskInputFn:i,sampling:u,userTriggeredOnInput:d}){function l(v){let y=tt(v),_=v.isTrusted,A=y&&y.tagName;if(y&&A==="OPTION"&&(y=T.parentElement(y)),!y||!A||ni.indexOf(A)<0||te(y,o,n,!0)||y.classList.contains(s)||a&&y.matches(a))return;let m=y.value,E=!1,w=br(y)||"";w==="radio"||w==="checkbox"?E=y.checked:(c[A.toLowerCase()]||c[w])&&(m=bt({element:y,maskInputOptions:c,tagName:A,type:w,value:m,maskInputFn:i})),g(y,d?{text:m,isChecked:E,userTriggered:_}:{text:m,isChecked:E});let D=y.name;w==="radio"&&D&&E&&t.querySelectorAll(`input[type="radio"][name="${ii(D)}"]`).forEach(L=>{if(L!==y){let oe=L.value;g(L,d?{text:oe,isChecked:!E,userTriggered:!1}:{text:oe,isChecked:!E})}})}function g(v,y){let _=uo.get(v);if(!_||_.text!==y.text||_.isChecked!==y.isChecked){uo.set(v,y);let A=r.getId(v);x(e)({...y,id:A})}}let p=(u.input==="last"?["change"]:["input","change"]).map(v=>ee(v,x(l),t)),h=t.defaultView;if(!h)return()=>{p.forEach(v=>v())};let C=h.Object.getOwnPropertyDescriptor(h.HTMLInputElement.prototype,"value"),I=[[h.HTMLInputElement.prototype,"value"],[h.HTMLInputElement.prototype,"checked"],[h.HTMLSelectElement.prototype,"value"],[h.HTMLTextAreaElement.prototype,"value"],[h.HTMLSelectElement.prototype,"selectedIndex"],[h.HTMLOptionElement.prototype,"selected"]];return C&&C.set&&p.push(...I.map(v=>At(v[0],v[1],{set(){x(l)({target:this,isTrusted:!1})}},!1,h))),x(()=>{p.forEach(v=>v())})}function It(e){let t=[];function r(o,n){if(gt("CSSGroupingRule")&&o.parentRule instanceof CSSGroupingRule||gt("CSSMediaRule")&&o.parentRule instanceof CSSMediaRule||gt("CSSSupportsRule")&&o.parentRule instanceof CSSSupportsRule||gt("CSSConditionRule")&&o.parentRule instanceof CSSConditionRule){let a=Array.from(o.parentRule.cssRules).indexOf(o);n.unshift(a)}else if(o.parentStyleSheet){let a=Array.from(o.parentStyleSheet.cssRules).indexOf(o);n.unshift(a)}return n}return r(e,t)}function ii(e){return e.replace(/["\\]/g,"\\$&")}function _e(e,t,r){let o,n;return e?(e.ownerNode?o=t.getId(e.ownerNode):n=r.getId(e),{styleId:n,id:o}):{}}function ai({styleSheetRuleCb:e,mirror:t,stylesheetManager:r},{win:o}){if(!o.CSSStyleSheet||!o.CSSStyleSheet.prototype)return()=>{};let n=o.CSSStyleSheet.prototype.insertRule;o.CSSStyleSheet.prototype.insertRule=new Proxy(n,{apply:x((d,l,g)=>{let[f,p]=g,{id:h,styleId:C}=_e(l,t,r.styleMirror);return(h&&h!==-1||C&&C!==-1)&&e({id:h,styleId:C,adds:[{rule:f,index:p}]}),d.apply(l,g)})}),o.CSSStyleSheet.prototype.addRule=function(d,l,g=this.cssRules.length){let f=`${d} { ${l} }`;return o.CSSStyleSheet.prototype.insertRule.apply(this,[f,g])};let s=o.CSSStyleSheet.prototype.deleteRule;o.CSSStyleSheet.prototype.deleteRule=new Proxy(s,{apply:x((d,l,g)=>{let[f]=g,{id:p,styleId:h}=_e(l,t,r.styleMirror);return(p&&p!==-1||h&&h!==-1)&&e({id:p,styleId:h,removes:[{index:f}]}),d.apply(l,g)})}),o.CSSStyleSheet.prototype.removeRule=function(d){return o.CSSStyleSheet.prototype.deleteRule.apply(this,[d])};let a;o.CSSStyleSheet.prototype.replace&&(a=o.CSSStyleSheet.prototype.replace,o.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:x((d,l,g)=>{let[f]=g,{id:p,styleId:h}=_e(l,t,r.styleMirror);return(p&&p!==-1||h&&h!==-1)&&e({id:p,styleId:h,replace:f}),d.apply(l,g)})}));let c;o.CSSStyleSheet.prototype.replaceSync&&(c=o.CSSStyleSheet.prototype.replaceSync,o.CSSStyleSheet.prototype.replaceSync=new Proxy(c,{apply:x((d,l,g)=>{let[f]=g,{id:p,styleId:h}=_e(l,t,r.styleMirror);return(p&&p!==-1||h&&h!==-1)&&e({id:p,styleId:h,replaceSync:f}),d.apply(l,g)})}));let i={};mt("CSSGroupingRule")?i.CSSGroupingRule=o.CSSGroupingRule:(mt("CSSMediaRule")&&(i.CSSMediaRule=o.CSSMediaRule),mt("CSSConditionRule")&&(i.CSSConditionRule=o.CSSConditionRule),mt("CSSSupportsRule")&&(i.CSSSupportsRule=o.CSSSupportsRule));let u={};return Object.entries(i).forEach(([d,l])=>{u[d]={insertRule:l.prototype.insertRule,deleteRule:l.prototype.deleteRule},l.prototype.insertRule=new Proxy(u[d].insertRule,{apply:x((g,f,p)=>{let[h,C]=p,{id:I,styleId:v}=_e(f.parentStyleSheet,t,r.styleMirror);return(I&&I!==-1||v&&v!==-1)&&e({id:I,styleId:v,adds:[{rule:h,index:[...It(f),C||0]}]}),g.apply(f,p)})}),l.prototype.deleteRule=new Proxy(u[d].deleteRule,{apply:x((g,f,p)=>{let[h]=p,{id:C,styleId:I}=_e(f.parentStyleSheet,t,r.styleMirror);return(C&&C!==-1||I&&I!==-1)&&e({id:C,styleId:I,removes:[{index:[...It(f),h]}]}),g.apply(f,p)})})}),x(()=>{o.CSSStyleSheet.prototype.insertRule=n,o.CSSStyleSheet.prototype.deleteRule=s,a&&(o.CSSStyleSheet.prototype.replace=a),c&&(o.CSSStyleSheet.prototype.replaceSync=c),Object.entries(i).forEach(([d,l])=>{l.prototype.insertRule=u[d].insertRule,l.prototype.deleteRule=u[d].deleteRule})})}function Uo({mirror:e,stylesheetManager:t},r){var o,n,s;let a=null;r.nodeName==="#document"?a=e.getId(r):a=e.getId(T.host(r));let c=r.nodeName==="#document"?(o=r.defaultView)==null?void 0:o.Document:(s=(n=r.ownerDocument)==null?void 0:n.defaultView)==null?void 0:s.ShadowRoot,i=c?.prototype?Object.getOwnPropertyDescriptor(c?.prototype,"adoptedStyleSheets"):void 0;return a===null||a===-1||!c||!i?()=>{}:(Object.defineProperty(r,"adoptedStyleSheets",{configurable:i.configurable,enumerable:i.enumerable,get(){var u;return(u=i.get)==null?void 0:u.call(this)},set(u){var d;let l=(d=i.set)==null?void 0:d.call(this,u);if(a!==null&&a!==-1)try{t.adoptStyleSheets(u,a)}catch{}return l}}),x(()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:i.configurable,enumerable:i.enumerable,get:i.get,set:i.set})}))}function di({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:r,stylesheetManager:o},{win:n}){let s=n.CSSStyleDeclaration.prototype.setProperty;n.CSSStyleDeclaration.prototype.setProperty=new Proxy(s,{apply:x((c,i,u)=>{var d;let[l,g,f]=u;if(r.has(l))return s.apply(i,[l,g,f]);let{id:p,styleId:h}=_e((d=i.parentRule)==null?void 0:d.parentStyleSheet,t,o.styleMirror);return(p&&p!==-1||h&&h!==-1)&&e({id:p,styleId:h,set:{property:l,value:g,priority:f},index:It(i.parentRule)}),c.apply(i,u)})});let a=n.CSSStyleDeclaration.prototype.removeProperty;return n.CSSStyleDeclaration.prototype.removeProperty=new Proxy(a,{apply:x((c,i,u)=>{var d;let[l]=u;if(r.has(l))return a.apply(i,[l]);let{id:g,styleId:f}=_e((d=i.parentRule)==null?void 0:d.parentStyleSheet,t,o.styleMirror);return(g&&g!==-1||f&&f!==-1)&&e({id:g,styleId:f,remove:{property:l},index:It(i.parentRule)}),c.apply(i,u)})}),x(()=>{n.CSSStyleDeclaration.prototype.setProperty=s,n.CSSStyleDeclaration.prototype.removeProperty=a})}function ci({mediaInteractionCb:e,blockClass:t,blockSelector:r,mirror:o,sampling:n,doc:s}){let a=x(i=>et(x(u=>{let d=tt(u);if(!d||te(d,t,r,!0))return;let{currentTime:l,volume:g,muted:f,playbackRate:p,loop:h}=d;e({type:i,id:o.getId(d),currentTime:l,volume:g,muted:f,playbackRate:p,loop:h})}),n.media||500)),c=[ee("play",a(Ue.Play),s),ee("pause",a(Ue.Pause),s),ee("seeked",a(Ue.Seeked),s),ee("volumechange",a(Ue.VolumeChange),s),ee("ratechange",a(Ue.RateChange),s)];return x(()=>{c.forEach(i=>i())})}function ui({fontCb:e,doc:t}){let r=t.defaultView;if(!r)return()=>{};let o=[],n=new WeakMap,s=r.FontFace;r.FontFace=function(i,u,d){let l=new s(i,u,d);return n.set(l,{family:i,buffer:typeof u!="string",descriptors:d,fontSource:typeof u=="string"?u:JSON.stringify(Array.from(new Uint8Array(u)))}),l};let a=Be(t.fonts,"add",function(c){return function(i){return setTimeout(x(()=>{let u=n.get(i);u&&(e(u),n.delete(i))}),0),c.apply(this,[i])}});return o.push(()=>{r.FontFace=s}),o.push(a),x(()=>{o.forEach(c=>c())})}function li(e){let{doc:t,mirror:r,blockClass:o,blockSelector:n,selectionCb:s}=e,a=!0,c=x(()=>{let i=t.getSelection();if(!i||a&&i?.isCollapsed)return;a=i.isCollapsed||!1;let u=[],d=i.rangeCount||0;for(let l=0;l<d;l++){let g=i.getRangeAt(l),{startContainer:f,startOffset:p,endContainer:h,endOffset:C}=g;te(f,o,n,!0)||te(h,o,n,!0)||u.push({start:r.getId(f),startOffset:p,end:r.getId(h),endOffset:C})}s({ranges:u})});return c(),ee("selectionchange",c)}function hi({doc:e,customElementCb:t}){let r=e.defaultView;return!r||!r.customElements?()=>{}:Be(r.customElements,"define",function(n){return function(s,a,c){try{t({define:{name:s}})}catch{console.warn(`Custom element callback failed for ${s}`)}return n.apply(this,[s,a,c])}})}function fi(e,t){let{mutationCb:r,mousemoveCb:o,mouseInteractionCb:n,scrollCb:s,viewportResizeCb:a,inputCb:c,mediaInteractionCb:i,styleSheetRuleCb:u,styleDeclarationCb:d,canvasMutationCb:l,fontCb:g,selectionCb:f,customElementCb:p}=e;e.mutationCb=(...h)=>{t.mutation&&t.mutation(...h),r(...h)},e.mousemoveCb=(...h)=>{t.mousemove&&t.mousemove(...h),o(...h)},e.mouseInteractionCb=(...h)=>{t.mouseInteraction&&t.mouseInteraction(...h),n(...h)},e.scrollCb=(...h)=>{t.scroll&&t.scroll(...h),s(...h)},e.viewportResizeCb=(...h)=>{t.viewportResize&&t.viewportResize(...h),a(...h)},e.inputCb=(...h)=>{t.input&&t.input(...h),c(...h)},e.mediaInteractionCb=(...h)=>{t.mediaInteaction&&t.mediaInteaction(...h),i(...h)},e.styleSheetRuleCb=(...h)=>{t.styleSheetRule&&t.styleSheetRule(...h),u(...h)},e.styleDeclarationCb=(...h)=>{t.styleDeclaration&&t.styleDeclaration(...h),d(...h)},e.canvasMutationCb=(...h)=>{t.canvasMutation&&t.canvasMutation(...h),l(...h)},e.fontCb=(...h)=>{t.font&&t.font(...h),g(...h)},e.selectionCb=(...h)=>{t.selection&&t.selection(...h),f(...h)},e.customElementCb=(...h)=>{t.customElement&&t.customElement(...h),p(...h)}}function pi(e,t={}){let r=e.doc.defaultView;if(!r)return()=>{};fi(e,t);let o;e.recordDOM&&(o=Po(e,e.doc));let n=ti(e),s=ri(e),a=Fo(e),c=oi(e,{win:r}),i=si(e),u=ci(e),d=()=>{},l=()=>{},g=()=>{},f=()=>{};e.recordDOM&&(d=ai(e,{win:r}),l=Uo(e,e.doc),g=di(e,{win:r}),e.collectFonts&&(f=ui(e)));let p=li(e),h=hi(e),C=[];for(let I of e.plugins)C.push(I.observer(I.callback,r,I.options));return x(()=>{Te.forEach(I=>I.reset()),o?.disconnect(),n(),s(),a(),c(),i(),u(),d(),l(),g(),f(),p(),h(),C.forEach(I=>I())})}function gt(e){return typeof window[e]<"u"}function mt(e){return!!(typeof window[e]<"u"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}var _t=class{constructor(t){S(this,"iframeIdToRemoteIdMap",new WeakMap),S(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=t}getId(t,r,o,n){let s=o||this.getIdToRemoteIdMap(t),a=n||this.getRemoteIdToIdMap(t),c=s.get(r);return c||(c=this.generateIdFn(),s.set(r,c),a.set(c,r)),c}getIds(t,r){let o=this.getIdToRemoteIdMap(t),n=this.getRemoteIdToIdMap(t);return r.map(s=>this.getId(t,s,o,n))}getRemoteId(t,r,o){let n=o||this.getRemoteIdToIdMap(t);if(typeof r!="number")return r;let s=n.get(r);return s||-1}getRemoteIds(t,r){let o=this.getRemoteIdToIdMap(t);return r.map(n=>this.getRemoteId(t,n,o))}reset(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){let r=this.iframeIdToRemoteIdMap.get(t);return r||(r=new Map,this.iframeIdToRemoteIdMap.set(t,r)),r}getRemoteIdToIdMap(t){let r=this.iframeRemoteIdToIdMap.get(t);return r||(r=new Map,this.iframeRemoteIdToIdMap.set(t,r)),r}},pr=class{constructor(t){S(this,"iframes",new WeakMap),S(this,"crossOriginIframeMap",new WeakMap),S(this,"crossOriginIframeMirror",new _t(bo)),S(this,"crossOriginIframeStyleMirror"),S(this,"crossOriginIframeRootIdMap",new WeakMap),S(this,"mirror"),S(this,"mutationCb"),S(this,"wrappedEmit"),S(this,"loadListener"),S(this,"stylesheetManager"),S(this,"recordCrossOriginIframes"),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new _t(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}addLoadListener(t){this.loadListener=t}attachIframe(t,r){var o,n;this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&((o=t.contentWindow)==null||o.addEventListener("message",this.handleMessage.bind(this))),(n=this.loadListener)==null||n.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}handleMessage(t){let r=t;if(r.data.type!=="rrweb"||r.origin!==r.data.origin||!t.source)return;let n=this.crossOriginIframeMap.get(t.source);if(!n)return;let s=this.transformCrossOriginEvent(n,r.data.event);s&&this.wrappedEmit(s,r.data.isCheckout)}transformCrossOriginEvent(t,r){var o;switch(r.type){case M.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(r.data.node,t);let n=r.data.node.id;return this.crossOriginIframeRootIdMap.set(t,n),this.patchRootIdOnNode(r.data.node,n),{timestamp:r.timestamp,type:M.IncrementalSnapshot,data:{source:N.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:r.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case M.Meta:case M.Load:case M.DomContentLoaded:return!1;case M.Plugin:return r;case M.Custom:return this.replaceIds(r.data.payload,t,["id","parentId","previousId","nextId"]),r;case M.IncrementalSnapshot:switch(r.data.source){case N.Mutation:return r.data.adds.forEach(n=>{this.replaceIds(n,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(n.node,t);let s=this.crossOriginIframeRootIdMap.get(t);s&&this.patchRootIdOnNode(n.node,s)}),r.data.removes.forEach(n=>{this.replaceIds(n,t,["parentId","id"])}),r.data.attributes.forEach(n=>{this.replaceIds(n,t,["id"])}),r.data.texts.forEach(n=>{this.replaceIds(n,t,["id"])}),r;case N.Drag:case N.TouchMove:case N.MouseMove:return r.data.positions.forEach(n=>{this.replaceIds(n,t,["id"])}),r;case N.ViewportResize:return!1;case N.MediaInteraction:case N.MouseInteraction:case N.Scroll:case N.CanvasMutation:case N.Input:return this.replaceIds(r.data,t,["id"]),r;case N.StyleSheetRule:case N.StyleDeclaration:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleId"]),r;case N.Font:return r;case N.Selection:return r.data.ranges.forEach(n=>{this.replaceIds(n,t,["start","end"])}),r;case N.AdoptedStyleSheet:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleIds"]),(o=r.data.styles)==null||o.forEach(n=>{this.replaceStyleIds(n,t,["styleId"])}),r}}return!1}replace(t,r,o,n){for(let s of n)!Array.isArray(r[s])&&typeof r[s]!="number"||(Array.isArray(r[s])?r[s]=t.getIds(o,r[s]):r[s]=t.getId(o,r[s]));return r}replaceIds(t,r,o){return this.replace(this.crossOriginIframeMirror,t,r,o)}replaceStyleIds(t,r,o){return this.replace(this.crossOriginIframeStyleMirror,t,r,o)}replaceIdOnNode(t,r){this.replaceIds(t,r,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(o=>{this.replaceIdOnNode(o,r)})}patchRootIdOnNode(t,r){t.type!==K.Document&&!t.rootId&&(t.rootId=r),"childNodes"in t&&t.childNodes.forEach(o=>{this.patchRootIdOnNode(o,r)})}},gr=class{constructor(t){S(this,"shadowDoms",new WeakSet),S(this,"mutationCb"),S(this,"scrollCb"),S(this,"bypassOptions"),S(this,"mirror"),S(this,"restoreHandlers",[]),this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(t,r){if(!Xe(t)||this.shadowDoms.has(t))return;this.shadowDoms.add(t);let o=Po({...this.bypassOptions,doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},t);this.restoreHandlers.push(()=>o.disconnect()),this.restoreHandlers.push(Fo({...this.bypassOptions,scrollCb:this.scrollCb,doc:t,mirror:this.mirror})),setTimeout(()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(T.host(t))),this.restoreHandlers.push(Uo({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t))},0)}observeAttachShadow(t){!t.contentWindow||!t.contentDocument||this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,r){let o=this;this.restoreHandlers.push(Be(t.prototype,"attachShadow",function(n){return function(s){let a=n.call(this,s),c=T.shadowRoot(this);return c&&ko(this)&&o.addShadowRoot(c,r),a}}))}reset(){this.restoreHandlers.forEach(t=>{try{t()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}},Ve="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",gi=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(Ze=0;Ze<Ve.length;Ze++)gi[Ve.charCodeAt(Ze)]=Ze;var Ze,mi=function(e){var t=new Uint8Array(e),r,o=t.length,n="";for(r=0;r<o;r+=3)n+=Ve[t[r]>>2],n+=Ve[(t[r]&3)<<4|t[r+1]>>4],n+=Ve[(t[r+1]&15)<<2|t[r+2]>>6],n+=Ve[t[r+2]&63];return o%3===2?n=n.substring(0,n.length-1)+"=":o%3===1&&(n=n.substring(0,n.length-2)+"=="),n},lo=new Map;function yi(e,t){let r=lo.get(e);return r||(r=new Map,lo.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}var Ho=(e,t,r)=>{if(!e||!(Vo(e,t)||typeof e=="object"))return;let o=e.constructor.name,n=yi(r,o),s=n.indexOf(e);return s===-1&&(s=n.length,n.push(e)),s};function yt(e,t,r){if(e instanceof Array)return e.map(o=>yt(o,t,r));if(e===null)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer){let o=e.constructor.name,n=mi(e);return{rr_type:o,base64:n}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[yt(e.buffer,t,r),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){let o=e.constructor.name,{src:n}=e;return{rr_type:o,src:n}}else if(e instanceof HTMLCanvasElement){let o="HTMLImageElement",n=e.toDataURL();return{rr_type:o,src:n}}else{if(e instanceof ImageData)return{rr_type:e.constructor.name,args:[yt(e.data,t,r),e.width,e.height]};if(Vo(e,t)||typeof e=="object"){let o=e.constructor.name,n=Ho(e,t,r);return{rr_type:o,index:n}}}}return e}var Yo=(e,t,r)=>e.map(o=>yt(o,t,r)),Vo=(e,t)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(n=>typeof t[n]=="function").find(n=>e instanceof t[n]);function Si(e,t,r,o){let n=[],s=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(let a of s)try{if(typeof t.CanvasRenderingContext2D.prototype[a]!="function")continue;let c=Be(t.CanvasRenderingContext2D.prototype,a,function(i){return function(...u){return te(this.canvas,r,o,!0)||setTimeout(()=>{let d=Yo(u,t,this);e(this.canvas,{type:We["2D"],property:a,args:d})},0),i.apply(this,u)}});n.push(c)}catch{let c=At(t.CanvasRenderingContext2D.prototype,a,{set(i){e(this.canvas,{type:We["2D"],property:a,args:[i],setter:!0})}});n.push(c)}return()=>{n.forEach(a=>a())}}function vi(e){return e==="experimental-webgl"?"webgl":e}function ho(e,t,r,o){let n=[];try{let s=Be(e.HTMLCanvasElement.prototype,"getContext",function(a){return function(c,...i){if(!te(this,t,r,!0)){let u=vi(c);if("__context"in this||(this.__context=u),o&&["webgl","webgl2"].includes(u))if(i[0]&&typeof i[0]=="object"){let d=i[0];d.preserveDrawingBuffer||(d.preserveDrawingBuffer=!0)}else i.splice(0,1,{preserveDrawingBuffer:!0})}return a.apply(this,[c,...i])}});n.push(s)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{n.forEach(s=>s())}}function fo(e,t,r,o,n,s){let a=[],c=Object.getOwnPropertyNames(e);for(let i of c)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(i))try{if(typeof e[i]!="function")continue;let u=Be(e,i,function(d){return function(...l){let g=d.apply(this,l);if(Ho(g,s,this),"tagName"in this.canvas&&!te(this.canvas,o,n,!0)){let f=Yo(l,s,this),p={type:t,property:i,args:f};r(this.canvas,p)}return g}});a.push(u)}catch{let u=At(e,i,{set(d){r(this.canvas,{type:t,property:i,args:[d],setter:!0})}});a.push(u)}return a}function bi(e,t,r,o){let n=[];return n.push(...fo(t.WebGLRenderingContext.prototype,We.WebGL,e,r,o,t)),typeof t.WebGL2RenderingContext<"u"&&n.push(...fo(t.WebGL2RenderingContext.prototype,We.WebGL2,e,r,o,t)),()=>{n.forEach(s=>s())}}var Wo="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",Ci=e=>Uint8Array.from(atob(e),t=>t.charCodeAt(0)),po=typeof window<"u"&&window.Blob&&new Blob([Ci(Wo)],{type:"text/javascript;charset=utf-8"});function wi(e){let t;try{if(t=po&&(window.URL||window.webkitURL).createObjectURL(po),!t)throw"";let r=new Worker(t,{name:e?.name});return r.addEventListener("error",()=>{(window.URL||window.webkitURL).revokeObjectURL(t)}),r}catch{return new Worker("data:text/javascript;base64,"+Wo,{name:e?.name})}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}var mr=class{constructor(t){S(this,"pendingCanvasMutations",new Map),S(this,"rafStamps",{latestId:0,invokeId:null}),S(this,"mirror"),S(this,"mutationCb"),S(this,"resetObservers"),S(this,"frozen",!1),S(this,"locked",!1),S(this,"processMutation",(i,u)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(i)||this.pendingCanvasMutations.set(i,[]),this.pendingCanvasMutations.get(i).push(u)});let{sampling:r="all",win:o,blockClass:n,blockSelector:s,recordCanvas:a,dataURLOptions:c}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,a&&r==="all"&&this.initCanvasMutationObserver(o,n,s),a&&typeof r=="number"&&this.initCanvasFPSObserver(r,o,n,s,{dataURLOptions:c})}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(t,r,o,n,s){let a=ho(r,o,n,!0),c=new Map,i=new wi;i.onmessage=p=>{let{id:h}=p.data;if(c.set(h,!1),!("base64"in p.data))return;let{base64:C,type:I,width:v,height:y}=p.data;this.mutationCb({id:h,type:We["2D"],commands:[{property:"clearRect",args:[0,0,v,y]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:C}],type:I}]},0,0]}]})};let u=1e3/t,d=0,l,g=()=>{let p=[];return r.document.querySelectorAll("canvas").forEach(h=>{te(h,o,n,!0)||p.push(h)}),p},f=p=>{if(d&&p-d<u){l=requestAnimationFrame(f);return}d=p,g().forEach(async h=>{var C;let I=this.mirror.getId(h);if(c.get(I)||h.width===0||h.height===0)return;if(c.set(I,!0),["webgl","webgl2"].includes(h.__context)){let y=h.getContext(h.__context);((C=y?.getContextAttributes())==null?void 0:C.preserveDrawingBuffer)===!1&&y.clear(y.COLOR_BUFFER_BIT)}let v=await createImageBitmap(h);i.postMessage({id:I,bitmap:v,width:h.width,height:h.height,dataURLOptions:s.dataURLOptions},[v])}),l=requestAnimationFrame(f)};l=requestAnimationFrame(f),this.resetObservers=()=>{a(),cancelAnimationFrame(l)}}initCanvasMutationObserver(t,r,o){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let n=ho(t,r,o,!1),s=Si(this.processMutation.bind(this),t,r,o),a=bi(this.processMutation.bind(this),t,r,o);this.resetObservers=()=>{n(),s(),a()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let t=r=>{this.rafStamps.latestId=r,requestAnimationFrame(t)};requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,r)=>{let o=this.mirror.getId(r);this.flushPendingCanvasMutationFor(r,o)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,r){if(this.frozen||this.locked)return;let o=this.pendingCanvasMutations.get(t);if(!o||r===-1)return;let n=o.map(a=>{let{type:c,...i}=a;return i}),{type:s}=o[0];this.mutationCb({id:r,type:s,commands:n}),this.pendingCanvasMutations.delete(t)}},yr=class{constructor(t){S(this,"trackedLinkElements",new WeakSet),S(this,"mutationCb"),S(this,"adoptedStyleSheetCb"),S(this,"styleMirror",new ur),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,r){"_cssText"in r.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:r.id,attributes:r.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,r){if(t.length===0)return;let o={id:r,styleIds:[]},n=[];for(let s of t){let a;this.styleMirror.has(s)?a=this.styleMirror.getId(s):(a=this.styleMirror.add(s),n.push({styleId:a,rules:Array.from(s.rules||CSSRule,(c,i)=>({rule:So(c,s.href),index:i}))})),o.styleIds.push(a)}n.length>0&&(o.styles=n),this.adoptedStyleSheetCb(o)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}},Sr=class{constructor(){S(this,"nodeMap",new WeakMap),S(this,"active",!1)}inOtherBuffer(t,r){let o=this.nodeMap.get(t);return o&&Array.from(o).some(n=>n!==r)}add(t,r){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(r))}destroy(){}},z,St,sr,Rt=!1;try{if(Array.from([1],e=>e*2)[0]!==2){let e=document.createElement("iframe");document.body.appendChild(e),Array.from=((Zr=e.contentWindow)==null?void 0:Zr.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}var he=hs();function me(e={}){let{emit:t,checkoutEveryNms:r,checkoutEveryNth:o,blockClass:n="rr-block",blockSelector:s=null,ignoreClass:a="rr-ignore",ignoreSelector:c=null,maskTextClass:i="rr-mask",maskTextSelector:u=null,inlineStylesheet:d=!0,maskAllInputs:l,maskInputOptions:g,slimDOMOptions:f,maskInputFn:p,maskTextFn:h,maskAnchorHrefFn:C,blockImgSrcPattern:I=null,blockImgSrcFillOptions:v={backgroundColor:"#F6F7F9",strokeColor:"#E9EBEF",strokeWidth:"1px"},hooks:y,packFn:_,sampling:A={},dataURLOptions:m={},mousemoveWait:E,recordDOM:w=!0,recordCanvas:D=!1,recordCrossOriginIframes:L=!1,recordAfter:oe=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:H=!1,collectFonts:ne=!1,inlineImages:G=!1,plugins:V,keepIframeSrcFn:R=()=>!1,ignoreCSSAttributes:Y=new Set([]),errorHandler:$}=e;Qs($);let P=L?window.parent===window:!0,Z=!1;if(!P)try{window.parent.document&&(Z=!1)}catch{Z=!0}if(P&&!t)throw new Error("emit function is required");if(!P&&!Z)return()=>{};E!==void 0&&A.mousemove===void 0&&(A.mousemove=E),he.reset();let j=l===!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}:g!==void 0?g:{password:!0},J=f===!0||f==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:f==="all",headMetaDescKeywords:f==="all",headTitleMutations:f==="all"}:f||{};Zs();let Se,se=0,X=O=>{for(let le of V||[])le.eventProcessor&&(O=le.eventProcessor(O));return _&&!Z&&(O=_(O)),O};z=(O,le)=>{var W;let B=O;if(B.timestamp=Et(),(W=Te[0])!=null&&W.isFrozen()&&B.type!==M.FullSnapshot&&!(B.type===M.IncrementalSnapshot&&B.data.source===N.Mutation)&&Te.forEach(ge=>ge.unfreeze()),P)t?.(X(B),le);else if(Z){let ge={type:"rrweb",event:X(B),origin:window.location.origin,isCheckout:le};window.parent.postMessage(ge,"*")}if(B.type===M.FullSnapshot)Se=B,se=0;else if(B.type===M.IncrementalSnapshot){if(B.data.source===N.Mutation&&B.data.isAttachIframe)return;se++;let ge=o&&se>=o,F=r&&B.timestamp-Se.timestamp>r;(ge||F)&&St(!0)}};let xe=O=>{z({type:M.IncrementalSnapshot,data:{source:N.Mutation,...O}})},je=O=>z({type:M.IncrementalSnapshot,data:{source:N.Scroll,...O}}),Me=O=>z({type:M.IncrementalSnapshot,data:{source:N.CanvasMutation,...O}}),Ut=O=>z({type:M.IncrementalSnapshot,data:{source:N.AdoptedStyleSheet,...O}}),fe=new yr({mutationCb:xe,adoptedStyleSheetCb:Ut}),pe=new pr({mirror:he,mutationCb:xe,stylesheetManager:fe,recordCrossOriginIframes:L,wrappedEmit:z});for(let O of V||[])O.getMirror&&O.getMirror({nodeMirror:he,crossOriginIframeMirror:pe.crossOriginIframeMirror,crossOriginIframeStyleMirror:pe.crossOriginIframeStyleMirror});let ke=new Sr;sr=new mr({recordCanvas:D,mutationCb:Me,win:window,blockClass:n,blockSelector:s,mirror:he,sampling:A.canvas,dataURLOptions:m});let dt=new gr({mutationCb:xe,scrollCb:je,bypassOptions:{blockClass:n,blockSelector:s,maskTextClass:i,maskTextSelector:u,inlineStylesheet:d,maskInputOptions:j,dataURLOptions:m,maskTextFn:h,maskInputFn:p,maskAnchorHrefFn:C,blockImgSrcPattern:I,blockImgSrcFillOptions:v,recordCanvas:D,inlineImages:G,sampling:A,slimDOMOptions:J,iframeManager:pe,stylesheetManager:fe,canvasManager:sr,keepIframeSrcFn:R,processedNodeManager:ke},mirror:he});St=(O=!1)=>{if(!w)return;z({type:M.Meta,data:{href:window.location.href,width:Do(),height:Ao()}},O),fe.reset(),dt.init(),Te.forEach(W=>W.lock());let le=Ps(document,{mirror:he,blockClass:n,blockSelector:s,maskTextClass:i,maskTextSelector:u,inlineStylesheet:d,maskAllInputs:j,maskTextFn:h,maskInputFn:p,maskAnchorHrefFn:C,blockImgSrcPattern:I,blockImgSrcFillOptions:v,slimDOM:J,dataURLOptions:m,recordCanvas:D,inlineImages:G,onSerialize:W=>{Oo(W,he)&&pe.addIframe(W),xo(W,he)&&fe.trackLinkElement(W),cr(W)&&dt.addShadowRoot(T.shadowRoot(W),document)},onIframeLoad:(W,B)=>{pe.attachIframe(W,B),dt.observeAttachShadow(W)},onStylesheetLoad:(W,B)=>{fe.attachLinkElement(W,B)},keepIframeSrcFn:R});if(!le)return console.warn("Failed to snapshot the document");z({type:M.FullSnapshot,data:{node:le,initialOffset:Ro(window)}},O),Te.forEach(W=>W.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&fe.adoptStyleSheets(document.adoptedStyleSheets,he.getId(document))};try{let O=[],le=B=>{var ge;return x(pi)({mutationCb:xe,mousemoveCb:(F,Ht)=>z({type:M.IncrementalSnapshot,data:{source:Ht,positions:F}}),mouseInteractionCb:F=>z({type:M.IncrementalSnapshot,data:{source:N.MouseInteraction,...F}}),scrollCb:je,viewportResizeCb:F=>z({type:M.IncrementalSnapshot,data:{source:N.ViewportResize,...F}}),inputCb:F=>z({type:M.IncrementalSnapshot,data:{source:N.Input,...F}}),mediaInteractionCb:F=>z({type:M.IncrementalSnapshot,data:{source:N.MediaInteraction,...F}}),styleSheetRuleCb:F=>z({type:M.IncrementalSnapshot,data:{source:N.StyleSheetRule,...F}}),styleDeclarationCb:F=>z({type:M.IncrementalSnapshot,data:{source:N.StyleDeclaration,...F}}),canvasMutationCb:Me,fontCb:F=>z({type:M.IncrementalSnapshot,data:{source:N.Font,...F}}),selectionCb:F=>{z({type:M.IncrementalSnapshot,data:{source:N.Selection,...F}})},customElementCb:F=>{z({type:M.IncrementalSnapshot,data:{source:N.CustomElement,...F}})},blockClass:n,ignoreClass:a,ignoreSelector:c,maskTextClass:i,maskTextSelector:u,maskInputOptions:j,inlineStylesheet:d,sampling:A,recordDOM:w,recordCanvas:D,inlineImages:G,userTriggeredOnInput:H,collectFonts:ne,doc:B,maskInputFn:p,maskTextFn:h,maskAnchorHrefFn:C,blockImgSrcPattern:I,blockImgSrcFillOptions:v,keepIframeSrcFn:R,blockSelector:s,slimDOMOptions:J,dataURLOptions:m,mirror:he,iframeManager:pe,stylesheetManager:fe,shadowDomManager:dt,processedNodeManager:ke,canvasManager:sr,ignoreCSSAttributes:Y,plugins:((ge=V?.filter(F=>F.observer))==null?void 0:ge.map(F=>({observer:F.observer,options:F.options,callback:Ht=>z({type:M.Plugin,data:{plugin:F.name,payload:Ht}})})))||[]},y)};pe.addLoadListener(B=>{try{O.push(le(B.contentDocument))}catch(ge){console.warn(ge)}});let W=()=>{St(),O.push(le(document)),Rt=!0};return document.readyState==="interactive"||document.readyState==="complete"?W():(O.push(ee("DOMContentLoaded",()=>{z({type:M.DomContentLoaded,data:{}}),oe==="DOMContentLoaded"&&W()})),O.push(ee("load",()=>{z({type:M.Load,data:{}}),oe==="load"&&W()},window))),()=>{O.forEach(B=>B()),ke.destroy(),Rt=!1,ei()}}catch(O){console.warn(O)}}me.addCustomEvent=(e,t)=>{if(!Rt)throw new Error("please add custom event after start recording");z({type:M.Custom,data:{tag:e,payload:t}})};me.freezePage=()=>{Te.forEach(e=>e.freeze())};me.takeFullSnapshot=e=>{if(!Rt)throw new Error("please take full snapshot after start recording");St(e)};me.mirror=he;var go;(function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"})(go||(go={}));function Dt(e,t){if(!t)return;let r=new URL(e),o={};for(let[n,s]of r.searchParams)t.includes(n)&&(o[n]=s);return Object.keys(o).length>0?o:void 0}import{minimatch as _i}from"minimatch";function Er(e){throw new Error(`This code path should be unreachable: ${e}`)}function Ei(e){return(e.startsWith("http://")||e.startsWith("https://"))&&(e=e.replace(/^https?:\/\//,"")),e.endsWith("/")&&(e=e.substring(0,e.length-1)),e=e.replace(/:\d+$/,""),e}function Ii(e,t){if(!t||t==="")return!1;if(t==="*")return!0;let r=Ei(t);return e===r}function ce({urlStr:e,pathConfig:t}){let r=new URL(e),o=r.pathname,n=r.hostname,s=t.rules.filter(c=>Ii(n,c.domain));if(s.length>0){let c=s.find(i=>i.path==="**");if(!c)return t.defaultAction==="allow"?r:void 0;for(let i of s){if(i.path==="**")continue;let u=Le(o,i);if(u!==void 0)switch(i.action){case"allow":return r;case"block":return;case"replace":return r.pathname=u,r;default:Er(i.action)}}return c.action==="allow"?r:void 0}let a=t.rules.filter(c=>!c.domain);for(let c of a){let i=Le(o,c);if(i!==void 0)switch(c.action){case"allow":return r;case"block":return;case"replace":return r.pathname=i,r;default:Er(c.action)}}return t.defaultAction==="allow"?r:void 0}function rt(e,t,r){let o=ce({urlStr:e,pathConfig:r});o||(o=new URL(e));let n=Ri(o.pathname,t.rules||[]),s=[];for(let a of o.searchParams.keys()){let c=Ai(a,n?.rules||[]);switch(c){case"accept":break;case"delete":s.push(a);break;case"anonymize":o.searchParams.set(a,"*");break;default:ae(c)}}for(let a of s)o.searchParams.delete(a);if(o.pathname.includes("%3F")){let a=o.pathname.split("/");a[a.length-1]=a[a.length-1].split("%3F")[0],o.pathname=a.join("/")}return o.hash.includes("=")&&(o.hash=""),o.toString()}function Ri(e,t){for(let r of t)if(Le(e,{path:r.path}))return r}function Ai(e,t){for(let r of t)if(_i(e,r.param))return r.anonymizeValue?"anonymize":"accept";return"delete"}var Ir=class{constructor(t,r,o){this.org=t;this.recorder=r;this.events=[];this._estimatedByteSize=0;this.events=o,this._estimatedByteSize=this.calculateTotalSize()}get estimatedByteSize(){return this._estimatedByteSize}calculateTotalSize(){try{let t=JSON.stringify(this.events,this.getCircularReplacer());return Di(t)}catch(t){return b(`Error calculating event size: ${t}. Falling back to approximation.`),this.events.length*500}}getCircularReplacer(){let t=new WeakSet;return(r,o)=>{if(typeof o=="object"&&o!==null){if(t.has(o))return;t.add(o)}return o}}clearEvents(){this.events=[],this._estimatedByteSize=this.calculateTotalSize()}pushEvent({eventHref:t,event:r}){if(!ce({urlStr:t,pathConfig:this.org.pathConfig})){b(`URL not accepted: ${t}`);return}if(!this.recorder.isRecording){b("Dropping event - recorder is not recording");return}this.events.push(r),this._estimatedByteSize=this.calculateTotalSize()}getEvents(){return this.events}},Tt=class{constructor(t,r,o,n,s){this.org=t;this.eventStorage=r;this.getHref=o;this.eventStore=new Ir(t,n,s)}get estimatedSerializedByteSize(){return this.eventStore.estimatedByteSize}clear(){this.eventStore.clearEvents(),this.eventStorage.removeEvents()}getEvents(){return this.eventStore.getEvents()}onVisibilityChange(t){t||this.eventStorage.setEvents(this.getEvents())}append(t){let r=this.getHref();if(t.type===Q.Meta)t.data.href=rt(t.data.href,this.org.allowedQueryParams,this.org.pathConfig),this.lastHref=this.getHref();else if(this.lastHref&&r!=this.lastHref){b(`URL changed from ${this.lastHref} to ${r}, adding artificial meta event for ${this.getHref()}`),this.eventStore.pushEvent({eventHref:r,event:Br({href:rt(r,this.org.allowedQueryParams,this.org.pathConfig),delay:t.delay,timestamp:t.timestamp})});let o=Dt(r,this.org.customQueryParamsCohorts);o&&this.eventStore.pushEvent({eventHref:r,event:$e({payload:{userCohorts:o,source:"query_params"},timestamp:t.timestamp,delay:t.delay})}),this.lastHref=this.getHref()}if(t.type===Q.IncrementalSnapshot&&t.data.source===De.MouseInteraction&&t.data.type===Wt.Click){let o=me.mirror.getNode(t.data.id);if(o){let n=Ti(o),s=Wr({dom0EventHandlers:n,delay:t.delay,timestamp:t.timestamp});this.eventStore.pushEvent({eventHref:r,event:s})}}this.eventStore.pushEvent({eventHref:r,event:t})}};function Di(e){return new Blob([e]).size}function Ti(e){let t=[];for(let r=0;r<Bt.length;r++){let n=Bt[r];typeof e[n]=="function"&&t.push(n)}return t}var ue=Uint8Array,re=Uint16Array,it=Uint32Array,Nr=new ue([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Or=new ue([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Bo=new ue([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),jo=function(e,t){for(var r=new re(31),o=0;o<31;++o)r[o]=t+=1<<e[o-1];for(var n=new it(r[30]),o=1;o<30;++o)for(var s=r[o];s<r[o+1];++s)n[s]=s-r[o]<<5|o;return[r,n]},$o=jo(Nr,2),Ni=$o[0],Rr=$o[1];Ni[28]=258,Rr[258]=28;var Zo=jo(Or,0),Qc=Zo[0],zo=Zo[1],Ar=new re(32768);for(k=0;k<32768;++k)we=(k&43690)>>>1|(k&21845)<<1,we=(we&52428)>>>2|(we&13107)<<2,we=(we&61680)>>>4|(we&3855)<<4,Ar[k]=((we&65280)>>>8|(we&255)<<8)>>>1;var we,k,st=function(e,t,r){for(var o=e.length,n=0,s=new re(t);n<o;++n)++s[e[n]-1];var a=new re(t);for(n=0;n<t;++n)a[n]=a[n-1]+s[n-1]<<1;var c;if(r){c=new re(1<<t);var i=15-t;for(n=0;n<o;++n)if(e[n])for(var u=n<<4|e[n],d=t-e[n],l=a[e[n]-1]++<<d,g=l|(1<<d)-1;l<=g;++l)c[Ar[l]>>>i]=u}else for(c=new re(o),n=0;n<o;++n)c[n]=Ar[a[e[n]-1]++]>>>15-e[n];return c},Oe=new ue(288);for(k=0;k<144;++k)Oe[k]=8;var k;for(k=144;k<256;++k)Oe[k]=9;var k;for(k=256;k<280;++k)Oe[k]=7;var k;for(k=280;k<288;++k)Oe[k]=8;var k,Nt=new ue(32);for(k=0;k<32;++k)Nt[k]=5;var k,Oi=st(Oe,9,0);var xi=st(Nt,5,0);var Jo=function(e){return(e/8>>0)+(e&7&&1)},Xo=function(e,t,r){(r==null||r>e.length)&&(r=e.length);var o=new(e instanceof re?re:e instanceof it?it:ue)(r-t);return o.set(e.subarray(t,r)),o};var Ee=function(e,t,r){r<<=t&7;var o=t/8>>0;e[o]|=r,e[o+1]|=r>>>8},ot=function(e,t,r){r<<=t&7;var o=t/8>>0;e[o]|=r,e[o+1]|=r>>>8,e[o+2]|=r>>>16},_r=function(e,t){for(var r=[],o=0;o<e.length;++o)e[o]&&r.push({s:o,f:e[o]});var n=r.length,s=r.slice();if(!n)return[new ue(0),0];if(n==1){var a=new ue(r[0].s+1);return a[r[0].s]=1,[a,1]}r.sort(function(A,m){return A.f-m.f}),r.push({s:-1,f:25001});var c=r[0],i=r[1],u=0,d=1,l=2;for(r[0]={s:-1,f:c.f+i.f,l:c,r:i};d!=n-1;)c=r[r[u].f<r[l].f?u++:l++],i=r[u!=d&&r[u].f<r[l].f?u++:l++],r[d++]={s:-1,f:c.f+i.f,l:c,r:i};for(var g=s[0].s,o=1;o<n;++o)s[o].s>g&&(g=s[o].s);var f=new re(g+1),p=Dr(r[d-1],f,0);if(p>t){var o=0,h=0,C=p-t,I=1<<C;for(s.sort(function(m,E){return f[E.s]-f[m.s]||m.f-E.f});o<n;++o){var v=s[o].s;if(f[v]>t)h+=I-(1<<p-f[v]),f[v]=t;else break}for(h>>>=C;h>0;){var y=s[o].s;f[y]<t?h-=1<<t-f[y]++-1:++o}for(;o>=0&&h;--o){var _=s[o].s;f[_]==t&&(--f[_],++h)}p=t}return[new ue(f),p]},Dr=function(e,t,r){return e.s==-1?Math.max(Dr(e.l,t,r+1),Dr(e.r,t,r+1)):t[e.s]=r},Go=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new re(++t),o=0,n=e[0],s=1,a=function(i){r[o++]=i},c=1;c<=t;++c)if(e[c]==n&&c!=t)++s;else{if(!n&&s>2){for(;s>138;s-=138)a(32754);s>2&&(a(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(a(n),--s;s>6;s-=6)a(8304);s>2&&(a(s-3<<5|8208),s=0)}for(;s--;)a(n);s=1,n=e[c]}return[r.subarray(0,o),t]},nt=function(e,t){for(var r=0,o=0;o<t.length;++o)r+=e[o]*t[o];return r},Tr=function(e,t,r){var o=r.length,n=Jo(t+2);e[n]=o&255,e[n+1]=o>>>8,e[n+2]=e[n]^255,e[n+3]=e[n+1]^255;for(var s=0;s<o;++s)e[n+s+4]=r[s];return(n+4+o)*8},Ko=function(e,t,r,o,n,s,a,c,i,u,d){Ee(t,d++,r),++n[256];for(var l=_r(n,15),g=l[0],f=l[1],p=_r(s,15),h=p[0],C=p[1],I=Go(g),v=I[0],y=I[1],_=Go(h),A=_[0],m=_[1],E=new re(19),w=0;w<v.length;++w)E[v[w]&31]++;for(var w=0;w<A.length;++w)E[A[w]&31]++;for(var D=_r(E,7),L=D[0],oe=D[1],H=19;H>4&&!L[Bo[H-1]];--H);var ne=u+5<<3,G=nt(n,Oe)+nt(s,Nt)+a,V=nt(n,g)+nt(s,h)+a+14+3*H+nt(E,L)+(2*E[16]+3*E[17]+7*E[18]);if(ne<=G&&ne<=V)return Tr(t,d,e.subarray(i,i+u));var R,Y,$,P;if(Ee(t,d,1+(V<G)),d+=2,V<G){R=st(g,f,0),Y=g,$=st(h,C,0),P=h;var Z=st(L,oe,0);Ee(t,d,y-257),Ee(t,d+5,m-1),Ee(t,d+10,H-4),d+=14;for(var w=0;w<H;++w)Ee(t,d+3*w,L[Bo[w]]);d+=3*H;for(var j=[v,A],J=0;J<2;++J)for(var Se=j[J],w=0;w<Se.length;++w){var se=Se[w]&31;Ee(t,d,Z[se]),d+=L[se],se>15&&(Ee(t,d,Se[w]>>>5&127),d+=Se[w]>>>12)}}else R=Oi,Y=Oe,$=xi,P=Nt;for(var w=0;w<c;++w)if(o[w]>255){var se=o[w]>>>18&31;ot(t,d,R[se+257]),d+=Y[se+257],se>7&&(Ee(t,d,o[w]>>>23&31),d+=Nr[se]);var X=o[w]&31;ot(t,d,$[X]),d+=P[X],X>3&&(ot(t,d,o[w]>>>5&8191),d+=Or[X])}else ot(t,d,R[o[w]]),d+=Y[o[w]];return ot(t,d,R[256]),d+Y[256]},Mi=new it([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ki=function(e,t,r,o,n,s){var a=e.length,c=new ue(o+a+5*(1+Math.floor(a/7e3))+n),i=c.subarray(o,c.length-n),u=0;if(!t||a<8)for(var d=0;d<=a;d+=65535){var l=d+65535;l<a?u=Tr(i,u,e.subarray(d,l)):(i[d]=s,u=Tr(i,u,e.subarray(d,a)))}else{for(var g=Mi[t-1],f=g>>>13,p=g&8191,h=(1<<r)-1,C=new re(32768),I=new re(h+1),v=Math.ceil(r/3),y=2*v,_=function(O){return(e[O]^e[O+1]<<v^e[O+2]<<y)&h},A=new it(25e3),m=new re(288),E=new re(32),w=0,D=0,d=0,L=0,oe=0,H=0;d<a;++d){var ne=_(d),G=d&32767,V=I[ne];if(C[G]=V,I[ne]=G,oe<=d){var R=a-d;if((w>7e3||L>24576)&&R>423){u=Ko(e,i,0,A,m,E,D,L,H,d-H,u),L=w=D=0,H=d;for(var Y=0;Y<286;++Y)m[Y]=0;for(var Y=0;Y<30;++Y)E[Y]=0}var $=2,P=0,Z=p,j=G-V&32767;if(R>2&&ne==_(d-j))for(var J=Math.min(f,R)-1,Se=Math.min(32767,d),se=Math.min(258,R);j<=Se&&--Z&&G!=V;){if(e[d+$]==e[d+$-j]){for(var X=0;X<se&&e[d+X]==e[d+X-j];++X);if(X>$){if($=X,P=j,X>J)break;for(var xe=Math.min(j,X-2),je=0,Y=0;Y<xe;++Y){var Me=d-j+Y+32768&32767,Ut=C[Me],fe=Me-Ut+32768&32767;fe>je&&(je=fe,V=Me)}}}G=V,V=C[G],j+=G-V+32768&32767}if(P){A[L++]=268435456|Rr[$]<<18|zo[P];var pe=Rr[$]&31,ke=zo[P]&31;D+=Nr[pe]+Or[ke],++m[257+pe],++E[ke],oe=d+$,++w}else A[L++]=e[d],++m[e[d]]}}u=Ko(e,i,s,A,m,E,D,L,H,d-H,u)}return Xo(c,0,o+Jo(u)+n)},Li=function(){var e=1,t=0;return{p:function(r){for(var o=e,n=t,s=r.length,a=0;a!=s;){for(var c=Math.min(a+5552,s);a<c;++a)o+=r[a],n+=o;o%=65521,n%=65521}e=o,t=n},d:function(){return(e>>>8<<16|(t&255)<<8|t>>>8)+((e&255)<<23)*2}}},Pi=function(e,t,r,o,n){return ki(e,t.level==null?6:t.level,t.mem==null?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):12+t.mem,r,o,!n)},Fi=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8},Ui=function(e,t){var r=t.level,o=r==0?0:r<6?1:r==9?3:2;e[0]=120,e[1]=o<<6|(o?32-2*o:1)};function qo(e,t){t===void 0&&(t={});var r=Li();r.p(e);var o=Pi(e,t,2,4);return Ui(o,t),Fi(o,o.length-4,r.d()),o}function xr(e,t){var r=e.length;if(!t&&typeof TextEncoder<"u")return new TextEncoder().encode(e);for(var o=new ue(e.length+(e.length>>>1)),n=0,s=function(u){o[n++]=u},a=0;a<r;++a){if(n+5>o.length){var c=new ue(n+8+(r-a<<1));c.set(o),o=c}var i=e.charCodeAt(a);i<128||t?s(i):i<2048?(s(192|i>>>6),s(128|i&63)):i>55295&&i<57344?(i=65536+(i&1047552)|e.charCodeAt(++a)&1023,s(240|i>>>18),s(128|i>>>12&63),s(128|i>>>6&63),s(128|i&63)):(s(224|i>>>12),s(128|i>>>6&63),s(128|i&63))}return Xo(o,0,n)}function Mr(e,t){var r="";if(!t&&typeof TextDecoder<"u")return new TextDecoder().decode(e);for(var o=0;o<e.length;){var n=e[o++];n<128||t?r+=String.fromCharCode(n):n<224?r+=String.fromCharCode((n&31)<<6|e[o++]&63):n<240?r+=String.fromCharCode((n&15)<<12|(e[o++]&63)<<6|e[o++]&63):(n=((n&15)<<18|(e[o++]&63)<<12|(e[o++]&63)<<6|e[o++]&63)-65536,r+=String.fromCharCode(55296|n>>10,56320|n&1023))}return r}var kr="v1";var Lr=e=>{let t={...e,v:kr};return Mr(qo(xr(JSON.stringify(t))),!0)};function Qo(e){let t=new URL(e),r={};for(let[o,n]of t.searchParams)switch(o){case"utm_source":case"utm_medium":case"utm_campaign":case"utm_term":case"utm_content":r[`UTM@@${o}`]=n;break}return Object.keys(r).length>0?r:void 0}var en=3*1024*1024,tn=5e3,Ot=class{constructor(t,r,o,n,s,a,c){this.window=t;this.storage=r;this.eventHolder=o;this.recorder=n;this.api=s;this.organization=a;this.windowGetters=c;this.lastSendTime=-1;this.lastAutoCohorts=void 0;this.fastpathToken=void 0;n.setOnEvent(i=>this.onEvent(i))}onEvent(t){if(t.type===Q.FullSnapshot){let s,a=ht(this.window,this.organization.cohortsBootstrapConfig),c=Qo(this.windowGetters.getHref()),i=Dt(this.windowGetters.getHref(),this.organization.customQueryParamsCohorts),u=qt(this.window);this.lastAutoCohorts=u,(c||a||u||i)&&(s=$e({payload:{userCohorts:{...a||{},...u||{},...c||{},...i||{}},source:"window_getters"},delay:t.delay,timestamp:t.timestamp}));let d=s?[...this.eventHolder.getEvents(),s,t]:[...this.eventHolder.getEvents(),t];this.clearAndSaveEvents(d);return}else if(t.type===Q.IncrementalSnapshot&&t.data.source===De.Mutation){let s=qt(this.window);s&&(!this.lastAutoCohorts||Object.keys(s).length!==Object.keys(this.lastAutoCohorts).length)&&(b("auto cohorts different, appending new event",s),this.eventHolder.append($e({payload:{userCohorts:s,source:"window_getters"},delay:t.delay,timestamp:t.timestamp}))),this.lastAutoCohorts=s}this.eventHolder.append(t);let r=this.eventHolder.estimatedSerializedByteSize,n=Date.now()-this.lastSendTime;r>en&&n>=tn&&(b(`MAX_EVENT_BYTE_SIZE and timeSinceLastSend exceeded: ${r} > ${en} and ${n} >= ${tn}`),this.clearAndSaveEvents())}async clearAndSaveEvents(t){let r=this.windowGetters.getHref();if(!ce({urlStr:r,pathConfig:this.organization.pathConfig}))return;let o=t||this.eventHolder.getEvents();if(o.length!==0){this.eventHolder.clear();try{b("saving events...");let n=await this.prepareAndSendEvents(o);switch(b("save events result",n.type),n.type){case"success":break;case"recreate-session":await this.recreateSession(n.session);break;case"no-session":case"unknown-failure":case"rate-limit-exceeded":this.storage.removeSession(),this.eventHolder.clear();break;default:ae(n)}}catch(n){throw b("error saving events",n),this.storage.removeSession(),n}}}async prepareAndSendEvents(t){this.lastSendTime=Date.now();let r=this.storage.getSession();if(!r)return{type:"no-session"};if(r.eventPostUrl&&r.eventPostToken){let s=JSON.parse(atob(r.eventPostToken.split(".")[1]));if(s&&Date.now()>s.lastEventAt-10*1e3){b("refreshing token as it is about to expire");let a=await this.refreshToken(r);if(a.type!=="success")return a;if(r=this.storage.getSession(),!r)return{type:"no-session"}}}let o=r.compressionType==="RRWEB_PACK"?t.map(s=>Lr(s)):t,n=await this.api.saveSessionEvents({sessionId:r.id,events:o,metadata:{url:rt(this.windowGetters.getHref(),this.organization.allowedQueryParams,this.organization.pathConfig)},eventPostUrl:r.eventPostUrl,eventPostToken:r.eventPostToken,fastpathToken:this.fastpathToken});if(!n)return{type:"unknown-failure"};if(n.error)switch(n.error.code){case"SessionNotFound":case"SessionAlreadySynced":return{type:"recreate-session",session:r};case"RateLimitExceeded":return{type:"rate-limit-exceeded"}}if(!n.data)return{type:"unknown-failure"};if(n.data&&"code"in n.data)switch(n.data.code){case"TOKEN_REFRESH":{b("refreshing token as it expired on the worker");let s=await this.refreshToken(r);return s.type!=="success"?s:this.prepareAndSendEvents(t)}default:ae(n.data.code)}if(this.fastpathToken=n.data.fastpathToken,n.response.status<200||n.response.status>201)throw new Error(`got status ${n.response.status}`);return{type:"success"}}async refreshToken(t){let r=await this.api.refreshEventToken({sessionId:t.id});if(!r)return{type:"unknown-failure"};if(r.error)switch(r.error.code){case"SessionNotFound":case"SessionAlreadySynced":return{type:"recreate-session",session:t};case"RateLimitExceeded":return{type:"rate-limit-exceeded"}}return r.data?(this.storage.setSession({...t,eventPostToken:r.data.token}),{type:"success"}):{type:"unknown-failure"}}async recreateSession(t){b("recreating sessions");let r,o=this.recorder.isRecording;this.recorder.setRecording(!1),this.storage.removeSession(),this.fastpathToken=void 0;let n,s;try{b("recreating session...");let c=await this.api.startSession({orgId:t.settings.orgId,language:t.settings.language||this.windowGetters.getLanguage(),domain:new URL(this.windowGetters.getHref()).hostname,userCohorts:t.settings.userCohorts||{},uid:t.settings.uid,devicePixelRatio:this.windowGetters.getDevicePixelRatio(),adoraUserId:t.adoraUserId,documentReferrer:t.documentReferrer,snippetVersion:lt});if(!c||c.error)return;if(c.response.status!==201){b("session not created, aborting");return}if(!c.data||!("session"in c.data)){b("malformed session, exiting");return}c?.data&&"eventPostUrl"in c.data&&c.data.eventPostUrl&&"eventPostToken"in c.data&&c.data.eventPostToken&&(n=c.data.eventPostUrl,s=c.data.eventPostToken),r=c.data}catch{}if(!r)return;let a={id:r.session.id,createdAt:r.session.createdAt,status:r.session.status,lastSyncedAt:r.session.lastSyncedAt,domain:r.session.domain,requestIp:r.session.requestIp,country:r.session.country,userAgent:r.session.userAgent,language:r.session.language,initialUserCohorts:r.session.initialUserCohorts,devicePixelRatio:r.session.devicePixelRatio,organization:r.organization,settings:t.settings,adoraUserId:t.adoraUserId,documentReferrer:t.documentReferrer,canvasRecordingEnabled:t.canvasRecordingEnabled,eventPostUrl:n,eventPostToken:s,limitedCanvasRecording:t.limitedCanvasRecording,compressionType:t.compressionType};this.storage.setSession(a),this.eventHolder.clear(),o&&this.recorder.setRecording(!0)}};var Mt=class{constructor(t){this._options=t;this._buckets={};this._refillBuckets=()=>{Object.keys(this._buckets).forEach(t=>{let r=this._getBucket(t)+this._refillRate;r>=this._bucketSize?delete this._buckets[t]:this._setBucket(t,r)})};this._getBucket=t=>this._buckets[String(t)];this._setBucket=(t,r)=>{this._buckets[String(t)]=r};this.consumeRateLimit=t=>{let r=this._getBucket(t)??this._bucketSize;if(r=Math.max(r-1,0),r===0)return!0;this._setBucket(t,r);let o=r===0;return o&&this._onBucketRateLimited?.(t),o};this._onBucketRateLimited=this._options._onBucketRateLimited,this._bucketSize=xt(this._options.bucketSize,0,100),this._refillRate=xt(this._options.refillRate,0,this._bucketSize),this._refillInterval=xt(this._options.refillInterval,0,864e5),this._removeInterval=setInterval(()=>{this._refillBuckets()},this._refillInterval)}stop(){this._removeInterval&&(clearInterval(this._removeInterval),this._removeInterval=void 0)}};function xt(e,t,r,o){return t>r&&(t=r),Hi(e)?e>r?r:e<t?t:e:xt(o||r,t,r)}var Hi=e=>toString.call(e)=="[object Number]";var kt=class{constructor(t,r={}){this._rrweb=t;this._options=r;this._loggedTracker={};this._onNodeRateLimited=t=>{if(!this._loggedTracker[t]){this._loggedTracker[t]=!0;let r=this._getNode(t);this._options.onBlockedNode?.(t,r)}};this._getNodeOrRelevantParent=t=>{let r=this._getNode(t);if(r?.nodeName!=="svg"&&r instanceof Element){let o=r.closest("svg");if(o)return[this._rrweb.mirror.getId(o),o]}return[t,r]};this._getNode=t=>this._rrweb.mirror.getNode(t);this._numberOfChanges=t=>(t.removes?.length??0)+(t.attributes?.length??0)+(t.texts?.length??0)+(t.adds?.length??0);this.throttleMutations=t=>{if(t.type!==Q.IncrementalSnapshot||t.data.source!==De.Mutation)return t;let r=t.data,o=this._numberOfChanges(r);r.attributes&&(r.attributes=r.attributes.filter(s=>{let[a]=this._getNodeOrRelevantParent(s.id);return this._rateLimiter.consumeRateLimit(a)?!1:s}));let n=this._numberOfChanges(r);if(!(n===0&&o!==n))return t};this._rateLimiter=new Mt({bucketSize:this._options.bucketSize??100,refillRate:this._options.refillRate??10,refillInterval:1e3,_onBucketRateLimited:this._onNodeRateLimited})}reset(){this._loggedTracker={}}stop(){this._rateLimiter.stop(),this.reset()}};var ze,rn=()=>{if(ze!==void 0)return ze;try{return ze=document.createElement("canvas").toDataURL("image/webp").indexOf("data:image/webp")===0,b("adora script - isWebpSupported? - ",ze),ze}catch{return ze=!1,!1}};var Lt=class{constructor(t,r,o,n){this.limitedCanvasRecording=t;this.canvasRecordingEnabled=r;this.org=o;this.rrwebRecorder=n;this.startable=!0;b("new recorder")}setOnEvent(t){this.onEvent=t}get args(){let t=this.org.blockedCSSClasses.length>0?`|(${this.org.blockedCSSClasses.join(")|(")})`:"",r=this.org.maskedCSSClasses&&this.org.maskedCSSClasses?.length>0?`|(${this.org.maskedCSSClasses?.join(")|(")})`:"",o=rn()?"image/webp":this.limitedCanvasRecording?"image/jpeg":"image/png";return{emit:n=>{if(!this.onEvent)throw new Error("onEvent must be assigned before starting recording");n.type===Q.FullSnapshot&&this.mutationThrottler?.reset();let s=this.mutationThrottler?this.mutationThrottler.throttleMutations(n):n;s&&this.onEvent(s)},userTriggeredOnInput:!0,blockClass:new RegExp(`(adora-block)|(rr-block|fs-exclude|ph-no-capture)${t}`),maskTextClass:new RegExp(`(adora-mask)|(rr-mask|fs-mask)${r}`),maskAllInputs:!0,maskInputFn:(n,s)=>on(this.org,s)?n:"*".repeat(n.length),maskTextFn:(n,s)=>s&&this.org.maskByDefault&&s.closest('button,a,div[role="button"],div[role*="menuitem"],input[type="button"],input[type="submit"],input[type="reset"]')||s&&on(this.org,s)?n:n.replace(/[\S]/g,"*"),maskTextSelector:this.org?.maskByDefault?"*":"",recordCanvas:this.canvasRecordingEnabled,sampling:this.canvasRecordingEnabled?{canvas:this.limitedCanvasRecording?1:2}:void 0,dataURLOptions:this.canvasRecordingEnabled?{type:o,quality:.6}:{}}}recordChangeCustomCohort(t){b("sending custom cohort change",t),this.rrwebRecorder.addCustomEvent(Vr,t)}recordCLS(t){this.rrwebRecorder.addCustomEvent("CLS",t)}recordFID(t){this.rrwebRecorder.addCustomEvent("FID",t)}recordLCP(t){this.rrwebRecorder.addCustomEvent("LCP",t)}recordVisibilityChange(t){this.rrwebRecorder.addCustomEvent("Adora.VisibilityChange",{visibilityState:t})}recordFocusChange(t){this.rrwebRecorder.addCustomEvent("Adora.FocusChange",{focusState:t})}get isRecording(){return this.rrwebRecorder.isRecording}setRecording(t){if(b("setRecording",`requested status: ${t}`,`current status ${this.rrwebRecorder.isRecording}`),this.rrwebRecorder.isRecording!==t){if(t){this.startRecording();return}this.stopRecording()}}startRecording(){if(this.isRecording)throw new Error("recording already in progress!");if(!this.startable){b("recorder is not startable, returning");return}this.mutationThrottler=new kt(this.rrwebRecorder,{bucketSize:100,refillRate:10,onBlockedNode:(t,r)=>{b("mutation throttler blocked node",{id:t,node:r})}}),this.rrwebRecorder.record(this.args)}stopRecording(){this.mutationThrottler?.stop(),this.mutationThrottler=void 0,this.rrwebRecorder.stop()}stopFutureRecordings(){this.startable=!1}};function on(e,t){if(t.classList.contains("adora-unmask"))return!0;for(let r of e.unmaskSelectors)if(Array.from(document.querySelectorAll(r)).find(o=>o===t))return!0;return!1}var Pt=class{constructor(){this._isRecording=!1}get isRecording(){return this._isRecording}get mirror(){return me.mirror}record(t){if(b("record",{stopFn:typeof this.stopFn,isRecording:this._isRecording}),this.stopFn!==void 0&&this.stop(),this._isRecording=!0,this.stopFn=me(t),!this.stopFn)throw new Error("recorder could not successfully start")}stop(){this._isRecording=!1,this.stopFn&&(this.stopFn(),this.stopFn=void 0)}addCustomEvent(t,r){if(!this._isRecording)return b("WARNING! attempting to add custom event with recording off"),!1;try{me.addCustomEvent(t,r)}catch(o){return b("trying to record an event even though",o),!1}return!0}};var nn=5e3;function sn({sessionType:e}){b("initialize recording");let t=new Ie(e,new be),r=t.getSession();if(!r)return;let o=new ve(r.settings.backendUrl),n=new ut(e,new be),s=n.getEvents();n.removeEvents();let a=()=>window.location.href,c=()=>window.navigator.language,i=()=>window.devicePixelRatio,u=new Pt,d=new Lt(r.limitedCanvasRecording??!1,r.canvasRecordingEnabled??!1,r.organization,u),l=new Tt(r.organization,n,a,d,s||[]),g=new Ot(window,t,l,d,o,r.organization,{getHref:a,getLanguage:c,getDevicePixelRatio:i}),f=window.location.href;ce({urlStr:f,pathConfig:r.organization.pathConfig})?(b("starting recording..."),d.setRecording(!0)):b("recording did not start as current URL is blocked");let p=ht(window,r.organization.cohortsBootstrapConfig);d.isRecording&&(d.recordChangeCustomCohort({uid:r.settings.uid,userCohorts:r.settings.userCohorts?{...p,...r.settings.userCohorts}:{}}),t.setSession(r)),Ge.onCLS(_=>{d.isRecording&&d.recordCLS(_)}),Ge.onFID(_=>{d.isRecording&&d.recordFID(_)}),Ge.onLCP(_=>{d.isRecording&&d.recordLCP(_)});let h=()=>{g.clearAndSaveEvents(l.getEvents())},C=window.setInterval(h,nn);window.addEventListener("blur",()=>{d.recordFocusChange("blur")}),window.addEventListener("focus",()=>{d.recordFocusChange("focus")}),document.addEventListener("visibilitychange",()=>{if(b(`detected a visibility change to ${document.visibilityState}`),d.isRecording&&d.recordVisibilityChange(document.visibilityState),document.visibilityState==="hidden"){C&&(b("clearing the saveInterval"),clearInterval(C),C=void 0),l.onVisibilityChange(!1);return}C||(b("resuming the saveInterval"),C=window.setInterval(h,nn))});let I=f,v=new MutationObserver(function(){if(l&&window.location.href!==I){let _=ce({urlStr:window.location.href,pathConfig:r.organization.pathConfig});b(`url changed detected, status: ${!!_}`),d.setRecording(!!_),I=window.location.href}});return v.observe(document,{subtree:!0,childList:!0}),{recorder:d,eventSync:g,urlChangeObserverDispose:()=>{v.disconnect()}}}var an=e=>sn(e);var Ke=!1,dn="_adora_user_id",cn="_adora_rate_limited",ye,at,Pr="stopped",un=()=>{b("startRecording",`adoraIsRunning: ${Ke}`),Pr==="started"&&(ye=an({sessionType:"adoraSessionScript"}))},ln=1e3*60*30,pl=async({userCohorts:e,...t})=>{let r=t;if(Pr="started",b("adora start",{adoraIsRunning:Ke,uid:r.uid,userCohorts:e||{}}),typeof window.sessionStorage!="object"){b("SSR detected");return}if(e){r.userCohorts={};for(let[i,u]of Object.entries(e))u!==void 0?(b("setting user cohorts key",{key:i,value:u}),r.userCohorts[i]=u):b("found undefined user cohorts key",{key:i})}let o=new Ie("adoraSessionScript",new be),n=o.getSession();if(n){b("session detected; finding if changes should be written");let i=!1;if(r.uid&&n.settings.uid!==r.uid&&(b("detected uid change"),n.settings.uid=r.uid,o.setSession(n),i=!0),r.userCohorts&&Object.keys(r.userCohorts).length>0){b("detected user cohorts");let u=structuredClone(n.settings.userCohorts);Yi(u,r.userCohorts)||(b("detected user cohorts have been changed"),n.settings.userCohorts=r.userCohorts,o.setSession(n),i=!0)}i&&ye?.recorder&&ye?.recorder.isRecording&&(b("writing cohort change to recorder"),ye?.recorder.recordChangeCustomCohort({uid:n.settings.uid,userCohorts:n.settings.userCohorts?{...n.settings.userCohorts}:{}}))}if(Ke===!0)return;Ke=!0;let s=o.lastRateLimitedTimestamp;if(s!==void 0){if(Date.now()-s<ln){b("exiting as the session has been rate limited recently");return}o.clearLastRateLimitedTimestamp()}if(Ft.get(cn)){b("exiting as the domain has been rate limited recently");return}if(n){b("start recording for existing session"),un();return}let a=!1,c=async(i,u)=>{if(b("start status",{started:a}),a)return;a=!0;let d=await Kr("adoraSessionScript",u,r);if(d.type==="error"){d.code==="RateLimitExceeded"&&(b("setting expiration on local storage"),o.setLastRateLimitedTimestamp(Date.now()),i&&(b("setting expiration cookie"),Ft.set(cn,i,{expires:new Date(Date.now()+ln),domain:i})));return}un()};b("launching session preload");try{let i=await new ve(r.backendUrl).sessionPreload({orgId:r.orgId});b("session preload resolved");let u=window.location.href;if(i){if(i.error){b("error preloading",i.error);return}if("scheduledDowntime"in i.data){b("scheduled downtime; exiting");return}let{organization:d}=i.data;b("session preload success");let l=Ft.get(dn),g;b("existing adora user id cookie:",l);for(let f of d.cookieDomains)(window.location.hostname.toLowerCase()===f||window.location.hostname.toLowerCase().endsWith("."+f))&&(g=f,l||(l=Vi(),Ft.set(dn,l,{domain:f,expires:new Date(Date.now()+365*24*60*60*1e3)}),b("setting adoraUserId cookie on domain",l)));b("using adora user id:",l),ce({urlStr:u,pathConfig:d.pathConfig})?(b("at an unblocked URL, starting adora"),await c(g,l)):(b("at an blocked URL, waiting for unblocked URL to start adora"),at&&at.disconnect(),at=new MutationObserver(function(f,p){if(u!=window.location.href){let h=window.location.href,C=ce({urlStr:h,pathConfig:d.pathConfig});if(b(`url changed detected during blocked state, status: ${!!C}`),C){b("disconnecting observer"),p.disconnect(),b("scheduling adora to start"),c(g,l);return}u=h}}),at.observe(document,{subtree:!0,childList:!0}))}}catch(i){b("Error in adoraStart:",i)}},gl=async()=>{Pr="stopped",b("adora stop",{adoraIsRunning:Ke}),ye&&(ye.recorder.setRecording(!1),ye.recorder.stopFutureRecordings(),ye.urlChangeObserverDispose(),await ye.eventSync.clearAndSaveEvents()),at?.disconnect(),Ke=!1,ye=void 0};export{Ke as adoraIsRunning,pl as adoraStart,gl as adoraStop};
54
4
  //# sourceMappingURL=index.mjs.map