ripplo 0.9.7 → 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.
Files changed (51) hide show
  1. package/dist/{chunk-XJJDHGK4.js → chunk-26A42N75.js} +28 -28
  2. package/dist/{chunk-TPCKMDWU.js → chunk-43C7VPGA.js} +1 -1
  3. package/dist/{chunk-GZPE7I7U.js → chunk-44GHUVW6.js} +2 -2
  4. package/dist/{chunk-2Q7VXQYN.js → chunk-4OSYMIH6.js} +1 -1
  5. package/dist/{chunk-GFKK7K6T.js → chunk-5X4M4MTG.js} +3 -3
  6. package/dist/chunk-67YR3QHA.js +6 -0
  7. package/dist/{chunk-BJWGAKKD.js → chunk-6NKSEWP6.js} +6 -6
  8. package/dist/chunk-6TCK75ER.js +83 -0
  9. package/dist/{chunk-5DT43ABQ.js → chunk-73TKORK6.js} +1 -1
  10. package/dist/{chunk-IG7J452B.js → chunk-CEVQ5RNC.js} +1 -1
  11. package/dist/chunk-FXCBWBN5.js +4 -0
  12. package/dist/{chunk-6VUSLPQD.js → chunk-GOZWOCTE.js} +2 -2
  13. package/dist/chunk-IONMYZ3K.js +4 -0
  14. package/dist/{chunk-V4CLXOCP.js → chunk-LL4HUOJP.js} +1 -1
  15. package/dist/{chunk-CAS7MBA7.js → chunk-M3CXHDFV.js} +1 -1
  16. package/dist/{chunk-OES7HGNF.js → chunk-QAR7FZO3.js} +1 -1
  17. package/dist/{chunk-BNMS3N54.js → chunk-UDPKOYZT.js} +1 -1
  18. package/dist/chunk-VDAFHS7J.js +7 -0
  19. package/dist/{chunk-7CELUIVK.js → chunk-VOZOP7MQ.js} +1 -1
  20. package/dist/{cli-error-OIG4RO4E.js → cli-error-AHNJULLG.js} +1 -1
  21. package/dist/{compile-write-OLP4DB4P.js → compile-write-OLQOR3OK.js} +1 -1
  22. package/dist/daemon-BJAGK2Q3.js +152 -0
  23. package/dist/{daemon-WEKGUIRK.js → daemon-H4P5PCVH.js} +1 -1
  24. package/dist/{dsl-loader-IRBKYLNW.js → dsl-loader-LXH6PUY5.js} +1 -1
  25. package/dist/{exit-plan-gate-HSTV7UO4.js → exit-plan-gate-CJ3IXWTN.js} +1 -1
  26. package/dist/hook.js +1 -1
  27. package/dist/index.js +175 -175
  28. package/dist/{plan-reminder-FZSSUVNB.js → plan-reminder-EPCNBFY3.js} +1 -1
  29. package/dist/post-edit-ZVCYZ62V.js +4 -0
  30. package/dist/post-edit-analyze-J2H3I3IO.js +4 -0
  31. package/dist/post-edit-flag-stubs-E22KT2LD.js +4 -0
  32. package/dist/{pre-edit-WZJVD3J4.js → pre-edit-TEN3AFRK.js} +1 -1
  33. package/dist/pre-edit-scope-gate-2YIFSEDY.js +1 -1
  34. package/dist/{pre-edit-watch-gate-GQZYMDOC.js → pre-edit-watch-gate-BUFWLXR3.js} +1 -1
  35. package/dist/{prompt-submit-LE5LR62B.js → prompt-submit-DJFWNGYC.js} +1 -1
  36. package/dist/scope-reminder-DIDCHDAA.js +1 -1
  37. package/dist/status-FDM2RK37.js +4 -0
  38. package/dist/{stop-enforce-EH2SC7ND.js → stop-enforce-4XV6LK7Z.js} +2 -2
  39. package/dist/tasks-reminder-SDS6RNLP.js +1 -1
  40. package/package.json +2 -3
  41. package/dist/chunk-22JUAYHM.js +0 -4
  42. package/dist/chunk-4GA5662U.js +0 -83
  43. package/dist/chunk-FJPJDGSS.js +0 -7
  44. package/dist/chunk-L2ZJK7MP.js +0 -6
  45. package/dist/chunk-RIVHBABX.js +0 -4
  46. package/dist/daemon-3IWI7VQT.js +0 -152
  47. package/dist/post-edit-333UCJ6G.js +0 -4
  48. package/dist/post-edit-analyze-JFWA223C.js +0 -4
  49. package/dist/post-edit-flag-stubs-IZSAIM4O.js +0 -4
  50. package/dist/solve-worker.js +0 -4
  51. package/dist/status-H5WYYH4J.js +0 -4
@@ -0,0 +1,83 @@
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 At,B as Vc,C as Pt,D as it,E as xe,G as Wc,H as Uc,I as zc,J as Gc,K as G,L as me,M as Gn,N as Kc,O as qc,R as ys,S as Hc,T as Kn,U as Yc,Y as qn,Z as Zc,a as b,b as Oc,ba as Jc,c as ms,ca as Xc,d as nt,da as Qc,e as Zt,ea as eu,f as le,g as Ic,h as ot,i as Dr,ia as yt,j as Wn,k as Tc,l as Lc,la as tu,m as Un,n as Nc,o as Fc,p as $c,q as zn,u as Dc,v as _c,w as Bc,x as jc,y as ve,z as $e}from"./chunk-26A42N75.js";import{a as By}from"./chunk-NNH3YVVO.js";import{a as _y,b as Mc}from"./chunk-KMZ3L5YA.js";var Fd=_y((sN,Zs)=>{"use strict";var Po=process||{},Ld=Po.argv||[],Ao=Po.env||{},_b=!(Ao.NO_COLOR||Ld.includes("--no-color"))&&(!!Ao.FORCE_COLOR||Ld.includes("--color")||Po.platform==="win32"||(Po.stdout||{}).isTTY&&Ao.TERM!=="dumb"||!!Ao.CI),Bb=(e,t,r=e)=>n=>{let o=""+n,i=o.indexOf(t,e.length);return~i?e+jb(o,t,r,i)+t:e+o+t},jb=(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)},Nd=(e=_b)=>{let t=e?Bb:()=>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")}};Zs.exports=Nd();Zs.exports.createColors=Nd});function ee(e){return`${e.workflow}/${e.slug}`}var ru=new WeakMap;function Z(e){let t=ru.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 ru.set(e,r),r}function gs({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=gs();function Ss(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 bs(e,t,r){return{detail:r.slice(0,500),kind:"engine-http",path:e,status:t}}function Jt(e,t){return{code:lu(t)??null,kind:"engine-network",message:Br(t),path:e}}function Hn(e){return{kind:"client-mount-missing",mountKey:e}}function ws(e,t){return{kind:"app-not-ready",readyKey:e,timeoutMs:t}}function Rs(e,t){return{kind:"engine-decode",message:Br(t),path:e}}function vs(e,t){return{entity:e,field:t,kind:"state-identity"}}function xs(e){return{as:e,kind:"setup-missing-row"}}function ze(e){return{kind:"driver-launch",message:Br(e)}}function Yn(e){return{kind:"page-read",message:Br(e)}}function ks(e){return{kind:"engine-unreachable",url:e}}function Cs(e,t){return{action:e,failure:t,kind:"action-failed"}}function Es(e){return{kind:"unclassified",message:Br(e)}}function As(){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 Zn(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"],iu=new Set(Uy);function Jn(e){return iu.has(e.kind)}function su(e){return iu.has(e)}var nu=300;function _r(e){switch(e.kind){case"engine-http":return`engine ${e.path} returned ${String(e.status)}: ${au(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: ${ou(e.failure)}`;case"check-failed":return`check failed: ${ou(e.failure)}`;case"aborted":return"run aborted"}}function ou(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 au(e){let t=e.replaceAll(/\s+/gu," ").trim();return t.length<=nu?t:`${t.slice(0,nu)}\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 lu(e){if(!(typeof e!="object"||e==null))return"code"in e&&typeof e.code=="string"?e.code:"cause"in e?lu(e.cause):void 0}function Br(e){let t=e instanceof Error?e.message:String(e);return au(Ss(t))}var cu=new WeakMap;function Xt(e){let t=cu.get(e);if(t!=null)return t;let r={entities:e.entities,singletonSchemas:e.singletons,valueSpaces:e.valueSpaces};return cu.set(e,r),r}import{createHash as AS}from"crypto";import{z as Hy}from"zod";import{stringify as Yy}from"safe-stable-stringify";var Ps=Hy.string().brand(),P=Ps.parse("");function Ie(e){return Ps.parse(e)}function Ce(e,t){return Ps.parse(e.length===0?t:`${e}.${t}`)}function N(e){return Oc.safeParse(e).success}function Mt(e){let t=e.lastIndexOf(".");return t===-1?void 0:{alias:e.slice(0,t),field:e.slice(t+1)}}function Ge(e){return typeof e=="object"&&e!==null&&"template"in e}function uu(e){return typeof e!="string"&&"count"in e}var ye=class extends Error{subject;constructor(t){super(t),this.subject=t}};function ge(e){return{counts:void 0,env:e}}function jr(e,t,r){let n=Ce(t,e.ref);if(!r.has(n))throw new ye(n);return r.get(n)??null}function Vr(e,t,r){return Xn(e).every(n=>r.has(Ce(t,n)))}function Ke(e,t,r){return typeof e=="string"?e:N(e)?String(jr(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)?jr(e,t,r.env):Ke(e,t,r)}function du(e,t){return Ee(e,P,t)}function Ot(e){return Yy(e)}function Qt(e,t,r){return Object.fromEntries(Object.entries(e).map(([n,o])=>[n,Ee(o,t,r)]))}function Xn(e){return e==null||typeof e!="object"?[]:Ge(e)?e.template.flatMap(t=>typeof t=="string"?[]:uu(t)?Zy(t):[t.ref]):[e.ref]}function Zy(e){return Object.values(e.count.where).flatMap(t=>pu(t))}function pu(e){return e==null||typeof e!="object"?[]:"kind"in e?e.kind==="within"?Object.values(e.selection.where).flatMap(t=>pu(t)):e.kind==="anyOf"?e.values.flatMap(t=>Xn(t)):Xn(e.value):Xn(e)}function Jy(e,t,r){if(typeof e=="string")return e;if(!uu(e))return String(jr(e,t,r.env));if(r.counts==null)throw new ye(e.count.entity);return String(r.counts(e,r.env))}function se(e,t){return e.by==="role"?{by:"role",name:e.name==null?void 0:Ke(e.name,P,t),role:e.role}:e.by==="inside"?{by:"inside",scope:se(e.scope,t),target:se(e.target,t)}:e.by==="surface"?{by:"surface",container:se(e.container,t),overlay:e.overlay}:e.by==="frame"?{by:"frame",element:se(e.element,t)}:{by:"testId",value:Ke(e.value,P,t)}}var Xy="https://ripplo.invalid";var fu={hash:void 0,path:void 0,query:{},title:void 0,viewport:void 0};function mu(e){return e.kind!=="title"&&e.kind!=="viewport"}function Ur(e){return e.kind==="query"?`url query "${e.key}"`:e.kind==="title"||e.kind==="viewport"?e.kind:`url ${e.kind}`}function Qn(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 Wr(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 yu(e){if(typeof e=="string")return hu(Wr(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{...fu,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{...fu,path:s};let a=i.filter(c=>typeof c=="string").join(""),l=Wr(`/p${a.slice(a.search(/[?#]/))}`);return{...hu(l),path:s}}function gu(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 hu(e){return{hash:e.hash,path:e.path,query:e.query,title:e.title,viewport:e.viewport}}var De=new Map;function R(e){return e.kind!=="element"?b(e):Zt(e.locator,e.state)}function st(e,t){return new Map([...Su(e,t),[R(t.subject),t]])}function Ms(e,t){return new Map([...Su(e,t),[R(t.subject),t]])}function Se(e,t){return new Map([...e,...t])}function Os(e){return e.kind==="element"}function gt(e){return e.kind==="path"||e.kind==="query"||e.kind==="hash"}function X(e,t){let r=e.get(R(t));return r==null||r.expect.expect!=="is"?void 0:r.expect.value}function tr(e){let t=Wr(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 Is(e){return[...e].toSorted(([t],[r])=>t.localeCompare(r))}function Su(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(le(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=le(e.subject.locator);return zr(r,t)?!1:b(r)!==t?!0:e.subject.state!=="text"&&e.subject.state!=="value"}function zr(e,t){return e.by==="frame"?b(e.element)===t||zr(e.element,t):e.by!=="inside"?!1:b(e.scope)===t||b(e.target)===t||zr(e.scope,t)||zr(e.target,t)}function rg(e){return e.subject.kind==="element"&&e.subject.state==="visible"&&e.expect.expect==="is"&&e.expect.value===!0&&bu(e.subject.locator)}function bu(e){return e.by==="surface"&&e.overlay}function ng(e,t){if(t.kind!=="element")return e;let r=b(le(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"||bu(e.subject.locator))return!0;let r=le(e.subject.locator);return b(r)===t||zr(r,t)}function qe({declared:e,entry:t,scope:r}){let n=t.subject.kind==="element"?{...t.subject,locator:se(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,P,r),i=ag(n)&&typeof o=="number"?String(o):o;return{declared:e,expect:{expect:t.expect.expect,value:i},subject:n}}function It({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 er(e){return e.replaceAll(/\s+/gu," ").trim()}function sg(e,t){return typeof e=="string"&&typeof t=="string"&&er(e)===er(t)}function ag(e){return e.kind==="element"&&(e.state==="value"||e.state==="text")}import lg from"better-sqlite3";var wu={current:null};function eo(){let e=wu.current;if(e!=null)return e;let t={columns:new Map,db:new lg(":memory:"),loaded:null,statements:new Map};return wu.current=t,t}function Tt(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 He(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 to(e,t){t.entities.forEach((r,n)=>{let o=[...new Set([...r.values()].flatMap(i=>Object.keys(i)))];He(e,n,o)})}function Gr(e,t,r){He(e,t,Object.keys(r)),Object.values(r).forEach(n=>{ve(n)&&(He(e,n.selection.entity,[n.field]),Gr(e,n.selection.entity,n.selection.where))})}function ro(e,t){e.loaded!==t&&(e.columns.forEach((r,n)=>{Tt(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=Tt(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 Ts({entity:e,snapshot:t,where:r}){let n=eo();Gr(n,e,r),to(n,t),ro(n,t);let i=`SELECT r.__as AS __as FROM "${e}" r WHERE ${no(r,{depth:0,refExpr:ug,row:"r"})} ORDER BY r.rowid`;return Tt(n,i).all().flatMap(s=>{let a=s!=null&&typeof s=="object"?Reflect.get(s,"__as"):null;return typeof a=="string"?[a]:[]})}function Ru(e){let t=e.snapshot.entities.get(e.entity);return t==null||t.size===0?[]:Ts(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 no(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=no(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 $e(r)?mg({column:e,scope:t,want:r}):`${e} IS ${Lt(r,t.refExpr)}`}function Lt(e,t){let r=pg(e);if(r!=null)return t(r);if(e instanceof Date)return Nt(e.toISOString());if(e!=null&&typeof e=="object")throw new Error("sql-where: template values must be resolved before compiling");return Nt(e)}function Nt(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 oo(e,t){return e.map(r=>{let n=[...Object.entries(r.literals).map(([i,s])=>`x."${i}" IS ${Nt(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 io(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 so(e,t){return e.flatMap(r=>Ls(r,t))}function Ls(e,t){if(e.kind==="singleton")return[];if(e.kind==="not"){let r=Ls(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=>Ls(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 ${no(e.where,t)}) = ${String(e.value)}`:`EXISTS (SELECT 1 FROM "${e.entity}" c WHERE ${no(e.where,t)})`}function mg({column:e,scope:t,want:r}){let{refExpr:n}=t;if(r.kind==="not")return`${e} IS NOT ${Lt(r.value,n)}`;if(r.kind==="anyOf")return`(${r.values.map(i=>`${e} IS ${Lt(i,n)}`).join(" OR ")})`;if(r.kind==="compare"){let o={gt:">",gte:">=",lt:"<",lte:"<="}[r.op];return`${e} ${o} ${Lt(r.value,n)}`}return r.kind==="contains"?`instr(${e}, ${Lt(r.value,n)}) > 0`:`substr(${e}, 1, length(${Lt(r.value,n)})) IS ${Lt(r.value,n)}`}function St(e){return typeof e=="object"&&e!==null&&"kind"in e}function bt(e){return Object.fromEntries(Object.entries(e).filter(t=>!St(t[1])))}function Fs(e){return new Map(e.entities.filter(t=>t.identityKind==="surrogate").map(t=>[t.name,t.identity]))}function de(e){return(t,r)=>Ye(e,t.count.entity,t.count.where,r).length}function Ft(e,t,r){return t.reduce((n,o)=>Sg(n,o,r,e),e)}function vu(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&&(Os(c.subject)||gg(c.subject)))),a=[...n.values()].reduce((l,c)=>st(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=X(e.scalars,{kind:"path"}),o=X(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=Qt(t.assertion.props,P,{counts:de(e),env:o}),c=bg({entity:t.entity,identities:i,props:l},e);return xg(e,t.entity,Ot(c),c)}let s=Cu({entity:t.entity,env:o,key:t.key,snapshot:n});if(t.assertion.kind==="deleted")return Ns(e,t.entity,l=>new Map([...l].filter(([c])=>!s.has(c))));let a=Qt(bt(t.assertion.props),P,{counts:de(e),env:o});return Ns(e,t.entity,l=>new Map([...l].map(([c,u])=>s.has(c)?[c,{...u,...a}]:[c,u])))}var $s="#surrogate#";function xu(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,bt(e.assertion.props)]:[e.key]).every(n=>Object.values(n).every(o=>ve(o)||vg(o).every(i=>!N(i)||t.has(Ie(i.ref)))))}function vg(e){return $e(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 Ns(e,t,r){let n=r(e.entities.get(t)??new Map);return{...e,entities:new Map([...e.entities,[t,n]])}}function Ye(e,t,r,n){return Ru({entity:t,snapshot:e,where:Ds(r,{env:n,snapshot:e})})}function ku(e,t,r,n,o){let i=Cu({entity:t,env:n,key:r,snapshot:e});return Ns(e,t,s=>new Map([...s].map(([a,l])=>[a,i.has(a)?o(l):l])))}function Cu({entity:e,env:t,key:r,snapshot:n}){return new Set(Ts({entity:e,snapshot:n,where:Ds(r,{env:t,snapshot:n})}))}function Ds(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:Ds(e.selection.where,t)}}:$e(e)?e.kind==="anyOf"?{...e,values:e.values.map(r=>ao(r,t))}:e.kind==="contains"||e.kind==="startsWith"?{...e,value:String(ao(e.value,t))}:{...e,value:ao(e.value,t)}:ao(e,t)}function ao(e,t){return Ee(e,P,{counts:de(t.snapshot),env:t.env})}function Pu(e,t,r){return e.reduce((n,o)=>{let i=Cg(o,n.snapshot,r),s=Ft(n.snapshot,Mu(o,i),r);return{resolved:[...n.resolved,{executedBranches:i,step:o}],snapshot:s}},{resolved:[],snapshot:t}).resolved}function $t(e,t){if(e.kind==="count")return Au(e,t)===e.value;if(e.kind==="exists")return Au(e,t)>0;if(e.kind==="singleton"){let r=Eg(e,t);return r===Ou?!1:Eu(X(t.snapshot.scalars,{kind:"variable",name:e.singleton}))===Eu(r)}return e.kind==="not"?!$t(e.predicate,t):e.kind==="or"?e.predicates.some(r=>$t(r,t)):e.predicates.every(r=>$t(r,t))}function Cg(e,t,r){let n=Ft(t,Mu(e,[]),r);return e.expect.filter(o=>o.kind==="when").flatMap(o=>{let i=o.branches.find(s=>s.condition==null||$t(s.condition,{env:r.env,snapshot:n}));return i==null?[]:[i.name]})}function Mu(e,t){return zn({executedBranches:t,expect:e.expect}).flatMap(r=>r.predicate.kind==="state"&&!r.negated?[r.predicate]:[])}function Eu(e){return e==null?"\u2205":JSON.stringify(e)}var Ou=Symbol("unresolved-condition-ref");function Au(e,t){try{return Ye(t.snapshot,e.entity,e.where,t.env).length}catch(r){if(r instanceof ye)return 0;throw r}}function Eg(e,t){try{return Ee(e.assertion.value,P,{counts:de(t.snapshot),env:t.env})}catch(r){if(r instanceof ye)return Ou;throw r}}function Iu(e){return[...e.world.flatMap(t=>Ag(t)),...e.steps.flatMap(t=>_s(t)),...Object.values(e.singletons).flatMap(t=>G(t)),...e.absent.flatMap(t=>Object.values(t.where).flatMap(r=>G(r))),...e.actor.kind==="user"?[e.actor.alias]:[]]}function Ag(e){return Object.values(e.set).flatMap(t=>G(t))}function _s(e){return[...Pg(e.action),...e.expect.flatMap(t=>at(t))]}function at(e){switch(e.kind){case"visible":case"unobstructed":case"disabled":case"enabled":case"focused":case"checked":case"expanded":case"pressed":return me(e.locator);case"value":case"text":{let t=nt(e.value)?e.value.value:e.value;return[...me(e.locator),...G(t)]}case"singleton":return G(e.assertion.value);case"browser":return G(e.value);case"state":return[...e.assertion.kind==="deleted"?[]:Object.values(bt(e.assertion.props)).flatMap(t=>G(t)),...Object.values(e.key).flatMap(t=>Dt(t))];case"not":return at(e.predicate);case"when":return e.branches.flatMap(t=>[...t.condition==null?[]:at(t.condition),...t.consequence.flatMap(r=>at(r))]);case"and":case"or":return e.predicates.flatMap(t=>at(t));case"count":case"exists":return Object.values(e.where).flatMap(t=>Dt(t));case"actor":return e.target.kind==="anonymous"?[]:[e.target.ref.ref]}}function Dt(e){return ve(e)?Object.values(e.selection.where).flatMap(t=>Dt(t)):$e(e)?(e.kind==="anyOf"?e.values:[e.value]).flatMap(r=>G(r)):G(e)}function Tu(e){return!e.includes(".")}function rr(e){let t=e.indexOf(".");return t===-1?e:e.slice(0,t)}function Pg(e){return e.kind==="goto"?G(e.url):e.kind==="actor"?[e.ref.ref]:e.kind==="fill"||e.kind==="select"?[...me(e.locator),...G(e.value)]:e.kind==="press"?e.locator==null?[]:me(e.locator):e.kind==="drag"?[...me(e.source),...me(e.target)]:me(e.locator)}var Lu=2e4;function $u(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=Og({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}`),Mg(e,u),u},null);if(n==null)return{};let o=Ig(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 Mg(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>Lu)throw new Error(`sql-staged: pattern too weakly constrained \u2014 ${String(n)} partial assignments exceed the ${String(Lu)} cap`)}function Og({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 ${Nt(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}" = ${Nu(t,d,u.targetField)}`]}),a=t.entities.slice(0,e).flatMap((u,d)=>u.relations.flatMap(p=>p.targetAlias===n.alias?[`${Nu(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 Nu(e,t,r){let n=e.entities[t]?.entity??"";return`(SELECT b."${r}" FROM "${n}" b WHERE b.__as = prev."a${String(t)}")`}function Fu(e,t,r){let n=e.entities[t]?.entity??"";return`(SELECT r."${r}" FROM "${n}" r WHERE r.__as = s."a${String(t)}")`}function Ig(e){let t=new Map(e.entities.map((i,s)=>[i.alias,s])),r=i=>{let s=Mt(i),a=s==null?void 0:t.get(s.alias);if(s==null||a==null)throw new Error(`sql-staged: unresolved ref "${i}"`);return Fu(e,a,s.field)},n=(i,s)=>{let a=t.get(i);return a==null?null:Fu(e,a,s)},o=i=>e.entities.flatMap((s,a)=>s.entity===i?[`s."a${String(a)}"`]:[]);return[...oo(e.absences,n),...io(e.exclusives,o),...so(e.conditions,{depth:0,refExpr:r,row:"c"})]}var Du=new WeakMap,Tg=60;function Bu(e,t){let r=eo(),n=Vu(t);if(Wu(e.actor,n))return null;if(Lg(r,e),to(r,t),ro(r,t),e.entities.length>Tg){let s=$u(r,e);return s==null?null:_u({pattern:e,picked:s,snapshot:t})}let o=Du.get(e)??Ng(e);Du.set(e,o);let i=o.includes(":actor")?Tt(r,o).get({actor:n}):Tt(r,o).get();return i==null||typeof i!="object"?null:_u({pattern:e,picked:i,snapshot:t})}function ju(e,t){let r=Vu(t);return Wu(e.actor,r)?{got:r}:null}function Vu(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 Wu(e,t){return e.kind==="user"?t==null:e.kind==="anonymous"?t!=null:!1}function Lg(e,t){t.entities.forEach(r=>{He(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&&He(e,o.entity,[n.targetField])})}),t.absences.forEach(r=>{He(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&&He(e,o.entity,[n.targetField])})}),t.conditions.forEach(r=>{js(e,r),Bs({condition:r,pattern:t,store:e})}),t.exclusives.forEach(r=>{He(e,r,[])})}function Bs({condition:e,pattern:t,store:r}){if(e.kind!=="singleton"){if(e.kind==="not"){Bs({condition:e.predicate,pattern:t,store:r});return}if(e.kind==="and"||e.kind==="or"){e.predicates.forEach(n=>{Bs({condition:n,pattern:t,store:r})});return}Object.values(e.where).flatMap(n=>Dt(n)).forEach(n=>{let o=Mt(n);if(o==null)return;let i=t.entities.find(s=>s.alias===o.alias);i!=null&&He(r,i.entity,[o.field])})}}function js(e,t){if(t.kind!=="singleton"){if(t.kind==="not"){js(e,t.predicate);return}if(t.kind==="and"||t.kind==="or"){t.predicates.forEach(r=>{js(e,r)});return}Gr(e,t.entity,t.where)}}function _u({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 Ng(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=[...Fg(e,t),...e.entities.flatMap((l,c)=>$g({alias:`t${String(c)}`,aliases:t,constraint:l})),...Dg(e,t),...oo(e.absences,o),...so(e.conditions,{depth:0,refExpr:_g(t),row:"c"}),...io(e.exclusives,i)],a=s.length===0?"":` WHERE ${s.join(" AND ")}`;return`SELECT ${r}${n}${a} LIMIT 1`}function Fg(e,t){if(e.actor.kind!=="user")return[];let r=t.get(e.actor.alias);return r==null?[]:[`${r}.__as = :actor`]}function $g({alias:e,aliases:t,constraint:r}){let n=Object.entries(r.literals).map(([i,s])=>`${e}."${i}" IS ${Nt(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 Dg(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 _g(e){return t=>{let r=Mt(t),n=r==null?void 0:e.get(r.alias);if(r==null||n==null)throw new Error(`sql-match: unresolved ref "${t}" among aliases [${[...e.keys()].join(", ")}]`);return`${n}."${r.field}"`}}function Ae(e,t){let r=Kr(e,t);if(r==null)return null;let n=Vg(e.scalars,t,Ku(r));return n==null?null:e.conditions.every(i=>$t(i,{env:n,snapshot:t}))?n:null}function Kr(e,t){return Bu(e,t)}function lo(e,t){let r=Kr(e,t);if(r==null)return Bg(e,t);let n=jg(e.scalars,t,Ku(r));if(n.unmet!=null)return n.unmet;let o=e.conditions.find(i=>!$t(i,{env:n.env,snapshot:t}));return o==null?null:{condition:o,kind:"condition"}}function Bg(e,t){let r=ju(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 Kr(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 Kr(s,t)==null});return{alias:null,entity:o?.entity??null,kind:"entities",mustBeAbsent:o!=null}}function Uu(e,t,r){let n=zu(e.subject,r);if(n==null)return null;let o=Gu(t,n);return e.expect.expect==="absent"?o===void 0?r:null:e.expect.expect==="not"?zg({clause:e.expect.value,env:r,got:o,snapshot:t,subject:n}):Wg({clause:e.expect.value,env:r,got:o,snapshot:t,subject:n})}function jg(e,t,r){return[...e.values()].reduce((n,o)=>{if(n.unmet!=null)return n;let i=Uu(o,t,n.env);if(i!=null)return{env:i,unmet:null};let s=zu(o.subject,n.env),a=s==null?void 0:Gu(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 Vg(e,t,r){return[...e.values()].reduce((n,o)=>n==null?null:Uu(o,t,n),r)}function Wg({clause:e,env:t,got:r,snapshot:n,subject:o}){if(Ug(o,e,t))return r===void 0?null:new Map([...t,[Ie(Gg(e)),r]]);if(!Vr(e,P,t))return null;let i=Ee(e,P,{counts:de(n),env:t});return It({got:r,subject:o,want:{expect:"is",value:i}})?t:null}function Ug(e,t,r){return e.kind==="element"&&(e.state==="value"||e.state==="text")&&N(t)&&!Vr(t,P,r)}function zg({clause:e,env:t,got:r,snapshot:n,subject:o}){if(!Vr(e,P,t))return null;let i=Ee(e,P,{counts:de(n),env:t});return It({got:r,subject:o,want:{expect:"not",value:i}})?t:null}function Gg(e){if(!N(e))throw new Error("expected a ref clause");return e.ref}function zu(e,t){return e.kind!=="element"?e:Kg(e.locator,t)?{...e,locator:se(e.locator,ge(t))}:null}function Kg(e,t){return Uc(e).every(r=>Vr(r,P,t))}function Gu(e,t){let r=e.scalars.get(R(t));return r==null||r.expect.expect!=="is"?void 0:r.expect.value}function Ku(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"?[[Ie(`${t}.${n[0]}`),o]]:[]})))}function Pe(e,t){return[...new Map(e.map(r=>[t(r),r])).values()]}function co(e){return e.flatMap(t=>t.kind==="and"?co(t.predicates):[t])}function nr(e){return co(e).filter(t=>!At(t))}function uo(e){return e.action.kind==="goto"?!0:Vs(e.expect).some(t=>t.kind==="browser"&&t.name==="url"&&t.value!==null)}function _t(e){return e.action.kind==="goto"?!0:Vs(e.expect).some(t=>t.kind==="browser"&&t.name==="url"&&t.value!==null&&(t.part===void 0||t.part.kind==="path"))}function Vs(e){return e.flatMap(t=>t.kind==="and"?Vs(t.predicates):[t])}function Ze(e,t){return t.reduce((r,n)=>{let o=[...Qg(n),...Hr(n),...eS(n)],i=qg(n,r,o)?Xg(r):r;return o.reduce((s,a)=>Ms(s,a),i)},e)}function ce(e){return e.kind==="not"?Hg(e.predicate):e.kind==="singleton"?{expect:{expect:"is",value:e.assertion.value},subject:{kind:"variable",name:e.singleton}}:Yg(e)}function qr(e){return gu(yu(e)).map(({clause:t,key:r})=>({expect:t===null?{expect:"absent"}:{expect:"is",value:t},subject:r}))}function qg(e,t,r){if(e.action.kind==="goto")return!0;if(!_t(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 Hg(e){return e.kind==="value"||e.kind==="text"?nt(e.value)?null:{expect:{expect:"not",value:e.value},subject:{kind:"element",locator:e.locator,state:e.kind}}:qu(e,!0)}function qu(e,t){if(e.kind==="value"||e.kind==="text")return nt(e.value)?null:{expect:{expect:"is",value:e.value},subject:{kind:"element",locator:e.locator,state:e.kind}};let r=Zg(e);return r==null?null:{expect:{expect:"is",value:r.value!==t},subject:{kind:"element",locator:r.locator,state:r.state}}}function Yg(e){return e.kind==="browser"?{expect:e.value===null?{expect:"absent"}:{expect:"is",value:e.value},subject:Qn(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"}}:qu(e,!1)}function Hr(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 Zg(e){return Jg(e)?e.kind==="disabled"?{locator:e.locator,state:"enabled",value:!1}:{locator:e.locator,state:e.kind,value:!0}:null}function Jg(e){return e.kind==="visible"||e.kind==="disabled"||e.kind==="enabled"||e.kind==="focused"||e.kind==="checked"||e.kind==="expanded"||e.kind==="pressed"}function Xg(e){return new Map([...e].filter(([,t])=>t.subject.kind==="variable"||t.subject.kind==="viewport"))}function Qg(e){return e.action.kind==="goto"?qr(e.action.url):[]}function eS(e){return nr(e.expect).flatMap(t=>{let r=ce(t);return r==null?[]:[r]})}function Ws(e){return e.includes("async")?"async":e.includes("slow")?"slow":"fast"}var Yr={async:12e4,fast:5e3,slow:3e4},po={async:{backoffMs:[500,1e3,2e3,5e3],timeoutMs:Yr.async},fast:{backoffMs:[100,250,500,1e3],timeoutMs:Yr.fast},slow:{backoffMs:[250,500,1e3,2e3],timeoutMs:Yr.slow}};function Hu(e,t){return e.backoffMs[Math.min(t,e.backoffMs.length-1)]??0}function Je(e){return`${e.test}#${String(e.index)}`}function Zr(e){let t=Z(e).flatMap(r=>Jr(e,r.test));return Pe(t,r=>`${r.test}:${b(r.steps)}`)}function Jr(e,t){let r=Ju(t),n=Zu(r,t.singletons,t.actor,t.viewport),o=kS(t,xS(e)),i=nS(e,t),s=Fs(e);return iS(n,CS(t.steps),r).reduce((l,{chunk:c,requiredState:u},d)=>({offset:l.offset+c.length,transitions:[...l.transitions,wS({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 tS(e){return[R({kind:"viewport"}),{expect:{expect:"is",value:e},subject:{kind:"viewport"}}]}var rS=R({kind:"viewport"});function Yu(e){let t=e.scalars.get(rS);return t==null||t.expect.expect!=="is"||typeof t.expect.value!="string"?null:t.expect.value}function Zu(e,t,r,n){return{absences:yS(e),actor:r,conditions:[],entities:bS(e),exclusives:e.exclusives,scalars:new Map([...Object.entries(t).filter(([,o])=>!N(o)&&!Ge(o)).map(o=>{let[i,s]=o;return[R({kind:"variable",name:i}),{expect:{expect:"is",value:s},subject:{kind:"variable",name:i}}]}),tS(n)])}}function nS(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 fo(e,t,r){return Object.values(e).flatMap(n=>N(n)?or(n.ref,r):[]).find(n=>n.entity===t)?.aliasPath}function Xr(e,t){return t.reduce((r,n)=>oS(n)??r,e)}function oS(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"?Vc:{alias:t.target.ref.ref,kind:"user"}}function iS(e,t,r){return t.reduce((n,o)=>({requiredState:sS(n.requiredState,o,r),withRequiredState:[...n.withRequiredState,{chunk:o,requiredState:mS(n.requiredState,o)}]}),{requiredState:e,withRequiredState:[]}).withRequiredState}function sS(e,t,r){let n=t.flatMap(o=>o.expect.filter(i=>i.kind==="state")).reduce((o,i)=>aS(o,i,r),e);return{...n,actor:Xr(n.actor,t),scalars:Ze(n.scalars,t)}}function aS(e,t,r){return t.assertion.kind==="deleted"?lS(e,t,r):t.assertion.kind==="created"?dS(e,t.entity,t.assertion.as,t.assertion.props,r):fS(e,t,r)}function lS(e,t,r){let n=fo(t.key,t.entity,r.namespace),o=e.entities.find(a=>a.alias===n),i=Qr(cS(t.key),r),s=o==null?{entity:t.entity,params:{},...i}:{entity:o.entity,params:{},...uS(o,i)};return{...e,absences:[...e.absences,s],entities:e.entities.filter(a=>a.alias!==n)}}function cS(e){return Object.fromEntries(Object.entries(e).flatMap(t=>{let r=t[1];return ve(r)||$e(r)?[]:[[t[0],r]]}))}function uS(e,t){return{literals:{...e.literals,...t.literals},relations:[...e.relations.filter(r=>!t.relations.some(n=>n.field===r.field)),...t.relations]}}function dS(e,t,r,n,o){let i=Qr(n,o);return{...e,absences:e.absences.filter(s=>s.entity!==t||!pS(i,s)),entities:[...e.entities,{alias:r,entity:t,...i}]}}function pS(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 fS(e,t,r){if(t.assertion.kind!=="updated")return e;let n=fo(t.key,t.entity,r.namespace);if(n==null)return e;let o=Qr(bt(t.assertion.props),r),i=Object.entries(t.assertion.props).filter(([,a])=>St(a)).map(([a])=>a),s=a=>a.alias===n?hS(a,o,i):a;return{...e,entities:e.entities.map(a=>s(a))}}function hS(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 mS(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 ho(e,t){let r=Ju(t);return{namespace:r.namespace,requiredState:Zu(r,t.singletons,t.actor,t.viewport)}}function Us(e,t){return[...new Set(e)].flatMap(r=>or(r,t))}function Ju(e){return{absences:e.absent,exclusives:e.exclusive,namespace:new Map(e.world.map(t=>[t.as,t.entity])),setups:e.world}}function yS(e){return e.absences.map(t=>({entity:t.entity,...Qr(t.where,e),params:gS(t.where,e)}))}function Qr(e,t){let r=Object.entries(e),n=Object.fromEntries(r.flatMap(([i,s])=>N(s)||Ge(s)?[]:[[i,s]])),o=r.flatMap(i=>{let s=i[1];if(!N(s))return[];let a=or(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 gS(e,t){return Object.fromEntries(Object.entries(e).flatMap(r=>{let n=r[1];return!N(n)||or(n.ref,t.namespace).at(0)!=null?[]:[[r[0],n.ref]]}))}function SS(e,t){return e.map(r=>({alias:r.as,entity:r.entity,...Qr(r.set,t)}))}function bS(e){return SS(e.setups,e)}function or(e,t){let r=Mt(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 wS(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=>_s(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:Ws(e.chunk.flatMap(s=>[...RS(s),...vS(s)])),whenSteps:e.whenChunk}}function RS(e){return e.expect.flatMap(t=>t.kind==="state"&&t.wait!=null?[t.wait]:[])}function vS(e){return uo(e)?["slow"]:[]}function xS(e){return new Map(e.valueSpaces.map(t=>[t.name,t]))}function kS(e,t){return new Map(Object.entries(e.params).map(([r,n])=>[r,t.get(n.valueSpace)]))}function CS(e){return e.map(t=>[t])}function Xu(e,t){let r=it({conditions:e.when,...ES(e,t)});return e.expect.map(n=>({consequence:n,localConsequence:!1,origin:{kind:"declared",name:e.name},refs:new Set,when:r}))}function ES(e,t){if(!e.when.some(i=>zs(i).some(s=>s.startsWith(`${Gn}.`))))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:Gn,kind:"user"},entities:[{alias:Gn,entity:o.name,literals:{},relations:[]}]}}function zs(e){return e.kind==="not"?zs(e.predicate):e.kind==="and"||e.kind==="or"?e.predicates.flatMap(t=>zs(t)):e.kind==="singleton"?G(e.assertion.value):Object.values(e.where).flatMap(t=>Dt(t))}function Xe(e){return e.surfaces.filter(t=>t.by==="surface"&&t.overlay)}function mo(e,t){return{...e,scalars:yo(e.scalars,t)}}function yo(e,t){return td(e,t,r=>({expect:{expect:"is",value:!1},subject:{kind:"element",locator:r,state:"visible"}}))}function ed(e,t){let r=td(e.scalars,t,n=>({declared:!1,expect:{expect:"is",value:!1},subject:{kind:"element",locator:se(n,ge(new Map)),state:"visible"}}));return{...e,scalars:r}}function td(e,t,r){let n=t.filter(o=>!e.has(Qu(o))).map(o=>[Qu(o),r(o)]);return n.length===0?e:new Map([...e,...n])}function Qu(e){return R({kind:"element",locator:e,state:"visible"})}var rd=new WeakMap;function lt(e){let t=rd.get(e);if(t!=null)return t;let r=AS("sha256").update(b({consequence:e.consequence,when:xe(e.when)})).digest("base64");return rd.set(e,r),r}function So(e){let t=e.facts.flatMap(i=>Xu(i,e)),r=new Set(Xe(e).map(i=>b(le(i)))),n=Z(e).map(i=>Ks(e,i)),o=Pe(n.flatMap(i=>i.steps.flatMap(s=>s.facts)),lt).filter(i=>!PS(i.consequence,r));return[...t,...o]}function Gs(e,t){return e.filter(r=>!TS(r)||LS(r)===t)}function bo(e){return e.kind==="not"?bo(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=le(e.locator);return t.has(b(r))?!0:r.by==="inside"&&t.has(b(le(r.scope)))}function wo(e,t){if(e.facts.length===0)return t;let r=en(e,t);return r.size===0?t:{...t,scalars:Se(r,t.scalars)}}function en(e,t){let r=ed(t,e.overlays),n=e.facts.flatMap(s=>{let a=Ae(s.when,r);if(a==null)return[];let l=MS(s.consequence,a,r);return l==null?[]:[{entry:l,factKey:lt(s),key:R(l.subject)}]}),o=n.filter(s=>!IS({m:s,matched:n,overrides:e.overrides})),i=OS(o);return o.reduce((s,a)=>i.has(a.key)?s:st(s,a.entry),De)}function MS(e,t,r){let n=ce(e);if(n==null)return null;try{return qe({declared:!0,entry:n,scope:{counts:de(r),env:t}})}catch{return null}}function OS(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 IS({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 TS(e){return e.origin?.kind==="test"&&e.localConsequence}function LS(e){let{origin:t}=e;if(!(t==null||t.kind!=="test"))return t.test}var nd=new WeakMap;function Ks(e,t){let r=nd.get(t);if(r!=null)return r;let n=NS(e,t);return nd.set(t,n),n}function NS(e,{test:t,workflow:r}){let n=ho(e,t),o=Xe(e),i=FS(r.steps),s=t.steps.reduce((a,l)=>{let c=DS(a.requiredState,l,n,o),u=KS({actor:t.actor,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:mo(n.requiredState,o),steps:[]});return{initial:mo(n.requiredState,o),steps:s.steps}}function FS(e){return e.flatMap(r=>r.expect).flatMap(r=>go(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 go(e){return e.kind==="not"?go(e.predicate):e.kind==="and"||e.kind==="or"?e.predicates.flatMap(t=>go(t)):e.kind!=="when"?[]:e.branches.flatMap((t,r)=>{let n=$S(e.branches,r);return t.consequence.flatMap(o=>[{condition:n,consequence:o},...go(o)])})}function $S(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 DS(e,t,r,n){let{entities:o}=_S(e,t,r),i=Ze(e.scalars,[t]),s=Xr(e.actor,[t]);return mo({...e,actor:s,entities:o,scalars:i},n)}function _S(e,t,r){return t.expect.reduce((n,o)=>o.kind==="state"?BS(n,o,r):n,e)}function BS(e,t,r){if(t.assertion.kind==="created"){let i=jS(t.assertion.as,t.entity,t.assertion.props,r);return{...e,entities:[...e.entities,i]}}let n=fo(t.key,t.entity,r.namespace);if(n==null)return e;if(t.assertion.kind==="deleted")return US(e,n);let o=bt(t.assertion.props);return{...e,entities:e.entities.map(i=>i.alias===n?sd(i,o,r):i)}}function jS(e,t,r,n){return sd({alias:e,entity:t,literals:{},relations:[]},r,n)}function sd(e,t,r){return Object.entries(t).reduce((n,[o,i])=>{if(Ge(i))return n;if(N(i)){let s=VS(i.ref,o,r.namespace);return{...n,literals:WS(n.literals,o),relations:s==null?n.relations:[...od(n.relations,o),s]}}return{...n,literals:{...n.literals,[o]:i},relations:od(n.relations,o)}},e)}function VS(e,t,r){let[n]=or(e,r);return n==null?void 0:{entity:n.entity,field:t,targetAlias:n.aliasPath,targetField:n.field}}function WS(e,t){return Object.fromEntries(Object.entries(e).filter(([r])=>r!==t))}function od(e,t){return e.filter(r=>r.field!==t)}function US(e,t){let r=e.entities.find(o=>o.alias===t),n=zS(e,t);return r==null?n:{...n,absences:[...n.absences,{entity:r.entity,literals:r.literals,params:{},relations:r.relations}]}}function zS(e,t){return{...e,entities:e.entities.filter(r=>r.alias!==t)}}var GS=16;function KS(e){return nr(e.step.expect).filter(t=>bo(t)).flatMap(t=>qS(t,e))}function qS(e,t){let r=ce(e);if(r==null)return[];if(at(e).some(a=>t.paramNames.has(a)))return[];let n=R(r.subject),o=HS(e,t);if(o!=null&&o.r==="truth"&&!o.value)return[];let i={...t.post,conditions:o==null||o.r==="truth"?t.post.conditions:[...t.post.conditions,o.condition],scalars:new Map([...t.post.scalars].filter(([a])=>a!==n))},s=YS(i,t.pre,t.paramNames);return s==null||s.entities.length>GS?[]:xe(s)===xe(t.pre)?[]:[{consequence:e,localConsequence:Us(at(e),t.namespace).length>0,origin:t.origin,refs:new Set(Us([...JS(s),...at(e)],t.namespace).map(a=>a.aliasPath)),when:s}]}function HS(e,t){let r=t.branchConditions.get(b(e));if(r==null)return;let n={actorAlias:t.actor.kind==="user"?t.actor.alias:null,aliases:new Set(t.post.entities.map(o=>o.alias)),params:new Map};return qc(n,r)}function YS(e,t,r){let n=[...e.scalars.values()].map(o=>ZS(o,t,r));return n.some(o=>o==null)?null:{...e,scalars:new Map(n.flatMap(o=>o==null?[]:[[R(o.subject),o]]))}}function ZS(e,t,r){if(!id(e,r))return e;if(e.subject.kind!=="element"||e.expect.expect==="absent"||me(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"||id(n,r)?null:{expect:{expect:"not",value:n.expect.value},subject:e.subject}}function id(e,t){let r=e.expect.expect==="absent"?[]:G(e.expect.value);return[...e.subject.kind==="element"?me(e.subject.locator):[],...r].some(o=>t.has(o))}function JS(e){return[...e.scalars.values()].flatMap(t=>gt(t.subject)&&t.expect.expect!=="absent"?G(t.expect.value):[])}function ad(e,t,r){let n=o=>e(o,...t);return r===void 0?n:Object.assign(n,{lazy:r,lazyArgs:t})}function ld(e,t,r){let n=e.length-t.length;if(n===0)return e(...t);if(n===1)return ad(e,t,r);throw Error("Wrong number of arguments")}function tn(...e){return ld(XS,e)}var XS=(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 ud(e){return`\xA4param:${e}`}function dd(e,t){return`\xA4${e}.${t}`}var pd=new WeakMap;function qs(e){let t=pd.get(e);if(t!==void 0)return t;let r=QS(e);return pd.set(e,r),r}function QS(e){let t=lb(e);return t==null?null:{absenceKeys:new Set(e.absences.map(r=>b(r))),conditionKeys:new Set(e.conditions.map(r=>b(r))),pinned:nb(e),snapshot:t,specific:e}}var fd=new WeakMap,hd=new WeakMap;function Hs(e,t){if(t==null)return null;let r=hd.get(e)??new Map;hd.set(e,r);let n=xe(t.specific),o=r.get(n);if(o!==void 0)return o;let i=eb(e,t);return r.set(n,i),i}function Ys(e,t){return Hs(e,qs(t))}function eb(e,t){let{absenceKeys:r,conditionKeys:n,pinned:o,snapshot:i,specific:s}=t,a=tb(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])=>rb({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=it({absences:l,actor:e.actor,entities:e.entities,exclusives:e.exclusives,scalars:u});return Ae(d,i)!=null}function tb(e){let t=fd.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 fd.set(e,r),r}function rb({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&&ib(e.expect)?"skip":r.expect.expect!=="is"?ob({entry:e,host:r,identical:i}):e.expect.expect==="absent"?"false":sb({entry:e,generalEntityOf:t,key:n,pinned:o,want:e.expect,wantOfHost:r.expect})}function nb(e){let t=new Map(e.entities.map(i=>[i.alias,i.entity])),n=[...[...e.scalars.values()].flatMap(i=>[...i.expect.expect==="absent"?[]:G(i.expect.value),...i.subject.kind==="element"?me(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 ob({entry:e,host:t,identical:r}){return r||t.expect.expect==="absent"&&e.expect.expect==="not"?"defer":"false"}function ib(e){return e.expect==="absent"?!0:G(e.value).every(t=>!t.includes("."))}function sb({entry:e,generalEntityOf:t,key:r,pinned:n,want:o,wantOfHost:i}){if(md(o.value)||md(i.value))return"defer";if(o.expect==="not")return G(o.value).length===0&&G(i.value).length===0?[r,e]:"defer";let s=new Set(G(o.value).filter(a=>a.includes(".")).map(a=>ab({generalEntityOf:t,pinned:n,ref:a})));return s.has("false")?"false":s.has("defer")?"defer":[r,{expect:Sd(o),subject:wd(e.subject)}]}function ab({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 md(e){return e!==null&&typeof e=="object"&&"template"in e&&e.template.some(t=>typeof t!="string"&&"count"in t)}var yd=new WeakMap;function lb(e){let t=yd.get(e);if(t!==void 0)return t;let r=cb(e);return yd.set(e,r),r}function cb(e){let t=ub(e),r=Ae(it({absences:e.absences,conditions:e.conditions,entities:e.entities,exclusives:e.exclusives}),t);if(r==null)return null;let n=pb(e,r,t);return n==null?null:{...t,scalars:db(n,e)}}function ub(e){let t=new Map(e.entities.map(s=>[s.alias,s])),r=[...e.scalars.values()].flatMap(s=>[...s.expect.expect==="absent"?[]:G(s.expect.value),...s.subject.kind==="element"?me(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,gd(t,a,l)])),...s.literals,...Object.fromEntries(s.relations.map(a=>[a.field,gd(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:De}}function gd(e,t,r){let o=e.get(t)?.literals[r];return o!==void 0?o:dd(t,r)}function db(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 pb(e,t,r){let n=[...e.scalars.values()].filter(o=>o.expect.expect==="is").map(o=>{try{return qe({declared:!0,entry:{expect:Sd(o.expect),subject:wd(o.subject)},scope:{counts:de(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 Sd(e){return e.expect==="absent"?e:{...e,value:fb(e.value)}}function fb(e){return zc(e,bd)}function bd(e){return Tu(e.ref)?ud(e.ref):e}function wd(e){return e.kind!=="element"?e:{...e,locator:hb(e.locator)}}function hb(e){return Wc(e,mb)}function mb(e){return Gc(e,bd)}var Rd=new Map;function Ro({context:e,facts:t}){let r=tn(t.filter(i=>ce(i.consequence)!=null),i=>yb(i));return Object.values(r).flatMap(i=>i.flatMap(s=>i.filter(a=>a!==s).map(a=>({general:s,specific:a})))).reduce((i,{general:s,specific:a})=>{if(!(Ys(s.when,a.when)!==!1&&yt({context:e,general:s.when,specific:a.when}))||Ys(a.when,s.when)!==!1&&yt({context:e,general:a.when,specific:s.when}))return i;let u=lt(s),d=i.get(u)??new Set;return new Map([...i,[u,new Set([...d,lt(a)])]])},Rd)}function vd(e){let t=ce(e.consequence);if(t==null)return null;try{let r=qe({declared:!0,entry:t,scope:ge(new Map)});return R(r.subject)}catch{return null}}function yb(e){let t=ce(e.consequence);if(t==null)throw new Error("fact consequence has no pattern entry");return R(t.subject)}function vo(e){return Pe(Z(e).flatMap(t=>gb(e,t.test)),ir)}function ir(e){return b({holds:xe(e.holds),reference:e.reference,when:xe(e.when)})}function xo(e,t){return Ae(e.when,t)==null?!1:Ae(e.holds,t)==null}function gb(e,t){let r=ho(e,t);return r.requiredState.entities.flatMap(n=>n.relations.flatMap(o=>Sb(e,n,o,r.namespace)?Rb(n,o,r.namespace):[]))}function Sb(e,t,r,n){let o=n.get(r.targetAlias);return o!=null&&!bb(e,t.entity,r.field)&&wb(e,o,r.targetField)}function bb(e,t,r){return e.entities.find(n=>n.name===t)?.props[r]?.optional===!0}function wb(e,t,r){return e.entities.find(n=>n.name===t)?.identity.includes(r)===!0}function Rb(e,t,r){let n=r.get(t.targetAlias);if(n==null)return[];let o=xd(e.alias,e.entity),i=xd(t.targetAlias,n);return[{holds:it({entities:[{...o,relations:[t]},i]}),reference:{field:t.field,source:e.entity,target:n,targetField:t.targetField},when:it({entities:[o]})}]}function xd(e,t){return{alias:e,entity:t,literals:{},relations:[]}}function kd(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 ko=kd(e=>{let t=Xt(e),r=So(e);return{dataRules:vo(e),facts:r,overrides:Ro({context:t,facts:r})}});function Cd(e,t){let{context:r,pool:n,timelines:o}=xb(e,t),i=vb(r),s=n.map(l=>Yu(l.fact.when)),a=[...o.values()].map(l=>{let c=l.locked.test.viewport,u=n.filter((d,p)=>s[p]==null||s[p]===c);try{return kb({entry:l,pool:u,resolve:i})}catch(d){let p=d instanceof Error?d.message:String(d);throw new Error(`fact report for ${l.locked.ref}: ${p}`)}});return{pool:n,reports:a}}function Ed(e,t){return{...Ad(e.consequence),declared:e.origin?.kind==="test",key:lt(e),label:qn(e.consequence),labelTokens:Zc(e.consequence),origins:t}}function vb(e){return(t,r)=>yt({context:e,general:t,specific:r})}function xb(e,t){let r=Z(e),n=new Map(r.map(s=>[s.ref,{locked:s,timeline:Ks(e,s)}])),o=Pb(n),i=Mb({facts:t,originSites:o});return{context:Xt(e),pool:i,timelines:n}}function kb(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=Eb({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 Cb(e,t){return e.map(r=>({candidate:r,holds:Hs(r.fact.when,t)}))}function Eb({candidates:e,resolve:t,timeline:r}){let o=[r.initial,...r.steps.map(i=>i.post)].reduce((i,s,a)=>{let l=e.filter(p=>!i.has(p)),u=Cb(l,qs(s)).filter(p=>p.holds===!0||p.holds==null&&t(p.candidate.fact.when,s)).map(p=>p.candidate),d=a===0?0:a-1;return new Map([...i,...u.map(p=>[p,d])])},new Map);return r.steps.length===0?[]:[...o].map(([i,s])=>({borrowed:i.borrowed,stepIndex:s}))}function Ab(e,t){return{stepIndex:t,testRef:e.ref,testSlug:e.test.slug,workflowIntent:e.workflow.intent,workflowSlug:e.test.workflow}}function Pb(e){let t=[...e.values()].flatMap(r=>r.timeline.steps.flatMap((n,o)=>n.facts.map(i=>[lt(i),Ab(r.locked,o)])));return new Map(Object.entries(tn(t,([r])=>r)).map(([r,n])=>[r,n.map(([,o])=>o)]))}function Mb({facts:e,originSites:t}){return e.filter(r=>!(r.origin?.kind==="test"&&r.localConsequence)).map(r=>{let n=lt(r),i=r.origin?.kind==="test"?t.get(n)??[]:[];return{borrowed:Ed(r,i),consequenceKey:b(r.consequence),fact:r,originWorkflows:new Set(i.map(s=>s.workflowSlug))}}).filter(r=>r.borrowed.origins.length>0)}function Ad(e){if(e.kind==="not"){let t=Ad(e.predicate);return{...t,negated:!t.negated}}return"locator"in e?{checkKind:e.kind,negated:!1,subject:Un(se(e.locator,ge(new Map)))}:{checkKind:void 0,negated:!1,subject:void 0}}function Pd(e){e.forEach(c=>{Ob(c)});let t=Pe(e,xe),r=Pe(t.flatMap(c=>[...c.scalars.values()]),b),n=Pe(t.flatMap(c=>c.entities),b),o=Pe(t.flatMap(c=>c.absences),b),i=Co(r,b),s=Co(n,b),a=Co(o,b),l=Co(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=>Eo(a,b(u))),actor:c.actor,conditions:[...c.conditions],entities:c.entities.map(u=>Eo(s,b(u))),exclusives:[...c.exclusives],scalars:[...c.scalars.values()].map(u=>Eo(i,b(u)))})),scalarTable:r.map(c=>({expect:c.expect,subject:c.subject})),indexOf:c=>Eo(l,xe(c))}}function Md(e){return e.patternTable.map(t=>({absences:t.absences.map(r=>Bt(e.absenceTable,r)),actor:t.actor,conditions:t.conditions,entities:t.entities.map(r=>Bt(e.constraintTable,r)),exclusives:t.exclusives,scalars:new Map(t.scalars.map(r=>{let n=Bt(e.scalarTable,r);return[R(n.subject),n]}))}))}function Bt(e,t){let r=e[t];if(r==null)throw new Error("compiled checks table index out of range \u2014 recompile");return r}function Ob(e){let t=new Set(e.entities.map(n=>n.alias)),r=e.conditions.flatMap(n=>Tc(n)).map(n=>Lc(n)).filter(n=>!t.has(n));if(r.length>0)throw new Error(`pattern condition references [${[...new Set(r)].join(", ")}] outside its own entities \u2014 conditions must be grounded before stamping`)}function Co(e,t){return new Map(e.map((r,n)=>[t(r),n]))}function Eo(e,t){let r=e.get(t);if(r==null)throw new Error("compiled checks pattern missing from table");return r}function Id(e){let t=ko(e),{pool:r,reports:n}=Cd(e,t.facts),o=Pd([...t.facts.flatMap(a=>Nb(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:Td(i,a.fact),origins:a.borrowed.origins.map(l=>({...l}))})),factReports:n.map(a=>Db(a,s)),facts:t.facts.map(a=>Fb(a,o)),overrides:$b(t.overrides),patternTable:o.patternTable,scalarTable:o.scalarTable}}var Od=new WeakMap;function sr(e){let t=Od.get(e);if(t!=null)return t;let r=Ib(e),n=Md(r),o={dataRules:r.dataRules.map(i=>({holds:Bt(n,i.holds),reference:i.reference,when:Bt(n,i.when)})),facts:r.facts.map(i=>Tb(i,n)),overrides:Lb(r.overrides)};return Od.set(e,o),o}function Ib(e){return e.checks}function Td(e,t){let r=e.get(t);if(r==null)throw new Error("compiled checks item missing from index");return r}function Tb(e,t){return{consequence:e.consequence,localConsequence:e.localConsequence,origin:e.origin,refs:new Set(e.refs),when:Bt(t,e.when)}}function Lb(e){return new Map(Object.entries(e).map(([t,r])=>[t,new Set(r)]))}function Nb(e){return[e.when]}function Fb(e,t){return{consequence:e.consequence,localConsequence:e.localConsequence,origin:e.origin,refs:[...e.refs],when:t.indexOf(e.when)}}function $b(e){return Object.fromEntries([...e].map(([t,r])=>[t,[...r].toSorted((n,o)=>n.localeCompare(o))]).toSorted(([t],[r])=>t.localeCompare(r)))}function Db(e,t){return{steps:e.steps.map(r=>({borrowed:r.borrowed.map(n=>Td(t,n)),stepIndex:r.stepIndex})),testRef:e.testRef,testSlug:e.testSlug,workflowSlug:e.workflowSlug}}var M=Mc(Fd(),1),Te={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))},Vb={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 ne(e){return`${M.default.red(M.default.bold("\u2717"))} ${Vb[e](M.default.bold(e))}`}var Wb=M.default.red("\u2717"),aN=M.default.green("\u2713"),Ub=M.default.dim("\u203A"),zb=8;function $d(e,t,r){let n=r==null?"":` ${Te.dim(r)}`;return` ${Te.dim(e.padStart(zb))} ${t}${n}`}function Dd(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)":Gb(t.value)}function Gb(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 Oo(e){let t=[...e.entities.map(r=>Mo(r)),...e.absences.map(r=>`no ${Mo(r)}`),...[...e.scalars.values()].filter(r=>r.subject.kind!=="path").filter(r=>!Bd(r)).map(r=>Io(r))];return t.length===0?"always":t.join(" \u2227 ")}function Io(e){let t=Kb(e.subject);return e.expect.expect==="absent"?`${t} absent`:e.subject.kind==="element"&&qb(e.expect.value)?e.expect.value?t:`not ${t}`:`${t} ${e.expect.expect==="not"?"\u2260":"="} ${Qe(e.expect.value)}`}function oe(e){return e.by==="role"?e.name==null?e.role:`${e.role} ${Qe(e.name)}`:e.by==="inside"?`${oe(e.scope)} \u25B8 ${oe(e.target)}`:e.by==="surface"?oe(e.container):e.by==="frame"?`frame ${oe(e.element)}`:Qe(e.value)}function Qe(e){return e===null?"\u2205":typeof e=="string"?`"${e}"`:typeof e!="object"?String(e):"ref"in e?`{${e.ref}}`:Js(e)}function Js(e){return e.template.map(t=>typeof t=="string"?t:":id").join("")}function _d(e,t){let r=new Set(t.entities.map(i=>Mo(i))),n=new Set(t.scalars.keys()),o=[...e.entities.map(i=>Mo(i)).filter(i=>!r.has(i)),...[...e.scalars].filter(([i])=>!n.has(i)).map(([,i])=>i).filter(i=>i.subject.kind!=="path"&&!Bd(i)).map(i=>Io(i))];return o.length===0?"nothing beyond the shared state":o.join(" \u2227 ")}function Bd(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 Kb(e){return e.kind==="variable"?e.name:e.kind==="element"?`${e.state} ${oe(e.locator)}`:e.kind==="query"?`url query "${e.key}"`:e.kind==="title"||e.kind==="viewport"?e.kind:`url ${e.kind}`}function qb(e){return typeof e=="boolean"}function Mo(e){let t=Object.entries(e.literals).map(([r,n])=>`${r}=${Qe(n)}`);return t.length===0?e.entity:`${e.entity}(${t.join(", ")})`}function pe(e){return e.by==="testId"?`testId=${e.value}`:e.by==="inside"?`${pe(e.scope)} \u25B8 ${pe(e.target)}`:e.by==="surface"?pe(e.container):e.by==="frame"?`frame ${pe(e.element)}`:e.name==null?e.role:`${e.role} "${e.name}"`}function rn(e){return e.kind==="variable"?`global variable "${e.name}"`:e.kind==="element"?`${e.state} ${pe(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 To(e){return e.url!=null?`${e.kind} ${e.url}`:e.locator!=null?`${e.kind} ${pe(e.locator)}`:e.kind}function ar(e){let{field:t,source:r,target:n,targetField:o}=e.reference;return`${r}.${t} \u2192 ${n}.${o}`}function Le(e){return e==null?"\u2205":JSON.stringify(e)}function Lo(e){if(e.kind==="entities")return Hb(e);if(e.kind==="condition")return"a required condition did not hold";let t=e.want==null?"absent":Qe(e.want),r=e.got===void 0?"absent":Qe(e.got);return`${Yb(e.subject)} needed ${t} but was ${r}`}function Hb(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 Yb(e){return e.kind==="element"?`${e.state} ${oe(e.locator)}`:e.kind==="variable"?`"${e.name}"`:e.kind==="query"?`url query "${e.key}"`:e.kind==="actor"?"signed-in actor":`url ${e.kind}`}var Zb={"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 Xs(e){return Zb[e]}function jd({debugDir:e,runId:t}){let r=`${e}/${t}`;return $d("behavior",Te.path(`${r}/behavior.jsonl`),void 0)}function nn(e){return e.kind==="drag"?`drag ${oe(e.source)} to ${oe(e.target)}`:"locator"in e&&e.locator!=null?`${e.kind} ${oe(e.locator)}`:"url"in e?`${e.kind} ${Jb(e.url)}`:e.kind}function Jb(e){return typeof e=="string"?e:"ref"in e?`{${e.ref}}`:Js(e)}function ct(e){return e.kind==="not"?`not ${ct(e.predicate)}`:e.kind==="and"?e.predicates.map(t=>ct(t)).join(" \u2227 "):e.kind==="when"?e.branches.map(t=>t.name).join(" | "):Xb(e)}function Xb(e){return"locator"in e?Qb(e):e.kind==="browser"?`${e.name}=${Qe(e.value)}`:e.kind==="singleton"?`${e.singleton}=${Qe(e.assertion.value)}`:e.kind==="count"?qn(e):e.kind==="actor"?e.target.kind==="anonymous"?"actor is signed out":`actor is ${e.target.ref.ref}`:""}function Qb(e){let t=oe(e.locator);if(e.kind==="value"||e.kind==="text"){let r=nt(e.value)?e.value.value:e.value;return`${e.kind} ${t}=${Qe(r)}`}return`${e.kind} ${t}`}function Vd({contradiction:e,evidencePath:t}){let r=ew(e);return t==null?r:`${r} Evidence: ${Te.path(t)}`}function No(e){return`${rw(e)}.`}function Fo(e){return hw(nw(e))}function ew(e){switch(e.kind){case"check":{let t=` After "${e.step.intent}".`;return`${tw(e.record.body)} ${No(e.record.body)}${t}`}case"stepError":return`${ne("driver")} Browser failed at "${e.step.intent}" \u2014 ${_r(e.record.error)}. Environment, not app or test.`;case"finding":return dw(e.finding)}}function tw(e){switch(e.family){case"element":case"content":case"scalar":return ne("assertion");case"state":case"frame":return ne("state");case"action":return ne("action");case"dataRule":return ne("data rule")}}function rw(e){switch(e.family){case"element":return`Expected ${e.subject} ${e.negated?"not ":""}${e.checkKind} \u2014 ${ow(e)}`;case"content":return`Expected ${e.subject} ${e.checkKind} ${uw(e.match)} ${JSON.stringify(e.expected)}${e.negated?" to not hold":""} \u2014 ${iw(e)}`;case"scalar":return`Expected ${e.subject} to ${e.negated?"not ":""}be ${Wd(e.expected)} \u2014 ${sw(e)}`;case"state":return`Expected ${e.subject} ${e.assertion} \u2014 ${aw(e)}`;case"frame":return`Unexpected change \u2014 ${lw(e)}`;case"action":return`Could not ${e.actionKind} ${e.subject} \u2014 ${cw(e)}`;case"dataRule":return`Data rule ${e.rule} broke \u2014 a referenced row went missing`}}function nw(e){switch(e.kind){case"check":return Bc(e.record.body)??No(e.record.body);case"stepError":return`driver failed at "${e.step.intent}": ${_r(e.record.error)}`;case"finding":return pw(e.finding)}}function Qs(e){switch(e.kind){case"wrongValue":return`${e.entity}.${e.field} [${e.key}] showed ${Te.actual(e.observed)}, expected ${Te.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 ${Te.actual(e.observed)})`:`${e.entity}.${e.field} [${e.key}] never changed from ${Te.actual(e.observed)}`;case"wrongCount":return`found ${String(e.observed)} ${e.entity} rows, expected ${String(e.expected)}`}}function lr(e){let{outcome:t}=e;return t.kind==="passed"?null:t.reason}function ow(e){let t=lr(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 iw(e){let t=lr(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 sw(e){let t=lr(e);return t==null?"held":`it showed ${Wd(t.observed)}`}function Wd(e){return e??"absent"}function aw(e){let t=lr(e);return t==null?"held":Qs(t)}function lw(e){let t=lr(e);return t==null?"none was seen":jc(t)}function cw(e){let t=lr(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 uw(e){switch(e){case"exact":return"to equal";case"contains":return"to contain";case"startsWith":return"to start with"}}function dw(e){switch(e.kind){case"impossible-action":return`${ne("impossible action")} "${e.step.intent}" ran ${To(e.step.action)} from a state the test calls impossible.`;case"unrunnable":return`${ne("model drift")} "${e.intent}" couldn't run \u2014 ${Ud(e)}.`;case"lift-visibility":return`${ne("reachability")} ${oe(e.locator)} is visible by step ${String(e.visibleIndex+1)} but declared at step ${String(e.declaredIndex+1)}.`}}function Ud(e){return e.unmet==null?Xs(e.reason):Lo(e.unmet)}function pw(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 ${Ud(e)}. Fix the model and recompile \u2014 do not dismiss`;case"lift-visibility":return`visible(${oe(e.locator)}) declared at step ${String(e.declaredIndex+1)} but already visible at step ${String(e.visibleIndex+1)}`}}var fw=new RegExp(`${String.fromCodePoint(27)}\\[[0-9;]*m`,"g");function hw(e){return e.replaceAll(fw,"").replaceAll(/\s+/g," ").trim()}function cr(e){let t=X(e.scalars,{kind:"path"});return typeof t=="string"?t:null}function $o(e,t){switch(e.kind){case"step":return{checkId:$c(e.ref,t),kind:"step"};case"action":return{checkId:Nc(t),kind:"step"};case"frame":return{checkId:Fc(t),kind:"step"};case"fact":return{factId:e.factId,kind:"fact"};case"dataRule":return{kind:"dataRule",ruleId:e.ruleId}}}function zd(e){return e.body.outcome.kind==="failed"}function ea(e){return e.kind==="data-rule"?b({kind:e.kind,rule:ir(e.dataRule)}):b(e)}function Do({actual:e,canon:t,pre:r,predicted:n}){return[...[...new Set([...n.entities.keys(),...e.entities.keys()])].flatMap(s=>Sw({actual:e.entities.get(s),canon:t,entity:s,pre:r.entities.get(s),predicted:n.entities.get(s)})),...mw(r.scalars,n.scalars,e.scalars)]}function mw(e,t,r){let n=et(r,R({kind:"path"}))!==void 0;return[...[...t.entries()].flatMap(([i,s])=>{if(s.subject.kind==="actor")return[];let a=et(r,i),l=n&&gt(s.subject)&&s.expect.expect!=="absent",c=a===void 0&&l?null:a;if(!s.declared||c===void 0||It({got:c,subject:s.subject,want:s.expect}))return[];let u=et(e,i);return[{mismatch:{kind:"scalar-mismatch",subject:s.subject,sut:c,want:s.expect},pending:u!==void 0&&on(u,c)}]}),...yw(e,t,r),...gw(e,t,r)]}function et(e,t){let r=e.get(t);return r==null||r.expect.expect!=="is"?void 0:r.expect.value}function yw(e,t,r){let n=R({kind:"path"});if(et(r,n)===void 0)return[];let o=!on(et(e,n),et(r,n));return[...new Set([...e.keys(),...r.keys()])].flatMap(s=>{let a=(e.get(s)??r.get(s))?.subject;if(a==null||!gt(a)||t.has(s))return[];let c=o&&a.kind!=="path"?null:et(e,s)??null,u=et(r,s)??null;return on(c,u)?[]:[{mismatch:{kind:"scalar-mismatch",subject:a,sut:u,want:{expect:"is",value:c}},pending:!1}]})}function gw(e,t,r){let n=R({kind:"actor"}),o=t.get(n);if(o==null)return[];let i=et(r,n);if(It({got:i,subject:{kind:"actor"},want:o.expect}))return[];let s=et(e,n);return[{mismatch:{kind:"scalar-mismatch",subject:{kind:"actor"},sut:i??null,want:o.expect},pending:s!==void 0&&on(s,i)}]}function Sw({actual:e,canon:t,entity:r,pre:n,predicted:o}){return[...new Set([...o?.keys()??[],...e?.keys()??[]])].flatMap(s=>bw({actual:e?.get(s),canon:t,entity:r,key:s,predicted:o?.get(s),preHadKey:n?.has(s)??!1,preRow:n?.get(s)}))}function bw({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)=>on(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 on(e,t){return Gd(e)===Gd(t)}function Gd(e){return e==null?"\u2205":JSON.stringify(e)}function _o(e){let t=ww(e.entities),r=Rw(e.singletons);return n=>vw(n,t,r)}function ww(e){return new Map(e.flatMap(t=>Object.entries(t.props).map(([r,n])=>[Kd(t.name,r),n.consistency])))}function Kd(e,t){return`${e}.${t}`}function Rw(e){return new Map(e.map(t=>[t.name,t.consistency]))}function vw(e,t,r){return e.kind==="scalar-mismatch"?xw(e.subject,r):e.kind==="unexpected-row"||e.kind==="missing-row"?"strict":t.get(Kd(e.entity,e.field))??"strict"}function xw(e,t){return e.kind==="variable"?t.get(e.name)??"strict":"eventual"}function Bo(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 wt=class extends Error{name="AbortError";constructor(){super("aborted")}};function sn(e){return e instanceof Error&&e.name==="AbortError"}function be(e){if(e.aborted)throw new wt}function Rt(e,t){return t.aborted?Promise.reject(new wt):new Promise((r,n)=>{let o=()=>{clearTimeout(i),n(new wt)},i=setTimeout(()=>{t.removeEventListener("abort",o),r()},e);t.addEventListener("abort",o,{once:!0})})}function ta({check:e,ephemeral:t,failure:r,rrwebIds:n,waitedMs:o}){let{check:i,negated:s}=qd(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:kw(r)},subject:pe(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:Cw(r)},subject:pe(i.locator)};case"browser":return{...a,expected:i.value,family:"scalar",negated:s,outcome:r==null?{kind:"passed"}:{kind:"failed",reason:Ew(r)},subject:Ur(i.key),subjectKey:R(i.key),subjectKind:i.key.kind}}}function qd(e,t){return e.kind==="not"?qd(e.inner,!t):{check:e,negated:t}}function kw(e){return e.kind==="wrongContent"?{kind:"unclassified",message:Hd(e)}:e}function Hd(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 Cw(e){return e.kind==="wrongState"||e.kind==="covered"?{kind:"unclassified",message:Hd(e)}:e}function ra({observed:e,passed:t,planned:r,waitedMs:n}){return{ephemeral:!1,expected:na(r.entry.expect),family:"scalar",negated:r.entry.expect.expect==="not",outcome:t?{kind:"passed"}:{kind:"failed",reason:{kind:"wrongScalar",observed:e}},rrwebIds:[],subject:rn(r.entry.subject),subjectKey:R(r.entry.subject),subjectKind:r.entry.subject.kind,waitedMs:n}}function na(e){switch(e.expect){case"absent":return null;case"is":case"not":return Le(e.value)}}function Ew(e){return e.kind==="wrongContent"?{kind:"wrongScalar",observed:e.observed}:{kind:"wrongScalar",observed:null}}function oa({failure:e,planned:t,waitedMs:r}){return{assertion:Aw(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 jo(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:Le(e.snapshot),field:e.field,key:e.key,kind:"wrongValue",observed:Le(e.sut)};case"expected-change":return{direction:e.direction??null,entity:e.entity,field:e.field,from:Le(e.from),key:e.key,kind:"neverChanged",observed:Le(e.value)}}}function Aw(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 ia({dataRule:e,violated:t,waitedMs:r}){return{ephemeral:!1,family:"dataRule",outcome:t?{kind:"failed",reason:{kind:"violated"}}:{kind:"passed"},rrwebIds:[],rule:ar(e),waitedMs:r}}function Vo({failure:e,waitedMs:t}){return{ephemeral:!1,family:"frame",outcome:e==null?{kind:"passed"}:{kind:"failed",reason:e},rrwebIds:[],waitedMs:t}}function sa({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:Mw(e),value:Ow(e),waitedMs:n}}function aa(e){if(e.kind!=="scalar-mismatch")return jo(e);let t=e.subject;return t.kind==="element"?Pw(e,t):{expected:na(e.want),kind:"wrongScalar",observed:e.sut==null?null:Le(e.sut),subject:rn(t),subjectKey:R(t)}}function Pw(e,t){let r=pe(t.locator),n=R(t);return t.state==="text"||t.state==="value"?{checkKind:t.state,expected:na(e.want),kind:"wrongElementContent",observed:e.sut==null?null:Le(e.sut),subject:r,subjectKey:n}:{checkKind:t.state,kind:"wrongElementState",observed:e.sut===!0,subject:r,subjectKey:n}}function Mw(e){return e.locator!=null?pe(e.locator):e.url!=null?e.url:""}function Ow(e){return e.value!=null?typeof e.value=="object"?JSON.stringify(e.value):String(e.value):e.key!=null?e.key:null}function Yd(e){let t=Iw(e);return[...Fw(e,t),...$w(e,t),...Dw(e,t)]}function Iw(e){return e.mismatches.reduce((t,r)=>Tw(t,r.mismatch,e),{frame:[],scalar:new Map,state:new Map})}function Tw(e,t,r){if(t.kind==="scalar-mismatch")return Lw(e,t,r);let n=t,o=r.stateChecks.find(i=>!e.state.has(i)&&Nw(i,n));return o==null?{...e,frame:[...e.frame,t]}:{...e,state:new Map([...e.state,[o,n]])}}function Lw(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 Nw(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 Fw(e,t){return e.scalarChecks.map(r=>{let n=t.scalar.get(r),o=n?.kind==="scalar-mismatch"&&n.sut!=null?Le(n.sut):null;return{atMs:e.atMs,body:ra({observed:o,passed:n==null,planned:r,waitedMs:e.waitedMs}),target:{kind:"step",ref:r.ref}}})}function $w(e,t){return e.stateChecks.map(r=>{let n=t.state.get(r),o=n==null?null:jo(n);return{atMs:e.atMs,body:oa({failure:r.verify==null?o:r.verify(e.post),planned:r,waitedMs:e.waitedMs}),target:{kind:"step",ref:r.ref}}})}function Dw(e,t){return t.frame.length===0?[{atMs:e.atMs,body:Vo({failure:null,waitedMs:e.waitedMs}),target:{kind:"frame"}}]:t.frame.map(r=>({atMs:e.atMs,body:Vo({failure:aa(r),waitedMs:e.waitedMs}),target:{kind:"frame"}}))}function Zd(e){return e().match(t=>({observed:t,ok:!0}),t=>({error:t,ok:!1}))}function _w(e,t,r){return r.reconcile==null?e:r.reconcile(e,t)}function Jd(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 Qd({canon:e,claimed:t,classify:r,observe:n,pre:o,predicted:i,signal:s,step:a}){let l=po[a.sync],c=Date.now()+l.timeoutMs,u=Se(o.scalars,i.scalars),d=new Map([...u].filter(([h,v])=>v.declared&&(v.subject.kind!=="element"||t.has(h)))),p=()=>n(d),y=await Zd(p);if(!y.ok)return{mismatches:[],snapshot:i,stepError:{atMs:Date.now(),error:y.error}};let f=Xd({canon:e,pre:o,predicted:i,step:a},y.observed),m=0;for(;Date.now()<c;){be(s);let h=Jd(f,a,r);if(h!=null)return h;await Rt(Hu(l,m),s),m+=1;let v=await Zd(p);if(!v.ok)return{mismatches:f.probed,snapshot:f.adopted,stepError:{atMs:Date.now(),error:v.error}};f=Xd({canon:e,pre:o,predicted:i,step:a},v.observed)}return Jd(f,a,r)??{mismatches:f.probed,snapshot:f.adopted,stepError:null}}function Xd({canon:e,pre:t,predicted:r,step:n},o){let i=n.verifyChanges==null?[]:n.verifyChanges(r,o),s=_w(r,o,n),a=i.map(l=>({mismatch:l,pending:!0}));return{adopted:s,probed:[...a,...Do({actual:o.snapshot,canon:e,pre:t,predicted:s})]}}function ur(e){if(e.kind==="not")return ur(e.inner);if(e.kind!=="browser")return e.locator}function Bw(e){return e.stepError!=null||e.findings.length>0||e.checks.some(t=>zd(t))}var jw=()=>[],Vw=()=>De;async function Wo({canon:e,classify:t,dataRuleChecks:r,derive:n,initialSnapshot:o,observe:i,onStep:s,steps:a,stopAfterStep:l},c){return ep({canon:e,classify:t,dataRuleChecks:r??jw,derive:n??Vw,failed:!1,findings:[],index:0,observe:i,onStep:s,signal:c,snapshot:o,steps:a,stopAfterStep:l})}async function ep(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 ca(e.onStep,{checks:[la({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:cr(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(Ww({error:l,params:e,rrwebIds:a,startMs:s,step:i})))}function Ww({error:e,params:t,rrwebIds:r,startMs:n,step:o}){let{checks:i,stepError:s}=Uw({error:e,rrwebIds:r,startMs:n,step:o});return ca(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:cr(t.snapshot)}),{failed:!0,finalModel:t.snapshot,findings:t.findings}}function Uw({error:e,rrwebIds:t,startMs:r,step:n}){return e.kind==="action-failed"?{checks:[la({failure:e.failure,rrwebIds:t,startMs:r,step:n})],stepError:null}:{checks:[],stepError:{atMs:Date.now(),error:e}}}function la({failure:e,rrwebIds:t,startMs:r,step:n}){let o=Date.now();return{atMs:o,body:sa({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 Qd({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 Hw({pendingChecks:d,signal:e.signal,windowStartMs:r}),y=la({failure:null,rrwebIds:t,startMs:r,step:n}),f=Yd({atMs:u,mismatches:l.mismatches,pendingElementKeys:Gw(n.pendingChecks),post:l.snapshot,scalarChecks:n.scalarChecks,stateChecks:n.stateChecks,waitedMs:Math.max(0,u-r)}),m=[y,...p.checks,...f],h=qw([...l.stepError==null?[]:[l.stepError],...p.stepErrors]),v={checks:m,endMs:Date.now(),executedBranches:n.executedBranches,findings:[],index:e.index,post:l.snapshot,pre:o,source:n.source,startMs:r,step:n.step,stepError:h,url:cr(l.snapshot)};return ca(e.onStep,v),Bw(v)?{failed:!0,finalModel:c,findings:e.findings}:e.stopAfterStep!=null&&e.index+1>=e.stopAfterStep?{failed:!1,finalModel:c,findings:e.findings}:ep({...e,index:e.index+1,snapshot:c})}function Gw(e){return new Set(e.flatMap(t=>{if(!("check"in t.source))return[];let r=ur(t.source.check);return r==null?[]:Kw(t.source.check,r)}))}function Kw(e,t){let r=tp(e);return r==="browser"||r==="unobstructed"||r==="disabled"?[]:[Zt(t,r)]}function tp(e){return e.kind==="not"?tp(e.inner):e.kind}function qw(e){return e.at(0)??null}async function Hw({pendingChecks:e,signal:t,windowStartMs:r}){let n=[...new Map(e.map(i=>[ea(i.source),i])).values()],o=await Promise.all(n.map(async i=>{let s=await Qw({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"?[]:[Yw({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 Yw({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:ia({dataRule:r.source.dataRule,violated:t.kind==="failed",waitedMs:i}),target:{kind:"dataRule",ruleId:ir(r.source.dataRule)}}:{atMs:e,body:ta({check:r.source.check,ephemeral:r.ephemeral,failure:Zw(t),rrwebIds:n,waitedMs:i}),target:Jw(r.source)}}function Zw(e){return e.kind==="passed"?null:e.failure??{kind:"unclassified",message:"check failed without diagnosis"}}function Jw(e){switch(e.kind){case"step":return{kind:"step",ref:e.ref};case"fact":return{factId:ea(e),kind:"fact"};case"data-rule":return{kind:"dataRule",ruleId:ir(e.dataRule)}}}var Xw=250;async function Qw({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(Xw,po[e.budget].timeoutMs-n);return r.wait(o).match(async i=>i?{kind:"passed"}:eR(r.diagnose),i=>Promise.resolve(rp(i)))}function eR(e){return e().match(t=>({failure:t,kind:"failed"}),t=>rp(t))}function rp(e){if(e.kind==="aborted")throw new wt;return{error:e,kind:"error"}}function ca(e,t){e?.(t)}function ua(e){let t=e.predicates.filter(i=>cp(i)),r=t.filter(i=>i.assertion.kind==="created"),n=sp(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)=>sR(u,s,d,e),{env:e.env,snapshot:i}),l=n.reduce((u,d)=>iR(u,s,d,e.env),a.snapshot),c=o.reduce((u,d)=>tR(u,s,d),a.env);return uR(l,e.deferred,c)}}function ip(e,t,r){return new Map([...e,...Object.entries(r).map(([n,o])=>[Ce(P,`${t}.${n}`),o])])}function tR(e,t,r){let n=Ye(t.snapshot,r.entity,r.key,e).at(0);return n==null?e:ip(e,r.assertion.as,n)}function da(e){let t=sp(e.predicates.filter(r=>cp(r)));if(t.length!==0)return(r,n)=>t.flatMap(o=>rR(o,r,n,e.env))}function sp(e){return e.filter(t=>t.assertion.kind==="updated"&&ap(t.assertion.props).length>0)}function ap(e){return lp(e).map(([t])=>t)}function lp(e){return Object.entries(e).flatMap(([t,r])=>St(r)?[[t,r.direction]]:[])}function cp(e){return e.assertion.kind==="created"||e.assertion.kind==="updated"}function rR(e,t,r,n){let o=Ye(t,e.entity,e.key,n).at(0),i=Ye(r.snapshot,e.entity,e.key,n).at(0);if(o==null||i==null)return[];let s=Ot(nR(e.key,n));return lp(e.assertion.props).flatMap(([a,l])=>oR(o[a],i[a],l)?[]:[{direction:l,entity:e.entity,field:a,from:o[a],key:s,kind:"expected-change",value:i[a]}])}function nR(e,t){let r=Object.fromEntries(Object.entries(e).filter(n=>!ve(n[1])&&!$e(n[1])));return Qt(r,P,ge(t))}function oR(e,t,r){return r==null?np(e)!==np(t):r==="increased"?op(e,t):op(t,e)}function np(e){return e==null?"\u2205":JSON.stringify(e)}function op(e,t){return(typeof e=="number"&&typeof t=="number"||typeof e=="string"&&typeof t=="string")&&e<t}function iR(e,t,r,n){let o=ap(r.assertion.props),i=Ye(t.snapshot,r.entity,r.key,n).at(0);return i==null?e:ku(e,r.entity,r.key,n,s=>({...s,...Object.fromEntries(o.flatMap(a=>{let l=i[a];return l===void 0?[]:[[a,l]]}))}))}function sR(e,t,r,n){if(r.assertion.kind!=="created")return e;let o=Qt(r.assertion.props,P,ge(n.env)),i=e.snapshot.entities.get(r.entity);if(i==null)return e;let s=aR({identityFields:n.identities.get(r.entity)??[],props:o,set:i});if(s==null)return e;let a=lR(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:ip(e.env,r.assertion.as,c),snapshot:{...e.snapshot,entities:new Map(e.snapshot.entities).set(r.entity,u)}}}function aR({identityFields:e,props:t,set:r}){let n=Ot(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=>xu(s[a]))&&o.every(([a,l])=>Uo(s[a])===Uo(l)));return i==null?null:i[0]}function lR(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])=>Uo(s[a])===Uo(l)).length}));return cR(o,n.length)}function Uo(e){return e==null?"\u2205":JSON.stringify(e)}function cR(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 uR(e,t,r){let n=t.reduce((o,i)=>{let s=dR(i.value,r);return s==null||typeof s!="string"?o:st(o,{declared:!0,expect:{expect:"is",value:s},subject:i.key})},e.scalars);return{...e,scalars:n}}function dR(e,t){try{return Ke(e,P,ge(t))}catch{return}}function pa(e){return e.kind==="not"?pa(e.inner):e.kind==="browser"&&mu(e.key)}function fa(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:se(e.locator,t)};if(e.kind==="not"){let r=fa(e.predicate,t);return r==null?null:{inner:r,kind:"not"}}return e.kind==="value"||e.kind==="text"?pR(e,t):e.kind!=="browser"?null:{key:Qn(e.name,e.part),kind:"browser",value:e.value===null?null:Ke(e.value,P,t)}}function dr(e,t){let{executedBranches:r,step:n}=e,{env:o,identities:i}=t,s=zn({executedBranches:r,expect:n.expect}),a=s.flatMap(w=>w.predicate.kind==="state"&&!w.negated?[w.predicate]:[]),l=OR(a),c=t.snapshot==null?void 0:Ft(t.snapshot,a,t),u={counts:c==null?void 0:de(c),env:o},d={counts:t.snapshot==null?void 0:de(t.snapshot),env:o},{clears:p,deferred:y,sets:f}=kR({after:u,captures:l,leaves:s,step:n}),m=uo(n),h=IR(n.action,d),v=fR(n,s);return{action:h,assertedScalars:[...f.keys()],executedBranches:r,label:n.action.kind,pendingChecks:s.flatMap(w=>NR(w,u,m)),reconcile:ua({deferred:y,env:o,identities:i,predicates:a}),scalarChecks:s.flatMap(w=>mR(w,u)),stateChecks:s.flatMap(w=>yR(w,o)),urlChecks:s.flatMap(w=>LR(an(w),u)),verifyChanges:da({deferred:y,env:o,identities:i,predicates:a}),effect:w=>vu(Ft(w,a,t),{clears:p,forget:v,sets:f})}}function pR(e,t){let r=nt(e.value);return{kind:e.kind,locator:se(e.locator,t),match:r?e.value.kind:"exact",value:Ke(r?e.value.value:e.value,P,t)}}function fR(e,t){return e.action.kind==="goto"||e.action.kind==="actor"||hR(t)?"hard":_t(e)?"soft-path":"none"}function hR(e){return e.some(t=>t.predicate.kind==="actor")}function mR(e,t){let{predicate:r}=e;if(r.kind!=="singleton"&&r.kind!=="browser"&&r.kind!=="actor")return[];let n=ce(an(e));if(n==null)return[];try{return[{entry:qe({declared:!0,entry:n,scope:t}),negated:e.negated,ref:{branch:e.branch,ordinal:e.ordinal}}]}catch(o){if(o instanceof ye)return[];throw o}}function an(e){return e.negated?{kind:"not",predicate:e.predicate}:e.predicate}function yR(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:gR(r,t),verify:r.kind==="state"?void 0:wR(r,e.negated,t)}]}function gR(e,t){let r=e.kind==="state"?e.key:e.where,n=Object.entries(r).map(([o,i])=>`${o}=${SR(i,t)}`);return n.length===0?e.entity:`${e.entity} where ${n.join(", ")}`}function SR(e,t){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"?JSON.stringify(e):e==null?"null":N(e)?bR(e,t):"?"}function bR(e,t){try{return JSON.stringify(jr(e,P,t))}catch(r){if(r instanceof ye)return e.ref;throw r}}function wR(e,t,r){return n=>{let o=Ye(n,e.entity,e.where,r);return e.kind==="count"?RR(e,o.length):vR({entity:e.entity,negated:t,rows:o})}}function RR(e,t){return t===e.value?null:{entity:e.entity,expected:e.value,kind:"wrongCount",observed:t}}function vR({entity:e,negated:t,rows:r}){let n=r.at(0);return t?n==null?null:{entity:e,key:Ot(n),kind:"unexpectedRow"}:n==null?{entity:e,key:"",kind:"missingRow"}:null}function xR(e){return e.action.kind!=="actor"?null:{expect:{expect:"is",value:{ref:`${e.action.ref.ref}.id`}},subject:{kind:"actor"}}}function kR({after:e,captures:t,leaves:r,step:n}){let o=n.action.kind==="goto"?qr(n.action.url):[],i=xR(n),s=r.filter(c=>!At(an(c))).flatMap(c=>{let u=ce(an(c));return u==null?[]:[u]}),a=[...o,...s,...i==null?[]:[i]].map(c=>({declared:!0,entry:c}));return[...Hr(n).map(c=>({declared:!1,entry:c})),...a].reduce((c,{declared:u,entry:d})=>CR({acc:c,captures:t,declared:u,entry:d,scope:e}),{clears:[],deferred:[],sets:De})}function CR({acc:e,captures:t,declared:r,entry:n,scope:o}){if(ER(n,t))return n.expect.expect==="is"&&up(n.expect.value)?{...e,deferred:[...e.deferred,{key:MR(n.subject),value:n.expect.value}]}:e;let i=qe({declared:r,entry:n,scope:o});return i.expect.expect==="absent"&&!gt(i.subject)?{...e,clears:[...e.clears,R(i.subject)]}:{...e,sets:st(e.sets,i)}}function ER(e,t){return e.subject.kind==="element"||e.subject.kind==="variable"?!1:e.expect.expect==="is"&&up(e.expect.value)&&AR(e.expect.value,t)}function up(e){return typeof e=="string"||typeof e=="object"}function AR(e,t){return PR(e).some(r=>t.has(rr(r)))}function PR(e){return typeof e=="string"?[]:N(e)?[e.ref]:e.template.filter(t=>typeof t!="string").map(t=>t.ref)}function MR(e){if(e.kind==="element"||e.kind==="variable"||e.kind==="actor")throw new Error("expected a browser subject");return e}function OR(e){return new Set(e.flatMap(t=>t.assertion.kind==="created"||t.assertion.kind==="updated"?[t.assertion.as]:[]))}function IR(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:TR(e,t),target:e.kind==="drag"?se(e.target,t):void 0,url:e.kind==="goto"?Ke(e.url,P,t):void 0,value:"value"in e?du(e.value,t):void 0}}function TR(e,t){if(e.kind==="drag")return se(e.source,t);if(!(!("locator"in e)||e.locator==null))return se(e.locator,t)}function LR(e,t){if(e.kind!=="browser"&&e.kind!=="not")return[];try{let r=fa(e,t);return r!=null&&pa(r)?[r]:[]}catch(r){if(r instanceof ye)return[];throw r}}function NR(e,t,r){let n=an(e);if(e.predicate.kind==="browser"||e.predicate.kind==="singleton")return[];let o=fa(n,t);return o==null?[]:[{budget:FR(e.predicate,r),check:o,ephemeral:At(n),ref:{branch:e.branch,ordinal:e.ordinal}}]}function FR(e,t){return"wait"in e&&e.wait!=null?e.wait:t?"slow":"fast"}import{err as $R,errAsync as DR,ok as dp,okAsync as pp,Result as _R}from"neverthrow";function pr(e,t,r){let n=HR(e),o={env:new Map,generate:r.generate,generatedParams:new Set,indexed:n,overrides:new Map(Object.entries(r.params??{}).map(([s,a])=>[Ie(s),a]))};YR(t.params,P,o);let i=t.world.map(s=>ZR(s,P,o));return r.materialize(i).andThen(s=>ev(s,o.env,n).asyncAndThen(a=>BR({base:a,rows:s,signIn:r.signIn,test:t}).map(l=>jR({base:l,generatedParams:o.generatedParams,lockfile:e,test:t}))))}function zo(e,t){let r=new Map(t.map(n=>[n.name,n]));return n=>pp(GR(n,e,r).rows)}function Go(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 ma(e,t){let r=ln(t);return Object.fromEntries(Object.entries(e).filter(([n,o])=>r.includes(n)&&o!=null))}function ln(e){return Object.keys(e.props)}function BR({base:e,rows:t,signIn:r,test:n}){if(n.actor.kind!=="user"||r==null)return pp(e);let o=n.actor.alias,i=t.find(s=>s.as===o);return i==null?DR(xs(o)):r({entity:i.entity,row:i.row}).map(s=>({...e,auth:s}))}function jR({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,P,ge(e.env))])),s=Object.entries(n.singletons).filter(([,d])=>VR(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=WR(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,...UR(n)]))}}}function VR(e,t){return N(e)?t.has(Ce(P,e.ref)):Ge(e)?e.template.some(r=>typeof r!="string"&&"ref"in r&&t.has(Ce(P,r.ref))):!1}function WR(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 UR(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 _R.combine(e.map(n=>{let o=r.get(n.as);return o==null?$R(xs(n.as)):dp({as:n.as,entity:n.entity,generatedFields:n.generatedFields,row:o.row})}))}function GR(e,t,r){return e.reduce((n,o)=>{let i=KR(o.fields,n.env),s=tv({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 KR(e,t){return Object.fromEntries(Object.entries(e).map(([r,n])=>{if(N(n))return[r,qR(t,n.ref)];if(Ge(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 HR(e){return{models:new Map(e.entities.map(t=>[t.name,t])),valueSpaces:new Map(e.valueSpaces.map(t=>[t.name,t]))}}function YR(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:Ic(s),valueSpace:o.valueSpace});r.env.set(i,l)})}function ZR(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=JR(e.set,t,r.env),s=QR(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 JR(e,t,r){return Object.fromEntries(Object.entries(e).map(([n,o])=>[n,XR(o,t,r)]))}function XR(e,t,r){if(!N(e))return e;let n=Ce(t,e.ref);return r.get(n)??{ref:n}}function QR(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,fp({field:o,generate:n.generate,model:e,seedPrefix:r,spec:i,valueSpaces:n.indexed.valueSpaces})]))}function ev(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(Ie(a.as),u),d));let c=n.get(a.entity)??new Map;c.set(ha(a.row,l),ma(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:ha(a.row,l)}]}),i=e.flatMap(a=>{let l=r.models.get(a.entity);if(l==null)return[];let c=ha(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 dp({aliases:o,auth:void 0,env:t,generated:i,principals:s,snapshot:{entities:rv(n),scalars:De}})}function tv({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,fp({field:s,generate:e,model:t,seedPrefix:r,spec:a,valueSpaces:o})])),...n}}function fp({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 ha(e,t){return t.identity.map(r=>String(e[r])).join(":")}function rv(e){return new Map([...e].map(([t,r])=>[t,new Map(r)]))}function cn(e,t,r){let n=Ae(e.requiredState,t.snapshot);return n==null?null:new Map([...Object.entries(r).map(([o,i])=>[Ie(o),i]),...t.base,...n,...ov(t.snapshot)])}function un(e,t,r){let n={env:t,identities:e.identities,snapshot:r},o=Pu(e.whenSteps,r,n),i=o.at(-1)??{executedBranches:[],step:e.effectStep},s=dr(i,n),a=iv(e,n),l=o.reduce((c,u)=>{let d=dr(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:sv(s.effect,a),steps:l.steps}}function qo(e,t,r){return Ae(e.requiredState,r)==null?!1:Ko(t(r))!==Ko(r)||av(e)||nv(e)}function nv(e){return[...e.nav,...e.steps].every(t=>t.expect.every(r=>r.kind!=="state"))}function ov(e){let t=X(e.scalars,{kind:"actor"});return t==null?[]:[[Ie(Kc),t]]}var hp=new WeakMap;function Ko(e){let t=hp.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:Is(e.scalars).map(([n,o])=>[n,o.expect])});return hp.set(e,r),r}function iv(e,t){let r=e.nav.at(-1);if(r!=null)return dr({executedBranches:[],step:r},t).action.url}function sv(e,t){if(t==null)return e;let r=tr(t);return n=>{let o=e(n);return{...o,scalars:Se(o.scalars,r)}}}function av(e){return e.effectStep.expect.some(t=>t.kind==="state"&&t.assertion.kind==="updated"&&Object.values(t.assertion.props).some(r=>St(r)))}function fr(e,t,r){let n=cn(e,t,r);if(n==null)return null;let o=lv(e,n,t.snapshot);return o==null||!qo(e,o.effect,t.snapshot)?null:{next:{base:t.base,snapshot:o.effect(t.snapshot)},resolved:o}}function ya(e,t,r){let n=cn(e,t,r);if(n==null)return"required-state-unsatisfied";try{return un(e,n,t.snapshot),"no-effect"}catch(o){if(o instanceof ye)return"unresolvable";throw o}}function lv(e,t,r){try{return un(e,t,r)}catch(n){if(n instanceof ye)return null;throw n}}function Ho(e,t,r){return e.flatMap((n,o)=>{let i=r(n),s=fr(n,t,i);return s==null?[]:[{idx:o,label:Je(n),params:i,stepRun:s}]})}function ga(e,t){let r=[...t.entities].flatMap(([i,s])=>[...s].map(([a,l])=>cv({entity:i,key:a,pre:e,row:l}))),n=[...e.entities].flatMap(([i,s])=>[...s].flatMap(([a,l])=>uv({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:X(e.scalars,i.subject)!==i.expect.value,name:s,value:i.expect.value}]});return{rows:[...r,...n],singletons:o}}function cv({entity:e,key:t,pre:r,row:n}){let o=dv(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 uv({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 dv(e,t){return e?.get(t)}function hr(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(ur(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 mp({current:e,driver:t,index:r,next:n,state:o}){if(n==null||pv(n))return[];if(_t(e.transition.effectStep))return[];let i=fr(n.transition,o,n.params);if(i==null)return[];let s=hr(n.transition,i.resolved,t).flatMap(c=>c.pendingChecks.flatMap(u=>{let d=fv(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=X(l.snapshot.scalars,u)===!0,p=X(o.snapshot.scalars,u)===!1;return d&&p}).map(c=>({declaredIndex:r+1,kind:"lift-visibility",locator:c,visibleIndex:r}))}function pv(e){return e.transition.nav.length>0||e.transition.steps.some(t=>t.action.kind==="goto"||_t(t))}function fv(e){if(e.kind!=="data-rule")return e.check.kind==="visible"?e.check.locator:void 0}function Yo(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 mr(e){return e.filter(t=>t.kind!=="finding"||t.finding.kind!=="unrunnable")}async function ba(e,t){let{params:r,transition:n}=e.stepRun,o={base:e.state.base,snapshot:wo(e.facts,e.state.snapshot)},i=fr(n,o,r);if(i==null){let a=ya(n,o,r),l={intent:n.intent,kind:"unrunnable",reason:a,test:n.test,unmet:a==="required-state-unsatisfied"?lo(n.requiredState,o.snapshot)??void 0:void 0};return{label:Je(n),next:e.state,result:{failed:!0,finalModel:e.state.snapshot,findings:[l]}}}let s=await Wo({canon:e.canon,classify:e.classify,initialSnapshot:e.state.snapshot,observe:e.driver.observe,onStep:e.onStep,steps:hr(e.stepRun.transition,i.resolved,e.driver),stopAfterStep:e.stopAfterStep==null?void 0:e.stopAfterStep-e.stepBase,dataRuleChecks:(a,l)=>e.dataRules.flatMap(c=>gp(c,l)),derive:a=>en(e.facts,a)},t);return{label:Je(e.stepRun.transition),next:{base:e.state.base,snapshot:s.finalModel},result:s}}function gp(e,t){return xo(e,t)?[{budget:"fast",check:{kind:"decided",passed:!1},ephemeral:!1,source:{dataRule:e,kind:"data-rule"},targetIds:()=>Promise.resolve([])}]:[]}function Zo(e,t){return Sa({acc:{contradictions:[],failed:!1,findings:[],ran:[]},index:0,params:e,signal:t,state:e.initialState,stepBase:0})}async function Sa({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 ba({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:f=>{l.push(f.index);let m={checks:f.checks,endMs:f.endMs,executedBranches:f.executedBranches,findings:f.findings,index:i+f.index,kind:"step",source:f.source,startMs:f.startMs,state:ga(f.pre,f.post),step:f.step,stepError:f.stepError,url:f.url};c.push(...Yo(m)),r.onEvent(m)}},n);if(u==null)return Sa({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 hv({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(f=>({finding:f,kind:"finding"})),...d.map(f=>({finding:f,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:Sa({acc:y,index:t+1,params:r,signal:n,state:u.next,stepBase:i+l.length})}async function hv(e,t){let{index:r,outcome:n,params:o,stepBase:i,stepRun:s}=e,a=t.length>0;!a&&n.result.findings.length>0&&yp(o,s,e.state,i,n.result.findings);let l=o.sequence[r+1],c=a?await mp({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&&yp(o,l,n.next,i+t.length,c),c}function yp(e,t,r,n,o){let i=Date.now(),s=X(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:ga(r.snapshot,r.snapshot),step:null,stepError:null,url:typeof s=="string"?s:null})}function bp(e){let t=new Map;return e.forEach(r=>{mv(r).forEach(n=>{dn(n,t)})}),t}function Ra(e,t){let r=yv(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 mv(e){let t=[...e.when.scalars.values()].flatMap(n=>n.subject.kind==="element"?[n.subject.locator]:[]),r=wp(e.consequence);return r==null?t:[...t,r]}function wp(e){return e.kind==="not"?wp(e.predicate):"locator"in e?e.locator:void 0}function dn(e,t){if(e.by==="inside"){let r=Rp(wa(e.scope));t.set(r,[...t.get(r)??[],e]),dn(e.scope,t),dn(e.target,t);return}if(e.by==="surface"){dn(e.container,t);return}e.by==="frame"&&dn(e.element,t)}function Rp(e){return Zt(e,"visible")}function wa(e){return e.by==="frame"?e.element:e}function yv(e,t){let r=gv(e);if(r!=null)return(t.get(Rp(wa(r)))??[]).map(o=>Sp(o,!1));let n=Sv(e);return n==null?[]:[Sp(wa(n),!0)]}function gv(e){return e.kind!=="not"||e.predicate.kind!=="visible"?null:e.predicate.locator}function Sp(e,t){return{expect:{expect:"is",value:t},subject:{kind:"element",locator:e,state:"visible"}}}function Sv(e){return e.kind!=="visible"||e.locator.by!=="inside"?null:e.locator.scope}function pn(e){return e.origin==null||e.origin.kind==="declared"?[]:[{test:e.origin.test,when:e.when}]}function kp({context:e,facts:t}){let n=[...t.reduce((s,a)=>{let l=ce(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=>wv(a.consequence,c.consequence)).map(c=>[a,c]))),o=bp(t),i=n.map(([s,a])=>{let l=yt({context:e,general:s.when,specific:a.when}),c=yt({context:e,general:a.when,specific:s.when});return l!==c?null:l||tu({aligned:!0,context:e,patterns:[Ra(s,o),Ra(a,o)]})?vv(s,a):null});return xv(i.filter(s=>s!=null))}function bv(e,t){return Rv(e)?xp(e,t):e.expect.expect==="is"&&t.expect.expect==="is"?b(e.expect.value)!==b(t.expect.value):xp(e,t)}function wv(e,t){let r=ce(e),n=ce(t);return r==null||n==null||R(r.subject)!==R(n.subject)?!1:bv(r,n)}function Rv(e){return e.subject.kind==="element"&&e.subject.state==="text"}function vv(e,t){let r=pn(e),n=pn(t);return{a:e.consequence,aProducers:r,b:t.consequence,bProducers:n,tests:[...new Set([...vp(e),...vp(t)])],when:e.when}}function vp(e){return e.origin==null?[]:e.origin.kind==="declared"?[]:[e.origin.test]}function xv(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 xp(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 Cp(e,t){return e.flatMap(r=>{let n=kv(r),o=new Set(r.requiredState.absences.map(i=>i.entity));return t.flatMap(i=>Cv(r,i,n,o))})}function kv(e){return new Set(e.steps.flatMap(t=>t.expect.flatMap(r=>r.kind==="state"&&r.assertion.kind==="deleted"?[r.entity]:[])))}function Cv(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:Je(e)}]}function Ep(e){return Z(e).flatMap(t=>Ev(t.test))}function Ev(e){let t=new Map(e.world.map(n=>[n.as,n])),r=Mv(e.steps);return e.steps.flatMap((n,o)=>n.expect.filter(i=>Ov(i)).flatMap(i=>Av({createdAliases:r,predicate:i,setByAlias:t,stepIndex:o,test:e})))}function Av(e){let{createdAliases:t,predicate:r,setByAlias:n,stepIndex:o,test:i}=e,s=Pv(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 Pv(e){return Object.values(e.key).flatMap(t=>N(t)?[rr(t.ref)]:[]).at(0)}function Mv(e){return new Set(e.flatMap(t=>t.expect.flatMap(r=>r.kind==="state"&&r.assertion.kind==="created"?[r.assertion.as]:[])))}function Ov(e){return e.kind==="state"&&e.assertion.kind==="updated"}function Ap(e){return Z(e).flatMap(({test:t})=>Iv(t.steps,ee(t)))}function Iv(e,t){return e.reduce((r,n)=>{let o=Tv(n.action).filter(i=>!Lv(i,r.pre)).map(i=>({action:n.action,ephemeralOnly:r.ephemeralKeys.has(b(le(i))),target:i,test:t}));return{ephemeralKeys:new Set([...r.ephemeralKeys,...Nv(n)]),pre:Ze(r.pre,[n]),violations:[...r.violations,...o]}},{ephemeralKeys:new Set,pre:Pt,violations:[]}).violations}function Tv(e){return e.kind==="goto"||e.kind==="upload"?[]:e.kind==="drag"?[e.source,e.target]:"locator"in e&&e.locator!=null?[e.locator]:[]}function Lv(e,t){let r=b(le(e)),n=[...t.values()].filter(i=>i.subject.kind==="element"&&b(le(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 Nv(e){return co(e.expect).filter(t=>At(t)).flatMap(t=>Pp(t)).map(t=>b(le(t)))}function Pp(e){return e.kind==="not"?Pp(e.predicate):"locator"in e?[e.locator]:[]}function Mp(e){let t=Xe(e);return Z(e).flatMap(({test:r})=>[..._v(r.steps,ee(r),t),...Fv(r.steps,r.actor,ee(r))])}function Fv(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=$v(o).filter(l=>Dv(l.target,s)).map(l=>({predicate:l,stepIndex:i,test:r}));return{actor:Xr(n.actor,[o]),flagged:[...n.flagged,...a]}},{actor:t,flagged:[]}).flagged}function $v(e){return e.expect.filter(t=>t.kind==="actor")}function Dv(e,t){return e.kind==="anonymous"?t.kind==="anonymous":t.kind==="user"&&t.alias===e.ref.ref}function _v(e,t,r){let n=yo(Pt,r),o=new Set(n.keys());return e.reduce((i,s,a)=>{let l=Wv(s),c=Bv({acc:i,assertions:l,stepIndex:a,test:t}),u=yo(Ze(i.pattern,[s]),r);return{assertedKeys:new Set([...jv({acc:i,assertions:l,pattern:u,step:s}),...o]),pattern:u,redundant:[...i.redundant,...c]}},{assertedKeys:o,pattern:n,redundant:[]}).redundant}function Bv({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 jv({acc:e,assertions:t,pattern:r,step:n}){let o=new Set([...Vv(n),...Hr(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 Vv(e){return e.action.kind==="goto"?qr(e.action.url):[]}function Wv(e){return nr(e.expect).flatMap(t=>{if(t.kind==="actor")return[];let r=ce(t);return r==null?[]:[{entry:r,predicate:t}]})}var Uv=2;function Op(e){return Z(e).flatMap(({test:t})=>t.steps.reduce((n,o,i)=>{let s=zv(o,n.pre),a=s.length>=Uv?[...n.violations,{hidden:s,stepIndex:i,test:ee(t)}]:n.violations;return{pre:Ze(n.pre,[o]),violations:a}},{pre:Pt,violations:[]}).violations)}function zv(e,t){return e.expect.flatMap(r=>{let n=Gv(r);return n!=null&&!va(n)&&Kv(n,t)?[n]:[]})}function Gv(e){return e.kind!=="not"||e.predicate.kind!=="visible"?null:e.predicate.locator}function va(e){return e.by==="surface"?!0:e.by==="inside"?va(e.scope)||va(e.target):!1}function Kv(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 Tp(e){return Z(e).flatMap(({test:t})=>{let r=ee(t);return t.steps.reduce((n,o,i)=>qv(n,o,i,r),{found:[],open:new Set}).found})}function qv(e,t,r,n){let o=t.action.kind==="goto"?new Set:e.open,i=Ip(t,Hv),s=Ip(t,Yv),a=new Set([...o,...i].filter(c=>!s.has(c))),l=Zv(t).flatMap(c=>a.has(b(le(c.surface)))?[]:[{...c,stepIndex:r,test:n}]);return{found:[...e.found,...l],open:a}}function Ip(e,t){return new Set(e.expect.flatMap(r=>{let n=t(r);return n==null?[]:[b(le(n))]}))}function Hv(e){return e.kind!=="visible"?null:e.locator.by==="surface"?e.locator:null}function Yv(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=Lp(t.locator);return r==null?[]:[{content:t.locator,surface:r}]})}function Lp(e){return e.by!=="inside"?null:e.scope.by==="surface"?e.scope:Lp(e.scope)}function Fp(e){switch(e.kind){case"cascade-gap":{let{gap:t}=e;return`${ne("data rule")} ${t.transition} deletes ${t.target} but leaves ${t.source} rows pointing at it, breaking ${ar(t.dataRule)}. Cascade the delete or declare the cleanup.`}case"create-gap":return Jv(e.gap);case"unreachable-interaction":{let{violation:t}=e,r=oe(t.target);return t.ephemeralOnly?`${ne("reachability")} ${t.test}: ${nn(t.action)}, but ${r} was only declared inside ephemeral(...), which grants no reachability. Assert a durable visible(...) first.`:`${ne("reachability")} ${t.test}: ${nn(t.action)}, but no prior step declared ${r} reachable. Assert visible(...) on it first.`}case"redundant-assertion":{let{redundancy:t}=e;return`${ne("redundancy")} ${t.test}: step ${String(t.stepIndex+1)} restates "${ct(t.predicate)}" \u2014 already asserted and unchanged since. Delete it.`}case"missing-precondition":{let{missing:t}=e;return`${ne("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 Xv(e.conflict);case"unmodeled-surface":{let{surface:t}=e,r=t.hidden.map(n=>oe(n)).join(", ");return`${ne("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=oe(t.surface);return`${ne("surface")} ${t.test}: step ${String(t.stepIndex+1)} asserts ${oe(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 Jv(e){let t=e.missing.length===1?"field":"fields",r=e.missing.length===1?"it":"them";return`${ne("data rule")} ${e.transition} creates ${e.entity} without required ${t} ${e.missing.join(", ")}. Set ${r} or drop the requirement.`}function Xv(e){return[`${ne("fact")} Two facts contradict on overlapping states \u2014 "${ct(e.a)}" vs "${ct(e.b)}".`,` Shared state: ${Oo(e.when)}.`,Np(e.a,e.aProducers,e.when),Np(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 Np(e,t,r){let n=t.map(o=>` - ${o.test} adds ${_d(o.when,r)}`);return[` "${ct(e)}" declared by:`,...n].join(`
6
+ `)}var Qv=24301;function Jo(e,t){return e.reduce((r,n)=>nx(r,t[n.idx]?.paramSpaces),new Map)}function yr(e,t){return Object.fromEntries(Object.entries(e.paramSpaces).map(([r,n])=>[r,ex(n,n?.name==null?0:t.get(n.name)??0)]))}var $p=new WeakMap;function ex(e,t){if(e==null)return Dp(void 0,t);let r=$p.get(e)??new Map;$p.set(e,r);let n=r.get(t);if(n!=null)return n;let o=Dp(e,t);return r.set(t,o),o}function tx(e){return e==null?ix(10):e.kind==="enum"?ot.constantFrom(...e.values):e.kind==="number"?ot.integer({max:e.max,min:e.min}):e.kind==="boolean"?ot.boolean():e.kind==="datetime"?sx():rx(e)}function Dp(e,t){let[r]=ot.sample(tx(e),{numRuns:1,seed:Qv+t});if(r==null)throw new Error("arbitrary produced no sample");return r}function rx(e){let t=e.refine??e.pattern;return ot.stringMatching(new RegExp(`^(?:${t})$`,"u")).filter(r=>(e.minLength==null||r.length>=e.minLength)&&(e.maxLength==null||r.length<=e.maxLength))}function nx(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 ox="abcdefghijklmnopqrstuvwxyz0123456789".match(/./g)??[],ix=e=>ot.array(ot.constantFrom(...ox),{maxLength:e,minLength:1}).map(t=>t.join(""));function sx(){return ot.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 ax=new Map;function Xo(e){return yr(e,ax)}function xa(e){switch(e.kind){case"stepError":return"crash";case"check":return lx(e);case"finding":return e.finding.kind==="unrunnable"?"model-drift":"frame"}}function lx(e){switch(e.record.target.kind){case"dataRule":return"data-rule";case"fact":return"fact";case"step":case"action":case"frame":return"frame"}}function fn(e){let t=e.map(o=>({contradiction:o,line:Fo(o),part:dx(o)})).toSorted((o,i)=>b(o.part).localeCompare(b(i.part))),r=t.map(o=>o.part),n=t.at(0)?.contradiction;return{layer:hx(r),signature:b({parts:r.map(o=>b(o))}),sourceTest:n==null?void 0:cx(n),title:t.at(0)?.line}}function cx(e){switch(e.kind){case"check":case"stepError":return e.step.test;case"finding":return ux(e)}}function ux(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 _p={crash:0,"data-rule":1,fact:2,frame:3,"model-drift":4};function dx(e){let t=xa(e);switch(e.kind){case"check":{let{body:r}=e.record;return{family:r.family,kind:"check",layer:t,reason:px(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 fx(e,t)}}function px(e){return e.outcome.kind==="failed"?e.outcome.reason.kind:"passed"}function fx(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:pe(r.locator),visibleIndex:r.visibleIndex}}}function hx(e){return e.map(r=>r.layer).toSorted((r,n)=>_p[r]-_p[n]).at(0)??"frame"}function Ca(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=>Qo(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 Qo(e){return e.kind==="not"?Qo(e.predicate):e.kind==="and"?e.predicates.flatMap(t=>Qo(t)):e.kind!=="when"?[]:e.branches.flatMap(t=>[...t.condition==null?[]:ka(t.condition),...t.consequence.flatMap(r=>Qo(r))])}function ka(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"?ka(e.predicate):e.kind==="and"||e.kind==="or"?e.predicates.flatMap(t=>ka(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()}),Ea={even:{maxAttemptLength:12}};function Vp(e){return Ea[e]}function ei(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=wo(e.facts,t),o=Ho(e.corpus,{base:e.startingPoint.env,snapshot:n},Sx(e,r)),i=yx(o,e.corpus,e.random());return i==null?r:Wp(e,i.stepRun.next.snapshot,[...r,{idx:i.idx,params:i.params}])}var mx=.02;function yx(e,t,r){let n=e.map(a=>gx(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 gx(e,t){return t[e]?.effectStep.action.kind==="goto"?mx:1}function Sx(e,t){let r=Jo(t,e.corpus);return n=>wx({drawn:yr(n,r),params:e,prior:r,rule:n})}var bx=3;function wx({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%bx!==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:Yc,lockfileHash:x.string().min(1),stepRuns:x.array(x.object({idx:x.number().int().nonnegative(),params:x.record(x.string(),x.union([ms,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([ms,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()}),ti=x.object({baseLabel:x.string(),baseState:x.string().min(1),durationMs:x.number().int().nonnegative(),signature:x.string().optional(),steps:x.array(Aa)}),Pa=x.enum(["driver","infra","trail"]),Ma=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:Pa,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:Ma,kind:x.literal("error")}),x.object({kind:x.literal("clean"),trail:ti}),x.object({kind:x.literal("flaky"),trail:ti}),x.object({kind:x.literal("seen"),trail:ti}),x.object({kind:x.literal("finding"),runId:x.string().optional(),trail:ti})]);function ri(e,{sweep:t}){let r=Pe(Z(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=>vx(n))]:r}function Rx(e){return e.world.filter(t=>{let r={...e,world:e.world.filter(n=>n!==t)};return Iu(r).every(n=>rr(n)!==t.as)})}function ni(e,t,r){return pr(e,t.test,r)}function vx(e){return Rx(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 oi(e){let t=Zr(e);if(t.length===0)return null;let r=ri(e,{sweep:!1}),n=await xx(e,r);if(n.length===0)return null;let o=sr(e);return{corpus:t,facts:{facts:o.facts.filter(i=>!i.localConsequence),overlays:Xe(e),overrides:o.overrides},literals:Ca(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=ei({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 xx(e,t){let r={generate:Dr,materialize:zo(Dr,e.valueSpaces),params:void 0,signIn:void 0};return(await Promise.all(t.map(async o=>(await ni(e,o,r)).match(s=>({env:s.env,name:o.name,snapshot:s.snapshot}),()=>null)))).flatMap(o=>o==null?[]:[o])}import{createServer as Vx}from"http";import{mkdir as Wx,rm as Ux,writeFile as zx}from"fs/promises";import Gx from"path";import{z as F}from"zod";var Kx="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()})}),qx=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()}),Hx=F.object({resourceSpans:F.array(F.object({resource:F.object({attributes:F.array(Jp).default([])}).optional(),scopeSpans:F.array(F.object({spans:F.array(qx).default([])})).default([])})).default([])});async function Oa({localDir:e,onRrwebBatch:t,onSpan:r,writePortFile:n}){let{port:o,server:i}=await Yx({onRrwebBatch:t,onSpan:r}),s=Gx.join(e,Kx);return n&&(await Wx(e,{recursive:!0}),await zx(s,String(o),{encoding:"utf8"})),{port:o,stop:async()=>{n&&await Ux(s,{force:!0}),await ek(i)}}}function Yx(e){return new Promise((t,r)=>{let n=Vx((o,i)=>{Zx(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 Zx(e,t,r){let n=Jx(e.url);if(n!=null){Zp(e).then(o=>{r.onRrwebBatch(n,o),ii(t)}).catch(()=>{ii(t)});return}Zp(e).then(o=>{Xx(Hx.parse(JSON.parse(o.toString("utf8"))),r.onSpan),ii(t)}).catch(()=>{ii(t)})}function Jx(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 ii(e){e.writeHead(200,{"content-type":"application/json"}),e.end("{}")}function Xx(e,t){e.resourceSpans.flatMap(r=>r.scopeSpans).flatMap(r=>r.spans).forEach(r=>{t({attributes:Qx(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:Dc(r.kind),status:{code:_c(r.status?.code??0),message:r.status?.message},timeNanos:r.startTimeUnixNano,traceId:r.traceId})})}function Qx(e){return Object.fromEntries(e.map(({key:t,value:r})=>[t,String(r.stringValue??r.intValue??r.doubleValue??r.boolValue??"")]))}function ek(e){return new Promise((t,r)=>{e.close(n=>{if(n==null){t();return}r(n)}),e.closeAllConnections()})}import{ResultAsync as Sr}from"neverthrow";function jt(e,t,r){if(t==null)throw new Error("action requires a locator");return ut(e,t,r)}function ut(e,t,r){if(t.by==="inside"){if(t.scope.by==="frame"){let i=ut(e,t.scope.element,{visibleOnly:!1});return ut(i.contentFrame(),t.target,r)}let o=ut(e,t.scope,r);return ut(o,t.target,r)}if(t.by==="surface")return ut(e,t.container,r);if(t.by==="frame")return ut(e,t.element,r);let n=t.by==="testId"?e.getByTestId(t.value):e.locator(Ia(t.role,t.name));return r.visibleOnly?n.filter({visible:!0}):n}function Ia(e,t){return t==null?`role=${e}`:`role=${e}[name=${JSON.stringify(t)}i]`}var Ta=3e4,gr=class extends Error{mountKey;constructor(t){super("client-mount-unmounted"),this.mountKey=t}},Vt=class extends Error{readyKey;timeoutMs;constructor(t,r){super("app-not-ready"),this.readyKey=t,this.timeoutMs=r}};function La(e){return{read:t=>tk(t,e),seedScript:t=>`globalThis[${JSON.stringify(Hc)}] = ${JSON.stringify(t)};`}}async function tk(e,t){let r=Se(tr(e.url()),Xp([[{kind:"title"},await e.title()],[{kind:"viewport"},ik(e.viewportSize())]]));if(t.length===0)return{scalars:r};let n=await e.evaluate(nk,{mountKey:ys,names:t,timeoutMs:rk});if(n.kind==="unmounted")throw new gr(ys);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 rk=Ta;async function nk(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 ok=768;function ik(e){return e==null?"":e.width<ok?"mobile":"desktop"}async function si({page:e,readiness:t,signal:r,startMs:n,tries:o,url:i}){if(be(r),!await sk(e,i)){if(Date.now()-n>=t.budgetMs)throw new Vt(Kn,t.budgetMs);let a=t.backoffMs[Math.min(o,t.backoffMs.length-1)]??8e3;await Rt(a,r),await si({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 uk(e,r,Math.min(s,lk(t,o)))){if(Date.now()-n>=t.budgetMs)throw new Vt(Kn,t.budgetMs);await si({page:e,readiness:t,signal:r,startMs:n,tries:o+1,url:i})}}function Na(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 ai(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 sk(e,t){let r=await ak(e,t);return r==="net-error"?!1:r==null||r.status()<400}async function ak(e,t){try{return await e.goto(t,{waitUntil:"domcontentloaded"})}catch(r){if(Na(r))return"net-error";throw r}}function lk(e,t){return t===0?e.budgetMs/2:e.budgetMs}var ck=50;async function uk(e,t,r){let n=Date.now()+r;for(;Date.now()<n;){if(be(t),await Qp(e))return!0;await Rt(ck,t)}return Qp(e)}async function Qp(e){try{return await e.evaluate(dk,Kn)}catch(t){if(ai(t))return!1;throw t}}function dk(e){return Reflect.get(globalThis,e)===!0}async function Fa(e,t,r){if(r.kind==="browser")return pk(e,t,r.key,r.value);if(r.kind==="not")return!await Fa(e,t,r.inner);let n=jt(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=er(e),o=er(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,f)=>u+o+(d-o*2)*f/(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 pk(e,t,r,n){let o=await t.read(e),i=X(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=X(s.scalars,n.check.key);return{kind:"wrongContent",observed:a===void 0?"":String(a)}}let o=jt(e,n.check.locator,{visibleOnly:!0}),i=await o.count();return i>1?{count:i,kind:"multipleMatches"}:i===0?{kind:"notFound"}:fk(o,n.check)}function sf(e,t){return e.kind==="not"?sf(e.inner,!t):{check:e,negated:t}}async function fk(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 hk(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 hk(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 Da={backoffMs:[500,1e3,2e3,4e3,8e3],budgetMs:Ta},mk={readiness:Da,readSession:void 0,switchActor:void 0};function _a(e,t,r,n,{readiness:o,readSession:i,switchActor:s}=mk){return{awaitCheck:(a,l)=>Sr.fromPromise(Ck({check:a,engine:r,page:e,signal:n,timeoutMs:l}),c=>sn(c)?{kind:"aborted"}:hn(c)),diagnoseCheck:a=>Sr.fromPromise($a(of(e,r,a),`diagnose ${a.kind}`),hn),evaluate:a=>Sr.fromPromise($a(Ba(e,r,a),`check ${a.kind}`),hn),locateIds:a=>Fk(e,a),observe:a=>Sr.fromPromise(i==null?Promise.resolve(void 0):i(),hn).andThen(l=>Sk(t.read(l))).andThen(l=>Sr.fromPromise($a(Ek({backend:l,engine:r,page:e,tracked:a}),"observe"),hn)),perform:a=>Sr.fromPromise(uf(e,a,0,n,{readiness:o,switchActor:s}),l=>wk(a,l))}}function hn(e){return e instanceof gr?Hn(e.mountKey):Yn(e)}async function Ba(e,t,r){try{return await Fa(e,t,r)}catch(n){if(ai(n)||gk(n))return!1;throw n}}var yk=/strict mode violation/;function gk(e){return e instanceof Error&&yk.test(e.message)}function Sk(e){return e.mapErr(t=>t.kind==="action-failed"||t.kind==="check-failed"?Yn(new Error(bk(t.kind))):t)}function bk(e){return`unexpected ${e} while reading app state`}function wk(e,t){return t instanceof Vt?ws(t.readyKey,t.timeoutMs):t instanceof gr?Hn(t.mountKey):Cs(e.kind,xk(t))}var Rk=/resolved to (\d+) elements/,vk=/(<[^<>]+>)[^<>]* intercepts pointer events/;function xk(e){let t=e instanceof Error?e.message:String(e),r=Rk.exec(t);if(r?.[1]!=null)return{count:Number(r[1]),kind:"multipleMatches"};let n=vk.exec(t);return n?.[1]!=null?{by:n[1],kind:"covered"}:e instanceof Error&&e.name==="TimeoutError"&&t.includes("waiting for")?{kind:"notFound"}:Es(e)}var kk=75;function Ck(e){return lf(e,Date.now()+e.timeoutMs)}async function lf(e,t){return be(e.signal),await Ba(e.page,e.engine,e.check)?!0:Date.now()>=t?!1:(await Rt(kk,e.signal),lf(e,t))}async function Ek({backend:e,engine:t,page:r,tracked:n}){let o=await cf(r,t,0),i=await Ak(r,t,n);return{snapshot:{...e,scalars:new Map([...e.scalars,...o.scalars,...i])}}}async function Ak(e,t,r){let n=await Promise.all([...r.values()].filter(o=>o.subject.kind==="element").map(async o=>{let i=await Pk(e,t,o.subject);return[R(o.subject),{declared:!0,expect:{expect:"is",value:i},subject:o.subject}]}));return new Map(n)}async function Pk(e,t,r){return r.state==="value"||r.state==="text"?Mk(e,r.locator,r.state):Ba(e,t,{kind:r.state,locator:r.locator})}async function Mk(e,t,r){try{let n=jt(e,t,{visibleOnly:!0});return r==="value"?await n.inputValue():await n.textContent()??""}catch{return""}}var Ok=[100,250,500];async function cf(e,t,r){try{return await t.read(e)}catch(n){let o=Ok[r];if(o==null||!ai(n))throw n;return await df(o),cf(e,t,r+1)}}var af=35e3;function $a(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 Ik=[250,750,2e3];async function uf(e,t,r,n,o){try{await Tk(e,t,n,o.readiness,o.switchActor)}catch(i){let s=Ik[r];if(s==null||!Na(i))throw i;await df(s),await uf(e,t,r+1,n,o)}}async function Tk(e,t,r,n,o){if(t.kind==="actor"){if(o==null)throw new Error("this driver cannot switch actors");await o(vt(t.actorRef,t,"actorRef"));return}if(t.kind==="goto"){await si({page:e,readiness:n,signal:r,startMs:Date.now(),tries:0,url:vt(t.url,t,"url")});return}if(t.kind==="press"&&t.locator==null){await e.keyboard.press(vt(t.key,t,"key"));return}let i=t.kind!=="upload";await Lk(e,jt(e,t.locator,{visibleOnly:i}),t)}function vt(e,t,r){if(e==null)throw new Error(`action "${t.kind}" requires ${r}`);return e}function Lk(e,t,r){switch(r.kind){case"goto":throw new Error("goto must not be located");case"fill":return t.fill(String(vt(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 Nk(e,t,String(vt(r.value,r,"value")));case"upload":return t.setInputFiles(vt(r.files,r,"files"));case"press":return t.press(vt(r.key,r,"key"));case"drag":return t.dragTo(jt(e,vt(r.target,r,"target"),{visibleOnly:!0}));case"actor":throw new Error("actor switch must not be located")}}async function Nk(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(Ia("option",r)).filter({visible:!0}).click()}function df(e){return new Promise(t=>{setTimeout(t,e)})}async function Fk(e,t){if(t==null)return[];try{let r=ut(e,t,{visibleOnly:!1});if(await r.count()===0)return[];let n=await r.first().evaluate($k);return n>0?[n]:[]}catch{return[]}}function $k(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 Dk from"path";var ff={desktop:{height:720,width:1280},mobile:{height:844,width:390}};function hf(e){return ff[e]}var g_=ff.desktop;async function ja({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:Wa(c.cookies,e),origins:c.origins},viewport:p});s!=null&&await jk(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 f=r==null?Vk():await r.hub.attach(y,r.runId),m=await y.newPage();f.onPage(m);let h=m,v=_k({baseUrl:e,context:y,page:m,signInActor:d}),w=a?Bk(e,y):void 0;return{context:y,driver:zk(Wk(_a(h,l,o,u,{readiness:Da,readSession:w,switchActor:v}),i),f),emitStepOutcome:f.emitStepOutcome,close:()=>Gk({context:y,handle:f})}}async function Va(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 _k({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(Wa(i.cookies,e)),i.headers!=null&&await t.setExtraHTTPHeaders(i.headers),await r.reload()}}function Wa(e,t){let r=new URL(t).hostname;return e.map(n=>({...n,domain:r}))}function Bk(e,t){return async()=>{let r=await t.cookies();return{cookies:Wa(r,e),headers:void 0,origins:[]}}}async function jk(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 Vk(){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 li({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 Wk(e,t){return{...e,perform:r=>e.perform(Uk(r,t))}}function Uk(e,t){return e.kind!=="upload"||e.files==null?e:{...e,files:e.files.map(r=>Dk.join(t,r))}}function zk(e,t){return{...e,perform:r=>(t.emitAction(r),e.perform(r))}}async function Gk({context:e,handle:t}){await pf(t.finish()),await pf(e.close())}var Kk=15e3;async function pf(e){let t,r=new Promise(n=>{t=setTimeout(n,Kk)});await Promise.race([e.catch(()=>{}),r]).finally(()=>{clearTimeout(t)})}import{err as qk,ok as Hk,Result as Ua}from"neverthrow";function za(e,t,r){return{read:n=>r.read(e.map(o=>o.name),t,n).andThen(o=>Yk(e,o))}}function Yk(e,t){return Ua.combine(e.map(r=>Zk(r,t.entities[r.name]??[]).map(n=>[r.name,n]))).map(r=>({entities:new Map(r),scalars:new Map([...Qk(t.singletons),...eC(t.actor)])}))}function Zk(e,t){let r=ln(e);return Ua.combine(t.map(n=>Jk(n,e).map(o=>[o,Xk(n,r)]))).map(n=>new Map(n))}function Jk(e,t){return Ua.combine(t.identity.map(r=>{let n=e[r];return n==null?qk(vs(t.name,r)):Hk(String(n))})).map(r=>r.join(":"))}function Xk(e,t){let r=t.map(n=>[n,e[n]]).filter(n=>n[1]!=null);return Object.fromEntries(r)}function Qk(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 eC(e){return e==null?[]:[[R({kind:"actor"}),{declared:!1,expect:{expect:"is",value:e},subject:{kind:"actor"}}]]}var gf=Mc(By(),1);import tC from"crypto";import{err as rC,errAsync as Ga,ok as nC,ResultAsync as br}from"neverthrow";var oC=1e4,iC=[250,750,2e3],sC=[500,1e3,2e3,3e3];function Ka({baseUrl:e,extraHeaders:t,runId:r,secret:n},o){let i=new gf.Webhook(n),s=(a,l,c)=>aC({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:Qc,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:Jc,signal:o}).map(l=>l.rows),signIn:({entity:a,row:l})=>s("/sign-in",{entity:a,row:l,runId:r},{retry:"connection",schema:Xc,signal:o}).map(c=>c.session),teardown:()=>s("/teardown",{runId:r},{retry:"connection",schema:eu,signal:void 0}).map(()=>{})}}function aC(e){return Sf(e.retry,()=>dC(e),0)}function Sf(e,t,r){return t().orElse(n=>{let o=iC[r];return o==null||!cC(n,e)?Ga(n):br.fromSafePromise(wf(o)).andThen(()=>Sf(e,t,r+1))})}function bf(e,t,r,n){return br.fromPromise(fetch(e,{headers:t,method:"HEAD",signal:Rf(r)}),o=>Jt("",o)).map(()=>{}).orElse(()=>{let o=sC[n];return o==null||r.aborted?Ga(ks(e)):br.fromSafePromise(wf(o)).andThen(()=>bf(e,t,r,n+1))})}var lC=new Set(["EAI_AGAIN","ECONNREFUSED","ENOTFOUND"]);function cC(e,t){return e.kind==="aborted"?!1:uC(e)?!0:t==="connection"?!1:e.kind==="engine-network"||e.kind==="engine-http"&&e.status>=500}function uC(e){return e.kind==="engine-network"&&e.code!=null&&lC.has(e.code)}function wf(e){return new Promise(t=>{setTimeout(t,e)})}function dC({baseUrl:e,body:t,extraHeaders:r,path:n,schema:o,signal:i,webhook:s}){let a=JSON.stringify(t);return br.fromPromise(fetch(`${e}${n}`,{body:a,headers:{...r,"Content-Type":"application/json",...pC(s,a)},method:"PUT",signal:Rf(i)}),l=>Jt(n,l)).andThen(l=>fC(l,n)).andThen(l=>hC(o,l,n)).mapErr(l=>i?.aborted===!0?As():l)}function pC(e,t){let r=`msg_${tC.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(oC);return e==null?t:AbortSignal.any([e,t])}function fC(e,t){return e.ok?br.fromPromise(e.json(),r=>Jt(t,r)):br.fromPromise(e.text().catch(()=>""),r=>Jt(t,r)).andThen(r=>Ga(bs(t,e.status,r)))}function hC(e,t,r){let n=e.safeParse(t);return n.success?nC(n.data):rC(Rs(r,n.error))}import fI from"path";import{err as Yt,errAsync as hI,ok as Lr,ResultAsync as Rc}from"neverthrow";import ky from"path";import{z as Ve}from"zod";import mC from"path";function vf({debugDir:e,runId:t,worker:r}){let n=mC.join(e,t,"behavior.jsonl");return r.open({file:n,runId:t}),{close:o=>r.close({noticeLineIfNoRrweb:o?.noticeIfNoRrweb==null?"":JSON.stringify(yC(o.noticeIfNoRrweb)),runId:t}),emit:o=>{let i={...o,timestamp:gC(o.timeNanos)};r.line({line:JSON.stringify(i),runId:t,timeNanos:o.timeNanos})},emitRrwebBatch:o=>{r.rrwebBatch({data:o,runId:t})}}}function Wt(e){return String(BigInt(Math.round(e))*1000000n)}function yC(e){return{kind:"notice",message:e,source:"capture",timeNanos:"0"}}function gC(e){return Number(BigInt(e)/1000000n)}import{existsSync as SC}from"fs";import{createRequire as bC}from"module";import{fileURLToPath as wC}from"url";import{Worker as RC}from"worker_threads";var vC=bC(import.meta.url);function xf(e){let t=new RC(xC(),{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 xC(){try{return vC.resolve("@ripplo/runtime/capture-worker")}catch{let e=["../../dist/capture-worker.js","./capture-worker.js"].map(r=>wC(new URL(r,import.meta.url))),t=e.find(r=>SC(r));if(t==null)throw new Error(`capture-worker.js not found; looked at: ${e.join(", ")}`);return t}}import{readFile as kC}from"fs/promises";import{createRequire as CC}from"module";import{fileURLToPath as EC}from"url";var AC=CC(import.meta.url);function qa(e,t){try{return AC.resolve(e)}catch{return EC(new URL(`assets/${t}`,import.meta.url))}}function Ha(e){let t;return()=>(t??=kC(e,"utf8"),t)}var PC=Ha(qa("@ripplo/browser-trace/bundle","browser-trace.js"));async function kf(e,t){await e.addInitScript(`globalThis.__ripploRunId = ${JSON.stringify(t)};`),await e.addInitScript(await PC())}var MC=Object.defineProperty,OC=(e,t,r)=>t in e?MC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,S=(e,t,r)=>OC(e,typeof t!="symbol"?t+"":t,r),Cf,IC=Object.defineProperty,TC=(e,t,r)=>t in e?IC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ef=(e,t,r)=>TC(e,typeof t!="symbol"?t+"":t,r),ie=(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))(ie||{}),Af={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Pf={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},ci={},LC=()=>!!globalThis.Zone;function Xl(e){if(ci[e])return ci[e];let t=globalThis[e],r=t.prototype,n=e in Af?Af[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 Pf?Pf[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&&!LC())return ci[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?ci[e]=c:r}catch{return r}}var Ya={};function ht(e,t,r){var n;let o=`${e}.${String(r)}`;if(Ya[o])return Ya[o].call(t);let i=Xl(e),s=(n=Object.getOwnPropertyDescriptor(i,r))==null?void 0:n.get;return s?(Ya[o]=s,s.call(t)):t[r]}var Za={};function Ch(e,t,r){let n=`${e}.${String(r)}`;if(Za[n])return Za[n].bind(t);let i=Xl(e)[r];return typeof i!="function"?t[r]:(Za[n]=i,i.bind(t))}function NC(e){return ht("Node",e,"ownerDocument")}function FC(e){return ht("Node",e,"childNodes")}function $C(e){return ht("Node",e,"parentNode")}function DC(e){return ht("Node",e,"parentElement")}function _C(e){return ht("Node",e,"textContent")}function BC(e,t){return Ch("Node",e,"contains")(t)}function jC(e){return Ch("Node",e,"getRootNode")()}function VC(e){return!e||!("host"in e)?null:ht("ShadowRoot",e,"host")}function WC(e){return e.styleSheets}function UC(e){return!e||!("shadowRoot"in e)?null:ht("Element",e,"shadowRoot")}function zC(e,t){return ht("Element",e,"querySelector")(t)}function GC(e,t){return ht("Element",e,"querySelectorAll")(t)}function KC(){return Xl("MutationObserver").constructor}function qC(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 ue={ownerDocument:NC,childNodes:FC,parentNode:$C,parentElement:DC,textContent:_C,contains:BC,getRootNode:jC,host:VC,styleSheets:WC,shadowRoot:UC,querySelector:zC,querySelectorAll:GC,mutationObserver:KC,patch:qC};function Eh(e){return e.nodeType===e.ELEMENT_NODE}function wn(e){let t=e&&"host"in e&&"mode"in e&&ue.host(e)||null;return!!(t&&"shadowRoot"in t&&ue.shadowRoot(t)===e)}function Rn(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function HC(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 YC(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 cl(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=>Ah(o,r)).join("");return HC(n)}catch{return null}}function Ah(e,t){if(JC(e)){let r;try{r=cl(e.styleSheet)||YC(e)}catch{r=e.cssText}return e.styleSheet.href?Vi(r,e.styleSheet.href):r}else{let r=e.cssText;return XC(e)&&e.selectorText.includes(":")&&(r=ZC(r)),t?Vi(r,t):r}}function ZC(e){let t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function JC(e){return"styleSheet"in e}function XC(e){return"selectorText"in e}var _i=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 QC(){return new _i}function Bi({element:e,maskInputOptions:t,tagName:r,type:n,value:o,maskInputFn:i}){let s=o||"",a=n&&zt(n);return(t[r.toLowerCase()]||a&&t[a])&&(i?s=i(s,e):s="*".repeat(s.length)),s}function zt(e){return e.toLowerCase()}var Mf="__rrweb_original__";function eE(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 ji(e){let t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?zt(t):null}function Ph(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 tE(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var rE=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,nE=/^(?:[a-z+]+:)?\/\//i,oE=/^www\..*/i,iE=/^(data:)([^,]*),(.*)/i;function Vi(e,t){return(e||"").replace(rE,(r,n,o,i,s,a)=>{let l=o||s||a,c=n||i||"";if(!l)return r;if(nE.test(l)||oE.test(l))return`url(${c}${l}${c})`;if(iE.test(l))return`url(${c}${l}${c})`;if(l[0]==="/")return`url(${c}${tE(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 ui(e,t=!1){return t?e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,""):e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"").replace(/0px/g,"0")}function sE(e,t,r=!1){let n=Array.from(t.childNodes),o=[],i=0;if(n.length>1&&e&&typeof e=="string"){let s=ui(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=ui(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),f=-1;if(y.length===2)f=y[0].length;else if(y.length>2&&y[0]===""&&n[l-1].textContent!=="")f=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&&(f=s.indexOf(p));if(y.length>=2&&d>u){let m=n[l-1].textContent;if(m&&typeof m=="string"){let h=ui(m).length;f=s.indexOf(p,h)}f===-1&&(f=y[0].length)}if(f!==-1){let m=Math.floor(f/a);for(;m>0&&m<e.length;){if(i+=1,i>50*n.length)return o.push(e),o;let h=ui(e.substring(0,m),r);if(h.length===f){o.push(e.substring(0,m)),e=e.substring(m),s=s.substring(f);break}else h.length<f?m+=Math.max(1,Math.floor((f-h.length)/a)):m-=Math.max(1,Math.floor((h.length-f)*a))}break}}}}return o.push(e),o}function aE(e,t){return sE(e,t).join("/* rr_split */")}var lE=1,cE=new RegExp("[^a-z0-9-_:]"),xn=-2;function Mh(){return lE++}function uE(e){if(e instanceof HTMLFormElement)return"form";let t=zt(e.tagName);return cE.test(t)?"div":t}var wr,Of,dE=/^[^ \t\n\r\u000c]+/,pE=/^[, \t\n\r\u000c]+/;function fE(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(pE),!(r>=t.length);){let i=n(dE);if(i.slice(-1)===",")i=xr(e,i.substring(0,i.length-1)),o.push(i);else{let s="";i=xr(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 xr(e,t){return!t||t.trim()===""?t:Ql(e,t)}function hE(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function Ql(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)?xr(e,n):r==="srcset"?fE(e,n):r==="style"?Vi(n,Ql(e)):t==="object"&&r==="data"?xr(e,n):n)}function Ih(e,t,r){return["video","audio"].includes(e)&&t==="autoplay"}function mE(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 Wi(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return r?Wi(ue.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?Wi(ue.parentNode(e),t,r):!1}function Th(e,t,r,n){let o;if(Eh(e)){if(o=e,!ue.childNodes(o).length)return!1}else{if(ue.parentElement(e)===null)return!1;o=ue.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(Wi(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 yE(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 gE(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 SE(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:f,newlyAddedElement:m=!1,cssCaptured:h=!1}=t,v=bE(r,n);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:ie.Document,childNodes:[],compatMode:e.compatMode}:{type:ie.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:ie.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:v};case e.ELEMENT_NODE:return RE(e,{doc:r,blockClass:o,blockSelector:i,inlineStylesheet:a,maskInputOptions:l,maskInputFn:u,dataURLOptions:d,inlineImages:p,recordCanvas:y,keepIframeSrcFn:f,newlyAddedElement:m,rootId:v});case e.TEXT_NODE:return wE(e,{doc:r,needsMask:s,maskTextFn:c,rootId:v,cssCaptured:h});case e.CDATA_SECTION_NODE:return{type:ie.CDATA,textContent:"",rootId:v};case e.COMMENT_NODE:return{type:ie.Comment,textContent:ue.textContent(e)||"",rootId:v};default:return!1}}function bE(e,t){if(!t.hasNode(e))return;let r=t.getId(e);return r===1?void 0:r}function wE(e,t){let{needsMask:r,maskTextFn:n,rootId:o,cssCaptured:i}=t,s=ue.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=ue.textContent(e),c&&l&&(l=Vi(l,Ql(t.doc)))),!c&&!u&&l&&r&&(l=n?n(l,ue.parentElement(e)):l.replace(/[\S]/g,"*")),{type:ie.Text,textContent:l||"",rootId:o}}function RE(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,f=mE(e,n,o),m=uE(e),h={},v=e.attributes.length;for(let g=0;g<v;g++){let k=e.attributes[g];Ih(m,k.name,k.value)||(h[k.name]=Oh(r,m,zt(k.name),k.value))}if(m==="link"&&i){let g=Array.from(r.styleSheets).find(_=>_.href===e.href),k=null;g&&(k=cl(g)),k&&(delete h.rel,delete h.href,h._cssText=k)}if(m==="style"&&e.sheet){let g=cl(e.sheet);g&&(e.childNodes.length>1&&(g=aE(g,e)),h._cssText=g)}if(["input","textarea","select"].includes(m)){let g=e.value,k=e.checked;h.type!=="radio"&&h.type!=="checkbox"&&h.type!=="submit"&&h.type!=="button"&&g?h.value=Bi({element:e,type:ji(e),tagName:m,value:g,maskInputOptions:s,maskInputFn:a}):k&&(h.checked=k)}if(m==="option"&&(e.selected&&!s.select?h.selected=!0:delete h.selected),m==="dialog"&&e.open&&(h.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"),m==="canvas"&&u){if(e.__context==="2d")eE(e)||(h.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!==_&&(h.rr_dataURL=g)}}if(m==="img"&&c){wr||(wr=r.createElement("canvas"),Of=wr.getContext("2d"));let g=e,k=g.currentSrc||g.getAttribute("src")||"<unknown-src>",_=g.crossOrigin,j=()=>{g.removeEventListener("load",j);try{wr.width=g.naturalWidth,wr.height=g.naturalHeight,Of.drawImage(g,0,0),h.rr_dataURL=wr.toDataURL(l.type,l.quality)}catch(te){if(g.crossOrigin!=="anonymous"){g.crossOrigin="anonymous",g.complete&&g.naturalWidth!==0?j():g.addEventListener("load",j);return}else console.warn(`Cannot inline img src=${k}! Error: ${te}`)}g.crossOrigin==="anonymous"&&(_?h.crossOrigin=_:g.removeAttribute("crossorigin"))};g.complete&&g.naturalWidth!==0?j():g.addEventListener("load",j)}if(["audio","video"].includes(m)){let g=h;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&&(h.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(h.rr_scrollTop=e.scrollTop)),f){let{width:g,height:k}=e.getBoundingClientRect();h={class:h.class,rr_width:`${g}px`,rr_height:`${k}px`}}m==="iframe"&&!d(h.src)&&(e.contentDocument||(h.rr_src=h.src),delete h.src);let w;try{customElements.get(m)&&(w=!0)}catch{}return{type:ie.Element,tagName:m,attributes:h,childNodes:[],isSVG:hE(e)||void 0,needBlock:f,rootId:y,isCustom:w}}function V(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 vE(e,t){if(t.comment&&e.type===ie.Comment)return!0;if(e.type===ie.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"&&Ph(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(V(e.attributes.name).match(/^msapplication-tile(image|color)$/)||V(e.attributes.name)==="application-name"||V(e.attributes.rel)==="icon"||V(e.attributes.rel)==="apple-touch-icon"||V(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&V(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(V(e.attributes.property).match(/^(og|twitter|fb):/)||V(e.attributes.name).match(/^(og|twitter):/)||V(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(V(e.attributes.name)==="robots"||V(e.attributes.name)==="googlebot"||V(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(V(e.attributes.name)==="author"||V(e.attributes.name)==="generator"||V(e.attributes.name)==="framework"||V(e.attributes.name)==="publisher"||V(e.attributes.name)==="progid"||V(e.attributes.property).match(/^article:/)||V(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(V(e.attributes.name)==="google-site-verification"||V(e.attributes.name)==="yandex-verification"||V(e.attributes.name)==="csrf-token"||V(e.attributes.name)==="p:domain_verify"||V(e.attributes.name)==="verify-v1"||V(e.attributes.name)==="verification"||V(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function kr(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:f={},inlineImages:m=!1,recordCanvas:h=!1,onSerialize:v,onIframeLoad:w,iframeLoadTimeout:g=5e3,onStylesheetLoad:k,stylesheetLoadTimeout:_=5e3,keepIframeSrcFn:j=()=>!1,newlyAddedElement:te=!1,cssCaptured:z=!1}=t,{needsMask:Q}=t,{preserveWhiteSpace:ae=!0}=t;Q||(Q=Th(e,s,a,Q===void 0));let Me=SE(e,{doc:r,mirror:n,blockClass:o,blockSelector:i,needsMask:Q,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:p,dataURLOptions:f,inlineImages:m,recordCanvas:h,keepIframeSrcFn:j,newlyAddedElement:te,cssCaptured:z});if(!Me)return console.warn(e,"not serialized"),null;let We;n.hasNode(e)?We=n.getId(e):vE(Me,y)||!ae&&Me.type===ie.Text&&!Me.textContent.replace(/^\s+|\s+$/gm,"").length?We=xn:We=Mh();let T=Object.assign(Me,{id:We});if(n.add(e,T),We===xn)return null;v&&v(e);let Fr=!l;if(T.type===ie.Element){Fr=Fr&&!T.needBlock,delete T.needBlock;let re=ue.shadowRoot(e);re&&Rn(re)&&(T.isShadowHost=!0)}if((T.type===ie.Document||T.type===ie.Element)&&Fr){y.headWhitespace&&T.type===ie.Element&&T.tagName==="head"&&(ae=!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:f,inlineImages:m,recordCanvas:h,preserveWhiteSpace:ae,onSerialize:v,onIframeLoad:w,iframeLoadTimeout:g,onStylesheetLoad:k,stylesheetLoadTimeout:_,keepIframeSrcFn:j,cssCaptured:!1};if(!(T.type===ie.Element&&T.tagName==="textarea"&&T.attributes.value!==void 0)){T.type===ie.Element&&T.attributes._cssText!==void 0&&typeof T.attributes._cssText=="string"&&(re.cssCaptured=!0);for(let kt of Array.from(ue.childNodes(e))){let Ue=kr(kt,re);Ue&&T.childNodes.push(Ue)}}let Oe=null;if(Eh(e)&&(Oe=ue.shadowRoot(e)))for(let kt of Array.from(ue.childNodes(Oe))){let Ue=kr(kt,re);Ue&&(Rn(Oe)&&(Ue.isShadow=!0),T.childNodes.push(Ue))}}let $r=ue.parentNode(e);return $r&&wn($r)&&Rn($r)&&(T.isShadow=!0),T.type===ie.Element&&T.tagName==="iframe"&&yE(e,()=>{let re=e.contentDocument;if(re&&w){let Oe=kr(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:f,inlineImages:m,recordCanvas:h,preserveWhiteSpace:ae,onSerialize:v,onIframeLoad:w,iframeLoadTimeout:g,onStylesheetLoad:k,stylesheetLoadTimeout:_,keepIframeSrcFn:j});Oe&&w(e,Oe)}},g),T.type===ie.Element&&T.tagName==="link"&&typeof T.attributes.rel=="string"&&(T.attributes.rel==="stylesheet"||T.attributes.rel==="preload"&&typeof T.attributes.href=="string"&&Ph(T.attributes.href)==="css")&&gE(e,()=>{if(k){let re=kr(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:f,inlineImages:m,recordCanvas:h,preserveWhiteSpace:ae,onSerialize:v,onIframeLoad:w,iframeLoadTimeout:g,onStylesheetLoad:k,stylesheetLoadTimeout:_,keepIframeSrcFn:j});re&&k(e,re)}},_),T}function xE(e,t){let{mirror:r=new _i,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:f,preserveWhiteSpace:m,onSerialize:h,onIframeLoad:v,iframeLoadTimeout:w,onStylesheetLoad:g,stylesheetLoadTimeout:k,keepIframeSrcFn:_=()=>!1}=t||{},j=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 kr(e,{doc:e,mirror:r,blockClass:n,blockSelector:o,maskTextClass:i,maskTextSelector:s,skipChild:!1,inlineStylesheet:a,maskInputOptions:j,maskTextFn:d,maskInputFn:p,slimDOMOptions:te,dataURLOptions:f,inlineImages:l,recordCanvas:c,preserveWhiteSpace:m,onSerialize:h,onIframeLoad:v,iframeLoadTimeout:w,onStylesheetLoad:g,stylesheetLoadTimeout:k,keepIframeSrcFn:_,newlyAddedElement:!1})}var kE=/(max|min)-device-(width|height)/,__=new RegExp(kE.source,"g");function CE(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function EE(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 ec={exports:{}},W=String,Nh=function(){return{isColorSupported:!1,reset:W,bold:W,dim:W,italic:W,underline:W,inverse:W,hidden:W,strikethrough:W,black:W,red:W,green:W,yellow:W,blue:W,magenta:W,cyan:W,white:W,gray:W,bgBlack:W,bgRed:W,bgGreen:W,bgYellow:W,bgBlue:W,bgMagenta:W,bgCyan:W,bgWhite:W}};ec.exports=Nh();ec.exports.createColors=Nh;var AE=ec.exports,PE={},ME=Object.freeze(Object.defineProperty({__proto__:null,default:PE},Symbol.toStringTag,{value:"Module"})),Be=EE(ME),Tf=AE,Lf=Be,ul=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}},tc=ul;ul.default=ul;var Ln={};Ln.isClean=Symbol("isClean");Ln.my=Symbol("my");var Nf={after:`
12
+ `,beforeClose:`
13
+ `,beforeComment:`
14
+ `,beforeDecl:`
15
+ `,beforeOpen:" ",beforeRule:`
16
+ `,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function OE(e){return e[0].toUpperCase()+e.slice(1)}var dl=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"+OE(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=dl;dl.default=dl;var IE=$h;function pl(e,t){new IE(t).stringify(e)}var ts=pl;pl.default=pl;var{isClean:di,my:TE}=Ln,LE=tc,NE=$h,FE=ts;function fl(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=>fl(s,r)):(i==="object"&&o!==null&&(o=fl(o)),r[n]=o)}return r}var hl=class{constructor(t={}){this.raws={},this[di]=!1,this[TE]=!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=fl(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 LE(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[di]){this[di]=!1;let t=this;for(;t=t.parent;)t[di]=!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 NE().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=FE){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}},rs=hl;hl.default=hl;var $E=rs,ml=class extends $E{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]==="$"}},ns=ml;ml.default=ml;var DE="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",_E=(e,t=21)=>(r=t)=>{let n="",o=r;for(;o--;)n+=e[Math.random()*e.length|0];return n},BE=(e=21)=>{let t="",r=e;for(;r--;)t+=DE[Math.random()*64|0];return t},jE={nanoid:BE,customAlphabet:_E},{SourceMapConsumer:Ff,SourceMapGenerator:$f}=Be,{existsSync:VE,readFileSync:WE}=Be,{dirname:Ja,join:UE}=Be;function zE(e){return Buffer?Buffer.from(e,"base64").toString():window.atob(e)}var yl=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=Ja(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 zE(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=Ja(t),VE(t))return this.mapFile=t,WE(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=UE(Ja(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=yl;yl.default=yl;var{SourceMapConsumer:GE,SourceMapGenerator:KE}=Be,{fileURLToPath:Df,pathToFileURL:pi}=Be,{isAbsolute:gl,resolve:Sl}=Be,{nanoid:qE}=jE,Xa=Be,_f=tc,HE=Dh,Qa=Symbol("fromOffsetCache"),YE=!!(GE&&KE),Bf=!!(Sl&&gl),Ui=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)||gl(r.from)?this.file=r.from:this.file=Sl(r.from)),Bf&&YE){let n=new HE(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 "+qE(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&&(pi&&(i.input.url=pi(this.file).toString()),i.input.file=this.file),i}fromOffset(t){let r,n;if(this[Qa])n=this[Qa];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[Qa]=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:Sl(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;gl(s.source)?l=pi(s.source):l=new URL(s.source,this.map.consumer().sourceRoot||pi(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}},os=Ui;Ui.default=Ui;Xa&&Xa.registerInput&&Xa.registerInput(Ui);var{SourceMapConsumer:_h,SourceMapGenerator:Ti}=Be,{dirname:Li,relative:Bh,resolve:jh,sep:Vh}=Be,{pathToFileURL:jf}=Be,ZE=os,JE=!!(_h&&Ti),XE=!!(Li&&jh&&Bh&&Vh),QE=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||Li(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(),XE&&JE&&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=Ti.fromSourceMap(t,{ignoreInvalidMapping:!0})}else this.map=new Ti({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 Ti({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?Li(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(n=Li(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 ZE(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=QE,eA=rs,bl=class extends eA{constructor(t){super(t),this.type="comment"}},is=bl;bl.default=bl;var{isClean:Uh,my:zh}=Ln,Gh=ns,Kh=is,tA=rs,qh,rc,nc,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 pt=class Jh extends tA{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 rc(t)];else if(t.name)t=[new nc(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]}};pt.registerParse=e=>{qh=e};pt.registerRule=e=>{rc=e};pt.registerAtRule=e=>{nc=e};pt.registerRoot=e=>{Hh=e};var Gt=pt;pt.default=pt;pt.rebuild=e=>{e.type==="atrule"?Object.setPrototypeOf(e,nc.prototype):e.type==="rule"?Object.setPrototypeOf(e,rc.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=>{pt.rebuild(t)})};var rA=Gt,Xh,Qh,kn=class extends rA{constructor(t){super({type:"document",...t}),this.nodes||(this.nodes=[])}toResult(t={}){return new Xh(new Qh,this,t).stringify()}};kn.registerLazyResult=e=>{Xh=e};kn.registerProcessor=e=>{Qh=e};var oc=kn;kn.default=kn;var Vf={},em=function(t){Vf[t]||(Vf[t]=!0,typeof console<"u"&&console.warn&&console.warn(t))},wl=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=wl;wl.default=wl;var nA=tm,Rl=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 nA(t,r);return this.messages.push(n),n}warnings(){return this.messages.filter(t=>t.type==="warning")}get content(){return this.css}},ic=Rl;Rl.default=Rl;var el=39,Wf=34,fi=92,Uf=47,hi=10,mn=32,mi=12,yi=9,gi=13,oA=91,iA=93,sA=40,aA=41,lA=123,cA=125,uA=59,dA=42,pA=58,fA=64,Si=/[\t\n\f\r "#'()/;[\\\]{}]/g,bi=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,hA=/.[\r\n"'(/\\]/,zf=/[\da-f]/i,mA=function(t,r={}){let n=t.css.valueOf(),o=r.ignoreErrors,i,s,a,l,c,u,d,p,y,f,m=n.length,h=0,v=[],w=[];function g(){return h}function k(z){throw t.error("Unclosed "+z,h)}function _(){return w.length===0&&h>=m}function j(z){if(w.length)return w.pop();if(h>=m)return;let Q=z?z.ignoreUnclosed:!1;switch(i=n.charCodeAt(h),i){case hi:case mn:case yi:case gi:case mi:{s=h;do s+=1,i=n.charCodeAt(s);while(i===mn||i===hi||i===yi||i===gi||i===mi);f=["space",n.slice(h,s)],h=s-1;break}case oA:case iA:case lA:case cA:case pA:case uA:case aA:{let ae=String.fromCharCode(i);f=[ae,ae,h];break}case sA:{if(p=v.length?v.pop()[1]:"",y=n.charCodeAt(h+1),p==="url"&&y!==el&&y!==Wf&&y!==mn&&y!==hi&&y!==yi&&y!==mi&&y!==gi){s=h;do{if(u=!1,s=n.indexOf(")",s+1),s===-1)if(o||Q){s=h;break}else k("bracket");for(d=s;n.charCodeAt(d-1)===fi;)d-=1,u=!u}while(u);f=["brackets",n.slice(h,s+1),h,s],h=s}else s=n.indexOf(")",h+1),l=n.slice(h,s+1),s===-1||hA.test(l)?f=["(","(",h]:(f=["brackets",l,h,s],h=s);break}case el:case Wf:{a=i===el?"'":'"',s=h;do{if(u=!1,s=n.indexOf(a,s+1),s===-1)if(o||Q){s=h+1;break}else k("string");for(d=s;n.charCodeAt(d-1)===fi;)d-=1,u=!u}while(u);f=["string",n.slice(h,s+1),h,s],h=s;break}case fA:{Si.lastIndex=h+1,Si.test(n),Si.lastIndex===0?s=n.length-1:s=Si.lastIndex-2,f=["at-word",n.slice(h,s+1),h,s],h=s;break}case fi:{for(s=h,c=!0;n.charCodeAt(s+1)===fi;)s+=1,c=!c;if(i=n.charCodeAt(s+1),c&&i!==Uf&&i!==mn&&i!==hi&&i!==yi&&i!==gi&&i!==mi&&(s+=1,zf.test(n.charAt(s)))){for(;zf.test(n.charAt(s+1));)s+=1;n.charCodeAt(s+1)===mn&&(s+=1)}f=["word",n.slice(h,s+1),h,s],h=s;break}default:{i===Uf&&n.charCodeAt(h+1)===dA?(s=n.indexOf("*/",h+2)+1,s===0&&(o||Q?s=n.length:k("comment")),f=["comment",n.slice(h,s+1),h,s],h=s):(bi.lastIndex=h+1,bi.test(n),bi.lastIndex===0?s=n.length-1:s=bi.lastIndex-2,f=["word",n.slice(h,s+1),h,s],v.push(f),h=s);break}}return h++,f}function te(z){w.push(z)}return{back:te,endOfFile:_,nextToken:j,position:g}},rm=Gt,zi=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)}},sc=zi;zi.default=zi;rm.registerAtRule(zi);var nm=Gt,om,im,Er=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()}};Er.registerLazyResult=e=>{om=e};Er.registerProcessor=e=>{im=e};var Nn=Er;Er.default=Er;nm.registerRoot(Er);var Cn={comma(e){return Cn.split(e,[","],!0)},space(e){let t=[" ",`
29
+ `," "];return Cn.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=Cn;Cn.default=Cn;var am=Gt,yA=sm,Gi=class extends am{constructor(t){super(t),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return yA.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)}},ac=Gi;Gi.default=Gi;am.registerRule(Gi);var gA=ns,SA=mA,bA=is,wA=sc,RA=Nn,Gf=ac,Kf={empty:!0,space:!0};function vA(e){for(let t=e.length-1;t>=0;t--){let r=e[t],n=r[3]||r[2];if(n)return n}}var xA=class{constructor(t){this.input=t,this.root=new RA,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 wA;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 bA;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=SA(this.input)}decl(t,r){let n=new gA;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]||vA(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,f)=>y+f[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})}},kA=xA,CA=Gt,EA=kA,AA=os;function Ki(e,t){let r=new AA(e,t),n=new EA(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 lc=Ki;Ki.default=Ki;CA.registerParse(Ki);var{isClean:tt,my:PA}=Ln,MA=Wh,OA=ts,IA=Gt,TA=oc,LA=em,qf=ic,NA=lc,FA=Nn,$A={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},DA={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},_A={Once:!0,postcssPlugin:!0,prepare:!0},Ar=0;function yn(e){return typeof e=="object"&&typeof e.then=="function"}function lm(e){let t=!1,r=$A[e.type];return e.type==="decl"?t=e.prop.toLowerCase():e.type==="atrule"&&(t=e.name.toLowerCase()),t&&e.append?[r,r+"-"+t,Ar,r+"Exit",r+"Exit-"+t]:t?[r,r+"-"+t,r+"Exit",r+"Exit-"+t]:e.append?[r,Ar,r+"Exit"]:[r,r+"Exit"]}function Hf(e){let t;return e.type==="document"?t=["Document",Ar,"DocumentExit"]:e.type==="root"?t=["Root",Ar,"RootExit"]:t=lm(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function vl(e){return e[tt]=!1,e.nodes&&e.nodes.forEach(t=>vl(t)),e}var xl={},Pr=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=vl(r);else if(r instanceof cm||r instanceof qf)o=vl(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=NA;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[PA]&&IA.rebuild(o)}this.result=new qf(t,o,n),this.helpers={...xl,postcss:xl,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(!DA[n]&&/^[A-Z]/.test(n))throw new Error(`Unknown event ${n} in ${r.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!_A[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(yn(n))try{await n}catch(o){throw this.handleError(o)}}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[tt];){t[tt]=!0;let r=[Hf(t)];for(;r.length>0;){let n=this.visitTick(r);if(yn(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 yn(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=OA;t.syntax&&(r=t.syntax.stringify),t.stringifier&&(r=t.stringifier),r.stringify&&(r=r.stringify);let o=new MA(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(yn(r))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[tt];)t[tt]=!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||LA("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(yn(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[tt]){a[tt]=!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===Ar){n.nodes&&n.nodes.length&&(n[tt]=!0,r.iterator=n.getIterator());return}else if(this.listeners[s]){r.visitors=this.listeners[s];return}}t.pop()}walkSync(t){t[tt]=!0;let r=lm(t);for(let n of r)if(n===Ar)t.nodes&&t.each(o=>{o[tt]||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"}};Pr.registerPostcss=e=>{xl=e};var um=Pr;Pr.default=Pr;FA.registerLazyResult(Pr);TA.registerLazyResult(Pr);var BA=Wh,jA=ts,VA=em,WA=lc,UA=ic,kl=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=jA;this.result=new UA(this._processor,o,this._opts),this.result.css=r;let s=this;Object.defineProperty(this.result,"root",{get(){return s.root}});let a=new BA(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||VA("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=WA;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"}},zA=kl;kl.default=kl;var GA=zA,KA=um,qA=oc,HA=Nn,En=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 GA(this,t,r):new KA(this,t,r)}use(t){return this.plugins=this.plugins.concat(this.normalize([t])),this}},YA=En;En.default=En;HA.registerProcessor(En);qA.registerProcessor(En);var ZA=ns,JA=Dh,XA=is,QA=sc,eP=os,tP=Nn,rP=ac;function An(e,t){if(Array.isArray(e))return e.map(o=>An(o));let{inputs:r,...n}=e;if(r){t=[];for(let o of r){let i={...o,__proto__:eP.prototype};i.map&&(i.map={...i.map,__proto__:JA.prototype}),t.push(i)}}if(n.nodes&&(n.nodes=e.nodes.map(o=>An(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 tP(n);if(n.type==="decl")return new ZA(n);if(n.type==="rule")return new rP(n);if(n.type==="comment")return new XA(n);if(n.type==="atrule")return new QA(n);throw new Error("Unknown node type: "+e.type)}var nP=An;An.default=An;var oP=tc,dm=ns,iP=um,sP=Gt,cc=YA,aP=ts,lP=nP,pm=oc,cP=tm,fm=is,hm=sc,uP=ic,dP=os,pP=lc,fP=sm,mm=ac,ym=Nn,hP=rs;function $(...e){return e.length===1&&Array.isArray(e[0])&&(e=e[0]),new cc(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 cc().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=aP;$.parse=pP;$.fromJSON=lP;$.list=fP;$.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=oP;$.Declaration=dm;$.Container=sP;$.Processor=cc;$.Document=pm;$.Comment=fm;$.Warning=cP;$.AtRule=hm;$.Result=uP;$.Input=dP;$.Rule=mm;$.Root=ym;$.Node=hP;iP.registerPostcss($);var mP=$;$.default=$;var K=CE(mP);K.stringify;K.fromJSON;K.plugin;K.parse;K.list;K.document;K.comment;K.atRule;K.rule;K.decl;K.root;K.CssSyntaxError;K.Declaration;K.Container;K.Processor;K.Document;K.Comment;K.Warning;K.AtRule;K.Result;K.Input;K.Rule;K.Root;K.Node;var yP=Object.defineProperty,gP=(e,t,r)=>t in e?yP(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ne=(e,t,r)=>gP(e,typeof t!="symbol"?t+"":t,r);function SP(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function bP(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 uc={exports:{}},U=String,gm=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}};uc.exports=gm();uc.exports.createColors=gm;var wP=uc.exports,RP={},vP=Object.freeze(Object.defineProperty({__proto__:null,default:RP},Symbol.toStringTag,{value:"Module"})),je=bP(vP),Yf=wP,Zf=je,Cl=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}},dc=Cl;Cl.default=Cl;var Fn={};Fn.isClean=Symbol("isClean");Fn.my=Symbol("my");var Jf={after:`
40
+ `,beforeClose:`
41
+ `,beforeComment:`
42
+ `,beforeDecl:`
43
+ `,beforeOpen:" ",beforeRule:`
44
+ `,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function xP(e){return e[0].toUpperCase()+e.slice(1)}var El=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"+xP(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=El;El.default=El;var kP=bm;function Al(e,t){new kP(t).stringify(e)}var ss=Al;Al.default=Al;var{isClean:wi,my:CP}=Fn,EP=dc,AP=bm,PP=ss;function Pl(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=>Pl(s,r)):(i==="object"&&o!==null&&(o=Pl(o)),r[n]=o)}return r}var Ml=class{constructor(t={}){this.raws={},this[wi]=!1,this[CP]=!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=Pl(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 EP(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[wi]){this[wi]=!1;let t=this;for(;t=t.parent;)t[wi]=!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 AP().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=PP){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}},as=Ml;Ml.default=Ml;var MP=as,Ol=class extends MP{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]==="$"}},ls=Ol;Ol.default=Ol;var OP="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",IP=(e,t=21)=>(r=t)=>{let n="",o=r;for(;o--;)n+=e[Math.random()*e.length|0];return n},TP=(e=21)=>{let t="",r=e;for(;r--;)t+=OP[Math.random()*64|0];return t},LP={nanoid:TP,customAlphabet:IP},{SourceMapConsumer:Xf,SourceMapGenerator:Qf}=je,{existsSync:NP,readFileSync:FP}=je,{dirname:tl,join:$P}=je;function DP(e){return Buffer?Buffer.from(e,"base64").toString():window.atob(e)}var Il=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=tl(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 DP(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=tl(t),NP(t))return this.mapFile=t,FP(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=$P(tl(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=Il;Il.default=Il;var{SourceMapConsumer:_P,SourceMapGenerator:BP}=je,{fileURLToPath:eh,pathToFileURL:Ri}=je,{isAbsolute:Tl,resolve:Ll}=je,{nanoid:jP}=LP,rl=je,th=dc,VP=wm,nl=Symbol("fromOffsetCache"),WP=!!(_P&&BP),rh=!!(Ll&&Tl),qi=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)||Tl(r.from)?this.file=r.from:this.file=Ll(r.from)),rh&&WP){let n=new VP(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 "+jP(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&&(Ri&&(i.input.url=Ri(this.file).toString()),i.input.file=this.file),i}fromOffset(t){let r,n;if(this[nl])n=this[nl];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[nl]=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:Ll(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;Tl(s.source)?l=Ri(s.source):l=new URL(s.source,this.map.consumer().sourceRoot||Ri(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}},cs=qi;qi.default=qi;rl&&rl.registerInput&&rl.registerInput(qi);var{SourceMapConsumer:Rm,SourceMapGenerator:Ni}=je,{dirname:Fi,relative:vm,resolve:xm,sep:km}=je,{pathToFileURL:nh}=je,UP=cs,zP=!!(Rm&&Ni),GP=!!(Fi&&xm&&vm&&km),KP=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||Fi(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(),GP&&zP&&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(`
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?Fi(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(n=Fi(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 UP(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=KP,qP=as,Nl=class extends qP{constructor(t){super(t),this.type="comment"}},us=Nl;Nl.default=Nl;var{isClean:Em,my:Am}=Fn,Pm=ls,Mm=us,HP=as,Om,pc,fc,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 ft=class Nm extends HP{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 Pm(t)]}else if(t.selector)t=[new pc(t)];else if(t.name)t=[new fc(t)];else if(t.text)t=[new Mm(t)];else throw new Error("Unknown node type in node creation");return t.map(o=>(o[Am]||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]}};ft.registerParse=e=>{Om=e};ft.registerRule=e=>{pc=e};ft.registerAtRule=e=>{fc=e};ft.registerRoot=e=>{Im=e};var Kt=ft;ft.default=ft;ft.rebuild=e=>{e.type==="atrule"?Object.setPrototypeOf(e,fc.prototype):e.type==="rule"?Object.setPrototypeOf(e,pc.prototype):e.type==="decl"?Object.setPrototypeOf(e,Pm.prototype):e.type==="comment"?Object.setPrototypeOf(e,Mm.prototype):e.type==="root"&&Object.setPrototypeOf(e,Im.prototype),e[Am]=!0,e.nodes&&e.nodes.forEach(t=>{ft.rebuild(t)})};var YP=Kt,Fm,$m,Pn=class extends YP{constructor(t){super({type:"document",...t}),this.nodes||(this.nodes=[])}toResult(t={}){return new Fm(new $m,this,t).stringify()}};Pn.registerLazyResult=e=>{Fm=e};Pn.registerProcessor=e=>{$m=e};var hc=Pn;Pn.default=Pn;var oh={},Dm=function(t){oh[t]||(oh[t]=!0,typeof console<"u"&&console.warn&&console.warn(t))},Fl=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=Fl;Fl.default=Fl;var ZP=_m,$l=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 ZP(t,r);return this.messages.push(n),n}warnings(){return this.messages.filter(t=>t.type==="warning")}get content(){return this.css}},mc=$l;$l.default=$l;var ol=39,ih=34,vi=92,sh=47,xi=10,gn=32,ki=12,Ci=9,Ei=13,JP=91,XP=93,QP=40,eM=41,tM=123,rM=125,nM=59,oM=42,iM=58,sM=64,Ai=/[\t\n\f\r "#'()/;[\\\]{}]/g,Pi=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,aM=/.[\r\n"'(/\\]/,ah=/[\da-f]/i,lM=function(t,r={}){let n=t.css.valueOf(),o=r.ignoreErrors,i,s,a,l,c,u,d,p,y,f,m=n.length,h=0,v=[],w=[];function g(){return h}function k(z){throw t.error("Unclosed "+z,h)}function _(){return w.length===0&&h>=m}function j(z){if(w.length)return w.pop();if(h>=m)return;let Q=z?z.ignoreUnclosed:!1;switch(i=n.charCodeAt(h),i){case xi:case gn:case Ci:case Ei:case ki:{s=h;do s+=1,i=n.charCodeAt(s);while(i===gn||i===xi||i===Ci||i===Ei||i===ki);f=["space",n.slice(h,s)],h=s-1;break}case JP:case XP:case tM:case rM:case iM:case nM:case eM:{let ae=String.fromCharCode(i);f=[ae,ae,h];break}case QP:{if(p=v.length?v.pop()[1]:"",y=n.charCodeAt(h+1),p==="url"&&y!==ol&&y!==ih&&y!==gn&&y!==xi&&y!==Ci&&y!==ki&&y!==Ei){s=h;do{if(u=!1,s=n.indexOf(")",s+1),s===-1)if(o||Q){s=h;break}else k("bracket");for(d=s;n.charCodeAt(d-1)===vi;)d-=1,u=!u}while(u);f=["brackets",n.slice(h,s+1),h,s],h=s}else s=n.indexOf(")",h+1),l=n.slice(h,s+1),s===-1||aM.test(l)?f=["(","(",h]:(f=["brackets",l,h,s],h=s);break}case ol:case ih:{a=i===ol?"'":'"',s=h;do{if(u=!1,s=n.indexOf(a,s+1),s===-1)if(o||Q){s=h+1;break}else k("string");for(d=s;n.charCodeAt(d-1)===vi;)d-=1,u=!u}while(u);f=["string",n.slice(h,s+1),h,s],h=s;break}case sM:{Ai.lastIndex=h+1,Ai.test(n),Ai.lastIndex===0?s=n.length-1:s=Ai.lastIndex-2,f=["at-word",n.slice(h,s+1),h,s],h=s;break}case vi:{for(s=h,c=!0;n.charCodeAt(s+1)===vi;)s+=1,c=!c;if(i=n.charCodeAt(s+1),c&&i!==sh&&i!==gn&&i!==xi&&i!==Ci&&i!==Ei&&i!==ki&&(s+=1,ah.test(n.charAt(s)))){for(;ah.test(n.charAt(s+1));)s+=1;n.charCodeAt(s+1)===gn&&(s+=1)}f=["word",n.slice(h,s+1),h,s],h=s;break}default:{i===sh&&n.charCodeAt(h+1)===oM?(s=n.indexOf("*/",h+2)+1,s===0&&(o||Q?s=n.length:k("comment")),f=["comment",n.slice(h,s+1),h,s],h=s):(Pi.lastIndex=h+1,Pi.test(n),Pi.lastIndex===0?s=n.length-1:s=Pi.lastIndex-2,f=["word",n.slice(h,s+1),h,s],v.push(f),h=s);break}}return h++,f}function te(z){w.push(z)}return{back:te,endOfFile:_,nextToken:j,position:g}},Bm=Kt,Hi=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)}},yc=Hi;Hi.default=Hi;Bm.registerAtRule(Hi);var jm=Kt,Vm,Wm,Mr=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()}};Mr.registerLazyResult=e=>{Vm=e};Mr.registerProcessor=e=>{Wm=e};var $n=Mr;Mr.default=Mr;jm.registerRoot(Mr);var Mn={comma(e){return Mn.split(e,[","],!0)},space(e){let t=[" ",`
57
+ `," "];return Mn.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=Mn;Mn.default=Mn;var zm=Kt,cM=Um,Yi=class extends zm{constructor(t){super(t),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return cM.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)}},gc=Yi;Yi.default=Yi;zm.registerRule(Yi);var uM=ls,dM=lM,pM=us,fM=yc,hM=$n,lh=gc,ch={empty:!0,space:!0};function mM(e){for(let t=e.length-1;t>=0;t--){let r=e[t],n=r[3]||r[2];if(n)return n}}var yM=class{constructor(t){this.input=t,this.root=new hM,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 fM;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 pM;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=dM(this.input)}decl(t,r){let n=new uM;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]||mM(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,f)=>y+f[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})}},gM=yM,SM=Kt,bM=gM,wM=cs;function Zi(e,t){let r=new wM(e,t),n=new bM(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 Sc=Zi;Zi.default=Zi;SM.registerParse(Zi);var{isClean:rt,my:RM}=Fn,vM=Cm,xM=ss,kM=Kt,CM=hc,EM=Dm,uh=mc,AM=Sc,PM=$n,MM={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},OM={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},IM={Once:!0,postcssPlugin:!0,prepare:!0},Or=0;function Sn(e){return typeof e=="object"&&typeof e.then=="function"}function Gm(e){let t=!1,r=MM[e.type];return e.type==="decl"?t=e.prop.toLowerCase():e.type==="atrule"&&(t=e.name.toLowerCase()),t&&e.append?[r,r+"-"+t,Or,r+"Exit",r+"Exit-"+t]:t?[r,r+"-"+t,r+"Exit",r+"Exit-"+t]:e.append?[r,Or,r+"Exit"]:[r,r+"Exit"]}function dh(e){let t;return e.type==="document"?t=["Document",Or,"DocumentExit"]:e.type==="root"?t=["Root",Or,"RootExit"]:t=Gm(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function Dl(e){return e[rt]=!1,e.nodes&&e.nodes.forEach(t=>Dl(t)),e}var _l={},Ir=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=Dl(r);else if(r instanceof Km||r instanceof uh)o=Dl(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=AM;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[RM]&&kM.rebuild(o)}this.result=new uh(t,o,n),this.helpers={..._l,postcss:_l,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(!OM[n]&&/^[A-Z]/.test(n))throw new Error(`Unknown event ${n} in ${r.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!IM[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=[dh(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=xM;t.syntax&&(r=t.syntax.stringify),t.stringifier&&(r=t.stringifier),r.stringify&&(r=r.stringify);let o=new vM(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||EM("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(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===Or){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=Gm(t);for(let n of r)if(n===Or)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"}};Ir.registerPostcss=e=>{_l=e};var qm=Ir;Ir.default=Ir;PM.registerLazyResult(Ir);CM.registerLazyResult(Ir);var TM=Cm,LM=ss,NM=Dm,FM=Sc,$M=mc,Bl=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=LM;this.result=new $M(this._processor,o,this._opts),this.result.css=r;let s=this;Object.defineProperty(this.result,"root",{get(){return s.root}});let a=new TM(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||NM("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=FM;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"}},DM=Bl;Bl.default=Bl;var _M=DM,BM=qm,jM=hc,VM=$n,On=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 _M(this,t,r):new BM(this,t,r)}use(t){return this.plugins=this.plugins.concat(this.normalize([t])),this}},WM=On;On.default=On;VM.registerProcessor(On);jM.registerProcessor(On);var UM=ls,zM=wm,GM=us,KM=yc,qM=cs,HM=$n,YM=gc;function In(e,t){if(Array.isArray(e))return e.map(o=>In(o));let{inputs:r,...n}=e;if(r){t=[];for(let o of r){let i={...o,__proto__:qM.prototype};i.map&&(i.map={...i.map,__proto__:zM.prototype}),t.push(i)}}if(n.nodes&&(n.nodes=e.nodes.map(o=>In(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 HM(n);if(n.type==="decl")return new UM(n);if(n.type==="rule")return new YM(n);if(n.type==="comment")return new GM(n);if(n.type==="atrule")return new KM(n);throw new Error("Unknown node type: "+e.type)}var ZM=In;In.default=In;var JM=dc,Hm=ls,XM=qm,QM=Kt,bc=WM,eO=ss,tO=ZM,Ym=hc,rO=_m,Zm=us,Jm=yc,nO=mc,oO=cs,iO=Sc,sO=Um,Xm=gc,Qm=$n,aO=as;function D(...e){return e.length===1&&Array.isArray(e[0])&&(e=e[0]),new bc(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 bc().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=eO;D.parse=iO;D.fromJSON=tO;D.list=sO;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=JM;D.Declaration=Hm;D.Container=QM;D.Processor=bc;D.Document=Ym;D.Comment=Zm;D.Warning=rO;D.AtRule=Jm;D.Result=nO;D.Input=oO;D.Rule=Xm;D.Root=Qm;D.Node=aO;XM.registerPostcss(D);var lO=D;D.default=D;var q=SP(lO);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 jl=class e{constructor(...t){Ne(this,"parentElement",null),Ne(this,"parentNode",null),Ne(this,"ownerDocument"),Ne(this,"firstChild",null),Ne(this,"lastChild",null),Ne(this,"previousSibling",null),Ne(this,"nextSibling",null),Ne(this,"ELEMENT_NODE",1),Ne(this,"TEXT_NODE",3),Ne(this,"nodeType"),Ne(this,"nodeName"),Ne(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"]},Mi={},cO=()=>!!globalThis.Zone;function wc(e){if(Mi[e])return Mi[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&&!cO())return Mi[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?Mi[e]=c:r}catch{return r}}var il={};function mt(e,t,r){var n;let o=`${e}.${String(r)}`;if(il[o])return il[o].call(t);let i=wc(e),s=(n=Object.getOwnPropertyDescriptor(i,r))==null?void 0:n.get;return s?(il[o]=s,s.call(t)):t[r]}var sl={};function ey(e,t,r){let n=`${e}.${String(r)}`;if(sl[n])return sl[n].bind(t);let i=wc(e)[r];return typeof i!="function"?t[r]:(sl[n]=i,i.bind(t))}function uO(e){return mt("Node",e,"ownerDocument")}function dO(e){return mt("Node",e,"childNodes")}function pO(e){return mt("Node",e,"parentNode")}function fO(e){return mt("Node",e,"parentElement")}function hO(e){return mt("Node",e,"textContent")}function mO(e,t){return ey("Node",e,"contains")(t)}function yO(e){return ey("Node",e,"getRootNode")()}function gO(e){return!e||!("host"in e)?null:mt("ShadowRoot",e,"host")}function SO(e){return e.styleSheets}function bO(e){return!e||!("shadowRoot"in e)?null:mt("Element",e,"shadowRoot")}function wO(e,t){return mt("Element",e,"querySelector")(t)}function RO(e,t){return mt("Element",e,"querySelectorAll")(t)}function ty(){return wc("MutationObserver").constructor}function qt(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:uO,childNodes:dO,parentNode:pO,parentElement:fO,textContent:hO,contains:mO,getRootNode:yO,host:gO,styleSheets:SO,shadowRoot:bO,querySelector:wO,querySelectorAll:RO,mutationObserver:ty,patch:qt};function fe(e,t,r=document){let n={capture:!0,passive:!0};return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}var Rr=`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(Rr),-1},getNode(){return console.error(Rr),null},removeNodeFromMap(){console.error(Rr)},has(){return console.error(Rr),!1},reset(){console.error(Rr)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(hh=new Proxy(hh,{get(e,t,r){return t==="map"&&console.error(Rr),Reflect.get(e,t,r)}}));function Tn(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 ds(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)}}),()=>ds(e,t,i||{},!0)}var Ji=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(Ji=()=>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 he(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(Wi(o,t,n))return!0}catch{}return!!(r&&(o.matches(r)||n&&o.closest(r)!==null))}function vO(e,t){return t.getId(e)!==-1}function al(e,t,r){return e.tagName==="TITLE"&&r.headTitleMutations?!0:t.getId(e)===xn}function sy(e,t){if(wn(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 Vl(e){return!!e.changedTouches}function xO(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 Wl(e){return e?e instanceof jl&&"shadowRoot"in e?!!e.shadowRoot:!!C.shadowRoot(e):!1}var Ul=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 kO(e){let t=e,r;for(;r=cy(t);)t=r;return t}function CO(e){let t=C.ownerDocument(e);if(!t)return!1;let r=kO(e);return C.contains(t,r)}function uy(e){let t=C.ownerDocument(e);return t?C.contains(t,e)||CO(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||{}),dt=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(dt||{}),Tr=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(Tr||{}),vr=(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))(vr||{});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 zl=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}`,Gl=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 zl,o=l=>{let c=l,u=xn;for(;u===xn;)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 f=c.tagName;if(f==="TEXTAREA")return;f==="STYLE"&&this.addedSet.has(c)&&(u=!0)}let d=wn(c)?this.mirror.getId(cy(l)):this.mirror.getId(c),p=o(l);if(d===-1||p===-1)return n.addNode(l);let y=kr(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:f=>{ay(f,this.mirror)&&this.iframeManager.addIframe(f),ly(f,this.mirror)&&this.stylesheetManager.trackLinkElement(f),Wl(l)&&this.shadowDomManager.addShadowRoot(C.shadowRoot(l),this.doc)},onIframeLoad:(f,m)=>{this.iframeManager.attachIframe(f,m),this.shadowDomManager.observeAttachShadow(f)},onStylesheetLoad:(f,m)=>{this.stylesheetManager.attachLinkElement(f,m)},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,f=C.parentNode(y);if(f&&f.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let m=C.host(f);if(this.mirror.getId(m)!==-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=Bi({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:ji(t),value:n,maskInputFn:this.maskInputFn})}),S(this,"processMutation",t=>{if(!al(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{let r=C.textContent(t.target);!he(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=ji(r);o=Bi({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:s,value:o,maskInputFn:this.maskInputFn})}if(he(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,zt(r.tagName),zt(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(he(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=wn(t.target)?this.mirror.getId(C.host(t.target)):this.mirror.getId(t.target);he(t.target,this.blockClass,this.blockSelector,!1)||al(r,this.mirror,this.slimDOMOptions)||!vO(r,this.mirror)||(this.addedSet.has(r)?(Kl(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)]?Kl(this.movedSet,r):(this.removes.push({parentId:o,id:n,isShadow:wn(t.target)&&Rn(t.target)?!0:void 0}),EO(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(al(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);he(t,this.blockClass,this.blockSelector,!1)||(C.childNodes(t).forEach(n=>this.genAdds(n)),Wl(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 Kl(e,t){e.delete(t),C.childNodes(t).forEach(r=>Kl(e,r))}function EO(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:AO(e,t)}function AO(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 vn;function PO(e){vn=e}function MO(){vn=void 0}var I=e=>vn?(...r)=>{try{return e(...r)}catch(n){if(vn&&vn(n)===!0)return;throw n}}:e,Ut=[];function Dn(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 Gl;Ut.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 OO({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=Tn(I(d=>{let p=Date.now()-a;e(s.map(y=>(y.timeOffset-=p,y)),d),s=[],a=null}),i),c=I(Tn(I(d=>{let p=Dn(d),{clientX:y,clientY:f}=Vl(d)?d.changedTouches[0]:d;a||(a=Ji()),s.push({x:y,y:f,id:n.getId(p),timeOffset:Ji()-a}),l(typeof DragEvent<"u"&&d instanceof DragEvent?E.Drag:d instanceof MouseEvent?E.MouseMove:E.TouchMove)}),o,{trailing:!1})),u=[fe("mousemove",c,r),fe("touchmove",c,r),fe("drag",c,r)];return I(()=>{u.forEach(d=>d())})}function IO({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=Dn(d);if(he(p,n,o,!0))return;let y=null,f=u;if("pointerType"in d){switch(d.pointerType){case"mouse":y=dt.Mouse;break;case"touch":y=dt.Touch;break;case"pen":y=dt.Pen;break}y===dt.Touch?we[u]===we.MouseDown?f="TouchStart":we[u]===we.MouseUp&&(f="TouchEnd"):dt.Pen}else Vl(d)&&(y=dt.Touch);y!==null?(l=y,(f.startsWith("Touch")&&y===dt.Touch||f.startsWith("Mouse")&&y===dt.Mouse)&&(y=null)):we[u]===we.Click&&(y=l,l=null);let m=Vl(d)?d.changedTouches[0]:d;if(!m)return;let h=r.getId(p),{clientX:v,clientY:w}=m;I(e)({type:we[f],id:h,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=zt(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(fe(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(Tn(I(a=>{let l=Dn(a);if(!l||he(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 fe("scroll",s,t)}function TO({viewportResizeCb:e},{win:t}){let r=-1,n=-1,o=I(Tn(I(()=>{let i=ny(),s=oy();(r!==i||n!==s)&&(e({width:Number(s),height:Number(i)}),r=i,n=s)}),200));return fe("resize",o,t)}var LO=["INPUT","TEXTAREA","SELECT"],bh=new WeakMap;function NO({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=Dn(w),k=w.isTrusted,_=g&&g.tagName;if(g&&_==="OPTION"&&(g=C.parentElement(g)),!g||!_||LO.indexOf(_)<0||he(g,n,o,!0)||g.classList.contains(i)||s&&g.matches(s))return;let j=g.value,te=!1,z=ji(g)||"";z==="radio"||z==="checkbox"?te=g.checked:(a[_.toLowerCase()]||a[z])&&(j=Bi({element:g,maskInputOptions:a,tagName:_,type:z,value:j,maskInputFn:l})),p(g,u?{text:j,isChecked:te,userTriggered:k}:{text:j,isChecked:te});let Q=g.name;z==="radio"&&Q&&te&&t.querySelectorAll(`input[type="radio"][name="${Q}"]`).forEach(ae=>{if(ae!==g){let Me=ae.value;p(ae,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 f=(c.input==="last"?["change"]:["input","change"]).map(w=>fe(w,I(d),t)),m=t.defaultView;if(!m)return()=>{f.forEach(w=>w())};let h=m.Object.getOwnPropertyDescriptor(m.HTMLInputElement.prototype,"value"),v=[[m.HTMLInputElement.prototype,"value"],[m.HTMLInputElement.prototype,"checked"],[m.HTMLSelectElement.prototype,"value"],[m.HTMLTextAreaElement.prototype,"value"],[m.HTMLSelectElement.prototype,"selectedIndex"],[m.HTMLOptionElement.prototype,"selected"]];return h&&h.set&&f.push(...v.map(w=>ds(w[0],w[1],{set(){I(d)({target:this,isTrusted:!1})}},!1,m))),I(()=>{f.forEach(w=>w())})}function Xi(e){let t=[];function r(n,o){if(Oi("CSSGroupingRule")&&n.parentRule instanceof CSSGroupingRule||Oi("CSSMediaRule")&&n.parentRule instanceof CSSMediaRule||Oi("CSSSupportsRule")&&n.parentRule instanceof CSSSupportsRule||Oi("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 xt(e,t,r){let n,o;return e?(e.ownerNode?n=t.getId(e.ownerNode):o=r.getId(e),{styleId:o,id:n}):{}}function FO({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,f]=p,{id:m,styleId:h}=xt(d,t,r.styleMirror);return(m&&m!==-1||h&&h!==-1)&&e({id:m,styleId:h,adds:[{rule:y,index:f}]}),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:f,styleId:m}=xt(d,t,r.styleMirror);return(f&&f!==-1||m&&m!==-1)&&e({id:f,styleId:m,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:f,styleId:m}=xt(d,t,r.styleMirror);return(f&&f!==-1||m&&m!==-1)&&e({id:f,styleId:m,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:f,styleId:m}=xt(d,t,r.styleMirror);return(f&&f!==-1||m&&m!==-1)&&e({id:f,styleId:m,replaceSync:y}),u.apply(d,p)})}));let l={};Ii("CSSGroupingRule")?l.CSSGroupingRule=n.CSSGroupingRule:(Ii("CSSMediaRule")&&(l.CSSMediaRule=n.CSSMediaRule),Ii("CSSConditionRule")&&(l.CSSConditionRule=n.CSSConditionRule),Ii("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,f)=>{let[m,h]=f,{id:v,styleId:w}=xt(y.parentStyleSheet,t,r.styleMirror);return(v&&v!==-1||w&&w!==-1)&&e({id:v,styleId:w,adds:[{rule:m,index:[...Xi(y),h||0]}]}),p.apply(y,f)})}),d.prototype.deleteRule=new Proxy(c[u].deleteRule,{apply:I((p,y,f)=>{let[m]=f,{id:h,styleId:v}=xt(y.parentStyleSheet,t,r.styleMirror);return(h&&h!==-1||v&&v!==-1)&&e({id:h,styleId:v,removes:[{index:[...Xi(y),m]}]}),p.apply(y,f)})})}),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 $O({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:f,styleId:m}=xt((u=l.parentRule)==null?void 0:u.parentStyleSheet,t,n.styleMirror);return(f&&f!==-1||m&&m!==-1)&&e({id:f,styleId:m,set:{property:d,value:p,priority:y},index:Xi(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}=xt((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:Xi(l.parentRule)}),a.apply(l,c)})}),I(()=>{o.CSSStyleDeclaration.prototype.setProperty=i,o.CSSStyleDeclaration.prototype.removeProperty=s})}function DO({mediaInteractionCb:e,blockClass:t,blockSelector:r,mirror:n,sampling:o,doc:i}){let s=I(l=>Tn(I(c=>{let u=Dn(c);if(!u||he(u,t,r,!0))return;let{currentTime:d,volume:p,muted:y,playbackRate:f,loop:m}=u;e({type:l,id:n.getId(u),currentTime:d,volume:p,muted:y,playbackRate:f,loop:m})}),o.media||500)),a=[fe("play",s(vr.Play),i),fe("pause",s(vr.Pause),i),fe("seeked",s(vr.Seeked),i),fe("volumechange",s(vr.VolumeChange),i),fe("ratechange",s(vr.RateChange),i)];return I(()=>{a.forEach(l=>l())})}function _O({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=qt(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 BO(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:f,endContainer:m,endOffset:h}=p;he(y,n,o,!0)||he(m,n,o,!0)||c.push({start:r.getId(y),startOffset:f,end:r.getId(m),endOffset:h})}i({ranges:c})});return a(),fe("selectionchange",a)}function jO({doc:e,customElementCb:t}){let r=e.defaultView;return!r||!r.customElements?()=>{}:qt(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 VO(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:f}=e;e.mutationCb=(...m)=>{t.mutation&&t.mutation(...m),r(...m)},e.mousemoveCb=(...m)=>{t.mousemove&&t.mousemove(...m),n(...m)},e.mouseInteractionCb=(...m)=>{t.mouseInteraction&&t.mouseInteraction(...m),o(...m)},e.scrollCb=(...m)=>{t.scroll&&t.scroll(...m),i(...m)},e.viewportResizeCb=(...m)=>{t.viewportResize&&t.viewportResize(...m),s(...m)},e.inputCb=(...m)=>{t.input&&t.input(...m),a(...m)},e.mediaInteractionCb=(...m)=>{t.mediaInteaction&&t.mediaInteaction(...m),l(...m)},e.styleSheetRuleCb=(...m)=>{t.styleSheetRule&&t.styleSheetRule(...m),c(...m)},e.styleDeclarationCb=(...m)=>{t.styleDeclaration&&t.styleDeclaration(...m),u(...m)},e.canvasMutationCb=(...m)=>{t.canvasMutation&&t.canvasMutation(...m),d(...m)},e.fontCb=(...m)=>{t.font&&t.font(...m),p(...m)},e.selectionCb=(...m)=>{t.selection&&t.selection(...m),y(...m)},e.customElementCb=(...m)=>{t.customElement&&t.customElement(...m),f(...m)}}function WO(e,t={}){let r=e.doc.defaultView;if(!r)return()=>{};VO(e,t);let n;e.recordDOM&&(n=fy(e,e.doc));let o=OO(e),i=IO(e),s=hy(e),a=TO(e,{win:r}),l=NO(e),c=DO(e),u=()=>{},d=()=>{},p=()=>{},y=()=>{};e.recordDOM&&(u=FO(e,{win:r}),d=my(e,e.doc),p=$O(e,{win:r}),e.collectFonts&&(y=_O(e)));let f=BO(e),m=jO(e),h=[];for(let v of e.plugins)h.push(v.observer(v.callback,r,v.options));return I(()=>{Ut.forEach(v=>v.reset()),n?.disconnect(),o(),i(),s(),a(),l(),c(),u(),d(),p(),y(),f(),m(),h.forEach(v=>v())})}function Oi(e){return typeof window[e]<"u"}function Ii(e){return!!(typeof window[e]<"u"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}var Qi=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}},ql=class{constructor(t){S(this,"iframes",new WeakMap),S(this,"crossOriginIframeMap",new WeakMap),S(this,"crossOriginIframeMirror",new Qi(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 Qi(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)})}},Hl=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(!Rn(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(qt(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}},Cr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",UO=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(bn=0;bn<Cr.length;bn++)UO[Cr.charCodeAt(bn)]=bn;var bn,zO=function(e){var t=new Uint8Array(e),r,n=t.length,o="";for(r=0;r<n;r+=3)o+=Cr[t[r]>>2],o+=Cr[(t[r]&3)<<4|t[r+1]>>4],o+=Cr[(t[r+1]&15)<<2|t[r+2]>>6],o+=Cr[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 GO(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=GO(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=zO(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 KO(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=qt(t.CanvasRenderingContext2D.prototype,s,function(l){return function(...c){return he(this.canvas,r,n,!0)||setTimeout(()=>{let u=gy(c,t,this);e(this.canvas,{type:Tr["2D"],property:s,args:u})},0),l.apply(this,c)}});o.push(a)}catch{let a=ds(t.CanvasRenderingContext2D.prototype,s,{set(l){e(this.canvas,{type:Tr["2D"],property:s,args:[l],setter:!0})}});o.push(a)}return()=>{o.forEach(s=>s())}}function qO(e){return e==="experimental-webgl"?"webgl":e}function Rh(e,t,r,n){let o=[];try{let i=qt(e.HTMLCanvasElement.prototype,"getContext",function(s){return function(a,...l){if(!he(this,t,r,!0)){let c=qO(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=qt(e,l,function(u){return function(...d){let p=u.apply(this,d);if(yy(p,i,this),"tagName"in this.canvas&&!he(this.canvas,n,o,!0)){let y=gy(d,i,this),f={type:t,property:l,args:y};r(this.canvas,f)}return p}});s.push(c)}catch{let c=ds(e,l,{set(u){r(this.canvas,{type:t,property:l,args:[u],setter:!0})}});s.push(c)}return s}function HO(e,t,r,n){let o=[];return o.push(...vh(t.WebGLRenderingContext.prototype,Tr.WebGL,e,r,n,t)),typeof t.WebGL2RenderingContext<"u"&&o.push(...vh(t.WebGL2RenderingContext.prototype,Tr.WebGL2,e,r,n,t)),()=>{o.forEach(i=>i())}}var by="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",YO=e=>Uint8Array.from(atob(e),t=>t.charCodeAt(0)),xh=typeof window<"u"&&window.Blob&&new Blob([YO(by)],{type:"text/javascript;charset=utf-8"});function ZO(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 Yl=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 ZO;l.onmessage=f=>{let{id:m}=f.data;if(a.set(m,!1),!("base64"in f.data))return;let{base64:h,type:v,width:w,height:g}=f.data;this.mutationCb({id:m,type:Tr["2D"],commands:[{property:"clearRect",args:[0,0,w,g]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:h}],type:v}]},0,0]}]})};let c=1e3/t,u=0,d,p=()=>{let f=[];return r.document.querySelectorAll("canvas").forEach(m=>{he(m,n,o,!0)||f.push(m)}),f},y=f=>{if(u&&f-u<c){d=requestAnimationFrame(y);return}u=f,p().forEach(async m=>{var h;let v=this.mirror.getId(m);if(a.get(v)||m.width===0||m.height===0)return;if(a.set(v,!0),["webgl","webgl2"].includes(m.__context)){let g=m.getContext(m.__context);((h=g?.getContextAttributes())==null?void 0:h.preserveDrawingBuffer)===!1&&g.clear(g.COLOR_BUFFER_BIT)}let w=await createImageBitmap(m);l.postMessage({id:v,bitmap:w,width:m.width,height:m.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=KO(this.processMutation.bind(this),t,r,n),s=HO(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)}},Zl=class{constructor(t){S(this,"trackedLinkElements",new WeakSet),S(this,"mutationCb"),S(this,"adoptedStyleSheetCb"),S(this,"styleMirror",new Ul),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:Ah(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){}},Jl=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(){}},J,Di,ll,es=!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 _e=QC();function Ht(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:f,maskTextFn:m,hooks:h,packFn:v,sampling:w={},dataURLOptions:g={},mousemoveWait:k,recordDOM:_=!0,recordCanvas:j=!1,recordCrossOriginIframes:te=!1,recordAfter:z=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:Q=!1,collectFonts:ae=!1,inlineImages:Me=!1,plugins:We,keepIframeSrcFn:T=()=>!1,ignoreCSSAttributes:Fr=new Set([]),errorHandler:$r}=e;PO($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),_e.reset();let kt=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},Ue=Lh(y);xO();let Cc,ps=0,Ec=L=>{for(let Fe of We||[])Fe.eventProcessor&&(L=Fe.eventProcessor(L));return v&&!Oe&&(L=v(L)),L};J=(L,Fe)=>{var H;let Y=L;if(Y.timestamp=Ji(),(H=Ut[0])!=null&&H.isFrozen()&&Y.type!==O.FullSnapshot&&!(Y.type===O.IncrementalSnapshot&&Y.data.source===E.Mutation)&&Ut.forEach(Re=>Re.unfreeze()),re)t?.(Ec(Y),Fe);else if(Oe){let Re={type:"rrweb",event:Ec(Y),origin:window.location.origin,isCheckout:Fe};window.parent.postMessage(Re,"*")}if(Y.type===O.FullSnapshot)Cc=Y,ps=0;else if(Y.type===O.IncrementalSnapshot){if(Y.data.source===E.Mutation&&Y.data.isAttachIframe)return;ps++;let Re=n&&ps>=n,B=r&&Y.timestamp-Cc.timestamp>r;(Re||B)&&Di(!0)}};let jn=L=>{J({type:O.IncrementalSnapshot,data:{source:E.Mutation,...L}})},Ac=L=>J({type:O.IncrementalSnapshot,data:{source:E.Scroll,...L}}),Pc=L=>J({type:O.IncrementalSnapshot,data:{source:E.CanvasMutation,...L}}),Dy=L=>J({type:O.IncrementalSnapshot,data:{source:E.AdoptedStyleSheet,...L}}),Ct=new Zl({mutationCb:jn,adoptedStyleSheetCb:Dy}),Et=new ql({mirror:_e,mutationCb:jn,stylesheetManager:Ct,recordCrossOriginIframes:te,wrappedEmit:J});for(let L of We||[])L.getMirror&&L.getMirror({nodeMirror:_e,crossOriginIframeMirror:Et.crossOriginIframeMirror,crossOriginIframeStyleMirror:Et.crossOriginIframeStyleMirror});let fs=new Jl;ll=new Yl({recordCanvas:j,mutationCb:Pc,win:window,blockClass:o,blockSelector:i,mirror:_e,sampling:w.canvas,dataURLOptions:g});let Vn=new Hl({mutationCb:jn,scrollCb:Ac,bypassOptions:{blockClass:o,blockSelector:i,maskTextClass:l,maskTextSelector:c,inlineStylesheet:u,maskInputOptions:kt,dataURLOptions:g,maskTextFn:m,maskInputFn:f,recordCanvas:j,inlineImages:Me,sampling:w,slimDOMOptions:Ue,iframeManager:Et,stylesheetManager:Ct,canvasManager:ll,keepIframeSrcFn:T,processedNodeManager:fs},mirror:_e});Di=(L=!1)=>{if(!_)return;J({type:O.Meta,data:{href:window.location.href,width:oy(),height:ny()}},L),Ct.reset(),Vn.init(),Ut.forEach(H=>H.lock());let Fe=xE(document,{mirror:_e,blockClass:o,blockSelector:i,maskTextClass:l,maskTextSelector:c,inlineStylesheet:u,maskAllInputs:kt,maskTextFn:m,maskInputFn:f,slimDOM:Ue,dataURLOptions:g,recordCanvas:j,inlineImages:Me,onSerialize:H=>{ay(H,_e)&&Et.addIframe(H),ly(H,_e)&&Ct.trackLinkElement(H),Wl(H)&&Vn.addShadowRoot(C.shadowRoot(H),document)},onIframeLoad:(H,Y)=>{Et.attachIframe(H,Y),Vn.observeAttachShadow(H)},onStylesheetLoad:(H,Y)=>{Ct.attachLinkElement(H,Y)},keepIframeSrcFn:T});if(!Fe)return console.warn("Failed to snapshot the document");J({type:O.FullSnapshot,data:{node:Fe,initialOffset:ry(window)}},L),Ut.forEach(H=>H.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&Ct.adoptStyleSheets(document.adoptedStyleSheets,_e.getId(document))};try{let L=[],Fe=Y=>{var Re;return I(WO)({mutationCb:jn,mousemoveCb:(B,hs)=>J({type:O.IncrementalSnapshot,data:{source:hs,positions:B}}),mouseInteractionCb:B=>J({type:O.IncrementalSnapshot,data:{source:E.MouseInteraction,...B}}),scrollCb:Ac,viewportResizeCb:B=>J({type:O.IncrementalSnapshot,data:{source:E.ViewportResize,...B}}),inputCb:B=>J({type:O.IncrementalSnapshot,data:{source:E.Input,...B}}),mediaInteractionCb:B=>J({type:O.IncrementalSnapshot,data:{source:E.MediaInteraction,...B}}),styleSheetRuleCb:B=>J({type:O.IncrementalSnapshot,data:{source:E.StyleSheetRule,...B}}),styleDeclarationCb:B=>J({type:O.IncrementalSnapshot,data:{source:E.StyleDeclaration,...B}}),canvasMutationCb:Pc,fontCb:B=>J({type:O.IncrementalSnapshot,data:{source:E.Font,...B}}),selectionCb:B=>{J({type:O.IncrementalSnapshot,data:{source:E.Selection,...B}})},customElementCb:B=>{J({type:O.IncrementalSnapshot,data:{source:E.CustomElement,...B}})},blockClass:o,ignoreClass:s,ignoreSelector:a,maskTextClass:l,maskTextSelector:c,maskInputOptions:kt,inlineStylesheet:u,sampling:w,recordDOM:_,recordCanvas:j,inlineImages:Me,userTriggeredOnInput:Q,collectFonts:ae,doc:Y,maskInputFn:f,maskTextFn:m,keepIframeSrcFn:T,blockSelector:i,slimDOMOptions:Ue,dataURLOptions:g,mirror:_e,iframeManager:Et,stylesheetManager:Ct,shadowDomManager:Vn,processedNodeManager:fs,canvasManager:ll,ignoreCSSAttributes:Fr,plugins:((Re=We?.filter(B=>B.observer))==null?void 0:Re.map(B=>({observer:B.observer,options:B.options,callback:hs=>J({type:O.Plugin,data:{plugin:B.name,payload:hs}})})))||[]},h)};Et.addLoadListener(Y=>{try{L.push(Fe(Y.contentDocument))}catch(Re){console.warn(Re)}});let H=()=>{Di(),L.push(Fe(document)),es=!0};return["interactive","complete"].includes(document.readyState)?H():(L.push(fe("DOMContentLoaded",()=>{J({type:O.DomContentLoaded,data:{}}),z==="DOMContentLoaded"&&H()})),L.push(fe("load",()=>{J({type:O.Load,data:{}}),z==="load"&&H()},window))),()=>{L.forEach(Y=>{try{Y()}catch(Re){String(Re).toLowerCase().includes("cross-origin")||console.warn(Re)}}),fs.destroy(),es=!1,MO()}}catch(L){console.warn(L)}}Ht.addCustomEvent=(e,t)=>{if(!es)throw new Error("please add custom event after start recording");J({type:O.Custom,data:{tag:e,payload:t}})};Ht.freezePage=()=>{Ut.forEach(e=>e.freeze())};Ht.takeFullSnapshot=e=>{if(!es)throw new Error("please take full snapshot after start recording");Di(e)};Ht.mirror=_e;var kh;(function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"})(kh||(kh={}));var gB=5*1e3;var{addCustomEvent:SB}=Ht,{freezePage:bB}=Ht,{takeFullSnapshot:wB}=Ht;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=Ha(qa("@ripplo/rrweb-bundle/bundle","rrweb.js"));async function _n({clientVersion:e,debugDir:t,writeOtlpPortFile:r}){let n=new Map,o=xf(vy()),i=await Oa({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 XO(l,u),await tI(l,u);let d=[];return{emitAction:p=>{oI(u,p)},emitStepOutcome:p=>{iI(u,p)},finish:()=>rI(u,{pages:d,registry:n,runId:c}),onPage:p=>{d.push(p),nI(u,s,p)}}},debugDir:t,close:async()=>{await i.stop(),await o.terminate()},injectSpan:(l,c)=>{n.get(l)?.emit(c)}}}async function JO(e){await Promise.all(e.map(t=>t.evaluate("globalThis.__ripploFlushRrweb ? globalThis.__ripploFlushRrweb() : undefined").catch(()=>{})))}async function XO(e,t){await e.exposeBinding(Ry,(r,n)=>{let o=typeof n=="string"?n:JSON.stringify(n);t.emitRrwebBatch(Buffer.from(o,"utf8"))})}var QO="__ripploEventPush",eI=Ve.discriminatedUnion("kind",[Ve.object({kind:Ve.literal("console"),level:Ve.string(),text:Ve.string(),timestamp:Ve.number()}),Ve.object({kind:Ve.literal("error"),message:Ve.string(),stack:Ve.string().optional(),timestamp:Ve.number()})]);async function tI(e,t){await e.exposeBinding(QO,(r,n)=>{let o=eI.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:Wt(i.timestamp)});return}t.emit({kind:"error",message:i.message,source:"browser",stack:i.stack,timeNanos:Wt(i.timestamp)})})}async function rI(e,t){await JO(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 nI(e,t,r){r.on("load",()=>{r.addScriptTag({content:t}).catch(()=>{})}),r.on("requestfinished",n=>{dI(e,n).catch(()=>{})}),r.url()!=="about:blank"&&r.addScriptTag({content:t}).catch(()=>{})}function oI(e,t){e.emit({action:t.kind,kind:"action",source:"test",target:lI(t),timeNanos:Wt(Date.now()),value:cI(t)})}function iI(e,t){t.checks.forEach(r=>{e.emit(sI(r,t.stepIndex))}),t.stepError!=null&&e.emit(aI(t.stepError,t.stepIndex))}function sI(e,t){return{...e.body,kind:"check",origin:$o(e.target,t),source:"verifier",stepIndex:t,timeNanos:Wt(e.atMs)}}function aI(e,t){return{error:e.error,kind:"stepError",source:"verifier",stepIndex:t,timeNanos:Wt(e.atMs)}}function lI(e){if(e.url!=null)return e.url;if(e.locator!=null)return Un(e.locator)}function cI(e){return e.value!=null?typeof e.value=="object"?JSON.stringify(e.value):String(e.value):e.key}var uI=/^http:\/\/127\.0\.0\.1:\d+\/rrweb\//;async function dI(e,t){if(uI.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 pI(r):void 0,source:"browser",spanId:s?.[2],status:r.status(),timeNanos:Wt(a>0?a:Date.now()),traceId:s?.[1],url:r.url()})}async function pI(e){try{return await e.text()}catch{return}}function Bn(e){return{aborted:!0,contradictions:[],failed:!1,findings:[],ran:[],teardown:e}}function vc(e,t){return new Rc(kI(e,t))}function mI(e,t){return new Rc(yI(e,t))}async function yI(e,t){let r=await mf(e.profileDir).catch(()=>{});if(r==null)return Yt(ze(new Error("launch")));try{return Lr(await gI({context:r,params:e,signal:t}))}catch(n){return Yt(ze(n))}finally{await r.close().catch(ke)}}async function gI({context:e,params:t,signal:r}){let n=e.pages()[0]??await e.newPage(),o=await _n({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 SI(e,r),await i.finish(),await o.close(),{behaviorPath:fI.join(t.debugDir,t.runId,"behavior.jsonl")}}function SI(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 bI(e,t){return new Rc(wI(e,t))}async function wI(e,t){let r=RI(e),n=Py({lockfile:e.lockfile,options:e.options,runId:e.runId,signal:t}),o=async i=>{try{return Lr(await vI({established:i,params:e,signal:t}))}catch(s){return await i.teardown().match(ke,ke),Yt(Zn(s)?s:ze(s))}};return Ay(n,r).match(o,async i=>(await xc(n.teardown),Yt(i)))}function RI(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 vI({established:e,params:t,signal:r}){let n=li({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 xI(o,s.context),await e.teardown().match(ke,ke),await n.close(),{kind:"handed-over",ran:i.ran.length})}function xI(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 kI({browser:e,hub:t,request:r},n){if(n.aborted)return Lr(Bn("skipped"));let o=Py({lockfile:r.lockfile,options:r.options,runId:r.runId,signal:n}),i=async s=>{try{return await EI({browser:e,established:s,hub:t,request:r,signal:n})}catch(a){return Yt(Zn(a)?a:ze(a))}};return Ay(o,r).match(i,s=>CI(s,o.teardown))}async function CI(e,t){return e.kind!=="aborted"?Yt(e):Lr(Bn(await xc(t)))}function xc(e){return e().match(()=>"done",()=>"failed")}async function EI(e){let t=await AI(e);if(t.kind==="completed"){let n=Date.now();return e.established.teardown().match(()=>(e.request.onPhase?.("teardown",Date.now()-n),Lr({aborted:!1,...t.result})),o=>Yt(o))}let r=await xc(e.established.teardown);if(t.kind==="aborted")return Lr(Bn(r));throw t.error}function Cy(e,t,r){return Jr(e,t).map(n=>({params:{...Xo(n),...r},transition:n}))}async function Ey(e){let{established:t,lockfile:r,signal:n}=e,o=Date.now(),i=await ja({baseUrl:e.options.baseUrl,browser:e.browser,capture:e.capture,clientState:t.clientState,engine:La(OI(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=sr(r),a=Date.now(),l=await Zo({canon:Bo(r),classify:_o(r),dataRules:s.dataRules,driver:i.driver,facts:{facts:Gs(s.facts,ee(e.test)),overlays:Xe(r),overrides:s.overrides},initialState:{base:t.env,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 AI({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 sn(i)?{kind:"aborted"}:{error:i,kind:"threw"}}}function Ay(e,t){let r=Date.now();return e.ready().andThen(()=>{t.onPhase?.("engine",Date.now()-r);let n=Date.now();return pr(t.lockfile,t.test,{generate:Wn(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,env:o.env,generated:o.generated,generatedSingletons:o.generatedSingletons,observeActor:o.principals.size>0,reader:e.reader,signInActor:PI(e.signIn,o.principals),snapshot:o.snapshot,teardown:e.teardown}))})}function PI(e,t){return r=>{let n=t.get(r);return n==null?hI(ze(new Error(`no seeded principal for actor "${r}"`))):e({entity:n.entity,row:n.row})}}function Py({lockfile:e,options:t,runId:r,signal:n}){let o=Ka({baseUrl:t.engineUrl,extraHeaders:void 0,runId:r,secret:t.secret},n);return{materialize:Go(o.setupWorld),reader:za(e.entities,MI(e),o.query),ready:o.ready,signIn:o.signIn,teardown:o.teardown}}function MI(e){return e.singletons.filter(t=>t.source==="backend").map(t=>t.name)}function OI(e){return e.singletons.filter(t=>t.source==="client").map(t=>t.name)}import{err as II,ok as TI,ResultAsync as LI}from"neverthrow";function NI({cacheDir:e,clientVersion:t,debugDir:r,headed:n,writeOtlpPortFile:o}){let i=li({cacheDir:e,headed:n}),s,a,l=async()=>(s??=_n({clientVersion:t,debugDir:r,writeOtlpPortFile:o}),a=await s,a),c=async(p,y)=>{if(y.aborted)return TI(Bn("skipped"));try{let f=await l();if(p.options.headed&&!n)return await Va(!0,async h=>vc({browser:h,hub:f,request:p},y));let m=await i.acquire();return await vc({browser:m,hub:f,request:p},y)}catch(f){return II(ze(f))}};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 LI(c(p,y))}}import{z as A}from"zod";function FI(e){let t=e.split(`
65
+ `).map(o=>JI(o)).filter(o=>o!=null),r=GI(t),n=t.map(o=>BI(o,r)).filter(o=>o!=null).filter(o=>o.kind==="input"||o.element!=null);return $I(n)}function $I(e){return e.filter((t,r)=>{let n=e[r+1];return!(t.kind==="input"&&n?.kind==="input"&&DI(t.element,n.element))})}function DI(e,t){return e?.testId===t?.testId&&e?.ariaLabel===t?.ariaLabel&&e?.placeholder===t?.placeholder}var _I={2:"click",3:"contextmenu",4:"dblclick"};function BI(e,t){return e.rrwebType==="IncrementalSnapshot:MouseInteraction"?jI(e,t):e.rrwebType==="IncrementalSnapshot:Input"?VI(e,t):null}function jI(e,t){let r=nT.safeParse(e.event.data);if(!r.success)return null;let n=_I[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 VI(e,t){let r=oT.safeParse(e.event.data);return r.success?{element:Oy(r.data.id,t),kind:"input",timeNanos:e.timeNanos,value:r.data.text??WI(r.data.isChecked)}:null}function WI(e){return e==null?void 0:String(e)}var UI=new Set(["button","a","input","select","textarea","summary"]);function My(e,t){let r=t.get(e);if(r!=null)return zI(r)?e:r.parentId==null?void 0:My(r.parentId,t)}function zI(e){return e.attrs["data-testid"]!=null||e.attrs["aria-label"]!=null||e.attrs.role!=null||UI.has(e.tag??"")}function Oy(e,t){let r=e==null?void 0:t.nodes.get(e);if(!(r==null||e==null))return{ariaLabel:Nr(r,"aria-label"),href:Nr(r,"href"),name:Nr(r,"name"),placeholder:Nr(r,"placeholder"),role:Nr(r,"role"),tag:r.tag,testId:Nr(r,"data-testid"),text:Iy(e,t)}}function Nr(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 GI(e){let t=e.flatMap(o=>KI(o).flatMap(i=>kc(i,void 0))),r=e.flatMap(o=>qI(o).flatMap(i=>kc(i.node,i.parentId??void 0))),n=YI(new Map([...t,...r]),e);return{children:HI(n),nodes:n}}function KI(e){if(e.rrwebType!=="FullSnapshot")return[];let t=eT.safeParse(e.event.data);return t.success?[t.data.node]:[]}function qI(e){if(e.rrwebType!=="IncrementalSnapshot:Mutation")return[];let t=Ty.safeParse(e.event.data);return t.success?t.data.adds.flatMap(r=>{let n=tT.safeParse(r);return n.success?[n.data]:[]}):[]}function HI(e){let t=new Map;return e.forEach((r,n)=>{r.parentId!=null&&t.set(r.parentId,[...t.get(r.parentId)??[],n])}),t}function kc(e,t){let r=QI.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=>kc(s,n.id))]}function YI(e,t){return t.flatMap(n=>ZI(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 ZI(e){if(e.rrwebType!=="IncrementalSnapshot:Mutation")return[];let t=Ty.safeParse(e.event.data);return t.success?t.data.attributes.flatMap(r=>{let n=rT.safeParse(r);return n.success?[n.data]:[]}):[]}function JI(e){if(e.trim().length===0)return null;let t=iT.safeParse(XI(e));return t.success?t.data:null}function XI(e){try{return JSON.parse(e)}catch{return null}}var QI=A.object({attributes:A.record(A.string(),A.unknown()).optional(),childNodes:A.array(A.unknown()).optional(),id:A.number(),tagName:A.string().optional(),textContent:A.string().optional()}),eT=A.object({node:A.unknown()}),tT=A.object({node:A.unknown(),parentId:A.number().nullable().default(null)}),rT=A.object({attributes:A.record(A.string(),A.unknown()),id:A.number()}),Ty=A.object({adds:A.array(A.unknown()).default([]),attributes:A.array(A.unknown()).default([])}),nT=A.object({id:A.number(),type:A.number()}),oT=A.object({id:A.number(),isChecked:A.boolean().optional(),text:A.string().optional()}),iT=A.object({event:A.object({data:A.unknown()}),kind:A.literal("rrweb"),rrwebType:A.string(),timeNanos:A.string()});function sT(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 aT(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=mr(r.contradictions);if(o.length===0)return{kind:"clean",ranCount:r.ranCount,timing:{confirm:void 0,detect:r.timing}};let i=fn(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}:lT(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"&&Jn(r.record.error));return t!=null&&t.kind==="stepError"?t.record.error:void 0}async function lT(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=mr(o.contradictions);return a.length===0||fn(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:cT(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:sT(a)},c=>({error:c,kind:"error"}))}function cT(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 oi(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 uT({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=mr(u.contradictions);return d.length>0?{contradictions:d,kind:"still-fails"}:{kind:"resolved"}},u=>({kind:"state-unavailable",reason:u.kind}))}export{ee as a,Z as b,Zr as c,Jn as d,su as e,_r as f,Te as g,Dd as h,Oo as i,To as j,Lo as k,jd as l,nn as m,ct as n,So as o,Yo as p,Xt as q,vd as r,ko as s,Id as t,kp as u,Cp as v,Ep as w,Ap as x,Mp as y,Op as z,Tp as A,Vd as B,No as C,Fo as D,Fp as E,Vp as F,Up as G,zp as H,Gp as I,qp as J,Hp as K,ri as L,oi as M,Yp as N,qa as O,Ha as P,Oa as Q,mI as R,bI as S,Cy as T,NI as U,FI as V,aT as W,$y as X,uT 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
+ */