ripplo 0.9.8 → 0.10.0
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/{chunk-IKYR3UCU.js → chunk-26A42N75.js} +28 -28
- package/dist/{chunk-7EL64XR6.js → chunk-43C7VPGA.js} +1 -1
- package/dist/{chunk-TOBC3SQA.js → chunk-44GHUVW6.js} +2 -2
- package/dist/{chunk-64OQXBRG.js → chunk-4OSYMIH6.js} +1 -1
- package/dist/{chunk-GI65FUDI.js → chunk-5X4M4MTG.js} +3 -3
- package/dist/chunk-67YR3QHA.js +6 -0
- package/dist/{chunk-7YQOAAKF.js → chunk-6NKSEWP6.js} +6 -6
- package/dist/chunk-6TCK75ER.js +83 -0
- package/dist/{chunk-7IIRERCW.js → chunk-73TKORK6.js} +1 -1
- package/dist/{chunk-3UZZBLVA.js → chunk-CEVQ5RNC.js} +1 -1
- package/dist/chunk-FXCBWBN5.js +4 -0
- package/dist/{chunk-OQS63V7U.js → chunk-GOZWOCTE.js} +2 -2
- package/dist/chunk-IONMYZ3K.js +4 -0
- package/dist/{chunk-2GFHB4LD.js → chunk-LL4HUOJP.js} +1 -1
- package/dist/{chunk-IDPJESOE.js → chunk-M3CXHDFV.js} +1 -1
- package/dist/{chunk-OES7HGNF.js → chunk-QAR7FZO3.js} +1 -1
- package/dist/{chunk-GZ3M7PNW.js → chunk-UDPKOYZT.js} +1 -1
- package/dist/chunk-VDAFHS7J.js +7 -0
- package/dist/{chunk-OQ4TDIP3.js → chunk-VOZOP7MQ.js} +1 -1
- package/dist/{cli-error-TS4FNZ6F.js → cli-error-AHNJULLG.js} +1 -1
- package/dist/{compile-write-BLJH647I.js → compile-write-OLQOR3OK.js} +1 -1
- package/dist/daemon-BJAGK2Q3.js +152 -0
- package/dist/{daemon-QKBWYQJA.js → daemon-H4P5PCVH.js} +1 -1
- package/dist/{dsl-loader-NGW4V4A3.js → dsl-loader-LXH6PUY5.js} +1 -1
- package/dist/{exit-plan-gate-HSTV7UO4.js → exit-plan-gate-CJ3IXWTN.js} +1 -1
- package/dist/hook.js +1 -1
- package/dist/index.js +175 -175
- package/dist/{plan-reminder-RBCRBCKC.js → plan-reminder-EPCNBFY3.js} +1 -1
- package/dist/post-edit-ZVCYZ62V.js +4 -0
- package/dist/post-edit-analyze-J2H3I3IO.js +4 -0
- package/dist/post-edit-flag-stubs-E22KT2LD.js +4 -0
- package/dist/{pre-edit-YF6WNE6G.js → pre-edit-TEN3AFRK.js} +1 -1
- package/dist/pre-edit-scope-gate-2YIFSEDY.js +1 -1
- package/dist/{pre-edit-watch-gate-SJ3RCYH5.js → pre-edit-watch-gate-BUFWLXR3.js} +1 -1
- package/dist/{prompt-submit-YX7GMTC4.js → prompt-submit-DJFWNGYC.js} +1 -1
- package/dist/scope-reminder-DIDCHDAA.js +1 -1
- package/dist/status-FDM2RK37.js +4 -0
- package/dist/{stop-enforce-VWOM5EZY.js → stop-enforce-4XV6LK7Z.js} +2 -2
- package/dist/tasks-reminder-SDS6RNLP.js +1 -1
- package/package.json +2 -3
- package/dist/chunk-22JUAYHM.js +0 -4
- package/dist/chunk-7VGCLQGP.js +0 -7
- package/dist/chunk-AWPZTNYU.js +0 -6
- package/dist/chunk-CTTC4KKQ.js +0 -83
- package/dist/chunk-NY6EIQR4.js +0 -4
- package/dist/daemon-UMZJZ7BY.js +0 -152
- package/dist/post-edit-MVGQGAW4.js +0 -4
- package/dist/post-edit-analyze-XWTZMQCB.js +0 -4
- package/dist/post-edit-flag-stubs-4MQZATJE.js +0 -4
- package/dist/solve-worker.js +0 -4
- package/dist/status-HPMHJBKH.js +0 -4
package/dist/chunk-CTTC4KKQ.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __ripploCreateRequire } from "node:module";
|
|
3
|
-
const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
|
|
4
|
-
import{A as Mt,B as st,C as xe,D as Vc,E as Wc,F as Uc,G as zc,H as K,I as ye,L as Ss,M as Gc,N as qn,O as Kc,S as Hn,T as qc,X as Hc,Y as Yc,Z as Zc,_ as Jc,a as b,b as Ic,c as gs,d as ot,da as at,e as Jt,ea as Xc,f as ce,g as Tc,ga as Qc,h as it,i as Br,j as zn,k as Gn,l as Lc,m as Nc,n as Fc,o as Kn,s as $c,t as Dc,u as _c,v as Bc,w as ve,x as Fe,y as At,z as jc}from"./chunk-IKYR3UCU.js";import{a as By}from"./chunk-NNH3YVVO.js";import{a as _y,b as Oc}from"./chunk-KMZ3L5YA.js";var jd=_y((mN,ea)=>{"use strict";var Oo=process||{},_d=Oo.argv||[],Mo=Oo.env||{},Gb=!(Mo.NO_COLOR||_d.includes("--no-color"))&&(!!Mo.FORCE_COLOR||_d.includes("--color")||Oo.platform==="win32"||(Oo.stdout||{}).isTTY&&Mo.TERM!=="dumb"||!!Mo.CI),Kb=(e,t,r=e)=>n=>{let o=""+n,i=o.indexOf(t,e.length);return~i?e+qb(o,t,r,i)+t:e+o+t},qb=(e,t,r,n)=>{let o="",i=0;do o+=e.substring(i,n)+r,i=n+t.length,n=e.indexOf(t,i);while(~n);return o+e.substring(i)},Bd=(e=Gb)=>{let t=e?Kb:()=>String;return{isColorSupported:e,reset:t("\x1B[0m","\x1B[0m"),bold:t("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:t("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:t("\x1B[3m","\x1B[23m"),underline:t("\x1B[4m","\x1B[24m"),inverse:t("\x1B[7m","\x1B[27m"),hidden:t("\x1B[8m","\x1B[28m"),strikethrough:t("\x1B[9m","\x1B[29m"),black:t("\x1B[30m","\x1B[39m"),red:t("\x1B[31m","\x1B[39m"),green:t("\x1B[32m","\x1B[39m"),yellow:t("\x1B[33m","\x1B[39m"),blue:t("\x1B[34m","\x1B[39m"),magenta:t("\x1B[35m","\x1B[39m"),cyan:t("\x1B[36m","\x1B[39m"),white:t("\x1B[37m","\x1B[39m"),gray:t("\x1B[90m","\x1B[39m"),bgBlack:t("\x1B[40m","\x1B[49m"),bgRed:t("\x1B[41m","\x1B[49m"),bgGreen:t("\x1B[42m","\x1B[49m"),bgYellow:t("\x1B[43m","\x1B[49m"),bgBlue:t("\x1B[44m","\x1B[49m"),bgMagenta:t("\x1B[45m","\x1B[49m"),bgCyan:t("\x1B[46m","\x1B[49m"),bgWhite:t("\x1B[47m","\x1B[49m"),blackBright:t("\x1B[90m","\x1B[39m"),redBright:t("\x1B[91m","\x1B[39m"),greenBright:t("\x1B[92m","\x1B[39m"),yellowBright:t("\x1B[93m","\x1B[39m"),blueBright:t("\x1B[94m","\x1B[39m"),magentaBright:t("\x1B[95m","\x1B[39m"),cyanBright:t("\x1B[96m","\x1B[39m"),whiteBright:t("\x1B[97m","\x1B[39m"),bgBlackBright:t("\x1B[100m","\x1B[49m"),bgRedBright:t("\x1B[101m","\x1B[49m"),bgGreenBright:t("\x1B[102m","\x1B[49m"),bgYellowBright:t("\x1B[103m","\x1B[49m"),bgBlueBright:t("\x1B[104m","\x1B[49m"),bgMagentaBright:t("\x1B[105m","\x1B[49m"),bgCyanBright:t("\x1B[106m","\x1B[49m"),bgWhiteBright:t("\x1B[107m","\x1B[49m")}};ea.exports=Bd();ea.exports.createColors=Bd});function ee(e){return`${e.workflow}/${e.slug}`}var eu=new WeakMap;function J(e){let t=eu.get(e);if(t!=null)return t;let r=e.workflows.flatMap(n=>n.tests.map(o=>({ref:ee(o),test:o,workflow:n})));return eu.set(e,r),r}function bs({onlyFirst:e=!1}={}){let o="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(o,e?void 0:"g")}var jy=bs();function ws(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!e.includes("\x1B")&&!e.includes("\x9B")?e:e.replace(jy,"")}function Rs(e,t,r){return{detail:r.slice(0,500),kind:"engine-http",path:e,status:t}}function Xt(e,t){return{code:su(t)??null,kind:"engine-network",message:Vr(t),path:e}}function Yn(e){return{kind:"client-mount-missing",mountKey:e}}function vs(e,t){return{kind:"app-not-ready",readyKey:e,timeoutMs:t}}function xs(e,t){return{kind:"engine-decode",message:Vr(t),path:e}}function ks(e,t){return{entity:e,field:t,kind:"state-identity"}}function Cs(e){return{as:e,kind:"setup-missing-row"}}function Ke(e){return{kind:"driver-launch",message:Vr(e)}}function Zn(e){return{kind:"page-read",message:Vr(e)}}function Es(e){return{kind:"engine-unreachable",url:e}}function Ps(e,t){return{action:e,failure:t,kind:"action-failed"}}function As(e){return{kind:"unclassified",message:Vr(e)}}function Ms(){return{kind:"aborted"}}var Vy=["aborted","action-failed","page-read","app-not-ready","check-failed","client-mount-missing","driver-launch","engine-decode","engine-http","engine-network","engine-unreachable","setup-missing-row","state-identity"],Wy=new Set(Vy);function Jn(e){if(typeof e!="object"||e==null||!("kind"in e))return!1;let{kind:t}=e;return typeof t=="string"&&Wy.has(t)}var Uy=["app-not-ready","client-mount-missing","driver-launch","engine-decode","engine-http","engine-network","engine-unreachable"],nu=new Set(Uy);function Xn(e){return nu.has(e.kind)}function ou(e){return nu.has(e)}var tu=300;function jr(e){switch(e.kind){case"engine-http":return`engine ${e.path} returned ${String(e.status)}: ${iu(e.detail)}${qy(e.status)}`;case"engine-network":return`engine ${e.path} request failed: ${e.message}${zy(e.code)}${Ky(e.code,e.message)}`;case"client-mount-missing":return`this test reads client-side state, but the app never mounted the client engine ("${e.mountKey}"). Call mountClientEngine() where your app boots.`;case"app-not-ready":return`the app never called ready() within ${String(e.timeoutMs)}ms of loading the page. Call ready() from @ripplo/testing once your app is interactive \u2014 see setup.`;case"engine-decode":return`engine ${e.path} response did not match schema: ${e.message}`;case"state-identity":return`row of "${e.entity}" is missing identity field "${e.field}"`;case"setup-missing-row":return`setup returned no row for "${e.as}"`;case"engine-unreachable":return`the engine at ${e.url} did not respond in time \u2014 the dev server may still be recompiling. Re-run once it settles.`;case"driver-launch":return`browser driver failed to launch: ${e.message}`;case"page-read":return`reading the page failed: ${e.message}`;case"action-failed":return`action "${e.action}" failed: ${ru(e.failure)}`;case"check-failed":return`check failed: ${ru(e.failure)}`;case"aborted":return"run aborted"}}function ru(e){switch(e.kind){case"notFound":return"the element was not found";case"multipleMatches":return`the locator matched ${String(e.count)} elements`;case"covered":return`the element is covered by ${e.by}`;case"notPossible":return"the action is not possible on this element";case"wrongState":return`the element is ${e.observed.value?"":"not "}${e.observed.checkKind}`;case"wrongContent":return`the content was "${e.observed}"`;case"unclassified":return e.message}}function ke(){}function iu(e){let t=e.replaceAll(/\s+/gu," ").trim();return t.length<=tu?t:`${t.slice(0,tu)}\u2026 [truncated]`}function zy(e){return e==null?"":` (${e})`}var Gy=new Set(["EAI_AGAIN","ECONNREFUSED","ENOTFOUND"]);function Ky(e,t){return e!=null&&Gy.has(e)?" \u2014 nothing accepted the connection at the engine URL. Check that the app's dev server is running and RIPPLO_ENGINE_URL points at it.":t.toLowerCase().includes("timeout")?" \u2014 the app took too long to respond. On a dev server the first hit to a route compiles it on demand and can blow the timeout \u2014 warm the route or raise the setup budget. A hung seed/read impl does the same, so check the app logs if it persists.":" \u2014 the app dropped the connection mid-request. A thrown error in the engine route or a seed/read impl can cause this \u2014 check the app logs."}function qy(e){return e===404?" \u2014 the engine adapter is not mounted at RIPPLO_ENGINE_URL (or the mount path differs). Verify the adapter is wired into the app server and ENABLE_RIPPLO_TESTING=true; `ripplo doctor` checks the endpoint.":e===403||e===401?" \u2014 the adapter rejected the request: ENABLE_RIPPLO_TESTING is not true in the app's env, or RIPPLO_WEBHOOK_SECRET differs between the app and .ripplo env.":""}function su(e){if(!(typeof e!="object"||e==null))return"code"in e&&typeof e.code=="string"?e.code:"cause"in e?su(e.cause):void 0}function Vr(e){let t=e instanceof Error?e.message:String(e);return iu(ws(t))}var au=new WeakMap;function Qt(e){let t=au.get(e);if(t!=null)return t;let r={entities:e.entities,singletonSchemas:e.singletons,valueSpaces:e.valueSpaces};return Qc(r,e.solved),au.set(e,r),r}import{createHash as ES}from"crypto";import{z as Hy}from"zod";import{stringify as Yy}from"safe-stable-stringify";var Os=Hy.string().brand(),A=Os.parse("");function De(e){return Os.parse(e)}function Ce(e,t){return Os.parse(e.length===0?t:`${e}.${t}`)}function N(e){return Ic.safeParse(e).success}function Ot(e){let t=e.lastIndexOf(".");return t===-1?void 0:{alias:e.slice(0,t),field:e.slice(t+1)}}function qe(e){return typeof e=="object"&&e!==null&&"template"in e}function lu(e){return typeof e!="string"&&"count"in e}var $e=class extends Error{subject;constructor(t){super(t),this.subject=t}};function ge(e){return{counts:void 0,env:e}}function Wr(e,t,r){let n=Ce(t,e.ref);if(!r.has(n))throw new $e(n);return r.get(n)??null}function Ur(e,t,r){return Qn(e).every(n=>r.has(Ce(t,n)))}function He(e,t,r){return typeof e=="string"?e:N(e)?String(Wr(e,t,r.env)):e.template.map(n=>Jy(n,t,r)).join("")}function Ee(e,t,r){return e===null||typeof e=="number"||typeof e=="boolean"?e:N(e)?Wr(e,t,r.env):He(e,t,r)}function cu(e,t){return Ee(e,A,t)}function It(e){return Yy(e)}function er(e,t,r){return Object.fromEntries(Object.entries(e).map(([n,o])=>[n,Ee(o,t,r)]))}function Qn(e){return e==null||typeof e!="object"?[]:qe(e)?e.template.flatMap(t=>typeof t=="string"?[]:lu(t)?Zy(t):[t.ref]):[e.ref]}function Zy(e){return Object.values(e.count.where).flatMap(t=>uu(t))}function uu(e){return e==null||typeof e!="object"?[]:"kind"in e?e.kind==="within"?Object.values(e.selection.where).flatMap(t=>uu(t)):e.kind==="anyOf"?e.values.flatMap(t=>Qn(t)):Qn(e.value):Qn(e)}function Jy(e,t,r){if(typeof e=="string")return e;if(!lu(e))return String(Wr(e,t,r.env));if(r.counts==null)throw new $e(e.count.entity);return String(r.counts(e,r.env))}function ae(e,t){return e.by==="role"?{by:"role",name:e.name==null?void 0:He(e.name,A,t),role:e.role}:e.by==="inside"?{by:"inside",scope:ae(e.scope,t),target:ae(e.target,t)}:e.by==="surface"?{by:"surface",container:ae(e.container,t),overlay:e.overlay}:e.by==="frame"?{by:"frame",element:ae(e.element,t)}:{by:"testId",value:He(e.value,A,t)}}var Xy="https://ripplo.invalid";var du={hash:void 0,path:void 0,query:{},title:void 0,viewport:void 0};function fu(e){return e.kind!=="title"&&e.kind!=="viewport"}function Gr(e){return e.kind==="query"?`url query "${e.key}"`:e.kind==="title"||e.kind==="viewport"?e.kind:`url ${e.kind}`}function eo(e,t){return e==="title"?{kind:"title"}:e==="viewport"?{kind:"viewport"}:t===void 0||t.kind==="path"?{kind:"path"}:t.kind==="hash"?{kind:"hash"}:{key:t.key,kind:"query"}}function zr(e){let t=new URL(e,Xy),r=Object.fromEntries(t.searchParams.entries());return{hash:t.hash.length>0?t.hash.slice(1):void 0,path:t.pathname,query:r,title:void 0,viewport:void 0}}function hu(e){if(typeof e=="string")return pu(zr(e));let t=N(e)?[e]:e.template,r=t.findIndex(c=>typeof c=="string"&&/[?#]/.test(c)),n=t[r];if(r===-1||typeof n!="string")return{...du,path:e};let o=[...t.slice(0,r),n.slice(0,n.search(/[?#]/))].filter(c=>typeof c!="string"||c.length>0),i=t.slice(r),s={template:o};if(i.some(c=>typeof c!="string"))return{...du,path:s};let a=i.filter(c=>typeof c=="string").join(""),l=zr(`/p${a.slice(a.search(/[?#]/))}`);return{...pu(l),path:s}}function mu(e){let r=[[{kind:"path"},e.path],[{kind:"hash"},e.hash],[{kind:"title"},e.title],[{kind:"viewport"},e.viewport]].flatMap(([o,i])=>i===void 0?[]:[{clause:i,key:o}]),n=Object.entries(e.query).map(([o,i])=>({clause:i,key:{key:o,kind:"query"}}));return[...r,...n]}function pu(e){return{hash:e.hash,path:e.path,query:e.query,title:e.title,viewport:e.viewport}}var _e=new Map;function R(e){return e.kind!=="element"?b(e):Jt(e.locator,e.state)}function lt(e,t){return new Map([...yu(e,t),[R(t.subject),t]])}function Is(e,t){return new Map([...yu(e,t),[R(t.subject),t]])}function Se(e,t){return new Map([...e,...t])}function Ts(e){return e.kind==="element"}function St(e){return e.kind==="path"||e.kind==="query"||e.kind==="hash"}function ne(e,t){let r=e.get(R(t));return r==null||r.expect.expect!=="is"?void 0:r.expect.value}function rr(e){let t=zr(e),r=[[{kind:"path"},t.path],[{kind:"hash"},t.hash],...Object.entries(t.query).map(n=>[{key:n[0],kind:"query"},n[1]])];return new Map(r.flatMap(([n,o])=>o===void 0?[]:[[R(n),{declared:!0,expect:{expect:"is",value:o},subject:n}]]))}function Ls(e){return[...e].toSorted(([t],[r])=>t.localeCompare(r))}function yu(e,t){return Qy(t)?eg(e,t.subject):rg(t)?ng(e,t.subject):e}function Qy(e){return e.subject.kind==="element"&&e.subject.state==="visible"&&e.expect.expect==="is"&&e.expect.value===!1}function eg(e,t){if(t.kind!=="element")return e;let r=b(ce(t.locator)),n=[...e].filter(([,o])=>tg(o,r));return n.length===e.size?e:new Map(n)}function tg(e,t){if(e.subject.kind!=="element")return!0;let r=ce(e.subject.locator);return Kr(r,t)?!1:b(r)!==t?!0:e.subject.state!=="text"&&e.subject.state!=="value"}function Kr(e,t){return e.by==="frame"?b(e.element)===t||Kr(e.element,t):e.by!=="inside"?!1:b(e.scope)===t||b(e.target)===t||Kr(e.scope,t)||Kr(e.target,t)}function rg(e){return e.subject.kind==="element"&&e.subject.state==="visible"&&e.expect.expect==="is"&&e.expect.value===!0&&gu(e.subject.locator)}function gu(e){return e.by==="surface"&&e.overlay}function ng(e,t){if(t.kind!=="element")return e;let r=b(ce(t.locator)),n=[...e].filter(([,o])=>og(o,r));return n.length===e.size?e:new Map(n)}function og(e,t){if(e.subject.kind!=="element"||gu(e.subject.locator))return!0;let r=ce(e.subject.locator);return b(r)===t||Kr(r,t)}function Ye({declared:e,entry:t,scope:r}){let n=t.subject.kind==="element"?{...t.subject,locator:ae(t.subject.locator,r)}:t.subject;if(t.expect.expect==="absent")return{declared:e,expect:{expect:"absent"},subject:n};let o=Ee(t.expect.value,A,r),i=ag(n)&&typeof o=="number"?String(o):o;return{declared:e,expect:{expect:t.expect.expect,value:i},subject:n}}function Tt({got:e,subject:t,want:r}){if(r.expect==="absent")return e===void 0;if(ig(t)){let n=sg(e,r.value);return r.expect==="is"?n:!n}return r.expect==="is"?e===r.value:e!==r.value}function ig(e){return e.kind==="element"&&e.state==="text"}function tr(e){return e.replaceAll(/\s+/gu," ").trim()}function sg(e,t){return typeof e=="string"&&typeof t=="string"&&tr(e)===tr(t)}function ag(e){return e.kind==="element"&&(e.state==="value"||e.state==="text")}import lg from"better-sqlite3";var Su={current:null};function to(){let e=Su.current;if(e!=null)return e;let t={columns:new Map,db:new lg(":memory:"),loaded:null,statements:new Map};return Su.current=t,t}function Lt(e,t){let r=e.statements.get(t);if(r!=null)return r;let n=e.db.prepare(t);return e.statements.set(t,n),n}function Ze(e,t,r){e.columns.get(t)==null&&(e.db.exec(`CREATE TABLE "${t}" (__as TEXT PRIMARY KEY)`),e.columns.set(t,new Set));let o=e.columns.get(t);r.filter(s=>o?.has(s)!==!0).forEach(s=>{e.db.exec(`ALTER TABLE "${t}" ADD COLUMN "${s}"`),o?.add(s),e.loaded=null})}function ro(e,t){t.entities.forEach((r,n)=>{let o=[...new Set([...r.values()].flatMap(i=>Object.keys(i)))];Ze(e,n,o)})}function qr(e,t,r){Ze(e,t,Object.keys(r)),Object.values(r).forEach(n=>{ve(n)&&(Ze(e,n.selection.entity,[n.field]),qr(e,n.selection.entity,n.selection.where))})}function no(e,t){e.loaded!==t&&(e.columns.forEach((r,n)=>{Lt(e,`DELETE FROM "${n}"`).run();let o=t.entities.get(n);if(o==null||o.size===0)return;let i=[...r],s=i.map(d=>`"${d}"`).join(", "),a=i.map(()=>"?").join(", "),l=i.length===0?"(__as)":`(__as, ${s})`,c=i.length===0?"(?)":`(?, ${a})`,u=Lt(e,`INSERT INTO "${n}" ${l} VALUES ${c}`);o.forEach((d,p)=>{u.run(p,...i.map(y=>cg(d[y])))})}),e.loaded=t)}function cg(e){return typeof e=="boolean"?e?1:0:typeof e=="string"||typeof e=="number"?e:e instanceof Date?e.toISOString():null}function Ns({entity:e,snapshot:t,where:r}){let n=to();qr(n,e,r),ro(n,t),no(n,t);let i=`SELECT r.__as AS __as FROM "${e}" r WHERE ${oo(r,{depth:0,refExpr:ug,row:"r"})} ORDER BY r.rowid`;return Lt(n,i).all().flatMap(s=>{let a=s!=null&&typeof s=="object"?Reflect.get(s,"__as"):null;return typeof a=="string"?[a]:[]})}function bu(e){let t=e.snapshot.entities.get(e.entity);return t==null||t.size===0?[]:Ns(e).flatMap(r=>{let n=t.get(r);return n==null?[]:[n]})}function ug(e){throw new Error(`sql-where: unresolved ref "${e}" \u2014 resolve refs before matching`)}function oo(e,t){let r=Object.entries(e).map(([n,o])=>dg({column:`${t.row}."${n}"`,scope:t,want:o}));return r.length===0?"1":r.join(" AND ")}function dg({column:e,scope:t,want:r}){if(ve(r)){let n=`w${String(t.depth)}`,o=oo(r.selection.where,{...t,depth:t.depth+1,row:n});return`${e} IN (SELECT ${n}."${r.field}" FROM "${r.selection.entity}" ${n} WHERE ${o})`}return Fe(r)?mg({column:e,scope:t,want:r}):`${e} IS ${Nt(r,t.refExpr)}`}function Nt(e,t){let r=pg(e);if(r!=null)return t(r);if(e instanceof Date)return Ft(e.toISOString());if(e!=null&&typeof e=="object")throw new Error("sql-where: template values must be resolved before compiling");return Ft(e)}function Ft(e){if(e==null)return"NULL";if(typeof e=="boolean")return e?"1":"0";if(typeof e=="number")return String(e);if(typeof e=="string")return`'${e.replaceAll("'","''")}'`;throw new Error("sql-where: only primitive literals can be compiled")}function pg(e){return N(e)?e.ref:void 0}function io(e,t){return e.map(r=>{let n=[...Object.entries(r.literals).map(([i,s])=>`x."${i}" IS ${Ft(s)}`),...r.relations.map(i=>{let s=t(i.targetAlias,i.targetField);return s==null?"0":`x."${i.field}" = ${s}`})],o=n.length===0?"":` WHERE ${n.join(" AND ")}`;return`NOT EXISTS (SELECT 1 FROM "${r.entity}" x${o})`})}function so(e,t){return e.map(r=>{let n=t(r),o=n.length===0?"":` WHERE x.__as NOT IN (${n.join(", ")})`;return`NOT EXISTS (SELECT 1 FROM "${r}" x${o})`})}function ao(e,t){return e.flatMap(r=>Fs(r,t))}function Fs(e,t){if(e.kind==="singleton")return[];if(e.kind==="not"){let r=Fs(e.predicate,t);return r.length===0?[]:[`NOT (${r.join(" AND ")})`]}return e.kind==="and"||e.kind==="or"?fg(e,t):[hg(e,t)]}function fg(e,t){let r=e.predicates.flatMap(o=>Fs(o,t)),n=e.kind==="and"?" AND ":" OR ";return r.length===0?[]:[`(${r.join(n)})`]}function hg(e,t){return e.kind==="count"?`(SELECT COUNT(*) FROM "${e.entity}" c WHERE ${oo(e.where,t)}) = ${String(e.value)}`:`EXISTS (SELECT 1 FROM "${e.entity}" c WHERE ${oo(e.where,t)})`}function mg({column:e,scope:t,want:r}){let{refExpr:n}=t;if(r.kind==="not")return`${e} IS NOT ${Nt(r.value,n)}`;if(r.kind==="anyOf")return`(${r.values.map(i=>`${e} IS ${Nt(i,n)}`).join(" OR ")})`;if(r.kind==="compare"){let o={gt:">",gte:">=",lt:"<",lte:"<="}[r.op];return`${e} ${o} ${Nt(r.value,n)}`}return r.kind==="contains"?`instr(${e}, ${Nt(r.value,n)}) > 0`:`substr(${e}, 1, length(${Nt(r.value,n)})) IS ${Nt(r.value,n)}`}function bt(e){return typeof e=="object"&&e!==null&&"kind"in e}function wt(e){return Object.fromEntries(Object.entries(e).filter(t=>!bt(t[1])))}function Ds(e){return new Map(e.entities.filter(t=>t.identityKind==="surrogate").map(t=>[t.name,t.identity]))}function pe(e){return(t,r)=>Be(e,t.count.entity,t.count.where,r).length}function $t(e,t,r){return t.reduce((n,o)=>Sg(n,o,r,e),e)}function wu(e,{clears:t,forget:r,sets:n}){let o=new Set(t),i=yg(e,r,n),s=[...e.scalars].filter(([l,c])=>!o.has(l)&&!(i&&(Ts(c.subject)||gg(c.subject)))),a=[...n.values()].reduce((l,c)=>lt(l,c),new Map(s));return{...e,scalars:a}}function yg(e,t,r){if(t==="hard")return!0;if(t==="none")return!1;let n=ne(e.scalars,{kind:"path"}),o=ne(r,{kind:"path"});return o!==void 0&&o!==n}function gg(e){return e.kind==="query"||e.kind==="hash"}function Sg(e,t,r,n){let{env:o,identities:i}=r;if(!Rg(t,o))return e;if(t.assertion.kind==="created"){let l=er(t.assertion.props,A,{counts:pe(e),env:o}),c=bg({entity:t.entity,identities:i,props:l},e);return xg(e,t.entity,It(c),c)}let s=xu({entity:t.entity,env:o,key:t.key,snapshot:n});if(t.assertion.kind==="deleted")return $s(e,t.entity,l=>new Map([...l].filter(([c])=>!s.has(c))));let a=er(wt(t.assertion.props),A,{counts:pe(e),env:o});return $s(e,t.entity,l=>new Map([...l].map(([c,u])=>s.has(c)?[c,{...u,...a}]:[c,u])))}var _s="#surrogate#";function Ru(e){return typeof e=="string"&&e.includes(_s)}function bg({entity:e,identities:t,props:r},n){let o=(t.get(e)??[]).filter(a=>!(a in r));if(o.length===0)return r;let i=wg(n.entities.get(e),e),s=Object.fromEntries(o.map(a=>[a,`${e}${_s}${String(i)}`]));return{...r,...s}}function wg(e,t){let r=`${t}${_s}`;return[...(e??new Map).values()].flatMap(o=>Object.values(o)).filter(o=>typeof o=="string"&&o.startsWith(r)).map(o=>Number(o.slice(r.length))).filter(o=>Number.isFinite(o)).reduce((o,i)=>Math.max(o,i),0)+1}function Rg(e,t){return("props"in e.assertion?[e.key,wt(e.assertion.props)]:[e.key]).every(n=>Object.values(n).every(o=>ve(o)||vg(o).every(i=>!N(i)||t.has(De(i.ref)))))}function vg(e){return Fe(e)?e.kind==="anyOf"?e.values:[e.value]:[e]}function xg(e,t,r,n){let o=new Map([...e.entities.get(t)??[],[r,n]]);return{...e,entities:new Map([...e.entities,[t,o]])}}function $s(e,t,r){let n=r(e.entities.get(t)??new Map);return{...e,entities:new Map([...e.entities,[t,n]])}}function Be(e,t,r,n){return bu({entity:t,snapshot:e,where:Bs(r,{env:n,snapshot:e})})}function vu(e,t,r,n,o){let i=xu({entity:t,env:n,key:r,snapshot:e});return $s(e,t,s=>new Map([...s].map(([a,l])=>[a,i.has(a)?o(l):l])))}function xu({entity:e,env:t,key:r,snapshot:n}){return new Set(Ns({entity:e,snapshot:n,where:Bs(r,{env:t,snapshot:n})}))}function Bs(e,t){return Object.fromEntries(Object.entries(e).map(([r,n])=>[r,kg(n,t)]))}function kg(e,t){return ve(e)?{...e,selection:{...e.selection,where:Bs(e.selection.where,t)}}:Fe(e)?e.kind==="anyOf"?{...e,values:e.values.map(r=>lo(r,t))}:e.kind==="contains"||e.kind==="startsWith"?{...e,value:String(lo(e.value,t))}:{...e,value:lo(e.value,t)}:lo(e,t)}function lo(e,t){return Ee(e,A,{counts:pe(t.snapshot),env:t.env})}function Cu(e,t,r){return e.reduce((n,o)=>{let i=Cg(o,n.snapshot,r),s=$t(n.snapshot,Eu(o,i),r);return{resolved:[...n.resolved,{executedBranches:i,step:o}],snapshot:s}},{resolved:[],snapshot:t}).resolved}function Dt(e,t){if(e.kind==="count")return Be(t.snapshot,e.entity,e.where,t.env).length===e.value;if(e.kind==="exists")return Be(t.snapshot,e.entity,e.where,t.env).length>0;if(e.kind==="singleton"){let r=Ee(e.assertion.value,A,{counts:pe(t.snapshot),env:t.env});return ku(ne(t.snapshot.scalars,{kind:"variable",name:e.singleton}))===ku(r)}return e.kind==="not"?!Dt(e.predicate,t):e.kind==="or"?e.predicates.some(r=>Dt(r,t)):e.predicates.every(r=>Dt(r,t))}function Cg(e,t,r){let n=$t(t,Eu(e,[]),r);return e.expect.filter(o=>o.kind==="when").flatMap(o=>{let i=o.branches.find(s=>s.condition==null||Dt(s.condition,{env:r.env,snapshot:n}));return i==null?[]:[i.name]})}function Eu(e,t){return Kn({executedBranches:t,expect:e.expect}).flatMap(r=>r.predicate.kind==="state"&&!r.negated?[r.predicate]:[])}function ku(e){return e==null?"\u2205":JSON.stringify(e)}function Pu(e){return[...e.world.flatMap(t=>Eg(t)),...e.steps.flatMap(t=>js(t)),...Object.values(e.singletons).flatMap(t=>K(t)),...e.absent.flatMap(t=>Object.values(t.where).flatMap(r=>K(r))),...e.actor.kind==="user"?[e.actor.alias]:[]]}function Eg(e){return Object.values(e.set).flatMap(t=>K(t))}function js(e){return[...Pg(e.action),...e.expect.flatMap(t=>ct(t))]}function ct(e){switch(e.kind){case"visible":case"unobstructed":case"disabled":case"enabled":case"focused":case"checked":case"expanded":case"pressed":return ye(e.locator);case"value":case"text":{let t=ot(e.value)?e.value.value:e.value;return[...ye(e.locator),...K(t)]}case"singleton":return K(e.assertion.value);case"browser":return K(e.value);case"state":return[...e.assertion.kind==="deleted"?[]:Object.values(wt(e.assertion.props)).flatMap(t=>K(t)),...Object.values(e.key).flatMap(t=>_t(t))];case"not":return ct(e.predicate);case"when":return e.branches.flatMap(t=>[...t.condition==null?[]:ct(t.condition),...t.consequence.flatMap(r=>ct(r))]);case"and":case"or":return e.predicates.flatMap(t=>ct(t));case"count":case"exists":return Object.values(e.where).flatMap(t=>_t(t));case"actor":return e.target.kind==="anonymous"?[]:[e.target.ref.ref]}}function _t(e){return ve(e)?Object.values(e.selection.where).flatMap(t=>_t(t)):Fe(e)?(e.kind==="anyOf"?e.values:[e.value]).flatMap(r=>K(r)):K(e)}function Au(e){return!e.includes(".")}function nr(e){let t=e.indexOf(".");return t===-1?e:e.slice(0,t)}function Pg(e){return e.kind==="goto"?K(e.url):e.kind==="actor"?[e.ref.ref]:e.kind==="fill"||e.kind==="select"?[...ye(e.locator),...K(e.value)]:e.kind==="press"?e.locator==null?[]:ye(e.locator):e.kind==="drag"?[...ye(e.source),...ye(e.target)]:ye(e.locator)}var Mu=2e4;function Tu(e,t){let r=["__stage_a","__stage_b"],n=t.entities.reduce((a,l,c)=>{let u=r[c%2]??"__stage_a";e.db.exec(`DROP TABLE IF EXISTS ${u}`);let d=a==null?"":"prev.*, ",p=a==null?"":`${a} prev, `,y=Mg({index:c,pattern:t,prev:a});return e.db.exec(`CREATE TEMP TABLE ${u} AS SELECT ${d}t.__as AS "a${String(c)}" FROM ${p}"${l.entity}" t WHERE ${y}`),Ag(e,u),u},null);if(n==null)return{};let o=Og(t),i=o.length===0?"":` WHERE ${o.join(" AND ")}`,s=e.db.prepare(`SELECT * FROM ${n} s${i} LIMIT 1`).get();return s==null||typeof s!="object"?null:{...s}}function Ag(e,t){let r=e.db.prepare(`SELECT COUNT(*) AS n FROM ${t}`).get(),n=r!=null&&typeof r=="object"?Reflect.get(r,"n"):0;if(typeof n=="number"&&n>Mu)throw new Error(`sql-staged: pattern too weakly constrained \u2014 ${String(n)} partial assignments exceed the ${String(Mu)} cap`)}function Mg({index:e,pattern:t,prev:r}){let n=t.entities[e];if(n==null)return"1";let o=Object.entries(n.literals).map(([u,d])=>`t."${u}" IS ${Ft(d)}`),i=new Map(t.entities.slice(0,e).map((u,d)=>[u.alias,d])),s=n.relations.flatMap(u=>{let d=i.get(u.targetAlias);return d==null?[]:[`t."${u.field}" = ${Ou(t,d,u.targetField)}`]}),a=t.entities.slice(0,e).flatMap((u,d)=>u.relations.flatMap(p=>p.targetAlias===n.alias?[`${Ou(t,d,p.field)} = t."${p.targetField}"`]:[])),l=t.entities.slice(0,e).flatMap((u,d)=>u.entity===n.entity&&r!=null?[`t.__as <> prev."a${String(d)}"`]:[]),c=[...o,...s,...a,...l];return c.length===0?"1":c.join(" AND ")}function Ou(e,t,r){let n=e.entities[t]?.entity??"";return`(SELECT b."${r}" FROM "${n}" b WHERE b.__as = prev."a${String(t)}")`}function Iu(e,t,r){let n=e.entities[t]?.entity??"";return`(SELECT r."${r}" FROM "${n}" r WHERE r.__as = s."a${String(t)}")`}function Og(e){let t=new Map(e.entities.map((i,s)=>[i.alias,s])),r=i=>{let s=Ot(i),a=s==null?void 0:t.get(s.alias);if(s==null||a==null)throw new Error(`sql-staged: unresolved ref "${i}"`);return Iu(e,a,s.field)},n=(i,s)=>{let a=t.get(i);return a==null?null:Iu(e,a,s)},o=i=>e.entities.flatMap((s,a)=>s.entity===i?[`s."a${String(a)}"`]:[]);return[...io(e.absences,n),...so(e.exclusives,o),...ao(e.conditions,{depth:0,refExpr:r,row:"c"})]}var Lu=new WeakMap,Ig=60;function Fu(e,t){let r=to(),n=Du(t);if(_u(e.actor,n))return null;if(Tg(r,e),ro(r,t),no(r,t),e.entities.length>Ig){let s=Tu(r,e);return s==null?null:Nu({pattern:e,picked:s,snapshot:t})}let o=Lu.get(e)??Lg(e);Lu.set(e,o);let i=o.includes(":actor")?Lt(r,o).get({actor:n}):Lt(r,o).get();return i==null||typeof i!="object"?null:Nu({pattern:e,picked:i,snapshot:t})}function $u(e,t){let r=Du(t);return _u(e.actor,r)?{got:r}:null}function Du(e){let t=e.scalars.get(R({kind:"actor"})),r=t!=null&&t.expect.expect==="is"?t.expect.value:null;return typeof r=="string"?r:null}function _u(e,t){return e.kind==="user"?t==null:e.kind==="anonymous"?t!=null:!1}function Tg(e,t){t.entities.forEach(r=>{Ze(e,r.entity,[...Object.keys(r.literals),...r.relations.map(n=>n.field)]),r.relations.forEach(n=>{let o=t.entities.find(i=>i.alias===n.targetAlias);o!=null&&Ze(e,o.entity,[n.targetField])})}),t.absences.forEach(r=>{Ze(e,r.entity,[...Object.keys(r.literals),...r.relations.map(n=>n.field)]),r.relations.forEach(n=>{let o=t.entities.find(i=>i.alias===n.targetAlias);o!=null&&Ze(e,o.entity,[n.targetField])})}),t.conditions.forEach(r=>{Ws(e,r),Vs({condition:r,pattern:t,store:e})}),t.exclusives.forEach(r=>{Ze(e,r,[])})}function Vs({condition:e,pattern:t,store:r}){if(e.kind!=="singleton"){if(e.kind==="not"){Vs({condition:e.predicate,pattern:t,store:r});return}if(e.kind==="and"||e.kind==="or"){e.predicates.forEach(n=>{Vs({condition:n,pattern:t,store:r})});return}Object.values(e.where).flatMap(n=>_t(n)).forEach(n=>{let o=Ot(n);if(o==null)return;let i=t.entities.find(s=>s.alias===o.alias);i!=null&&Ze(r,i.entity,[o.field])})}}function Ws(e,t){if(t.kind!=="singleton"){if(t.kind==="not"){Ws(e,t.predicate);return}if(t.kind==="and"||t.kind==="or"){t.predicates.forEach(r=>{Ws(e,r)});return}qr(e,t.entity,t.where)}}function Nu({pattern:e,picked:t,snapshot:r}){let n=e.entities.map((o,i)=>{let s=Reflect.get(t,`a${String(i)}`),a=typeof s=="string"?r.entities.get(o.entity)?.get(s):null;return a==null?null:[o.alias,a]});return n.some(o=>o==null)?null:new Map(n.filter(o=>o!=null))}function Lg(e){let t=new Map(e.entities.map((l,c)=>[l.alias,`t${String(c)}`])),r=e.entities.length===0?"1":e.entities.map((l,c)=>`t${String(c)}.__as AS a${String(c)}`).join(", "),n=e.entities.length===0?"":` FROM ${e.entities.map((l,c)=>`"${l.entity}" t${String(c)}`).join(", ")}`,o=(l,c)=>{let u=t.get(l);return u==null?null:`${u}."${c}"`},i=l=>e.entities.flatMap(c=>c.entity===l?[t.get(c.alias)].flatMap(u=>u==null?[]:[`${u}.__as`]):[]),s=[...Ng(e,t),...e.entities.flatMap((l,c)=>Fg({alias:`t${String(c)}`,aliases:t,constraint:l})),...$g(e,t),...io(e.absences,o),...ao(e.conditions,{depth:0,refExpr:Dg(t),row:"c"}),...so(e.exclusives,i)],a=s.length===0?"":` WHERE ${s.join(" AND ")}`;return`SELECT ${r}${n}${a} LIMIT 1`}function Ng(e,t){if(e.actor.kind!=="user")return[];let r=t.get(e.actor.alias);return r==null?[]:[`${r}.__as = :actor`]}function Fg({alias:e,aliases:t,constraint:r}){let n=Object.entries(r.literals).map(([i,s])=>`${e}."${i}" IS ${Ft(s)}`),o=r.relations.map(i=>{let s=t.get(i.targetAlias);return s==null?"1":`${e}."${i.field}" = ${s}."${i.targetField}"`});return[...n,...o]}function $g(e,t){return e.entities.flatMap((r,n)=>e.entities.slice(n+1).flatMap((o,i)=>{if(r.entity!==o.entity)return[];let s=t.get(r.alias),a=t.get(e.entities[n+1+i]?.alias??o.alias);return s==null||a==null?[]:[`${s}.__as <> ${a}.__as`]}))}function Dg(e){return t=>{let r=Ot(t),n=r==null?void 0:e.get(r.alias);if(r==null||n==null)throw new Error(`sql-match: unresolved ref "${t}"`);return`${n}."${r.field}"`}}function Pe(e,t){let r=Hr(e,t);if(r==null)return null;let n=jg(e.scalars,t,Wu(r));return n==null?null:e.conditions.every(i=>Dt(i,{env:n,snapshot:t}))?n:null}function Hr(e,t){return Fu(e,t)}function co(e,t){let r=Hr(e,t);if(r==null)return _g(e,t);let n=Bg(e.scalars,t,Wu(r));if(n.unmet!=null)return n.unmet;let o=e.conditions.find(i=>!Dt(i,{env:n.env,snapshot:t}));return o==null?null:{condition:o,kind:"condition"}}function _g(e,t){let r=$u(e,t);if(r!=null)return{got:r.got??void 0,kind:"scalar",subject:{kind:"actor"},want:e.actor.kind==="anonymous"?"signed out":"a signed-in user"};let n=e.entities.find((i,s)=>{let a={...e,absences:[],conditions:[],entities:e.entities.slice(0,s+1),scalars:new Map};return Hr(a,t)==null});if(n!=null)return{alias:n.alias,entity:n.entity,kind:"entities",mustBeAbsent:!1};let o=e.absences.find(i=>{let s={...e,absences:[i],conditions:[],scalars:new Map};return Hr(s,t)==null});return{alias:null,entity:o?.entity??null,kind:"entities",mustBeAbsent:o!=null}}function Bu(e,t,r){let n=ju(e.subject,r);if(n==null)return null;let o=Vu(t,n);return e.expect.expect==="absent"?o===void 0?r:null:e.expect.expect==="not"?Ug({clause:e.expect.value,env:r,got:o,snapshot:t,subject:n}):Vg({clause:e.expect.value,env:r,got:o,snapshot:t,subject:n})}function Bg(e,t,r){return[...e.values()].reduce((n,o)=>{if(n.unmet!=null)return n;let i=Bu(o,t,n.env);if(i!=null)return{env:i,unmet:null};let s=ju(o.subject,n.env),a=s==null?void 0:Vu(t,s),l=o.expect.expect==="absent"?null:o.expect.value;return{env:n.env,unmet:{got:a,kind:"scalar",subject:o.subject,want:l}}},{env:r,unmet:null})}function jg(e,t,r){return[...e.values()].reduce((n,o)=>n==null?null:Bu(o,t,n),r)}function Vg({clause:e,env:t,got:r,snapshot:n,subject:o}){if(Wg(o,e,t))return r===void 0?null:new Map([...t,[De(zg(e)),r]]);if(!Ur(e,A,t))return null;let i=Ee(e,A,{counts:pe(n),env:t});return Tt({got:r,subject:o,want:{expect:"is",value:i}})?t:null}function Wg(e,t,r){return e.kind==="element"&&(e.state==="value"||e.state==="text")&&N(t)&&!Ur(t,A,r)}function Ug({clause:e,env:t,got:r,snapshot:n,subject:o}){if(!Ur(e,A,t))return null;let i=Ee(e,A,{counts:pe(n),env:t});return Tt({got:r,subject:o,want:{expect:"not",value:i}})?t:null}function zg(e){if(!N(e))throw new Error("expected a ref clause");return e.ref}function ju(e,t){return e.kind!=="element"?e:Gg(e.locator,t)?{...e,locator:ae(e.locator,ge(t))}:null}function Gg(e,t){return Wc(e).every(r=>Ur(r,A,t))}function Vu(e,t){let r=e.scalars.get(R(t));return r==null||r.expect.expect!=="is"?void 0:r.expect.value}function Wu(e){return new Map([...e].flatMap(([t,r])=>Object.entries(r).flatMap(n=>{let o=n[1];return typeof o=="string"||typeof o=="number"||typeof o=="boolean"?[[De(`${t}.${n[0]}`),o]]:[]})))}function Ae(e,t){return[...new Map(e.map(r=>[t(r),r])).values()]}function uo(e){return e.flatMap(t=>t.kind==="and"?uo(t.predicates):[t])}function or(e){return uo(e).filter(t=>!At(t))}function po(e){return e.action.kind==="goto"?!0:Us(e.expect).some(t=>t.kind==="browser"&&t.name==="url"&&t.value!==null)}function Bt(e){return e.action.kind==="goto"?!0:Us(e.expect).some(t=>t.kind==="browser"&&t.name==="url"&&t.value!==null&&(t.part===void 0||t.part.kind==="path"))}function Us(e){return e.flatMap(t=>t.kind==="and"?Us(t.predicates):[t])}function Je(e,t){return t.reduce((r,n)=>{let o=[...Xg(n),...Zr(n),...Qg(n)],i=Kg(n,r,o)?Jg(r):r;return o.reduce((s,a)=>Is(s,a),i)},e)}function ue(e){return e.kind==="not"?qg(e.predicate):e.kind==="singleton"?{expect:{expect:"is",value:e.assertion.value},subject:{kind:"variable",name:e.singleton}}:Hg(e)}function Yr(e){return mu(hu(e)).map(({clause:t,key:r})=>({expect:t===null?{expect:"absent"}:{expect:"is",value:t},subject:r}))}function Kg(e,t,r){if(e.action.kind==="goto")return!0;if(!Bt(e))return!1;let n=t.get(R({kind:"path"})),o=r.find(i=>i.subject.kind==="path");return o==null?!1:n==null||b(n.expect)!==b(o.expect)}function qg(e){return e.kind==="value"||e.kind==="text"?ot(e.value)?null:{expect:{expect:"not",value:e.value},subject:{kind:"element",locator:e.locator,state:e.kind}}:Uu(e,!0)}function Uu(e,t){if(e.kind==="value"||e.kind==="text")return ot(e.value)?null:{expect:{expect:"is",value:e.value},subject:{kind:"element",locator:e.locator,state:e.kind}};let r=Yg(e);return r==null?null:{expect:{expect:"is",value:r.value!==t},subject:{kind:"element",locator:r.locator,state:r.state}}}function Hg(e){return e.kind==="browser"?{expect:e.value===null?{expect:"absent"}:{expect:"is",value:e.value},subject:eo(e.name,e.part)}:e.kind==="actor"?e.target.kind==="anonymous"?{expect:{expect:"absent"},subject:{kind:"actor"}}:{expect:{expect:"is",value:{ref:`${e.target.ref.ref}.id`}},subject:{kind:"actor"}}:Uu(e,!1)}function Zr(e){let t=e.action;return!("locator"in t)||t.locator==null?[]:t.kind==="check"||t.kind==="uncheck"?[{expect:{expect:"is",value:t.kind==="check"},subject:{kind:"element",locator:t.locator,state:"checked"}}]:t.kind==="clear"?[{expect:{expect:"is",value:""},subject:{kind:"element",locator:t.locator,state:"value"}}]:t.kind==="fill"||t.kind==="select"?[{expect:{expect:"is",value:t.value},subject:{kind:"element",locator:t.locator,state:"value"}}]:[]}function Yg(e){return Zg(e)?e.kind==="disabled"?{locator:e.locator,state:"enabled",value:!1}:{locator:e.locator,state:e.kind,value:!0}:null}function Zg(e){return e.kind==="visible"||e.kind==="disabled"||e.kind==="enabled"||e.kind==="focused"||e.kind==="checked"||e.kind==="expanded"||e.kind==="pressed"}function Jg(e){return new Map([...e].filter(([,t])=>t.subject.kind==="variable"||t.subject.kind==="viewport"))}function Xg(e){return e.action.kind==="goto"?Yr(e.action.url):[]}function Qg(e){return or(e.expect).flatMap(t=>{let r=ue(t);return r==null?[]:[r]})}function zs(e){return e.includes("async")?"async":e.includes("slow")?"slow":"fast"}var Jr={async:12e4,fast:5e3,slow:3e4},fo={async:{backoffMs:[500,1e3,2e3,5e3],timeoutMs:Jr.async},fast:{backoffMs:[100,250,500,1e3],timeoutMs:Jr.fast},slow:{backoffMs:[250,500,1e3,2e3],timeoutMs:Jr.slow}};function zu(e,t){return e.backoffMs[Math.min(t,e.backoffMs.length-1)]??0}function Xe(e){return`${e.test}#${String(e.index)}`}function Xr(e){let t=J(e).flatMap(r=>Qr(e,r.test));return Ae(t,r=>`${r.test}:${b(r.steps)}`)}function Qr(e,t){let r=qu(t),n=Ku(r,t.singletons,t.actor,t.viewport),o=xS(t,vS(e)),i=rS(e,t),s=Ds(e);return oS(n,kS(t.steps),r).reduce((l,{chunk:c,requiredState:u},d)=>({offset:l.offset+c.length,transitions:[...l.transitions,bS({chunk:c,identities:s,index:d,intent:t.intent,namespace:r.namespace,paramSpaceOf:o,requiredState:u,testRef:ee(t),whenChunk:i.slice(l.offset,l.offset+c.length)})]}),{offset:0,transitions:[]}).transitions}function eS(e){return[R({kind:"viewport"}),{expect:{expect:"is",value:e},subject:{kind:"viewport"}}]}var tS=R({kind:"viewport"});function Gu(e){let t=e.scalars.get(tS);return t==null||t.expect.expect!=="is"||typeof t.expect.value!="string"?null:t.expect.value}function Ku(e,t,r,n){return{absences:mS(e),actor:r,conditions:[],entities:SS(e),exclusives:e.exclusives,scalars:new Map([...Object.entries(t).filter(([,o])=>!N(o)&&!qe(o)).map(o=>{let[i,s]=o;return[R({kind:"variable",name:i}),{expect:{expect:"is",value:s},subject:{kind:"variable",name:i}}]}),eS(n)])}}function rS(e,t){let r=e.workflows.find(n=>n.name===t.workflow);return r==null||r.steps.length!==t.steps.length?t.steps:r.steps}function ho(e,t,r){return Object.values(e).flatMap(n=>N(n)?ir(n.ref,r):[]).find(n=>n.entity===t)?.aliasPath}function en(e,t){return t.reduce((r,n)=>nS(n)??r,e)}function nS(e){if(e.action.kind==="actor")return{alias:e.action.ref.ref,kind:"user"};let t=e.expect.find(r=>r.kind==="actor");return t==null?null:t.target.kind==="anonymous"?jc:{alias:t.target.ref.ref,kind:"user"}}function oS(e,t,r){return t.reduce((n,o)=>({requiredState:iS(n.requiredState,o,r),withRequiredState:[...n.withRequiredState,{chunk:o,requiredState:hS(n.requiredState,o)}]}),{requiredState:e,withRequiredState:[]}).withRequiredState}function iS(e,t,r){let n=t.flatMap(o=>o.expect.filter(i=>i.kind==="state")).reduce((o,i)=>sS(o,i,r),e);return{...n,actor:en(n.actor,t),scalars:Je(n.scalars,t)}}function sS(e,t,r){return t.assertion.kind==="deleted"?aS(e,t,r):t.assertion.kind==="created"?uS(e,t.entity,t.assertion.as,t.assertion.props,r):pS(e,t,r)}function aS(e,t,r){let n=ho(t.key,t.entity,r.namespace),o=e.entities.find(a=>a.alias===n),i=tn(lS(t.key),r),s=o==null?{entity:t.entity,params:{},...i}:{entity:o.entity,params:{},...cS(o,i)};return{...e,absences:[...e.absences,s],entities:e.entities.filter(a=>a.alias!==n)}}function lS(e){return Object.fromEntries(Object.entries(e).flatMap(t=>{let r=t[1];return ve(r)||Fe(r)?[]:[[t[0],r]]}))}function cS(e,t){return{literals:{...e.literals,...t.literals},relations:[...e.relations.filter(r=>!t.relations.some(n=>n.field===r.field)),...t.relations]}}function uS(e,t,r,n,o){let i=tn(n,o);return{...e,absences:e.absences.filter(s=>s.entity!==t||!dS(i,s)),entities:[...e.entities,{alias:r,entity:t,...i}]}}function dS(e,t){return Object.entries(t.literals).every(([n,o])=>e.literals[n]===o)&&t.relations.every(n=>e.relations.some(o=>o.field===n.field&&o.targetAlias===n.targetAlias&&o.targetField===n.targetField))}function pS(e,t,r){if(t.assertion.kind!=="updated")return e;let n=ho(t.key,t.entity,r.namespace);if(n==null)return e;let o=tn(wt(t.assertion.props),r),i=Object.entries(t.assertion.props).filter(([,a])=>bt(a)).map(([a])=>a),s=a=>a.alias===n?fS(a,o,i):a;return{...e,entities:e.entities.map(a=>s(a))}}function fS(e,t,r){let n=Object.entries(e.literals).filter(([o])=>!r.includes(o)&&!(o in t.literals));return{...e,literals:{...Object.fromEntries(n),...t.literals},relations:[...e.relations.filter(o=>!t.relations.some(i=>i.field===o.field)),...t.relations]}}function hS(e,t){return t[0]?.action.kind!=="goto"?e:{...e,scalars:new Map([...e.scalars].filter(([,r])=>r.subject.kind==="variable"||r.subject.kind==="viewport"))}}function mo(e,t){let r=qu(t);return{namespace:r.namespace,requiredState:Ku(r,t.singletons,t.actor,t.viewport)}}function Gs(e,t){return[...new Set(e)].flatMap(r=>ir(r,t))}function qu(e){return{absences:e.absent,exclusives:e.exclusive,namespace:new Map(e.world.map(t=>[t.as,t.entity])),setups:e.world}}function mS(e){return e.absences.map(t=>({entity:t.entity,...tn(t.where,e),params:yS(t.where,e)}))}function tn(e,t){let r=Object.entries(e),n=Object.fromEntries(r.flatMap(([i,s])=>N(s)||qe(s)?[]:[[i,s]])),o=r.flatMap(i=>{let s=i[1];if(!N(s))return[];let a=ir(s.ref,t.namespace).at(0);return a==null?[]:[{entity:a.entity,field:i[0],targetAlias:a.aliasPath,targetField:a.field}]});return{literals:n,relations:o}}function yS(e,t){return Object.fromEntries(Object.entries(e).flatMap(r=>{let n=r[1];return!N(n)||ir(n.ref,t.namespace).at(0)!=null?[]:[[r[0],n.ref]]}))}function gS(e,t){return e.map(r=>({alias:r.as,entity:r.entity,...tn(r.set,t)}))}function SS(e){return gS(e.setups,e)}function ir(e,t){let r=Ot(e);if(r==null)return[];let n=t.get(r.alias);return n==null?[]:[{aliasPath:r.alias,entity:n,field:r.field,ref:e}]}function bS(e){let t=e.chunk.findIndex(s=>s.action.kind!=="goto"),r=t===-1?e.chunk:e.chunk.slice(0,t),n=e.chunk.slice(r.length),o=n.at(-1)??e.chunk.at(-1);if(o==null)throw new Error("empty transition chunk");let i=[...new Set(e.chunk.flatMap(s=>js(s)))];return{effectStep:o,identities:e.identities,index:e.index,intent:e.intent,namespace:e.namespace,nav:r,paramSpaces:Object.fromEntries(i.filter(s=>e.paramSpaceOf.has(s)).map(s=>[s,e.paramSpaceOf.get(s)])),requiredState:e.requiredState,steps:n,test:e.testRef,wait:zs(e.chunk.flatMap(s=>[...wS(s),...RS(s)])),whenSteps:e.whenChunk}}function wS(e){return e.expect.flatMap(t=>t.kind==="state"&&t.wait!=null?[t.wait]:[])}function RS(e){return po(e)?["slow"]:[]}function vS(e){return new Map(e.valueSpaces.map(t=>[t.name,t]))}function xS(e,t){return new Map(Object.entries(e.params).map(([r,n])=>[r,t.get(n.valueSpace)]))}function kS(e){return e.map(t=>[t])}function Hu(e,t){let r=st({conditions:e.when,...CS(e,t)});return e.expect.map(n=>({consequence:n,localConsequence:!1,origin:{kind:"declared",name:e.name},refs:new Set,when:r}))}var Ks="@actor";function CS(e,t){if(!e.when.some(i=>qs(i).some(s=>s.startsWith(`${Ks}.`))))return{};let n=t.entities.filter(i=>i.principal),o=n[0];if(o==null||n.length>1)throw new Error(`the declared fact "${e.name}" uses actor.id, which needs exactly one principal entity`);return{actor:{alias:Ks,kind:"user"},entities:[{alias:Ks,entity:o.name,literals:{},relations:[]}]}}function qs(e){return e.kind==="not"?qs(e.predicate):e.kind==="and"||e.kind==="or"?e.predicates.flatMap(t=>qs(t)):e.kind==="singleton"?K(e.assertion.value):Object.values(e.where).flatMap(t=>_t(t))}function Qe(e){return e.surfaces.filter(t=>t.by==="surface"&&t.overlay)}function yo(e,t){return{...e,scalars:go(e.scalars,t)}}function go(e,t){return Ju(e,t,r=>({expect:{expect:"is",value:!1},subject:{kind:"element",locator:r,state:"visible"}}))}function Zu(e,t){let r=Ju(e.scalars,t,n=>({declared:!1,expect:{expect:"is",value:!1},subject:{kind:"element",locator:ae(n,ge(new Map)),state:"visible"}}));return{...e,scalars:r}}function Ju(e,t,r){let n=t.filter(o=>!e.has(Yu(o))).map(o=>[Yu(o),r(o)]);return n.length===0?e:new Map([...e,...n])}function Yu(e){return R({kind:"element",locator:e,state:"visible"})}var Xu=new WeakMap;function ut(e){let t=Xu.get(e);if(t!=null)return t;let r=ES("sha256").update(b({consequence:e.consequence,when:xe(e.when)})).digest("base64");return Xu.set(e,r),r}function bo(e){let t=e.facts.flatMap(i=>Hu(i,e)),r=new Set(Qe(e).map(i=>b(ce(i)))),n=J(e).map(i=>Ys(e,i)),o=Ae(n.flatMap(i=>i.steps.flatMap(s=>s.facts)),ut).filter(i=>!PS(i.consequence,r));return Promise.resolve([...t,...o])}function Hs(e,t){return e.filter(r=>!IS(r)||TS(r)===t)}function wo(e){return e.kind==="not"?wo(e.predicate):e.kind==="visible"||e.kind==="disabled"||e.kind==="enabled"||e.kind==="focused"||e.kind==="checked"||e.kind==="expanded"||e.kind==="pressed"||e.kind==="value"||e.kind==="text"}function PS(e,t){if(e.kind!=="visible")return!1;let r=ce(e.locator);return t.has(b(r))?!0:r.by==="inside"&&t.has(b(ce(r.scope)))}function Ro(e,t){if(e.facts.length===0)return t;let r=rn(e,t);return r.size===0?t:{...t,scalars:Se(r,t.scalars)}}function rn(e,t){let r=Zu(t,e.overlays),n=e.facts.flatMap(s=>{let a=Pe(s.when,r);if(a==null)return[];let l=AS(s.consequence,a,r);return l==null?[]:[{entry:l,factKey:ut(s),key:R(l.subject)}]}),o=n.filter(s=>!OS({m:s,matched:n,overrides:e.overrides})),i=MS(o);return o.reduce((s,a)=>i.has(a.key)?s:lt(s,a.entry),_e)}function AS(e,t,r){let n=ue(e);if(n==null)return null;try{return Ye({declared:!0,entry:n,scope:{counts:pe(r),env:t}})}catch{return null}}function MS(e){let t=e.reduce((r,n)=>new Map([...r,[n.key,[...r.get(n.key)??[],b(n.entry.expect)]]]),new Map);return new Set([...t].flatMap(([r,n])=>new Set(n).size>1?[r]:[]))}function OS({m:e,matched:t,overrides:r}){let n=r.get(e.factKey);return n==null?!1:t.some(o=>o.key===e.key&&n.has(o.factKey))}function IS(e){return e.origin?.kind==="test"&&e.localConsequence}function TS(e){let{origin:t}=e;if(!(t==null||t.kind!=="test"))return t.test}var Qu=new WeakMap;function Ys(e,t){let r=Qu.get(t);if(r!=null)return r;let n=LS(e,t);return Qu.set(t,n),n}function LS(e,{test:t,workflow:r}){let n=mo(e,t),o=Qe(e),i=NS(r.steps),s=t.steps.reduce((a,l)=>{let c=$S(a.requiredState,l,n,o),u=GS({branchConditions:i,namespace:n.namespace,origin:{kind:"test",test:ee(t)},paramNames:new Set(Object.keys(t.params)),post:c,pre:a.requiredState,step:l});return{requiredState:c,steps:[...a.steps,{facts:u,post:c}]}},{requiredState:yo(n.requiredState,o),steps:[]});return{initial:yo(n.requiredState,o),steps:s.steps}}function NS(e){return e.flatMap(r=>r.expect).flatMap(r=>So(r)).reduce((r,n)=>{let o=b(n.consequence),i=r.get(o),s=i==null?n.condition:{kind:"or",predicates:[i,n.condition]};return new Map([...r,[o,s]])},new Map)}function So(e){return e.kind==="not"?So(e.predicate):e.kind==="and"||e.kind==="or"?e.predicates.flatMap(t=>So(t)):e.kind!=="when"?[]:e.branches.flatMap((t,r)=>{let n=FS(e.branches,r);return t.consequence.flatMap(o=>[{condition:n,consequence:o},...So(o)])})}function FS(e,t){let r=e.slice(0,t).flatMap(i=>i.condition==null?[]:[i.condition]).map(i=>({kind:"not",predicate:i})),n=e[t]?.condition,o=n==null?r:[...r,n];return o.length===1&&o[0]!=null?o[0]:{kind:"and",predicates:o}}function $S(e,t,r,n){let{entities:o}=DS(e,t,r),i=Je(e.scalars,[t]),s=en(e.actor,[t]);return yo({...e,actor:s,entities:o,scalars:i},n)}function DS(e,t,r){return t.expect.reduce((n,o)=>o.kind==="state"?_S(n,o,r):n,e)}function _S(e,t,r){if(t.assertion.kind==="created"){let i=BS(t.assertion.as,t.entity,t.assertion.props,r);return{...e,entities:[...e.entities,i]}}let n=ho(t.key,t.entity,r.namespace);if(n==null)return e;if(t.assertion.kind==="deleted")return WS(e,n);let o=wt(t.assertion.props);return{...e,entities:e.entities.map(i=>i.alias===n?rd(i,o,r):i)}}function BS(e,t,r,n){return rd({alias:e,entity:t,literals:{},relations:[]},r,n)}function rd(e,t,r){return Object.entries(t).reduce((n,[o,i])=>{if(qe(i))return n;if(N(i)){let s=jS(i.ref,o,r.namespace);return{...n,literals:VS(n.literals,o),relations:s==null?n.relations:[...ed(n.relations,o),s]}}return{...n,literals:{...n.literals,[o]:i},relations:ed(n.relations,o)}},e)}function jS(e,t,r){let[n]=ir(e,r);return n==null?void 0:{entity:n.entity,field:t,targetAlias:n.aliasPath,targetField:n.field}}function VS(e,t){return Object.fromEntries(Object.entries(e).filter(([r])=>r!==t))}function ed(e,t){return e.filter(r=>r.field!==t)}function WS(e,t){let r=e.entities.find(o=>o.alias===t),n=US(e,t);return r==null?n:{...n,absences:[...n.absences,{entity:r.entity,literals:r.literals,params:{},relations:r.relations}]}}function US(e,t){return{...e,entities:e.entities.filter(r=>r.alias!==t)}}var zS=16;function GS(e){return or(e.step.expect).filter(t=>wo(t)).flatMap(t=>KS(t,e))}function KS(e,t){let r=ue(e);if(r==null)return[];if(ct(e).some(a=>t.paramNames.has(a)))return[];let n=R(r.subject),o=t.branchConditions.get(b(e)),i={...t.post,conditions:o==null?t.post.conditions:[...t.post.conditions,o],scalars:new Map([...t.post.scalars].filter(([a])=>a!==n))},s=qS(i,t.pre,t.paramNames);return s==null||s.entities.length>zS?[]:xe(s)===xe(t.pre)?[]:[{consequence:e,localConsequence:Gs(ct(e),t.namespace).length>0,origin:t.origin,refs:new Set(Gs([...YS(s),...ct(e)],t.namespace).map(a=>a.aliasPath)),when:s}]}function qS(e,t,r){let n=[...e.scalars.values()].map(o=>HS(o,t,r));return n.some(o=>o==null)?null:{...e,scalars:new Map(n.flatMap(o=>o==null?[]:[[R(o.subject),o]]))}}function HS(e,t,r){if(!td(e,r))return e;if(e.subject.kind!=="element"||e.expect.expect==="absent"||ye(e.subject.locator).some(o=>r.has(o)))return null;let n=t.scalars.get(R(e.subject));return n==null||n.expect.expect!=="is"||td(n,r)?null:{expect:{expect:"not",value:n.expect.value},subject:e.subject}}function td(e,t){let r=e.expect.expect==="absent"?[]:K(e.expect.value);return[...e.subject.kind==="element"?ye(e.subject.locator):[],...r].some(o=>t.has(o))}function YS(e){return[...e.scalars.values()].flatMap(t=>St(t.subject)&&t.expect.expect!=="absent"?K(t.expect.value):[])}function nd(e,t,r){let n=o=>e(o,...t);return r===void 0?n:Object.assign(n,{lazy:r,lazyArgs:t})}function od(e,t,r){let n=e.length-t.length;if(n===0)return e(...t);if(n===1)return nd(e,t,r);throw Error("Wrong number of arguments")}function nn(...e){return od(ZS,e)}var ZS=(e,t)=>{let r=Object.create(null);for(let n=0;n<e.length;n++){let o=e[n],i=t(o,n,e);if(i!==void 0){let s=r[i];s===void 0?r[i]=[o]:s.push(o)}}return Object.setPrototypeOf(r,Object.prototype),r};function sd(e){return`\xA4param:${e}`}function ad(e,t){return`\xA4${e}.${t}`}var ld=new WeakMap;function Zs(e){let t=ld.get(e);if(t!==void 0)return t;let r=JS(e);return ld.set(e,r),r}function JS(e){let t=sb(e);return t==null?null:{absenceKeys:new Set(e.absences.map(r=>b(r))),conditionKeys:new Set(e.conditions.map(r=>b(r))),pinned:tb(e),snapshot:t,specific:e}}var cd=new WeakMap,ud=new WeakMap;function Js(e,t){if(t==null)return null;let r=ud.get(e)??new Map;ud.set(e,r);let n=xe(t.specific),o=r.get(n);if(o!==void 0)return o;let i=XS(e,t);return r.set(n,i),i}function vo(e,t){return Js(e,Zs(t))}function XS(e,t){let{absenceKeys:r,conditionKeys:n,pinned:o,snapshot:i,specific:s}=t,a=QS(e);if(!a.conditionKeys.every(p=>n.has(p))||!a.scalarEntries.every(([p])=>s.scalars.has(p)))return!1;let l=a.absenceEntries.filter(p=>!r.has(p.key)).map(p=>p.absence);if(l.some(p=>!s.exclusives.includes(p.entity))||!e.exclusives.every(p=>s.exclusives.includes(p)))return!1;let c=a.scalarEntries.map(([p,y])=>eb({entry:y,generalEntityOf:a.entityOf,host:s.scalars.get(p),key:p,pinned:o}));if(c.includes("false"))return!1;if(c.includes("defer"))return null;let u=new Map(c.flatMap(p=>typeof p=="string"?[]:[p])),d=st({absences:l,actor:e.actor,entities:e.entities,exclusives:e.exclusives,scalars:u});return Pe(d,i)!=null}function QS(e){let t=cd.get(e);if(t!=null)return t;let r={absenceEntries:e.absences.map(n=>({absence:n,key:b(n)})),conditionKeys:e.conditions.map(n=>b(n)),entityOf:new Map(e.entities.map(n=>[n.alias,n.entity])),scalarEntries:[...e.scalars]};return cd.set(e,r),r}function eb({entry:e,generalEntityOf:t,host:r,key:n,pinned:o}){if(r==null)return"false";let i=b(r.expect)===b(e.expect);return i&&nb(e.expect)?"skip":r.expect.expect!=="is"?rb({entry:e,host:r,identical:i}):e.expect.expect==="absent"?"false":ob({entry:e,generalEntityOf:t,key:n,pinned:o,want:e.expect,wantOfHost:r.expect})}function tb(e){let t=new Map(e.entities.map(i=>[i.alias,i.entity])),n=[...[...e.scalars.values()].flatMap(i=>[...i.expect.expect==="absent"?[]:K(i.expect.value),...i.subject.kind==="element"?ye(i.subject.locator):[]]).filter(i=>i.includes(".")),...e.entities.flatMap(i=>[...Object.keys(i.literals).map(s=>`${i.alias}.${s}`),...i.relations.flatMap(s=>[`${i.alias}.${s.field}`,`${s.targetAlias}.${s.targetField}`])])],o=n.flatMap(i=>{let s=i.indexOf("."),a=t.get(i.slice(0,s));return a==null?[]:[`${a}.${i.slice(s+1)}`]});return{byAlias:new Set(n),byEntity:new Set(o)}}function rb({entry:e,host:t,identical:r}){return r||t.expect.expect==="absent"&&e.expect.expect==="not"?"defer":"false"}function nb(e){return e.expect==="absent"?!0:K(e.value).every(t=>!t.includes("."))}function ob({entry:e,generalEntityOf:t,key:r,pinned:n,want:o,wantOfHost:i}){if(dd(o.value)||dd(i.value))return"defer";if(o.expect==="not")return K(o.value).length===0&&K(i.value).length===0?[r,e]:"defer";let s=new Set(K(o.value).filter(a=>a.includes(".")).map(a=>ib({generalEntityOf:t,pinned:n,ref:a})));return s.has("false")?"false":s.has("defer")?"defer":[r,{expect:hd(o),subject:yd(e.subject)}]}function ib({generalEntityOf:e,pinned:t,ref:r}){if(t.byAlias.has(r))return"ok";let n=r.indexOf("."),o=e.get(r.slice(0,n));return o==null||t.byEntity.has(`${o}.${r.slice(n+1)}`)?"defer":"false"}function dd(e){return e!==null&&typeof e=="object"&&"template"in e&&e.template.some(t=>typeof t!="string"&&"count"in t)}var pd=new WeakMap;function sb(e){let t=pd.get(e);if(t!==void 0)return t;let r=ab(e);return pd.set(e,r),r}function ab(e){let t=lb(e),r=Pe(st({absences:e.absences,conditions:e.conditions,entities:e.entities,exclusives:e.exclusives}),t);if(r==null)return null;let n=ub(e,r,t);return n==null?null:{...t,scalars:cb(n,e)}}function lb(e){let t=new Map(e.entities.map(s=>[s.alias,s])),r=[...e.scalars.values()].flatMap(s=>[...s.expect.expect==="absent"?[]:K(s.expect.value),...s.subject.kind==="element"?ye(s.subject.locator):[]]),n=[...e.entities.flatMap(s=>s.relations.map(a=>[a.targetAlias,a.targetField])),...r.flatMap(s=>{let a=s.indexOf(".");return a===-1?[]:[[s.slice(0,a),s.slice(a+1)]]})];return{entities:e.entities.map(s=>[s.entity,s.alias,{...Object.fromEntries(n.filter(([a])=>a===s.alias).map(([a,l])=>[l,fd(t,a,l)])),...s.literals,...Object.fromEntries(s.relations.map(a=>[a.field,fd(t,a.targetAlias,a.targetField)]))}]).reduce((s,[a,l,c])=>{let u=new Map([...s.get(a)??[],[l,c]]);return new Map([...s,[a,u]])},new Map),scalars:_e}}function fd(e,t,r){let o=e.get(t)?.literals[r];return o!==void 0?o:ad(t,r)}function cb(e,t){return t.actor.kind!=="user"?e:new Map([...e,[R({kind:"actor"}),{declared:!1,expect:{expect:"is",value:t.actor.alias},subject:{kind:"actor"}}]])}function ub(e,t,r){let n=[...e.scalars.values()].filter(o=>o.expect.expect==="is").map(o=>{try{return Ye({declared:!0,entry:{expect:hd(o.expect),subject:yd(o.subject)},scope:{counts:pe(r),env:t}})}catch{return null}});return n.some(o=>o==null)?null:new Map(n.flatMap(o=>o==null?[]:[[R(o.subject),o]]))}function hd(e){return e.expect==="absent"?e:{...e,value:db(e.value)}}function db(e){return Uc(e,md)}function md(e){return Au(e.ref)?sd(e.ref):e}function yd(e){return e.kind!=="element"?e:{...e,locator:pb(e.locator)}}function pb(e){return Vc(e,fb)}function fb(e){return zc(e,md)}var gd=new Map;async function xo({context:e,facts:t}){let r=nn(t.filter(i=>ue(i.consequence)!=null),i=>hb(i)),o=Object.values(r).flatMap(i=>i.flatMap(s=>i.filter(a=>a!==s).map(a=>({general:s,specific:a}))));return o.filter(({general:i,specific:s})=>vo(i.when,s.when)!==!1).forEach(({general:i,specific:s})=>{at({context:e,general:i.when,specific:s.when}).catch(()=>{})}),o.reduce(async(i,{general:s,specific:a})=>{let l=await i;if(!(vo(s.when,a.when)!==!1&&await at({context:e,general:s.when,specific:a.when}))||vo(a.when,s.when)!==!1&&await at({context:e,general:a.when,specific:s.when}))return l;let d=ut(s),p=l.get(d)??new Set;return new Map([...l,[d,new Set([...p,ut(a)])]])},Promise.resolve(gd))}function Sd(e){let t=ue(e.consequence);if(t==null)return null;try{let r=Ye({declared:!0,entry:t,scope:ge(new Map)});return R(r.subject)}catch{return null}}function hb(e){let t=ue(e.consequence);if(t==null)throw new Error("fact consequence has no pattern entry");return R(t.subject)}function ko(e){return Ae(J(e).flatMap(t=>mb(e,t.test)),sr)}function sr(e){return b({holds:xe(e.holds),reference:e.reference,when:xe(e.when)})}function Co(e,t){return Pe(e.when,t)==null?!1:Pe(e.holds,t)==null}function mb(e,t){let r=mo(e,t);return r.requiredState.entities.flatMap(n=>n.relations.flatMap(o=>yb(e,n,o,r.namespace)?bb(n,o,r.namespace):[]))}function yb(e,t,r,n){let o=n.get(r.targetAlias);return o!=null&&!gb(e,t.entity,r.field)&&Sb(e,o,r.targetField)}function gb(e,t,r){return e.entities.find(n=>n.name===t)?.props[r]?.optional===!0}function Sb(e,t,r){return e.entities.find(n=>n.name===t)?.identity.includes(r)===!0}function bb(e,t,r){let n=r.get(t.targetAlias);if(n==null)return[];let o=bd(e.alias,e.entity),i=bd(t.targetAlias,n);return[{holds:st({entities:[{...o,relations:[t]},i]}),reference:{field:t.field,source:e.entity,target:n,targetField:t.targetField},when:st({entities:[o]})}]}function bd(e,t){return{alias:e,entity:t,literals:{},relations:[]}}function wd(e){let t;return r=>{if(t!==void 0&&t.input===r)return t.output;let n=e(r);return t={input:r,output:n},n}}var Eo=wd(async e=>{let t=Qt(e),r=await bo(e);return{dataRules:ko(e),facts:r,overrides:await xo({context:t,facts:r})}});async function Rd(e,t){let{context:r,pool:n,timelines:o}=Rb(e,t),i=wb(r),s=n.map(l=>Gu(l.fact.when)),a=await Promise.all([...o.values()].map(l=>{let c=l.locked.test.viewport,u=n.filter((d,p)=>s[p]==null||s[p]===c);return vb({entry:l,pool:u,resolve:i})}));return{pool:n,reports:a}}function vd(e,t){return{...xd(e.consequence),declared:e.origin?.kind==="test",key:ut(e),label:Hn(e.consequence),labelTokens:qc(e.consequence),origins:t}}function wb(e){return(t,r)=>at({context:e,general:t,specific:r})}function Rb(e,t){let r=J(e),n=new Map(r.map(s=>[s.ref,{locked:s,timeline:Ys(e,s)}])),o=Eb(n),i=Pb({facts:t,originSites:o});return{context:Qt(e),pool:i,timelines:n}}async function vb(e){let{entry:t,pool:r,resolve:n}=e,{locked:o}=t,i=new Set(t.timeline.steps.flatMap(c=>c.facts.map(u=>b(u.consequence)))),s=r.filter(c=>!c.originWorkflows.has(o.test.workflow)).filter(c=>!i.has(c.consequenceKey)),a=await kb({candidates:s,resolve:n,timeline:t.timeline});return{steps:t.timeline.steps.map((c,u)=>({borrowed:a.filter(d=>d.stepIndex===u).map(d=>d.borrowed),stepIndex:u})),testRef:o.ref,testSlug:o.test.slug,workflowSlug:o.test.workflow}}function xb(e,t){return e.map(r=>({candidate:r,holds:Js(r.fact.when,t)}))}async function kb({candidates:e,resolve:t,timeline:r}){let o=await[r.initial,...r.steps.map(i=>i.post)].reduce(async(i,s,a)=>{let l=await i,c=e.filter(f=>!l.has(f)),u=xb(c,Zs(s)),d=await Promise.all(u.filter(f=>f.holds==null).map(async f=>({candidate:f.candidate,holds:await t(f.candidate.fact.when,s)}))),p=new Set(d.filter(f=>f.holds).map(f=>f.candidate)),y=u.filter(f=>f.holds===!0||p.has(f.candidate)).map(f=>f.candidate),h=a===0?0:a-1;return new Map([...l,...y.map(f=>[f,h])])},Promise.resolve(new Map));return r.steps.length===0?[]:[...o].map(([i,s])=>({borrowed:i.borrowed,stepIndex:s}))}function Cb(e,t){return{stepIndex:t,testRef:e.ref,testSlug:e.test.slug,workflowIntent:e.workflow.intent,workflowSlug:e.test.workflow}}function Eb(e){let t=[...e.values()].flatMap(r=>r.timeline.steps.flatMap((n,o)=>n.facts.map(i=>[ut(i),Cb(r.locked,o)])));return new Map(Object.entries(nn(t,([r])=>r)).map(([r,n])=>[r,n.map(([,o])=>o)]))}function Pb({facts:e,originSites:t}){return e.filter(r=>!(r.origin?.kind==="test"&&r.localConsequence)).map(r=>{let n=ut(r),i=r.origin?.kind==="test"?t.get(n)??[]:[];return{borrowed:vd(r,i),consequenceKey:b(r.consequence),fact:r,originWorkflows:new Set(i.map(s=>s.workflowSlug))}}).filter(r=>r.borrowed.origins.length>0)}function xd(e){if(e.kind==="not"){let t=xd(e.predicate);return{...t,negated:!t.negated}}return"locator"in e?{checkKind:e.kind,negated:!1,subject:Gn(ae(e.locator,ge(new Map)))}:{checkKind:void 0,negated:!1,subject:void 0}}function kd(e){let t=Ae(e,xe),r=Ae(t.flatMap(c=>[...c.scalars.values()]),b),n=Ae(t.flatMap(c=>c.entities),b),o=Ae(t.flatMap(c=>c.absences),b),i=Po(r,b),s=Po(n,b),a=Po(o,b),l=Po(t,xe);return{absenceTable:o.map(c=>({...c,relations:[...c.relations]})),constraintTable:n.map(c=>({...c,relations:[...c.relations]})),patternTable:t.map(c=>({absences:c.absences.map(u=>Ao(a,b(u))),actor:c.actor,conditions:[...c.conditions],entities:c.entities.map(u=>Ao(s,b(u))),exclusives:[...c.exclusives],scalars:[...c.scalars.values()].map(u=>Ao(i,b(u)))})),scalarTable:r.map(c=>({expect:c.expect,subject:c.subject})),indexOf:c=>Ao(l,xe(c))}}function Cd(e){return e.patternTable.map(t=>({absences:t.absences.map(r=>jt(e.absenceTable,r)),actor:t.actor,conditions:t.conditions,entities:t.entities.map(r=>jt(e.constraintTable,r)),exclusives:t.exclusives,scalars:new Map(t.scalars.map(r=>{let n=jt(e.scalarTable,r);return[R(n.subject),n]}))}))}function jt(e,t){let r=e[t];if(r==null)throw new Error("compiled checks table index out of range \u2014 recompile");return r}function Po(e,t){return new Map(e.map((r,n)=>[t(r),n]))}function Ao(e,t){let r=e.get(t);if(r==null)throw new Error("compiled checks pattern missing from table");return r}async function Pd(e){let t=await Eo(e),{pool:r,reports:n}=await Rd(e,t.facts),o=kd([...t.facts.flatMap(a=>Ib(a)),...t.dataRules.flatMap(a=>[a.when,a.holds])]),i=new Map(t.facts.map((a,l)=>[a,l])),s=new Map(r.map((a,l)=>[a.borrowed,l]));return{absenceTable:o.absenceTable,constraintTable:o.constraintTable,dataRules:t.dataRules.map(a=>({holds:o.indexOf(a.holds),reference:a.reference,when:o.indexOf(a.when)})),factPool:r.map(a=>({fact:Ad(i,a.fact),origins:a.borrowed.origins.map(l=>({...l}))})),factReports:n.map(a=>Nb(a,s)),facts:t.facts.map(a=>Tb(a,o)),overrides:Lb(t.overrides),patternTable:o.patternTable,scalarTable:o.scalarTable}}var Ed=new WeakMap;function ar(e){let t=Ed.get(e);if(t!=null)return t;let r=Ab(e),n=Cd(r),o={dataRules:r.dataRules.map(i=>({holds:jt(n,i.holds),reference:i.reference,when:jt(n,i.when)})),facts:r.facts.map(i=>Mb(i,n)),overrides:Ob(r.overrides)};return Ed.set(e,o),o}function Ab(e){return e.checks}function Ad(e,t){let r=e.get(t);if(r==null)throw new Error("compiled checks item missing from index");return r}function Mb(e,t){return{consequence:e.consequence,localConsequence:e.localConsequence,origin:e.origin,refs:new Set(e.refs),when:jt(t,e.when)}}function Ob(e){return new Map(Object.entries(e).map(([t,r])=>[t,new Set(r)]))}function Ib(e){return[e.when]}function Tb(e,t){return{consequence:e.consequence,localConsequence:e.localConsequence,origin:e.origin,refs:[...e.refs],when:t.indexOf(e.when)}}function Lb(e){return Object.fromEntries([...e].map(([t,r])=>[t,[...r].toSorted((n,o)=>n.localeCompare(o))]).toSorted(([t],[r])=>t.localeCompare(r)))}function Nb(e,t){return{steps:e.steps.map(r=>({borrowed:r.borrowed.map(n=>Ad(t,n)),stepIndex:r.stepIndex})),testRef:e.testRef,testSlug:e.testSlug,workflowSlug:e.workflowSlug}}function Od(e){let t=new Map;return e.forEach(r=>{Fb(r).forEach(n=>{on(n,t)})}),t}function Qs(e,t){let r=$b(e.consequence,t);if(r.length===0)return e.when;let n=new Map(e.when.scalars);return r.forEach(o=>n.set(R(o.subject),o)),{...e.when,scalars:n}}function Fb(e){let t=[...e.when.scalars.values()].flatMap(n=>n.subject.kind==="element"?[n.subject.locator]:[]),r=Id(e.consequence);return r==null?t:[...t,r]}function Id(e){return e.kind==="not"?Id(e.predicate):"locator"in e?e.locator:void 0}function on(e,t){if(e.by==="inside"){let r=Td(Xs(e.scope));t.set(r,[...t.get(r)??[],e]),on(e.scope,t),on(e.target,t);return}if(e.by==="surface"){on(e.container,t);return}e.by==="frame"&&on(e.element,t)}function Td(e){return Jt(e,"visible")}function Xs(e){return e.by==="frame"?e.element:e}function $b(e,t){let r=Db(e);if(r!=null)return(t.get(Td(Xs(r)))??[]).map(o=>Md(o,!1));let n=_b(e);return n==null?[]:[Md(Xs(n),!0)]}function Db(e){return e.kind!=="not"||e.predicate.kind!=="visible"?null:e.predicate.locator}function Md(e,t){return{expect:{expect:"is",value:t},subject:{kind:"element",locator:e,state:"visible"}}}function _b(e){return e.kind!=="visible"||e.locator.by!=="inside"?null:e.locator.scope}function sn(e){return e.origin==null||e.origin.kind==="declared"?[]:[{test:e.origin.test,when:e.when}]}async function Fd({context:e,facts:t}){let n=[...t.reduce((s,a)=>{let l=ue(a.consequence);if(l==null)return s;let c=R(l.subject);return new Map([...s,[c,[...s.get(c)??[],a]]])},new Map).values()].flatMap(s=>s.flatMap((a,l)=>s.slice(l+1).filter(c=>$d(a.consequence,c.consequence)).map(c=>[a,c]))),o=Od(t),i=await Promise.all(n.map(async([s,a])=>{let l=await at({context:e,general:s.when,specific:a.when}),c=await at({context:e,general:a.when,specific:s.when});return l!==c?null:l||await Xc({aligned:!0,context:e,patterns:[Qs(s,o),Qs(a,o)]})?Vb(s,a):null}));return Wb(i.filter(s=>s!=null))}function $d(e,t){let r=ue(e),n=ue(t);return r==null||n==null||R(r.subject)!==R(n.subject)?!1:Bb(r,n)}function Bb(e,t){return jb(e)?Nd(e,t):e.expect.expect==="is"&&t.expect.expect==="is"?b(e.expect.value)!==b(t.expect.value):Nd(e,t)}function jb(e){return e.subject.kind==="element"&&e.subject.state==="text"}function Vb(e,t){let r=sn(e),n=sn(t);return{a:e.consequence,aProducers:r,b:t.consequence,bProducers:n,tests:[...new Set([...Ld(e),...Ld(t)])],when:e.when}}function Ld(e){return e.origin==null?[]:e.origin.kind==="declared"?[]:[e.origin.test]}function Wb(e){return[...e.reduce((r,n)=>{let o=[b(n.a),b(n.b)].toSorted((a,l)=>a.localeCompare(l)).join("|"),i=r.get(o),s=i==null?n:{...i,tests:[...new Set([...i.tests,...n.tests])]};return new Map([...r,[o,s]])},new Map).values()]}function Nd(e,t){let r=[e.expect,t.expect],n=r.find(i=>i.expect==="is"),o=r.find(i=>i.expect==="not");return n==null||o==null?!1:b(n.value)===b(o.value)}function Dd(e,t){return e.flatMap(r=>{let n=Ub(r),o=new Set(r.requiredState.absences.map(i=>i.entity));return t.flatMap(i=>zb(r,i,n,o))})}function Ub(e){return new Set(e.steps.flatMap(t=>t.expect.flatMap(r=>r.kind==="state"&&r.assertion.kind==="deleted"?[r.entity]:[])))}function zb(e,t,r,n){let{source:o,target:i}=t.reference;return!r.has(i)||r.has(o)||n.has(o)?[]:[{dataRule:t,source:o,target:i,transition:Xe(e)}]}var M=Oc(jd(),1),Ie={actual:e=>M.default.red(e),bad:e=>M.default.red(M.default.bold(e)),bold:e=>M.default.bold(e),dim:e=>M.default.dim(e),expected:e=>M.default.green(e),good:e=>M.default.green(M.default.bold(e)),heading:e=>M.default.bold(M.default.cyan(e)),path:e=>M.default.cyan(M.default.underline(e)),warn:e=>M.default.yellow(M.default.bold(e))},Hb={action:M.default.yellow,assertion:M.default.yellow,consistency:M.default.magenta,"data rule":M.default.yellow,driver:M.default.red,fact:M.default.yellow,"impossible action":M.default.cyan,"model drift":M.default.red,precondition:M.default.yellow,reachability:M.default.yellow,redundancy:M.default.yellow,skipped:M.default.red,state:M.default.magenta,surface:M.default.yellow};function oe(e){return`${M.default.red(M.default.bold("\u2717"))} ${Hb[e](M.default.bold(e))}`}var Yb=M.default.red("\u2717"),yN=M.default.green("\u2713"),Zb=M.default.dim("\u203A"),Jb=8;function Vd(e,t,r){let n=r==null?"":` ${Ie.dim(r)}`;return` ${Ie.dim(e.padStart(Jb))} ${t}${n}`}function Wd(e){let t=[...e.scalars.values()].find(r=>r.subject.kind==="path"&&r.expect.expect==="is")?.expect;return t==null||t.expect==="absent"?"(any view)":Xb(t.value)}function Xb(e){return typeof e!="object"||e==null?String(e):"template"in e?e.template.map(t=>typeof t=="string"?t:"ref"in t?`{${t.ref}}`:`{count:${t.count.entity}}`).join(""):`{${e.ref}}`}function To(e){let t=[...e.entities.map(r=>Io(r)),...e.absences.map(r=>`no ${Io(r)}`),...[...e.scalars.values()].filter(r=>r.subject.kind!=="path").filter(r=>!zd(r)).map(r=>Lo(r))];return t.length===0?"always":t.join(" \u2227 ")}function Lo(e){let t=Qb(e.subject);return e.expect.expect==="absent"?`${t} absent`:e.subject.kind==="element"&&ew(e.expect.value)?e.expect.value?t:`not ${t}`:`${t} ${e.expect.expect==="not"?"\u2260":"="} ${et(e.expect.value)}`}function ie(e){return e.by==="role"?e.name==null?e.role:`${e.role} ${et(e.name)}`:e.by==="inside"?`${ie(e.scope)} \u25B8 ${ie(e.target)}`:e.by==="surface"?ie(e.container):e.by==="frame"?`frame ${ie(e.element)}`:et(e.value)}function et(e){return e===null?"\u2205":typeof e=="string"?`"${e}"`:typeof e!="object"?String(e):"ref"in e?`{${e.ref}}`:ta(e)}function ta(e){return e.template.map(t=>typeof t=="string"?t:":id").join("")}function Ud(e,t){let r=new Set(t.entities.map(i=>Io(i))),n=new Set(t.scalars.keys()),o=[...e.entities.map(i=>Io(i)).filter(i=>!r.has(i)),...[...e.scalars].filter(([i])=>!n.has(i)).map(([,i])=>i).filter(i=>i.subject.kind!=="path"&&!zd(i)).map(i=>Lo(i))];return o.length===0?"nothing beyond the shared state":o.join(" \u2227 ")}function zd(e){return e.subject.kind==="element"&&e.subject.locator.by==="surface"&&e.subject.locator.overlay&&e.subject.state==="visible"&&e.expect.expect==="is"&&e.expect.value===!1}function Qb(e){return e.kind==="variable"?e.name:e.kind==="element"?`${e.state} ${ie(e.locator)}`:e.kind==="query"?`url query "${e.key}"`:e.kind==="title"||e.kind==="viewport"?e.kind:`url ${e.kind}`}function ew(e){return typeof e=="boolean"}function Io(e){let t=Object.entries(e.literals).map(([r,n])=>`${r}=${et(n)}`);return t.length===0?e.entity:`${e.entity}(${t.join(", ")})`}function fe(e){return e.by==="testId"?`testId=${e.value}`:e.by==="inside"?`${fe(e.scope)} \u25B8 ${fe(e.target)}`:e.by==="surface"?fe(e.container):e.by==="frame"?`frame ${fe(e.element)}`:e.name==null?e.role:`${e.role} "${e.name}"`}function an(e){return e.kind==="variable"?`global variable "${e.name}"`:e.kind==="element"?`${e.state} ${fe(e.locator)}`:e.kind==="query"?`url query "${e.key}"`:e.kind==="title"||e.kind==="viewport"?e.kind:e.kind==="actor"?"signed-in actor":`url ${e.kind}`}function No(e){return e.url!=null?`${e.kind} ${e.url}`:e.locator!=null?`${e.kind} ${fe(e.locator)}`:e.kind}function lr(e){let{field:t,source:r,target:n,targetField:o}=e.reference;return`${r}.${t} \u2192 ${n}.${o}`}function Te(e){return e==null?"\u2205":JSON.stringify(e)}function Fo(e){if(e.kind==="entities")return tw(e);if(e.kind==="condition")return"a required condition did not hold";let t=e.want==null?"absent":et(e.want),r=e.got===void 0?"absent":et(e.got);return`${rw(e.subject)} needed ${t} but was ${r}`}function tw(e){if(e.entity==null)return"the required rows exist individually but could not be matched together";if(e.mustBeAbsent)return`a ${e.entity} row that must be absent was present`;let t=e.alias==null?"":` "${e.alias}"`;return`a required ${e.entity} row${t} was not present`}function rw(e){return e.kind==="element"?`${e.state} ${ie(e.locator)}`:e.kind==="variable"?`"${e.name}"`:e.kind==="query"?`url query "${e.key}"`:e.kind==="actor"?"signed-in actor":`url ${e.kind}`}var nw={"no-effect":"the action has no observable effect from this state","required-state-unsatisfied":"the live state doesn't satisfy the step's required state",unresolvable:"a step references a value that doesn't exist yet (e.g. a not-yet-created id)"};function ra(e){return nw[e]}function Gd({debugDir:e,runId:t}){let r=`${e}/${t}`;return Vd("behavior",Ie.path(`${r}/behavior.jsonl`),void 0)}function ln(e){return e.kind==="drag"?`drag ${ie(e.source)} to ${ie(e.target)}`:"locator"in e&&e.locator!=null?`${e.kind} ${ie(e.locator)}`:"url"in e?`${e.kind} ${ow(e.url)}`:e.kind}function ow(e){return typeof e=="string"?e:"ref"in e?`{${e.ref}}`:ta(e)}function dt(e){return e.kind==="not"?`not ${dt(e.predicate)}`:e.kind==="and"?e.predicates.map(t=>dt(t)).join(" \u2227 "):e.kind==="when"?e.branches.map(t=>t.name).join(" | "):iw(e)}function iw(e){return"locator"in e?sw(e):e.kind==="browser"?`${e.name}=${et(e.value)}`:e.kind==="singleton"?`${e.singleton}=${et(e.assertion.value)}`:e.kind==="count"?Hn(e):e.kind==="actor"?e.target.kind==="anonymous"?"actor is signed out":`actor is ${e.target.ref.ref}`:""}function sw(e){let t=ie(e.locator);if(e.kind==="value"||e.kind==="text"){let r=ot(e.value)?e.value.value:e.value;return`${e.kind} ${t}=${et(r)}`}return`${e.kind} ${t}`}function Kd({contradiction:e,evidencePath:t}){let r=aw(e);return t==null?r:`${r} Evidence: ${Ie.path(t)}`}function $o(e){return`${cw(e)}.`}function Do(e){return Rw(uw(e))}function aw(e){switch(e.kind){case"check":{let t=` After "${e.step.intent}".`;return`${lw(e.record.body)} ${$o(e.record.body)}${t}`}case"stepError":return`${oe("driver")} Browser failed at "${e.step.intent}" \u2014 ${jr(e.record.error)}. Environment, not app or test.`;case"finding":return Sw(e.finding)}}function lw(e){switch(e.family){case"element":case"content":case"scalar":return oe("assertion");case"state":case"frame":return oe("state");case"action":return oe("action");case"dataRule":return oe("data rule")}}function cw(e){switch(e.family){case"element":return`Expected ${e.subject} ${e.negated?"not ":""}${e.checkKind} \u2014 ${dw(e)}`;case"content":return`Expected ${e.subject} ${e.checkKind} ${gw(e.match)} ${JSON.stringify(e.expected)}${e.negated?" to not hold":""} \u2014 ${pw(e)}`;case"scalar":return`Expected ${e.subject} to ${e.negated?"not ":""}be ${qd(e.expected)} \u2014 ${fw(e)}`;case"state":return`Expected ${e.subject} ${e.assertion} \u2014 ${hw(e)}`;case"frame":return`Unexpected change \u2014 ${mw(e)}`;case"action":return`Could not ${e.actionKind} ${e.subject} \u2014 ${yw(e)}`;case"dataRule":return`Data rule ${e.rule} broke \u2014 a referenced row went missing`}}function uw(e){switch(e.kind){case"check":return _c(e.record.body)??$o(e.record.body);case"stepError":return`driver failed at "${e.step.intent}": ${jr(e.record.error)}`;case"finding":return bw(e.finding)}}function na(e){switch(e.kind){case"wrongValue":return`${e.entity}.${e.field} [${e.key}] showed ${Ie.actual(e.observed)}, expected ${Ie.expected(e.expected)}`;case"missingRow":return`${e.entity} row "${e.key}" never appeared`;case"unexpectedRow":return`${e.entity} row "${e.key}" is present but the test expected none`;case"unexpectedlyDeleted":return`${e.entity} row "${e.key}" disappeared`;case"neverChanged":return e.direction!=null?`${e.entity}.${e.field} [${e.key}] didn't ${e.direction==="increased"?"increase":"decrease"} from ${e.from} (showed ${Ie.actual(e.observed)})`:`${e.entity}.${e.field} [${e.key}] never changed from ${Ie.actual(e.observed)}`;case"wrongCount":return`found ${String(e.observed)} ${e.entity} rows, expected ${String(e.expected)}`}}function cr(e){let{outcome:t}=e;return t.kind==="passed"?null:t.reason}function dw(e){let t=cr(e);if(t==null)return"held";switch(t.kind){case"notFound":return"the element was not visible";case"multipleMatches":return`the locator matched ${String(t.count)} elements`;case"wrongState":return`the element ${t.observed.value?"stayed":"was never"} ${t.observed.checkKind}`;case"covered":return`the element is covered by ${t.by}`;case"unclassified":return t.message}}function pw(e){let t=cr(e);if(t==null)return"held";switch(t.kind){case"notFound":return"the element was not visible";case"multipleMatches":return`the locator matched ${String(t.count)} elements`;case"wrongContent":return`it showed ${JSON.stringify(t.observed)}`;case"unclassified":return t.message}}function fw(e){let t=cr(e);return t==null?"held":`it showed ${qd(t.observed)}`}function qd(e){return e??"absent"}function hw(e){let t=cr(e);return t==null?"held":na(t)}function mw(e){let t=cr(e);return t==null?"none was seen":Bc(t)}function yw(e){let t=cr(e);if(t==null)return"it succeeded";switch(t.kind){case"notFound":return"the element was not visible";case"multipleMatches":return`the locator matched ${String(t.count)} elements`;case"covered":return`the element is covered by ${t.by}`;case"notPossible":return"the test model says this action can't happen from the current state";case"unclassified":return t.message}}function gw(e){switch(e){case"exact":return"to equal";case"contains":return"to contain";case"startsWith":return"to start with"}}function Sw(e){switch(e.kind){case"impossible-action":return`${oe("impossible action")} "${e.step.intent}" ran ${No(e.step.action)} from a state the test calls impossible.`;case"unrunnable":return`${oe("model drift")} "${e.intent}" couldn't run \u2014 ${Hd(e)}.`;case"lift-visibility":return`${oe("reachability")} ${ie(e.locator)} is visible by step ${String(e.visibleIndex+1)} but declared at step ${String(e.declaredIndex+1)}.`}}function Hd(e){return e.unmet==null?ra(e.reason):Fo(e.unmet)}function bw(e){switch(e.kind){case"impossible-action":return`"${e.step.intent}" ran from a state the test says can't happen`;case"unrunnable":return`model drift: planned step "${e.intent}" could not run \u2014 ${Hd(e)}. Fix the model and recompile \u2014 do not dismiss`;case"lift-visibility":return`visible(${ie(e.locator)}) declared at step ${String(e.declaredIndex+1)} but already visible at step ${String(e.visibleIndex+1)}`}}var ww=new RegExp(`${String.fromCodePoint(27)}\\[[0-9;]*m`,"g");function Rw(e){return e.replaceAll(ww,"").replaceAll(/\s+/g," ").trim()}function ur(e){let t=ne(e.scalars,{kind:"path"});return typeof t=="string"?t:null}function _o(e,t){switch(e.kind){case"step":return{checkId:Fc(e.ref,t),kind:"step"};case"action":return{checkId:Lc(t),kind:"step"};case"frame":return{checkId:Nc(t),kind:"step"};case"fact":return{factId:e.factId,kind:"fact"};case"dataRule":return{kind:"dataRule",ruleId:e.ruleId}}}function Yd(e){return e.body.outcome.kind==="failed"}function oa(e){return e.kind==="data-rule"?b({kind:e.kind,rule:sr(e.dataRule)}):b(e)}function Bo({actual:e,canon:t,pre:r,predicted:n}){return[...[...new Set([...n.entities.keys(),...e.entities.keys()])].flatMap(s=>Cw({actual:e.entities.get(s),canon:t,entity:s,pre:r.entities.get(s),predicted:n.entities.get(s)})),...vw(r.scalars,n.scalars,e.scalars)]}function vw(e,t,r){let n=tt(r,R({kind:"path"}))!==void 0;return[...[...t.entries()].flatMap(([i,s])=>{if(s.subject.kind==="actor")return[];let a=tt(r,i),l=n&&St(s.subject)&&s.expect.expect!=="absent",c=a===void 0&&l?null:a;if(!s.declared||c===void 0||Tt({got:c,subject:s.subject,want:s.expect}))return[];let u=tt(e,i);return[{mismatch:{kind:"scalar-mismatch",subject:s.subject,sut:c,want:s.expect},pending:u!==void 0&&cn(u,c)}]}),...xw(e,t,r),...kw(e,t,r)]}function tt(e,t){let r=e.get(t);return r==null||r.expect.expect!=="is"?void 0:r.expect.value}function xw(e,t,r){let n=R({kind:"path"});if(tt(r,n)===void 0)return[];let o=!cn(tt(e,n),tt(r,n));return[...new Set([...e.keys(),...r.keys()])].flatMap(s=>{let a=(e.get(s)??r.get(s))?.subject;if(a==null||!St(a)||t.has(s))return[];let c=o&&a.kind!=="path"?null:tt(e,s)??null,u=tt(r,s)??null;return cn(c,u)?[]:[{mismatch:{kind:"scalar-mismatch",subject:a,sut:u,want:{expect:"is",value:c}},pending:!1}]})}function kw(e,t,r){let n=R({kind:"actor"}),o=t.get(n);if(o==null)return[];let i=tt(r,n);if(Tt({got:i,subject:{kind:"actor"},want:o.expect}))return[];let s=tt(e,n);return[{mismatch:{kind:"scalar-mismatch",subject:{kind:"actor"},sut:i??null,want:o.expect},pending:s!==void 0&&cn(s,i)}]}function Cw({actual:e,canon:t,entity:r,pre:n,predicted:o}){return[...new Set([...o?.keys()??[],...e?.keys()??[]])].flatMap(s=>Ew({actual:e?.get(s),canon:t,entity:r,key:s,predicted:o?.get(s),preHadKey:n?.has(s)??!1,preRow:n?.get(s)}))}function Ew({actual:e,canon:t,entity:r,key:n,predicted:o,preHadKey:i,preRow:s}){if(o==null)return[{mismatch:{entity:r,key:n,kind:"unexpected-row",row:e},pending:i}];if(e==null)return[{mismatch:{entity:r,key:n,kind:"missing-row"},pending:!i}];let a=(c,u,d)=>cn(t(r,c,u),t(r,c,d));return[...new Set([...Object.keys(o),...Object.keys(e)])].filter(c=>!a(c,o[c],e[c])).map(c=>({mismatch:{entity:r,field:c,key:n,kind:"wrong-value",snapshot:o[c],sut:e[c]},pending:s==null?e[c]===void 0:a(c,s[c],e[c])}))}function cn(e,t){return Zd(e)===Zd(t)}function Zd(e){return e==null?"\u2205":JSON.stringify(e)}function jo(e){let t=Pw(e.entities),r=Aw(e.singletons);return n=>Mw(n,t,r)}function Pw(e){return new Map(e.flatMap(t=>Object.entries(t.props).map(([r,n])=>[Jd(t.name,r),n.consistency])))}function Jd(e,t){return`${e}.${t}`}function Aw(e){return new Map(e.map(t=>[t.name,t.consistency]))}function Mw(e,t,r){return e.kind==="scalar-mismatch"?Ow(e.subject,r):e.kind==="unexpected-row"||e.kind==="missing-row"?"strict":t.get(Jd(e.entity,e.field))??"strict"}function Ow(e,t){return e.kind==="variable"?t.get(e.name)??"strict":"eventual"}function Vo(e){let t=new Set(e.valueSpaces.filter(r=>r.kind==="datetime").map(r=>r.name));return(r,n,o)=>{if(!t.has(`${r}.${n}`)||typeof o!="string")return o;let i=Date.parse(o);return Number.isNaN(i)?o:new Date(i).toISOString()}}var Rt=class extends Error{name="AbortError";constructor(){super("aborted")}};function un(e){return e instanceof Error&&e.name==="AbortError"}function be(e){if(e.aborted)throw new Rt}function vt(e,t){return t.aborted?Promise.reject(new Rt):new Promise((r,n)=>{let o=()=>{clearTimeout(i),n(new Rt)},i=setTimeout(()=>{t.removeEventListener("abort",o),r()},e);t.addEventListener("abort",o,{once:!0})})}function ia({check:e,ephemeral:t,failure:r,rrwebIds:n,waitedMs:o}){let{check:i,negated:s}=Xd(e,!1),a={ephemeral:t,rrwebIds:[...n],waitedMs:o};switch(i.kind){case"visible":case"unobstructed":case"disabled":case"enabled":case"focused":case"checked":case"expanded":case"pressed":return{...a,checkKind:i.kind,family:"element",negated:s,outcome:r==null?{kind:"passed"}:{kind:"failed",reason:Iw(r)},subject:fe(i.locator)};case"value":case"text":return{...a,checkKind:i.kind,expected:i.value,family:"content",match:i.match,negated:s,outcome:r==null?{kind:"passed"}:{kind:"failed",reason:Tw(r)},subject:fe(i.locator)};case"browser":return{...a,expected:i.value,family:"scalar",negated:s,outcome:r==null?{kind:"passed"}:{kind:"failed",reason:Lw(r)},subject:Gr(i.key),subjectKey:R(i.key),subjectKind:i.key.kind}}}function Xd(e,t){return e.kind==="not"?Xd(e.inner,!t):{check:e,negated:t}}function Iw(e){return e.kind==="wrongContent"?{kind:"unclassified",message:Qd(e)}:e}function Qd(e){switch(e.kind){case"notFound":return"element not found";case"multipleMatches":return`matched ${String(e.count)} elements`;case"covered":return`covered by ${e.by}`;case"wrongState":return`element ${e.observed.value?"is":"is not"} ${e.observed.checkKind}`;case"wrongContent":return`content was "${e.observed}"`;case"unclassified":return e.message}}function Tw(e){return e.kind==="wrongState"||e.kind==="covered"?{kind:"unclassified",message:Qd(e)}:e}function sa({observed:e,passed:t,planned:r,waitedMs:n}){return{ephemeral:!1,expected:aa(r.entry.expect),family:"scalar",negated:r.entry.expect.expect==="not",outcome:t?{kind:"passed"}:{kind:"failed",reason:{kind:"wrongScalar",observed:e}},rrwebIds:[],subject:an(r.entry.subject),subjectKey:R(r.entry.subject),subjectKind:r.entry.subject.kind,waitedMs:n}}function aa(e){switch(e.expect){case"absent":return null;case"is":case"not":return Te(e.value)}}function Lw(e){return e.kind==="wrongContent"?{kind:"wrongScalar",observed:e.observed}:{kind:"wrongScalar",observed:null}}function la({failure:e,planned:t,waitedMs:r}){return{assertion:Nw(t),entity:t.predicate.entity,ephemeral:!1,family:"state",outcome:e==null?{kind:"passed"}:{kind:"failed",reason:e},rrwebIds:[],subject:t.subject,waitedMs:r}}function Wo(e){switch(e.kind){case"unexpected-row":return{entity:e.entity,key:e.key,kind:"unexpectedRow"};case"missing-row":return{entity:e.entity,key:e.key,kind:"missingRow"};case"wrong-value":return{entity:e.entity,expected:Te(e.snapshot),field:e.field,key:e.key,kind:"wrongValue",observed:Te(e.sut)};case"expected-change":return{direction:e.direction??null,entity:e.entity,field:e.field,from:Te(e.from),key:e.key,kind:"neverChanged",observed:Te(e.value)}}}function Nw(e){let{negated:t,predicate:r}=e;switch(r.kind){case"count":return"count";case"exists":return t?"absent":"exists";case"state":return r.assertion.kind}}function ca({dataRule:e,violated:t,waitedMs:r}){return{ephemeral:!1,family:"dataRule",outcome:t?{kind:"failed",reason:{kind:"violated"}}:{kind:"passed"},rrwebIds:[],rule:lr(e),waitedMs:r}}function Uo({failure:e,waitedMs:t}){return{ephemeral:!1,family:"frame",outcome:e==null?{kind:"passed"}:{kind:"failed",reason:e},rrwebIds:[],waitedMs:t}}function ua({action:e,failure:t,rrwebIds:r,waitedMs:n}){return{actionKind:e.kind,ephemeral:!1,family:"action",outcome:t==null?{kind:"passed"}:{kind:"failed",reason:t},rrwebIds:[...r],subject:$w(e),value:Dw(e),waitedMs:n}}function da(e){if(e.kind!=="scalar-mismatch")return Wo(e);let t=e.subject;return t.kind==="element"?Fw(e,t):{expected:aa(e.want),kind:"wrongScalar",observed:e.sut==null?null:Te(e.sut),subject:an(t),subjectKey:R(t)}}function Fw(e,t){let r=fe(t.locator),n=R(t);return t.state==="text"||t.state==="value"?{checkKind:t.state,expected:aa(e.want),kind:"wrongElementContent",observed:e.sut==null?null:Te(e.sut),subject:r,subjectKey:n}:{checkKind:t.state,kind:"wrongElementState",observed:e.sut===!0,subject:r,subjectKey:n}}function $w(e){return e.locator!=null?fe(e.locator):e.url!=null?e.url:""}function Dw(e){return e.value!=null?typeof e.value=="object"?JSON.stringify(e.value):String(e.value):e.key!=null?e.key:null}function ep(e){let t=_w(e);return[...Ww(e,t),...Uw(e,t),...zw(e,t)]}function _w(e){return e.mismatches.reduce((t,r)=>Bw(t,r.mismatch,e),{frame:[],scalar:new Map,state:new Map})}function Bw(e,t,r){if(t.kind==="scalar-mismatch")return jw(e,t,r);let n=t,o=r.stateChecks.find(i=>!e.state.has(i)&&Vw(i,n));return o==null?{...e,frame:[...e.frame,t]}:{...e,state:new Map([...e.state,[o,n]])}}function jw(e,t,r){let n=R(t.subject),o=r.scalarChecks.find(i=>!e.scalar.has(i)&&R(i.entry.subject)===n);return o!=null?{...e,scalar:new Map([...e.scalar,[o,t]])}:r.pendingElementKeys.has(n)?e:{...e,frame:[...e.frame,t]}}function Vw(e,t){if(e.predicate.kind!=="state"||e.predicate.entity!==t.entity)return!1;let{assertion:r}=e.predicate;switch(t.kind){case"wrong-value":return(r.kind==="created"||r.kind==="updated")&&t.field in r.props;case"missing-row":return r.kind==="created"||r.kind==="updated";case"expected-change":return r.kind==="updated"&&t.field in r.props;case"unexpected-row":return r.kind==="deleted"}}function Ww(e,t){return e.scalarChecks.map(r=>{let n=t.scalar.get(r),o=n?.kind==="scalar-mismatch"&&n.sut!=null?Te(n.sut):null;return{atMs:e.atMs,body:sa({observed:o,passed:n==null,planned:r,waitedMs:e.waitedMs}),target:{kind:"step",ref:r.ref}}})}function Uw(e,t){return e.stateChecks.map(r=>{let n=t.state.get(r),o=n==null?null:Wo(n);return{atMs:e.atMs,body:la({failure:r.verify==null?o:r.verify(e.post),planned:r,waitedMs:e.waitedMs}),target:{kind:"step",ref:r.ref}}})}function zw(e,t){return t.frame.length===0?[{atMs:e.atMs,body:Uo({failure:null,waitedMs:e.waitedMs}),target:{kind:"frame"}}]:t.frame.map(r=>({atMs:e.atMs,body:Uo({failure:da(r),waitedMs:e.waitedMs}),target:{kind:"frame"}}))}function tp(e){return e().match(t=>({observed:t,ok:!0}),t=>({error:t,ok:!1}))}function Gw(e,t,r){return r.reconcile==null?e:r.reconcile(e,t)}function rp(e,t,r){let n=e.probed.filter(o=>!o.pending&&r(o.mismatch)==="strict");return n.length>0?{mismatches:n,snapshot:e.adopted,stepError:null}:e.probed.length===0?{mismatches:[],snapshot:e.adopted,stepError:null}:null}async function op({canon:e,claimed:t,classify:r,observe:n,pre:o,predicted:i,signal:s,step:a}){let l=fo[a.sync],c=Date.now()+l.timeoutMs,u=Se(o.scalars,i.scalars),d=new Map([...u].filter(([m,v])=>v.declared&&(v.subject.kind!=="element"||t.has(m)))),p=()=>n(d),y=await tp(p);if(!y.ok)return{mismatches:[],snapshot:i,stepError:{atMs:Date.now(),error:y.error}};let h=np({canon:e,pre:o,predicted:i,step:a},y.observed),f=0;for(;Date.now()<c;){be(s);let m=rp(h,a,r);if(m!=null)return m;await vt(zu(l,f),s),f+=1;let v=await tp(p);if(!v.ok)return{mismatches:h.probed,snapshot:h.adopted,stepError:{atMs:Date.now(),error:v.error}};h=np({canon:e,pre:o,predicted:i,step:a},v.observed)}return rp(h,a,r)??{mismatches:h.probed,snapshot:h.adopted,stepError:null}}function np({canon:e,pre:t,predicted:r,step:n},o){let i=n.verifyChanges==null?[]:n.verifyChanges(r,o),s=Gw(r,o,n),a=i.map(l=>({mismatch:l,pending:!0}));return{adopted:s,probed:[...a,...Bo({actual:o.snapshot,canon:e,pre:t,predicted:s})]}}function dr(e){if(e.kind==="not")return dr(e.inner);if(e.kind!=="browser")return e.locator}function ip(e){return e.stepError!=null||e.findings.length>0||e.checks.some(t=>Yd(t))}var Kw=()=>[],qw=()=>_e;async function zo({canon:e,classify:t,dataRuleChecks:r,derive:n,initialSnapshot:o,observe:i,onStep:s,steps:a,stopAfterStep:l},c){return sp({canon:e,classify:t,dataRuleChecks:r??Kw,derive:n??qw,failed:!1,findings:[],index:0,observe:i,onStep:s,signal:c,snapshot:o,steps:a,stopAfterStep:l})}async function sp(e){let{index:t,signal:r,snapshot:n,steps:o}=e;be(r);let i=o[t];if(i==null)return{failed:e.failed,finalModel:n,findings:e.findings};let s=Date.now(),a=await i.targetIds();if(!i.requiredState(n)){let l={kind:"impossible-action",step:i.step};return fa(e.onStep,{checks:[pa({failure:{kind:"notPossible"},rrwebIds:a,startMs:s,step:i})],endMs:Date.now(),executedBranches:i.executedBranches,findings:[l],index:t,post:n,pre:n,source:i.source,startMs:s,step:i.step,stepError:null,url:ur(n)}),{failed:!0,finalModel:n,findings:[...e.findings,l]}}return i.perform().match(()=>Zw({params:e,rrwebIds:a,startMs:s,step:i}),l=>Promise.resolve(Hw({error:l,params:e,rrwebIds:a,startMs:s,step:i})))}function Hw({error:e,params:t,rrwebIds:r,startMs:n,step:o}){let{checks:i,stepError:s}=Yw({error:e,rrwebIds:r,startMs:n,step:o});return fa(t.onStep,{checks:i,endMs:Date.now(),executedBranches:o.executedBranches,findings:[],index:t.index,post:t.snapshot,pre:t.snapshot,source:o.source,startMs:n,step:o.step,stepError:s,url:ur(t.snapshot)}),{failed:!0,finalModel:t.snapshot,findings:t.findings}}function Yw({error:e,rrwebIds:t,startMs:r,step:n}){return e.kind==="action-failed"?{checks:[pa({failure:e.failure,rrwebIds:t,startMs:r,step:n})],stepError:null}:{checks:[],stepError:{atMs:Date.now(),error:e}}}function pa({failure:e,rrwebIds:t,startMs:r,step:n}){let o=Date.now();return{atMs:o,body:ua({action:n.step.action,failure:e,rrwebIds:t,waitedMs:Math.max(0,o-r)}),target:{kind:"action"}}}async function Zw({params:e,rrwebIds:t,startMs:r,step:n}){let{snapshot:o}=e,i=n.effect(o),s=e.derive(i),a={...i,scalars:Se(s,i.scalars)},l=await op({canon:e.canon,claimed:new Set([...n.assertedScalars,...s.keys()]),classify:e.classify,observe:e.observe,pre:o,predicted:a,signal:e.signal,step:n}),c={...l.snapshot,scalars:new Map([...[...l.snapshot.scalars].filter(([,g])=>g.subject.kind!=="element"),...[...i.scalars].filter(([,g])=>g.subject.kind==="element")])},u=Date.now(),d=[...n.pendingChecks,...e.dataRuleChecks(o,l.snapshot)],p=await eR({pendingChecks:d,signal:e.signal,windowStartMs:r}),y=pa({failure:null,rrwebIds:t,startMs:r,step:n}),h=ep({atMs:u,mismatches:l.mismatches,pendingElementKeys:Jw(n.pendingChecks),post:l.snapshot,scalarChecks:n.scalarChecks,stateChecks:n.stateChecks,waitedMs:Math.max(0,u-r)}),f=[y,...p.checks,...h],m=Qw([...l.stepError==null?[]:[l.stepError],...p.stepErrors]),v={checks:f,endMs:Date.now(),executedBranches:n.executedBranches,findings:[],index:e.index,post:l.snapshot,pre:o,source:n.source,startMs:r,step:n.step,stepError:m,url:ur(l.snapshot)};return fa(e.onStep,v),ip(v)?{failed:!0,finalModel:c,findings:e.findings}:e.stopAfterStep!=null&&e.index+1>=e.stopAfterStep?{failed:!1,finalModel:c,findings:e.findings}:sp({...e,index:e.index+1,snapshot:c})}function Jw(e){return new Set(e.flatMap(t=>{if(!("check"in t.source))return[];let r=dr(t.source.check);return r==null?[]:Xw(t.source.check,r)}))}function Xw(e,t){let r=ap(e);return r==="browser"||r==="unobstructed"||r==="disabled"?[]:[Jt(t,r)]}function ap(e){return e.kind==="not"?ap(e.inner):e.kind}function Qw(e){return e.at(0)??null}async function eR({pendingChecks:e,signal:t,windowStartMs:r}){let n=[...new Map(e.map(i=>[oa(i.source),i])).values()],o=await Promise.all(n.map(async i=>{let s=await iR({pendingCheck:i,signal:t,windowStartMs:r}),a=Date.now(),l=await i.targetIds();return{atMs:a,outcome:s,pendingCheck:i,rrwebIds:l}}));return{checks:o.flatMap(i=>i.outcome.kind==="error"?[]:[tR({atMs:i.atMs,outcome:i.outcome,pendingCheck:i.pendingCheck,rrwebIds:i.rrwebIds,windowStartMs:r})]),stepErrors:o.flatMap(i=>i.outcome.kind==="error"?[{atMs:i.atMs,error:i.outcome.error}]:[])}}function tR({atMs:e,outcome:t,pendingCheck:r,rrwebIds:n,windowStartMs:o}){let i=Math.max(0,e-o);return r.source.kind==="data-rule"?{atMs:e,body:ca({dataRule:r.source.dataRule,violated:t.kind==="failed",waitedMs:i}),target:{kind:"dataRule",ruleId:sr(r.source.dataRule)}}:{atMs:e,body:ia({check:r.source.check,ephemeral:r.ephemeral,failure:rR(t),rrwebIds:n,waitedMs:i}),target:nR(r.source)}}function rR(e){return e.kind==="passed"?null:e.failure??{kind:"unclassified",message:"check failed without diagnosis"}}function nR(e){switch(e.kind){case"step":return{kind:"step",ref:e.ref};case"fact":return{factId:oa(e),kind:"fact"};case"data-rule":return{kind:"dataRule",ruleId:sr(e.dataRule)}}}var oR=250;async function iR({pendingCheck:e,windowStartMs:t}){let r=e.check;if(r.kind==="decided")return r.passed?{kind:"passed"}:{failure:null,kind:"failed"};let n=Date.now()-t,o=Math.max(oR,fo[e.budget].timeoutMs-n);return r.wait(o).match(async i=>i?{kind:"passed"}:sR(r.diagnose),i=>Promise.resolve(lp(i)))}function sR(e){return e().match(t=>({failure:t,kind:"failed"}),t=>lp(t))}function lp(e){if(e.kind==="aborted")throw new Rt;return{error:e,kind:"error"}}function fa(e,t){e?.(t)}function ha(e){let t=e.predicates.filter(i=>mp(i)),r=t.filter(i=>i.assertion.kind==="created"),n=pp(t);if(r.length===0&&n.length===0&&e.deferred.length===0)return;let o=t.filter(i=>i.assertion.kind==="updated");return(i,s)=>{let a=r.reduce((u,d)=>pR(u,s,d,e),{env:e.env,snapshot:i}),l=n.reduce((u,d)=>dR(u,s,d,e.env),a.snapshot),c=o.reduce((u,d)=>aR(u,s,d),a.env);return yR(l,e.deferred,c)}}function dp(e,t,r){return new Map([...e,...Object.entries(r).map(([n,o])=>[Ce(A,`${t}.${n}`),o])])}function aR(e,t,r){let n=Be(t.snapshot,r.entity,r.key,e).at(0);return n==null?e:dp(e,r.assertion.as,n)}function ma(e){let t=pp(e.predicates.filter(r=>mp(r)));if(t.length!==0)return(r,n)=>t.flatMap(o=>lR(o,r,n,e.env))}function pp(e){return e.filter(t=>t.assertion.kind==="updated"&&fp(t.assertion.props).length>0)}function fp(e){return hp(e).map(([t])=>t)}function hp(e){return Object.entries(e).flatMap(([t,r])=>bt(r)?[[t,r.direction]]:[])}function mp(e){return e.assertion.kind==="created"||e.assertion.kind==="updated"}function lR(e,t,r,n){let o=Be(t,e.entity,e.key,n).at(0),i=Be(r.snapshot,e.entity,e.key,n).at(0);if(o==null||i==null)return[];let s=It(cR(e.key,n));return hp(e.assertion.props).flatMap(([a,l])=>uR(o[a],i[a],l)?[]:[{direction:l,entity:e.entity,field:a,from:o[a],key:s,kind:"expected-change",value:i[a]}])}function cR(e,t){let r=Object.fromEntries(Object.entries(e).filter(n=>!ve(n[1])&&!Fe(n[1])));return er(r,A,ge(t))}function uR(e,t,r){return r==null?cp(e)!==cp(t):r==="increased"?up(e,t):up(t,e)}function cp(e){return e==null?"\u2205":JSON.stringify(e)}function up(e,t){return(typeof e=="number"&&typeof t=="number"||typeof e=="string"&&typeof t=="string")&&e<t}function dR(e,t,r,n){let o=fp(r.assertion.props),i=Be(t.snapshot,r.entity,r.key,n).at(0);return i==null?e:vu(e,r.entity,r.key,n,s=>({...s,...Object.fromEntries(o.flatMap(a=>{let l=i[a];return l===void 0?[]:[[a,l]]}))}))}function pR(e,t,r,n){if(r.assertion.kind!=="created")return e;let o=er(r.assertion.props,A,ge(n.env)),i=e.snapshot.entities.get(r.entity);if(i==null)return e;let s=fR({identityFields:n.identities.get(r.entity)??[],props:o,set:i});if(s==null)return e;let a=hR(t.snapshot.entities.get(r.entity),i,o);if(a==null)return e;let[l,c]=a,u=new Map(i);return u.delete(s),u.set(l,{...c,...o}),{env:dp(e.env,r.assertion.as,c),snapshot:{...e.snapshot,entities:new Map(e.snapshot.entities).set(r.entity,u)}}}function fR({identityFields:e,props:t,set:r}){let n=It(t);if(r.has(n))return n;if(e.length===0)return null;let o=Object.entries(t),i=[...r].find(([,s])=>e.every(a=>Ru(s[a]))&&o.every(([a,l])=>Go(s[a])===Go(l)));return i==null?null:i[0]}function hR(e,t,r){if(e==null)return;let n=Object.entries(r),o=[...e].filter(([i])=>!t.has(i)).map(([i,s])=>({entry:[i,s],score:n.filter(([a,l])=>Go(s[a])===Go(l)).length}));return mR(o,n.length)}function Go(e){return e==null?"\u2205":JSON.stringify(e)}function mR(e,t){let r=e.reduce((o,i)=>Math.max(o,i.score),0);if(r===0)return;let n=e.filter(o=>o.score===r);if(!(r<t&&n.length!==1))return n[0]?.entry}function yR(e,t,r){let n=t.reduce((o,i)=>{let s=gR(i.value,r);return s==null||typeof s!="string"?o:lt(o,{declared:!0,expect:{expect:"is",value:s},subject:i.key})},e.scalars);return{...e,scalars:n}}function gR(e,t){try{return He(e,A,ge(t))}catch{return}}function ya(e){return e.kind==="not"?ya(e.inner):e.kind==="browser"&&fu(e.key)}function ga(e,t){if(e.kind==="visible"||e.kind==="unobstructed"||e.kind==="disabled"||e.kind==="enabled"||e.kind==="focused"||e.kind==="checked"||e.kind==="expanded"||e.kind==="pressed")return{kind:e.kind,locator:ae(e.locator,t)};if(e.kind==="not"){let r=ga(e.predicate,t);return r==null?null:{inner:r,kind:"not"}}return e.kind==="value"||e.kind==="text"?SR(e,t):e.kind!=="browser"?null:{key:eo(e.name,e.part),kind:"browser",value:e.value===null?null:He(e.value,A,t)}}function pr(e,t){let{executedBranches:r,step:n}=e,{env:o,identities:i}=t,s=Kn({executedBranches:r,expect:n.expect}),a=s.flatMap(w=>w.predicate.kind==="state"&&!w.negated?[w.predicate]:[]),l=$R(a),c=t.snapshot==null?void 0:$t(t.snapshot,a,t),u={counts:c==null?void 0:pe(c),env:o},d={counts:t.snapshot==null?void 0:pe(t.snapshot),env:o},{clears:p,deferred:y,sets:h}=OR({after:u,captures:l,leaves:s,step:n}),f=po(n),m=DR(n.action,d),v=bR(n,s);return{action:m,assertedScalars:[...h.keys()],executedBranches:r,label:n.action.kind,pendingChecks:s.flatMap(w=>jR(w,u,f)),reconcile:ha({deferred:y,env:o,identities:i,predicates:a}),scalarChecks:s.flatMap(w=>RR(w,u)),stateChecks:s.flatMap(w=>vR(w,o)),urlChecks:s.flatMap(w=>BR(dn(w),u)),verifyChanges:ma({deferred:y,env:o,identities:i,predicates:a}),effect:w=>wu($t(w,a,t),{clears:p,forget:v,sets:h})}}function SR(e,t){let r=ot(e.value);return{kind:e.kind,locator:ae(e.locator,t),match:r?e.value.kind:"exact",value:He(r?e.value.value:e.value,A,t)}}function bR(e,t){return e.action.kind==="goto"||e.action.kind==="actor"||wR(t)?"hard":Bt(e)?"soft-path":"none"}function wR(e){return e.some(t=>t.predicate.kind==="actor")}function RR(e,t){let{predicate:r}=e;if(r.kind!=="singleton"&&r.kind!=="browser"&&r.kind!=="actor")return[];let n=ue(dn(e));if(n==null)return[];try{return[{entry:Ye({declared:!0,entry:n,scope:t}),negated:e.negated,ref:{branch:e.branch,ordinal:e.ordinal}}]}catch(o){if(o instanceof $e)return[];throw o}}function dn(e){return e.negated?{kind:"not",predicate:e.predicate}:e.predicate}function vR(e,t){let{predicate:r}=e;return r.kind!=="state"&&r.kind!=="count"&&r.kind!=="exists"?[]:[{negated:e.negated,predicate:r,ref:{branch:e.branch,ordinal:e.ordinal},subject:xR(r,t),verify:r.kind==="state"?void 0:ER(r,e.negated,t)}]}function xR(e,t){let r=e.kind==="state"?e.key:e.where,n=Object.entries(r).map(([o,i])=>`${o}=${kR(i,t)}`);return n.length===0?e.entity:`${e.entity} where ${n.join(", ")}`}function kR(e,t){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"?JSON.stringify(e):e==null?"null":N(e)?CR(e,t):"?"}function CR(e,t){try{return JSON.stringify(Wr(e,A,t))}catch(r){if(r instanceof $e)return e.ref;throw r}}function ER(e,t,r){return n=>{let o=Be(n,e.entity,e.where,r);return e.kind==="count"?PR(e,o.length):AR({entity:e.entity,negated:t,rows:o})}}function PR(e,t){return t===e.value?null:{entity:e.entity,expected:e.value,kind:"wrongCount",observed:t}}function AR({entity:e,negated:t,rows:r}){let n=r.at(0);return t?n==null?null:{entity:e,key:It(n),kind:"unexpectedRow"}:n==null?{entity:e,key:"",kind:"missingRow"}:null}function MR(e){return e.action.kind!=="actor"?null:{expect:{expect:"is",value:{ref:`${e.action.ref.ref}.id`}},subject:{kind:"actor"}}}function OR({after:e,captures:t,leaves:r,step:n}){let o=n.action.kind==="goto"?Yr(n.action.url):[],i=MR(n),s=r.filter(c=>!At(dn(c))).flatMap(c=>{let u=ue(dn(c));return u==null?[]:[u]}),a=[...o,...s,...i==null?[]:[i]].map(c=>({declared:!0,entry:c}));return[...Zr(n).map(c=>({declared:!1,entry:c})),...a].reduce((c,{declared:u,entry:d})=>IR({acc:c,captures:t,declared:u,entry:d,scope:e}),{clears:[],deferred:[],sets:_e})}function IR({acc:e,captures:t,declared:r,entry:n,scope:o}){if(TR(n,t))return n.expect.expect==="is"&&yp(n.expect.value)?{...e,deferred:[...e.deferred,{key:FR(n.subject),value:n.expect.value}]}:e;let i=Ye({declared:r,entry:n,scope:o});return i.expect.expect==="absent"&&!St(i.subject)?{...e,clears:[...e.clears,R(i.subject)]}:{...e,sets:lt(e.sets,i)}}function TR(e,t){return e.subject.kind==="element"||e.subject.kind==="variable"?!1:e.expect.expect==="is"&&yp(e.expect.value)&&LR(e.expect.value,t)}function yp(e){return typeof e=="string"||typeof e=="object"}function LR(e,t){return NR(e).some(r=>t.has(nr(r)))}function NR(e){return typeof e=="string"?[]:N(e)?[e.ref]:e.template.filter(t=>typeof t!="string").map(t=>t.ref)}function FR(e){if(e.kind==="element"||e.kind==="variable"||e.kind==="actor")throw new Error("expected a browser subject");return e}function $R(e){return new Set(e.flatMap(t=>t.assertion.kind==="created"||t.assertion.kind==="updated"?[t.assertion.as]:[]))}function DR(e,t){return{actorRef:e.kind==="actor"?e.ref.ref:void 0,files:e.kind==="upload"?e.files:void 0,key:e.kind==="press"?e.key:void 0,kind:e.kind,locator:_R(e,t),target:e.kind==="drag"?ae(e.target,t):void 0,url:e.kind==="goto"?He(e.url,A,t):void 0,value:"value"in e?cu(e.value,t):void 0}}function _R(e,t){if(e.kind==="drag")return ae(e.source,t);if(!(!("locator"in e)||e.locator==null))return ae(e.locator,t)}function BR(e,t){if(e.kind!=="browser"&&e.kind!=="not")return[];try{let r=ga(e,t);return r!=null&&ya(r)?[r]:[]}catch(r){if(r instanceof $e)return[];throw r}}function jR(e,t,r){let n=dn(e);if(e.predicate.kind==="browser"||e.predicate.kind==="singleton")return[];let o=ga(n,t);return o==null?[]:[{budget:VR(e.predicate,r),check:o,ephemeral:At(n),ref:{branch:e.branch,ordinal:e.ordinal}}]}function VR(e,t){return"wait"in e&&e.wait!=null?e.wait:t?"slow":"fast"}import{err as WR,errAsync as UR,ok as gp,okAsync as Sp,Result as zR}from"neverthrow";function fr(e,t,r){let n=ev(e),o={env:new Map,generate:r.generate,generatedParams:new Set,indexed:n,overrides:new Map(Object.entries(r.params??{}).map(([s,a])=>[De(s),a]))};tv(t.params,A,o);let i=t.world.map(s=>rv(s,A,o));return r.materialize(i).andThen(s=>sv(s,o.env,n).asyncAndThen(a=>GR({base:a,rows:s,signIn:r.signIn,test:t}).map(l=>KR({base:l,generatedParams:o.generatedParams,lockfile:e,test:t}))))}function Ko(e,t){let r=new Map(t.map(n=>[n.name,n]));return n=>Sp(JR(n,e,r).rows)}function qo(e){return t=>{let r=t.map(n=>({as:n.as,entity:n.entity,fields:n.fields}));return e(r).andThen(n=>ZR(t,n))}}function ba(e,t){let r=pn(t);return Object.fromEntries(Object.entries(e).filter(([n,o])=>r.includes(n)&&o!=null))}function pn(e){return Object.keys(e.props)}function GR({base:e,rows:t,signIn:r,test:n}){if(n.actor.kind!=="user"||r==null)return Sp(e);let o=n.actor.alias,i=t.find(s=>s.as===o);return i==null?UR(Cs(o)):r({entity:i.entity,row:i.row}).map(s=>({...e,auth:s}))}function KR({base:e,generatedParams:t,lockfile:r,test:n}){let o=Object.fromEntries(r.singletons.map(d=>[d.name,d.default])),i=Object.fromEntries(Object.entries(n.singletons).map(([d,p])=>[d,Ee(p,A,ge(e.env))])),s=Object.entries(n.singletons).filter(([,d])=>qR(d,t)).map(([d])=>d),a={...o,...i},l=new Set(r.singletons.filter(d=>d.source==="client").map(d=>d.name)),c=Object.fromEntries(Object.entries(a).filter(([d])=>l.has(d))),u=HR(e.aliases,n);return{...e,clientState:c,generatedSingletons:s,snapshot:{...e.snapshot,scalars:Se(e.snapshot.scalars,new Map([...Object.entries(a).map(([d,p])=>[R({kind:"variable",name:d}),{declared:!0,expect:{expect:"is",value:p},subject:{kind:"variable",name:d}}]),...u,...YR(n)]))}}}function qR(e,t){return N(e)?t.has(Ce(A,e.ref)):qe(e)?e.template.some(r=>typeof r!="string"&&"ref"in r&&t.has(Ce(A,r.ref))):!1}function HR(e,t){if(t.actor.kind!=="user")return[];let r=t.actor.alias,n=e.find(o=>o.alias===r);return n==null?[]:[[R({kind:"actor"}),{declared:!1,expect:{expect:"is",value:n.key},subject:{kind:"actor"}}]]}function YR(e){return[[R({kind:"viewport"}),{declared:!1,expect:{expect:"is",value:e.viewport},subject:{kind:"viewport"}}]]}function ZR(e,t){let r=new Map(t.map(n=>[n.as,n]));return zR.combine(e.map(n=>{let o=r.get(n.as);return o==null?WR(Cs(n.as)):gp({as:n.as,entity:n.entity,generatedFields:n.generatedFields,row:o.row})}))}function JR(e,t,r){return e.reduce((n,o)=>{let i=XR(o.fields,n.env),s=av({generate:t,model:o.model,seedPrefix:o.seedPrefix,set:i,valueSpaces:r}),a=Object.entries(s).map(([c,u])=>[`${o.as}.${c}`,u]),l=Object.keys(s).filter(c=>!(c in i));return{env:new Map([...n.env,...a]),rows:[...n.rows,{as:o.as,entity:o.entity,generatedFields:[...new Set([...o.generatedFields,...l])],row:s}]}},{env:new Map,rows:[]})}function XR(e,t){return Object.fromEntries(Object.entries(e).map(([r,n])=>{if(N(n))return[r,QR(t,n.ref)];if(qe(n))throw new Error(`template value not allowed in entity field "${r}"`);return[r,n]}))}function QR(e,t){let r=e.get(t);if(r==null)throw new Error(`setup ref "${t}" was not produced by an earlier entity`);return r}function ev(e){return{models:new Map(e.entities.map(t=>[t.name,t])),valueSpaces:new Map(e.valueSpaces.map(t=>[t.name,t]))}}function tv(e,t,r){Object.entries(e).forEach(([n,o])=>{let i=Ce(t,n),s=r.indexed.valueSpaces.get(o.valueSpace);if(s==null)throw new Error(`unknown valueSpace "${o.valueSpace}" for param "${i}"`);let a=r.overrides.get(i);a==null&&r.generatedParams.add(i);let l=a??r.generate.value({nullable:!1,seed:i,space:s,type:Tc(s),valueSpace:o.valueSpace});r.env.set(i,l)})}function rv(e,t,r){let n=r.indexed.models.get(e.entity);if(n==null)throw new Error(`model "${e.entity}" not found for setup "${e.as}"`);let o=Ce(t,e.as),i=nv(e.set,t,r.env),s=iv(n,i,o,r),a=Object.entries(e.set).filter(([,l])=>N(l)&&r.generatedParams.has(Ce(t,l.ref))).map(([l])=>l);return{as:o,entity:e.entity,fields:{...s,...i},generatedFields:[...Object.keys(s),...a],model:n,seedPrefix:o}}function nv(e,t,r){return Object.fromEntries(Object.entries(e).map(([n,o])=>[n,ov(o,t,r)]))}function ov(e,t,r){if(!N(e))return e;let n=Ce(t,e.ref);return r.get(n)??{ref:n}}function iv(e,t,r,n){return Object.fromEntries(Object.entries(e.props).filter(([o,i])=>!i.optional&&!e.identity.includes(o)&&!(o in t)).map(([o,i])=>[o,bp({field:o,generate:n.generate,model:e,seedPrefix:r,spec:i,valueSpaces:n.indexed.valueSpaces})]))}function sv(e,t,r){let n=new Map;e.forEach(a=>{let l=r.models.get(a.entity);if(l==null)throw new Error(`model "${a.entity}" not found for setup "${a.as}"`);Object.entries(a.row).forEach(([u,d])=>t.set(Ce(De(a.as),u),d));let c=n.get(a.entity)??new Map;c.set(Sa(a.row,l),ba(a.row,l)),n.set(a.entity,c)});let o=e.flatMap(a=>{let l=r.models.get(a.entity);return l==null?[]:[{alias:a.as,entity:a.entity,key:Sa(a.row,l)}]}),i=e.flatMap(a=>{let l=r.models.get(a.entity);if(l==null)return[];let c=Sa(a.row,l);return a.generatedFields.map(u=>({entity:a.entity,field:u,key:c}))}),s=new Map(e.map(a=>[a.as,{entity:a.entity,row:a.row}]));return gp({aliases:o,auth:void 0,env:t,generated:i,principals:s,snapshot:{entities:lv(n),scalars:_e}})}function av({generate:e,model:t,seedPrefix:r,set:n,valueSpaces:o}){return{...Object.fromEntries(Object.entries(t.props).filter(([s])=>!(s in n)).map(([s,a])=>[s,bp({field:s,generate:e,model:t,seedPrefix:r,spec:a,valueSpaces:o})])),...n}}function bp({field:e,generate:t,model:r,seedPrefix:n,spec:o,valueSpaces:i}){let s=`${r.name}.${e}`;return t.value({nullable:o.optional,seed:Ce(n,e),space:i.get(s),type:o.type,valueSpace:s})}function Sa(e,t){return t.identity.map(r=>String(e[r])).join(":")}function lv(e){return new Map([...e].map(([t,r])=>[t,new Map(r)]))}function fn(e,t,r){let n=Pe(e.requiredState,t);return n==null?null:new Map([...Object.entries(r).map(([o,i])=>[De(o),i]),...n])}function hn(e,t,r){let n={env:t,identities:e.identities,snapshot:r},o=Cu(e.whenSteps,r,n),i=o.at(-1)??{executedBranches:[],step:e.effectStep},s=pr(i,n),a=uv(e,n),l=o.reduce((c,u)=>{let d=pr(u,{...n,snapshot:c.current});return{current:d.effect(c.current),steps:[...c.steps,{action:d.action,assertedScalars:d.assertedScalars,effect:d.effect,executedBranches:u.executedBranches,pendingChecks:d.pendingChecks,reconcile:d.reconcile,scalarChecks:d.scalarChecks,source:u.step,stateChecks:d.stateChecks,urlChecks:d.urlChecks,verifyChanges:d.verifyChanges}]}},{current:r,steps:[]});return{effect:dv(s.effect,a),steps:l.steps}}function Yo(e,t,r){return Pe(e.requiredState,r)==null?!1:Ho(t(r))!==Ho(r)||pv(e)||cv(e)}function cv(e){return[...e.nav,...e.steps].every(t=>t.expect.every(r=>r.kind!=="state"))}var wp=new WeakMap;function Ho(e){let t=wp.get(e);if(t!=null)return t;let r=b({entities:[...e.entities].toSorted(([n],[o])=>n.localeCompare(o)).map(([n,o])=>[n,[...o].toSorted(([i],[s])=>i.localeCompare(s))]),scalars:Ls(e.scalars).map(([n,o])=>[n,o.expect])});return wp.set(e,r),r}function uv(e,t){let r=e.nav.at(-1);if(r!=null)return pr({executedBranches:[],step:r},t).action.url}function dv(e,t){if(t==null)return e;let r=rr(t);return n=>{let o=e(n);return{...o,scalars:Se(o.scalars,r)}}}function pv(e){return e.effectStep.expect.some(t=>t.kind==="state"&&t.assertion.kind==="updated"&&Object.values(t.assertion.props).some(r=>bt(r)))}function hr(e,t,r){let n=fn(e,t.snapshot,r);if(n==null)return null;let o=fv(e,n,t.snapshot);return o==null||!Yo(e,o.effect,t.snapshot)?null:{next:{snapshot:o.effect(t.snapshot)},resolved:o}}function Rp(e,t,r){let n=fn(e,t.snapshot,r);if(n==null)return"required-state-unsatisfied";try{return hn(e,n,t.snapshot),"no-effect"}catch(o){if(o instanceof $e)return"unresolvable";throw o}}function fv(e,t,r){try{return hn(e,t,r)}catch(n){if(n instanceof $e)return null;throw n}}function Zo(e,t,r){return e.flatMap((n,o)=>{let i=r(n),s=hr(n,t,i);return s==null?[]:[{idx:o,label:Xe(n),params:i,stepRun:s}]})}function wa(e,t){let r=[...t.entities].flatMap(([i,s])=>[...s].map(([a,l])=>hv({entity:i,key:a,pre:e,row:l}))),n=[...e.entities].flatMap(([i,s])=>[...s].flatMap(([a,l])=>mv({entity:i,key:a,post:t,row:l}))),o=[...t.scalars.values()].flatMap(i=>{if(i.subject.kind!=="variable"||i.expect.expect!=="is")return[];let s=i.subject.name;return[{changed:ne(e.scalars,i.subject)!==i.expect.value,name:s,value:i.expect.value}]});return{rows:[...r,...n],singletons:o}}function hv({entity:e,key:t,pre:r,row:n}){let o=yv(r.entities.get(e),t),i=Object.entries(n).map(([s,a])=>({changed:o==null||o[s]!==a,field:s,value:a}));return{changed:o==null||i.some(s=>s.changed),entity:e,fields:i,key:t,status:o==null?"created":"present"}}function mv({entity:e,key:t,post:r,row:n}){if(r.entities.get(e)?.has(t)===!0)return[];let o=Object.entries(n).map(([i,s])=>({changed:!1,field:i,value:s}));return[{changed:!0,entity:e,fields:o,key:t,status:"deleted"}]}function yv(e,t){return e?.get(t)}function mr(e,t,r){return t.steps.map(n=>({assertedScalars:n.assertedScalars,effect:n.effect,executedBranches:n.executedBranches,pendingChecks:n.pendingChecks.map(o=>({budget:o.budget,check:{kind:"poll",diagnose:()=>r.diagnoseCheck(o.check),wait:i=>r.awaitCheck(o.check,i)},ephemeral:o.ephemeral,source:{check:o.check,kind:"step",ref:o.ref},targetIds:()=>r.locateIds(dr(o.check))})),reconcile:n.reconcile,scalarChecks:n.scalarChecks,source:n.source,stateChecks:n.stateChecks,step:{action:n.action,intent:e.intent,test:e.test},sync:e.wait,urlChecks:n.urlChecks,verifyChanges:n.verifyChanges,perform:()=>r.perform(n.action),requiredState:()=>!0,targetIds:()=>r.locateIds(n.action.locator)}))}async function vp({current:e,driver:t,index:r,next:n,state:o}){if(n==null||gv(n))return[];if(Bt(e.transition.effectStep))return[];let i=hr(n.transition,o,n.params);if(i==null)return[];let s=mr(n.transition,i.resolved,t).flatMap(c=>c.pendingChecks.flatMap(u=>{let d=Sv(u.source);return d==null?[]:[d]}));if(s.length===0)return[];let a=new Map(s.map(c=>{let u={kind:"element",locator:c,state:"visible"};return[R(u),{declared:!0,expect:{expect:"is",value:!0},subject:u}]})),l=await t.observe(a).match(c=>c,()=>null);return l==null?[]:s.filter(c=>{let u={kind:"element",locator:c,state:"visible"},d=ne(l.snapshot.scalars,u)===!0,p=ne(o.snapshot.scalars,u)===!1;return d&&p}).map(c=>({declaredIndex:r+1,kind:"lift-visibility",locator:c,visibleIndex:r}))}function gv(e){return e.transition.nav.length>0||e.transition.steps.some(t=>t.action.kind==="goto"||Bt(t))}function Sv(e){if(e.kind!=="data-rule")return e.check.kind==="visible"?e.check.locator:void 0}function Jo(e){let t=e.findings.map(n=>({finding:n,kind:"finding"})),r=e.step;return r==null?t:[...e.checks.filter(n=>n.body.outcome.kind==="failed").map(n=>({kind:"check",record:n,step:r,stepIndex:e.index})),...e.stepError==null?[]:[{kind:"stepError",record:e.stepError,step:r,stepIndex:e.index}],...t]}function yr(e){return e.filter(t=>t.kind!=="finding"||t.finding.kind!=="unrunnable")}async function va(e,t){let{params:r,transition:n}=e.stepRun,o={snapshot:Ro(e.facts,e.state.snapshot)},i=hr(n,o,r);if(i==null){let a=Rp(n,o,r),l={intent:n.intent,kind:"unrunnable",reason:a,test:n.test,unmet:a==="required-state-unsatisfied"?co(n.requiredState,o.snapshot)??void 0:void 0};return{label:Xe(n),next:e.state,result:{failed:!0,finalModel:e.state.snapshot,findings:[l]}}}let s=await zo({canon:e.canon,classify:e.classify,initialSnapshot:e.state.snapshot,observe:e.driver.observe,onStep:e.onStep,steps:mr(e.stepRun.transition,i.resolved,e.driver),stopAfterStep:e.stopAfterStep==null?void 0:e.stopAfterStep-e.stepBase,dataRuleChecks:(a,l)=>e.dataRules.flatMap(c=>kp(c,l)),derive:a=>rn(e.facts,a)},t);return{label:Xe(e.stepRun.transition),next:{snapshot:s.finalModel},result:s}}function kp(e,t){return Co(e,t)?[{budget:"fast",check:{kind:"decided",passed:!1},ephemeral:!1,source:{dataRule:e,kind:"data-rule"},targetIds:()=>Promise.resolve([])}]:[]}function Xo(e,t){return Ra({acc:{contradictions:[],failed:!1,findings:[],ran:[]},index:0,params:e,signal:t,state:e.initialState,stepBase:0})}async function Ra({acc:e,index:t,params:r,signal:n,state:o,stepBase:i}){be(n);let s=r.sequence[t];if(s==null)return e;let a=Date.now(),l=[],c=[],u=await va({canon:r.canon,classify:r.classify,dataRules:r.dataRules,driver:r.driver,facts:r.facts,state:o,stepBase:i,stepRun:s,stopAfterStep:r.stopAfterStep,onStep:h=>{l.push(h.index);let f={checks:h.checks,endMs:h.endMs,executedBranches:h.executedBranches,findings:h.findings,index:i+h.index,kind:"step",source:h.source,startMs:h.startMs,state:wa(h.pre,h.post),step:h.step,stepError:h.stepError,url:h.url};c.push(...Jo(f)),r.onEvent(f)}},n);if(u==null)return Ra({acc:e,index:t+1,params:r,signal:n,state:o,stepBase:i});r.onEvent({endMs:Date.now(),intent:s.transition.intent,kind:"ran",startMs:a});let d=await bv({index:t,outcome:u,params:r,signal:n,state:o,stepBase:i,stepRun:s},l),p=l.length>0?[]:u.result.findings,y={contradictions:[...e.contradictions,...c,...p.map(h=>({finding:h,kind:"finding"})),...d.map(h=>({finding:h,kind:"finding"}))],failed:e.failed||u.result.failed||c.length>0||d.length>0,findings:[...e.findings,...u.result.findings,...d],ran:[...e.ran,u.label]};return u.result.failed||c.length>0||d.length>0||r.stopAfterStep!=null&&i+l.length>=r.stopAfterStep?y:Ra({acc:y,index:t+1,params:r,signal:n,state:u.next,stepBase:i+l.length})}async function bv(e,t){let{index:r,outcome:n,params:o,stepBase:i,stepRun:s}=e,a=t.length>0;!a&&n.result.findings.length>0&&xp(o,s,e.state,i,n.result.findings);let l=o.sequence[r+1],c=a?await vp({current:s,driver:o.driver,index:r,next:l,state:n.next}):[];return n.result.findings.forEach(u=>{o.onEvent({finding:u,kind:"finding"})}),c.forEach(u=>{o.onEvent({finding:u,kind:"finding"})}),c.length>0&&l!=null&&xp(o,l,n.next,i+t.length,c),c}function xp(e,t,r,n,o){let i=Date.now(),s=ne(r.snapshot.scalars,{kind:"path"});e.onEvent({checks:[],endMs:i,executedBranches:[],findings:o,index:n,kind:"step",source:t.transition.steps[0]??t.transition.effectStep,startMs:i,state:wa(r.snapshot,r.snapshot),step:null,stepError:null,url:typeof s=="string"?s:null})}function Cp(e){return J(e).flatMap(t=>wv(t.test))}function wv(e){let t=new Map(e.world.map(n=>[n.as,n])),r=xv(e.steps);return e.steps.flatMap((n,o)=>n.expect.filter(i=>kv(i)).flatMap(i=>Rv({createdAliases:r,predicate:i,setByAlias:t,stepIndex:o,test:e})))}function Rv(e){let{createdAliases:t,predicate:r,setByAlias:n,stepIndex:o,test:i}=e,s=vv(r);if(s==null||t.has(s))return[];let a=n.get(s);return a==null?[]:Object.keys(r.assertion.props).filter(l=>!(l in a.set)).map(l=>({entity:r.entity,field:l,stepIndex:o,test:`${i.workflow}/${i.slug}`}))}function vv(e){return Object.values(e.key).flatMap(t=>N(t)?[nr(t.ref)]:[]).at(0)}function xv(e){return new Set(e.flatMap(t=>t.expect.flatMap(r=>r.kind==="state"&&r.assertion.kind==="created"?[r.assertion.as]:[])))}function kv(e){return e.kind==="state"&&e.assertion.kind==="updated"}function Ep(e){return J(e).flatMap(({test:t})=>Cv(t.steps,ee(t)))}function Cv(e,t){return e.reduce((r,n)=>{let o=Ev(n.action).filter(i=>!Pv(i,r.pre)).map(i=>({action:n.action,ephemeralOnly:r.ephemeralKeys.has(b(ce(i))),target:i,test:t}));return{ephemeralKeys:new Set([...r.ephemeralKeys,...Av(n)]),pre:Je(r.pre,[n]),violations:[...r.violations,...o]}},{ephemeralKeys:new Set,pre:Mt,violations:[]}).violations}function Ev(e){return e.kind==="goto"||e.kind==="upload"?[]:e.kind==="drag"?[e.source,e.target]:"locator"in e&&e.locator!=null?[e.locator]:[]}function Pv(e,t){let r=b(ce(e)),n=[...t.values()].filter(i=>i.subject.kind==="element"&&b(ce(i.subject.locator))===r);if(n.length===0)return!1;let o=i=>n.some(s=>s.subject.kind==="element"&&s.subject.state===i&&s.expect.expect==="is"&&s.expect.value===!1);return!o("visible")&&!o("enabled")}function Av(e){return uo(e.expect).filter(t=>At(t)).flatMap(t=>Pp(t)).map(t=>b(ce(t)))}function Pp(e){return e.kind==="not"?Pp(e.predicate):"locator"in e?[e.locator]:[]}function Ap(e){let t=Qe(e);return J(e).flatMap(({test:r})=>[...Tv(r.steps,ee(r),t),...Mv(r.steps,r.actor,ee(r))])}function Mv(e,t,r){return e.reduce((n,o,i)=>{let s=o.action.kind==="actor"?{alias:o.action.ref.ref,kind:"user"}:n.actor,a=Ov(o).filter(l=>Iv(l.target,s)).map(l=>({predicate:l,stepIndex:i,test:r}));return{actor:en(n.actor,[o]),flagged:[...n.flagged,...a]}},{actor:t,flagged:[]}).flagged}function Ov(e){return e.expect.filter(t=>t.kind==="actor")}function Iv(e,t){return e.kind==="anonymous"?t.kind==="anonymous":t.kind==="user"&&t.alias===e.ref.ref}function Tv(e,t,r){let n=go(Mt,r),o=new Set(n.keys());return e.reduce((i,s,a)=>{let l=$v(s),c=Lv({acc:i,assertions:l,stepIndex:a,test:t}),u=go(Je(i.pattern,[s]),r);return{assertedKeys:new Set([...Nv({acc:i,assertions:l,pattern:u,step:s}),...o]),pattern:u,redundant:[...i.redundant,...c]}},{assertedKeys:o,pattern:n,redundant:[]}).redundant}function Lv({acc:e,assertions:t,stepIndex:r,test:n}){return t.reduce((o,{entry:i,predicate:s})=>{let a=R(i.subject),l=b(i.expect),c=e.pattern.get(a),u=c!=null&&e.assertedKeys.has(a)&&b(c.expect)===l,d=o.seen.get(a)===l;return{flagged:u||d?[...o.flagged,{predicate:s,stepIndex:r,test:n}]:o.flagged,seen:new Map([...o.seen,[a,l]])}},{flagged:[],seen:new Map}).flagged}function Nv({acc:e,assertions:t,pattern:r,step:n}){let o=new Set([...Fv(n),...Zr(n)].map(a=>R(a.subject))),i=[...e.assertedKeys].filter(a=>r.has(a)&&!o.has(a)),s=t.map(({entry:a})=>R(a.subject)).filter(a=>r.has(a));return new Set([...i,...s])}function Fv(e){return e.action.kind==="goto"?Yr(e.action.url):[]}function $v(e){return or(e.expect).flatMap(t=>{if(t.kind==="actor")return[];let r=ue(t);return r==null?[]:[{entry:r,predicate:t}]})}var Dv=2;function Mp(e){return J(e).flatMap(({test:t})=>t.steps.reduce((n,o,i)=>{let s=_v(o,n.pre),a=s.length>=Dv?[...n.violations,{hidden:s,stepIndex:i,test:ee(t)}]:n.violations;return{pre:Je(n.pre,[o]),violations:a}},{pre:Mt,violations:[]}).violations)}function _v(e,t){return e.expect.flatMap(r=>{let n=Bv(r);return n!=null&&!xa(n)&&jv(n,t)?[n]:[]})}function Bv(e){return e.kind!=="not"||e.predicate.kind!=="visible"?null:e.predicate.locator}function xa(e){return e.by==="surface"?!0:e.by==="inside"?xa(e.scope)||xa(e.target):!1}function jv(e,t){let r=t.get(R({kind:"element",locator:e,state:"visible"}));return r!=null&&r.expect.expect==="is"&&r.expect.value===!0}function Ip(e){return J(e).flatMap(({test:t})=>{let r=ee(t);return t.steps.reduce((n,o,i)=>Vv(n,o,i,r),{found:[],open:new Set}).found})}function Vv(e,t,r,n){let o=t.action.kind==="goto"?new Set:e.open,i=Op(t,Wv),s=Op(t,Uv),a=new Set([...o,...i].filter(c=>!s.has(c))),l=zv(t).flatMap(c=>a.has(b(ce(c.surface)))?[]:[{...c,stepIndex:r,test:n}]);return{found:[...e.found,...l],open:a}}function Op(e,t){return new Set(e.expect.flatMap(r=>{let n=t(r);return n==null?[]:[b(ce(n))]}))}function Wv(e){return e.kind!=="visible"?null:e.locator.by==="surface"?e.locator:null}function Uv(e){return e.kind!=="not"||e.predicate.kind!=="visible"?null:e.predicate.locator.by==="surface"?e.predicate.locator:null}function zv(e){return e.expect.flatMap(t=>{if(t.kind!=="visible"||t.locator.by!=="inside")return[];let r=Tp(t.locator);return r==null?[]:[{content:t.locator,surface:r}]})}function Tp(e){return e.by!=="inside"?null:e.scope.by==="surface"?e.scope:Tp(e.scope)}function Np(e){switch(e.kind){case"cascade-gap":{let{gap:t}=e;return`${oe("data rule")} ${t.transition} deletes ${t.target} but leaves ${t.source} rows pointing at it, breaking ${lr(t.dataRule)}. Cascade the delete or declare the cleanup.`}case"create-gap":return Gv(e.gap);case"unreachable-interaction":{let{violation:t}=e,r=ie(t.target);return t.ephemeralOnly?`${oe("reachability")} ${t.test}: ${ln(t.action)}, but ${r} was only declared inside ephemeral(...), which grants no reachability. Assert a durable visible(...) first.`:`${oe("reachability")} ${t.test}: ${ln(t.action)}, but no prior step declared ${r} reachable. Assert visible(...) on it first.`}case"redundant-assertion":{let{redundancy:t}=e;return`${oe("redundancy")} ${t.test}: step ${String(t.stepIndex+1)} restates "${dt(t.predicate)}" \u2014 already asserted and unchanged since. Delete it.`}case"missing-precondition":{let{missing:t}=e;return`${oe("precondition")} ${t.test}: step ${String(t.stepIndex+1)} updates ${t.entity}.${t.field} but no earlier step or seed establishes its prior value. Set it on the step that creates the row, or seed it (a value, arbitrary(...), or null) \u2014 don't split the journey into a separate workflow.`}case"fact-conflict":return Kv(e.conflict);case"unmodeled-surface":{let{surface:t}=e,r=t.hidden.map(n=>ie(n)).join(", ");return`${oe("surface")} ${t.test}: step ${String(t.stepIndex+1)} hides ${String(t.hidden.length)} elements at once (${r}). Elements hidden together are one surface \u2014 declare surface(...) and scope them to it.`}case"unpinned-surface-content":{let{content:t}=e,r=ie(t.surface);return`${oe("surface")} ${t.test}: step ${String(t.stepIndex+1)} asserts ${ie(t.content)} but never opens ${r}. A content fact holds only while its surface is active \u2014 assert visible(${r}) here or on a prior open step.`}}}function Gv(e){let t=e.missing.length===1?"field":"fields",r=e.missing.length===1?"it":"them";return`${oe("data rule")} ${e.transition} creates ${e.entity} without required ${t} ${e.missing.join(", ")}. Set ${r} or drop the requirement.`}function Kv(e){return[`${oe("fact")} Two facts contradict on overlapping states \u2014 "${dt(e.a)}" vs "${dt(e.b)}".`,` Shared state: ${To(e.when)}.`,Lp(e.a,e.aProducers,e.when),Lp(e.b,e.bProducers,e.when),"The learned fact keeps only conditions all producers share \u2014 add the missing pin to the broad producer, or split with a when branch."].join(`
|
|
5
|
-
`)}function Lp(e,t,r){let n=t.map(o=>` - ${o.test} adds ${Ud(o.when,r)}`);return[` "${dt(e)}" declared by:`,...n].join(`
|
|
6
|
-
`)}var qv=24301;function Qo(e,t){return e.reduce((r,n)=>Jv(r,t[n.idx]?.paramSpaces),new Map)}function gr(e,t){return Object.fromEntries(Object.entries(e.paramSpaces).map(([r,n])=>[r,Hv(n,n?.name==null?0:t.get(n.name)??0)]))}var Fp=new WeakMap;function Hv(e,t){if(e==null)return $p(void 0,t);let r=Fp.get(e)??new Map;Fp.set(e,r);let n=r.get(t);if(n!=null)return n;let o=$p(e,t);return r.set(t,o),o}function Yv(e){return e==null?Qv(10):e.kind==="enum"?it.constantFrom(...e.values):e.kind==="number"?it.integer({max:e.max,min:e.min}):e.kind==="boolean"?it.boolean():e.kind==="datetime"?ex():Zv(e)}function $p(e,t){let[r]=it.sample(Yv(e),{numRuns:1,seed:qv+t});if(r==null)throw new Error("arbitrary produced no sample");return r}function Zv(e){let t=e.refine??e.pattern;return it.stringMatching(new RegExp(`^(?:${t})$`,"u")).filter(r=>(e.minLength==null||r.length>=e.minLength)&&(e.maxLength==null||r.length<=e.maxLength))}function Jv(e,t){return t==null?e:Object.values(t).reduce((r,n)=>n==null?r:new Map([...r,[n.name,(r.get(n.name)??0)+1]]),e)}var Xv="abcdefghijklmnopqrstuvwxyz0123456789".match(/./g)??[],Qv=e=>it.array(it.constantFrom(...Xv),{maxLength:e,minLength:1}).map(t=>t.join(""));function ex(){return it.date({max:new Date("2030-12-31T23:59:59.999Z"),min:new Date("2020-01-01T00:00:00.000Z"),noInvalidDate:!0}).map(e=>e.toISOString())}var tx=new Map;function ei(e){return gr(e,tx)}import{z as j}from"zod";var Sr=j.enum(["crash","data-rule","fact","frame","model-drift"]),rx=j.object({intent:j.string().min(1),test:j.string().min(1)}),nx=j.discriminatedUnion("kind",[j.object({family:j.string().min(1),kind:j.literal("check"),layer:Sr,reason:j.string().min(1),step:rx,subject:j.string()}),j.object({error:j.string().min(1),kind:j.literal("stepError"),layer:Sr,step:j.string().min(1)}),j.object({intent:j.string().min(1),kind:j.literal("unrunnable"),layer:Sr,reason:j.string().min(1),test:j.string().min(1)}),j.object({kind:j.literal("impossible-action"),layer:Sr,step:j.string().min(1)}),j.object({declaredIndex:j.number().int(),kind:j.literal("lift-visibility"),layer:Sr,subject:j.string().min(1),visibleIndex:j.number().int()})]);function ka(e){switch(e.kind){case"stepError":return"crash";case"check":return ox(e);case"finding":return e.finding.kind==="unrunnable"?"model-drift":"frame"}}function ox(e){switch(e.record.target.kind){case"dataRule":return"data-rule";case"fact":return"fact";case"step":case"action":case"frame":return"frame"}}function mn(e){let t=e.map(o=>({contradiction:o,line:Do(o),part:_p(o)})).toSorted((o,i)=>b(o.part).localeCompare(b(i.part))),r=t.map(o=>o.part),n=t.at(0)?.contradiction;return{layer:cx(r),signature:b({parts:r.map(o=>b(o))}),sourceTest:n==null?void 0:ix(n),title:t.at(0)?.line}}function ix(e){switch(e.kind){case"check":case"stepError":return e.step.test;case"finding":return sx(e)}}function sx(e){let{finding:t}=e;switch(t.kind){case"impossible-action":return t.step.test;case"unrunnable":return t.test;case"lift-visibility":return}}var Dp={crash:0,"data-rule":1,fact:2,frame:3,"model-drift":4};function _p(e){let t=ka(e);switch(e.kind){case"check":{let{body:r}=e.record;return{family:r.family,kind:"check",layer:t,reason:ax(r),step:{intent:e.step.intent,test:e.step.test},subject:"subject"in r?r.subject:""}}case"stepError":return{error:e.record.error.kind,kind:"stepError",layer:t,step:e.step.intent};case"finding":return lx(e,t)}}function ax(e){return e.outcome.kind==="failed"?e.outcome.reason.kind:"passed"}function lx(e,t){let{finding:r}=e;switch(r.kind){case"unrunnable":return{intent:r.intent,kind:"unrunnable",layer:t,reason:r.reason,test:r.test};case"impossible-action":return{kind:"impossible-action",layer:t,step:r.step.intent};case"lift-visibility":return{declaredIndex:r.declaredIndex,kind:"lift-visibility",layer:t,subject:fe(r.locator),visibleIndex:r.visibleIndex}}}function cx(e){return e.map(r=>r.layer).toSorted((r,n)=>Dp[r]-Dp[n]).at(0)??"frame"}function Ea(e){let t=new Map(e.entities.flatMap(o=>Object.entries(o.props).flatMap(([i,s])=>s.valueSpace==null?[]:[[`${o.name}.${i}`,s.valueSpace]]))),r=new Map(e.singletons.flatMap(o=>o.valueSpace==null?[]:[[o.name,o.valueSpace]]));return e.workflows.flatMap(o=>o.steps.flatMap(i=>i.expect.flatMap(s=>ti(s)))).reduce((o,i)=>{let s=i.kind==="field"?t.get(i.key):r.get(i.key);if(s==null)return o;let a=o.get(s)??[];return a.includes(i.value)?o:new Map([...o,[s,[...a,i.value]]])},new Map)}function ti(e){return e.kind==="not"?ti(e.predicate):e.kind==="and"?e.predicates.flatMap(t=>ti(t)):e.kind!=="when"?[]:e.branches.flatMap(t=>[...t.condition==null?[]:Ca(t.condition),...t.consequence.flatMap(r=>ti(r))])}function Ca(e){if(e.kind==="singleton"){let{value:t}=e.assertion;return t!==null&&typeof t!="object"?[{key:e.singleton,kind:"singleton",value:t}]:[]}return e.kind==="not"?Ca(e.predicate):e.kind==="and"||e.kind==="or"?e.predicates.flatMap(t=>Ca(t)):Object.entries(e.where).flatMap(([t,r])=>r===null||typeof r=="object"?[]:[{key:`${e.entity}.${t}`,kind:"field",value:r}])}import{z as Bp}from"zod";var jp=Bp.object({maxAttemptLength:Bp.number().int().positive()}),Pa={even:{maxAttemptLength:12}};function Vp(e){return Pa[e]}function ri(e){return{startingPoint:e.startingPoint.name,steps:Wp(e,e.startingPoint.snapshot,[])}}function Wp(e,t,r){if(r.length>=e.strategy.maxAttemptLength)return r;let n=Ro(e.facts,t),o=Zo(e.corpus,{snapshot:n},fx(e,r)),i=dx(o,e.corpus,e.random());return i==null?r:Wp(e,i.stepRun.next.snapshot,[...r,{idx:i.idx,params:i.params}])}var ux=.02;function dx(e,t,r){let n=e.map(a=>px(a.idx,t)),o=n.reduce((a,l)=>a+l,0);if(o<=0)return null;let i=r*o,s=n.reduce((a,l,c)=>{if(a.hit!=null)return a;let u=a.acc+l;return{acc:u,hit:u>i?c:null}},{acc:0,hit:null});return e[s.hit??e.length-1]??null}function px(e,t){return t[e]?.effectStep.action.kind==="goto"?ux:1}function fx(e,t){let r=Qo(t,e.corpus);return n=>mx({drawn:gr(n,r),params:e,prior:r,rule:n})}var hx=3;function mx({drawn:e,params:t,prior:r,rule:n}){return Object.fromEntries(Object.entries(e).map(([o,i])=>{let s=n.paramSpaces[o],a=s==null?void 0:t.literals.get(s.name);if(s==null||a==null||a.length===0)return[o,i];let l=r.get(s.name)??0;return l%hx!==1?[o,i]:[o,a[l%a.length]??i]}))}function Up(e){return Math.max(9e4,e*1e4)}import{z as x}from"zod";var zp=x.object({baseStateTest:Kc,lockfileHash:x.string().min(1),stepRuns:x.array(x.object({idx:x.number().int().nonnegative(),params:x.record(x.string(),x.union([gs,x.null()]))}))}),Gp=x.object({baseStateRef:x.string().min(1),steps:x.array(x.object({index:x.number().int().nonnegative(),params:x.record(x.string(),x.union([gs,x.null()])),test:x.string().min(1)}))}),Kp=x.object({actions:x.array(x.string()),label:x.string().min(1)}),Aa=x.object({test:x.string().min(1),text:x.string()}),ni=x.object({baseLabel:x.string(),baseState:x.string().min(1),durationMs:x.number().int().nonnegative(),signature:x.string().optional(),steps:x.array(Aa)}),Ma=x.enum(["driver","infra","trail"]),Oa=x.discriminatedUnion("source",[x.object({source:x.literal("empty-trail")}),x.object({source:x.literal("bad-assign")}),x.object({detail:x.string(),source:x.literal("config")}),x.object({source:x.literal("lockfile-stale")}),x.object({detail:x.string(),source:x.literal("transport")}),x.object({category:Ma,kind:x.string(),source:x.literal("runtime")})]);function qp(e){switch(e.source){case"empty-trail":case"bad-assign":return"trail";case"config":case"lockfile-stale":case"transport":return"infra";case"runtime":return e.category}}var Hp=x.discriminatedUnion("kind",[x.object({kind:x.literal("aborted")}),x.object({error:Oa,kind:x.literal("error")}),x.object({kind:x.literal("clean"),trail:ni}),x.object({kind:x.literal("flaky"),trail:ni}),x.object({kind:x.literal("seen"),trail:ni}),x.object({kind:x.literal("finding"),runId:x.string().optional(),trail:ni})]);function oi(e,{sweep:t}){let r=Ae(J(e),n=>b({a:n.test.actor,s:n.test.singletons,v:n.test.viewport,w:n.test.world})).map(n=>({name:n.ref,test:n.test}));return t?[...r,...r.flatMap(n=>gx(n))]:r}function yx(e){return e.world.filter(t=>{let r={...e,world:e.world.filter(n=>n!==t)};return Pu(r).every(n=>nr(n)!==t.as)})}function ii(e,t,r){return fr(e,t.test,r)}function gx(e){return yx(e.test).map(t=>{let r={...t,as:`${t.as}~2`},n=`${e.name} +${t.entity}`;return{name:n,test:{...e.test,name:n,world:[...e.test.world,r]}}})}async function si(e){let t=Xr(e);if(t.length===0)return null;let r=oi(e,{sweep:!1}),n=await Sx(e,r);if(n.length===0)return null;let o=ar(e);return{corpus:t,facts:{facts:o.facts.filter(i=>!i.localConsequence),overlays:Qe(e),overrides:o.overrides},literals:Ea(e),startingPoints:n,startingPointTests:new Map(r.map(i=>[i.name,i.test]))}}function Yp({lockfileHash:e,prepared:t,random:r,strategy:n}){let o=t.startingPoints[Math.floor(r()*t.startingPoints.length)];if(o==null)return null;let i=ri({corpus:t.corpus,facts:t.facts,literals:t.literals,random:r,startingPoint:o,strategy:n}),s=t.startingPointTests.get(i.startingPoint);return s==null||i.steps.length===0?null:{baseStateTest:s,lockfileHash:e,stepRuns:i.steps.map(a=>({idx:a.idx,params:a.params}))}}async function Sx(e,t){let r={generate:Br,materialize:Ko(Br,e.valueSpaces),params:void 0,signIn:void 0};return(await Promise.all(t.map(async o=>(await ii(e,o,r)).match(s=>({name:o.name,snapshot:s.snapshot}),()=>null)))).flatMap(o=>o==null?[]:[o])}import{createServer as $x}from"http";import{mkdir as Dx,rm as _x,writeFile as Bx}from"fs/promises";import jx from"path";import{z as F}from"zod";var Vx="otlp-port",Jp=F.object({key:F.string(),value:F.object({boolValue:F.boolean().optional(),doubleValue:F.number().optional(),intValue:F.union([F.string(),F.number()]).optional(),stringValue:F.string().optional()})}),Wx=F.object({attributes:F.array(Jp).default([]),endTimeUnixNano:F.string(),kind:F.number().default(0),name:F.string(),parentSpanId:F.string().optional(),spanId:F.string(),startTimeUnixNano:F.string(),status:F.object({code:F.number(),message:F.string().optional()}).optional(),traceId:F.string()}),Ux=F.object({resourceSpans:F.array(F.object({resource:F.object({attributes:F.array(Jp).default([])}).optional(),scopeSpans:F.array(F.object({spans:F.array(Wx).default([])})).default([])})).default([])});async function Ia({localDir:e,onRrwebBatch:t,onSpan:r,writePortFile:n}){let{port:o,server:i}=await zx({onRrwebBatch:t,onSpan:r}),s=jx.join(e,Vx);return n&&(await Dx(e,{recursive:!0}),await Bx(s,String(o),{encoding:"utf8"})),{port:o,stop:async()=>{n&&await _x(s,{force:!0}),await Yx(i)}}}function zx(e){return new Promise((t,r)=>{let n=$x((o,i)=>{Gx(o,i,e)});n.on("error",r),n.listen(0,()=>{let o=n.address();if(o==null||typeof o=="string"){r(new Error("otlp_receiver_no_port"));return}t({port:o.port,server:n})})})}function Gx(e,t,r){let n=Kx(e.url);if(n!=null){Zp(e).then(o=>{r.onRrwebBatch(n,o),ai(t)}).catch(()=>{ai(t)});return}Zp(e).then(o=>{qx(Ux.parse(JSON.parse(o.toString("utf8"))),r.onSpan),ai(t)}).catch(()=>{ai(t)})}function Kx(e){if(e==null||!e.startsWith("/rrweb/"))return;let t=decodeURIComponent(e.slice(7));return t.length===0?void 0:t}function Zp(e){return new Promise((t,r)=>{let n=[];e.on("data",o=>{n.push(o)}),e.on("end",()=>{t(Buffer.concat(n))}),e.on("error",r)})}function ai(e){e.writeHead(200,{"content-type":"application/json"}),e.end("{}")}function qx(e,t){e.resourceSpans.flatMap(r=>r.scopeSpans).flatMap(r=>r.spans).forEach(r=>{t({attributes:Hx(r.attributes),durationMs:Number((BigInt(r.endTimeUnixNano)-BigInt(r.startTimeUnixNano))/1000000n),kind:"span",name:r.name,parentSpanId:r.parentSpanId,source:"server",spanId:r.spanId,spanKind:$c(r.kind),status:{code:Dc(r.status?.code??0),message:r.status?.message},timeNanos:r.startTimeUnixNano,traceId:r.traceId})})}function Hx(e){return Object.fromEntries(e.map(({key:t,value:r})=>[t,String(r.stringValue??r.intValue??r.doubleValue??r.boolValue??"")]))}function Yx(e){return new Promise((t,r)=>{e.close(n=>{if(n==null){t();return}r(n)}),e.closeAllConnections()})}import{ResultAsync as wr}from"neverthrow";function Vt(e,t,r){if(t==null)throw new Error("action requires a locator");return pt(e,t,r)}function pt(e,t,r){if(t.by==="inside"){if(t.scope.by==="frame"){let i=pt(e,t.scope.element,{visibleOnly:!1});return pt(i.contentFrame(),t.target,r)}let o=pt(e,t.scope,r);return pt(o,t.target,r)}if(t.by==="surface")return pt(e,t.container,r);if(t.by==="frame")return pt(e,t.element,r);let n=t.by==="testId"?e.getByTestId(t.value):e.locator(Ta(t.role,t.name));return r.visibleOnly?n.filter({visible:!0}):n}function Ta(e,t){return t==null?`role=${e}`:`role=${e}[name=${JSON.stringify(t)}i]`}var La=3e4,br=class extends Error{mountKey;constructor(t){super("client-mount-unmounted"),this.mountKey=t}},Wt=class extends Error{readyKey;timeoutMs;constructor(t,r){super("app-not-ready"),this.readyKey=t,this.timeoutMs=r}};function Na(e){return{read:t=>Zx(t,e),seedScript:t=>`globalThis[${JSON.stringify(Gc)}] = ${JSON.stringify(t)};`}}async function Zx(e,t){let r=Se(rr(e.url()),Xp([[{kind:"title"},await e.title()],[{kind:"viewport"},ek(e.viewportSize())]]));if(t.length===0)return{scalars:r};let n=await e.evaluate(Xx,{mountKey:Ss,names:t,timeoutMs:Jx});if(n.kind==="unmounted")throw new br(Ss);let o=Xp(Object.entries(n.values).map(([i,s])=>[{kind:"variable",name:i},s]));return{scalars:Se(r,o)}}function Xp(e){return new Map(e.flatMap(([t,r])=>r===void 0?[]:[[R(t),{declared:!0,expect:{expect:"is",value:r},subject:t}]]))}var Jx=La;async function Xx(e){let t=Date.now()+e.timeoutMs;for(;Reflect.get(globalThis,e.mountKey)==null&&Date.now()<t;)await new Promise(n=>setTimeout(n,25));let r=Reflect.get(globalThis,e.mountKey);return r==null?{kind:"unmounted"}:{kind:"values",values:Object.fromEntries(e.names.map(n=>[n,r.readSingleton(n)??null]))}}var Qx=768;function ek(e){return e==null?"":e.width<Qx?"mobile":"desktop"}async function li({page:e,readiness:t,signal:r,startMs:n,tries:o,url:i}){if(be(r),!await tk(e,i)){if(Date.now()-n>=t.budgetMs)throw new Wt(qn,t.budgetMs);let a=t.backoffMs[Math.min(o,t.backoffMs.length-1)]??8e3;await vt(a,r),await li({page:e,readiness:t,signal:r,startMs:n,tries:o+1,url:i});return}let s=Math.max(0,t.budgetMs-(Date.now()-n));if(!await ik(e,r,Math.min(s,nk(t,o)))){if(Date.now()-n>=t.budgetMs)throw new Wt(qn,t.budgetMs);await li({page:e,readiness:t,signal:r,startMs:n,tries:o+1,url:i})}}function Fa(e){let t=e instanceof Error?e.message:String(e);return/net::ERR_|ERR_HTTP_RESPONSE_CODE_FAILURE|ECONNREFUSED|ECONNRESET|socket hang up|fetch failed|page\.goto: Timeout/.test(t)}function ci(e){let t=e instanceof Error?e.message:String(e);return/Execution context was destroyed|Cannot find context with specified id|[Ff]rame was detached|frame got detached/.test(t)}async function tk(e,t){let r=await rk(e,t);return r==="net-error"?!1:r==null||r.status()<400}async function rk(e,t){try{return await e.goto(t,{waitUntil:"domcontentloaded"})}catch(r){if(Fa(r))return"net-error";throw r}}function nk(e,t){return t===0?e.budgetMs/2:e.budgetMs}var ok=50;async function ik(e,t,r){let n=Date.now()+r;for(;Date.now()<n;){if(be(t),await Qp(e))return!0;await vt(ok,t)}return Qp(e)}async function Qp(e){try{return await e.evaluate(sk,qn)}catch(t){if(ci(t))return!1;throw t}}function sk(e){return Reflect.get(globalThis,e)===!0}async function $a(e,t,r){if(r.kind==="browser")return ak(e,t,r.key,r.value);if(r.kind==="not")return!await $a(e,t,r.inner);let n=Vt(e,r.locator,{visibleOnly:!0});return r.kind==="value"?ef(await n.inputValue(),r.value,r.match):r.kind==="text"?ef(await n.textContent()??"",r.value,r.match):r.kind==="unobstructed"?rf(n):nf(n,r.kind)}function ef(e,t,r){let n=tr(e),o=tr(t);return r==="contains"?n.includes(o):r==="startsWith"?n.startsWith(o):n===o}function rf(e){return e.evaluate(t=>{let r=t.getBoundingClientRect(),n=t.ownerDocument.defaultView;if(n==null||r.width<=0||r.height<=0)return!1;let o=2,i=Math.min(9,Math.max(3,Math.round(r.width/12))),s=Math.min(5,Math.max(2,Math.round(r.height/12))),a=(u,d,p)=>Array.from({length:p},(y,h)=>u+o+(d-o*2)*h/(p-1)),c=a(r.left,r.width,i).flatMap(u=>a(r.top,r.height,s).map(d=>({x:u,y:d}))).filter(u=>u.x>=0&&u.y>=0&&u.x<=n.innerWidth&&u.y<=n.innerHeight);return c.length===0?!1:c.every(u=>{let d=t.ownerDocument.elementFromPoint(u.x,u.y);return d!=null&&(d===t||t.contains(d)||d.contains(t))})})}function nf(e,t){return t==="visible"?e.isVisible():t==="disabled"?e.isDisabled():t==="enabled"?e.isEnabled():t==="checked"?e.isChecked():t==="expanded"?tf(e,r=>r.getAttribute("aria-expanded")==="true"):t==="pressed"?tf(e,r=>r.getAttribute("aria-pressed")==="true"):e.evaluate(r=>r===r.ownerDocument.activeElement)}async function tf(e,t){return await e.count()===0?!1:e.evaluate(t)}async function ak(e,t,r,n){let o=await t.read(e),i=ne(o.scalars,r);return n===null?i===void 0:i===n}async function of(e,t,r){let n=sf(r,!1);if(n.check.kind==="browser"){let s=await t.read(e),a=ne(s.scalars,n.check.key);return{kind:"wrongContent",observed:a===void 0?"":String(a)}}let o=Vt(e,n.check.locator,{visibleOnly:!0}),i=await o.count();return i>1?{count:i,kind:"multipleMatches"}:i===0?{kind:"notFound"}:lk(o,n.check)}function sf(e,t){return e.kind==="not"?sf(e.inner,!t):{check:e,negated:t}}async function lk(e,t){switch(t.kind){case"value":return{kind:"wrongContent",observed:await e.inputValue()};case"text":return{kind:"wrongContent",observed:await e.textContent()??""};case"unobstructed":{let r=await ck(e);return r==null?{kind:"wrongState",observed:{checkKind:"unobstructed",value:await rf(e)}}:{by:r,kind:"covered"}}case"visible":case"disabled":case"enabled":case"focused":case"checked":case"expanded":case"pressed":return{kind:"wrongState",observed:{checkKind:t.kind,value:await nf(e,t.kind)}}}}function ck(e){return e.evaluate(t=>{let r=t.getBoundingClientRect(),n=t.ownerDocument.elementFromPoint(r.left+r.width/2,r.top+r.height/2);if(n==null||n===t||t.contains(n)||n.contains(t))return null;let o=n.dataset.testid;return o==null?n.tagName.toLowerCase():`testId=${o}`})}var _a={backoffMs:[500,1e3,2e3,4e3,8e3],budgetMs:La},uk={readiness:_a,readSession:void 0,switchActor:void 0};function Ba(e,t,r,n,{readiness:o,readSession:i,switchActor:s}=uk){return{awaitCheck:(a,l)=>wr.fromPromise(wk({check:a,engine:r,page:e,signal:n,timeoutMs:l}),c=>un(c)?{kind:"aborted"}:yn(c)),diagnoseCheck:a=>wr.fromPromise(Da(of(e,r,a),`diagnose ${a.kind}`),yn),evaluate:a=>wr.fromPromise(Da(ja(e,r,a),`check ${a.kind}`),yn),locateIds:a=>Ok(e,a),observe:a=>wr.fromPromise(i==null?Promise.resolve(void 0):i(),yn).andThen(l=>fk(t.read(l))).andThen(l=>wr.fromPromise(Da(Rk({backend:l,engine:r,page:e,tracked:a}),"observe"),yn)),perform:a=>wr.fromPromise(uf(e,a,0,n,{readiness:o,switchActor:s}),l=>mk(a,l))}}function yn(e){return e instanceof br?Yn(e.mountKey):Zn(e)}async function ja(e,t,r){try{return await $a(e,t,r)}catch(n){if(ci(n)||pk(n))return!1;throw n}}var dk=/strict mode violation/;function pk(e){return e instanceof Error&&dk.test(e.message)}function fk(e){return e.mapErr(t=>t.kind==="action-failed"||t.kind==="check-failed"?Zn(new Error(hk(t.kind))):t)}function hk(e){return`unexpected ${e} while reading app state`}function mk(e,t){return t instanceof Wt?vs(t.readyKey,t.timeoutMs):t instanceof br?Yn(t.mountKey):Ps(e.kind,Sk(t))}var yk=/resolved to (\d+) elements/,gk=/(<[^<>]+>)[^<>]* intercepts pointer events/;function Sk(e){let t=e instanceof Error?e.message:String(e),r=yk.exec(t);if(r?.[1]!=null)return{count:Number(r[1]),kind:"multipleMatches"};let n=gk.exec(t);return n?.[1]!=null?{by:n[1],kind:"covered"}:e instanceof Error&&e.name==="TimeoutError"&&t.includes("waiting for")?{kind:"notFound"}:As(e)}var bk=75;function wk(e){return lf(e,Date.now()+e.timeoutMs)}async function lf(e,t){return be(e.signal),await ja(e.page,e.engine,e.check)?!0:Date.now()>=t?!1:(await vt(bk,e.signal),lf(e,t))}async function Rk({backend:e,engine:t,page:r,tracked:n}){let o=await cf(r,t,0),i=await vk(r,t,n);return{snapshot:{...e,scalars:new Map([...e.scalars,...o.scalars,...i])}}}async function vk(e,t,r){let n=await Promise.all([...r.values()].filter(o=>o.subject.kind==="element").map(async o=>{let i=await xk(e,t,o.subject);return[R(o.subject),{declared:!0,expect:{expect:"is",value:i},subject:o.subject}]}));return new Map(n)}async function xk(e,t,r){return r.state==="value"||r.state==="text"?kk(e,r.locator,r.state):ja(e,t,{kind:r.state,locator:r.locator})}async function kk(e,t,r){try{let n=Vt(e,t,{visibleOnly:!0});return r==="value"?await n.inputValue():await n.textContent()??""}catch{return""}}var Ck=[100,250,500];async function cf(e,t,r){try{return await t.read(e)}catch(n){let o=Ck[r];if(o==null||!ci(n))throw n;return await df(o),cf(e,t,r+1)}}var af=35e3;function Da(e,t){let r,n=new Promise((o,i)=>{r=setTimeout(()=>{i(new Error(`driver op "${t}" exceeded ${String(af)}ms`))},af)});return Promise.race([e,n]).finally(()=>{clearTimeout(r)})}var Ek=[250,750,2e3];async function uf(e,t,r,n,o){try{await Pk(e,t,n,o.readiness,o.switchActor)}catch(i){let s=Ek[r];if(s==null||!Fa(i))throw i;await df(s),await uf(e,t,r+1,n,o)}}async function Pk(e,t,r,n,o){if(t.kind==="actor"){if(o==null)throw new Error("this driver cannot switch actors");await o(xt(t.actorRef,t,"actorRef"));return}if(t.kind==="goto"){await li({page:e,readiness:n,signal:r,startMs:Date.now(),tries:0,url:xt(t.url,t,"url")});return}if(t.kind==="press"&&t.locator==null){await e.keyboard.press(xt(t.key,t,"key"));return}let i=t.kind!=="upload";await Ak(e,Vt(e,t.locator,{visibleOnly:i}),t)}function xt(e,t,r){if(e==null)throw new Error(`action "${t.kind}" requires ${r}`);return e}function Ak(e,t,r){switch(r.kind){case"goto":throw new Error("goto must not be located");case"fill":return t.fill(String(xt(r.value,r,"value")));case"clear":return t.clear();case"click":return t.click();case"dblclick":return t.dblclick();case"check":return t.check();case"uncheck":return t.uncheck();case"hover":return t.hover();case"select":return Mk(e,t,String(xt(r.value,r,"value")));case"upload":return t.setInputFiles(xt(r.files,r,"files"));case"press":return t.press(xt(r.key,r,"key"));case"drag":return t.dragTo(Vt(e,xt(r.target,r,"target"),{visibleOnly:!0}));case"actor":throw new Error("actor switch must not be located")}}async function Mk(e,t,r){if(await t.evaluate(o=>o.tagName==="SELECT")){await t.selectOption(r);return}await t.click(),await t.fill(r),await e.locator(Ta("option",r)).filter({visible:!0}).click()}function df(e){return new Promise(t=>{setTimeout(t,e)})}async function Ok(e,t){if(t==null)return[];try{let r=pt(e,t,{visibleOnly:!1});if(await r.count()===0)return[];let n=await r.first().evaluate(Ik);return n>0?[n]:[]}catch{return[]}}function Ik(e){let t=globalThis.__ripploRrwebMirror;if(t!=null)return t.getId(e);let r=globalThis.top;if(r==null||typeof r!="object"||!("__ripploRrwebMirror"in r))return-1;let n=r.__ripploRrwebMirror;if(n==null||typeof n!="object"||!("getId"in n))return-1;let o=n.getId;if(typeof o!="function")return-1;let i=o.call(n,e);return typeof i=="number"?i:-1}import Tk from"path";var ff={desktop:{height:720,width:1280},mobile:{height:844,width:390}};function hf(e){return ff[e]}var m_=ff.desktop;async function Va({baseUrl:e,browser:t,capture:r,clientState:n,engine:o,fixturesDir:i,networkHeaders:s,observeActor:a,reader:l,session:c,signal:u,signInActor:d,viewport:p}){let y=await t.newContext({baseURL:e,ignoreHTTPSErrors:!0,reducedMotion:"reduce",storageState:c==null?void 0:{cookies:Ua(c.cookies,e),origins:c.origins},viewport:p});s!=null&&await Fk(y,e,s),c?.headers!=null&&await y.setExtraHTTPHeaders(c.headers),await y.addInitScript("globalThis.__name = globalThis.__name ?? ((target) => target);"),await y.addInitScript(o.seedScript(n));let h=r==null?$k():await r.hub.attach(y,r.runId),f=await y.newPage();h.onPage(f);let m=f,v=Lk({baseUrl:e,context:y,page:f,signInActor:d}),w=a?Nk(e,y):void 0;return{context:y,driver:Bk(Dk(Ba(m,l,o,u,{readiness:_a,readSession:w,switchActor:v}),i),h),emitStepOutcome:h.emitStepOutcome,close:()=>jk({context:y,handle:h})}}async function Wa(e,t){let r=await yf(e,void 0);try{return await t(r)}finally{await r.close()}}async function mf(e){let{chromium:t}=await import("playwright");return t.launchPersistentContext(e,{headless:!1,viewport:null})}function Lk({baseUrl:e,context:t,page:r,signInActor:n}){if(n!=null)return async o=>{let i=await n(o).match(s=>s,s=>{throw new Error(`actor switch failed: ${s.kind}`)});await t.clearCookies(),await t.addCookies(Ua(i.cookies,e)),i.headers!=null&&await t.setExtraHTTPHeaders(i.headers),await r.reload()}}function Ua(e,t){let r=new URL(t).hostname;return e.map(n=>({...n,domain:r}))}function Nk(e,t){return async()=>{let r=await t.cookies();return{cookies:Ua(r,e),headers:void 0,origins:[]}}}async function Fk(e,t,r){let n=new URL(t).host;await e.route(o=>o.host===n,o=>o.continue({headers:{...o.request().headers(),...r}}))}function $k(){return{emitAction:()=>{},emitStepOutcome:()=>{},finish:()=>Promise.resolve(),onPage:()=>{}}}async function yf(e,t){let{chromium:r}=await import("playwright"),n=t==null?[]:[`--disk-cache-dir=${t}`,"--disk-cache-size=268435456"];return r.launch({args:n,headless:!e})}function ui({cacheDir:e,headed:t}){let r;return{acquire:async()=>{let i=r;if(i!=null){let s=await i.catch(()=>{});if(s?.isConnected()===!0)return s;r===i&&(r=void 0)}return r??=yf(t,e),r},close:async()=>{let i=r;r=void 0,i!=null&&await i.then(s=>s.close()).catch(()=>{})}}}function Dk(e,t){return{...e,perform:r=>e.perform(_k(r,t))}}function _k(e,t){return e.kind!=="upload"||e.files==null?e:{...e,files:e.files.map(r=>Tk.join(t,r))}}function Bk(e,t){return{...e,perform:r=>(t.emitAction(r),e.perform(r))}}async function jk({context:e,handle:t}){await pf(t.finish()),await pf(e.close())}var Vk=15e3;async function pf(e){let t,r=new Promise(n=>{t=setTimeout(n,Vk)});await Promise.race([e.catch(()=>{}),r]).finally(()=>{clearTimeout(t)})}import{err as Wk,ok as Uk,Result as za}from"neverthrow";function Ga(e,t,r){return{read:n=>r.read(e.map(o=>o.name),t,n).andThen(o=>zk(e,o))}}function zk(e,t){return za.combine(e.map(r=>Gk(r,t.entities[r.name]??[]).map(n=>[r.name,n]))).map(r=>({entities:new Map(r),scalars:new Map([...Hk(t.singletons),...Yk(t.actor)])}))}function Gk(e,t){let r=pn(e);return za.combine(t.map(n=>Kk(n,e).map(o=>[o,qk(n,r)]))).map(n=>new Map(n))}function Kk(e,t){return za.combine(t.identity.map(r=>{let n=e[r];return n==null?Wk(ks(t.name,r)):Uk(String(n))})).map(r=>r.join(":"))}function qk(e,t){let r=t.map(n=>[n,e[n]]).filter(n=>n[1]!=null);return Object.fromEntries(r)}function Hk(e){return Object.entries(e).map(([t,r])=>[R({kind:"variable",name:t}),{declared:!0,expect:{expect:"is",value:r},subject:{kind:"variable",name:t}}])}function Yk(e){return e==null?[]:[[R({kind:"actor"}),{declared:!1,expect:{expect:"is",value:e},subject:{kind:"actor"}}]]}var gf=Oc(By(),1);import Zk from"crypto";import{err as Jk,errAsync as Ka,ok as Xk,ResultAsync as Rr}from"neverthrow";var Qk=1e4,eC=[250,750,2e3],tC=[500,1e3,2e3,3e3];function qa({baseUrl:e,extraHeaders:t,runId:r,secret:n},o){let i=new gf.Webhook(n),s=(a,l,c)=>rC({baseUrl:e,body:l,extraHeaders:t,path:a,retry:c.retry,schema:c.schema,signal:c.signal,webhook:i});return{query:{read:(a,l,c)=>s("/state",{entities:a,runId:r,session:c,singletons:l},{retry:"transient",schema:Zc,signal:o}).map(u=>({actor:u.actor,entities:u.entities,singletons:u.singletons}))},ready:()=>bf(e,t,o,0),setupWorld:a=>s("/setup",{entities:a,runId:r},{retry:"connection",schema:Hc,signal:o}).map(l=>l.rows),signIn:({entity:a,row:l})=>s("/sign-in",{entity:a,row:l,runId:r},{retry:"connection",schema:Yc,signal:o}).map(c=>c.session),teardown:()=>s("/teardown",{runId:r},{retry:"connection",schema:Jc,signal:void 0}).map(()=>{})}}function rC(e){return Sf(e.retry,()=>sC(e),0)}function Sf(e,t,r){return t().orElse(n=>{let o=eC[r];return o==null||!oC(n,e)?Ka(n):Rr.fromSafePromise(wf(o)).andThen(()=>Sf(e,t,r+1))})}function bf(e,t,r,n){return Rr.fromPromise(fetch(e,{headers:t,method:"HEAD",signal:Rf(r)}),o=>Xt("",o)).map(()=>{}).orElse(()=>{let o=tC[n];return o==null||r.aborted?Ka(Es(e)):Rr.fromSafePromise(wf(o)).andThen(()=>bf(e,t,r,n+1))})}var nC=new Set(["EAI_AGAIN","ECONNREFUSED","ENOTFOUND"]);function oC(e,t){return e.kind==="aborted"?!1:iC(e)?!0:t==="connection"?!1:e.kind==="engine-network"||e.kind==="engine-http"&&e.status>=500}function iC(e){return e.kind==="engine-network"&&e.code!=null&&nC.has(e.code)}function wf(e){return new Promise(t=>{setTimeout(t,e)})}function sC({baseUrl:e,body:t,extraHeaders:r,path:n,schema:o,signal:i,webhook:s}){let a=JSON.stringify(t);return Rr.fromPromise(fetch(`${e}${n}`,{body:a,headers:{...r,"Content-Type":"application/json",...aC(s,a)},method:"PUT",signal:Rf(i)}),l=>Xt(n,l)).andThen(l=>lC(l,n)).andThen(l=>cC(o,l,n)).mapErr(l=>i?.aborted===!0?Ms():l)}function aC(e,t){let r=`msg_${Zk.randomUUID()}`,n=new Date;return{"webhook-id":r,"webhook-signature":e.sign(r,n,t),"webhook-timestamp":String(Math.floor(n.getTime()/1e3))}}function Rf(e){let t=AbortSignal.timeout(Qk);return e==null?t:AbortSignal.any([e,t])}function lC(e,t){return e.ok?Rr.fromPromise(e.json(),r=>Xt(t,r)):Rr.fromPromise(e.text().catch(()=>""),r=>Xt(t,r)).andThen(r=>Ka(Rs(t,e.status,r)))}function cC(e,t,r){let n=e.safeParse(t);return n.success?Xk(n.data):Jk(xs(r,n.error))}import lI from"path";import{err as Zt,errAsync as cI,ok as Fr,ResultAsync as vc}from"neverthrow";import ky from"path";import{z as Ue}from"zod";import uC from"path";function vf({debugDir:e,runId:t,worker:r}){let n=uC.join(e,t,"behavior.jsonl");return r.open({file:n,runId:t}),{close:o=>r.close({noticeLineIfNoRrweb:o?.noticeIfNoRrweb==null?"":JSON.stringify(dC(o.noticeIfNoRrweb)),runId:t}),emit:o=>{let i={...o,timestamp:pC(o.timeNanos)};r.line({line:JSON.stringify(i),runId:t,timeNanos:o.timeNanos})},emitRrwebBatch:o=>{r.rrwebBatch({data:o,runId:t})}}}function Ut(e){return String(BigInt(Math.round(e))*1000000n)}function dC(e){return{kind:"notice",message:e,source:"capture",timeNanos:"0"}}function pC(e){return Number(BigInt(e)/1000000n)}import{existsSync as fC}from"fs";import{createRequire as hC}from"module";import{fileURLToPath as mC}from"url";import{Worker as yC}from"worker_threads";var gC=hC(import.meta.url);function xf(e){let t=new yC(SC(),{workerData:e});t.unref();let r=new Map,n={next:0};t.on("message",i=>{let s=r.get(i.seq);s!=null&&(r.delete(i.seq),s())});let o=i=>{t.postMessage(i)};return{close:({noticeLineIfNoRrweb:i,runId:s})=>{let a=n.next;return n.next+=1,new Promise(l=>{r.set(a,l),o({noticeLineIfNoRrweb:i,runId:s,seq:a,t:"close"})})},line:({line:i,runId:s,timeNanos:a})=>{o({line:i,runId:s,t:"line",timeNanos:a})},open:({file:i,runId:s})=>{o({file:i,runId:s,t:"open"})},rrwebBatch:({data:i,runId:s})=>{o({data:i,runId:s,t:"rrweb-batch"})},terminate:async()=>{await t.terminate()}}}function SC(){try{return gC.resolve("@ripplo/runtime/capture-worker")}catch{let e=["../../dist/capture-worker.js","./capture-worker.js"].map(r=>mC(new URL(r,import.meta.url))),t=e.find(r=>fC(r));if(t==null)throw new Error(`capture-worker.js not found; looked at: ${e.join(", ")}`);return t}}import{readFile as bC}from"fs/promises";import{createRequire as wC}from"module";import{fileURLToPath as RC}from"url";var vC=wC(import.meta.url);function Ha(e,t){try{return vC.resolve(e)}catch{return RC(new URL(`assets/${t}`,import.meta.url))}}function Ya(e){let t;return()=>(t??=bC(e,"utf8"),t)}var xC=Ya(Ha("@ripplo/browser-trace/bundle","browser-trace.js"));async function kf(e,t){await e.addInitScript(`globalThis.__ripploRunId = ${JSON.stringify(t)};`),await e.addInitScript(await xC())}var kC=Object.defineProperty,CC=(e,t,r)=>t in e?kC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,S=(e,t,r)=>CC(e,typeof t!="symbol"?t+"":t,r),Cf,EC=Object.defineProperty,PC=(e,t,r)=>t in e?EC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ef=(e,t,r)=>PC(e,typeof t!="symbol"?t+"":t,r),se=(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))(se||{}),Pf={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Af={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},di={},AC=()=>!!globalThis.Zone;function Ql(e){if(di[e])return di[e];let t=globalThis[e],r=t.prototype,n=e in Pf?Pf[e]:void 0,o=!!(n&&n.every(a=>{var l,c;return!!((c=(l=Object.getOwnPropertyDescriptor(r,a))==null?void 0:l.get)!=null&&c.toString().includes("[native code]"))})),i=e in Af?Af[e]:void 0,s=!!(i&&i.every(a=>{var l;return typeof r[a]=="function"&&((l=r[a])==null?void 0:l.toString().includes("[native code]"))}));if(o&&s&&!AC())return di[e]=t.prototype,t.prototype;try{let a=document.createElement("iframe");document.body.appendChild(a);let l=a.contentWindow;if(!l)return t.prototype;let c=l[e].prototype;return document.body.removeChild(a),c?di[e]=c:r}catch{return r}}var Za={};function yt(e,t,r){var n;let o=`${e}.${String(r)}`;if(Za[o])return Za[o].call(t);let i=Ql(e),s=(n=Object.getOwnPropertyDescriptor(i,r))==null?void 0:n.get;return s?(Za[o]=s,s.call(t)):t[r]}var Ja={};function Ch(e,t,r){let n=`${e}.${String(r)}`;if(Ja[n])return Ja[n].bind(t);let i=Ql(e)[r];return typeof i!="function"?t[r]:(Ja[n]=i,i.bind(t))}function MC(e){return yt("Node",e,"ownerDocument")}function OC(e){return yt("Node",e,"childNodes")}function IC(e){return yt("Node",e,"parentNode")}function TC(e){return yt("Node",e,"parentElement")}function LC(e){return yt("Node",e,"textContent")}function NC(e,t){return Ch("Node",e,"contains")(t)}function FC(e){return Ch("Node",e,"getRootNode")()}function $C(e){return!e||!("host"in e)?null:yt("ShadowRoot",e,"host")}function DC(e){return e.styleSheets}function _C(e){return!e||!("shadowRoot"in e)?null:yt("Element",e,"shadowRoot")}function BC(e,t){return yt("Element",e,"querySelector")(t)}function jC(e,t){return yt("Element",e,"querySelectorAll")(t)}function VC(){return Ql("MutationObserver").constructor}function WC(e,t,r){try{if(!(t in e))return()=>{};let n=e[t],o=r(n);return typeof o=="function"&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=o,()=>{e[t]=n}}catch{return()=>{}}}var de={ownerDocument:MC,childNodes:OC,parentNode:IC,parentElement:TC,textContent:LC,contains:NC,getRootNode:FC,host:$C,styleSheets:DC,shadowRoot:_C,querySelector:BC,querySelectorAll:jC,mutationObserver:VC,patch:WC};function Eh(e){return e.nodeType===e.ELEMENT_NODE}function vn(e){let t=e&&"host"in e&&"mode"in e&&de.host(e)||null;return!!(t&&"shadowRoot"in t&&de.shadowRoot(t)===e)}function xn(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function UC(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 zC(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 ul(e){try{let t=e.rules||e.cssRules;if(!t)return null;let r=e.href;!r&&e.ownerNode&&(r=e.ownerNode.baseURI);let n=Array.from(t,o=>Ph(o,r)).join("");return UC(n)}catch{return null}}function Ph(e,t){if(KC(e)){let r;try{r=ul(e.styleSheet)||zC(e)}catch{r=e.cssText}return e.styleSheet.href?Ui(r,e.styleSheet.href):r}else{let r=e.cssText;return qC(e)&&e.selectorText.includes(":")&&(r=GC(r)),t?Ui(r,t):r}}function GC(e){let t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function KC(e){return"styleSheet"in e}function qC(e){return"selectorText"in e}var ji=class{constructor(){Ef(this,"idNodeMap",new Map),Ef(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(n=>this.removeNodeFromMap(n))}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,r){let n=r.id;this.idNodeMap.set(n,t),this.nodeMetaMap.set(t,r)}replace(t,r){let n=this.getNode(t);if(n){let o=this.nodeMetaMap.get(n);o&&this.nodeMetaMap.set(r,o)}this.idNodeMap.set(t,r)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function HC(){return new ji}function Vi({element:e,maskInputOptions:t,tagName:r,type:n,value:o,maskInputFn:i}){let s=o||"",a=n&&Gt(n);return(t[r.toLowerCase()]||a&&t[a])&&(i?s=i(s,e):s="*".repeat(s.length)),s}function Gt(e){return e.toLowerCase()}var Mf="__rrweb_original__";function YC(e){let t=e.getContext("2d");if(!t)return!0;let r=50;for(let n=0;n<e.width;n+=r)for(let o=0;o<e.height;o+=r){let i=t.getImageData,s=Mf in i?i[Mf]:i;if(new Uint32Array(s.call(t,n,o,Math.min(r,e.width-n),Math.min(r,e.height-o)).data.buffer).some(l=>l!==0))return!1}return!0}function Wi(e){let t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?Gt(t):null}function Ah(e,t){let r;try{r=new URL(e,t??window.location.href)}catch{return null}let n=/\.([0-9a-z]+)(?:$)/i,o=r.pathname.match(n);return o?.[1]??null}function ZC(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var JC=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,XC=/^(?:[a-z+]+:)?\/\//i,QC=/^www\..*/i,eE=/^(data:)([^,]*),(.*)/i;function Ui(e,t){return(e||"").replace(JC,(r,n,o,i,s,a)=>{let l=o||s||a,c=n||i||"";if(!l)return r;if(XC.test(l)||QC.test(l))return`url(${c}${l}${c})`;if(eE.test(l))return`url(${c}${l}${c})`;if(l[0]==="/")return`url(${c}${ZC(t)+l}${c})`;let u=t.split("/"),d=l.split("/");u.pop();for(let p of d)p!=="."&&(p===".."?u.pop():u.push(p));return`url(${c}${u.join("/")}${c})`})}function pi(e,t=!1){return t?e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,""):e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"").replace(/0px/g,"0")}function tE(e,t,r=!1){let n=Array.from(t.childNodes),o=[],i=0;if(n.length>1&&e&&typeof e=="string"){let s=pi(e,r),a=s.length/e.length;for(let l=1;l<n.length;l++)if(n[l].textContent&&typeof n[l].textContent=="string"){let c=pi(n[l].textContent,r),u=100,d=3;for(;d<c.length&&(c[d].match(/[a-zA-Z0-9]/)||c.indexOf(c.substring(0,d),1)!==-1);d++);for(;d<c.length;d++){let p=c.substring(0,d),y=s.split(p),h=-1;if(y.length===2)h=y[0].length;else if(y.length>2&&y[0]===""&&n[l-1].textContent!=="")h=s.indexOf(p,1);else if(y.length===1){if(p=p.substring(0,p.length-1),y=s.split(p),y.length<=1)return o.push(e),o;d=u+1}else d===c.length-1&&(h=s.indexOf(p));if(y.length>=2&&d>u){let f=n[l-1].textContent;if(f&&typeof f=="string"){let m=pi(f).length;h=s.indexOf(p,m)}h===-1&&(h=y[0].length)}if(h!==-1){let f=Math.floor(h/a);for(;f>0&&f<e.length;){if(i+=1,i>50*n.length)return o.push(e),o;let m=pi(e.substring(0,f),r);if(m.length===h){o.push(e.substring(0,f)),e=e.substring(f),s=s.substring(h);break}else m.length<h?f+=Math.max(1,Math.floor((h-m.length)/a)):f-=Math.max(1,Math.floor((m.length-h)*a))}break}}}}return o.push(e),o}function rE(e,t){return tE(e,t).join("/* rr_split */")}var nE=1,oE=new RegExp("[^a-z0-9-_:]"),Cn=-2;function Mh(){return nE++}function iE(e){if(e instanceof HTMLFormElement)return"form";let t=Gt(e.tagName);return oE.test(t)?"div":t}var vr,Of,sE=/^[^ \t\n\r\u000c]+/,aE=/^[, \t\n\r\u000c]+/;function lE(e,t){if(t.trim()==="")return t;let r=0;function n(i){let s,a=i.exec(t.substring(r));return a?(s=a[0],r+=s.length,s):""}let o=[];for(;n(aE),!(r>=t.length);){let i=n(sE);if(i.slice(-1)===",")i=Cr(e,i.substring(0,i.length-1)),o.push(i);else{let s="";i=Cr(e,i);let a=!1;for(;;){let l=t.charAt(r);if(l===""){o.push((i+s).trim());break}else if(a)l===")"&&(a=!1);else if(l===","){r+=1,o.push((i+s).trim());break}else l==="("&&(a=!0);s+=l,r+=1}}}return o.join(", ")}var If=new WeakMap;function Cr(e,t){return!t||t.trim()===""?t:ec(e,t)}function cE(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function ec(e,t){let r=If.get(e);if(r||(r=e.createElement("a"),If.set(e,r)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return r.setAttribute("href",t),r.href}function Oh(e,t,r,n){return n&&(r==="src"||r==="href"&&!(t==="use"&&n[0]==="#")||r==="xlink:href"&&n[0]!=="#"||r==="background"&&["table","td","th"].includes(t)?Cr(e,n):r==="srcset"?lE(e,n):r==="style"?Ui(n,ec(e)):t==="object"&&r==="data"?Cr(e,n):n)}function Ih(e,t,r){return["video","audio"].includes(e)&&t==="autoplay"}function uE(e,t,r){try{if(typeof t=="string"){if(e.classList.contains(t))return!0}else for(let n=e.classList.length;n--;){let o=e.classList[n];if(t.test(o))return!0}if(r)return e.matches(r)}catch{}return!1}function zi(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return r?zi(de.parentNode(e),t,r):!1;for(let n=e.classList.length;n--;){let o=e.classList[n];if(t.test(o))return!0}return r?zi(de.parentNode(e),t,r):!1}function Th(e,t,r,n){let o;if(Eh(e)){if(o=e,!de.childNodes(o).length)return!1}else{if(de.parentElement(e)===null)return!1;o=de.parentElement(e)}try{if(typeof t=="string"){if(n){if(o.closest(`.${t}`))return!0}else if(o.classList.contains(t))return!0}else if(zi(o,t,n))return!0;if(r){if(n){if(o.closest(r))return!0}else if(o.matches(r))return!0}}catch{}return!1}function dE(e,t,r){let n=e.contentWindow;if(!n)return;let o=!1,i;try{i=n.document.readyState}catch{return}if(i!=="complete"){let a=setTimeout(()=>{o||(t(),o=!0)},r);e.addEventListener("load",()=>{clearTimeout(a),o=!0,t()});return}let s="about:blank";if(n.location.href!==s||e.src===s||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}function pE(e,t,r){let n=!1,o;try{o=e.sheet}catch{return}if(o)return;let i=setTimeout(()=>{n||(t(),n=!0)},r);e.addEventListener("load",()=>{clearTimeout(i),n=!0,t()})}function fE(e,t){let{doc:r,mirror:n,blockClass:o,blockSelector:i,needsMask:s,inlineStylesheet:a,maskInputOptions:l={},maskTextFn:c,maskInputFn:u,dataURLOptions:d={},inlineImages:p,recordCanvas:y,keepIframeSrcFn:h,newlyAddedElement:f=!1,cssCaptured:m=!1}=t,v=hE(r,n);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:se.Document,childNodes:[],compatMode:e.compatMode}:{type:se.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:se.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:v};case e.ELEMENT_NODE:return yE(e,{doc:r,blockClass:o,blockSelector:i,inlineStylesheet:a,maskInputOptions:l,maskInputFn:u,dataURLOptions:d,inlineImages:p,recordCanvas:y,keepIframeSrcFn:h,newlyAddedElement:f,rootId:v});case e.TEXT_NODE:return mE(e,{doc:r,needsMask:s,maskTextFn:c,rootId:v,cssCaptured:m});case e.CDATA_SECTION_NODE:return{type:se.CDATA,textContent:"",rootId:v};case e.COMMENT_NODE:return{type:se.Comment,textContent:de.textContent(e)||"",rootId:v};default:return!1}}function hE(e,t){if(!t.hasNode(e))return;let r=t.getId(e);return r===1?void 0:r}function mE(e,t){let{needsMask:r,maskTextFn:n,rootId:o,cssCaptured:i}=t,s=de.parentNode(e),a=s&&s.tagName,l="",c=a==="STYLE"?!0:void 0,u=a==="SCRIPT"?!0:void 0;return u?l="SCRIPT_PLACEHOLDER":i||(l=de.textContent(e),c&&l&&(l=Ui(l,ec(t.doc)))),!c&&!u&&l&&r&&(l=n?n(l,de.parentElement(e)):l.replace(/[\S]/g,"*")),{type:se.Text,textContent:l||"",rootId:o}}function yE(e,t){let{doc:r,blockClass:n,blockSelector:o,inlineStylesheet:i,maskInputOptions:s={},maskInputFn:a,dataURLOptions:l={},inlineImages:c,recordCanvas:u,keepIframeSrcFn:d,newlyAddedElement:p=!1,rootId:y}=t,h=uE(e,n,o),f=iE(e),m={},v=e.attributes.length;for(let g=0;g<v;g++){let k=e.attributes[g];Ih(f,k.name,k.value)||(m[k.name]=Oh(r,f,Gt(k.name),k.value))}if(f==="link"&&i){let g=Array.from(r.styleSheets).find(_=>_.href===e.href),k=null;g&&(k=ul(g)),k&&(delete m.rel,delete m.href,m._cssText=k)}if(f==="style"&&e.sheet){let g=ul(e.sheet);g&&(e.childNodes.length>1&&(g=rE(g,e)),m._cssText=g)}if(["input","textarea","select"].includes(f)){let g=e.value,k=e.checked;m.type!=="radio"&&m.type!=="checkbox"&&m.type!=="submit"&&m.type!=="button"&&g?m.value=Vi({element:e,type:Wi(e),tagName:f,value:g,maskInputOptions:s,maskInputFn:a}):k&&(m.checked=k)}if(f==="option"&&(e.selected&&!s.select?m.selected=!0:delete m.selected),f==="dialog"&&e.open&&(m.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"),f==="canvas"&&u){if(e.__context==="2d")YC(e)||(m.rr_dataURL=e.toDataURL(l.type,l.quality));else if(!("__context"in e)){let g=e.toDataURL(l.type,l.quality),k=r.createElement("canvas");k.width=e.width,k.height=e.height;let _=k.toDataURL(l.type,l.quality);g!==_&&(m.rr_dataURL=g)}}if(f==="img"&&c){vr||(vr=r.createElement("canvas"),Of=vr.getContext("2d"));let g=e,k=g.currentSrc||g.getAttribute("src")||"<unknown-src>",_=g.crossOrigin,V=()=>{g.removeEventListener("load",V);try{vr.width=g.naturalWidth,vr.height=g.naturalHeight,Of.drawImage(g,0,0),m.rr_dataURL=vr.toDataURL(l.type,l.quality)}catch(te){if(g.crossOrigin!=="anonymous"){g.crossOrigin="anonymous",g.complete&&g.naturalWidth!==0?V():g.addEventListener("load",V);return}else console.warn(`Cannot inline img src=${k}! Error: ${te}`)}g.crossOrigin==="anonymous"&&(_?m.crossOrigin=_:g.removeAttribute("crossorigin"))};g.complete&&g.naturalWidth!==0?V():g.addEventListener("load",V)}if(["audio","video"].includes(f)){let g=m;g.rr_mediaState=e.paused?"paused":"played",g.rr_mediaCurrentTime=e.currentTime,g.rr_mediaPlaybackRate=e.playbackRate,g.rr_mediaMuted=e.muted,g.rr_mediaLoop=e.loop,g.rr_mediaVolume=e.volume}if(p||(e.scrollLeft&&(m.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(m.rr_scrollTop=e.scrollTop)),h){let{width:g,height:k}=e.getBoundingClientRect();m={class:m.class,rr_width:`${g}px`,rr_height:`${k}px`}}f==="iframe"&&!d(m.src)&&(e.contentDocument||(m.rr_src=m.src),delete m.src);let w;try{customElements.get(f)&&(w=!0)}catch{}return{type:se.Element,tagName:f,attributes:m,childNodes:[],isSVG:cE(e)||void 0,needBlock:h,rootId:y,isCustom:w}}function W(e){return e==null?"":e.toLowerCase()}function Lh(e){return e===!0||e==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:e==="all",headMetaDescKeywords:e==="all",headTitleMutations:e==="all"}:e||{}}function gE(e,t){if(t.comment&&e.type===se.Comment)return!0;if(e.type===se.Element){if(t.script&&(e.tagName==="script"||e.tagName==="link"&&(e.attributes.rel==="preload"&&e.attributes.as==="script"||e.attributes.rel==="modulepreload")||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&Ah(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(W(e.attributes.name).match(/^msapplication-tile(image|color)$/)||W(e.attributes.name)==="application-name"||W(e.attributes.rel)==="icon"||W(e.attributes.rel)==="apple-touch-icon"||W(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&W(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(W(e.attributes.property).match(/^(og|twitter|fb):/)||W(e.attributes.name).match(/^(og|twitter):/)||W(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(W(e.attributes.name)==="robots"||W(e.attributes.name)==="googlebot"||W(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(W(e.attributes.name)==="author"||W(e.attributes.name)==="generator"||W(e.attributes.name)==="framework"||W(e.attributes.name)==="publisher"||W(e.attributes.name)==="progid"||W(e.attributes.property).match(/^article:/)||W(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(W(e.attributes.name)==="google-site-verification"||W(e.attributes.name)==="yandex-verification"||W(e.attributes.name)==="csrf-token"||W(e.attributes.name)==="p:domain_verify"||W(e.attributes.name)==="verify-v1"||W(e.attributes.name)==="verification"||W(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function Er(e,t){let{doc:r,mirror:n,blockClass:o,blockSelector:i,maskTextClass:s,maskTextSelector:a,skipChild:l=!1,inlineStylesheet:c=!0,maskInputOptions:u={},maskTextFn:d,maskInputFn:p,slimDOMOptions:y,dataURLOptions:h={},inlineImages:f=!1,recordCanvas:m=!1,onSerialize:v,onIframeLoad:w,iframeLoadTimeout:g=5e3,onStylesheetLoad:k,stylesheetLoadTimeout:_=5e3,keepIframeSrcFn:V=()=>!1,newlyAddedElement:te=!1,cssCaptured:G=!1}=t,{needsMask:Q}=t,{preserveWhiteSpace:le=!0}=t;Q||(Q=Th(e,s,a,Q===void 0));let Me=fE(e,{doc:r,mirror:n,blockClass:o,blockSelector:i,needsMask:Q,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:p,dataURLOptions:h,inlineImages:f,recordCanvas:m,keepIframeSrcFn:V,newlyAddedElement:te,cssCaptured:G});if(!Me)return console.warn(e,"not serialized"),null;let ze;n.hasNode(e)?ze=n.getId(e):gE(Me,y)||!le&&Me.type===se.Text&&!Me.textContent.replace(/^\s+|\s+$/gm,"").length?ze=Cn:ze=Mh();let T=Object.assign(Me,{id:ze});if(n.add(e,T),ze===Cn)return null;v&&v(e);let Dr=!l;if(T.type===se.Element){Dr=Dr&&!T.needBlock,delete T.needBlock;let re=de.shadowRoot(e);re&&xn(re)&&(T.isShadowHost=!0)}if((T.type===se.Document||T.type===se.Element)&&Dr){y.headWhitespace&&T.type===se.Element&&T.tagName==="head"&&(le=!1);let re={doc:r,mirror:n,blockClass:o,blockSelector:i,needsMask:Q,maskTextClass:s,maskTextSelector:a,skipChild:l,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:p,slimDOMOptions:y,dataURLOptions:h,inlineImages:f,recordCanvas:m,preserveWhiteSpace:le,onSerialize:v,onIframeLoad:w,iframeLoadTimeout:g,onStylesheetLoad:k,stylesheetLoadTimeout:_,keepIframeSrcFn:V,cssCaptured:!1};if(!(T.type===se.Element&&T.tagName==="textarea"&&T.attributes.value!==void 0)){T.type===se.Element&&T.attributes._cssText!==void 0&&typeof T.attributes._cssText=="string"&&(re.cssCaptured=!0);for(let Ct of Array.from(de.childNodes(e))){let Ge=Er(Ct,re);Ge&&T.childNodes.push(Ge)}}let Oe=null;if(Eh(e)&&(Oe=de.shadowRoot(e)))for(let Ct of Array.from(de.childNodes(Oe))){let Ge=Er(Ct,re);Ge&&(xn(Oe)&&(Ge.isShadow=!0),T.childNodes.push(Ge))}}let _r=de.parentNode(e);return _r&&vn(_r)&&xn(_r)&&(T.isShadow=!0),T.type===se.Element&&T.tagName==="iframe"&&dE(e,()=>{let re=e.contentDocument;if(re&&w){let Oe=Er(re,{doc:re,mirror:n,blockClass:o,blockSelector:i,needsMask:Q,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:p,slimDOMOptions:y,dataURLOptions:h,inlineImages:f,recordCanvas:m,preserveWhiteSpace:le,onSerialize:v,onIframeLoad:w,iframeLoadTimeout:g,onStylesheetLoad:k,stylesheetLoadTimeout:_,keepIframeSrcFn:V});Oe&&w(e,Oe)}},g),T.type===se.Element&&T.tagName==="link"&&typeof T.attributes.rel=="string"&&(T.attributes.rel==="stylesheet"||T.attributes.rel==="preload"&&typeof T.attributes.href=="string"&&Ah(T.attributes.href)==="css")&&pE(e,()=>{if(k){let re=Er(e,{doc:r,mirror:n,blockClass:o,blockSelector:i,needsMask:Q,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:p,slimDOMOptions:y,dataURLOptions:h,inlineImages:f,recordCanvas:m,preserveWhiteSpace:le,onSerialize:v,onIframeLoad:w,iframeLoadTimeout:g,onStylesheetLoad:k,stylesheetLoadTimeout:_,keepIframeSrcFn:V});re&&k(e,re)}},_),T}function SE(e,t){let{mirror:r=new ji,blockClass:n="rr-block",blockSelector:o=null,maskTextClass:i="rr-mask",maskTextSelector:s=null,inlineStylesheet:a=!0,inlineImages:l=!1,recordCanvas:c=!1,maskAllInputs:u=!1,maskTextFn:d,maskInputFn:p,slimDOM:y=!1,dataURLOptions:h,preserveWhiteSpace:f,onSerialize:m,onIframeLoad:v,iframeLoadTimeout:w,onStylesheetLoad:g,stylesheetLoadTimeout:k,keepIframeSrcFn:_=()=>!1}=t||{},V=u===!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}:u===!1?{password:!0}:u,te=Lh(y);return Er(e,{doc:e,mirror:r,blockClass:n,blockSelector:o,maskTextClass:i,maskTextSelector:s,skipChild:!1,inlineStylesheet:a,maskInputOptions:V,maskTextFn:d,maskInputFn:p,slimDOMOptions:te,dataURLOptions:h,inlineImages:l,recordCanvas:c,preserveWhiteSpace:f,onSerialize:m,onIframeLoad:v,iframeLoadTimeout:w,onStylesheetLoad:g,stylesheetLoadTimeout:k,keepIframeSrcFn:_,newlyAddedElement:!1})}var bE=/(max|min)-device-(width|height)/,$_=new RegExp(bE.source,"g");function wE(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function RE(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var r=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}),r}var tc={exports:{}},U=String,Nh=function(){return{isColorSupported:!1,reset:U,bold:U,dim:U,italic:U,underline:U,inverse:U,hidden:U,strikethrough:U,black:U,red:U,green:U,yellow:U,blue:U,magenta:U,cyan:U,white:U,gray:U,bgBlack:U,bgRed:U,bgGreen:U,bgYellow:U,bgBlue:U,bgMagenta:U,bgCyan:U,bgWhite:U}};tc.exports=Nh();tc.exports.createColors=Nh;var vE=tc.exports,xE={},kE=Object.freeze(Object.defineProperty({__proto__:null,default:xE},Symbol.toStringTag,{value:"Module"})),Ve=RE(kE),Tf=vE,Lf=Ve,dl=class Fh extends Error{constructor(t,r,n,o,i,s){super(t),this.name="CssSyntaxError",this.reason=t,i&&(this.file=i),o&&(this.source=o),s&&(this.plugin=s),typeof r<"u"&&typeof n<"u"&&(typeof r=="number"?(this.line=r,this.column=n):(this.line=r.line,this.column=r.column,this.endLine=n.line,this.endColumn=n.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,Fh)}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(t){if(!this.source)return"";let r=this.source;t==null&&(t=Tf.isColorSupported),Lf&&t&&(r=Lf(r));let n=r.split(/\r?\n/),o=Math.max(this.line-3,0),i=Math.min(this.line+2,n.length),s=String(i).length,a,l;if(t){let{bold:c,gray:u,red:d}=Tf.createColors(!0);a=p=>c(d(p)),l=p=>u(p)}else a=l=c=>c;return n.slice(o,i).map((c,u)=>{let d=o+1+u,p=" "+(" "+d).slice(-s)+" | ";if(d===this.line){let y=l(p.replace(/\d/g," "))+c.slice(0,this.column-1).replace(/[^\t]/g," ");return a(">")+l(p)+c+`
|
|
7
|
-
`+y+a("^")}return" "+l(p)+c}).join(`
|
|
8
|
-
`)}toString(){let t=this.showSourceCode();return t&&(t=`
|
|
9
|
-
|
|
10
|
-
`+t+`
|
|
11
|
-
`),this.name+": "+this.message+t}},rc=dl;dl.default=dl;var Fn={};Fn.isClean=Symbol("isClean");Fn.my=Symbol("my");var Nf={after:`
|
|
12
|
-
`,beforeClose:`
|
|
13
|
-
`,beforeComment:`
|
|
14
|
-
`,beforeDecl:`
|
|
15
|
-
`,beforeOpen:" ",beforeRule:`
|
|
16
|
-
`,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function CE(e){return e[0].toUpperCase()+e.slice(1)}var pl=class{constructor(t){this.builder=t}atrule(t,r){let n="@"+t.name,o=t.params?this.rawValue(t,"params"):"";if(typeof t.raws.afterName<"u"?n+=t.raws.afterName:o&&(n+=" "),t.nodes)this.block(t,n+o);else{let i=(t.raws.between||"")+(r?";":"");this.builder(n+o+i,t)}}beforeAfter(t,r){let n;t.type==="decl"?n=this.raw(t,null,"beforeDecl"):t.type==="comment"?n=this.raw(t,null,"beforeComment"):r==="before"?n=this.raw(t,null,"beforeRule"):n=this.raw(t,null,"beforeClose");let o=t.parent,i=0;for(;o&&o.type!=="root";)i+=1,o=o.parent;if(n.includes(`
|
|
17
|
-
`)){let s=this.raw(t,null,"indent");if(s.length)for(let a=0;a<i;a++)n+=s}return n}block(t,r){let n=this.raw(t,"between","beforeOpen");this.builder(r+n+"{",t,"start");let o;t.nodes&&t.nodes.length?(this.body(t),o=this.raw(t,"after")):o=this.raw(t,"after","emptyBody"),o&&this.builder(o),this.builder("}",t,"end")}body(t){let r=t.nodes.length-1;for(;r>0&&t.nodes[r].type==="comment";)r-=1;let n=this.raw(t,"semicolon");for(let o=0;o<t.nodes.length;o++){let i=t.nodes[o],s=this.raw(i,"before");s&&this.builder(s),this.stringify(i,r!==o||n)}}comment(t){let r=this.raw(t,"left","commentLeft"),n=this.raw(t,"right","commentRight");this.builder("/*"+r+t.text+n+"*/",t)}decl(t,r){let n=this.raw(t,"between","colon"),o=t.prop+n+this.rawValue(t,"value");t.important&&(o+=t.raws.important||" !important"),r&&(o+=";"),this.builder(o,t)}document(t){this.body(t)}raw(t,r,n){let o;if(n||(n=r),r&&(o=t.raws[r],typeof o<"u"))return o;let i=t.parent;if(n==="before"&&(!i||i.type==="root"&&i.first===t||i&&i.type==="document"))return"";if(!i)return Nf[n];let s=t.root();if(s.rawCache||(s.rawCache={}),typeof s.rawCache[n]<"u")return s.rawCache[n];if(n==="before"||n==="after")return this.beforeAfter(t,n);{let a="raw"+CE(n);this[a]?o=this[a](s,t):s.walk(l=>{if(o=l.raws[r],typeof o<"u")return!1})}return typeof o>"u"&&(o=Nf[n]),s.rawCache[n]=o,o}rawBeforeClose(t){let r;return t.walk(n=>{if(n.nodes&&n.nodes.length>0&&typeof n.raws.after<"u")return r=n.raws.after,r.includes(`
|
|
18
|
-
`)&&(r=r.replace(/[^\n]+$/,"")),!1}),r&&(r=r.replace(/\S/g,"")),r}rawBeforeComment(t,r){let n;return t.walkComments(o=>{if(typeof o.raws.before<"u")return n=o.raws.before,n.includes(`
|
|
19
|
-
`)&&(n=n.replace(/[^\n]+$/,"")),!1}),typeof n>"u"?n=this.raw(r,null,"beforeDecl"):n&&(n=n.replace(/\S/g,"")),n}rawBeforeDecl(t,r){let n;return t.walkDecls(o=>{if(typeof o.raws.before<"u")return n=o.raws.before,n.includes(`
|
|
20
|
-
`)&&(n=n.replace(/[^\n]+$/,"")),!1}),typeof n>"u"?n=this.raw(r,null,"beforeRule"):n&&(n=n.replace(/\S/g,"")),n}rawBeforeOpen(t){let r;return t.walk(n=>{if(n.type!=="decl"&&(r=n.raws.between,typeof r<"u"))return!1}),r}rawBeforeRule(t){let r;return t.walk(n=>{if(n.nodes&&(n.parent!==t||t.first!==n)&&typeof n.raws.before<"u")return r=n.raws.before,r.includes(`
|
|
21
|
-
`)&&(r=r.replace(/[^\n]+$/,"")),!1}),r&&(r=r.replace(/\S/g,"")),r}rawColon(t){let r;return t.walkDecls(n=>{if(typeof n.raws.between<"u")return r=n.raws.between.replace(/[^\s:]/g,""),!1}),r}rawEmptyBody(t){let r;return t.walk(n=>{if(n.nodes&&n.nodes.length===0&&(r=n.raws.after,typeof r<"u"))return!1}),r}rawIndent(t){if(t.raws.indent)return t.raws.indent;let r;return t.walk(n=>{let o=n.parent;if(o&&o!==t&&o.parent&&o.parent===t&&typeof n.raws.before<"u"){let i=n.raws.before.split(`
|
|
22
|
-
`);return r=i[i.length-1],r=r.replace(/\S/g,""),!1}}),r}rawSemicolon(t){let r;return t.walk(n=>{if(n.nodes&&n.nodes.length&&n.last.type==="decl"&&(r=n.raws.semicolon,typeof r<"u"))return!1}),r}rawValue(t,r){let n=t[r],o=t.raws[r];return o&&o.value===n?o.raw:n}root(t){this.body(t),t.raws.after&&this.builder(t.raws.after)}rule(t){this.block(t,this.rawValue(t,"selector")),t.raws.ownSemicolon&&this.builder(t.raws.ownSemicolon,t,"end")}stringify(t,r){if(!this[t.type])throw new Error("Unknown AST node type "+t.type+". Maybe you need to change PostCSS stringifier.");this[t.type](t,r)}},$h=pl;pl.default=pl;var EE=$h;function fl(e,t){new EE(t).stringify(e)}var ns=fl;fl.default=fl;var{isClean:fi,my:PE}=Fn,AE=rc,ME=$h,OE=ns;function hl(e,t){let r=new e.constructor;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n)||n==="proxyCache")continue;let o=e[n],i=typeof o;n==="parent"&&i==="object"?t&&(r[n]=t):n==="source"?r[n]=o:Array.isArray(o)?r[n]=o.map(s=>hl(s,r)):(i==="object"&&o!==null&&(o=hl(o)),r[n]=o)}return r}var ml=class{constructor(t={}){this.raws={},this[fi]=!1,this[PE]=!0;for(let r in t)if(r==="nodes"){this.nodes=[];for(let n of t[r])typeof n.clone=="function"?this.append(n.clone()):this.append(n)}else this[r]=t[r]}addToError(t){if(t.postcssNode=this,t.stack&&this.source&&/\n\s{4}at /.test(t.stack)){let r=this.source;t.stack=t.stack.replace(/\n\s{4}at /,`$&${r.input.from}:${r.start.line}:${r.start.column}$&`)}return t}after(t){return this.parent.insertAfter(this,t),this}assign(t={}){for(let r in t)this[r]=t[r];return this}before(t){return this.parent.insertBefore(this,t),this}cleanRaws(t){delete this.raws.before,delete this.raws.after,t||delete this.raws.between}clone(t={}){let r=hl(this);for(let n in t)r[n]=t[n];return r}cloneAfter(t={}){let r=this.clone(t);return this.parent.insertAfter(this,r),r}cloneBefore(t={}){let r=this.clone(t);return this.parent.insertBefore(this,r),r}error(t,r={}){if(this.source){let{end:n,start:o}=this.rangeBy(r);return this.source.input.error(t,{column:o.column,line:o.line},{column:n.column,line:n.line},r)}return new AE(t)}getProxyProcessor(){return{get(t,r){return r==="proxyOf"?t:r==="root"?()=>t.root().toProxy():t[r]},set(t,r,n){return t[r]===n||(t[r]=n,(r==="prop"||r==="value"||r==="name"||r==="params"||r==="important"||r==="text")&&t.markDirty()),!0}}}markDirty(){if(this[fi]){this[fi]=!1;let t=this;for(;t=t.parent;)t[fi]=!1}}next(){if(!this.parent)return;let t=this.parent.index(this);return this.parent.nodes[t+1]}positionBy(t,r){let n=this.source.start;if(t.index)n=this.positionInside(t.index,r);else if(t.word){r=this.toString();let o=r.indexOf(t.word);o!==-1&&(n=this.positionInside(o,r))}return n}positionInside(t,r){let n=r||this.toString(),o=this.source.start.column,i=this.source.start.line;for(let s=0;s<t;s++)n[s]===`
|
|
23
|
-
`?(o=1,i+=1):o+=1;return{column:o,line:i}}prev(){if(!this.parent)return;let t=this.parent.index(this);return this.parent.nodes[t-1]}rangeBy(t){let r={column:this.source.start.column,line:this.source.start.line},n=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:r.column+1,line:r.line};if(t.word){let o=this.toString(),i=o.indexOf(t.word);i!==-1&&(r=this.positionInside(i,o),n=this.positionInside(i+t.word.length,o))}else t.start?r={column:t.start.column,line:t.start.line}:t.index&&(r=this.positionInside(t.index)),t.end?n={column:t.end.column,line:t.end.line}:typeof t.endIndex=="number"?n=this.positionInside(t.endIndex):t.index&&(n=this.positionInside(t.index+1));return(n.line<r.line||n.line===r.line&&n.column<=r.column)&&(n={column:r.column+1,line:r.line}),{end:n,start:r}}raw(t,r){return new ME().raw(this,t,r)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...t){if(this.parent){let r=this,n=!1;for(let o of t)o===this?n=!0:n?(this.parent.insertAfter(r,o),r=o):this.parent.insertBefore(r,o);n||this.remove()}return this}root(){let t=this;for(;t.parent&&t.parent.type!=="document";)t=t.parent;return t}toJSON(t,r){let n={},o=r==null;r=r||new Map;let i=0;for(let s in this){if(!Object.prototype.hasOwnProperty.call(this,s)||s==="parent"||s==="proxyCache")continue;let a=this[s];if(Array.isArray(a))n[s]=a.map(l=>typeof l=="object"&&l.toJSON?l.toJSON(null,r):l);else if(typeof a=="object"&&a.toJSON)n[s]=a.toJSON(null,r);else if(s==="source"){let l=r.get(a.input);l==null&&(l=i,r.set(a.input,i),i++),n[s]={end:a.end,inputId:l,start:a.start}}else n[s]=a}return o&&(n.inputs=[...r.keys()].map(s=>s.toJSON())),n}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(t=OE){t.stringify&&(t=t.stringify);let r="";return t(this,n=>{r+=n}),r}warn(t,r,n){let o={node:this};for(let i in n)o[i]=n[i];return t.warn(r,o)}get proxyOf(){return this}},os=ml;ml.default=ml;var IE=os,yl=class extends IE{constructor(t){t&&typeof t.value<"u"&&typeof t.value!="string"&&(t={...t,value:String(t.value)}),super(t),this.type="decl"}get variable(){return this.prop.startsWith("--")||this.prop[0]==="$"}},is=yl;yl.default=yl;var TE="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",LE=(e,t=21)=>(r=t)=>{let n="",o=r;for(;o--;)n+=e[Math.random()*e.length|0];return n},NE=(e=21)=>{let t="",r=e;for(;r--;)t+=TE[Math.random()*64|0];return t},FE={nanoid:NE,customAlphabet:LE},{SourceMapConsumer:Ff,SourceMapGenerator:$f}=Ve,{existsSync:$E,readFileSync:DE}=Ve,{dirname:Xa,join:_E}=Ve;function BE(e){return Buffer?Buffer.from(e,"base64").toString():window.atob(e)}var gl=class{constructor(t,r){if(r.map===!1)return;this.loadAnnotation(t),this.inline=this.startWith(this.annotation,"data:");let n=r.map?r.map.prev:void 0,o=this.loadMap(r.from,n);!this.mapFile&&r.from&&(this.mapFile=r.from),this.mapFile&&(this.root=Xa(this.mapFile)),o&&(this.text=o)}consumer(){return this.consumerCache||(this.consumerCache=new Ff(this.text)),this.consumerCache}decodeInline(t){let r=/^data:application\/json;charset=utf-?8;base64,/,n=/^data:application\/json;base64,/,o=/^data:application\/json;charset=utf-?8,/,i=/^data:application\/json,/;if(o.test(t)||i.test(t))return decodeURIComponent(t.substr(RegExp.lastMatch.length));if(r.test(t)||n.test(t))return BE(t.substr(RegExp.lastMatch.length));let s=t.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+s)}getAnnotationURL(t){return t.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(t){return typeof t!="object"?!1:typeof t.mappings=="string"||typeof t._mappings=="string"||Array.isArray(t.sections)}loadAnnotation(t){let r=t.match(/\/\*\s*# sourceMappingURL=/gm);if(!r)return;let n=t.lastIndexOf(r.pop()),o=t.indexOf("*/",n);n>-1&&o>-1&&(this.annotation=this.getAnnotationURL(t.substring(n,o)))}loadFile(t){if(this.root=Xa(t),$E(t))return this.mapFile=t,DE(t,"utf-8").toString().trim()}loadMap(t,r){if(r===!1)return!1;if(r){if(typeof r=="string")return r;if(typeof r=="function"){let n=r(t);if(n){let o=this.loadFile(n);if(!o)throw new Error("Unable to load previous source map: "+n.toString());return o}}else{if(r instanceof Ff)return $f.fromSourceMap(r).toString();if(r instanceof $f)return r.toString();if(this.isMap(r))return JSON.stringify(r);throw new Error("Unsupported previous source map format: "+r.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let n=this.annotation;return t&&(n=_E(Xa(t),n)),this.loadFile(n)}}}startWith(t,r){return t?t.substr(0,r.length)===r:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}},Dh=gl;gl.default=gl;var{SourceMapConsumer:jE,SourceMapGenerator:VE}=Ve,{fileURLToPath:Df,pathToFileURL:hi}=Ve,{isAbsolute:Sl,resolve:bl}=Ve,{nanoid:WE}=FE,Qa=Ve,_f=rc,UE=Dh,el=Symbol("fromOffsetCache"),zE=!!(jE&&VE),Bf=!!(bl&&Sl),Gi=class{constructor(t,r={}){if(t===null||typeof t>"u"||typeof t=="object"&&!t.toString)throw new Error(`PostCSS received ${t} instead of CSS string`);if(this.css=t.toString(),this.css[0]==="\uFEFF"||this.css[0]==="\uFFFE"?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,r.from&&(!Bf||/^\w+:\/\//.test(r.from)||Sl(r.from)?this.file=r.from:this.file=bl(r.from)),Bf&&zE){let n=new UE(this.css,r);if(n.text){this.map=n;let o=n.consumer().file;!this.file&&o&&(this.file=this.mapResolve(o))}}this.file||(this.id="<input css "+WE(6)+">"),this.map&&(this.map.file=this.from)}error(t,r,n,o={}){let i,s,a;if(r&&typeof r=="object"){let c=r,u=n;if(typeof c.offset=="number"){let d=this.fromOffset(c.offset);r=d.line,n=d.col}else r=c.line,n=c.column;if(typeof u.offset=="number"){let d=this.fromOffset(u.offset);s=d.line,a=d.col}else s=u.line,a=u.column}else if(!n){let c=this.fromOffset(r);r=c.line,n=c.col}let l=this.origin(r,n,s,a);return l?i=new _f(t,l.endLine===void 0?l.line:{column:l.column,line:l.line},l.endLine===void 0?l.column:{column:l.endColumn,line:l.endLine},l.source,l.file,o.plugin):i=new _f(t,s===void 0?r:{column:n,line:r},s===void 0?n:{column:a,line:s},this.css,this.file,o.plugin),i.input={column:n,endColumn:a,endLine:s,line:r,source:this.css},this.file&&(hi&&(i.input.url=hi(this.file).toString()),i.input.file=this.file),i}fromOffset(t){let r,n;if(this[el])n=this[el];else{let i=this.css.split(`
|
|
24
|
-
`);n=new Array(i.length);let s=0;for(let a=0,l=i.length;a<l;a++)n[a]=s,s+=i[a].length+1;this[el]=n}r=n[n.length-1];let o=0;if(t>=r)o=n.length-1;else{let i=n.length-2,s;for(;o<i;)if(s=o+(i-o>>1),t<n[s])i=s-1;else if(t>=n[s+1])o=s+1;else{o=s;break}}return{col:t-n[o]+1,line:o+1}}mapResolve(t){return/^\w+:\/\//.test(t)?t:bl(this.map.consumer().sourceRoot||this.map.root||".",t)}origin(t,r,n,o){if(!this.map)return!1;let i=this.map.consumer(),s=i.originalPositionFor({column:r,line:t});if(!s.source)return!1;let a;typeof n=="number"&&(a=i.originalPositionFor({column:o,line:n}));let l;Sl(s.source)?l=hi(s.source):l=new URL(s.source,this.map.consumer().sourceRoot||hi(this.map.mapFile));let c={column:s.column,endColumn:a&&a.column,endLine:a&&a.line,line:s.line,url:l.toString()};if(l.protocol==="file:")if(Df)c.file=Df(l);else throw new Error("file: protocol is not available in this PostCSS build");let u=i.sourceContentFor(s.source);return u&&(c.source=u),c}toJSON(){let t={};for(let r of["hasBOM","css","file","id"])this[r]!=null&&(t[r]=this[r]);return this.map&&(t.map={...this.map},t.map.consumerCache&&(t.map.consumerCache=void 0)),t}get from(){return this.file||this.id}},ss=Gi;Gi.default=Gi;Qa&&Qa.registerInput&&Qa.registerInput(Gi);var{SourceMapConsumer:_h,SourceMapGenerator:Ni}=Ve,{dirname:Fi,relative:Bh,resolve:jh,sep:Vh}=Ve,{pathToFileURL:jf}=Ve,GE=ss,KE=!!(_h&&Ni),qE=!!(Fi&&jh&&Bh&&Vh),HE=class{constructor(t,r,n,o){this.stringify=t,this.mapOpts=n.map||{},this.root=r,this.opts=n,this.css=o,this.originalCSS=o,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let t;this.isInline()?t="data:application/json;base64,"+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation=="string"?t=this.mapOpts.annotation:typeof this.mapOpts.annotation=="function"?t=this.mapOpts.annotation(this.opts.to,this.root):t=this.outputFile()+".map";let r=`
|
|
25
|
-
`;this.css.includes(`\r
|
|
26
|
-
`)&&(r=`\r
|
|
27
|
-
`),this.css+=r+"/*# sourceMappingURL="+t+" */"}applyPrevMaps(){for(let t of this.previous()){let r=this.toUrl(this.path(t.file)),n=t.root||Fi(t.file),o;this.mapOpts.sourcesContent===!1?(o=new _h(t.text),o.sourcesContent&&(o.sourcesContent=null)):o=t.consumer(),this.map.applySourceMap(o,r,this.toUrl(this.path(n)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1)if(this.root){let t;for(let r=this.root.nodes.length-1;r>=0;r--)t=this.root.nodes[r],t.type==="comment"&&t.text.indexOf("# sourceMappingURL=")===0&&this.root.removeChild(r)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),qE&&KE&&this.isMap())return this.generateMap();{let t="";return this.stringify(this.root,r=>{t+=r}),[t]}}generateMap(){if(this.root)this.generateString();else if(this.previous().length===1){let t=this.previous()[0].consumer();t.file=this.outputFile(),this.map=Ni.fromSourceMap(t,{ignoreInvalidMapping:!0})}else this.map=new Ni({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 Ni({file:this.outputFile(),ignoreInvalidMapping:!0});let t=1,r=1,n="<no source>",o={generated:{column:0,line:0},original:{column:0,line:0},source:""},i,s;this.stringify(this.root,(a,l,c)=>{if(this.css+=a,l&&c!=="end"&&(o.generated.line=t,o.generated.column=r-1,l.source&&l.source.start?(o.source=this.sourcePath(l),o.original.line=l.source.start.line,o.original.column=l.source.start.column-1,this.map.addMapping(o)):(o.source=n,o.original.line=1,o.original.column=0,this.map.addMapping(o))),i=a.match(/\n/g),i?(t+=i.length,s=a.lastIndexOf(`
|
|
28
|
-
`),r=a.length-s):r+=a.length,l&&c!=="start"){let u=l.parent||{raws:{}};(!(l.type==="decl"||l.type==="atrule"&&!l.nodes)||l!==u.last||u.raws.semicolon)&&(l.source&&l.source.end?(o.source=this.sourcePath(l),o.original.line=l.source.end.line,o.original.column=l.source.end.column-1,o.generated.line=t,o.generated.column=r-2,this.map.addMapping(o)):(o.source=n,o.original.line=1,o.original.column=0,o.generated.line=t,o.generated.column=r-1,this.map.addMapping(o)))}})}isAnnotation(){return this.isInline()?!0:typeof this.mapOpts.annotation<"u"?this.mapOpts.annotation:this.previous().length?this.previous().some(t=>t.annotation):!0}isInline(){if(typeof this.mapOpts.inline<"u")return this.mapOpts.inline;let t=this.mapOpts.annotation;return typeof t<"u"&&t!==!0?!1:this.previous().length?this.previous().some(r=>r.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(t=>t.withContent()):!0}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(t){if(this.mapOpts.absolute||t.charCodeAt(0)===60||/^\w+:\/\//.test(t))return t;let r=this.memoizedPaths.get(t);if(r)return r;let n=this.opts.to?Fi(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(n=Fi(jh(n,this.mapOpts.annotation)));let o=Bh(n,t);return this.memoizedPaths.set(t,o),o}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(t=>{if(t.source&&t.source.input.map){let r=t.source.input.map;this.previousMaps.includes(r)||this.previousMaps.push(r)}});else{let t=new GE(this.originalCSS,this.opts);t.map&&this.previousMaps.push(t.map)}return this.previousMaps}setSourcesContent(){let t={};if(this.root)this.root.walk(r=>{if(r.source){let n=r.source.input.from;if(n&&!t[n]){t[n]=!0;let o=this.usesFileUrls?this.toFileUrl(n):this.toUrl(this.path(n));this.map.setSourceContent(o,r.source.input.css)}}});else if(this.css){let r=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(r,this.css)}}sourcePath(t){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(t.source.input.from):this.toUrl(this.path(t.source.input.from))}toBase64(t){return Buffer?Buffer.from(t).toString("base64"):window.btoa(unescape(encodeURIComponent(t)))}toFileUrl(t){let r=this.memoizedFileURLs.get(t);if(r)return r;if(jf){let n=jf(t).toString();return this.memoizedFileURLs.set(t,n),n}else throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(t){let r=this.memoizedURLs.get(t);if(r)return r;Vh==="\\"&&(t=t.replace(/\\/g,"/"));let n=encodeURI(t).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(t,n),n}},Wh=HE,YE=os,wl=class extends YE{constructor(t){super(t),this.type="comment"}},as=wl;wl.default=wl;var{isClean:Uh,my:zh}=Fn,Gh=is,Kh=as,ZE=os,qh,nc,oc,Hh;function Yh(e){return e.map(t=>(t.nodes&&(t.nodes=Yh(t.nodes)),delete t.source,t))}function Zh(e){if(e[Uh]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)Zh(t)}var ht=class Jh extends ZE{append(...t){for(let r of t){let n=this.normalize(r,this.last);for(let o of n)this.proxyOf.nodes.push(o)}return this.markDirty(),this}cleanRaws(t){if(super.cleanRaws(t),this.nodes)for(let r of this.nodes)r.cleanRaws(t)}each(t){if(!this.proxyOf.nodes)return;let r=this.getIterator(),n,o;for(;this.indexes[r]<this.proxyOf.nodes.length&&(n=this.indexes[r],o=t(this.proxyOf.nodes[n],n),o!==!1);)this.indexes[r]+=1;return delete this.indexes[r],o}every(t){return this.nodes.every(t)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let t=this.lastEach;return this.indexes[t]=0,t}getProxyProcessor(){return{get(t,r){return r==="proxyOf"?t:t[r]?r==="each"||typeof r=="string"&&r.startsWith("walk")?(...n)=>t[r](...n.map(o=>typeof o=="function"?(i,s)=>o(i.toProxy(),s):o)):r==="every"||r==="some"?n=>t[r]((o,...i)=>n(o.toProxy(),...i)):r==="root"?()=>t.root().toProxy():r==="nodes"?t.nodes.map(n=>n.toProxy()):r==="first"||r==="last"?t[r].toProxy():t[r]:t[r]},set(t,r,n){return t[r]===n||(t[r]=n,(r==="name"||r==="params"||r==="selector")&&t.markDirty()),!0}}}index(t){return typeof t=="number"?t:(t.proxyOf&&(t=t.proxyOf),this.proxyOf.nodes.indexOf(t))}insertAfter(t,r){let n=this.index(t),o=this.normalize(r,this.proxyOf.nodes[n]).reverse();n=this.index(t);for(let s of o)this.proxyOf.nodes.splice(n+1,0,s);let i;for(let s in this.indexes)i=this.indexes[s],n<i&&(this.indexes[s]=i+o.length);return this.markDirty(),this}insertBefore(t,r){let n=this.index(t),o=n===0?"prepend":!1,i=this.normalize(r,this.proxyOf.nodes[n],o).reverse();n=this.index(t);for(let a of i)this.proxyOf.nodes.splice(n,0,a);let s;for(let a in this.indexes)s=this.indexes[a],n<=s&&(this.indexes[a]=s+i.length);return this.markDirty(),this}normalize(t,r){if(typeof t=="string")t=Yh(qh(t).nodes);else if(typeof t>"u")t=[];else if(Array.isArray(t)){t=t.slice(0);for(let o of t)o.parent&&o.parent.removeChild(o,"ignore")}else if(t.type==="root"&&this.type!=="document"){t=t.nodes.slice(0);for(let o of t)o.parent&&o.parent.removeChild(o,"ignore")}else if(t.type)t=[t];else if(t.prop){if(typeof t.value>"u")throw new Error("Value field is missed in node creation");typeof t.value!="string"&&(t.value=String(t.value)),t=[new Gh(t)]}else if(t.selector)t=[new nc(t)];else if(t.name)t=[new oc(t)];else if(t.text)t=[new Kh(t)];else throw new Error("Unknown node type in node creation");return t.map(o=>(o[zh]||Jh.rebuild(o),o=o.proxyOf,o.parent&&o.parent.removeChild(o),o[Uh]&&Zh(o),typeof o.raws.before>"u"&&r&&typeof r.raws.before<"u"&&(o.raws.before=r.raws.before.replace(/\S/g,"")),o.parent=this.proxyOf,o))}prepend(...t){t=t.reverse();for(let r of t){let n=this.normalize(r,this.first,"prepend").reverse();for(let o of n)this.proxyOf.nodes.unshift(o);for(let o in this.indexes)this.indexes[o]=this.indexes[o]+n.length}return this.markDirty(),this}push(t){return t.parent=this,this.proxyOf.nodes.push(t),this}removeAll(){for(let t of this.proxyOf.nodes)t.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(t){t=this.index(t),this.proxyOf.nodes[t].parent=void 0,this.proxyOf.nodes.splice(t,1);let r;for(let n in this.indexes)r=this.indexes[n],r>=t&&(this.indexes[n]=r-1);return this.markDirty(),this}replaceValues(t,r,n){return n||(n=r,r={}),this.walkDecls(o=>{r.props&&!r.props.includes(o.prop)||r.fast&&!o.value.includes(r.fast)||(o.value=o.value.replace(t,n))}),this.markDirty(),this}some(t){return this.nodes.some(t)}walk(t){return this.each((r,n)=>{let o;try{o=t(r,n)}catch(i){throw r.addToError(i)}return o!==!1&&r.walk&&(o=r.walk(t)),o})}walkAtRules(t,r){return r?t instanceof RegExp?this.walk((n,o)=>{if(n.type==="atrule"&&t.test(n.name))return r(n,o)}):this.walk((n,o)=>{if(n.type==="atrule"&&n.name===t)return r(n,o)}):(r=t,this.walk((n,o)=>{if(n.type==="atrule")return r(n,o)}))}walkComments(t){return this.walk((r,n)=>{if(r.type==="comment")return t(r,n)})}walkDecls(t,r){return r?t instanceof RegExp?this.walk((n,o)=>{if(n.type==="decl"&&t.test(n.prop))return r(n,o)}):this.walk((n,o)=>{if(n.type==="decl"&&n.prop===t)return r(n,o)}):(r=t,this.walk((n,o)=>{if(n.type==="decl")return r(n,o)}))}walkRules(t,r){return r?t instanceof RegExp?this.walk((n,o)=>{if(n.type==="rule"&&t.test(n.selector))return r(n,o)}):this.walk((n,o)=>{if(n.type==="rule"&&n.selector===t)return r(n,o)}):(r=t,this.walk((n,o)=>{if(n.type==="rule")return r(n,o)}))}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]}};ht.registerParse=e=>{qh=e};ht.registerRule=e=>{nc=e};ht.registerAtRule=e=>{oc=e};ht.registerRoot=e=>{Hh=e};var Kt=ht;ht.default=ht;ht.rebuild=e=>{e.type==="atrule"?Object.setPrototypeOf(e,oc.prototype):e.type==="rule"?Object.setPrototypeOf(e,nc.prototype):e.type==="decl"?Object.setPrototypeOf(e,Gh.prototype):e.type==="comment"?Object.setPrototypeOf(e,Kh.prototype):e.type==="root"&&Object.setPrototypeOf(e,Hh.prototype),e[zh]=!0,e.nodes&&e.nodes.forEach(t=>{ht.rebuild(t)})};var JE=Kt,Xh,Qh,En=class extends JE{constructor(t){super({type:"document",...t}),this.nodes||(this.nodes=[])}toResult(t={}){return new Xh(new Qh,this,t).stringify()}};En.registerLazyResult=e=>{Xh=e};En.registerProcessor=e=>{Qh=e};var ic=En;En.default=En;var Vf={},em=function(t){Vf[t]||(Vf[t]=!0,typeof console<"u"&&console.warn&&console.warn(t))},Rl=class{constructor(t,r={}){if(this.type="warning",this.text=t,r.node&&r.node.source){let n=r.node.rangeBy(r);this.line=n.start.line,this.column=n.start.column,this.endLine=n.end.line,this.endColumn=n.end.column}for(let n in r)this[n]=r[n]}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}},tm=Rl;Rl.default=Rl;var XE=tm,vl=class{constructor(t,r,n){this.processor=t,this.messages=[],this.root=r,this.opts=n,this.css=void 0,this.map=void 0}toString(){return this.css}warn(t,r={}){r.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(r.plugin=this.lastPlugin.postcssPlugin);let n=new XE(t,r);return this.messages.push(n),n}warnings(){return this.messages.filter(t=>t.type==="warning")}get content(){return this.css}},sc=vl;vl.default=vl;var tl=39,Wf=34,mi=92,Uf=47,yi=10,gn=32,gi=12,Si=9,bi=13,QE=91,eP=93,tP=40,rP=41,nP=123,oP=125,iP=59,sP=42,aP=58,lP=64,wi=/[\t\n\f\r "#'()/;[\\\]{}]/g,Ri=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,cP=/.[\r\n"'(/\\]/,zf=/[\da-f]/i,uP=function(t,r={}){let n=t.css.valueOf(),o=r.ignoreErrors,i,s,a,l,c,u,d,p,y,h,f=n.length,m=0,v=[],w=[];function g(){return m}function k(G){throw t.error("Unclosed "+G,m)}function _(){return w.length===0&&m>=f}function V(G){if(w.length)return w.pop();if(m>=f)return;let Q=G?G.ignoreUnclosed:!1;switch(i=n.charCodeAt(m),i){case yi:case gn:case Si:case bi:case gi:{s=m;do s+=1,i=n.charCodeAt(s);while(i===gn||i===yi||i===Si||i===bi||i===gi);h=["space",n.slice(m,s)],m=s-1;break}case QE:case eP:case nP:case oP:case aP:case iP:case rP:{let le=String.fromCharCode(i);h=[le,le,m];break}case tP:{if(p=v.length?v.pop()[1]:"",y=n.charCodeAt(m+1),p==="url"&&y!==tl&&y!==Wf&&y!==gn&&y!==yi&&y!==Si&&y!==gi&&y!==bi){s=m;do{if(u=!1,s=n.indexOf(")",s+1),s===-1)if(o||Q){s=m;break}else k("bracket");for(d=s;n.charCodeAt(d-1)===mi;)d-=1,u=!u}while(u);h=["brackets",n.slice(m,s+1),m,s],m=s}else s=n.indexOf(")",m+1),l=n.slice(m,s+1),s===-1||cP.test(l)?h=["(","(",m]:(h=["brackets",l,m,s],m=s);break}case tl:case Wf:{a=i===tl?"'":'"',s=m;do{if(u=!1,s=n.indexOf(a,s+1),s===-1)if(o||Q){s=m+1;break}else k("string");for(d=s;n.charCodeAt(d-1)===mi;)d-=1,u=!u}while(u);h=["string",n.slice(m,s+1),m,s],m=s;break}case lP:{wi.lastIndex=m+1,wi.test(n),wi.lastIndex===0?s=n.length-1:s=wi.lastIndex-2,h=["at-word",n.slice(m,s+1),m,s],m=s;break}case mi:{for(s=m,c=!0;n.charCodeAt(s+1)===mi;)s+=1,c=!c;if(i=n.charCodeAt(s+1),c&&i!==Uf&&i!==gn&&i!==yi&&i!==Si&&i!==bi&&i!==gi&&(s+=1,zf.test(n.charAt(s)))){for(;zf.test(n.charAt(s+1));)s+=1;n.charCodeAt(s+1)===gn&&(s+=1)}h=["word",n.slice(m,s+1),m,s],m=s;break}default:{i===Uf&&n.charCodeAt(m+1)===sP?(s=n.indexOf("*/",m+2)+1,s===0&&(o||Q?s=n.length:k("comment")),h=["comment",n.slice(m,s+1),m,s],m=s):(Ri.lastIndex=m+1,Ri.test(n),Ri.lastIndex===0?s=n.length-1:s=Ri.lastIndex-2,h=["word",n.slice(m,s+1),m,s],v.push(h),m=s);break}}return m++,h}function te(G){w.push(G)}return{back:te,endOfFile:_,nextToken:V,position:g}},rm=Kt,Ki=class extends rm{constructor(t){super(t),this.type="atrule"}append(...t){return this.proxyOf.nodes||(this.nodes=[]),super.append(...t)}prepend(...t){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...t)}},ac=Ki;Ki.default=Ki;rm.registerAtRule(Ki);var nm=Kt,om,im,Ar=class extends nm{constructor(t){super(t),this.type="root",this.nodes||(this.nodes=[])}normalize(t,r,n){let o=super.normalize(t);if(r){if(n==="prepend")this.nodes.length>1?r.raws.before=this.nodes[1].raws.before:delete r.raws.before;else if(this.first!==r)for(let i of o)i.raws.before=r.raws.before}return o}removeChild(t,r){let n=this.index(t);return!r&&n===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[n].raws.before),super.removeChild(t)}toResult(t={}){return new om(new im,this,t).stringify()}};Ar.registerLazyResult=e=>{om=e};Ar.registerProcessor=e=>{im=e};var $n=Ar;Ar.default=Ar;nm.registerRoot(Ar);var Pn={comma(e){return Pn.split(e,[","],!0)},space(e){let t=[" ",`
|
|
29
|
-
`," "];return Pn.split(e,t)},split(e,t,r){let n=[],o="",i=!1,s=0,a=!1,l="",c=!1;for(let u of e)c?c=!1:u==="\\"?c=!0:a?u===l&&(a=!1):u==='"'||u==="'"?(a=!0,l=u):u==="("?s+=1:u===")"?s>0&&(s-=1):s===0&&t.includes(u)&&(i=!0),i?(o!==""&&n.push(o.trim()),o="",i=!1):o+=u;return(r||o!=="")&&n.push(o.trim()),n}},sm=Pn;Pn.default=Pn;var am=Kt,dP=sm,qi=class extends am{constructor(t){super(t),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return dP.comma(this.selector)}set selectors(t){let r=this.selector?this.selector.match(/,\s*/):null,n=r?r[0]:","+this.raw("between","beforeOpen");this.selector=t.join(n)}},lc=qi;qi.default=qi;am.registerRule(qi);var pP=is,fP=uP,hP=as,mP=ac,yP=$n,Gf=lc,Kf={empty:!0,space:!0};function gP(e){for(let t=e.length-1;t>=0;t--){let r=e[t],n=r[3]||r[2];if(n)return n}}var SP=class{constructor(t){this.input=t,this.root=new yP,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:t,start:{column:1,line:1,offset:0}}}atrule(t){let r=new mP;r.name=t[1].slice(1),r.name===""&&this.unnamedAtrule(r,t),this.init(r,t[2]);let n,o,i,s=!1,a=!1,l=[],c=[];for(;!this.tokenizer.endOfFile();){if(t=this.tokenizer.nextToken(),n=t[0],n==="("||n==="["?c.push(n==="("?")":"]"):n==="{"&&c.length>0?c.push("}"):n===c[c.length-1]&&c.pop(),c.length===0)if(n===";"){r.source.end=this.getPosition(t[2]),r.source.end.offset++,this.semicolon=!0;break}else if(n==="{"){a=!0;break}else if(n==="}"){if(l.length>0){for(i=l.length-1,o=l[i];o&&o[0]==="space";)o=l[--i];o&&(r.source.end=this.getPosition(o[3]||o[2]),r.source.end.offset++)}this.end(t);break}else l.push(t);else l.push(t);if(this.tokenizer.endOfFile()){s=!0;break}}r.raws.between=this.spacesAndCommentsFromEnd(l),l.length?(r.raws.afterName=this.spacesAndCommentsFromStart(l),this.raw(r,"params",l),s&&(t=l[l.length-1],r.source.end=this.getPosition(t[3]||t[2]),r.source.end.offset++,this.spaces=r.raws.between,r.raws.between="")):(r.raws.afterName="",r.params=""),a&&(r.nodes=[],this.current=r)}checkMissedSemicolon(t){let r=this.colon(t);if(r===!1)return;let n=0,o;for(let i=r-1;i>=0&&(o=t[i],!(o[0]!=="space"&&(n+=1,n===2)));i--);throw this.input.error("Missed semicolon",o[0]==="word"?o[3]+1:o[2])}colon(t){let r=0,n,o,i;for(let[s,a]of t.entries()){if(n=a,o=n[0],o==="("&&(r+=1),o===")"&&(r-=1),r===0&&o===":")if(!i)this.doubleColon(n);else{if(i[0]==="word"&&i[1]==="progid")continue;return s}i=n}return!1}comment(t){let r=new hP;this.init(r,t[2]),r.source.end=this.getPosition(t[3]||t[2]),r.source.end.offset++;let n=t[1].slice(2,-2);if(/^\s*$/.test(n))r.text="",r.raws.left=n,r.raws.right="";else{let o=n.match(/^(\s*)([^]*\S)(\s*)$/);r.text=o[2],r.raws.left=o[1],r.raws.right=o[3]}}createTokenizer(){this.tokenizer=fP(this.input)}decl(t,r){let n=new pP;this.init(n,t[0][2]);let o=t[t.length-1];for(o[0]===";"&&(this.semicolon=!0,t.pop()),n.source.end=this.getPosition(o[3]||o[2]||gP(t)),n.source.end.offset++;t[0][0]!=="word";)t.length===1&&this.unknownWord(t),n.raws.before+=t.shift()[1];for(n.source.start=this.getPosition(t[0][2]),n.prop="";t.length;){let c=t[0][0];if(c===":"||c==="space"||c==="comment")break;n.prop+=t.shift()[1]}n.raws.between="";let i;for(;t.length;)if(i=t.shift(),i[0]===":"){n.raws.between+=i[1];break}else i[0]==="word"&&/\w/.test(i[1])&&this.unknownWord([i]),n.raws.between+=i[1];(n.prop[0]==="_"||n.prop[0]==="*")&&(n.raws.before+=n.prop[0],n.prop=n.prop.slice(1));let s=[],a;for(;t.length&&(a=t[0][0],!(a!=="space"&&a!=="comment"));)s.push(t.shift());this.precheckMissedSemicolon(t);for(let c=t.length-1;c>=0;c--){if(i=t[c],i[1].toLowerCase()==="!important"){n.important=!0;let u=this.stringFrom(t,c);u=this.spacesFromEnd(t)+u,u!==" !important"&&(n.raws.important=u);break}else if(i[1].toLowerCase()==="important"){let u=t.slice(0),d="";for(let p=c;p>0;p--){let y=u[p][0];if(d.trim().indexOf("!")===0&&y!=="space")break;d=u.pop()[1]+d}d.trim().indexOf("!")===0&&(n.important=!0,n.raws.important=d,t=u)}if(i[0]!=="space"&&i[0]!=="comment")break}t.some(c=>c[0]!=="space"&&c[0]!=="comment")&&(n.raws.between+=s.map(c=>c[1]).join(""),s=[]),this.raw(n,"value",s.concat(t),r),n.value.includes(":")&&!r&&this.checkMissedSemicolon(t)}doubleColon(t){throw this.input.error("Double colon",{offset:t[2]},{offset:t[2]+t[1].length})}emptyRule(t){let r=new Gf;this.init(r,t[2]),r.selector="",r.raws.between="",this.current=r}end(t){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(t[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(t)}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(t){if(this.spaces+=t[1],this.current.nodes){let r=this.current.nodes[this.current.nodes.length-1];r&&r.type==="rule"&&!r.raws.ownSemicolon&&(r.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(t){let r=this.input.fromOffset(t);return{column:r.col,line:r.line,offset:t}}init(t,r){this.current.push(t),t.source={input:this.input,start:this.getPosition(r)},t.raws.before=this.spaces,this.spaces="",t.type!=="comment"&&(this.semicolon=!1)}other(t){let r=!1,n=null,o=!1,i=null,s=[],a=t[1].startsWith("--"),l=[],c=t;for(;c;){if(n=c[0],l.push(c),n==="("||n==="[")i||(i=c),s.push(n==="("?")":"]");else if(a&&o&&n==="{")i||(i=c),s.push("}");else if(s.length===0)if(n===";")if(o){this.decl(l,a);return}else break;else if(n==="{"){this.rule(l);return}else if(n==="}"){this.tokenizer.back(l.pop()),r=!0;break}else n===":"&&(o=!0);else n===s[s.length-1]&&(s.pop(),s.length===0&&(i=null));c=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(r=!0),s.length>0&&this.unclosedBracket(i),r&&o){if(!a)for(;l.length&&(c=l[l.length-1][0],!(c!=="space"&&c!=="comment"));)this.tokenizer.back(l.pop());this.decl(l,a)}else this.unknownWord(l)}parse(){let t;for(;!this.tokenizer.endOfFile();)switch(t=this.tokenizer.nextToken(),t[0]){case"space":this.spaces+=t[1];break;case";":this.freeSemicolon(t);break;case"}":this.end(t);break;case"comment":this.comment(t);break;case"at-word":this.atrule(t);break;case"{":this.emptyRule(t);break;default:this.other(t);break}this.endFile()}precheckMissedSemicolon(){}raw(t,r,n,o){let i,s,a=n.length,l="",c=!0,u,d;for(let p=0;p<a;p+=1)i=n[p],s=i[0],s==="space"&&p===a-1&&!o?c=!1:s==="comment"?(d=n[p-1]?n[p-1][0]:"empty",u=n[p+1]?n[p+1][0]:"empty",!Kf[d]&&!Kf[u]?l.slice(-1)===","?c=!1:l+=i[1]:c=!1):l+=i[1];if(!c){let p=n.reduce((y,h)=>y+h[1],"");t.raws[r]={raw:p,value:l}}t[r]=l}rule(t){t.pop();let r=new Gf;this.init(r,t[0][2]),r.raws.between=this.spacesAndCommentsFromEnd(t),this.raw(r,"selector",t),this.current=r}spacesAndCommentsFromEnd(t){let r,n="";for(;t.length&&(r=t[t.length-1][0],!(r!=="space"&&r!=="comment"));)n=t.pop()[1]+n;return n}spacesAndCommentsFromStart(t){let r,n="";for(;t.length&&(r=t[0][0],!(r!=="space"&&r!=="comment"));)n+=t.shift()[1];return n}spacesFromEnd(t){let r,n="";for(;t.length&&(r=t[t.length-1][0],r==="space");)n=t.pop()[1]+n;return n}stringFrom(t,r){let n="";for(let o=r;o<t.length;o++)n+=t[o][1];return t.splice(r,t.length-r),n}unclosedBlock(){let t=this.current.source.start;throw this.input.error("Unclosed block",t.line,t.column)}unclosedBracket(t){throw this.input.error("Unclosed bracket",{offset:t[2]},{offset:t[2]+1})}unexpectedClose(t){throw this.input.error("Unexpected }",{offset:t[2]},{offset:t[2]+1})}unknownWord(t){throw this.input.error("Unknown word",{offset:t[0][2]},{offset:t[0][2]+t[0][1].length})}unnamedAtrule(t,r){throw this.input.error("At-rule without name",{offset:r[2]},{offset:r[2]+r[1].length})}},bP=SP,wP=Kt,RP=bP,vP=ss;function Hi(e,t){let r=new vP(e,t),n=new RP(r);try{n.parse()}catch(o){throw process.env.NODE_ENV!=="production"&&o.name==="CssSyntaxError"&&t&&t.from&&(/\.scss$/i.test(t.from)?o.message+=`
|
|
30
|
-
You tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser`:/\.sass/i.test(t.from)?o.message+=`
|
|
31
|
-
You tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser`:/\.less$/i.test(t.from)&&(o.message+=`
|
|
32
|
-
You tried to parse Less with the standard CSS parser; try again with the postcss-less parser`)),o}return n.root}var cc=Hi;Hi.default=Hi;wP.registerParse(Hi);var{isClean:rt,my:xP}=Fn,kP=Wh,CP=ns,EP=Kt,PP=ic,AP=em,qf=sc,MP=cc,OP=$n,IP={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},TP={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},LP={Once:!0,postcssPlugin:!0,prepare:!0},Mr=0;function Sn(e){return typeof e=="object"&&typeof e.then=="function"}function lm(e){let t=!1,r=IP[e.type];return e.type==="decl"?t=e.prop.toLowerCase():e.type==="atrule"&&(t=e.name.toLowerCase()),t&&e.append?[r,r+"-"+t,Mr,r+"Exit",r+"Exit-"+t]:t?[r,r+"-"+t,r+"Exit",r+"Exit-"+t]:e.append?[r,Mr,r+"Exit"]:[r,r+"Exit"]}function Hf(e){let t;return e.type==="document"?t=["Document",Mr,"DocumentExit"]:e.type==="root"?t=["Root",Mr,"RootExit"]:t=lm(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function xl(e){return e[rt]=!1,e.nodes&&e.nodes.forEach(t=>xl(t)),e}var kl={},Or=class cm{constructor(t,r,n){this.stringified=!1,this.processed=!1;let o;if(typeof r=="object"&&r!==null&&(r.type==="root"||r.type==="document"))o=xl(r);else if(r instanceof cm||r instanceof qf)o=xl(r.root),r.map&&(typeof n.map>"u"&&(n.map={}),n.map.inline||(n.map.inline=!1),n.map.prev=r.map);else{let i=MP;n.syntax&&(i=n.syntax.parse),n.parser&&(i=n.parser),i.parse&&(i=i.parse);try{o=i(r,n)}catch(s){this.processed=!0,this.error=s}o&&!o[xP]&&EP.rebuild(o)}this.result=new qf(t,o,n),this.helpers={...kl,postcss:kl,result:this.result},this.plugins=this.processor.plugins.map(i=>typeof i=="object"&&i.prepare?{...i,...i.prepare(this.result)}:i)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(t){return this.async().catch(t)}finally(t){return this.async().then(t,t)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(t,r){let n=this.result.lastPlugin;try{if(r&&r.addToError(t),this.error=t,t.name==="CssSyntaxError"&&!t.plugin)t.plugin=n.postcssPlugin,t.setMessage();else if(n.postcssVersion&&process.env.NODE_ENV!=="production"){let o=n.postcssPlugin,i=n.postcssVersion,s=this.result.processor.version,a=i.split("."),l=s.split(".");(a[0]!==l[0]||parseInt(a[1])>parseInt(l[1]))&&console.error("Unknown error from PostCSS plugin. Your current PostCSS version is "+s+", but "+o+" uses "+i+". Perhaps this is the source of the error below.")}}catch(o){console&&console.error&&console.error(o)}return t}prepareVisitors(){this.listeners={};let t=(r,n,o)=>{this.listeners[n]||(this.listeners[n]=[]),this.listeners[n].push([r,o])};for(let r of this.plugins)if(typeof r=="object")for(let n in r){if(!TP[n]&&/^[A-Z]/.test(n))throw new Error(`Unknown event ${n} in ${r.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!LP[n])if(typeof r[n]=="object")for(let o in r[n])o==="*"?t(r,n,r[n][o]):t(r,n+"-"+o.toLowerCase(),r[n][o]);else typeof r[n]=="function"&&t(r,n,r[n])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let t=0;t<this.plugins.length;t++){let r=this.plugins[t],n=this.runOnRoot(r);if(Sn(n))try{await n}catch(o){throw this.handleError(o)}}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[rt];){t[rt]=!0;let r=[Hf(t)];for(;r.length>0;){let n=this.visitTick(r);if(Sn(n))try{await n}catch(o){let i=r[r.length-1].node;throw this.handleError(o,i)}}}if(this.listeners.OnceExit)for(let[r,n]of this.listeners.OnceExit){this.result.lastPlugin=r;try{if(t.type==="document"){let o=t.nodes.map(i=>n(i,this.helpers));await Promise.all(o)}else await n(t,this.helpers)}catch(o){throw this.handleError(o)}}}return this.processed=!0,this.stringify()}runOnRoot(t){this.result.lastPlugin=t;try{if(typeof t=="object"&&t.Once){if(this.result.root.type==="document"){let r=this.result.root.nodes.map(n=>t.Once(n,this.helpers));return Sn(r[0])?Promise.all(r):r}return t.Once(this.result.root,this.helpers)}else if(typeof t=="function")return t(this.result.root,this.result)}catch(r){throw this.handleError(r)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let t=this.result.opts,r=CP;t.syntax&&(r=t.syntax.stringify),t.stringifier&&(r=t.stringifier),r.stringify&&(r=r.stringify);let o=new kP(r,this.result.root,this.result.opts).generate();return this.result.css=o[0],this.result.map=o[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 t of this.plugins){let r=this.runOnRoot(t);if(Sn(r))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[rt];)t[rt]=!0,this.walkSync(t);if(this.listeners.OnceExit)if(t.type==="document")for(let r of t.nodes)this.visitSync(this.listeners.OnceExit,r);else this.visitSync(this.listeners.OnceExit,t)}return this.result}then(t,r){return process.env.NODE_ENV!=="production"&&("from"in this.opts||AP("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(t,r)}toString(){return this.css}visitSync(t,r){for(let[n,o]of t){this.result.lastPlugin=n;let i;try{i=o(r,this.helpers)}catch(s){throw this.handleError(s,r.proxyOf)}if(r.type!=="root"&&r.type!=="document"&&!r.parent)return!0;if(Sn(i))throw this.getAsyncError()}}visitTick(t){let r=t[t.length-1],{node:n,visitors:o}=r;if(n.type!=="root"&&n.type!=="document"&&!n.parent){t.pop();return}if(o.length>0&&r.visitorIndex<o.length){let[s,a]=o[r.visitorIndex];r.visitorIndex+=1,r.visitorIndex===o.length&&(r.visitors=[],r.visitorIndex=0),this.result.lastPlugin=s;try{return a(n.toProxy(),this.helpers)}catch(l){throw this.handleError(l,n)}}if(r.iterator!==0){let s=r.iterator,a;for(;a=n.nodes[n.indexes[s]];)if(n.indexes[s]+=1,!a[rt]){a[rt]=!0,t.push(Hf(a));return}r.iterator=0,delete n.indexes[s]}let i=r.events;for(;r.eventIndex<i.length;){let s=i[r.eventIndex];if(r.eventIndex+=1,s===Mr){n.nodes&&n.nodes.length&&(n[rt]=!0,r.iterator=n.getIterator());return}else if(this.listeners[s]){r.visitors=this.listeners[s];return}}t.pop()}walkSync(t){t[rt]=!0;let r=lm(t);for(let n of r)if(n===Mr)t.nodes&&t.each(o=>{o[rt]||this.walkSync(o)});else{let o=this.listeners[n];if(o&&this.visitSync(o,t.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"}};Or.registerPostcss=e=>{kl=e};var um=Or;Or.default=Or;OP.registerLazyResult(Or);PP.registerLazyResult(Or);var NP=Wh,FP=ns,$P=em,DP=cc,_P=sc,Cl=class{constructor(t,r,n){r=r.toString(),this.stringified=!1,this._processor=t,this._css=r,this._opts=n,this._map=void 0;let o,i=FP;this.result=new _P(this._processor,o,this._opts),this.result.css=r;let s=this;Object.defineProperty(this.result,"root",{get(){return s.root}});let a=new NP(i,o,this._opts,r);if(a.isMap()){let[l,c]=a.generate();l&&(this.result.css=l),c&&(this.result.map=c)}else a.clearAnnotation(),this.result.css=a.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(t){return this.async().catch(t)}finally(t){return this.async().then(t,t)}sync(){if(this.error)throw this.error;return this.result}then(t,r){return process.env.NODE_ENV!=="production"&&("from"in this._opts||$P("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(t,r)}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 t,r=DP;try{t=r(this._css,this._opts)}catch(n){this.error=n}if(this.error)throw this.error;return this._root=t,t}get[Symbol.toStringTag](){return"NoWorkResult"}},BP=Cl;Cl.default=Cl;var jP=BP,VP=um,WP=ic,UP=$n,An=class{constructor(t=[]){this.version="8.4.38",this.plugins=this.normalize(t)}normalize(t){let r=[];for(let n of t)if(n.postcss===!0?n=n():n.postcss&&(n=n.postcss),typeof n=="object"&&Array.isArray(n.plugins))r=r.concat(n.plugins);else if(typeof n=="object"&&n.postcssPlugin)r.push(n);else if(typeof n=="function")r.push(n);else if(typeof n=="object"&&(n.parse||n.stringify)){if(process.env.NODE_ENV!=="production")throw new Error("PostCSS syntaxes cannot be used as plugins. Instead, please use one of the syntax/parser/stringifier options as outlined in your PostCSS runner documentation.")}else throw new Error(n+" is not a PostCSS plugin");return r}process(t,r={}){return!this.plugins.length&&!r.parser&&!r.stringifier&&!r.syntax?new jP(this,t,r):new VP(this,t,r)}use(t){return this.plugins=this.plugins.concat(this.normalize([t])),this}},zP=An;An.default=An;UP.registerProcessor(An);WP.registerProcessor(An);var GP=is,KP=Dh,qP=as,HP=ac,YP=ss,ZP=$n,JP=lc;function Mn(e,t){if(Array.isArray(e))return e.map(o=>Mn(o));let{inputs:r,...n}=e;if(r){t=[];for(let o of r){let i={...o,__proto__:YP.prototype};i.map&&(i.map={...i.map,__proto__:KP.prototype}),t.push(i)}}if(n.nodes&&(n.nodes=e.nodes.map(o=>Mn(o,t))),n.source){let{inputId:o,...i}=n.source;n.source=i,o!=null&&(n.source.input=t[o])}if(n.type==="root")return new ZP(n);if(n.type==="decl")return new GP(n);if(n.type==="rule")return new JP(n);if(n.type==="comment")return new qP(n);if(n.type==="atrule")return new HP(n);throw new Error("Unknown node type: "+e.type)}var XP=Mn;Mn.default=Mn;var QP=rc,dm=is,eA=um,tA=Kt,uc=zP,rA=ns,nA=XP,pm=ic,oA=tm,fm=as,hm=ac,iA=sc,sA=ss,aA=cc,lA=sm,mm=lc,ym=$n,cA=os;function $(...e){return e.length===1&&Array.isArray(e[0])&&(e=e[0]),new uc(e)}$.plugin=function(t,r){let n=!1;function o(...s){console&&console.warn&&!n&&(n=!0,console.warn(t+`: postcss.plugin was deprecated. Migration guide:
|
|
33
|
-
https://evilmartians.com/chronicles/postcss-8-plugin-migration`),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(t+`: \u91CC\u9762 postcss.plugin \u88AB\u5F03\u7528. \u8FC1\u79FB\u6307\u5357:
|
|
34
|
-
https://www.w3ctech.com/topic/2226`));let a=r(...s);return a.postcssPlugin=t,a.postcssVersion=new uc().version,a}let i;return Object.defineProperty(o,"postcss",{get(){return i||(i=o()),i}}),o.process=function(s,a,l){return $([o(l)]).process(s,a)},o};$.stringify=rA;$.parse=aA;$.fromJSON=nA;$.list=lA;$.comment=e=>new fm(e);$.atRule=e=>new hm(e);$.decl=e=>new dm(e);$.rule=e=>new mm(e);$.root=e=>new ym(e);$.document=e=>new pm(e);$.CssSyntaxError=QP;$.Declaration=dm;$.Container=tA;$.Processor=uc;$.Document=pm;$.Comment=fm;$.Warning=oA;$.AtRule=hm;$.Result=iA;$.Input=sA;$.Rule=mm;$.Root=ym;$.Node=cA;eA.registerPostcss($);var uA=$;$.default=$;var q=wE(uA);q.stringify;q.fromJSON;q.plugin;q.parse;q.list;q.document;q.comment;q.atRule;q.rule;q.decl;q.root;q.CssSyntaxError;q.Declaration;q.Container;q.Processor;q.Document;q.Comment;q.Warning;q.AtRule;q.Result;q.Input;q.Rule;q.Root;q.Node;var dA=Object.defineProperty,pA=(e,t,r)=>t in e?dA(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Le=(e,t,r)=>pA(e,typeof t!="symbol"?t+"":t,r);function fA(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function hA(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var r=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}),r}var dc={exports:{}},z=String,gm=function(){return{isColorSupported:!1,reset:z,bold:z,dim:z,italic:z,underline:z,inverse:z,hidden:z,strikethrough:z,black:z,red:z,green:z,yellow:z,blue:z,magenta:z,cyan:z,white:z,gray:z,bgBlack:z,bgRed:z,bgGreen:z,bgYellow:z,bgBlue:z,bgMagenta:z,bgCyan:z,bgWhite:z}};dc.exports=gm();dc.exports.createColors=gm;var mA=dc.exports,yA={},gA=Object.freeze(Object.defineProperty({__proto__:null,default:yA},Symbol.toStringTag,{value:"Module"})),We=hA(gA),Yf=mA,Zf=We,El=class Sm extends Error{constructor(t,r,n,o,i,s){super(t),this.name="CssSyntaxError",this.reason=t,i&&(this.file=i),o&&(this.source=o),s&&(this.plugin=s),typeof r<"u"&&typeof n<"u"&&(typeof r=="number"?(this.line=r,this.column=n):(this.line=r.line,this.column=r.column,this.endLine=n.line,this.endColumn=n.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,Sm)}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(t){if(!this.source)return"";let r=this.source;t==null&&(t=Yf.isColorSupported),Zf&&t&&(r=Zf(r));let n=r.split(/\r?\n/),o=Math.max(this.line-3,0),i=Math.min(this.line+2,n.length),s=String(i).length,a,l;if(t){let{bold:c,gray:u,red:d}=Yf.createColors(!0);a=p=>c(d(p)),l=p=>u(p)}else a=l=c=>c;return n.slice(o,i).map((c,u)=>{let d=o+1+u,p=" "+(" "+d).slice(-s)+" | ";if(d===this.line){let y=l(p.replace(/\d/g," "))+c.slice(0,this.column-1).replace(/[^\t]/g," ");return a(">")+l(p)+c+`
|
|
35
|
-
`+y+a("^")}return" "+l(p)+c}).join(`
|
|
36
|
-
`)}toString(){let t=this.showSourceCode();return t&&(t=`
|
|
37
|
-
|
|
38
|
-
`+t+`
|
|
39
|
-
`),this.name+": "+this.message+t}},pc=El;El.default=El;var Dn={};Dn.isClean=Symbol("isClean");Dn.my=Symbol("my");var Jf={after:`
|
|
40
|
-
`,beforeClose:`
|
|
41
|
-
`,beforeComment:`
|
|
42
|
-
`,beforeDecl:`
|
|
43
|
-
`,beforeOpen:" ",beforeRule:`
|
|
44
|
-
`,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function SA(e){return e[0].toUpperCase()+e.slice(1)}var Pl=class{constructor(t){this.builder=t}atrule(t,r){let n="@"+t.name,o=t.params?this.rawValue(t,"params"):"";if(typeof t.raws.afterName<"u"?n+=t.raws.afterName:o&&(n+=" "),t.nodes)this.block(t,n+o);else{let i=(t.raws.between||"")+(r?";":"");this.builder(n+o+i,t)}}beforeAfter(t,r){let n;t.type==="decl"?n=this.raw(t,null,"beforeDecl"):t.type==="comment"?n=this.raw(t,null,"beforeComment"):r==="before"?n=this.raw(t,null,"beforeRule"):n=this.raw(t,null,"beforeClose");let o=t.parent,i=0;for(;o&&o.type!=="root";)i+=1,o=o.parent;if(n.includes(`
|
|
45
|
-
`)){let s=this.raw(t,null,"indent");if(s.length)for(let a=0;a<i;a++)n+=s}return n}block(t,r){let n=this.raw(t,"between","beforeOpen");this.builder(r+n+"{",t,"start");let o;t.nodes&&t.nodes.length?(this.body(t),o=this.raw(t,"after")):o=this.raw(t,"after","emptyBody"),o&&this.builder(o),this.builder("}",t,"end")}body(t){let r=t.nodes.length-1;for(;r>0&&t.nodes[r].type==="comment";)r-=1;let n=this.raw(t,"semicolon");for(let o=0;o<t.nodes.length;o++){let i=t.nodes[o],s=this.raw(i,"before");s&&this.builder(s),this.stringify(i,r!==o||n)}}comment(t){let r=this.raw(t,"left","commentLeft"),n=this.raw(t,"right","commentRight");this.builder("/*"+r+t.text+n+"*/",t)}decl(t,r){let n=this.raw(t,"between","colon"),o=t.prop+n+this.rawValue(t,"value");t.important&&(o+=t.raws.important||" !important"),r&&(o+=";"),this.builder(o,t)}document(t){this.body(t)}raw(t,r,n){let o;if(n||(n=r),r&&(o=t.raws[r],typeof o<"u"))return o;let i=t.parent;if(n==="before"&&(!i||i.type==="root"&&i.first===t||i&&i.type==="document"))return"";if(!i)return Jf[n];let s=t.root();if(s.rawCache||(s.rawCache={}),typeof s.rawCache[n]<"u")return s.rawCache[n];if(n==="before"||n==="after")return this.beforeAfter(t,n);{let a="raw"+SA(n);this[a]?o=this[a](s,t):s.walk(l=>{if(o=l.raws[r],typeof o<"u")return!1})}return typeof o>"u"&&(o=Jf[n]),s.rawCache[n]=o,o}rawBeforeClose(t){let r;return t.walk(n=>{if(n.nodes&&n.nodes.length>0&&typeof n.raws.after<"u")return r=n.raws.after,r.includes(`
|
|
46
|
-
`)&&(r=r.replace(/[^\n]+$/,"")),!1}),r&&(r=r.replace(/\S/g,"")),r}rawBeforeComment(t,r){let n;return t.walkComments(o=>{if(typeof o.raws.before<"u")return n=o.raws.before,n.includes(`
|
|
47
|
-
`)&&(n=n.replace(/[^\n]+$/,"")),!1}),typeof n>"u"?n=this.raw(r,null,"beforeDecl"):n&&(n=n.replace(/\S/g,"")),n}rawBeforeDecl(t,r){let n;return t.walkDecls(o=>{if(typeof o.raws.before<"u")return n=o.raws.before,n.includes(`
|
|
48
|
-
`)&&(n=n.replace(/[^\n]+$/,"")),!1}),typeof n>"u"?n=this.raw(r,null,"beforeRule"):n&&(n=n.replace(/\S/g,"")),n}rawBeforeOpen(t){let r;return t.walk(n=>{if(n.type!=="decl"&&(r=n.raws.between,typeof r<"u"))return!1}),r}rawBeforeRule(t){let r;return t.walk(n=>{if(n.nodes&&(n.parent!==t||t.first!==n)&&typeof n.raws.before<"u")return r=n.raws.before,r.includes(`
|
|
49
|
-
`)&&(r=r.replace(/[^\n]+$/,"")),!1}),r&&(r=r.replace(/\S/g,"")),r}rawColon(t){let r;return t.walkDecls(n=>{if(typeof n.raws.between<"u")return r=n.raws.between.replace(/[^\s:]/g,""),!1}),r}rawEmptyBody(t){let r;return t.walk(n=>{if(n.nodes&&n.nodes.length===0&&(r=n.raws.after,typeof r<"u"))return!1}),r}rawIndent(t){if(t.raws.indent)return t.raws.indent;let r;return t.walk(n=>{let o=n.parent;if(o&&o!==t&&o.parent&&o.parent===t&&typeof n.raws.before<"u"){let i=n.raws.before.split(`
|
|
50
|
-
`);return r=i[i.length-1],r=r.replace(/\S/g,""),!1}}),r}rawSemicolon(t){let r;return t.walk(n=>{if(n.nodes&&n.nodes.length&&n.last.type==="decl"&&(r=n.raws.semicolon,typeof r<"u"))return!1}),r}rawValue(t,r){let n=t[r],o=t.raws[r];return o&&o.value===n?o.raw:n}root(t){this.body(t),t.raws.after&&this.builder(t.raws.after)}rule(t){this.block(t,this.rawValue(t,"selector")),t.raws.ownSemicolon&&this.builder(t.raws.ownSemicolon,t,"end")}stringify(t,r){if(!this[t.type])throw new Error("Unknown AST node type "+t.type+". Maybe you need to change PostCSS stringifier.");this[t.type](t,r)}},bm=Pl;Pl.default=Pl;var bA=bm;function Al(e,t){new bA(t).stringify(e)}var ls=Al;Al.default=Al;var{isClean:vi,my:wA}=Dn,RA=pc,vA=bm,xA=ls;function Ml(e,t){let r=new e.constructor;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n)||n==="proxyCache")continue;let o=e[n],i=typeof o;n==="parent"&&i==="object"?t&&(r[n]=t):n==="source"?r[n]=o:Array.isArray(o)?r[n]=o.map(s=>Ml(s,r)):(i==="object"&&o!==null&&(o=Ml(o)),r[n]=o)}return r}var Ol=class{constructor(t={}){this.raws={},this[vi]=!1,this[wA]=!0;for(let r in t)if(r==="nodes"){this.nodes=[];for(let n of t[r])typeof n.clone=="function"?this.append(n.clone()):this.append(n)}else this[r]=t[r]}addToError(t){if(t.postcssNode=this,t.stack&&this.source&&/\n\s{4}at /.test(t.stack)){let r=this.source;t.stack=t.stack.replace(/\n\s{4}at /,`$&${r.input.from}:${r.start.line}:${r.start.column}$&`)}return t}after(t){return this.parent.insertAfter(this,t),this}assign(t={}){for(let r in t)this[r]=t[r];return this}before(t){return this.parent.insertBefore(this,t),this}cleanRaws(t){delete this.raws.before,delete this.raws.after,t||delete this.raws.between}clone(t={}){let r=Ml(this);for(let n in t)r[n]=t[n];return r}cloneAfter(t={}){let r=this.clone(t);return this.parent.insertAfter(this,r),r}cloneBefore(t={}){let r=this.clone(t);return this.parent.insertBefore(this,r),r}error(t,r={}){if(this.source){let{end:n,start:o}=this.rangeBy(r);return this.source.input.error(t,{column:o.column,line:o.line},{column:n.column,line:n.line},r)}return new RA(t)}getProxyProcessor(){return{get(t,r){return r==="proxyOf"?t:r==="root"?()=>t.root().toProxy():t[r]},set(t,r,n){return t[r]===n||(t[r]=n,(r==="prop"||r==="value"||r==="name"||r==="params"||r==="important"||r==="text")&&t.markDirty()),!0}}}markDirty(){if(this[vi]){this[vi]=!1;let t=this;for(;t=t.parent;)t[vi]=!1}}next(){if(!this.parent)return;let t=this.parent.index(this);return this.parent.nodes[t+1]}positionBy(t,r){let n=this.source.start;if(t.index)n=this.positionInside(t.index,r);else if(t.word){r=this.toString();let o=r.indexOf(t.word);o!==-1&&(n=this.positionInside(o,r))}return n}positionInside(t,r){let n=r||this.toString(),o=this.source.start.column,i=this.source.start.line;for(let s=0;s<t;s++)n[s]===`
|
|
51
|
-
`?(o=1,i+=1):o+=1;return{column:o,line:i}}prev(){if(!this.parent)return;let t=this.parent.index(this);return this.parent.nodes[t-1]}rangeBy(t){let r={column:this.source.start.column,line:this.source.start.line},n=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:r.column+1,line:r.line};if(t.word){let o=this.toString(),i=o.indexOf(t.word);i!==-1&&(r=this.positionInside(i,o),n=this.positionInside(i+t.word.length,o))}else t.start?r={column:t.start.column,line:t.start.line}:t.index&&(r=this.positionInside(t.index)),t.end?n={column:t.end.column,line:t.end.line}:typeof t.endIndex=="number"?n=this.positionInside(t.endIndex):t.index&&(n=this.positionInside(t.index+1));return(n.line<r.line||n.line===r.line&&n.column<=r.column)&&(n={column:r.column+1,line:r.line}),{end:n,start:r}}raw(t,r){return new vA().raw(this,t,r)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...t){if(this.parent){let r=this,n=!1;for(let o of t)o===this?n=!0:n?(this.parent.insertAfter(r,o),r=o):this.parent.insertBefore(r,o);n||this.remove()}return this}root(){let t=this;for(;t.parent&&t.parent.type!=="document";)t=t.parent;return t}toJSON(t,r){let n={},o=r==null;r=r||new Map;let i=0;for(let s in this){if(!Object.prototype.hasOwnProperty.call(this,s)||s==="parent"||s==="proxyCache")continue;let a=this[s];if(Array.isArray(a))n[s]=a.map(l=>typeof l=="object"&&l.toJSON?l.toJSON(null,r):l);else if(typeof a=="object"&&a.toJSON)n[s]=a.toJSON(null,r);else if(s==="source"){let l=r.get(a.input);l==null&&(l=i,r.set(a.input,i),i++),n[s]={end:a.end,inputId:l,start:a.start}}else n[s]=a}return o&&(n.inputs=[...r.keys()].map(s=>s.toJSON())),n}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(t=xA){t.stringify&&(t=t.stringify);let r="";return t(this,n=>{r+=n}),r}warn(t,r,n){let o={node:this};for(let i in n)o[i]=n[i];return t.warn(r,o)}get proxyOf(){return this}},cs=Ol;Ol.default=Ol;var kA=cs,Il=class extends kA{constructor(t){t&&typeof t.value<"u"&&typeof t.value!="string"&&(t={...t,value:String(t.value)}),super(t),this.type="decl"}get variable(){return this.prop.startsWith("--")||this.prop[0]==="$"}},us=Il;Il.default=Il;var CA="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",EA=(e,t=21)=>(r=t)=>{let n="",o=r;for(;o--;)n+=e[Math.random()*e.length|0];return n},PA=(e=21)=>{let t="",r=e;for(;r--;)t+=CA[Math.random()*64|0];return t},AA={nanoid:PA,customAlphabet:EA},{SourceMapConsumer:Xf,SourceMapGenerator:Qf}=We,{existsSync:MA,readFileSync:OA}=We,{dirname:rl,join:IA}=We;function TA(e){return Buffer?Buffer.from(e,"base64").toString():window.atob(e)}var Tl=class{constructor(t,r){if(r.map===!1)return;this.loadAnnotation(t),this.inline=this.startWith(this.annotation,"data:");let n=r.map?r.map.prev:void 0,o=this.loadMap(r.from,n);!this.mapFile&&r.from&&(this.mapFile=r.from),this.mapFile&&(this.root=rl(this.mapFile)),o&&(this.text=o)}consumer(){return this.consumerCache||(this.consumerCache=new Xf(this.text)),this.consumerCache}decodeInline(t){let r=/^data:application\/json;charset=utf-?8;base64,/,n=/^data:application\/json;base64,/,o=/^data:application\/json;charset=utf-?8,/,i=/^data:application\/json,/;if(o.test(t)||i.test(t))return decodeURIComponent(t.substr(RegExp.lastMatch.length));if(r.test(t)||n.test(t))return TA(t.substr(RegExp.lastMatch.length));let s=t.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+s)}getAnnotationURL(t){return t.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(t){return typeof t!="object"?!1:typeof t.mappings=="string"||typeof t._mappings=="string"||Array.isArray(t.sections)}loadAnnotation(t){let r=t.match(/\/\*\s*# sourceMappingURL=/gm);if(!r)return;let n=t.lastIndexOf(r.pop()),o=t.indexOf("*/",n);n>-1&&o>-1&&(this.annotation=this.getAnnotationURL(t.substring(n,o)))}loadFile(t){if(this.root=rl(t),MA(t))return this.mapFile=t,OA(t,"utf-8").toString().trim()}loadMap(t,r){if(r===!1)return!1;if(r){if(typeof r=="string")return r;if(typeof r=="function"){let n=r(t);if(n){let o=this.loadFile(n);if(!o)throw new Error("Unable to load previous source map: "+n.toString());return o}}else{if(r instanceof Xf)return Qf.fromSourceMap(r).toString();if(r instanceof Qf)return r.toString();if(this.isMap(r))return JSON.stringify(r);throw new Error("Unsupported previous source map format: "+r.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let n=this.annotation;return t&&(n=IA(rl(t),n)),this.loadFile(n)}}}startWith(t,r){return t?t.substr(0,r.length)===r:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}},wm=Tl;Tl.default=Tl;var{SourceMapConsumer:LA,SourceMapGenerator:NA}=We,{fileURLToPath:eh,pathToFileURL:xi}=We,{isAbsolute:Ll,resolve:Nl}=We,{nanoid:FA}=AA,nl=We,th=pc,$A=wm,ol=Symbol("fromOffsetCache"),DA=!!(LA&&NA),rh=!!(Nl&&Ll),Yi=class{constructor(t,r={}){if(t===null||typeof t>"u"||typeof t=="object"&&!t.toString)throw new Error(`PostCSS received ${t} instead of CSS string`);if(this.css=t.toString(),this.css[0]==="\uFEFF"||this.css[0]==="\uFFFE"?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,r.from&&(!rh||/^\w+:\/\//.test(r.from)||Ll(r.from)?this.file=r.from:this.file=Nl(r.from)),rh&&DA){let n=new $A(this.css,r);if(n.text){this.map=n;let o=n.consumer().file;!this.file&&o&&(this.file=this.mapResolve(o))}}this.file||(this.id="<input css "+FA(6)+">"),this.map&&(this.map.file=this.from)}error(t,r,n,o={}){let i,s,a;if(r&&typeof r=="object"){let c=r,u=n;if(typeof c.offset=="number"){let d=this.fromOffset(c.offset);r=d.line,n=d.col}else r=c.line,n=c.column;if(typeof u.offset=="number"){let d=this.fromOffset(u.offset);s=d.line,a=d.col}else s=u.line,a=u.column}else if(!n){let c=this.fromOffset(r);r=c.line,n=c.col}let l=this.origin(r,n,s,a);return l?i=new th(t,l.endLine===void 0?l.line:{column:l.column,line:l.line},l.endLine===void 0?l.column:{column:l.endColumn,line:l.endLine},l.source,l.file,o.plugin):i=new th(t,s===void 0?r:{column:n,line:r},s===void 0?n:{column:a,line:s},this.css,this.file,o.plugin),i.input={column:n,endColumn:a,endLine:s,line:r,source:this.css},this.file&&(xi&&(i.input.url=xi(this.file).toString()),i.input.file=this.file),i}fromOffset(t){let r,n;if(this[ol])n=this[ol];else{let i=this.css.split(`
|
|
52
|
-
`);n=new Array(i.length);let s=0;for(let a=0,l=i.length;a<l;a++)n[a]=s,s+=i[a].length+1;this[ol]=n}r=n[n.length-1];let o=0;if(t>=r)o=n.length-1;else{let i=n.length-2,s;for(;o<i;)if(s=o+(i-o>>1),t<n[s])i=s-1;else if(t>=n[s+1])o=s+1;else{o=s;break}}return{col:t-n[o]+1,line:o+1}}mapResolve(t){return/^\w+:\/\//.test(t)?t:Nl(this.map.consumer().sourceRoot||this.map.root||".",t)}origin(t,r,n,o){if(!this.map)return!1;let i=this.map.consumer(),s=i.originalPositionFor({column:r,line:t});if(!s.source)return!1;let a;typeof n=="number"&&(a=i.originalPositionFor({column:o,line:n}));let l;Ll(s.source)?l=xi(s.source):l=new URL(s.source,this.map.consumer().sourceRoot||xi(this.map.mapFile));let c={column:s.column,endColumn:a&&a.column,endLine:a&&a.line,line:s.line,url:l.toString()};if(l.protocol==="file:")if(eh)c.file=eh(l);else throw new Error("file: protocol is not available in this PostCSS build");let u=i.sourceContentFor(s.source);return u&&(c.source=u),c}toJSON(){let t={};for(let r of["hasBOM","css","file","id"])this[r]!=null&&(t[r]=this[r]);return this.map&&(t.map={...this.map},t.map.consumerCache&&(t.map.consumerCache=void 0)),t}get from(){return this.file||this.id}},ds=Yi;Yi.default=Yi;nl&&nl.registerInput&&nl.registerInput(Yi);var{SourceMapConsumer:Rm,SourceMapGenerator:$i}=We,{dirname:Di,relative:vm,resolve:xm,sep:km}=We,{pathToFileURL:nh}=We,_A=ds,BA=!!(Rm&&$i),jA=!!(Di&&xm&&vm&&km),VA=class{constructor(t,r,n,o){this.stringify=t,this.mapOpts=n.map||{},this.root=r,this.opts=n,this.css=o,this.originalCSS=o,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let t;this.isInline()?t="data:application/json;base64,"+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation=="string"?t=this.mapOpts.annotation:typeof this.mapOpts.annotation=="function"?t=this.mapOpts.annotation(this.opts.to,this.root):t=this.outputFile()+".map";let r=`
|
|
53
|
-
`;this.css.includes(`\r
|
|
54
|
-
`)&&(r=`\r
|
|
55
|
-
`),this.css+=r+"/*# sourceMappingURL="+t+" */"}applyPrevMaps(){for(let t of this.previous()){let r=this.toUrl(this.path(t.file)),n=t.root||Di(t.file),o;this.mapOpts.sourcesContent===!1?(o=new Rm(t.text),o.sourcesContent&&(o.sourcesContent=null)):o=t.consumer(),this.map.applySourceMap(o,r,this.toUrl(this.path(n)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1)if(this.root){let t;for(let r=this.root.nodes.length-1;r>=0;r--)t=this.root.nodes[r],t.type==="comment"&&t.text.indexOf("# sourceMappingURL=")===0&&this.root.removeChild(r)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),jA&&BA&&this.isMap())return this.generateMap();{let t="";return this.stringify(this.root,r=>{t+=r}),[t]}}generateMap(){if(this.root)this.generateString();else if(this.previous().length===1){let t=this.previous()[0].consumer();t.file=this.outputFile(),this.map=$i.fromSourceMap(t,{ignoreInvalidMapping:!0})}else this.map=new $i({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 $i({file:this.outputFile(),ignoreInvalidMapping:!0});let t=1,r=1,n="<no source>",o={generated:{column:0,line:0},original:{column:0,line:0},source:""},i,s;this.stringify(this.root,(a,l,c)=>{if(this.css+=a,l&&c!=="end"&&(o.generated.line=t,o.generated.column=r-1,l.source&&l.source.start?(o.source=this.sourcePath(l),o.original.line=l.source.start.line,o.original.column=l.source.start.column-1,this.map.addMapping(o)):(o.source=n,o.original.line=1,o.original.column=0,this.map.addMapping(o))),i=a.match(/\n/g),i?(t+=i.length,s=a.lastIndexOf(`
|
|
56
|
-
`),r=a.length-s):r+=a.length,l&&c!=="start"){let u=l.parent||{raws:{}};(!(l.type==="decl"||l.type==="atrule"&&!l.nodes)||l!==u.last||u.raws.semicolon)&&(l.source&&l.source.end?(o.source=this.sourcePath(l),o.original.line=l.source.end.line,o.original.column=l.source.end.column-1,o.generated.line=t,o.generated.column=r-2,this.map.addMapping(o)):(o.source=n,o.original.line=1,o.original.column=0,o.generated.line=t,o.generated.column=r-1,this.map.addMapping(o)))}})}isAnnotation(){return this.isInline()?!0:typeof this.mapOpts.annotation<"u"?this.mapOpts.annotation:this.previous().length?this.previous().some(t=>t.annotation):!0}isInline(){if(typeof this.mapOpts.inline<"u")return this.mapOpts.inline;let t=this.mapOpts.annotation;return typeof t<"u"&&t!==!0?!1:this.previous().length?this.previous().some(r=>r.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(t=>t.withContent()):!0}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(t){if(this.mapOpts.absolute||t.charCodeAt(0)===60||/^\w+:\/\//.test(t))return t;let r=this.memoizedPaths.get(t);if(r)return r;let n=this.opts.to?Di(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(n=Di(xm(n,this.mapOpts.annotation)));let o=vm(n,t);return this.memoizedPaths.set(t,o),o}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(t=>{if(t.source&&t.source.input.map){let r=t.source.input.map;this.previousMaps.includes(r)||this.previousMaps.push(r)}});else{let t=new _A(this.originalCSS,this.opts);t.map&&this.previousMaps.push(t.map)}return this.previousMaps}setSourcesContent(){let t={};if(this.root)this.root.walk(r=>{if(r.source){let n=r.source.input.from;if(n&&!t[n]){t[n]=!0;let o=this.usesFileUrls?this.toFileUrl(n):this.toUrl(this.path(n));this.map.setSourceContent(o,r.source.input.css)}}});else if(this.css){let r=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(r,this.css)}}sourcePath(t){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(t.source.input.from):this.toUrl(this.path(t.source.input.from))}toBase64(t){return Buffer?Buffer.from(t).toString("base64"):window.btoa(unescape(encodeURIComponent(t)))}toFileUrl(t){let r=this.memoizedFileURLs.get(t);if(r)return r;if(nh){let n=nh(t).toString();return this.memoizedFileURLs.set(t,n),n}else throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(t){let r=this.memoizedURLs.get(t);if(r)return r;km==="\\"&&(t=t.replace(/\\/g,"/"));let n=encodeURI(t).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(t,n),n}},Cm=VA,WA=cs,Fl=class extends WA{constructor(t){super(t),this.type="comment"}},ps=Fl;Fl.default=Fl;var{isClean:Em,my:Pm}=Dn,Am=us,Mm=ps,UA=cs,Om,fc,hc,Im;function Tm(e){return e.map(t=>(t.nodes&&(t.nodes=Tm(t.nodes)),delete t.source,t))}function Lm(e){if(e[Em]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)Lm(t)}var mt=class Nm extends UA{append(...t){for(let r of t){let n=this.normalize(r,this.last);for(let o of n)this.proxyOf.nodes.push(o)}return this.markDirty(),this}cleanRaws(t){if(super.cleanRaws(t),this.nodes)for(let r of this.nodes)r.cleanRaws(t)}each(t){if(!this.proxyOf.nodes)return;let r=this.getIterator(),n,o;for(;this.indexes[r]<this.proxyOf.nodes.length&&(n=this.indexes[r],o=t(this.proxyOf.nodes[n],n),o!==!1);)this.indexes[r]+=1;return delete this.indexes[r],o}every(t){return this.nodes.every(t)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let t=this.lastEach;return this.indexes[t]=0,t}getProxyProcessor(){return{get(t,r){return r==="proxyOf"?t:t[r]?r==="each"||typeof r=="string"&&r.startsWith("walk")?(...n)=>t[r](...n.map(o=>typeof o=="function"?(i,s)=>o(i.toProxy(),s):o)):r==="every"||r==="some"?n=>t[r]((o,...i)=>n(o.toProxy(),...i)):r==="root"?()=>t.root().toProxy():r==="nodes"?t.nodes.map(n=>n.toProxy()):r==="first"||r==="last"?t[r].toProxy():t[r]:t[r]},set(t,r,n){return t[r]===n||(t[r]=n,(r==="name"||r==="params"||r==="selector")&&t.markDirty()),!0}}}index(t){return typeof t=="number"?t:(t.proxyOf&&(t=t.proxyOf),this.proxyOf.nodes.indexOf(t))}insertAfter(t,r){let n=this.index(t),o=this.normalize(r,this.proxyOf.nodes[n]).reverse();n=this.index(t);for(let s of o)this.proxyOf.nodes.splice(n+1,0,s);let i;for(let s in this.indexes)i=this.indexes[s],n<i&&(this.indexes[s]=i+o.length);return this.markDirty(),this}insertBefore(t,r){let n=this.index(t),o=n===0?"prepend":!1,i=this.normalize(r,this.proxyOf.nodes[n],o).reverse();n=this.index(t);for(let a of i)this.proxyOf.nodes.splice(n,0,a);let s;for(let a in this.indexes)s=this.indexes[a],n<=s&&(this.indexes[a]=s+i.length);return this.markDirty(),this}normalize(t,r){if(typeof t=="string")t=Tm(Om(t).nodes);else if(typeof t>"u")t=[];else if(Array.isArray(t)){t=t.slice(0);for(let o of t)o.parent&&o.parent.removeChild(o,"ignore")}else if(t.type==="root"&&this.type!=="document"){t=t.nodes.slice(0);for(let o of t)o.parent&&o.parent.removeChild(o,"ignore")}else if(t.type)t=[t];else if(t.prop){if(typeof t.value>"u")throw new Error("Value field is missed in node creation");typeof t.value!="string"&&(t.value=String(t.value)),t=[new Am(t)]}else if(t.selector)t=[new fc(t)];else if(t.name)t=[new hc(t)];else if(t.text)t=[new Mm(t)];else throw new Error("Unknown node type in node creation");return t.map(o=>(o[Pm]||Nm.rebuild(o),o=o.proxyOf,o.parent&&o.parent.removeChild(o),o[Em]&&Lm(o),typeof o.raws.before>"u"&&r&&typeof r.raws.before<"u"&&(o.raws.before=r.raws.before.replace(/\S/g,"")),o.parent=this.proxyOf,o))}prepend(...t){t=t.reverse();for(let r of t){let n=this.normalize(r,this.first,"prepend").reverse();for(let o of n)this.proxyOf.nodes.unshift(o);for(let o in this.indexes)this.indexes[o]=this.indexes[o]+n.length}return this.markDirty(),this}push(t){return t.parent=this,this.proxyOf.nodes.push(t),this}removeAll(){for(let t of this.proxyOf.nodes)t.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(t){t=this.index(t),this.proxyOf.nodes[t].parent=void 0,this.proxyOf.nodes.splice(t,1);let r;for(let n in this.indexes)r=this.indexes[n],r>=t&&(this.indexes[n]=r-1);return this.markDirty(),this}replaceValues(t,r,n){return n||(n=r,r={}),this.walkDecls(o=>{r.props&&!r.props.includes(o.prop)||r.fast&&!o.value.includes(r.fast)||(o.value=o.value.replace(t,n))}),this.markDirty(),this}some(t){return this.nodes.some(t)}walk(t){return this.each((r,n)=>{let o;try{o=t(r,n)}catch(i){throw r.addToError(i)}return o!==!1&&r.walk&&(o=r.walk(t)),o})}walkAtRules(t,r){return r?t instanceof RegExp?this.walk((n,o)=>{if(n.type==="atrule"&&t.test(n.name))return r(n,o)}):this.walk((n,o)=>{if(n.type==="atrule"&&n.name===t)return r(n,o)}):(r=t,this.walk((n,o)=>{if(n.type==="atrule")return r(n,o)}))}walkComments(t){return this.walk((r,n)=>{if(r.type==="comment")return t(r,n)})}walkDecls(t,r){return r?t instanceof RegExp?this.walk((n,o)=>{if(n.type==="decl"&&t.test(n.prop))return r(n,o)}):this.walk((n,o)=>{if(n.type==="decl"&&n.prop===t)return r(n,o)}):(r=t,this.walk((n,o)=>{if(n.type==="decl")return r(n,o)}))}walkRules(t,r){return r?t instanceof RegExp?this.walk((n,o)=>{if(n.type==="rule"&&t.test(n.selector))return r(n,o)}):this.walk((n,o)=>{if(n.type==="rule"&&n.selector===t)return r(n,o)}):(r=t,this.walk((n,o)=>{if(n.type==="rule")return r(n,o)}))}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]}};mt.registerParse=e=>{Om=e};mt.registerRule=e=>{fc=e};mt.registerAtRule=e=>{hc=e};mt.registerRoot=e=>{Im=e};var qt=mt;mt.default=mt;mt.rebuild=e=>{e.type==="atrule"?Object.setPrototypeOf(e,hc.prototype):e.type==="rule"?Object.setPrototypeOf(e,fc.prototype):e.type==="decl"?Object.setPrototypeOf(e,Am.prototype):e.type==="comment"?Object.setPrototypeOf(e,Mm.prototype):e.type==="root"&&Object.setPrototypeOf(e,Im.prototype),e[Pm]=!0,e.nodes&&e.nodes.forEach(t=>{mt.rebuild(t)})};var zA=qt,Fm,$m,On=class extends zA{constructor(t){super({type:"document",...t}),this.nodes||(this.nodes=[])}toResult(t={}){return new Fm(new $m,this,t).stringify()}};On.registerLazyResult=e=>{Fm=e};On.registerProcessor=e=>{$m=e};var mc=On;On.default=On;var oh={},Dm=function(t){oh[t]||(oh[t]=!0,typeof console<"u"&&console.warn&&console.warn(t))},$l=class{constructor(t,r={}){if(this.type="warning",this.text=t,r.node&&r.node.source){let n=r.node.rangeBy(r);this.line=n.start.line,this.column=n.start.column,this.endLine=n.end.line,this.endColumn=n.end.column}for(let n in r)this[n]=r[n]}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}},_m=$l;$l.default=$l;var GA=_m,Dl=class{constructor(t,r,n){this.processor=t,this.messages=[],this.root=r,this.opts=n,this.css=void 0,this.map=void 0}toString(){return this.css}warn(t,r={}){r.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(r.plugin=this.lastPlugin.postcssPlugin);let n=new GA(t,r);return this.messages.push(n),n}warnings(){return this.messages.filter(t=>t.type==="warning")}get content(){return this.css}},yc=Dl;Dl.default=Dl;var il=39,ih=34,ki=92,sh=47,Ci=10,bn=32,Ei=12,Pi=9,Ai=13,KA=91,qA=93,HA=40,YA=41,ZA=123,JA=125,XA=59,QA=42,eM=58,tM=64,Mi=/[\t\n\f\r "#'()/;[\\\]{}]/g,Oi=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,rM=/.[\r\n"'(/\\]/,ah=/[\da-f]/i,nM=function(t,r={}){let n=t.css.valueOf(),o=r.ignoreErrors,i,s,a,l,c,u,d,p,y,h,f=n.length,m=0,v=[],w=[];function g(){return m}function k(G){throw t.error("Unclosed "+G,m)}function _(){return w.length===0&&m>=f}function V(G){if(w.length)return w.pop();if(m>=f)return;let Q=G?G.ignoreUnclosed:!1;switch(i=n.charCodeAt(m),i){case Ci:case bn:case Pi:case Ai:case Ei:{s=m;do s+=1,i=n.charCodeAt(s);while(i===bn||i===Ci||i===Pi||i===Ai||i===Ei);h=["space",n.slice(m,s)],m=s-1;break}case KA:case qA:case ZA:case JA:case eM:case XA:case YA:{let le=String.fromCharCode(i);h=[le,le,m];break}case HA:{if(p=v.length?v.pop()[1]:"",y=n.charCodeAt(m+1),p==="url"&&y!==il&&y!==ih&&y!==bn&&y!==Ci&&y!==Pi&&y!==Ei&&y!==Ai){s=m;do{if(u=!1,s=n.indexOf(")",s+1),s===-1)if(o||Q){s=m;break}else k("bracket");for(d=s;n.charCodeAt(d-1)===ki;)d-=1,u=!u}while(u);h=["brackets",n.slice(m,s+1),m,s],m=s}else s=n.indexOf(")",m+1),l=n.slice(m,s+1),s===-1||rM.test(l)?h=["(","(",m]:(h=["brackets",l,m,s],m=s);break}case il:case ih:{a=i===il?"'":'"',s=m;do{if(u=!1,s=n.indexOf(a,s+1),s===-1)if(o||Q){s=m+1;break}else k("string");for(d=s;n.charCodeAt(d-1)===ki;)d-=1,u=!u}while(u);h=["string",n.slice(m,s+1),m,s],m=s;break}case tM:{Mi.lastIndex=m+1,Mi.test(n),Mi.lastIndex===0?s=n.length-1:s=Mi.lastIndex-2,h=["at-word",n.slice(m,s+1),m,s],m=s;break}case ki:{for(s=m,c=!0;n.charCodeAt(s+1)===ki;)s+=1,c=!c;if(i=n.charCodeAt(s+1),c&&i!==sh&&i!==bn&&i!==Ci&&i!==Pi&&i!==Ai&&i!==Ei&&(s+=1,ah.test(n.charAt(s)))){for(;ah.test(n.charAt(s+1));)s+=1;n.charCodeAt(s+1)===bn&&(s+=1)}h=["word",n.slice(m,s+1),m,s],m=s;break}default:{i===sh&&n.charCodeAt(m+1)===QA?(s=n.indexOf("*/",m+2)+1,s===0&&(o||Q?s=n.length:k("comment")),h=["comment",n.slice(m,s+1),m,s],m=s):(Oi.lastIndex=m+1,Oi.test(n),Oi.lastIndex===0?s=n.length-1:s=Oi.lastIndex-2,h=["word",n.slice(m,s+1),m,s],v.push(h),m=s);break}}return m++,h}function te(G){w.push(G)}return{back:te,endOfFile:_,nextToken:V,position:g}},Bm=qt,Zi=class extends Bm{constructor(t){super(t),this.type="atrule"}append(...t){return this.proxyOf.nodes||(this.nodes=[]),super.append(...t)}prepend(...t){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...t)}},gc=Zi;Zi.default=Zi;Bm.registerAtRule(Zi);var jm=qt,Vm,Wm,Ir=class extends jm{constructor(t){super(t),this.type="root",this.nodes||(this.nodes=[])}normalize(t,r,n){let o=super.normalize(t);if(r){if(n==="prepend")this.nodes.length>1?r.raws.before=this.nodes[1].raws.before:delete r.raws.before;else if(this.first!==r)for(let i of o)i.raws.before=r.raws.before}return o}removeChild(t,r){let n=this.index(t);return!r&&n===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[n].raws.before),super.removeChild(t)}toResult(t={}){return new Vm(new Wm,this,t).stringify()}};Ir.registerLazyResult=e=>{Vm=e};Ir.registerProcessor=e=>{Wm=e};var _n=Ir;Ir.default=Ir;jm.registerRoot(Ir);var In={comma(e){return In.split(e,[","],!0)},space(e){let t=[" ",`
|
|
57
|
-
`," "];return In.split(e,t)},split(e,t,r){let n=[],o="",i=!1,s=0,a=!1,l="",c=!1;for(let u of e)c?c=!1:u==="\\"?c=!0:a?u===l&&(a=!1):u==='"'||u==="'"?(a=!0,l=u):u==="("?s+=1:u===")"?s>0&&(s-=1):s===0&&t.includes(u)&&(i=!0),i?(o!==""&&n.push(o.trim()),o="",i=!1):o+=u;return(r||o!=="")&&n.push(o.trim()),n}},Um=In;In.default=In;var zm=qt,oM=Um,Ji=class extends zm{constructor(t){super(t),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return oM.comma(this.selector)}set selectors(t){let r=this.selector?this.selector.match(/,\s*/):null,n=r?r[0]:","+this.raw("between","beforeOpen");this.selector=t.join(n)}},Sc=Ji;Ji.default=Ji;zm.registerRule(Ji);var iM=us,sM=nM,aM=ps,lM=gc,cM=_n,lh=Sc,ch={empty:!0,space:!0};function uM(e){for(let t=e.length-1;t>=0;t--){let r=e[t],n=r[3]||r[2];if(n)return n}}var dM=class{constructor(t){this.input=t,this.root=new cM,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:t,start:{column:1,line:1,offset:0}}}atrule(t){let r=new lM;r.name=t[1].slice(1),r.name===""&&this.unnamedAtrule(r,t),this.init(r,t[2]);let n,o,i,s=!1,a=!1,l=[],c=[];for(;!this.tokenizer.endOfFile();){if(t=this.tokenizer.nextToken(),n=t[0],n==="("||n==="["?c.push(n==="("?")":"]"):n==="{"&&c.length>0?c.push("}"):n===c[c.length-1]&&c.pop(),c.length===0)if(n===";"){r.source.end=this.getPosition(t[2]),r.source.end.offset++,this.semicolon=!0;break}else if(n==="{"){a=!0;break}else if(n==="}"){if(l.length>0){for(i=l.length-1,o=l[i];o&&o[0]==="space";)o=l[--i];o&&(r.source.end=this.getPosition(o[3]||o[2]),r.source.end.offset++)}this.end(t);break}else l.push(t);else l.push(t);if(this.tokenizer.endOfFile()){s=!0;break}}r.raws.between=this.spacesAndCommentsFromEnd(l),l.length?(r.raws.afterName=this.spacesAndCommentsFromStart(l),this.raw(r,"params",l),s&&(t=l[l.length-1],r.source.end=this.getPosition(t[3]||t[2]),r.source.end.offset++,this.spaces=r.raws.between,r.raws.between="")):(r.raws.afterName="",r.params=""),a&&(r.nodes=[],this.current=r)}checkMissedSemicolon(t){let r=this.colon(t);if(r===!1)return;let n=0,o;for(let i=r-1;i>=0&&(o=t[i],!(o[0]!=="space"&&(n+=1,n===2)));i--);throw this.input.error("Missed semicolon",o[0]==="word"?o[3]+1:o[2])}colon(t){let r=0,n,o,i;for(let[s,a]of t.entries()){if(n=a,o=n[0],o==="("&&(r+=1),o===")"&&(r-=1),r===0&&o===":")if(!i)this.doubleColon(n);else{if(i[0]==="word"&&i[1]==="progid")continue;return s}i=n}return!1}comment(t){let r=new aM;this.init(r,t[2]),r.source.end=this.getPosition(t[3]||t[2]),r.source.end.offset++;let n=t[1].slice(2,-2);if(/^\s*$/.test(n))r.text="",r.raws.left=n,r.raws.right="";else{let o=n.match(/^(\s*)([^]*\S)(\s*)$/);r.text=o[2],r.raws.left=o[1],r.raws.right=o[3]}}createTokenizer(){this.tokenizer=sM(this.input)}decl(t,r){let n=new iM;this.init(n,t[0][2]);let o=t[t.length-1];for(o[0]===";"&&(this.semicolon=!0,t.pop()),n.source.end=this.getPosition(o[3]||o[2]||uM(t)),n.source.end.offset++;t[0][0]!=="word";)t.length===1&&this.unknownWord(t),n.raws.before+=t.shift()[1];for(n.source.start=this.getPosition(t[0][2]),n.prop="";t.length;){let c=t[0][0];if(c===":"||c==="space"||c==="comment")break;n.prop+=t.shift()[1]}n.raws.between="";let i;for(;t.length;)if(i=t.shift(),i[0]===":"){n.raws.between+=i[1];break}else i[0]==="word"&&/\w/.test(i[1])&&this.unknownWord([i]),n.raws.between+=i[1];(n.prop[0]==="_"||n.prop[0]==="*")&&(n.raws.before+=n.prop[0],n.prop=n.prop.slice(1));let s=[],a;for(;t.length&&(a=t[0][0],!(a!=="space"&&a!=="comment"));)s.push(t.shift());this.precheckMissedSemicolon(t);for(let c=t.length-1;c>=0;c--){if(i=t[c],i[1].toLowerCase()==="!important"){n.important=!0;let u=this.stringFrom(t,c);u=this.spacesFromEnd(t)+u,u!==" !important"&&(n.raws.important=u);break}else if(i[1].toLowerCase()==="important"){let u=t.slice(0),d="";for(let p=c;p>0;p--){let y=u[p][0];if(d.trim().indexOf("!")===0&&y!=="space")break;d=u.pop()[1]+d}d.trim().indexOf("!")===0&&(n.important=!0,n.raws.important=d,t=u)}if(i[0]!=="space"&&i[0]!=="comment")break}t.some(c=>c[0]!=="space"&&c[0]!=="comment")&&(n.raws.between+=s.map(c=>c[1]).join(""),s=[]),this.raw(n,"value",s.concat(t),r),n.value.includes(":")&&!r&&this.checkMissedSemicolon(t)}doubleColon(t){throw this.input.error("Double colon",{offset:t[2]},{offset:t[2]+t[1].length})}emptyRule(t){let r=new lh;this.init(r,t[2]),r.selector="",r.raws.between="",this.current=r}end(t){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(t[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(t)}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(t){if(this.spaces+=t[1],this.current.nodes){let r=this.current.nodes[this.current.nodes.length-1];r&&r.type==="rule"&&!r.raws.ownSemicolon&&(r.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(t){let r=this.input.fromOffset(t);return{column:r.col,line:r.line,offset:t}}init(t,r){this.current.push(t),t.source={input:this.input,start:this.getPosition(r)},t.raws.before=this.spaces,this.spaces="",t.type!=="comment"&&(this.semicolon=!1)}other(t){let r=!1,n=null,o=!1,i=null,s=[],a=t[1].startsWith("--"),l=[],c=t;for(;c;){if(n=c[0],l.push(c),n==="("||n==="[")i||(i=c),s.push(n==="("?")":"]");else if(a&&o&&n==="{")i||(i=c),s.push("}");else if(s.length===0)if(n===";")if(o){this.decl(l,a);return}else break;else if(n==="{"){this.rule(l);return}else if(n==="}"){this.tokenizer.back(l.pop()),r=!0;break}else n===":"&&(o=!0);else n===s[s.length-1]&&(s.pop(),s.length===0&&(i=null));c=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(r=!0),s.length>0&&this.unclosedBracket(i),r&&o){if(!a)for(;l.length&&(c=l[l.length-1][0],!(c!=="space"&&c!=="comment"));)this.tokenizer.back(l.pop());this.decl(l,a)}else this.unknownWord(l)}parse(){let t;for(;!this.tokenizer.endOfFile();)switch(t=this.tokenizer.nextToken(),t[0]){case"space":this.spaces+=t[1];break;case";":this.freeSemicolon(t);break;case"}":this.end(t);break;case"comment":this.comment(t);break;case"at-word":this.atrule(t);break;case"{":this.emptyRule(t);break;default:this.other(t);break}this.endFile()}precheckMissedSemicolon(){}raw(t,r,n,o){let i,s,a=n.length,l="",c=!0,u,d;for(let p=0;p<a;p+=1)i=n[p],s=i[0],s==="space"&&p===a-1&&!o?c=!1:s==="comment"?(d=n[p-1]?n[p-1][0]:"empty",u=n[p+1]?n[p+1][0]:"empty",!ch[d]&&!ch[u]?l.slice(-1)===","?c=!1:l+=i[1]:c=!1):l+=i[1];if(!c){let p=n.reduce((y,h)=>y+h[1],"");t.raws[r]={raw:p,value:l}}t[r]=l}rule(t){t.pop();let r=new lh;this.init(r,t[0][2]),r.raws.between=this.spacesAndCommentsFromEnd(t),this.raw(r,"selector",t),this.current=r}spacesAndCommentsFromEnd(t){let r,n="";for(;t.length&&(r=t[t.length-1][0],!(r!=="space"&&r!=="comment"));)n=t.pop()[1]+n;return n}spacesAndCommentsFromStart(t){let r,n="";for(;t.length&&(r=t[0][0],!(r!=="space"&&r!=="comment"));)n+=t.shift()[1];return n}spacesFromEnd(t){let r,n="";for(;t.length&&(r=t[t.length-1][0],r==="space");)n=t.pop()[1]+n;return n}stringFrom(t,r){let n="";for(let o=r;o<t.length;o++)n+=t[o][1];return t.splice(r,t.length-r),n}unclosedBlock(){let t=this.current.source.start;throw this.input.error("Unclosed block",t.line,t.column)}unclosedBracket(t){throw this.input.error("Unclosed bracket",{offset:t[2]},{offset:t[2]+1})}unexpectedClose(t){throw this.input.error("Unexpected }",{offset:t[2]},{offset:t[2]+1})}unknownWord(t){throw this.input.error("Unknown word",{offset:t[0][2]},{offset:t[0][2]+t[0][1].length})}unnamedAtrule(t,r){throw this.input.error("At-rule without name",{offset:r[2]},{offset:r[2]+r[1].length})}},pM=dM,fM=qt,hM=pM,mM=ds;function Xi(e,t){let r=new mM(e,t),n=new hM(r);try{n.parse()}catch(o){throw process.env.NODE_ENV!=="production"&&o.name==="CssSyntaxError"&&t&&t.from&&(/\.scss$/i.test(t.from)?o.message+=`
|
|
58
|
-
You tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser`:/\.sass/i.test(t.from)?o.message+=`
|
|
59
|
-
You tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser`:/\.less$/i.test(t.from)&&(o.message+=`
|
|
60
|
-
You tried to parse Less with the standard CSS parser; try again with the postcss-less parser`)),o}return n.root}var bc=Xi;Xi.default=Xi;fM.registerParse(Xi);var{isClean:nt,my:yM}=Dn,gM=Cm,SM=ls,bM=qt,wM=mc,RM=Dm,uh=yc,vM=bc,xM=_n,kM={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},CM={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},EM={Once:!0,postcssPlugin:!0,prepare:!0},Tr=0;function wn(e){return typeof e=="object"&&typeof e.then=="function"}function Gm(e){let t=!1,r=kM[e.type];return e.type==="decl"?t=e.prop.toLowerCase():e.type==="atrule"&&(t=e.name.toLowerCase()),t&&e.append?[r,r+"-"+t,Tr,r+"Exit",r+"Exit-"+t]:t?[r,r+"-"+t,r+"Exit",r+"Exit-"+t]:e.append?[r,Tr,r+"Exit"]:[r,r+"Exit"]}function dh(e){let t;return e.type==="document"?t=["Document",Tr,"DocumentExit"]:e.type==="root"?t=["Root",Tr,"RootExit"]:t=Gm(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function _l(e){return e[nt]=!1,e.nodes&&e.nodes.forEach(t=>_l(t)),e}var Bl={},Lr=class Km{constructor(t,r,n){this.stringified=!1,this.processed=!1;let o;if(typeof r=="object"&&r!==null&&(r.type==="root"||r.type==="document"))o=_l(r);else if(r instanceof Km||r instanceof uh)o=_l(r.root),r.map&&(typeof n.map>"u"&&(n.map={}),n.map.inline||(n.map.inline=!1),n.map.prev=r.map);else{let i=vM;n.syntax&&(i=n.syntax.parse),n.parser&&(i=n.parser),i.parse&&(i=i.parse);try{o=i(r,n)}catch(s){this.processed=!0,this.error=s}o&&!o[yM]&&bM.rebuild(o)}this.result=new uh(t,o,n),this.helpers={...Bl,postcss:Bl,result:this.result},this.plugins=this.processor.plugins.map(i=>typeof i=="object"&&i.prepare?{...i,...i.prepare(this.result)}:i)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(t){return this.async().catch(t)}finally(t){return this.async().then(t,t)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(t,r){let n=this.result.lastPlugin;try{if(r&&r.addToError(t),this.error=t,t.name==="CssSyntaxError"&&!t.plugin)t.plugin=n.postcssPlugin,t.setMessage();else if(n.postcssVersion&&process.env.NODE_ENV!=="production"){let o=n.postcssPlugin,i=n.postcssVersion,s=this.result.processor.version,a=i.split("."),l=s.split(".");(a[0]!==l[0]||parseInt(a[1])>parseInt(l[1]))&&console.error("Unknown error from PostCSS plugin. Your current PostCSS version is "+s+", but "+o+" uses "+i+". Perhaps this is the source of the error below.")}}catch(o){console&&console.error&&console.error(o)}return t}prepareVisitors(){this.listeners={};let t=(r,n,o)=>{this.listeners[n]||(this.listeners[n]=[]),this.listeners[n].push([r,o])};for(let r of this.plugins)if(typeof r=="object")for(let n in r){if(!CM[n]&&/^[A-Z]/.test(n))throw new Error(`Unknown event ${n} in ${r.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!EM[n])if(typeof r[n]=="object")for(let o in r[n])o==="*"?t(r,n,r[n][o]):t(r,n+"-"+o.toLowerCase(),r[n][o]);else typeof r[n]=="function"&&t(r,n,r[n])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let t=0;t<this.plugins.length;t++){let r=this.plugins[t],n=this.runOnRoot(r);if(wn(n))try{await n}catch(o){throw this.handleError(o)}}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[nt];){t[nt]=!0;let r=[dh(t)];for(;r.length>0;){let n=this.visitTick(r);if(wn(n))try{await n}catch(o){let i=r[r.length-1].node;throw this.handleError(o,i)}}}if(this.listeners.OnceExit)for(let[r,n]of this.listeners.OnceExit){this.result.lastPlugin=r;try{if(t.type==="document"){let o=t.nodes.map(i=>n(i,this.helpers));await Promise.all(o)}else await n(t,this.helpers)}catch(o){throw this.handleError(o)}}}return this.processed=!0,this.stringify()}runOnRoot(t){this.result.lastPlugin=t;try{if(typeof t=="object"&&t.Once){if(this.result.root.type==="document"){let r=this.result.root.nodes.map(n=>t.Once(n,this.helpers));return wn(r[0])?Promise.all(r):r}return t.Once(this.result.root,this.helpers)}else if(typeof t=="function")return t(this.result.root,this.result)}catch(r){throw this.handleError(r)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let t=this.result.opts,r=SM;t.syntax&&(r=t.syntax.stringify),t.stringifier&&(r=t.stringifier),r.stringify&&(r=r.stringify);let o=new gM(r,this.result.root,this.result.opts).generate();return this.result.css=o[0],this.result.map=o[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 t of this.plugins){let r=this.runOnRoot(t);if(wn(r))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[nt];)t[nt]=!0,this.walkSync(t);if(this.listeners.OnceExit)if(t.type==="document")for(let r of t.nodes)this.visitSync(this.listeners.OnceExit,r);else this.visitSync(this.listeners.OnceExit,t)}return this.result}then(t,r){return process.env.NODE_ENV!=="production"&&("from"in this.opts||RM("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(t,r)}toString(){return this.css}visitSync(t,r){for(let[n,o]of t){this.result.lastPlugin=n;let i;try{i=o(r,this.helpers)}catch(s){throw this.handleError(s,r.proxyOf)}if(r.type!=="root"&&r.type!=="document"&&!r.parent)return!0;if(wn(i))throw this.getAsyncError()}}visitTick(t){let r=t[t.length-1],{node:n,visitors:o}=r;if(n.type!=="root"&&n.type!=="document"&&!n.parent){t.pop();return}if(o.length>0&&r.visitorIndex<o.length){let[s,a]=o[r.visitorIndex];r.visitorIndex+=1,r.visitorIndex===o.length&&(r.visitors=[],r.visitorIndex=0),this.result.lastPlugin=s;try{return a(n.toProxy(),this.helpers)}catch(l){throw this.handleError(l,n)}}if(r.iterator!==0){let s=r.iterator,a;for(;a=n.nodes[n.indexes[s]];)if(n.indexes[s]+=1,!a[nt]){a[nt]=!0,t.push(dh(a));return}r.iterator=0,delete n.indexes[s]}let i=r.events;for(;r.eventIndex<i.length;){let s=i[r.eventIndex];if(r.eventIndex+=1,s===Tr){n.nodes&&n.nodes.length&&(n[nt]=!0,r.iterator=n.getIterator());return}else if(this.listeners[s]){r.visitors=this.listeners[s];return}}t.pop()}walkSync(t){t[nt]=!0;let r=Gm(t);for(let n of r)if(n===Tr)t.nodes&&t.each(o=>{o[nt]||this.walkSync(o)});else{let o=this.listeners[n];if(o&&this.visitSync(o,t.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"}};Lr.registerPostcss=e=>{Bl=e};var qm=Lr;Lr.default=Lr;xM.registerLazyResult(Lr);wM.registerLazyResult(Lr);var PM=Cm,AM=ls,MM=Dm,OM=bc,IM=yc,jl=class{constructor(t,r,n){r=r.toString(),this.stringified=!1,this._processor=t,this._css=r,this._opts=n,this._map=void 0;let o,i=AM;this.result=new IM(this._processor,o,this._opts),this.result.css=r;let s=this;Object.defineProperty(this.result,"root",{get(){return s.root}});let a=new PM(i,o,this._opts,r);if(a.isMap()){let[l,c]=a.generate();l&&(this.result.css=l),c&&(this.result.map=c)}else a.clearAnnotation(),this.result.css=a.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(t){return this.async().catch(t)}finally(t){return this.async().then(t,t)}sync(){if(this.error)throw this.error;return this.result}then(t,r){return process.env.NODE_ENV!=="production"&&("from"in this._opts||MM("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(t,r)}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 t,r=OM;try{t=r(this._css,this._opts)}catch(n){this.error=n}if(this.error)throw this.error;return this._root=t,t}get[Symbol.toStringTag](){return"NoWorkResult"}},TM=jl;jl.default=jl;var LM=TM,NM=qm,FM=mc,$M=_n,Tn=class{constructor(t=[]){this.version="8.4.38",this.plugins=this.normalize(t)}normalize(t){let r=[];for(let n of t)if(n.postcss===!0?n=n():n.postcss&&(n=n.postcss),typeof n=="object"&&Array.isArray(n.plugins))r=r.concat(n.plugins);else if(typeof n=="object"&&n.postcssPlugin)r.push(n);else if(typeof n=="function")r.push(n);else if(typeof n=="object"&&(n.parse||n.stringify)){if(process.env.NODE_ENV!=="production")throw new Error("PostCSS syntaxes cannot be used as plugins. Instead, please use one of the syntax/parser/stringifier options as outlined in your PostCSS runner documentation.")}else throw new Error(n+" is not a PostCSS plugin");return r}process(t,r={}){return!this.plugins.length&&!r.parser&&!r.stringifier&&!r.syntax?new LM(this,t,r):new NM(this,t,r)}use(t){return this.plugins=this.plugins.concat(this.normalize([t])),this}},DM=Tn;Tn.default=Tn;$M.registerProcessor(Tn);FM.registerProcessor(Tn);var _M=us,BM=wm,jM=ps,VM=gc,WM=ds,UM=_n,zM=Sc;function Ln(e,t){if(Array.isArray(e))return e.map(o=>Ln(o));let{inputs:r,...n}=e;if(r){t=[];for(let o of r){let i={...o,__proto__:WM.prototype};i.map&&(i.map={...i.map,__proto__:BM.prototype}),t.push(i)}}if(n.nodes&&(n.nodes=e.nodes.map(o=>Ln(o,t))),n.source){let{inputId:o,...i}=n.source;n.source=i,o!=null&&(n.source.input=t[o])}if(n.type==="root")return new UM(n);if(n.type==="decl")return new _M(n);if(n.type==="rule")return new zM(n);if(n.type==="comment")return new jM(n);if(n.type==="atrule")return new VM(n);throw new Error("Unknown node type: "+e.type)}var GM=Ln;Ln.default=Ln;var KM=pc,Hm=us,qM=qm,HM=qt,wc=DM,YM=ls,ZM=GM,Ym=mc,JM=_m,Zm=ps,Jm=gc,XM=yc,QM=ds,eO=bc,tO=Um,Xm=Sc,Qm=_n,rO=cs;function D(...e){return e.length===1&&Array.isArray(e[0])&&(e=e[0]),new wc(e)}D.plugin=function(t,r){let n=!1;function o(...s){console&&console.warn&&!n&&(n=!0,console.warn(t+`: postcss.plugin was deprecated. Migration guide:
|
|
61
|
-
https://evilmartians.com/chronicles/postcss-8-plugin-migration`),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(t+`: \u91CC\u9762 postcss.plugin \u88AB\u5F03\u7528. \u8FC1\u79FB\u6307\u5357:
|
|
62
|
-
https://www.w3ctech.com/topic/2226`));let a=r(...s);return a.postcssPlugin=t,a.postcssVersion=new wc().version,a}let i;return Object.defineProperty(o,"postcss",{get(){return i||(i=o()),i}}),o.process=function(s,a,l){return D([o(l)]).process(s,a)},o};D.stringify=YM;D.parse=eO;D.fromJSON=ZM;D.list=tO;D.comment=e=>new Zm(e);D.atRule=e=>new Jm(e);D.decl=e=>new Hm(e);D.rule=e=>new Xm(e);D.root=e=>new Qm(e);D.document=e=>new Ym(e);D.CssSyntaxError=KM;D.Declaration=Hm;D.Container=HM;D.Processor=wc;D.Document=Ym;D.Comment=Zm;D.Warning=JM;D.AtRule=Jm;D.Result=XM;D.Input=QM;D.Rule=Xm;D.Root=Qm;D.Node=rO;qM.registerPostcss(D);var nO=D;D.default=D;var H=fA(nO);H.stringify;H.fromJSON;H.plugin;H.parse;H.list;H.document;H.comment;H.atRule;H.rule;H.decl;H.root;H.CssSyntaxError;H.Declaration;H.Container;H.Processor;H.Document;H.Comment;H.Warning;H.AtRule;H.Result;H.Input;H.Rule;H.Root;H.Node;var Vl=class e{constructor(...t){Le(this,"parentElement",null),Le(this,"parentNode",null),Le(this,"ownerDocument"),Le(this,"firstChild",null),Le(this,"lastChild",null),Le(this,"previousSibling",null),Le(this,"nextSibling",null),Le(this,"ELEMENT_NODE",1),Le(this,"TEXT_NODE",3),Le(this,"nodeType"),Le(this,"nodeName"),Le(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"}};var ph={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},fh={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Ii={},oO=()=>!!globalThis.Zone;function Rc(e){if(Ii[e])return Ii[e];let t=globalThis[e],r=t.prototype,n=e in ph?ph[e]:void 0,o=!!(n&&n.every(a=>{var l,c;return!!((c=(l=Object.getOwnPropertyDescriptor(r,a))==null?void 0:l.get)!=null&&c.toString().includes("[native code]"))})),i=e in fh?fh[e]:void 0,s=!!(i&&i.every(a=>{var l;return typeof r[a]=="function"&&((l=r[a])==null?void 0:l.toString().includes("[native code]"))}));if(o&&s&&!oO())return Ii[e]=t.prototype,t.prototype;try{let a=document.createElement("iframe");document.body.appendChild(a);let l=a.contentWindow;if(!l)return t.prototype;let c=l[e].prototype;return document.body.removeChild(a),c?Ii[e]=c:r}catch{return r}}var sl={};function gt(e,t,r){var n;let o=`${e}.${String(r)}`;if(sl[o])return sl[o].call(t);let i=Rc(e),s=(n=Object.getOwnPropertyDescriptor(i,r))==null?void 0:n.get;return s?(sl[o]=s,s.call(t)):t[r]}var al={};function ey(e,t,r){let n=`${e}.${String(r)}`;if(al[n])return al[n].bind(t);let i=Rc(e)[r];return typeof i!="function"?t[r]:(al[n]=i,i.bind(t))}function iO(e){return gt("Node",e,"ownerDocument")}function sO(e){return gt("Node",e,"childNodes")}function aO(e){return gt("Node",e,"parentNode")}function lO(e){return gt("Node",e,"parentElement")}function cO(e){return gt("Node",e,"textContent")}function uO(e,t){return ey("Node",e,"contains")(t)}function dO(e){return ey("Node",e,"getRootNode")()}function pO(e){return!e||!("host"in e)?null:gt("ShadowRoot",e,"host")}function fO(e){return e.styleSheets}function hO(e){return!e||!("shadowRoot"in e)?null:gt("Element",e,"shadowRoot")}function mO(e,t){return gt("Element",e,"querySelector")(t)}function yO(e,t){return gt("Element",e,"querySelectorAll")(t)}function ty(){return Rc("MutationObserver").constructor}function Ht(e,t,r){try{if(!(t in e))return()=>{};let n=e[t],o=r(n);return typeof o=="function"&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=o,()=>{e[t]=n}}catch{return()=>{}}}var C={ownerDocument:iO,childNodes:sO,parentNode:aO,parentElement:lO,textContent:cO,contains:uO,getRootNode:dO,host:pO,styleSheets:fO,shadowRoot:hO,querySelector:mO,querySelectorAll:yO,mutationObserver:ty,patch:Ht};function he(e,t,r=document){let n={capture:!0,passive:!0};return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}var xr=`Please stop import mirror directly. Instead of that,\r
|
|
63
|
-
now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
|
|
64
|
-
or you can use record.mirror to access the mirror instance during recording.`,hh={map:{},getId(){return console.error(xr),-1},getNode(){return console.error(xr),null},removeNodeFromMap(){console.error(xr)},has(){return console.error(xr),!1},reset(){console.error(xr)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(hh=new Proxy(hh,{get(e,t,r){return t==="map"&&console.error(xr),Reflect.get(e,t,r)}}));function Nn(e,t,r={}){let n=null,o=0;return function(...i){let s=Date.now();!o&&r.leading===!1&&(o=s);let a=t-(s-o),l=this;a<=0||a>t?(n&&(clearTimeout(n),n=null),o=s,e.apply(l,i)):!n&&r.trailing!==!1&&(n=setTimeout(()=>{o=r.leading===!1?0:Date.now(),n=null,e.apply(l,i)},a))}}function fs(e,t,r,n,o=window){let i=o.Object.getOwnPropertyDescriptor(e,t);return o.Object.defineProperty(e,t,n?r:{set(s){setTimeout(()=>{r.set.call(this,s)},0),i&&i.set&&i.set.call(this,s)}}),()=>fs(e,t,i||{},!0)}var Qi=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(Qi=()=>new Date().getTime());function ry(e){var t,r,n,o;let i=e.document;return{left:i.scrollingElement?i.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:i.documentElement.scrollLeft||i?.body&&((t=C.parentElement(i.body))==null?void 0:t.scrollLeft)||((r=i?.body)==null?void 0:r.scrollLeft)||0,top:i.scrollingElement?i.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:i?.documentElement.scrollTop||i?.body&&((n=C.parentElement(i.body))==null?void 0:n.scrollTop)||((o=i?.body)==null?void 0:o.scrollTop)||0}}function ny(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function oy(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function iy(e){return e?e.nodeType===e.ELEMENT_NODE?e:C.parentElement(e):null}function me(e,t,r,n){if(!e)return!1;let o=iy(e);if(!o)return!1;try{if(typeof t=="string"){if(o.classList.contains(t)||n&&o.closest("."+t)!==null)return!0}else if(zi(o,t,n))return!0}catch{}return!!(r&&(o.matches(r)||n&&o.closest(r)!==null))}function gO(e,t){return t.getId(e)!==-1}function ll(e,t,r){return e.tagName==="TITLE"&&r.headTitleMutations?!0:t.getId(e)===Cn}function sy(e,t){if(vn(e))return!1;let r=t.getId(e);if(!t.has(r))return!0;let n=C.parentNode(e);return n&&n.nodeType===e.DOCUMENT_NODE?!1:n?sy(n,t):!0}function Wl(e){return!!e.changedTouches}function SO(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 ay(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function ly(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function Ul(e){return e?e instanceof Vl&&"shadowRoot"in e?!!e.shadowRoot:!!C.shadowRoot(e):!1}var zl=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 n;return r===void 0?n=this.id++:n=r,this.styleIDMap.set(t,n),this.idStyleMap.set(n,t),n}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 cy(e){var t;let r=null;return"getRootNode"in e&&((t=C.getRootNode(e))==null?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&C.host(C.getRootNode(e))&&(r=C.host(C.getRootNode(e))),r}function bO(e){let t=e,r;for(;r=cy(t);)t=r;return t}function wO(e){let t=C.ownerDocument(e);if(!t)return!1;let r=bO(e);return C.contains(t,r)}function uy(e){let t=C.ownerDocument(e);return t?C.contains(t,e)||wO(e):!1}var O=(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))(O||{}),E=(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))(E||{}),we=(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))(we||{}),ft=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(ft||{}),Nr=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(Nr||{}),kr=(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))(kr||{});var dy=(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))(dy||{});function mh(e){return"__ln"in e}var Gl=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 n=0;n<t;n++)r=r?.next||null;return r}addNode(t){let r={value:t,previous:null,next:null};if(t.__ln=r,t.previousSibling&&mh(t.previousSibling)){let n=t.previousSibling.__ln.next;r.next=n,r.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=r,n&&(n.previous=r)}else if(t.nextSibling&&mh(t.nextSibling)&&t.nextSibling.__ln.previous){let n=t.nextSibling.__ln.previous;r.previous=n,r.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=r,n&&(n.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--)}},yh=(e,t)=>`${e}@${t}`,Kl=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,"removesSubTreeCache",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,"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,n=new Gl,o=l=>{let c=l,u=Cn;for(;u===Cn;)c=c&&c.nextSibling,u=c&&this.mirror.getId(c);return u},i=l=>{let c=C.parentNode(l);if(!c||!uy(l))return;let u=!1;if(l.nodeType===Node.TEXT_NODE){let h=c.tagName;if(h==="TEXTAREA")return;h==="STYLE"&&this.addedSet.has(c)&&(u=!0)}let d=vn(c)?this.mirror.getId(cy(l)):this.mirror.getId(c),p=o(l);if(d===-1||p===-1)return n.addNode(l);let y=Er(l,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:h=>{ay(h,this.mirror)&&this.iframeManager.addIframe(h),ly(h,this.mirror)&&this.stylesheetManager.trackLinkElement(h),Ul(l)&&this.shadowDomManager.addShadowRoot(C.shadowRoot(l),this.doc)},onIframeLoad:(h,f)=>{this.iframeManager.attachIframe(h,f),this.shadowDomManager.observeAttachShadow(h)},onStylesheetLoad:(h,f)=>{this.stylesheetManager.attachLinkElement(h,f)},cssCaptured:u});y&&(t.push({parentId:d,nextId:p,node:y}),r.add(y.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let l of this.movedSet)gh(this.removesSubTreeCache,l,this.mirror)&&!this.movedSet.has(C.parentNode(l))||i(l);for(let l of this.addedSet)!Sh(this.droppedSet,l)&&!gh(this.removesSubTreeCache,l,this.mirror)||Sh(this.movedSet,l)?i(l):this.droppedSet.add(l);let s=null;for(;n.length;){let l=null;if(s){let c=this.mirror.getId(C.parentNode(s.value)),u=o(s.value);c!==-1&&u!==-1&&(l=s)}if(!l){let c=n.tail;for(;c;){let u=c;if(c=c.previous,u){let d=this.mirror.getId(C.parentNode(u.value));if(o(u.value)===-1)continue;if(d!==-1){l=u;break}else{let y=u.value,h=C.parentNode(y);if(h&&h.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let f=C.host(h);if(this.mirror.getId(f)!==-1){l=u;break}}}}}}if(!l){for(;n.head;)n.removeNode(n.head.value);break}s=l.previous,n.removeNode(l.value),i(l.value)}let a={texts:this.texts.map(l=>{let c=l.node,u=C.parentNode(c);return u&&u.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(u),{id:this.mirror.getId(c),value:l.value}}).filter(l=>!r.has(l.id)).filter(l=>this.mirror.has(l.id)),attributes:this.attributes.map(l=>{let{attributes:c}=l;if(typeof c.style=="string"){let u=JSON.stringify(l.styleDiff),d=JSON.stringify(l._unchangedStyles);u.length<c.style.length&&(u+d).split("var(").length===c.style.split("var(").length&&(c.style=l.styleDiff)}return{id:this.mirror.getId(l.node),attributes:c}}).filter(l=>!r.has(l.id)).filter(l=>this.mirror.has(l.id)),removes:this.removes,adds:t};!a.texts.length&&!a.attributes.length&&!a.removes.length&&!a.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},this.mutationCb(a))}),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 n=Array.from(C.childNodes(t),o=>C.textContent(o)||"").join("");r.attributes.value=Vi({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:Wi(t),value:n,maskInputFn:this.maskInputFn})}),S(this,"processMutation",t=>{if(!ll(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{let r=C.textContent(t.target);!me(t.target,this.blockClass,this.blockSelector,!1)&&r!==t.oldValue&&this.texts.push({value:Th(t.target,this.maskTextClass,this.maskTextSelector,!0)&&r?this.maskTextFn?this.maskTextFn(r,iy(t.target)):r.replace(/[\S]/g,"*"):r,node:t.target});break}case"attributes":{let r=t.target,n=t.attributeName,o=t.target.getAttribute(n);if(n==="value"){let s=Wi(r);o=Vi({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:s,value:o,maskInputFn:this.maskInputFn})}if(me(t.target,this.blockClass,this.blockSelector,!1)||o===t.oldValue)return;let i=this.attributeMap.get(t.target);if(r.tagName==="IFRAME"&&n==="src"&&!this.keepIframeSrcFn(o))if(!r.contentDocument)n="rr_src";else return;if(i||(i={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(i),this.attributeMap.set(t.target,i)),n==="type"&&r.tagName==="INPUT"&&(t.oldValue||"").toLowerCase()==="password"&&r.setAttribute("data-rr-is-password","true"),!Ih(r.tagName,n))if(i.attributes[n]=Oh(this.doc,Gt(r.tagName),Gt(n),o),n==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}let s=this.unattachedDoc.createElement("span");t.oldValue&&s.setAttribute("style",t.oldValue);for(let a of Array.from(r.style)){let l=r.style.getPropertyValue(a),c=r.style.getPropertyPriority(a);l!==s.style.getPropertyValue(a)||c!==s.style.getPropertyPriority(a)?c===""?i.styleDiff[a]=l:i.styleDiff[a]=[l,c]:i._unchangedStyles[a]=[l,c]}for(let a of Array.from(s.style))r.style.getPropertyValue(a)===""&&(i.styleDiff[a]=!1)}else n==="open"&&r.tagName==="DIALOG"&&(r.matches("dialog:modal")?i.attributes.rr_open_mode="modal":i.attributes.rr_open_mode="non-modal");break}case"childList":{if(me(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 n=this.mirror.getId(r),o=vn(t.target)?this.mirror.getId(C.host(t.target)):this.mirror.getId(t.target);me(t.target,this.blockClass,this.blockSelector,!1)||ll(r,this.mirror,this.slimDOMOptions)||!gO(r,this.mirror)||(this.addedSet.has(r)?(ql(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(t.target)&&n===-1||sy(t.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[yh(n,o)]?ql(this.movedSet,r):(this.removes.push({parentId:o,id:n,isShadow:vn(t.target)&&xn(t.target)?!0:void 0}),RO(r,this.removesSubTreeCache))),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(ll(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);let n=null;r&&this.mirror.hasNode(r)&&(n=this.mirror.getId(r)),n&&n!==-1&&(this.movedMap[yh(this.mirror.getId(t),n)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);me(t,this.blockClass,this.blockSelector,!1)||(C.childNodes(t).forEach(n=>this.genAdds(n)),Ul(t)&&C.childNodes(C.shadowRoot(t)).forEach(n=>{this.processedNodeManager.add(n,this),this.genAdds(n,t)}))}})}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","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 ql(e,t){e.delete(t),C.childNodes(t).forEach(r=>ql(e,r))}function RO(e,t){let r=[e];for(;r.length;){let n=r.pop();t.has(n)||(t.add(n),C.childNodes(n).forEach(o=>r.push(o)))}}function gh(e,t,r){return e.size===0?!1:vO(e,t)}function vO(e,t,r){let n=C.parentNode(t);return n?e.has(n):!1}function Sh(e,t){return e.size===0?!1:py(e,t)}function py(e,t){let r=C.parentNode(t);return r?e.has(r)?!0:py(e,r):!1}var kn;function xO(e){kn=e}function kO(){kn=void 0}var I=e=>kn?(...r)=>{try{return e(...r)}catch(n){if(kn&&kn(n)===!0)return;throw n}}:e,zt=[];function Bn(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 fy(e,t){let r=new Kl;zt.push(r),r.init(e);let n=new(ty())(I(r.processMutations.bind(r)));return n.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),n}function CO({mousemoveCb:e,sampling:t,doc:r,mirror:n}){if(t.mousemove===!1)return()=>{};let o=typeof t.mousemove=="number"?t.mousemove:50,i=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500,s=[],a,l=Nn(I(d=>{let p=Date.now()-a;e(s.map(y=>(y.timeOffset-=p,y)),d),s=[],a=null}),i),c=I(Nn(I(d=>{let p=Bn(d),{clientX:y,clientY:h}=Wl(d)?d.changedTouches[0]:d;a||(a=Qi()),s.push({x:y,y:h,id:n.getId(p),timeOffset:Qi()-a}),l(typeof DragEvent<"u"&&d instanceof DragEvent?E.Drag:d instanceof MouseEvent?E.MouseMove:E.TouchMove)}),o,{trailing:!1})),u=[he("mousemove",c,r),he("touchmove",c,r),he("drag",c,r)];return I(()=>{u.forEach(d=>d())})}function EO({mouseInteractionCb:e,doc:t,mirror:r,blockClass:n,blockSelector:o,sampling:i}){if(i.mouseInteraction===!1)return()=>{};let s=i.mouseInteraction===!0||i.mouseInteraction===void 0?{}:i.mouseInteraction,a=[],l=null,c=u=>d=>{let p=Bn(d);if(me(p,n,o,!0))return;let y=null,h=u;if("pointerType"in d){switch(d.pointerType){case"mouse":y=ft.Mouse;break;case"touch":y=ft.Touch;break;case"pen":y=ft.Pen;break}y===ft.Touch?we[u]===we.MouseDown?h="TouchStart":we[u]===we.MouseUp&&(h="TouchEnd"):ft.Pen}else Wl(d)&&(y=ft.Touch);y!==null?(l=y,(h.startsWith("Touch")&&y===ft.Touch||h.startsWith("Mouse")&&y===ft.Mouse)&&(y=null)):we[u]===we.Click&&(y=l,l=null);let f=Wl(d)?d.changedTouches[0]:d;if(!f)return;let m=r.getId(p),{clientX:v,clientY:w}=f;I(e)({type:we[h],id:m,x:v,y:w,...y!==null&&{pointerType:y}})};return Object.keys(we).filter(u=>Number.isNaN(Number(u))&&!u.endsWith("_Departed")&&s[u]!==!1).forEach(u=>{let d=Gt(u),p=c(u);if(window.PointerEvent)switch(we[u]){case we.MouseDown:case we.MouseUp:d=d.replace("mouse","pointer");break;case we.TouchStart:case we.TouchEnd:return}a.push(he(d,p,t))}),I(()=>{a.forEach(u=>u())})}function hy({scrollCb:e,doc:t,mirror:r,blockClass:n,blockSelector:o,sampling:i}){let s=I(Nn(I(a=>{let l=Bn(a);if(!l||me(l,n,o,!0))return;let c=r.getId(l);if(l===t&&t.defaultView){let u=ry(t.defaultView);e({id:c,x:u.left,y:u.top})}else e({id:c,x:l.scrollLeft,y:l.scrollTop})}),i.scroll||100));return he("scroll",s,t)}function PO({viewportResizeCb:e},{win:t}){let r=-1,n=-1,o=I(Nn(I(()=>{let i=ny(),s=oy();(r!==i||n!==s)&&(e({width:Number(s),height:Number(i)}),r=i,n=s)}),200));return he("resize",o,t)}var AO=["INPUT","TEXTAREA","SELECT"],bh=new WeakMap;function MO({inputCb:e,doc:t,mirror:r,blockClass:n,blockSelector:o,ignoreClass:i,ignoreSelector:s,maskInputOptions:a,maskInputFn:l,sampling:c,userTriggeredOnInput:u}){function d(w){let g=Bn(w),k=w.isTrusted,_=g&&g.tagName;if(g&&_==="OPTION"&&(g=C.parentElement(g)),!g||!_||AO.indexOf(_)<0||me(g,n,o,!0)||g.classList.contains(i)||s&&g.matches(s))return;let V=g.value,te=!1,G=Wi(g)||"";G==="radio"||G==="checkbox"?te=g.checked:(a[_.toLowerCase()]||a[G])&&(V=Vi({element:g,maskInputOptions:a,tagName:_,type:G,value:V,maskInputFn:l})),p(g,u?{text:V,isChecked:te,userTriggered:k}:{text:V,isChecked:te});let Q=g.name;G==="radio"&&Q&&te&&t.querySelectorAll(`input[type="radio"][name="${Q}"]`).forEach(le=>{if(le!==g){let Me=le.value;p(le,u?{text:Me,isChecked:!te,userTriggered:!1}:{text:Me,isChecked:!te})}})}function p(w,g){let k=bh.get(w);if(!k||k.text!==g.text||k.isChecked!==g.isChecked){bh.set(w,g);let _=r.getId(w);I(e)({...g,id:_})}}let h=(c.input==="last"?["change"]:["input","change"]).map(w=>he(w,I(d),t)),f=t.defaultView;if(!f)return()=>{h.forEach(w=>w())};let m=f.Object.getOwnPropertyDescriptor(f.HTMLInputElement.prototype,"value"),v=[[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 m&&m.set&&h.push(...v.map(w=>fs(w[0],w[1],{set(){I(d)({target:this,isTrusted:!1})}},!1,f))),I(()=>{h.forEach(w=>w())})}function es(e){let t=[];function r(n,o){if(Ti("CSSGroupingRule")&&n.parentRule instanceof CSSGroupingRule||Ti("CSSMediaRule")&&n.parentRule instanceof CSSMediaRule||Ti("CSSSupportsRule")&&n.parentRule instanceof CSSSupportsRule||Ti("CSSConditionRule")&&n.parentRule instanceof CSSConditionRule){let s=Array.from(n.parentRule.cssRules).indexOf(n);o.unshift(s)}else if(n.parentStyleSheet){let s=Array.from(n.parentStyleSheet.cssRules).indexOf(n);o.unshift(s)}return o}return r(e,t)}function kt(e,t,r){let n,o;return e?(e.ownerNode?n=t.getId(e.ownerNode):o=r.getId(e),{styleId:o,id:n}):{}}function OO({styleSheetRuleCb:e,mirror:t,stylesheetManager:r},{win:n}){if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return()=>{};let o=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(o,{apply:I((u,d,p)=>{let[y,h]=p,{id:f,styleId:m}=kt(d,t,r.styleMirror);return(f&&f!==-1||m&&m!==-1)&&e({id:f,styleId:m,adds:[{rule:y,index:h}]}),u.apply(d,p)})}),n.CSSStyleSheet.prototype.addRule=function(u,d,p=this.cssRules.length){let y=`${u} { ${d} }`;return n.CSSStyleSheet.prototype.insertRule.apply(this,[y,p])};let i=n.CSSStyleSheet.prototype.deleteRule;n.CSSStyleSheet.prototype.deleteRule=new Proxy(i,{apply:I((u,d,p)=>{let[y]=p,{id:h,styleId:f}=kt(d,t,r.styleMirror);return(h&&h!==-1||f&&f!==-1)&&e({id:h,styleId:f,removes:[{index:y}]}),u.apply(d,p)})}),n.CSSStyleSheet.prototype.removeRule=function(u){return n.CSSStyleSheet.prototype.deleteRule.apply(this,[u])};let s;n.CSSStyleSheet.prototype.replace&&(s=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(s,{apply:I((u,d,p)=>{let[y]=p,{id:h,styleId:f}=kt(d,t,r.styleMirror);return(h&&h!==-1||f&&f!==-1)&&e({id:h,styleId:f,replace:y}),u.apply(d,p)})}));let a;n.CSSStyleSheet.prototype.replaceSync&&(a=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:I((u,d,p)=>{let[y]=p,{id:h,styleId:f}=kt(d,t,r.styleMirror);return(h&&h!==-1||f&&f!==-1)&&e({id:h,styleId:f,replaceSync:y}),u.apply(d,p)})}));let l={};Li("CSSGroupingRule")?l.CSSGroupingRule=n.CSSGroupingRule:(Li("CSSMediaRule")&&(l.CSSMediaRule=n.CSSMediaRule),Li("CSSConditionRule")&&(l.CSSConditionRule=n.CSSConditionRule),Li("CSSSupportsRule")&&(l.CSSSupportsRule=n.CSSSupportsRule));let c={};return Object.entries(l).forEach(([u,d])=>{c[u]={insertRule:d.prototype.insertRule,deleteRule:d.prototype.deleteRule},d.prototype.insertRule=new Proxy(c[u].insertRule,{apply:I((p,y,h)=>{let[f,m]=h,{id:v,styleId:w}=kt(y.parentStyleSheet,t,r.styleMirror);return(v&&v!==-1||w&&w!==-1)&&e({id:v,styleId:w,adds:[{rule:f,index:[...es(y),m||0]}]}),p.apply(y,h)})}),d.prototype.deleteRule=new Proxy(c[u].deleteRule,{apply:I((p,y,h)=>{let[f]=h,{id:m,styleId:v}=kt(y.parentStyleSheet,t,r.styleMirror);return(m&&m!==-1||v&&v!==-1)&&e({id:m,styleId:v,removes:[{index:[...es(y),f]}]}),p.apply(y,h)})})}),I(()=>{n.CSSStyleSheet.prototype.insertRule=o,n.CSSStyleSheet.prototype.deleteRule=i,s&&(n.CSSStyleSheet.prototype.replace=s),a&&(n.CSSStyleSheet.prototype.replaceSync=a),Object.entries(l).forEach(([u,d])=>{d.prototype.insertRule=c[u].insertRule,d.prototype.deleteRule=c[u].deleteRule})})}function my({mirror:e,stylesheetManager:t},r){var n,o,i;let s=null;r.nodeName==="#document"?s=e.getId(r):s=e.getId(C.host(r));let a=r.nodeName==="#document"?(n=r.defaultView)==null?void 0:n.Document:(i=(o=r.ownerDocument)==null?void 0:o.defaultView)==null?void 0:i.ShadowRoot,l=a?.prototype?Object.getOwnPropertyDescriptor(a?.prototype,"adoptedStyleSheets"):void 0;return s===null||s===-1||!a||!l?()=>{}:(Object.defineProperty(r,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get(){var c;return(c=l.get)==null?void 0:c.call(this)},set(c){var u;let d=(u=l.set)==null?void 0:u.call(this,c);if(s!==null&&s!==-1)try{t.adoptStyleSheets(c,s)}catch{}return d}}),I(()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})}))}function IO({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:r,stylesheetManager:n},{win:o}){let i=o.CSSStyleDeclaration.prototype.setProperty;o.CSSStyleDeclaration.prototype.setProperty=new Proxy(i,{apply:I((a,l,c)=>{var u;let[d,p,y]=c;if(r.has(d))return i.apply(l,[d,p,y]);let{id:h,styleId:f}=kt((u=l.parentRule)==null?void 0:u.parentStyleSheet,t,n.styleMirror);return(h&&h!==-1||f&&f!==-1)&&e({id:h,styleId:f,set:{property:d,value:p,priority:y},index:es(l.parentRule)}),a.apply(l,c)})});let s=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=new Proxy(s,{apply:I((a,l,c)=>{var u;let[d]=c;if(r.has(d))return s.apply(l,[d]);let{id:p,styleId:y}=kt((u=l.parentRule)==null?void 0:u.parentStyleSheet,t,n.styleMirror);return(p&&p!==-1||y&&y!==-1)&&e({id:p,styleId:y,remove:{property:d},index:es(l.parentRule)}),a.apply(l,c)})}),I(()=>{o.CSSStyleDeclaration.prototype.setProperty=i,o.CSSStyleDeclaration.prototype.removeProperty=s})}function TO({mediaInteractionCb:e,blockClass:t,blockSelector:r,mirror:n,sampling:o,doc:i}){let s=I(l=>Nn(I(c=>{let u=Bn(c);if(!u||me(u,t,r,!0))return;let{currentTime:d,volume:p,muted:y,playbackRate:h,loop:f}=u;e({type:l,id:n.getId(u),currentTime:d,volume:p,muted:y,playbackRate:h,loop:f})}),o.media||500)),a=[he("play",s(kr.Play),i),he("pause",s(kr.Pause),i),he("seeked",s(kr.Seeked),i),he("volumechange",s(kr.VolumeChange),i),he("ratechange",s(kr.RateChange),i)];return I(()=>{a.forEach(l=>l())})}function LO({fontCb:e,doc:t}){let r=t.defaultView;if(!r)return()=>{};let n=[],o=new WeakMap,i=r.FontFace;r.FontFace=function(l,c,u){let d=new i(l,c,u);return o.set(d,{family:l,buffer:typeof c!="string",descriptors:u,fontSource:typeof c=="string"?c:JSON.stringify(Array.from(new Uint8Array(c)))}),d};let s=Ht(t.fonts,"add",function(a){return function(l){return setTimeout(I(()=>{let c=o.get(l);c&&(e(c),o.delete(l))}),0),a.apply(this,[l])}});return n.push(()=>{r.FontFace=i}),n.push(s),I(()=>{n.forEach(a=>a())})}function NO(e){let{doc:t,mirror:r,blockClass:n,blockSelector:o,selectionCb:i}=e,s=!0,a=I(()=>{let l=t.getSelection();if(!l||s&&l?.isCollapsed)return;s=l.isCollapsed||!1;let c=[],u=l.rangeCount||0;for(let d=0;d<u;d++){let p=l.getRangeAt(d),{startContainer:y,startOffset:h,endContainer:f,endOffset:m}=p;me(y,n,o,!0)||me(f,n,o,!0)||c.push({start:r.getId(y),startOffset:h,end:r.getId(f),endOffset:m})}i({ranges:c})});return a(),he("selectionchange",a)}function FO({doc:e,customElementCb:t}){let r=e.defaultView;return!r||!r.customElements?()=>{}:Ht(r.customElements,"define",function(o){return function(i,s,a){try{t({define:{name:i}})}catch{console.warn(`Custom element callback failed for ${i}`)}return o.apply(this,[i,s,a])}})}function $O(e,t){let{mutationCb:r,mousemoveCb:n,mouseInteractionCb:o,scrollCb:i,viewportResizeCb:s,inputCb:a,mediaInteractionCb:l,styleSheetRuleCb:c,styleDeclarationCb:u,canvasMutationCb:d,fontCb:p,selectionCb:y,customElementCb:h}=e;e.mutationCb=(...f)=>{t.mutation&&t.mutation(...f),r(...f)},e.mousemoveCb=(...f)=>{t.mousemove&&t.mousemove(...f),n(...f)},e.mouseInteractionCb=(...f)=>{t.mouseInteraction&&t.mouseInteraction(...f),o(...f)},e.scrollCb=(...f)=>{t.scroll&&t.scroll(...f),i(...f)},e.viewportResizeCb=(...f)=>{t.viewportResize&&t.viewportResize(...f),s(...f)},e.inputCb=(...f)=>{t.input&&t.input(...f),a(...f)},e.mediaInteractionCb=(...f)=>{t.mediaInteaction&&t.mediaInteaction(...f),l(...f)},e.styleSheetRuleCb=(...f)=>{t.styleSheetRule&&t.styleSheetRule(...f),c(...f)},e.styleDeclarationCb=(...f)=>{t.styleDeclaration&&t.styleDeclaration(...f),u(...f)},e.canvasMutationCb=(...f)=>{t.canvasMutation&&t.canvasMutation(...f),d(...f)},e.fontCb=(...f)=>{t.font&&t.font(...f),p(...f)},e.selectionCb=(...f)=>{t.selection&&t.selection(...f),y(...f)},e.customElementCb=(...f)=>{t.customElement&&t.customElement(...f),h(...f)}}function DO(e,t={}){let r=e.doc.defaultView;if(!r)return()=>{};$O(e,t);let n;e.recordDOM&&(n=fy(e,e.doc));let o=CO(e),i=EO(e),s=hy(e),a=PO(e,{win:r}),l=MO(e),c=TO(e),u=()=>{},d=()=>{},p=()=>{},y=()=>{};e.recordDOM&&(u=OO(e,{win:r}),d=my(e,e.doc),p=IO(e,{win:r}),e.collectFonts&&(y=LO(e)));let h=NO(e),f=FO(e),m=[];for(let v of e.plugins)m.push(v.observer(v.callback,r,v.options));return I(()=>{zt.forEach(v=>v.reset()),n?.disconnect(),o(),i(),s(),a(),l(),c(),u(),d(),p(),y(),h(),f(),m.forEach(v=>v())})}function Ti(e){return typeof window[e]<"u"}function Li(e){return!!(typeof window[e]<"u"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}var ts=class{constructor(t){S(this,"iframeIdToRemoteIdMap",new WeakMap),S(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=t}getId(t,r,n,o){let i=n||this.getIdToRemoteIdMap(t),s=o||this.getRemoteIdToIdMap(t),a=i.get(r);return a||(a=this.generateIdFn(),i.set(r,a),s.set(a,r)),a}getIds(t,r){let n=this.getIdToRemoteIdMap(t),o=this.getRemoteIdToIdMap(t);return r.map(i=>this.getId(t,i,n,o))}getRemoteId(t,r,n){let o=n||this.getRemoteIdToIdMap(t);if(typeof r!="number")return r;let i=o.get(r);return i||-1}getRemoteIds(t,r){let n=this.getRemoteIdToIdMap(t);return r.map(o=>this.getRemoteId(t,o,n))}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}},Hl=class{constructor(t){S(this,"iframes",new WeakMap),S(this,"crossOriginIframeMap",new WeakMap),S(this,"crossOriginIframeMirror",new ts(Mh)),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 ts(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 n,o;this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&((n=t.contentWindow)==null||n.addEventListener("message",this.handleMessage.bind(this))),(o=this.loadListener)==null||o.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 o=this.crossOriginIframeMap.get(t.source);if(!o)return;let i=this.transformCrossOriginEvent(o,r.data.event);i&&this.wrappedEmit(i,r.data.isCheckout)}transformCrossOriginEvent(t,r){var n;switch(r.type){case O.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(r.data.node,t);let o=r.data.node.id;return this.crossOriginIframeRootIdMap.set(t,o),this.patchRootIdOnNode(r.data.node,o),{timestamp:r.timestamp,type:O.IncrementalSnapshot,data:{source:E.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:r.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case O.Meta:case O.Load:case O.DomContentLoaded:return!1;case O.Plugin:return r;case O.Custom:return this.replaceIds(r.data.payload,t,["id","parentId","previousId","nextId"]),r;case O.IncrementalSnapshot:switch(r.data.source){case E.Mutation:return r.data.adds.forEach(o=>{this.replaceIds(o,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(o.node,t);let i=this.crossOriginIframeRootIdMap.get(t);i&&this.patchRootIdOnNode(o.node,i)}),r.data.removes.forEach(o=>{this.replaceIds(o,t,["parentId","id"])}),r.data.attributes.forEach(o=>{this.replaceIds(o,t,["id"])}),r.data.texts.forEach(o=>{this.replaceIds(o,t,["id"])}),r;case E.Drag:case E.TouchMove:case E.MouseMove:return r.data.positions.forEach(o=>{this.replaceIds(o,t,["id"])}),r;case E.ViewportResize:return!1;case E.MediaInteraction:case E.MouseInteraction:case E.Scroll:case E.CanvasMutation:case E.Input:return this.replaceIds(r.data,t,["id"]),r;case E.StyleSheetRule:case E.StyleDeclaration:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleId"]),r;case E.Font:return r;case E.Selection:return r.data.ranges.forEach(o=>{this.replaceIds(o,t,["start","end"])}),r;case E.AdoptedStyleSheet:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleIds"]),(n=r.data.styles)==null||n.forEach(o=>{this.replaceStyleIds(o,t,["styleId"])}),r}}return!1}replace(t,r,n,o){for(let i of o)!Array.isArray(r[i])&&typeof r[i]!="number"||(Array.isArray(r[i])?r[i]=t.getIds(n,r[i]):r[i]=t.getId(n,r[i]));return r}replaceIds(t,r,n){return this.replace(this.crossOriginIframeMirror,t,r,n)}replaceStyleIds(t,r,n){return this.replace(this.crossOriginIframeStyleMirror,t,r,n)}replaceIdOnNode(t,r){this.replaceIds(t,r,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(n=>{this.replaceIdOnNode(n,r)})}patchRootIdOnNode(t,r){t.type!==dy.Document&&!t.rootId&&(t.rootId=r),"childNodes"in t&&t.childNodes.forEach(n=>{this.patchRootIdOnNode(n,r)})}},Yl=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(!xn(t)||this.shadowDoms.has(t))return;this.shadowDoms.add(t);let n=fy({...this.bypassOptions,doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},t);this.restoreHandlers.push(()=>n.disconnect()),this.restoreHandlers.push(hy({...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(C.host(t))),this.restoreHandlers.push(my({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 n=this;this.restoreHandlers.push(Ht(t.prototype,"attachShadow",function(o){return function(i){let s=o.call(this,i),a=C.shadowRoot(this);return a&&uy(this)&&n.addShadowRoot(a,r),s}}))}reset(){this.restoreHandlers.forEach(t=>{try{t()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}},Pr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",_O=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(Rn=0;Rn<Pr.length;Rn++)_O[Pr.charCodeAt(Rn)]=Rn;var Rn,BO=function(e){var t=new Uint8Array(e),r,n=t.length,o="";for(r=0;r<n;r+=3)o+=Pr[t[r]>>2],o+=Pr[(t[r]&3)<<4|t[r+1]>>4],o+=Pr[(t[r+1]&15)<<2|t[r+2]>>6],o+=Pr[t[r+2]&63];return n%3===2?o=o.substring(0,o.length-1)+"=":n%3===1&&(o=o.substring(0,o.length-2)+"=="),o};var wh=new Map;function jO(e,t){let r=wh.get(e);return r||(r=new Map,wh.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}var yy=(e,t,r)=>{if(!e||!(Sy(e,t)||typeof e=="object"))return;let n=e.constructor.name,o=jO(r,n),i=o.indexOf(e);return i===-1&&(i=o.length,o.push(e)),i};function _i(e,t,r){if(e instanceof Array)return e.map(n=>_i(n,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 n=e.constructor.name,o=BO(e);return{rr_type:n,base64:o}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[_i(e.buffer,t,r),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){let n=e.constructor.name,{src:o}=e;return{rr_type:n,src:o}}else if(e instanceof HTMLCanvasElement){let n="HTMLImageElement",o=e.toDataURL();return{rr_type:n,src:o}}else{if(e instanceof ImageData)return{rr_type:e.constructor.name,args:[_i(e.data,t,r),e.width,e.height]};if(Sy(e,t)||typeof e=="object"){let n=e.constructor.name,o=yy(e,t,r);return{rr_type:n,index:o}}}}return e}var gy=(e,t,r)=>e.map(n=>_i(n,t,r)),Sy=(e,t)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(o=>typeof t[o]=="function").find(o=>e instanceof t[o]);function VO(e,t,r,n){let o=[],i=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(let s of i)try{if(typeof t.CanvasRenderingContext2D.prototype[s]!="function")continue;let a=Ht(t.CanvasRenderingContext2D.prototype,s,function(l){return function(...c){return me(this.canvas,r,n,!0)||setTimeout(()=>{let u=gy(c,t,this);e(this.canvas,{type:Nr["2D"],property:s,args:u})},0),l.apply(this,c)}});o.push(a)}catch{let a=fs(t.CanvasRenderingContext2D.prototype,s,{set(l){e(this.canvas,{type:Nr["2D"],property:s,args:[l],setter:!0})}});o.push(a)}return()=>{o.forEach(s=>s())}}function WO(e){return e==="experimental-webgl"?"webgl":e}function Rh(e,t,r,n){let o=[];try{let i=Ht(e.HTMLCanvasElement.prototype,"getContext",function(s){return function(a,...l){if(!me(this,t,r,!0)){let c=WO(a);if("__context"in this||(this.__context=c),n&&["webgl","webgl2"].includes(c))if(l[0]&&typeof l[0]=="object"){let u=l[0];u.preserveDrawingBuffer||(u.preserveDrawingBuffer=!0)}else l.splice(0,1,{preserveDrawingBuffer:!0})}return s.apply(this,[a,...l])}});o.push(i)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{o.forEach(i=>i())}}function vh(e,t,r,n,o,i){let s=[],a=Object.getOwnPropertyNames(e);for(let l of a)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(l))try{if(typeof e[l]!="function")continue;let c=Ht(e,l,function(u){return function(...d){let p=u.apply(this,d);if(yy(p,i,this),"tagName"in this.canvas&&!me(this.canvas,n,o,!0)){let y=gy(d,i,this),h={type:t,property:l,args:y};r(this.canvas,h)}return p}});s.push(c)}catch{let c=fs(e,l,{set(u){r(this.canvas,{type:t,property:l,args:[u],setter:!0})}});s.push(c)}return s}function UO(e,t,r,n){let o=[];return o.push(...vh(t.WebGLRenderingContext.prototype,Nr.WebGL,e,r,n,t)),typeof t.WebGL2RenderingContext<"u"&&o.push(...vh(t.WebGL2RenderingContext.prototype,Nr.WebGL2,e,r,n,t)),()=>{o.forEach(i=>i())}}var by="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",zO=e=>Uint8Array.from(atob(e),t=>t.charCodeAt(0)),xh=typeof window<"u"&&window.Blob&&new Blob([zO(by)],{type:"text/javascript;charset=utf-8"});function GO(e){let t;try{if(t=xh&&(window.URL||window.webkitURL).createObjectURL(xh),!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,"+by,{name:e?.name})}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}var Zl=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",(l,c)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(l)||this.pendingCanvasMutations.set(l,[]),this.pendingCanvasMutations.get(l).push(c)});let{sampling:r="all",win:n,blockClass:o,blockSelector:i,recordCanvas:s,dataURLOptions:a}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,s&&r==="all"&&this.initCanvasMutationObserver(n,o,i),s&&typeof r=="number"&&this.initCanvasFPSObserver(r,n,o,i,{dataURLOptions:a})}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,n,o,i){let s=Rh(r,n,o,!0),a=new Map,l=new GO;l.onmessage=h=>{let{id:f}=h.data;if(a.set(f,!1),!("base64"in h.data))return;let{base64:m,type:v,width:w,height:g}=h.data;this.mutationCb({id:f,type:Nr["2D"],commands:[{property:"clearRect",args:[0,0,w,g]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:m}],type:v}]},0,0]}]})};let c=1e3/t,u=0,d,p=()=>{let h=[];return r.document.querySelectorAll("canvas").forEach(f=>{me(f,n,o,!0)||h.push(f)}),h},y=h=>{if(u&&h-u<c){d=requestAnimationFrame(y);return}u=h,p().forEach(async f=>{var m;let v=this.mirror.getId(f);if(a.get(v)||f.width===0||f.height===0)return;if(a.set(v,!0),["webgl","webgl2"].includes(f.__context)){let g=f.getContext(f.__context);((m=g?.getContextAttributes())==null?void 0:m.preserveDrawingBuffer)===!1&&g.clear(g.COLOR_BUFFER_BIT)}let w=await createImageBitmap(f);l.postMessage({id:v,bitmap:w,width:f.width,height:f.height,dataURLOptions:i.dataURLOptions},[w])}),d=requestAnimationFrame(y)};d=requestAnimationFrame(y),this.resetObservers=()=>{s(),cancelAnimationFrame(d)}}initCanvasMutationObserver(t,r,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let o=Rh(t,r,n,!1),i=VO(this.processMutation.bind(this),t,r,n),s=UO(this.processMutation.bind(this),t,r,n);this.resetObservers=()=>{o(),i(),s()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let t=r=>{this.rafStamps.latestId=r,requestAnimationFrame(t)};requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,r)=>{let n=this.mirror.getId(r);this.flushPendingCanvasMutationFor(r,n)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,r){if(this.frozen||this.locked)return;let n=this.pendingCanvasMutations.get(t);if(!n||r===-1)return;let o=n.map(s=>{let{type:a,...l}=s;return l}),{type:i}=n[0];this.mutationCb({id:r,type:i,commands:o}),this.pendingCanvasMutations.delete(t)}},Jl=class{constructor(t){S(this,"trackedLinkElements",new WeakSet),S(this,"mutationCb"),S(this,"adoptedStyleSheetCb"),S(this,"styleMirror",new zl),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 n={id:r,styleIds:[]},o=[];for(let i of t){let s;this.styleMirror.has(i)?s=this.styleMirror.getId(i):(s=this.styleMirror.add(i),o.push({styleId:s,rules:Array.from(i.rules||CSSRule,(a,l)=>({rule:Ph(a,i.href),index:l}))})),n.styleIds.push(s)}o.length>0&&(n.styles=o),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}},Xl=class{constructor(){S(this,"nodeMap",new WeakMap),S(this,"active",!1)}inOtherBuffer(t,r){let n=this.nodeMap.get(t);return n&&Array.from(n).some(o=>o!==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(){}},X,Bi,cl,rs=!1;try{if(Array.from([1],e=>e*2)[0]!==2){let e=document.createElement("iframe");document.body.appendChild(e),Array.from=((Cf=e.contentWindow)==null?void 0:Cf.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}var je=HC();function Yt(e={}){let{emit:t,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:o="rr-block",blockSelector:i=null,ignoreClass:s="rr-ignore",ignoreSelector:a=null,maskTextClass:l="rr-mask",maskTextSelector:c=null,inlineStylesheet:u=!0,maskAllInputs:d,maskInputOptions:p,slimDOMOptions:y,maskInputFn:h,maskTextFn:f,hooks:m,packFn:v,sampling:w={},dataURLOptions:g={},mousemoveWait:k,recordDOM:_=!0,recordCanvas:V=!1,recordCrossOriginIframes:te=!1,recordAfter:G=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:Q=!1,collectFonts:le=!1,inlineImages:Me=!1,plugins:ze,keepIframeSrcFn:T=()=>!1,ignoreCSSAttributes:Dr=new Set([]),errorHandler:_r}=e;xO(_r);let re=te?window.parent===window:!0,Oe=!1;if(!re)try{window.parent.document&&(Oe=!1)}catch{Oe=!0}if(re&&!t)throw new Error("emit function is required");if(!re&&!Oe)return()=>{};k!==void 0&&w.mousemove===void 0&&(w.mousemove=k),je.reset();let Ct=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},Ge=Lh(y);SO();let Ec,hs=0,Pc=L=>{for(let Ne of ze||[])Ne.eventProcessor&&(L=Ne.eventProcessor(L));return v&&!Oe&&(L=v(L)),L};X=(L,Ne)=>{var Y;let Z=L;if(Z.timestamp=Qi(),(Y=zt[0])!=null&&Y.isFrozen()&&Z.type!==O.FullSnapshot&&!(Z.type===O.IncrementalSnapshot&&Z.data.source===E.Mutation)&&zt.forEach(Re=>Re.unfreeze()),re)t?.(Pc(Z),Ne);else if(Oe){let Re={type:"rrweb",event:Pc(Z),origin:window.location.origin,isCheckout:Ne};window.parent.postMessage(Re,"*")}if(Z.type===O.FullSnapshot)Ec=Z,hs=0;else if(Z.type===O.IncrementalSnapshot){if(Z.data.source===E.Mutation&&Z.data.isAttachIframe)return;hs++;let Re=n&&hs>=n,B=r&&Z.timestamp-Ec.timestamp>r;(Re||B)&&Bi(!0)}};let Wn=L=>{X({type:O.IncrementalSnapshot,data:{source:E.Mutation,...L}})},Ac=L=>X({type:O.IncrementalSnapshot,data:{source:E.Scroll,...L}}),Mc=L=>X({type:O.IncrementalSnapshot,data:{source:E.CanvasMutation,...L}}),Dy=L=>X({type:O.IncrementalSnapshot,data:{source:E.AdoptedStyleSheet,...L}}),Et=new Jl({mutationCb:Wn,adoptedStyleSheetCb:Dy}),Pt=new Hl({mirror:je,mutationCb:Wn,stylesheetManager:Et,recordCrossOriginIframes:te,wrappedEmit:X});for(let L of ze||[])L.getMirror&&L.getMirror({nodeMirror:je,crossOriginIframeMirror:Pt.crossOriginIframeMirror,crossOriginIframeStyleMirror:Pt.crossOriginIframeStyleMirror});let ms=new Xl;cl=new Zl({recordCanvas:V,mutationCb:Mc,win:window,blockClass:o,blockSelector:i,mirror:je,sampling:w.canvas,dataURLOptions:g});let Un=new Yl({mutationCb:Wn,scrollCb:Ac,bypassOptions:{blockClass:o,blockSelector:i,maskTextClass:l,maskTextSelector:c,inlineStylesheet:u,maskInputOptions:Ct,dataURLOptions:g,maskTextFn:f,maskInputFn:h,recordCanvas:V,inlineImages:Me,sampling:w,slimDOMOptions:Ge,iframeManager:Pt,stylesheetManager:Et,canvasManager:cl,keepIframeSrcFn:T,processedNodeManager:ms},mirror:je});Bi=(L=!1)=>{if(!_)return;X({type:O.Meta,data:{href:window.location.href,width:oy(),height:ny()}},L),Et.reset(),Un.init(),zt.forEach(Y=>Y.lock());let Ne=SE(document,{mirror:je,blockClass:o,blockSelector:i,maskTextClass:l,maskTextSelector:c,inlineStylesheet:u,maskAllInputs:Ct,maskTextFn:f,maskInputFn:h,slimDOM:Ge,dataURLOptions:g,recordCanvas:V,inlineImages:Me,onSerialize:Y=>{ay(Y,je)&&Pt.addIframe(Y),ly(Y,je)&&Et.trackLinkElement(Y),Ul(Y)&&Un.addShadowRoot(C.shadowRoot(Y),document)},onIframeLoad:(Y,Z)=>{Pt.attachIframe(Y,Z),Un.observeAttachShadow(Y)},onStylesheetLoad:(Y,Z)=>{Et.attachLinkElement(Y,Z)},keepIframeSrcFn:T});if(!Ne)return console.warn("Failed to snapshot the document");X({type:O.FullSnapshot,data:{node:Ne,initialOffset:ry(window)}},L),zt.forEach(Y=>Y.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&Et.adoptStyleSheets(document.adoptedStyleSheets,je.getId(document))};try{let L=[],Ne=Z=>{var Re;return I(DO)({mutationCb:Wn,mousemoveCb:(B,ys)=>X({type:O.IncrementalSnapshot,data:{source:ys,positions:B}}),mouseInteractionCb:B=>X({type:O.IncrementalSnapshot,data:{source:E.MouseInteraction,...B}}),scrollCb:Ac,viewportResizeCb:B=>X({type:O.IncrementalSnapshot,data:{source:E.ViewportResize,...B}}),inputCb:B=>X({type:O.IncrementalSnapshot,data:{source:E.Input,...B}}),mediaInteractionCb:B=>X({type:O.IncrementalSnapshot,data:{source:E.MediaInteraction,...B}}),styleSheetRuleCb:B=>X({type:O.IncrementalSnapshot,data:{source:E.StyleSheetRule,...B}}),styleDeclarationCb:B=>X({type:O.IncrementalSnapshot,data:{source:E.StyleDeclaration,...B}}),canvasMutationCb:Mc,fontCb:B=>X({type:O.IncrementalSnapshot,data:{source:E.Font,...B}}),selectionCb:B=>{X({type:O.IncrementalSnapshot,data:{source:E.Selection,...B}})},customElementCb:B=>{X({type:O.IncrementalSnapshot,data:{source:E.CustomElement,...B}})},blockClass:o,ignoreClass:s,ignoreSelector:a,maskTextClass:l,maskTextSelector:c,maskInputOptions:Ct,inlineStylesheet:u,sampling:w,recordDOM:_,recordCanvas:V,inlineImages:Me,userTriggeredOnInput:Q,collectFonts:le,doc:Z,maskInputFn:h,maskTextFn:f,keepIframeSrcFn:T,blockSelector:i,slimDOMOptions:Ge,dataURLOptions:g,mirror:je,iframeManager:Pt,stylesheetManager:Et,shadowDomManager:Un,processedNodeManager:ms,canvasManager:cl,ignoreCSSAttributes:Dr,plugins:((Re=ze?.filter(B=>B.observer))==null?void 0:Re.map(B=>({observer:B.observer,options:B.options,callback:ys=>X({type:O.Plugin,data:{plugin:B.name,payload:ys}})})))||[]},m)};Pt.addLoadListener(Z=>{try{L.push(Ne(Z.contentDocument))}catch(Re){console.warn(Re)}});let Y=()=>{Bi(),L.push(Ne(document)),rs=!0};return["interactive","complete"].includes(document.readyState)?Y():(L.push(he("DOMContentLoaded",()=>{X({type:O.DomContentLoaded,data:{}}),G==="DOMContentLoaded"&&Y()})),L.push(he("load",()=>{X({type:O.Load,data:{}}),G==="load"&&Y()},window))),()=>{L.forEach(Z=>{try{Z()}catch(Re){String(Re).toLowerCase().includes("cross-origin")||console.warn(Re)}}),ms.destroy(),rs=!1,kO()}}catch(L){console.warn(L)}}Yt.addCustomEvent=(e,t)=>{if(!rs)throw new Error("please add custom event after start recording");X({type:O.Custom,data:{tag:e,payload:t}})};Yt.freezePage=()=>{zt.forEach(e=>e.freeze())};Yt.takeFullSnapshot=e=>{if(!rs)throw new Error("please take full snapshot after start recording");Bi(e)};Yt.mirror=je;var kh;(function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"})(kh||(kh={}));var mB=5*1e3;var{addCustomEvent:yB}=Yt,{freezePage:gB}=Yt,{takeFullSnapshot:SB}=Yt;var Ry="__ripploEmitRrwebEvent";function vy(){return{eventTypes:wy(O),incrementalSources:wy(E)}}function wy(e){return Object.fromEntries(Object.entries(e).filter(t=>typeof t[1]=="number").map(([t,r])=>[r,t]))}var xy=Ya(Ha("@ripplo/rrweb-bundle/bundle","rrweb.js"));async function jn({clientVersion:e,debugDir:t,writeOtlpPortFile:r}){let n=new Map,o=xf(vy()),i=await Ia({localDir:ky.join(ky.dirname(t),".local"),writePortFile:r,onRrwebBatch:(l,c)=>{n.get(l)?.emitRrwebBatch(c)},onSpan:l=>{let c=l.attributes["ripplo.run"];c!=null&&n.get(c)?.emit(l)}}),s=await xy();return{attach:async(l,c)=>{let u=vf({debugDir:t,runId:c,worker:o});u.emit({clientVersion:e,kind:"meta",source:"capture",timeNanos:"0"}),n.set(c,u),await kf(l,c),await l.addInitScript(`globalThis.__ripploCapturePort = ${String(i.port)};`),await qO(l,u),await ZO(l,u);let d=[];return{emitAction:p=>{QO(u,p)},emitStepOutcome:p=>{eI(u,p)},finish:()=>JO(u,{pages:d,registry:n,runId:c}),onPage:p=>{d.push(p),XO(u,s,p)}}},debugDir:t,close:async()=>{await i.stop(),await o.terminate()},injectSpan:(l,c)=>{n.get(l)?.emit(c)}}}async function KO(e){await Promise.all(e.map(t=>t.evaluate("globalThis.__ripploFlushRrweb ? globalThis.__ripploFlushRrweb() : undefined").catch(()=>{})))}async function qO(e,t){await e.exposeBinding(Ry,(r,n)=>{let o=typeof n=="string"?n:JSON.stringify(n);t.emitRrwebBatch(Buffer.from(o,"utf8"))})}var HO="__ripploEventPush",YO=Ue.discriminatedUnion("kind",[Ue.object({kind:Ue.literal("console"),level:Ue.string(),text:Ue.string(),timestamp:Ue.number()}),Ue.object({kind:Ue.literal("error"),message:Ue.string(),stack:Ue.string().optional(),timestamp:Ue.number()})]);async function ZO(e,t){await e.exposeBinding(HO,(r,n)=>{let o=YO.safeParse(n);if(!o.success)return;let i=o.data;if(i.kind==="console"){t.emit({kind:"console",level:i.level,source:"browser",text:i.text,timeNanos:Ut(i.timestamp)});return}t.emit({kind:"error",message:i.message,source:"browser",stack:i.stack,timeNanos:Ut(i.timestamp)})})}async function JO(e,t){await KO(t.pages),t.registry.delete(t.runId),await e.close({noticeIfNoRrweb:"rrweb capture unavailable: recorder never pushed an event \u2014 page never loaded the recorder (blank page, failed navigation, or CSP block)"})}function XO(e,t,r){r.on("load",()=>{r.addScriptTag({content:t}).catch(()=>{})}),r.on("requestfinished",n=>{sI(e,n).catch(()=>{})}),r.url()!=="about:blank"&&r.addScriptTag({content:t}).catch(()=>{})}function QO(e,t){e.emit({action:t.kind,kind:"action",source:"test",target:nI(t),timeNanos:Ut(Date.now()),value:oI(t)})}function eI(e,t){t.checks.forEach(r=>{e.emit(tI(r,t.stepIndex))}),t.stepError!=null&&e.emit(rI(t.stepError,t.stepIndex))}function tI(e,t){return{...e.body,kind:"check",origin:_o(e.target,t),source:"verifier",stepIndex:t,timeNanos:Ut(e.atMs)}}function rI(e,t){return{error:e.error,kind:"stepError",source:"verifier",stepIndex:t,timeNanos:Ut(e.atMs)}}function nI(e){if(e.url!=null)return e.url;if(e.locator!=null)return Gn(e.locator)}function oI(e){return e.value!=null?typeof e.value=="object"?JSON.stringify(e.value):String(e.value):e.key}var iI=/^http:\/\/127\.0\.0\.1:\d+\/rrweb\//;async function sI(e,t){if(iI.test(t.url()))return;let r=await t.response();if(r==null)return;let n=t.resourceType(),o=n==="fetch"||n==="xhr",i=t.timing(),s=t.headers().traceparent?.split("-"),a=i.startTime;e.emit({durationMs:Math.max(0,i.responseEnd),kind:"network",method:t.method(),requestBody:o?t.postData()??void 0:void 0,resourceType:n,responseBody:o?await aI(r):void 0,source:"browser",spanId:s?.[2],status:r.status(),timeNanos:Ut(a>0?a:Date.now()),traceId:s?.[1],url:r.url()})}async function aI(e){try{return await e.text()}catch{return}}function Vn(e){return{aborted:!0,contradictions:[],failed:!1,findings:[],ran:[],teardown:e}}function xc(e,t){return new vc(bI(e,t))}function uI(e,t){return new vc(dI(e,t))}async function dI(e,t){let r=await mf(e.profileDir).catch(()=>{});if(r==null)return Zt(Ke(new Error("launch")));try{return Fr(await pI({context:r,params:e,signal:t}))}catch(n){return Zt(Ke(n))}finally{await r.close().catch(ke)}}async function pI({context:e,params:t,signal:r}){let n=e.pages()[0]??await e.newPage(),o=await jn({clientVersion:t.clientVersion,debugDir:t.debugDir,writeOtlpPortFile:!0}),i=await o.attach(e,t.runId);return i.onPage(n),e.on("page",s=>{i.onPage(s)}),await n.goto(t.startUrl).catch(ke),t.onReady(),await fI(e,r),await i.finish(),await o.close(),{behaviorPath:lI.join(t.debugDir,t.runId,"behavior.jsonl")}}function fI(e,t){return new Promise(r=>{let n=()=>{r()};t.addEventListener("abort",n,{once:!0}),e.on("close",n),e.browser()?.on("disconnected",n),e.on("page",o=>o.on("close",n)),e.pages().forEach(o=>o.on("close",n))})}function hI(e,t){return new vc(mI(e,t))}async function mI(e,t){let r=yI(e),n=Ay({lockfile:e.lockfile,options:e.options,runId:e.runId,signal:t}),o=async i=>{try{return Fr(await gI({established:i,params:e,signal:t}))}catch(s){return await i.teardown().match(ke,ke),Zt(Jn(s)?s:Ke(s))}};return Py(n,r).match(o,async i=>(await kc(n.teardown),Zt(i)))}function yI(e){return{capture:!1,lockfile:e.lockfile,onEvent:void 0,onPhase:void 0,options:e.options,params:void 0,runId:e.runId,sequence:e.sequence,test:e.test}}async function gI({established:e,params:t,signal:r}){let n=ui({cacheDir:void 0,headed:!0}),o=await n.acquire(),{result:i,session:s}=await Ey({browser:o,capture:null,established:e,lockfile:t.lockfile,onEvent:void 0,onPhase:void 0,options:t.options,sequence:t.sequence,signal:r,stopAfterStep:t.stopAfterStep,test:t.test,viewport:null});return i.failed?(await s.close().catch(ke),await e.teardown().match(ke,ke),await n.close(),{contradictions:i.contradictions,kind:"failed"}):(t.onReady(),await SI(o,s.context),await e.teardown().match(ke,ke),await n.close(),{kind:"handed-over",ran:i.ran.length})}function SI(e,t){return new Promise(r=>{let n=()=>{r()};e.on("disconnected",n),t.on("close",n),t.on("page",o=>o.on("close",n)),t.pages().forEach(o=>o.on("close",n))})}async function bI({browser:e,hub:t,request:r},n){if(n.aborted)return Fr(Vn("skipped"));let o=Ay({lockfile:r.lockfile,options:r.options,runId:r.runId,signal:n}),i=async s=>{try{return await RI({browser:e,established:s,hub:t,request:r,signal:n})}catch(a){return Zt(Jn(a)?a:Ke(a))}};return Py(o,r).match(i,s=>wI(s,o.teardown))}async function wI(e,t){return e.kind!=="aborted"?Zt(e):Fr(Vn(await kc(t)))}function kc(e){return e().match(()=>"done",()=>"failed")}async function RI(e){let t=await vI(e);if(t.kind==="completed"){let n=Date.now();return e.established.teardown().match(()=>(e.request.onPhase?.("teardown",Date.now()-n),Fr({aborted:!1,...t.result})),o=>Zt(o))}let r=await kc(e.established.teardown);if(t.kind==="aborted")return Fr(Vn(r));throw t.error}function Cy(e,t,r){return Qr(e,t).map(n=>({params:{...ei(n),...r},transition:n}))}async function Ey(e){let{established:t,lockfile:r,signal:n}=e,o=Date.now(),i=await Va({baseUrl:e.options.baseUrl,browser:e.browser,capture:e.capture,clientState:t.clientState,engine:Na(CI(r)),fixturesDir:e.options.fixturesDir,networkHeaders:void 0,observeActor:t.observeActor,reader:t.reader,session:t.auth,signal:n,signInActor:t.signInActor,viewport:e.viewport});e.onPhase?.("browser",Date.now()-o);try{let s=ar(r),a=Date.now(),l=await Xo({canon:Vo(r),classify:jo(r),dataRules:s.dataRules,driver:i.driver,facts:{facts:Hs(s.facts,ee(e.test)),overlays:Qe(r),overrides:s.overrides},initialState:{snapshot:t.snapshot},sequence:e.sequence,stopAfterStep:e.stopAfterStep,onEvent:c=>{c.kind==="step"&&i.emitStepOutcome({checks:c.checks,stepError:c.stepError,stepIndex:c.index}),e.onEvent?.(c)}},n);return e.onPhase?.("drive",Date.now()-a),{result:l,session:i}}catch(s){throw await i.close().catch(ke),s}}async function vI({browser:e,established:t,hub:r,request:n,signal:o}){try{be(o),n.onEvent?.({aliases:t.aliases,generated:t.generated,generatedSingletons:t.generatedSingletons,kind:"world"});let{result:i,session:s}=await Ey({browser:e,capture:n.capture?{hub:r,runId:n.runId}:null,established:t,lockfile:n.lockfile,onEvent:n.onEvent,onPhase:n.onPhase,options:n.options,sequence:n.sequence??Cy(n.lockfile,n.test,n.params),signal:o,stopAfterStep:void 0,test:n.test,viewport:hf(n.test.viewport)});return await s.close(),{kind:"completed",result:i}}catch(i){return un(i)?{kind:"aborted"}:{error:i,kind:"threw"}}}function Py(e,t){let r=Date.now();return e.ready().andThen(()=>{t.onPhase?.("engine",Date.now()-r);let n=Date.now();return fr(t.lockfile,t.test,{generate:zn(t.options.generate,t.runId),materialize:e.materialize,params:t.params,signIn:e.signIn}).map(o=>(t.onPhase?.("world",Date.now()-n),{aliases:o.aliases,auth:o.auth,clientState:o.clientState,generated:o.generated,generatedSingletons:o.generatedSingletons,observeActor:o.principals.size>0,reader:e.reader,signInActor:xI(e.signIn,o.principals),snapshot:o.snapshot,teardown:e.teardown}))})}function xI(e,t){return r=>{let n=t.get(r);return n==null?cI(Ke(new Error(`no seeded principal for actor "${r}"`))):e({entity:n.entity,row:n.row})}}function Ay({lockfile:e,options:t,runId:r,signal:n}){let o=qa({baseUrl:t.engineUrl,extraHeaders:void 0,runId:r,secret:t.secret},n);return{materialize:qo(o.setupWorld),reader:Ga(e.entities,kI(e),o.query),ready:o.ready,signIn:o.signIn,teardown:o.teardown}}function kI(e){return e.singletons.filter(t=>t.source==="backend").map(t=>t.name)}function CI(e){return e.singletons.filter(t=>t.source==="client").map(t=>t.name)}import{err as EI,ok as PI,ResultAsync as AI}from"neverthrow";function MI({cacheDir:e,clientVersion:t,debugDir:r,headed:n,writeOtlpPortFile:o}){let i=ui({cacheDir:e,headed:n}),s,a,l=async()=>(s??=jn({clientVersion:t,debugDir:r,writeOtlpPortFile:o}),a=await s,a),c=async(p,y)=>{if(y.aborted)return PI(Vn("skipped"));try{let h=await l();if(p.options.headed&&!n)return await Wa(!0,async m=>xc({browser:m,hub:h,request:p},y));let f=await i.acquire();return await xc({browser:f,hub:h,request:p},y)}catch(h){return EI(Ke(h))}};return{close:async()=>{await i.close();let p=s;s=void 0,a=void 0,p!=null&&await p.then(y=>y.close()).catch(()=>{})},prewarm:async()=>{await l(),await i.acquire()},injectSpan:(p,y)=>{a?.injectSpan(p,y)},runOnce:(p,y)=>new AI(c(p,y))}}import{z as P}from"zod";function OI(e){let t=e.split(`
|
|
65
|
-
`).map(o=>KI(o)).filter(o=>o!=null),r=jI(t),n=t.map(o=>NI(o,r)).filter(o=>o!=null).filter(o=>o.kind==="input"||o.element!=null);return II(n)}function II(e){return e.filter((t,r)=>{let n=e[r+1];return!(t.kind==="input"&&n?.kind==="input"&&TI(t.element,n.element))})}function TI(e,t){return e?.testId===t?.testId&&e?.ariaLabel===t?.ariaLabel&&e?.placeholder===t?.placeholder}var LI={2:"click",3:"contextmenu",4:"dblclick"};function NI(e,t){return e.rrwebType==="IncrementalSnapshot:MouseInteraction"?FI(e,t):e.rrwebType==="IncrementalSnapshot:Input"?$I(e,t):null}function FI(e,t){let r=XI.safeParse(e.event.data);if(!r.success)return null;let n=LI[r.data.type];if(n==null)return null;let o=My(r.data.id,t.nodes);return{element:Oy(o,t),kind:n,timeNanos:e.timeNanos,value:void 0}}function $I(e,t){let r=QI.safeParse(e.event.data);return r.success?{element:Oy(r.data.id,t),kind:"input",timeNanos:e.timeNanos,value:r.data.text??DI(r.data.isChecked)}:null}function DI(e){return e==null?void 0:String(e)}var _I=new Set(["button","a","input","select","textarea","summary"]);function My(e,t){let r=t.get(e);if(r!=null)return BI(r)?e:r.parentId==null?void 0:My(r.parentId,t)}function BI(e){return e.attrs["data-testid"]!=null||e.attrs["aria-label"]!=null||e.attrs.role!=null||_I.has(e.tag??"")}function Oy(e,t){let r=e==null?void 0:t.nodes.get(e);if(!(r==null||e==null))return{ariaLabel:$r(r,"aria-label"),href:$r(r,"href"),name:$r(r,"name"),placeholder:$r(r,"placeholder"),role:$r(r,"role"),tag:r.tag,testId:$r(r,"data-testid"),text:Iy(e,t)}}function $r(e,t){let r=e.attrs[t];return typeof r=="string"?r:typeof r=="number"||typeof r=="boolean"?String(r):void 0}function Iy(e,t){let r=t.nodes.get(e);if(r==null)return;let n=r.text?.trim()??"",i=(t.children.get(e)??[]).map(a=>Iy(a,t)??""),s=[n,...i].filter(a=>a.length>0).join(" ");return s.length===0?void 0:s.slice(0,100)}function jI(e){let t=e.flatMap(o=>VI(o).flatMap(i=>Cc(i,void 0))),r=e.flatMap(o=>WI(o).flatMap(i=>Cc(i.node,i.parentId??void 0))),n=zI(new Map([...t,...r]),e);return{children:UI(n),nodes:n}}function VI(e){if(e.rrwebType!=="FullSnapshot")return[];let t=YI.safeParse(e.event.data);return t.success?[t.data.node]:[]}function WI(e){if(e.rrwebType!=="IncrementalSnapshot:Mutation")return[];let t=Ty.safeParse(e.event.data);return t.success?t.data.adds.flatMap(r=>{let n=ZI.safeParse(r);return n.success?[n.data]:[]}):[]}function UI(e){let t=new Map;return e.forEach((r,n)=>{r.parentId!=null&&t.set(r.parentId,[...t.get(r.parentId)??[],n])}),t}function Cc(e,t){let r=HI.safeParse(e);if(!r.success)return[];let n=r.data,o=n.childNodes??[];return[[n.id,{attrs:{...n.attributes},parentId:t,tag:n.tagName,text:n.textContent}],...o.flatMap(s=>Cc(s,n.id))]}function zI(e,t){return t.flatMap(n=>GI(n)).reduce((n,o)=>{let i=n.get(o.id);return i==null?n:new Map(n).set(o.id,{...i,attrs:{...i.attrs,...o.attributes}})},e)}function GI(e){if(e.rrwebType!=="IncrementalSnapshot:Mutation")return[];let t=Ty.safeParse(e.event.data);return t.success?t.data.attributes.flatMap(r=>{let n=JI.safeParse(r);return n.success?[n.data]:[]}):[]}function KI(e){if(e.trim().length===0)return null;let t=eT.safeParse(qI(e));return t.success?t.data:null}function qI(e){try{return JSON.parse(e)}catch{return null}}var HI=P.object({attributes:P.record(P.string(),P.unknown()).optional(),childNodes:P.array(P.unknown()).optional(),id:P.number(),tagName:P.string().optional(),textContent:P.string().optional()}),YI=P.object({node:P.unknown()}),ZI=P.object({node:P.unknown(),parentId:P.number().nullable().default(null)}),JI=P.object({attributes:P.record(P.string(),P.unknown()),id:P.number()}),Ty=P.object({adds:P.array(P.unknown()).default([]),attributes:P.array(P.unknown()).default([])}),XI=P.object({id:P.number(),type:P.number()}),QI=P.object({id:P.number(),isChecked:P.boolean().optional(),text:P.string().optional()}),eT=P.object({event:P.object({data:P.unknown()}),kind:P.literal("rrweb"),rrwebType:P.string(),timeNanos:P.string()});function tT(e){let t=r=>e.find(n=>n.phase===r)?.ms??0;return{browserMs:t("browser"),driveMs:t("drive"),engineMs:t("engine"),teardownMs:t("teardown"),worldMs:t("world")}}async function rT(e,t){let r=await Fy({attemptIndex:0,capture:!1,params:e,stepRuns:e.stepRuns},t);if(r.kind!=="completed")return Ly(r);let n=Ny(r.contradictions);if(n!=null)return{error:n,kind:"error"};let o=yr(r.contradictions);if(o.length===0)return{kind:"clean",ranCount:r.ranCount,timing:{confirm:void 0,detect:r.timing}};let i=mn(o);return e.seenSignature!=null&&await e.seenSignature(i.signature)?{kind:"seen",ranCount:r.ranCount,signature:i.signature,timing:{confirm:void 0,detect:r.timing},title:i.title,verifierLayer:i.layer}:nT(e,i,r.timing,t)}function Ly(e){return e.kind==="error"?{error:e.error,kind:"error"}:{kind:e.kind}}function Ny(e){let t=e.find(r=>r.kind==="stepError"&&Xn(r.record.error));return t!=null&&t.kind==="stepError"?t.record.error:void 0}async function nT(e,t,r,n){let o=await Fy({attemptIndex:1,capture:!0,params:e,stepRuns:e.stepRuns},n);if(o.kind!=="completed")return Ly(o);let i=Ny(o.contradictions);if(i!=null)return{error:i,kind:"error"};let s={confirm:o.timing,detect:r},a=yr(o.contradictions);return a.length===0||mn(a).signature!==t.signature?{kind:"flaky",ranCount:o.ranCount,timing:s}:{baseState:e.baseState.name,captureEvents:o.events,kind:"finding",ranCount:o.ranCount,runId:o.runId,signature:t.signature,sourceTest:t.sourceTest,timing:s,title:t.title,verifierLayer:t.layer}}async function Fy({attemptIndex:e,capture:t,params:r,stepRuns:n},o){let i=r.runIdFor(e),s=[],a=[];return(await r.session.runOnce({capture:t,lockfile:r.lockfile,onEvent:t?c=>{s.push(c)}:void 0,options:r.options,params:void 0,runId:i,sequence:oT(r,n),test:r.baseState.test,onPhase:(c,u)=>{a.push({ms:u,phase:c})}},o)).match(c=>c.aborted?{kind:"aborted"}:{contradictions:c.contradictions,events:s,kind:"completed",ranCount:c.ran.length,runId:i,timing:tT(a)},c=>({error:c,kind:"error"}))}function oT(e,t){return t.map(r=>{let n=e.corpus[r.idx];if(n==null)throw new Error("transition index out of corpus range");return{params:r.params,transition:n}})}async function $y(e,t){let r=await si(e);if(r==null)return{kind:"unplannable"};let n=[...r.startingPointTests.values()].find(i=>ee(i)===t.baseStateRef);if(n==null)return{kind:"unplannable"};let o=t.steps.map(i=>{let s=r.corpus.find(a=>a.test===i.test&&a.index===i.index);return s==null?null:{params:i.params,transition:s}});return o.some(i=>i==null)?{kind:"unplannable"}:{baseTest:n,kind:"ok",sequence:o.filter(i=>i!=null)}}async function iT({capture:e,lockfile:t,onEvent:r,options:n,repro:o,runId:i,session:s,signal:a}){let l=await $y(t,o);return l.kind==="unplannable"?{kind:"unplannable"}:(await s.runOnce({capture:e,lockfile:t,onEvent:r,onPhase:void 0,options:n,params:void 0,runId:i,sequence:l.sequence,test:l.baseTest},a)).match(u=>{if(u.aborted)return{kind:"aborted"};let d=yr(u.contradictions);return d.length>0?{contradictions:d,kind:"still-fails"}:{kind:"resolved"}},u=>({kind:"state-unavailable",reason:u.kind}))}export{ee as a,J as b,Xr as c,Xn as d,ou as e,jr as f,Ie as g,Wd as h,To as i,No as j,Fo as k,Gd as l,ln as m,dt as n,bo as o,Jo as p,Qt as q,Sd as r,Eo as s,Pd as t,Fd as u,Dd as v,Cp as w,Ep as x,Ap as y,Mp as z,Ip as A,Kd as B,$o as C,Do as D,Np as E,Vp as F,Up as G,zp as H,Gp as I,qp as J,Hp as K,oi as L,si as M,Yp as N,Ha as O,Ya as P,Ia as Q,uI as R,hI as S,Cy as T,MI as U,OI as V,rT as W,$y as X,iT as Y};
|
|
66
|
-
/*! Bundled license information:
|
|
67
|
-
|
|
68
|
-
rrweb/dist/rrweb.js:
|
|
69
|
-
(*! *****************************************************************************
|
|
70
|
-
Copyright (c) Microsoft Corporation.
|
|
71
|
-
|
|
72
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
73
|
-
purpose with or without fee is hereby granted.
|
|
74
|
-
|
|
75
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
76
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
77
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
78
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
79
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
80
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
81
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
82
|
-
***************************************************************************** *)
|
|
83
|
-
*/
|