ripplo 0.9.0 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/dist/{chunk-FR4ENKCT.js → chunk-4XC5TAOG.js} +1 -1
  2. package/dist/{chunk-U27IDW6O.js → chunk-6BQADUAX.js} +2 -2
  3. package/dist/{chunk-XVMIPWJQ.js → chunk-INO3L4WS.js} +1 -1
  4. package/dist/chunk-MG43RZXH.js +83 -0
  5. package/dist/{chunk-AYDIXOW2.js → chunk-MMCOPC4L.js} +1 -1
  6. package/dist/{chunk-QQ7NFPJQ.js → chunk-NEPJCCQS.js} +1 -1
  7. package/dist/{chunk-PRD7P6EF.js → chunk-RWFS5SCW.js} +1 -1
  8. package/dist/{chunk-V4IQQT44.js → chunk-SFWAAS5H.js} +1 -1
  9. package/dist/{chunk-JXGIARTE.js → chunk-TY5K3P4F.js} +1 -1
  10. package/dist/{chunk-EA62LNKT.js → chunk-UMSBDSRS.js} +1 -1
  11. package/dist/{chunk-ZDA3E2AS.js → chunk-YODZBLYM.js} +1 -1
  12. package/dist/{compile-write-H2GLCECO.js → compile-write-4ZAIPQMG.js} +1 -1
  13. package/dist/{daemon-3J3K4BOD.js → daemon-MZWLJO75.js} +1 -1
  14. package/dist/{daemon-AS6IHTHD.js → daemon-YPXZGJAB.js} +1 -1
  15. package/dist/hook.js +1 -1
  16. package/dist/index.js +182 -175
  17. package/dist/{plan-reminder-E6AXT6OB.js → plan-reminder-45PSVOVW.js} +1 -1
  18. package/dist/{post-edit-LUPA46ZO.js → post-edit-JHJT2QTK.js} +1 -1
  19. package/dist/{post-edit-analyze-XY6C7ZFP.js → post-edit-analyze-PPFHKIYQ.js} +1 -1
  20. package/dist/{post-edit-flag-stubs-ZMKN4DJZ.js → post-edit-flag-stubs-Q3UKDZ2W.js} +1 -1
  21. package/dist/{prompt-submit-U3QOU47D.js → prompt-submit-ZCDG6T4Y.js} +1 -1
  22. package/dist/{session-preamble-IHBGHKCW.js → session-preamble-ZYVRDSGA.js} +1 -1
  23. package/dist/status-66XIDYSP.js +4 -0
  24. package/dist/{stop-enforce-ZLQKGMSF.js → stop-enforce-Q4JNBYQU.js} +1 -1
  25. package/package.json +4 -4
  26. package/dist/chunk-BR7W4UBJ.js +0 -83
  27. package/dist/status-247DEYFK.js +0 -4
@@ -1,83 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __ripploCreateRequire } from "node:module";
3
- const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
4
- import{$ as _c,A as Mc,B as Oc,C as V,D as we,G as cs,H as Ic,I as Vn,J as Tc,N as Wn,O as Nc,S as $c,T as Lc,U as Dc,V as Fc,_ as ot,a as S,b as Rc,ba as jc,c as ls,d as rt,e as _n,f as de,g as vc,h as nt,i as _r,j as jn,k as Bn,l as xc,p as Ec,q as kc,r as pe,s as ye,t as Qt,u as Cc,v as Lt,w as it,x as Ee,y as Ac,z as Pc}from"./chunk-4F67XQYS.js";import{a as Iy}from"./chunk-NNH3YVVO.js";import{a as Oy,b as wc}from"./chunk-KMZ3L5YA.js";var Ad=Oy((EN,Qs)=>{"use strict";var gi=process||{},kd=gi.argv||[],yi=gi.env||{},qb=!(yi.NO_COLOR||kd.includes("--no-color"))&&(!!yi.FORCE_COLOR||kd.includes("--color")||gi.platform==="win32"||(gi.stdout||{}).isTTY&&yi.TERM!=="dumb"||!!yi.CI),Kb=(e,t,r=e)=>n=>{let i=""+n,o=i.indexOf(t,e.length);return~o?e+Hb(i,t,r,o)+t:e+i+t},Hb=(e,t,r,n)=>{let i="",o=0;do i+=e.substring(o,n)+r,o=n+t.length,n=e.indexOf(t,o);while(~n);return i+e.substring(o)},Cd=(e=qb)=>{let t=e?Kb:()=>String;return{isColorSupported:e,reset:t("\x1B[0m","\x1B[0m"),bold:t("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:t("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:t("\x1B[3m","\x1B[23m"),underline:t("\x1B[4m","\x1B[24m"),inverse:t("\x1B[7m","\x1B[27m"),hidden:t("\x1B[8m","\x1B[28m"),strikethrough:t("\x1B[9m","\x1B[29m"),black:t("\x1B[30m","\x1B[39m"),red:t("\x1B[31m","\x1B[39m"),green:t("\x1B[32m","\x1B[39m"),yellow:t("\x1B[33m","\x1B[39m"),blue:t("\x1B[34m","\x1B[39m"),magenta:t("\x1B[35m","\x1B[39m"),cyan:t("\x1B[36m","\x1B[39m"),white:t("\x1B[37m","\x1B[39m"),gray:t("\x1B[90m","\x1B[39m"),bgBlack:t("\x1B[40m","\x1B[49m"),bgRed:t("\x1B[41m","\x1B[49m"),bgGreen:t("\x1B[42m","\x1B[49m"),bgYellow:t("\x1B[43m","\x1B[49m"),bgBlue:t("\x1B[44m","\x1B[49m"),bgMagenta:t("\x1B[45m","\x1B[49m"),bgCyan:t("\x1B[46m","\x1B[49m"),bgWhite:t("\x1B[47m","\x1B[49m"),blackBright:t("\x1B[90m","\x1B[39m"),redBright:t("\x1B[91m","\x1B[39m"),greenBright:t("\x1B[92m","\x1B[39m"),yellowBright:t("\x1B[93m","\x1B[39m"),blueBright:t("\x1B[94m","\x1B[39m"),magentaBright:t("\x1B[95m","\x1B[39m"),cyanBright:t("\x1B[96m","\x1B[39m"),whiteBright:t("\x1B[97m","\x1B[39m"),bgBlackBright:t("\x1B[100m","\x1B[49m"),bgRedBright:t("\x1B[101m","\x1B[49m"),bgGreenBright:t("\x1B[102m","\x1B[49m"),bgYellowBright:t("\x1B[103m","\x1B[49m"),bgBlueBright:t("\x1B[104m","\x1B[49m"),bgMagentaBright:t("\x1B[105m","\x1B[49m"),bgCyanBright:t("\x1B[106m","\x1B[49m"),bgWhiteBright:t("\x1B[107m","\x1B[49m")}};Qs.exports=Cd();Qs.exports.createColors=Cd});function ne(e){return`${e.workflow}/${e.slug}`}var Bc=new WeakMap;function J(e){let t=Bc.get(e);if(t!=null)return t;let r=e.workflows.flatMap(n=>n.tests.map(i=>({ref:ne(i),test:i,workflow:n})));return Bc.set(e,r),r}function us({onlyFirst:e=!1}={}){let i="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(i,e?void 0:"g")}var Ty=us();function ds(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!e.includes("\x1B")&&!e.includes("\x9B")?e:e.replace(Ty,"")}function ps(e,t,r){return{detail:r.slice(0,500),kind:"engine-http",path:e,status:t}}function er(e,t){return{code:Gc(t),kind:"engine-network",message:Br(t),path:e}}function Un(e){return{kind:"client-mount-missing",mountKey:e}}function fs(e,t){return{kind:"app-not-ready",readyKey:e,timeoutMs:t}}function hs(e,t){return{kind:"engine-decode",message:Br(t),path:e}}function ms(e,t){return{entity:e,field:t,kind:"state-identity"}}function ys(e){return{as:e,kind:"setup-missing-row"}}function Ue(e){return{kind:"driver-launch",message:Br(e)}}function gs(e){return{kind:"engine-unreachable",url:e}}function Ss(e,t){return{action:e,kind:"action-failed",message:Br(t)}}function bs(e){return{kind:"check-failed",message:Br(e)}}function ws(){return{kind:"aborted"}}var Ny=["aborted","action-failed","app-not-ready","check-failed","client-mount-missing","conflicting-sessions","driver-launch","engine-decode","engine-http","engine-network","engine-unreachable","setup-missing-row","state-identity"],$y=new Set(Ny);function zn(e){if(typeof e!="object"||e==null||!("kind"in e))return!1;let{kind:t}=e;return typeof t=="string"&&$y.has(t)}var Ly=["app-not-ready","client-mount-missing","driver-launch","engine-decode","engine-http","engine-network","engine-unreachable"],Wc=new Set(Ly);function Gn(e){return Wc.has(e.kind)}function Uc(e){return Wc.has(e)}var Vc=300;function jr(e){switch(e.kind){case"engine-http":return`engine ${e.path} returned ${String(e.status)}: ${zc(e.detail)}${jy(e.status)}`;case"engine-network":return`engine ${e.path} request failed: ${e.message}${Dy(e.code)}${_y(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"conflicting-sessions":return`world established ${String(e.count)} distinct auth sessions in one browser context; sessions are exclusive \u2014 a single context holds one signed-in user`;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"action-failed":return`action "${e.action}" failed: ${e.message}`;case"check-failed":return`check failed: ${e.message}`;case"aborted":return"run aborted"}}function ze(){}function zc(e){let t=e.replaceAll(/\s+/gu," ").trim();return t.length<=Vc?t:`${t.slice(0,Vc)}\u2026 [truncated]`}function Dy(e){return e==null?"":` (${e})`}var Fy=new Set(["EAI_AGAIN","ECONNREFUSED","ENOTFOUND"]);function _y(e,t){return e!=null&&Fy.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 jy(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 Gc(e){if(!(typeof e!="object"||e==null))return"code"in e&&typeof e.code=="string"?e.code:"cause"in e?Gc(e.cause):void 0}function Br(e){let t=e instanceof Error?e.message:String(e);return zc(ds(t))}var qc=new WeakMap;function tr(e){let t=qc.get(e);if(t!=null)return t;let r={entities:e.entities,singletonSchemas:e.singletons,valueSpaces:e.valueSpaces};return jc(r,e.solved),qc.set(e,r),r}import{createHash as ES}from"crypto";import{z as By}from"zod";import{stringify as Vy}from"safe-stable-stringify";var Rs=By.string().brand(),M=Rs.parse("");function $e(e){return Rs.parse(e)}function ke(e,t){return Rs.parse(e.length===0?t:`${e}.${t}`)}function U(e){return Rc.safeParse(e).success}function Kc(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 Hc(e){return typeof e!="string"&&"count"in e}var st=class extends Error{subject;constructor(t){super(t),this.subject=t}};function Re(e){return{counts:void 0,env:e}}function vs(e,t,r){let n=ke(t,e.ref);if(!r.has(n))throw new st(n);return r.get(n)??null}function Vr(e,t,r){return qn(e).every(n=>r.has(ke(t,n)))}function qe(e,t,r){return typeof e=="string"?e:U(e)?String(vs(e,t,r.env)):e.template.map(n=>Uy(n,t,r)).join("")}function Ce(e,t,r){return e===null||typeof e=="number"||typeof e=="boolean"?e:U(e)?vs(e,t,r.env):qe(e,t,r)}function Yc(e,t){return Ce(e,M,t)}function Wr(e){return Vy(e)}function rr(e,t,r){return Object.fromEntries(Object.entries(e).map(([n,i])=>[n,Ce(i,t,r)]))}function qn(e){return e==null||typeof e!="object"?[]:Ge(e)?e.template.flatMap(t=>typeof t=="string"?[]:Hc(t)?Wy(t):[t.ref]):[e.ref]}function Wy(e){return Object.values(e.count.where).flatMap(t=>Xc(t))}function Xc(e){return e==null||typeof e!="object"?[]:"kind"in e?e.kind==="within"?Object.values(e.selection.where).flatMap(t=>Xc(t)):e.kind==="anyOf"?e.values.flatMap(t=>qn(t)):qn(e.value):qn(e)}function Uy(e,t,r){if(typeof e=="string")return e;if(!Hc(e))return String(vs(e,t,r.env));if(r.counts==null)throw new st(e.count.entity);return String(r.counts(e,r.env))}function ae(e,t){return e.by==="role"?{by:"role",name:e.name==null?void 0:qe(e.name,M,t),role:e.role}:e.by==="inside"?{by:"inside",scope:ae(e.scope,t),target:ae(e.target,t)}:e.by==="surface"?{by:"surface",container:ae(e.container,t),overlay:e.overlay}:e.by==="frame"?{by:"frame",element:ae(e.element,t)}:{by:"testId",value:qe(e.value,M,t)}}var zy="https://ripplo.invalid";var Zc={hash:void 0,path:void 0,query:{},title:void 0,viewport:void 0};function Qc(e){return e.kind!=="title"&&e.kind!=="viewport"}function nr(e){return e.kind==="query"?`url query "${e.key}"`:e.kind==="title"||e.kind==="viewport"?e.kind:`url ${e.kind}`}function Kn(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 Ur(e){let t=new URL(e,zy),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 eu(e){if(typeof e=="string")return Jc(Ur(e));let t=U(e)?[e]:e.template,r=t.findIndex(c=>typeof c=="string"&&/[?#]/.test(c)),n=t[r];if(r===-1||typeof n!="string")return{...Zc,path:e};let i=[...t.slice(0,r),n.slice(0,n.search(/[?#]/))].filter(c=>typeof c!="string"||c.length>0),o=t.slice(r),s={template:i};if(o.some(c=>typeof c!="string"))return{...Zc,path:s};let a=o.filter(c=>typeof c=="string").join(""),l=Ur(`/p${a.slice(a.search(/[?#]/))}`);return{...Jc(l),path:s}}function tu(e){let r=[[{kind:"path"},e.path],[{kind:"hash"},e.hash],[{kind:"title"},e.title],[{kind:"viewport"},e.viewport]].flatMap(([i,o])=>o===void 0?[]:[{clause:o,key:i}]),n=Object.entries(e.query).map(([i,o])=>({clause:o,key:{key:i,kind:"query"}}));return[...r,...n]}function Jc(e){return{hash:e.hash,path:e.path,query:e.query,title:e.title,viewport:e.viewport}}var Le=new Map;function v(e){return e.kind!=="element"?S(e):_n(e.locator,e.state)}function at(e,t){return new Map([...ru(e,t),[v(t.subject),t]])}function xs(e,t){return new Map([...ru(e,t),[v(t.subject),t]])}function Ae(e,t){return new Map([...e,...t])}function Es(e){return e.kind==="element"}function wt(e){return e.kind==="path"||e.kind==="query"||e.kind==="hash"}function le(e,t){let r=e.get(v(t));return r==null||r.expect.expect!=="is"?void 0:r.expect.value}function or(e){let t=Ur(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,i])=>i===void 0?[]:[[v(n),{declared:!0,expect:{expect:"is",value:i},subject:n}]]))}function ks(e){return[...e].toSorted(([t],[r])=>t.localeCompare(r))}function ru(e,t){return Gy(t)?qy(e,t.subject):Hy(t)?Yy(e,t.subject):e}function Gy(e){return e.subject.kind==="element"&&e.subject.state==="visible"&&e.expect.expect==="is"&&e.expect.value===!1}function qy(e,t){if(t.kind!=="element")return e;let r=S(de(t.locator)),n=[...e].filter(([,i])=>Ky(i,r));return n.length===e.size?e:new Map(n)}function Ky(e,t){if(e.subject.kind!=="element")return!0;let r=de(e.subject.locator);return zr(r,t)?!1:S(r)!==t?!0:e.subject.state!=="text"&&e.subject.state!=="value"}function zr(e,t){return e.by==="frame"?S(e.element)===t||zr(e.element,t):e.by!=="inside"?!1:S(e.scope)===t||S(e.target)===t||zr(e.scope,t)||zr(e.target,t)}function Hy(e){return e.subject.kind==="element"&&e.subject.state==="visible"&&e.expect.expect==="is"&&e.expect.value===!0&&nu(e.subject.locator)}function nu(e){return e.by==="surface"&&e.overlay}function Yy(e,t){if(t.kind!=="element")return e;let r=S(de(t.locator)),n=[...e].filter(([,i])=>Xy(i,r));return n.length===e.size?e:new Map(n)}function Xy(e,t){if(e.subject.kind!=="element"||nu(e.subject.locator))return!0;let r=de(e.subject.locator);return S(r)===t||zr(r,t)}function lt({declared:e,entry:t,scope:r}){let n=t.subject.kind==="element"?{...t.subject,locator:ae(t.subject.locator,r)}:t.subject;if(t.expect.expect==="absent")return{declared:e,expect:{expect:"absent"},subject:n};let i=Ce(t.expect.value,M,r),o=Qy(n)&&typeof i=="number"?String(i):i;return{declared:e,expect:{expect:t.expect.expect,value:o},subject:n}}function Dt({got:e,subject:t,want:r}){if(r.expect==="absent")return e===void 0;if(Zy(t)){let n=Jy(e,r.value);return r.expect==="is"?n:!n}return r.expect==="is"?e===r.value:e!==r.value}function Zy(e){return e.kind==="element"&&e.state==="text"}function ir(e){return e.replaceAll(/\s+/gu," ").trim()}function Jy(e,t){return typeof e=="string"&&typeof t=="string"&&ir(e)===ir(t)}function Qy(e){return e.kind==="element"&&(e.state==="value"||e.state==="text")}import eg from"better-sqlite3";var iu={current:null};function Hn(){let e=iu.current;if(e!=null)return e;let t={columns:new Map,db:new eg(":memory:"),loaded:null,statements:new Map};return iu.current=t,t}function Ft(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 Ke(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 i=e.columns.get(t);r.filter(s=>i?.has(s)!==!0).forEach(s=>{e.db.exec(`ALTER TABLE "${t}" ADD COLUMN "${s}"`),i?.add(s),e.loaded=null})}function Yn(e,t){t.entities.forEach((r,n)=>{let i=[...new Set([...r.values()].flatMap(o=>Object.keys(o)))];Ke(e,n,i)})}function Gr(e,t,r){Ke(e,t,Object.keys(r)),Object.values(r).forEach(n=>{pe(n)&&(Ke(e,n.selection.entity,[n.field]),Gr(e,n.selection.entity,n.selection.where))})}function Xn(e,t){e.loaded!==t&&(e.columns.forEach((r,n)=>{Ft(e,`DELETE FROM "${n}"`).run();let i=t.entities.get(n);if(i==null||i.size===0)return;let o=[...r],s=o.map(d=>`"${d}"`).join(", "),a=o.map(()=>"?").join(", "),l=o.length===0?"(__as)":`(__as, ${s})`,c=o.length===0?"(?)":`(?, ${a})`,u=Ft(e,`INSERT INTO "${n}" ${l} VALUES ${c}`);i.forEach((d,p)=>{u.run(p,...o.map(m=>tg(d[m])))})}),e.loaded=t)}function tg(e){return typeof e=="boolean"?e?1:0:typeof e=="string"||typeof e=="number"?e:e instanceof Date?e.toISOString():null}function Cs({entity:e,snapshot:t,where:r}){let n=Hn();Gr(n,e,r),Yn(n,t),Xn(n,t);let o=`SELECT r.__as AS __as FROM "${e}" r WHERE ${vt(r,{depth:0,refExpr:rg,row:"r"})} ORDER BY r.rowid`;return Ft(n,o).all().flatMap(s=>{let a=s!=null&&typeof s=="object"?Reflect.get(s,"__as"):null;return typeof a=="string"?[a]:[]})}function ou(e){let t=e.snapshot.entities.get(e.entity);return t==null||t.size===0?[]:Cs(e).flatMap(r=>{let n=t.get(r);return n==null?[]:[n]})}function rg(e){throw new Error(`sql-where: unresolved ref "${e}" \u2014 resolve refs before matching`)}function vt(e,t){let r=Object.entries(e).map(([n,i])=>ng({column:`${t.row}."${n}"`,scope:t,want:i}));return r.length===0?"1":r.join(" AND ")}function ng({column:e,scope:t,want:r}){if(pe(r)){let n=`w${String(t.depth)}`,i=vt(r.selection.where,{...t,depth:t.depth+1,row:n});return`${e} IN (SELECT ${n}."${r.field}" FROM "${r.selection.entity}" ${n} WHERE ${i})`}return ye(r)?og({column:e,scope:t,want:r}):`${e} IS ${_t(r,t.refExpr)}`}function _t(e,t){let r=ig(e);if(r!=null)return t(r);if(e instanceof Date)return Rt(e.toISOString());if(e!=null&&typeof e=="object")throw new Error("sql-where: template values must be resolved before compiling");return Rt(e)}function Rt(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 ig(e){if(e!=null&&typeof e=="object"&&"ref"in e)return typeof e.ref=="string"?e.ref:void 0}function og({column:e,scope:t,want:r}){let{refExpr:n}=t;if(r.kind==="not")return`${e} IS NOT ${_t(r.value,n)}`;if(r.kind==="anyOf")return`(${r.values.map(o=>`${e} IS ${_t(o,n)}`).join(" OR ")})`;if(r.kind==="compare"){let i={gt:">",gte:">=",lt:"<",lte:"<="}[r.op];return`${e} ${i} ${_t(r.value,n)}`}return r.kind==="contains"?`instr(${e}, ${_t(r.value,n)}) > 0`:`substr(${e}, 1, length(${_t(r.value,n)})) IS ${_t(r.value,n)}`}function xt(e){return typeof e=="object"&&e!==null&&"kind"in e}function Et(e){return Object.fromEntries(Object.entries(e).filter(t=>!xt(t[1])))}function Ps(e){return new Map(e.entities.filter(t=>t.identityKind==="surrogate").map(t=>[t.name,t.identity]))}function ge(e){return(t,r)=>ct(e,t.count.entity,t.count.where,r).length}function sr(e,t,r){return t.reduce((n,i)=>lg(n,i,r,e),e)}function su(e,{clears:t,forget:r,sets:n}){let i=new Set(t),o=sg(e,r,n),s=[...e.scalars].filter(([l,c])=>!i.has(l)&&!(o&&(Es(c.subject)||ag(c.subject)))),a=[...n.values()].reduce((l,c)=>at(l,c),new Map(s));return{...e,scalars:a}}function sg(e,t,r){if(t==="hard")return!0;if(t==="none")return!1;let n=le(e.scalars,{kind:"path"}),i=le(r,{kind:"path"});return i!==void 0&&i!==n}function ag(e){return e.kind==="query"||e.kind==="hash"}function lg(e,t,r,n){let{env:i,identities:o}=r;if(!dg(t,i))return e;if(t.assertion.kind==="created"){let l=rr(t.assertion.props,M,{counts:ge(e),env:i}),c=cg({entity:t.entity,identities:o,props:l},e);return fg(e,t.entity,Wr(c),c)}let s=cu({entity:t.entity,env:i,key:t.key,snapshot:n});if(t.assertion.kind==="deleted")return As(e,t.entity,l=>new Map([...l].filter(([c])=>!s.has(c))));let a=rr(Et(t.assertion.props),M,{counts:ge(e),env:i});return As(e,t.entity,l=>new Map([...l].map(([c,u])=>s.has(c)?[c,{...u,...a}]:[c,u])))}var Ms="#surrogate#";function au(e){return typeof e=="string"&&e.includes(Ms)}function cg({entity:e,identities:t,props:r},n){let i=(t.get(e)??[]).filter(a=>!(a in r));if(i.length===0)return r;let o=ug(n.entities.get(e),e),s=Object.fromEntries(i.map(a=>[a,`${e}${Ms}${String(o)}`]));return{...r,...s}}function ug(e,t){let r=`${t}${Ms}`;return[...(e??new Map).values()].flatMap(i=>Object.values(i)).filter(i=>typeof i=="string"&&i.startsWith(r)).map(i=>Number(i.slice(r.length))).filter(i=>Number.isFinite(i)).reduce((i,o)=>Math.max(i,o),0)+1}function dg(e,t){return("props"in e.assertion?[e.key,Et(e.assertion.props)]:[e.key]).every(n=>Object.values(n).every(i=>pe(i)||pg(i).every(o=>!U(o)||t.has($e(o.ref)))))}function pg(e){return ye(e)?e.kind==="anyOf"?e.values:[e.value]:[e]}function fg(e,t,r,n){let i=new Map([...e.entities.get(t)??[],[r,n]]);return{...e,entities:new Map([...e.entities,[t,i]])}}function As(e,t,r){let n=r(e.entities.get(t)??new Map);return{...e,entities:new Map([...e.entities,[t,n]])}}function ct(e,t,r,n){return ou({entity:t,snapshot:e,where:Os(r,{env:n,snapshot:e})})}function lu(e,t,r,n,i){let o=cu({entity:t,env:n,key:r,snapshot:e});return As(e,t,s=>new Map([...s].map(([a,l])=>[a,o.has(a)?i(l):l])))}function cu({entity:e,env:t,key:r,snapshot:n}){return new Set(Cs({entity:e,snapshot:n,where:Os(r,{env:t,snapshot:n})}))}function Os(e,t){return Object.fromEntries(Object.entries(e).map(([r,n])=>[r,hg(n,t)]))}function hg(e,t){return pe(e)?{...e,selection:{...e.selection,where:Os(e.selection.where,t)}}:ye(e)?e.kind==="anyOf"?{...e,values:e.values.map(r=>Zn(r,t))}:e.kind==="contains"||e.kind==="startsWith"?{...e,value:String(Zn(e.value,t))}:{...e,value:Zn(e.value,t)}:Zn(e,t)}function Zn(e,t){return Ce(e,M,{counts:ge(t.snapshot),env:t.env})}function du(e,t,r){return e.reduce((n,i)=>{let o=sr(n.snapshot,mg(i),r);return{resolved:[...n.resolved,yg(i,o,r.env)],snapshot:o}},{resolved:[],snapshot:t}).resolved}function jt(e,t){if(e.kind==="count")return ct(t.snapshot,e.entity,e.where,t.env).length===e.value;if(e.kind==="exists")return ct(t.snapshot,e.entity,e.where,t.env).length>0;if(e.kind==="singleton"){let r=Ce(e.assertion.value,M,{counts:ge(t.snapshot),env:t.env});return uu(le(t.snapshot.scalars,{kind:"variable",name:e.singleton}))===uu(r)}return e.kind==="not"?!jt(e.predicate,t):e.kind==="or"?e.predicates.some(r=>jt(r,t)):e.predicates.every(r=>jt(r,t))}function mg(e){return e.expect.filter(t=>t.kind==="state")}function yg(e,t,r){return e.expect.some(n=>n.kind==="when")?{...e,expect:e.expect.flatMap(n=>pu(n,{env:r,snapshot:t}))}:e}function pu(e,t){if(e.kind!=="when")return[e];let r=gg(e,t);return r==null?[]:r.flatMap(n=>pu(n,t))}function gg(e,t){return e.branches.find(r=>r.condition==null||jt(r.condition,t))?.consequence}function uu(e){return e==null?"\u2205":JSON.stringify(e)}var fu=2e4;function yu(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, `,m=bg({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 ${m}`),Sg(e,u),u},null);if(n==null)return{};let i=wg(t),o=i.length===0?"":` WHERE ${i.join(" AND ")}`,s=e.db.prepare(`SELECT * FROM ${n} s${o} LIMIT 1`).get();return s==null||typeof s!="object"?null:{...s}}function Sg(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>fu)throw new Error(`sql-staged: pattern too weakly constrained \u2014 ${String(n)} partial assignments exceed the ${String(fu)} cap`)}function bg({index:e,pattern:t,prev:r}){let n=t.entities[e];if(n==null)return"1";let i=Object.entries(n.literals).map(([u,d])=>`t."${u}" IS ${Rt(d)}`),o=new Map(t.entities.slice(0,e).map((u,d)=>[u.alias,d])),s=n.relations.flatMap(u=>{let d=o.get(u.targetAlias);return d==null?[]:[`t."${u.field}" = ${hu(t,d,u.targetField)}`]}),a=t.entities.slice(0,e).flatMap((u,d)=>u.relations.flatMap(p=>p.targetAlias===n.alias?[`${hu(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=[...i,...s,...a,...l];return c.length===0?"1":c.join(" AND ")}function hu(e,t,r){let n=e.entities[t]?.entity??"";return`(SELECT b."${r}" FROM "${n}" b WHERE b.__as = prev."a${String(t)}")`}function mu(e,t,r){let n=e.entities[t]?.entity??"";return`(SELECT r."${r}" FROM "${n}" r WHERE r.__as = s."a${String(t)}")`}function wg(e){let t=new Map(e.entities.map((a,l)=>[a.alias,l])),r=a=>{let l=a.indexOf("."),c=l===-1?void 0:t.get(a.slice(0,l));if(c==null)throw new Error(`sql-staged: unresolved ref "${a}"`);return mu(e,c,a.slice(l+1))},n=e.absences.map(a=>{let l=[...Object.entries(a.literals).map(([u,d])=>`x."${u}" IS ${Rt(d)}`),...a.relations.map(u=>{let d=t.get(u.targetAlias);return d==null?"0":`x."${u.field}" = ${mu(e,d,u.targetField)}`})],c=l.length===0?"":` WHERE ${l.join(" AND ")}`;return`NOT EXISTS (SELECT 1 FROM "${a.entity}" x${c})`}),i=e.exclusives.map(a=>{let l=e.entities.flatMap((u,d)=>u.entity===a?[`s."a${String(d)}"`]:[]),c=l.length===0?"":` WHERE x.__as NOT IN (${l.join(", ")})`;return`NOT EXISTS (SELECT 1 FROM "${a}" x${c})`}),o={depth:0,refExpr:r,row:"c"},s=e.conditions.flatMap(a=>Is(a,o));return[...n,...i,...s]}function Is(e,t){if(e.kind==="singleton")return[];if(e.kind==="not"){let r=Is(e.predicate,t);return r.length===0?[]:[`NOT (${r.join(" AND ")})`]}return e.kind==="and"||e.kind==="or"?Rg(e,t):[vg(e,t)]}function Rg(e,t){let r=e.predicates.flatMap(i=>Is(i,t)),n=e.kind==="and"?" AND ":" OR ";return r.length===0?[]:[`(${r.join(n)})`]}function vg(e,t){return e.kind==="count"?`(SELECT COUNT(*) FROM "${e.entity}" c WHERE ${vt(e.where,t)}) = ${String(e.value)}`:`EXISTS (SELECT 1 FROM "${e.entity}" c WHERE ${vt(e.where,t)})`}var gu=new WeakMap,xg=60;function wu(e,t){let r=Hn(),n=Eg(t);if(kg(e.actor,n))return null;if(Cg(r,e),Yn(r,t),Xn(r,t),e.entities.length>xg){let s=yu(r,e);return s==null?null:bu({pattern:e,picked:s,snapshot:t})}let i=gu.get(e)??Pg(e);gu.set(e,i);let o=i.includes(":actor")?Ft(r,i).get({actor:n}):Ft(r,i).get();return o==null||typeof o!="object"?null:bu({pattern:e,picked:o,snapshot:t})}function Eg(e){let t=e.scalars.get(v({kind:"actor"})),r=t!=null&&t.expect.expect==="is"?t.expect.value:null;return typeof r=="string"?r:null}function kg(e,t){return e.kind==="user"?t==null:e.kind==="anonymous"?t!=null:!1}function Cg(e,t){t.entities.forEach(r=>{Ke(e,r.entity,[...Object.keys(r.literals),...r.relations.map(n=>n.field)]),r.relations.forEach(n=>{let i=t.entities.find(o=>o.alias===n.targetAlias);i!=null&&Ke(e,i.entity,[n.targetField])})}),t.absences.forEach(r=>{Ke(e,r.entity,[...Object.keys(r.literals),...r.relations.map(n=>n.field)]),r.relations.forEach(n=>{let i=t.entities.find(o=>o.alias===n.targetAlias);i!=null&&Ke(e,i.entity,[n.targetField])})}),t.conditions.forEach(r=>{Ns(e,r),Ts({condition:r,pattern:t,store:e})}),t.exclusives.forEach(r=>{Ke(e,r,[])})}function Ts({condition:e,pattern:t,store:r}){if(e.kind!=="singleton"){if(e.kind==="not"){Ts({condition:e.predicate,pattern:t,store:r});return}if(e.kind==="and"||e.kind==="or"){e.predicates.forEach(n=>{Ts({condition:n,pattern:t,store:r})});return}Ru(e.where).forEach(n=>{let i=n.indexOf(".");if(i===-1)return;let o=n.slice(0,i),s=t.entities.find(a=>a.alias===o);s!=null&&Ke(r,s.entity,[n.slice(i+1)])})}}function Ru(e){return Object.values(e).flatMap(t=>Ag(t))}function Ag(e){return pe(e)?Ru(e.selection.where):ye(e)?(e.kind==="anyOf"?e.values:[e.value]).flatMap(r=>Su(r)):Su(e)}function Su(e){return e!=null&&typeof e=="object"&&"ref"in e?typeof e.ref=="string"?[e.ref]:[]:[]}function Ns(e,t){if(t.kind!=="singleton"){if(t.kind==="not"){Ns(e,t.predicate);return}if(t.kind==="and"||t.kind==="or"){t.predicates.forEach(r=>{Ns(e,r)});return}Gr(e,t.entity,t.where)}}function bu({pattern:e,picked:t,snapshot:r}){let n=e.entities.map((i,o)=>{let s=Reflect.get(t,`a${String(o)}`),a=typeof s=="string"?r.entities.get(i.entity)?.get(s):null;return a==null?null:[i.alias,a]});return n.some(i=>i==null)?null:new Map(n.filter(i=>i!=null))}function Pg(e){let t=new Map(e.entities.map((s,a)=>[s.alias,`t${String(a)}`])),r=e.entities.length===0?"1":e.entities.map((s,a)=>`t${String(a)}.__as AS a${String(a)}`).join(", "),n=e.entities.length===0?"":` FROM ${e.entities.map((s,a)=>`"${s.entity}" t${String(a)}`).join(", ")}`,i=[...Mg(e,t),...e.entities.flatMap((s,a)=>Og({alias:`t${String(a)}`,aliases:t,constraint:s})),...Ig(e,t),...e.absences.map(s=>Tg(s,t)),...e.conditions.flatMap(s=>$s(s)?[]:[Ls(s,t)]),...Ng(e,t)],o=i.length===0?"":` WHERE ${i.join(" AND ")}`;return`SELECT ${r}${n}${o} LIMIT 1`}function Mg(e,t){if(e.actor.kind!=="user")return[];let r=t.get(e.actor.alias);return r==null?[]:[`${r}.__as = :actor`]}function $s(e){return e.kind==="singleton"?!0:e.kind==="not"?$s(e.predicate):e.kind==="and"||e.kind==="or"?e.predicates.some(t=>$s(t)):!1}function Og({alias:e,aliases:t,constraint:r}){let n=Object.entries(r.literals).map(([o,s])=>`${e}."${o}" IS ${Rt(s)}`),i=r.relations.map(o=>{let s=t.get(o.targetAlias);return s==null?"1":`${e}."${o.field}" = ${s}."${o.targetField}"`});return[...n,...i]}function Ig(e,t){return e.entities.flatMap((r,n)=>e.entities.slice(n+1).flatMap((i,o)=>{if(r.entity!==i.entity)return[];let s=t.get(r.alias),a=t.get(e.entities[n+1+o]?.alias??i.alias);return s==null||a==null?[]:[`${s}.__as <> ${a}.__as`]}))}function Tg(e,t){let r=[...Object.entries(e.literals).map(([i,o])=>`x."${i}" IS ${Rt(o)}`),...e.relations.map(i=>{let o=t.get(i.targetAlias);return o==null?"0":`x."${i.field}" = ${o}."${i.targetField}"`})],n=r.length===0?"":` WHERE ${r.join(" AND ")}`;return`NOT EXISTS (SELECT 1 FROM "${e.entity}" x${n})`}function Ng(e,t){return e.exclusives.map(r=>{let n=e.entities.map(s=>s.entity===r?t.get(s.alias):null).filter(s=>s!=null),i=n.map(s=>`${s}.__as`).join(", "),o=n.length===0?"":` WHERE x.__as NOT IN (${i})`;return`NOT EXISTS (SELECT 1 FROM "${r}" x${o})`})}function Ls(e,t){let r={depth:0,refExpr:$g(t),row:"c"};if(e.kind==="count")return`(SELECT COUNT(*) FROM "${e.entity}" c WHERE ${vt(e.where,r)}) = ${String(e.value)}`;if(e.kind==="exists")return`EXISTS (SELECT 1 FROM "${e.entity}" c WHERE ${vt(e.where,r)})`;if(e.kind==="singleton")throw new Error("sql-match: singleton conditions are evaluated by the scalar stage");if(e.kind==="not")return`NOT (${Ls(e.predicate,t)})`;let n=e.predicates.map(o=>Ls(o,t)),i=e.kind==="and"?" AND ":" OR ";return`(${n.join(i)})`}function $g(e){return t=>{let r=t.indexOf("."),n=r===-1?void 0:e.get(t.slice(0,r));if(n==null)throw new Error(`sql-match: unresolved ref "${t}"`);return`${n}."${t.slice(r+1)}"`}}function Pe(e,t){let r=Ds(e,t);if(r==null)return null;let n=Dg(e.scalars,t,ku(r));return n==null?null:e.conditions.every(o=>jt(o,{env:n,snapshot:t}))?n:null}function Ds(e,t){return wu(e,t)}function Jn(e,t){let r=Ds(e,t);if(r==null)return{kind:"entities"};let n=Lg(e.scalars,t,ku(r));if(n.unmet!=null)return n.unmet;let i=e.conditions.find(o=>!jt(o,{env:n.env,snapshot:t}));return i==null?null:{condition:i,kind:"condition"}}function vu(e,t,r){let n=xu(e.subject,r);if(n==null)return null;let i=Eu(t,n);return e.expect.expect==="absent"?i===void 0?r:null:e.expect.expect==="not"?jg({clause:e.expect.value,env:r,got:i,snapshot:t,subject:n}):Fg({clause:e.expect.value,env:r,got:i,snapshot:t,subject:n})}function Lg(e,t,r){return[...e.values()].reduce((n,i)=>{if(n.unmet!=null)return n;let o=vu(i,t,n.env);if(o!=null)return{env:o,unmet:null};let s=xu(i.subject,n.env),a=s==null?void 0:Eu(t,s),l=i.expect.expect==="absent"?null:i.expect.value;return{env:n.env,unmet:{got:a,kind:"scalar",subject:i.subject,want:l}}},{env:r,unmet:null})}function Dg(e,t,r){return[...e.values()].reduce((n,i)=>n==null?null:vu(i,t,n),r)}function Fg({clause:e,env:t,got:r,snapshot:n,subject:i}){if(_g(i,e,t))return r===void 0?null:new Map([...t,[$e(Bg(e)),r]]);if(!Vr(e,M,t))return null;let o=Ce(e,M,{counts:ge(n),env:t});return Dt({got:r,subject:i,want:{expect:"is",value:o}})?t:null}function _g(e,t,r){return e.kind==="element"&&(e.state==="value"||e.state==="text")&&U(t)&&!Vr(t,M,r)}function jg({clause:e,env:t,got:r,snapshot:n,subject:i}){if(!Vr(e,M,t))return null;let o=Ce(e,M,{counts:ge(n),env:t});return Dt({got:r,subject:i,want:{expect:"not",value:o}})?t:null}function Bg(e){if(!U(e))throw new Error("expected a ref clause");return e.ref}function xu(e,t){return e.kind!=="element"?e:Vg(e.locator,t)?{...e,locator:ae(e.locator,Re(t))}:null}function Vg(e,t){return Pc(e).every(r=>Vr(r,M,t))}function Eu(e,t){let r=e.scalars.get(v(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 i=n[1];return typeof i=="string"||typeof i=="number"||typeof i=="boolean"?[[$e(`${t}.${n[0]}`),i]]:[]})))}function Me(e,t){return[...new Map(e.map(r=>[t(r),r])).values()]}function Cu(e){return[...e.world.flatMap(t=>Wg(t)),...e.steps.flatMap(t=>_s(t)),...Object.values(e.singletons).flatMap(t=>V(t)),...e.absent.flatMap(t=>Object.values(t.where).flatMap(r=>V(r))),...e.actor.kind==="user"?[e.actor.alias]:[]]}function Wg(e){return Object.values(e.set).flatMap(t=>V(t))}function _s(e){return[...Ug(e.action),...e.expect.flatMap(t=>ut(t))]}function ut(e){switch(e.kind){case"visible":case"unobstructed":case"disabled":case"enabled":case"focused":case"checked":case"expanded":case"pressed":return we(e.locator);case"value":case"text":{let t=rt(e.value)?e.value.value:e.value;return[...we(e.locator),...V(t)]}case"singleton":return V(e.assertion.value);case"browser":return V(e.value);case"state":return[...e.assertion.kind==="deleted"?[]:Object.values(Et(e.assertion.props)).flatMap(t=>V(t)),...Object.values(e.key).flatMap(t=>Fs(t))];case"not":return ut(e.predicate);case"when":return e.branches.flatMap(t=>[...t.condition==null?[]:ut(t.condition),...t.consequence.flatMap(r=>ut(r))]);case"and":case"or":return e.predicates.flatMap(t=>ut(t));case"count":case"exists":return Object.values(e.where).flatMap(t=>Fs(t));case"actor":return e.target.kind==="anonymous"?[]:[e.target.ref.ref]}}function Au(e){return!e.includes(".")}function ar(e){let t=e.indexOf(".");return t===-1?e:e.slice(0,t)}function Ug(e){return e.kind==="goto"?V(e.url):e.kind==="actor"?[e.ref.ref]:e.kind==="fill"||e.kind==="select"?[...we(e.locator),...V(e.value)]:e.kind==="press"?e.locator==null?[]:we(e.locator):e.kind==="drag"?[...we(e.source),...we(e.target)]:we(e.locator)}function Fs(e){return pe(e)?Object.values(e.selection.where).flatMap(t=>Fs(t)):ye(e)?(e.kind==="anyOf"?e.values:[e.value]).flatMap(r=>V(r)):V(e)}function Qn(e){return e.flatMap(t=>t.kind==="and"?Qn(t.predicates):[t])}function kt(e){return Qn(e).filter(t=>!Qt(t))}function ei(e){return e.action.kind==="goto"?!0:js(e.expect).some(t=>t.kind==="browser"&&t.name==="url"&&t.value!==null)}function Bt(e){return e.action.kind==="goto"?!0:js(e.expect).some(t=>t.kind==="browser"&&t.name==="url"&&t.value!==null&&(t.part===void 0||t.part.kind==="path"))}function js(e){return e.flatMap(t=>t.kind==="and"?js(t.predicates):[t])}function He(e,t){return t.reduce((r,n)=>{let i=[...Xg(n),...Kr(n),...Zg(n)],o=zg(n,r,i)?Yg(r):r;return i.reduce((s,a)=>xs(s,a),o)},e)}function he(e){return e.kind==="not"?Gg(e.predicate):e.kind==="singleton"?{expect:{expect:"is",value:e.assertion.value},subject:{kind:"variable",name:e.singleton}}:qg(e)}function qr(e){return tu(eu(e)).map(({clause:t,key:r})=>({expect:t===null?{expect:"absent"}:{expect:"is",value:t},subject:r}))}function zg(e,t,r){if(e.action.kind==="goto")return!0;if(!Bt(e))return!1;let n=t.get(v({kind:"path"})),i=r.find(o=>o.subject.kind==="path");return i==null?!1:n==null||S(n.expect)!==S(i.expect)}function Gg(e){return e.kind==="value"||e.kind==="text"?rt(e.value)?null:{expect:{expect:"not",value:e.value},subject:{kind:"element",locator:e.locator,state:e.kind}}:Pu(e,!0)}function Pu(e,t){if(e.kind==="value"||e.kind==="text")return rt(e.value)?null:{expect:{expect:"is",value:e.value},subject:{kind:"element",locator:e.locator,state:e.kind}};let r=Kg(e);return r==null?null:{expect:{expect:"is",value:r.value!==t},subject:{kind:"element",locator:r.locator,state:r.state}}}function qg(e){return e.kind==="browser"?{expect:e.value===null?{expect:"absent"}:{expect:"is",value:e.value},subject:Kn(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"}}:Pu(e,!1)}function Kr(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 Kg(e){return Hg(e)?e.kind==="disabled"?{locator:e.locator,state:"enabled",value:!1}:{locator:e.locator,state:e.kind,value:!0}:null}function Hg(e){return e.kind==="visible"||e.kind==="disabled"||e.kind==="enabled"||e.kind==="focused"||e.kind==="checked"||e.kind==="expanded"||e.kind==="pressed"}function Yg(e){return new Map([...e].filter(([,t])=>t.subject.kind==="variable"||t.subject.kind==="viewport"))}function Xg(e){return e.action.kind==="goto"?qr(e.action.url):[]}function Zg(e){return kt(e.expect).flatMap(t=>{let r=he(t);return r==null?[]:[r]})}function Bs(e){return e.includes("async")?"async":e.includes("slow")?"slow":"fast"}var dt={async:12e4,fast:5e3,slow:3e4},Vs={async:{backoffMs:[500,1e3,2e3,5e3],timeoutMs:dt.async},fast:{backoffMs:[100,250,500,1e3],timeoutMs:dt.fast},slow:{backoffMs:[250,500,1e3,2e3],timeoutMs:dt.slow}};function Mu(e,t){return e.backoffMs[Math.min(t,e.backoffMs.length-1)]??0}function Ye(e){return`${e.test}#${String(e.index)}`}function Hr(e){let t=J(e).flatMap(r=>Yr(e,r.test));return Me(t,r=>`${r.test}:${S(r.steps)}`)}function Yr(e,t){let r=Nu(t),n=Tu(r,t.singletons,t.actor),i=wS(t,bS(e)),o=Qg(e,t),s=Ps(e);return tS(n,RS(t.steps),r).reduce((l,{chunk:c,requiredState:u},d)=>({offset:l.offset+c.length,transitions:[...l.transitions,yS({chunk:c,identities:s,index:d,intent:t.intent,namespace:r.namespace,paramSpaceOf:i,requiredState:u,testRef:ne(t),whenChunk:o.slice(l.offset,l.offset+c.length)})]}),{offset:0,transitions:[]}).transitions}function Ou(e){return[v({kind:"viewport"}),{expect:{expect:"is",value:e},subject:{kind:"viewport"}}]}var Jg=v({kind:"viewport"});function Iu(e){let t=e.scalars.get(Jg);return t==null||t.expect.expect!=="is"||typeof t.expect.value!="string"?null:t.expect.value}function Tu(e,t,r){return{absences:pS(e),actor:r,conditions:[],entities:mS(e),exclusives:e.exclusives,scalars:new Map(Object.entries(t).filter(([,n])=>!U(n)&&!Ge(n)).map(([n,i])=>[v({kind:"variable",name:n}),{expect:{expect:"is",value:i},subject:{kind:"variable",name:n}}]))}}function Qg(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 ti(e,t,r){return Object.values(e).flatMap(n=>U(n)?lr(n.ref,r):[]).find(n=>n.entity===t)?.aliasPath}function Xr(e,t){return t.reduce((r,n)=>eS(n)??r,e)}function eS(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"?Cc:{alias:t.target.ref.ref,kind:"user"}}function tS(e,t,r){return t.reduce((n,i)=>({requiredState:rS(n.requiredState,i,r),withRequiredState:[...n.withRequiredState,{chunk:i,requiredState:dS(n.requiredState,i)}]}),{requiredState:e,withRequiredState:[]}).withRequiredState}function rS(e,t,r){let n=t.flatMap(i=>i.expect.filter(o=>o.kind==="state")).reduce((i,o)=>nS(i,o,r),e);return{...n,actor:Xr(n.actor,t),scalars:He(n.scalars,t)}}function nS(e,t,r){return t.assertion.kind==="deleted"?iS(e,t,r):t.assertion.kind==="created"?aS(e,t.entity,t.assertion.as,t.assertion.props,r):cS(e,t,r)}function iS(e,t,r){let n=ti(t.key,t.entity,r.namespace),i=e.entities.find(a=>a.alias===n),o=Zr(oS(t.key),r),s=i==null?{entity:t.entity,params:{},...o}:{entity:i.entity,params:{},...sS(i,o)};return{...e,absences:[...e.absences,s],entities:e.entities.filter(a=>a.alias!==n)}}function oS(e){return Object.fromEntries(Object.entries(e).flatMap(t=>{let r=t[1];return pe(r)||ye(r)?[]:[[t[0],r]]}))}function sS(e,t){return{literals:{...e.literals,...t.literals},relations:[...e.relations.filter(r=>!t.relations.some(n=>n.field===r.field)),...t.relations]}}function aS(e,t,r,n,i){let o=Zr(n,i);return{...e,absences:e.absences.filter(s=>s.entity!==t||!lS(o,s)),entities:[...e.entities,{alias:r,entity:t,...o}]}}function lS(e,t){return Object.entries(t.literals).every(([n,i])=>e.literals[n]===i)&&t.relations.every(n=>e.relations.some(i=>i.field===n.field&&i.targetAlias===n.targetAlias&&i.targetField===n.targetField))}function cS(e,t,r){if(t.assertion.kind!=="updated")return e;let n=ti(t.key,t.entity,r.namespace);if(n==null)return e;let i=Zr(Et(t.assertion.props),r),o=Object.entries(t.assertion.props).filter(([,a])=>xt(a)).map(([a])=>a),s=a=>a.alias===n?uS(a,i,o):a;return{...e,entities:e.entities.map(a=>s(a))}}function uS(e,t,r){let n=Object.entries(e.literals).filter(([i])=>!r.includes(i)&&!(i in t.literals));return{...e,literals:{...Object.fromEntries(n),...t.literals},relations:[...e.relations.filter(i=>!t.relations.some(o=>o.field===i.field)),...t.relations]}}function dS(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 ri(e,t){let r=Nu(t);return{namespace:r.namespace,requiredState:Tu(r,t.singletons,t.actor)}}function Ws(e,t){return[...new Set(e)].flatMap(r=>lr(r,t))}function Nu(e){return{absences:e.absent,exclusives:e.exclusive,namespace:new Map(e.world.map(t=>[t.as,t.entity])),setups:e.world}}function pS(e){return e.absences.map(t=>({entity:t.entity,...Zr(t.where,e),params:fS(t.where,e)}))}function Zr(e,t){let r=Object.entries(e),n=Object.fromEntries(r.flatMap(([o,s])=>U(s)||Ge(s)?[]:[[o,s]])),i=r.flatMap(o=>{let s=o[1];if(!U(s))return[];let a=lr(s.ref,t.namespace).at(0);return a==null?[]:[{entity:a.entity,field:o[0],targetAlias:a.aliasPath,targetField:a.field}]});return{literals:n,relations:i}}function fS(e,t){return Object.fromEntries(Object.entries(e).flatMap(r=>{let n=r[1];return!U(n)||lr(n.ref,t.namespace).at(0)!=null?[]:[[r[0],n.ref]]}))}function hS(e,t){return e.map(r=>({alias:r.as,entity:r.entity,...Zr(r.set,t)}))}function mS(e){return hS(e.setups,e)}function lr(e,t){let r=Kc(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 yS(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),i=n.at(-1)??e.chunk.at(-1);if(i==null)throw new Error("empty transition chunk");let o=[...new Set(e.chunk.flatMap(s=>_s(s)))];return{effectStep:i,identities:e.identities,index:e.index,intent:e.intent,namespace:e.namespace,nav:r,paramSpaces:Object.fromEntries(o.filter(s=>e.paramSpaceOf.has(s)).map(s=>[s,e.paramSpaceOf.get(s)])),requiredState:e.requiredState,steps:n,test:e.testRef,wait:Bs(e.chunk.flatMap(s=>[...gS(s),...SS(s)])),whenSteps:e.whenChunk}}function gS(e){return e.expect.flatMap(t=>t.kind==="state"&&t.wait!=null?[t.wait]:[])}function SS(e){return ei(e)?["slow"]:[]}function bS(e){return new Map(e.valueSpaces.map(t=>[t.name,t]))}function wS(e,t){return new Map(Object.entries(e.params).map(([r,n])=>[r,t.get(n.valueSpace)]))}function RS(e){return e.map(t=>[t])}function $u(e,t){let r=it({conditions:e.when,...vS(e,t)});return e.expect.map(n=>({consequence:n,localConsequence:!1,origin:{kind:"declared",name:e.name},refs:new Set,when:r}))}var Us="@actor";function vS(e,t){if(!e.when.some(o=>zs(o).some(s=>s.startsWith(`${Us}.`))))return{};let n=t.entities.filter(o=>o.principal),i=n[0];if(i==null||n.length>1)throw new Error(`the declared fact "${e.name}" uses actor.id, which needs exactly one principal entity`);return{actor:{alias:Us,kind:"user"},entities:[{alias:Us,entity:i.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"?V(e.assertion.value):Object.values(e.where).flatMap(t=>Lu(t))}function Lu(e){return pe(e)?Object.values(e.selection.where).flatMap(t=>Lu(t)):ye(e)?xS(e):V(e)}function xS(e){switch(e.kind){case"not":case"compare":return V(e.value);case"anyOf":return e.values.flatMap(t=>V(t));case"contains":case"startsWith":return V(e.value)}}function Xe(e){return e.surfaces.filter(t=>t.by==="surface"&&t.overlay)}function ni(e,t){return{...e,scalars:ii(e.scalars,t)}}function ii(e,t){return _u(e,t,r=>({expect:{expect:"is",value:!1},subject:{kind:"element",locator:r,state:"visible"}}))}function Fu(e,t){let r=_u(e.scalars,t,n=>({declared:!1,expect:{expect:"is",value:!1},subject:{kind:"element",locator:ae(n,Re(new Map)),state:"visible"}}));return{...e,scalars:r}}function _u(e,t,r){let n=t.filter(i=>!e.has(Du(i))).map(i=>[Du(i),r(i)]);return n.length===0?e:new Map([...e,...n])}function Du(e){return v({kind:"element",locator:e,state:"visible"})}var ju=new WeakMap;function pt(e){let t=ju.get(e);if(t!=null)return t;let r=ES("sha256").update(S({consequence:e.consequence,when:Ee(e.when)})).digest("base64");return ju.set(e,r),r}function si(e){let t=e.facts.flatMap(o=>$u(o,e)),r=new Set(Xe(e).map(o=>S(de(o)))),n=J(e).map(o=>qs(e,o)),i=Me(n.flatMap(o=>o.steps.flatMap(s=>s.facts)),pt).filter(o=>!kS(o.consequence,r));return Promise.resolve([...t,...i])}function Gs(e,t){return e.filter(r=>!MS(r)||OS(r)===t)}function ai(e){return e.kind==="not"?ai(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 kS(e,t){if(e.kind!=="visible")return!1;let r=de(e.locator);return t.has(S(r))?!0:r.by==="inside"&&t.has(S(de(r.scope)))}function li(e,t){if(e.facts.length===0)return t;let r=Jr(e,t);return r.size===0?t:{...t,scalars:Ae(r,t.scalars)}}function Jr(e,t){let r=Fu(t,e.overlays),n=e.facts.flatMap(s=>{let a=Pe(s.when,r);if(a==null)return[];let l=CS(s.consequence,a,r);return l==null?[]:[{entry:l,factKey:pt(s),key:v(l.subject)}]}),i=n.filter(s=>!PS({m:s,matched:n,overrides:e.overrides})),o=AS(i);return i.reduce((s,a)=>o.has(a.key)?s:at(s,a.entry),Le)}function CS(e,t,r){let n=he(e);if(n==null)return null;try{return lt({declared:!0,entry:n,scope:{counts:ge(r),env:t}})}catch{return null}}function AS(e){let t=e.reduce((r,n)=>new Map([...r,[n.key,[...r.get(n.key)??[],S(n.entry.expect)]]]),new Map);return new Set([...t].flatMap(([r,n])=>new Set(n).size>1?[r]:[]))}function PS({m:e,matched:t,overrides:r}){let n=r.get(e.factKey);return n==null?!1:t.some(i=>i.key===e.key&&n.has(i.factKey))}function MS(e){return e.origin?.kind==="test"&&e.localConsequence}function OS(e){let{origin:t}=e;if(!(t==null||t.kind!=="test"))return t.test}var Bu=new WeakMap;function qs(e,t){let r=Bu.get(t);if(r!=null)return r;let n=IS(e,t);return Bu.set(t,n),n}function IS(e,{test:t,workflow:r}){let n=ri(e,t),i=TS(n,t.viewport),o=Xe(e),s=NS(r.steps),a=t.steps.reduce((l,c)=>{let u=LS(l.requiredState,c,i,o),d=zS({branchConditions:s,namespace:i.namespace,origin:{kind:"test",test:ne(t)},paramNames:new Set(Object.keys(t.params)),post:u,pre:l.requiredState,step:c});return{requiredState:u,steps:[...l.steps,{facts:d,post:u}]}},{requiredState:ni(i.requiredState,o),steps:[]});return{initial:ni(i.requiredState,o),steps:a.steps}}function TS(e,t){return{...e,requiredState:{...e.requiredState,scalars:new Map([...e.requiredState.scalars,Ou(t)])}}}function NS(e){return e.flatMap(r=>r.expect).flatMap(r=>oi(r)).reduce((r,n)=>{let i=S(n.consequence),o=r.get(i),s=o==null?n.condition:{kind:"or",predicates:[o,n.condition]};return new Map([...r,[i,s]])},new Map)}function oi(e){return e.kind==="not"?oi(e.predicate):e.kind==="and"||e.kind==="or"?e.predicates.flatMap(t=>oi(t)):e.kind!=="when"?[]:e.branches.flatMap((t,r)=>{let n=$S(e.branches,r);return t.consequence.flatMap(i=>[{condition:n,consequence:i},...oi(i)])})}function $S(e,t){let r=e.slice(0,t).flatMap(o=>o.condition==null?[]:[o.condition]).map(o=>({kind:"not",predicate:o})),n=e[t]?.condition,i=n==null?r:[...r,n];return i.length===1&&i[0]!=null?i[0]:{kind:"and",predicates:i}}function LS(e,t,r,n){let{entities:i}=DS(e,t,r),o=He(e.scalars,[t]),s=Xr(e.actor,[t]);return ni({...e,actor:s,entities:i,scalars:o},n)}function DS(e,t,r){return t.expect.reduce((n,i)=>i.kind==="state"?FS(n,i,r):n,e)}function FS(e,t,r){if(t.assertion.kind==="created"){let o=_S(t.assertion.as,t.entity,t.assertion.props,r);return{...e,entities:[...e.entities,o]}}let n=ti(t.key,t.entity,r.namespace);if(n==null)return e;if(t.assertion.kind==="deleted")return VS(e,n);let i=Et(t.assertion.props);return{...e,entities:e.entities.map(o=>o.alias===n?Uu(o,i,r):o)}}function _S(e,t,r,n){return Uu({alias:e,entity:t,literals:{},relations:[]},r,n)}function Uu(e,t,r){return Object.entries(t).reduce((n,[i,o])=>{if(Ge(o))return n;if(U(o)){let s=jS(o.ref,i,r.namespace);return{...n,literals:BS(n.literals,i),relations:s==null?n.relations:[...Vu(n.relations,i),s]}}return{...n,literals:{...n.literals,[i]:o},relations:Vu(n.relations,i)}},e)}function jS(e,t,r){let[n]=lr(e,r);return n==null?void 0:{entity:n.entity,field:t,targetAlias:n.aliasPath,targetField:n.field}}function BS(e,t){return Object.fromEntries(Object.entries(e).filter(([r])=>r!==t))}function Vu(e,t){return e.filter(r=>r.field!==t)}function VS(e,t){let r=e.entities.find(i=>i.alias===t),n=WS(e,t);return r==null?n:{...n,absences:[...n.absences,{entity:r.entity,literals:r.literals,params:{},relations:r.relations}]}}function WS(e,t){return{...e,entities:e.entities.filter(r=>r.alias!==t)}}var US=16;function zS(e){return kt(e.step.expect).filter(t=>ai(t)).flatMap(t=>GS(t,e))}function GS(e,t){let r=he(e);if(r==null)return[];if(ut(e).some(a=>t.paramNames.has(a)))return[];let n=v(r.subject),i=t.branchConditions.get(S(e)),o={...t.post,conditions:i==null?t.post.conditions:[...t.post.conditions,i],scalars:new Map([...t.post.scalars].filter(([a])=>a!==n))},s=qS(o,t.pre,t.paramNames);return s==null||s.entities.length>US?[]:Ee(s)===Ee(t.pre)?[]:[{consequence:e,localConsequence:Ws(ut(e),t.namespace).length>0,origin:t.origin,refs:new Set(Ws([...HS(s),...ut(e)],t.namespace).map(a=>a.aliasPath)),when:s}]}function qS(e,t,r){let n=[...e.scalars.values()].map(i=>KS(i,t,r));return n.some(i=>i==null)?null:{...e,scalars:new Map(n.flatMap(i=>i==null?[]:[[v(i.subject),i]]))}}function KS(e,t,r){if(!Wu(e,r))return e;if(e.subject.kind!=="element"||e.expect.expect==="absent"||we(e.subject.locator).some(i=>r.has(i)))return null;let n=t.scalars.get(v(e.subject));return n==null||n.expect.expect!=="is"||Wu(n,r)?null:{expect:{expect:"not",value:n.expect.value},subject:e.subject}}function Wu(e,t){let r=e.expect.expect==="absent"?[]:V(e.expect.value);return[...e.subject.kind==="element"?we(e.subject.locator):[],...r].some(i=>t.has(i))}function HS(e){return[...e.scalars.values()].flatMap(t=>wt(t.subject)&&t.expect.expect!=="absent"?V(t.expect.value):[])}import*as td from"remeda";function zu(e){return`\xA4param:${e}`}function Gu(e,t){return`\xA4${e}.${t}`}var qu=new WeakMap;function Ks(e){let t=qu.get(e);if(t!==void 0)return t;let r=YS(e);return qu.set(e,r),r}function YS(e){let t=ib(e);return t==null?null:{absenceKeys:new Set(e.absences.map(r=>S(r))),conditionKeys:new Set(e.conditions.map(r=>S(r))),pinned:QS(e),snapshot:t,specific:e}}var Ku=new WeakMap,Hu=new WeakMap;function Hs(e,t){if(t==null)return null;let r=Hu.get(e)??new Map;Hu.set(e,r);let n=Ee(t.specific),i=r.get(n);if(i!==void 0)return i;let o=XS(e,t);return r.set(n,o),o}function ci(e,t){return Hs(e,Ks(t))}function XS(e,t){let{absenceKeys:r,conditionKeys:n,pinned:i,snapshot:o,specific:s}=t,a=ZS(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,m])=>JS({entry:m,generalEntityOf:a.entityOf,host:s.scalars.get(p),key:p,pinned:i}));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 Pe(d,o)!=null}function ZS(e){let t=Ku.get(e);if(t!=null)return t;let r={absenceEntries:e.absences.map(n=>({absence:n,key:S(n)})),conditionKeys:e.conditions.map(n=>S(n)),entityOf:new Map(e.entities.map(n=>[n.alias,n.entity])),scalarEntries:[...e.scalars]};return Ku.set(e,r),r}function JS({entry:e,generalEntityOf:t,host:r,key:n,pinned:i}){if(r==null)return"false";let o=S(r.expect)===S(e.expect);return o&&tb(e.expect)?"skip":r.expect.expect!=="is"?eb({entry:e,host:r,identical:o}):e.expect.expect==="absent"?"false":rb({entry:e,generalEntityOf:t,key:n,pinned:i,want:e.expect,wantOfHost:r.expect})}function QS(e){let t=new Map(e.entities.map(o=>[o.alias,o.entity])),n=[...[...e.scalars.values()].flatMap(o=>[...o.expect.expect==="absent"?[]:V(o.expect.value),...o.subject.kind==="element"?we(o.subject.locator):[]]).filter(o=>o.includes(".")),...e.entities.flatMap(o=>[...Object.keys(o.literals).map(s=>`${o.alias}.${s}`),...o.relations.flatMap(s=>[`${o.alias}.${s.field}`,`${s.targetAlias}.${s.targetField}`])])],i=n.flatMap(o=>{let s=o.indexOf("."),a=t.get(o.slice(0,s));return a==null?[]:[`${a}.${o.slice(s+1)}`]});return{byAlias:new Set(n),byEntity:new Set(i)}}function eb({entry:e,host:t,identical:r}){return r||t.expect.expect==="absent"&&e.expect.expect==="not"?"defer":"false"}function tb(e){return e.expect==="absent"?!0:V(e.value).every(t=>!t.includes("."))}function rb({entry:e,generalEntityOf:t,key:r,pinned:n,want:i,wantOfHost:o}){if(Yu(i.value)||Yu(o.value))return"defer";if(i.expect==="not")return V(i.value).length===0&&V(o.value).length===0?[r,e]:"defer";let s=new Set(V(i.value).filter(a=>a.includes(".")).map(a=>nb({generalEntityOf:t,pinned:n,ref:a})));return s.has("false")?"false":s.has("defer")?"defer":[r,{expect:Ju(i),subject:ed(e.subject)}]}function nb({generalEntityOf:e,pinned:t,ref:r}){if(t.byAlias.has(r))return"ok";let n=r.indexOf("."),i=e.get(r.slice(0,n));return i==null||t.byEntity.has(`${i}.${r.slice(n+1)}`)?"defer":"false"}function Yu(e){return e!==null&&typeof e=="object"&&"template"in e&&e.template.some(t=>typeof t!="string"&&"count"in t)}var Xu=new WeakMap;function ib(e){let t=Xu.get(e);if(t!==void 0)return t;let r=ob(e);return Xu.set(e,r),r}function ob(e){let t=sb(e),r=Pe(it({absences:e.absences,conditions:e.conditions,entities:e.entities,exclusives:e.exclusives}),t);if(r==null)return null;let n=lb(e,r,t);return n==null?null:{...t,scalars:ab(n,e)}}function sb(e){let t=new Map(e.entities.map(s=>[s.alias,s])),r=[...e.scalars.values()].flatMap(s=>[...s.expect.expect==="absent"?[]:V(s.expect.value),...s.subject.kind==="element"?we(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,Zu(t,a,l)])),...s.literals,...Object.fromEntries(s.relations.map(a=>[a.field,Zu(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:Le}}function Zu(e,t,r){let i=e.get(t)?.literals[r];return i!==void 0?i:Gu(t,r)}function ab(e,t){return t.actor.kind!=="user"?e:new Map([...e,[v({kind:"actor"}),{declared:!1,expect:{expect:"is",value:t.actor.alias},subject:{kind:"actor"}}]])}function lb(e,t,r){let n=[...e.scalars.values()].filter(i=>i.expect.expect==="is").map(i=>{try{return lt({declared:!0,entry:{expect:Ju(i.expect),subject:ed(i.subject)},scope:{counts:ge(r),env:t}})}catch{return null}});return n.some(i=>i==null)?null:new Map(n.flatMap(i=>i==null?[]:[[v(i.subject),i]]))}function Ju(e){return e.expect==="absent"?e:{...e,value:cb(e.value)}}function cb(e){return Mc(e,Qu)}function Qu(e){return Au(e.ref)?zu(e.ref):e}function ed(e){return e.kind!=="element"?e:{...e,locator:ub(e.locator)}}function ub(e){return Ac(e,db)}function db(e){return Oc(e,Qu)}var rd=new Map;async function ui({context:e,facts:t}){let r=td.groupBy(t.filter(o=>he(o.consequence)!=null),o=>pb(o)),i=Object.values(r).flatMap(o=>o.flatMap(s=>o.filter(a=>a!==s).map(a=>({general:s,specific:a}))));return i.filter(({general:o,specific:s})=>ci(o.when,s.when)!==!1).forEach(({general:o,specific:s})=>{ot({context:e,general:o.when,specific:s.when}).catch(()=>{})}),i.reduce(async(o,{general:s,specific:a})=>{let l=await o;if(!(ci(s.when,a.when)!==!1&&await ot({context:e,general:s.when,specific:a.when}))||ci(a.when,s.when)!==!1&&await ot({context:e,general:a.when,specific:s.when}))return l;let d=pt(s),p=l.get(d)??new Set;return new Map([...l,[d,new Set([...p,pt(a)])]])},Promise.resolve(rd))}function nd(e){let t=he(e.consequence);if(t==null)return null;try{let r=lt({declared:!0,entry:t,scope:Re(new Map)});return v(r.subject)}catch{return null}}function pb(e){let t=he(e.consequence);if(t==null)throw new Error("fact consequence has no pattern entry");return v(t.subject)}function di(e){return Me(J(e).flatMap(t=>fb(e,t.test)),Ys)}function Ys(e){return S({holds:Ee(e.holds),reference:e.reference,when:Ee(e.when)})}function pi(e,t){return Pe(e.when,t)==null?!1:Pe(e.holds,t)==null}function fb(e,t){let r=ri(e,t);return r.requiredState.entities.flatMap(n=>n.relations.flatMap(i=>hb(e,n,i,r.namespace)?gb(n,i,r.namespace):[]))}function hb(e,t,r,n){let i=n.get(r.targetAlias);return i!=null&&!mb(e,t.entity,r.field)&&yb(e,i,r.targetField)}function mb(e,t,r){return e.entities.find(n=>n.name===t)?.props[r]?.optional===!0}function yb(e,t,r){return e.entities.find(n=>n.name===t)?.identity.includes(r)===!0}function gb(e,t,r){let n=r.get(t.targetAlias);if(n==null)return[];let i=id(e.alias,e.entity),o=id(t.targetAlias,n);return[{holds:it({entities:[{...i,relations:[t]},o]}),reference:{field:t.field,source:e.entity,target:n,targetField:t.targetField},when:it({entities:[i]})}]}function id(e,t){return{alias:e,entity:t,literals:{},relations:[]}}function od(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 fi=od(async e=>{let t=tr(e),r=await si(e);return{dataRules:di(e),facts:r,overrides:await ui({context:t,facts:r})}});import*as Xs from"remeda";function Ct(e){return[...new Set(e.producers.map(t=>t.test))]}function Qr(e){return e.origin==null||e.origin.kind==="declared"?[]:e.origin.kind==="generalized"?e.origin.producers:[{test:e.origin.test,when:e.when}]}async function sd(e,t){let{context:r,pool:n,timelines:i}=bb(e,t),o=Sb(r),s=n.map(l=>Iu(l.fact.when)),a=await Promise.all([...i.values()].map(l=>{let c=l.locked.test.viewport,u=n.filter((d,p)=>s[p]==null||s[p]===c);return wb({entry:l,pool:u,resolve:o})}));return{pool:n,reports:a}}function ad(e,t){return{...ud(e.consequence),declared:e.origin?.kind==="test",key:pt(e),label:Wn(e.consequence),labelTokens:Nc(e.consequence),origins:t}}function Sb(e){return(t,r)=>ot({context:e,general:t,specific:r})}function bb(e,t){let r=J(e),n=new Map(r.map(a=>[a.ref,{locked:a,timeline:qs(e,a)}])),i=Eb(n),o=xb(n),s=kb({facts:t,originSites:i,witnessSites:o});return{context:tr(e),pool:s,timelines:n}}async function wb(e){let{entry:t,pool:r,resolve:n}=e,{locked:i}=t,o=new Set(t.timeline.steps.flatMap(c=>c.facts.map(u=>S(u.consequence)))),s=r.filter(c=>!c.originWorkflows.has(i.test.workflow)).filter(c=>!o.has(c.consequenceKey)),a=await vb({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:i.ref,testSlug:i.test.slug,workflowSlug:i.test.workflow}}function Rb(e,t){return e.map(r=>({candidate:r,holds:Hs(r.fact.when,t)}))}async function vb({candidates:e,resolve:t,timeline:r}){let i=await[r.initial,...r.steps.map(o=>o.post)].reduce(async(o,s,a)=>{let l=await o,c=e.filter(f=>!l.has(f)),u=Rb(c,Ks(s)),d=await Promise.all(u.filter(f=>f.holds==null).map(async f=>({candidate:f.candidate,holds:await t(f.candidate.fact.when,s)}))),p=new Set(d.filter(f=>f.holds).map(f=>f.candidate)),m=u.filter(f=>f.holds===!0||p.has(f.candidate)).map(f=>f.candidate),y=a===0?0:a-1;return new Map([...l,...m.map(f=>[f,y])])},Promise.resolve(new Map));return r.steps.length===0?[]:[...i].map(([o,s])=>({borrowed:o.borrowed,stepIndex:s}))}function ld(e,t){return`${e}#${S(t)}`}function xb(e){let t=[...e.values()].flatMap(r=>r.timeline.steps.flatMap((n,i)=>n.facts.map(o=>[ld(r.locked.ref,o.consequence),cd(r.locked,i)])));return new Map(Object.entries(Xs.groupBy(t,([r])=>r)).map(([r,n])=>{let[,i]=n[0];return[r,i]}))}function cd(e,t){return{stepIndex:t,testRef:e.ref,testSlug:e.test.slug,workflowIntent:e.workflow.intent,workflowSlug:e.test.workflow}}function Eb(e){let t=[...e.values()].flatMap(r=>r.timeline.steps.flatMap((n,i)=>n.facts.map(o=>[pt(o),cd(r.locked,i)])));return new Map(Object.entries(Xs.groupBy(t,([r])=>r)).map(([r,n])=>[r,n.map(([,i])=>i)]))}function kb({facts:e,originSites:t,witnessSites:r}){return e.filter(n=>!(n.origin?.kind==="test"&&n.localConsequence)).map(n=>{let i=pt(n),s=n.origin?.kind==="test"?t.get(i)??[]:Cb(n,r);return{borrowed:ad(n,s),consequenceKey:S(n.consequence),fact:n,originWorkflows:new Set(s.map(a=>a.workflowSlug))}}).filter(n=>n.borrowed.origins.length>0)}function ud(e){if(e.kind==="not"){let t=ud(e.predicate);return{...t,negated:!t.negated}}return"locator"in e?{checkKind:e.kind,negated:!1,subject:xc(ae(e.locator,Re(new Map)))}:{checkKind:void 0,negated:!1,subject:void 0}}function Cb(e,t){return e.origin?.kind!=="generalized"?[]:Ct(e.origin).map(r=>{let n=t.get(ld(r,e.consequence));if(n==null)throw new Error(`missing witness site for ${r} in generalized fact origin`);return n})}function dd(e){let t=Me(e,Ee),r=Me(t.flatMap(c=>[...c.scalars.values()]),S),n=Me(t.flatMap(c=>c.entities),S),i=Me(t.flatMap(c=>c.absences),S),o=hi(r,S),s=hi(n,S),a=hi(i,S),l=hi(t,Ee);return{absenceTable:i.map(c=>({...c,relations:[...c.relations]})),constraintTable:n.map(c=>({...c,relations:[...c.relations]})),patternTable:t.map(c=>({absences:c.absences.map(u=>mi(a,S(u))),actor:c.actor,conditions:[...c.conditions],entities:c.entities.map(u=>mi(s,S(u))),exclusives:[...c.exclusives],scalars:[...c.scalars.values()].map(u=>mi(o,S(u)))})),scalarTable:r.map(c=>({expect:c.expect,subject:c.subject})),indexOf:c=>mi(l,Ee(c))}}function pd(e){return e.patternTable.map(t=>({absences:t.absences.map(r=>At(e.absenceTable,r)),actor:t.actor,conditions:t.conditions,entities:t.entities.map(r=>At(e.constraintTable,r)),exclusives:t.exclusives,scalars:new Map(t.scalars.map(r=>{let n=At(e.scalarTable,r);return[v(n.subject),n]}))}))}function At(e,t){let r=e[t];if(r==null)throw new Error("compiled checks table index out of range \u2014 recompile");return r}function hi(e,t){return new Map(e.map((r,n)=>[t(r),n]))}function mi(e,t){let r=e.get(t);if(r==null)throw new Error("compiled checks pattern missing from table");return r}async function hd(e){let t=await fi(e),{pool:r,reports:n}=await sd(e,t.facts),i=dd([...t.facts.flatMap(a=>Ib(a)),...t.dataRules.flatMap(a=>[a.when,a.holds])]),o=new Map(t.facts.map((a,l)=>[a,l])),s=new Map(r.map((a,l)=>[a.borrowed,l]));return{absenceTable:i.absenceTable,constraintTable:i.constraintTable,dataRules:t.dataRules.map(a=>({holds:i.indexOf(a.holds),reference:a.reference,when:i.indexOf(a.when)})),factPool:r.map(a=>({fact:md(o,a.fact),origins:a.borrowed.origins.map(l=>({...l}))})),factReports:n.map(a=>Lb(a,s)),facts:t.facts.map(a=>Tb(a,i)),overrides:$b(t.overrides),patternTable:i.patternTable,scalarTable:i.scalarTable}}var fd=new WeakMap;function cr(e){let t=fd.get(e);if(t!=null)return t;let r=Ab(e),n=pd(r),i={dataRules:r.dataRules.map(o=>({holds:At(n,o.holds),reference:o.reference,when:At(n,o.when)})),facts:r.facts.map(o=>Pb(o,n)),overrides:Ob(r.overrides)};return fd.set(e,i),i}function Ab(e){return e.checks}function md(e,t){let r=e.get(t);if(r==null)throw new Error("compiled checks item missing from index");return r}function Pb(e,t){return{consequence:e.consequence,localConsequence:e.localConsequence,origin:Mb(e.origin,t),refs:new Set(e.refs),when:At(t,e.when)}}function Mb(e,t){return e==null||e.kind!=="generalized"?e:{kind:"generalized",producers:e.producers.map(r=>({test:r.test,when:At(t,r.when)}))}}function Ob(e){return new Map(Object.entries(e).map(([t,r])=>[t,new Set(r)]))}function Ib(e){let t=e.origin?.kind==="generalized"?e.origin.producers.map(r=>r.when):[];return[e.when,...t]}function Tb(e,t){return{consequence:e.consequence,localConsequence:e.localConsequence,origin:Nb(e.origin,t),refs:[...e.refs],when:t.indexOf(e.when)}}function Nb(e,t){return e==null||e.kind!=="generalized"?e:{kind:"generalized",producers:e.producers.map(r=>({test:r.test,when:t.indexOf(r.when)}))}}function $b(e){return Object.fromEntries([...e].map(([t,r])=>[t,[...r].toSorted((n,i)=>n.localeCompare(i))]).toSorted(([t],[r])=>t.localeCompare(r)))}function Lb(e,t){return{steps:e.steps.map(r=>({borrowed:r.borrowed.map(n=>md(t,n)),stepIndex:r.stepIndex})),testRef:e.testRef,testSlug:e.testSlug,workflowSlug:e.workflowSlug}}function gd(e){let t=new Map;return e.forEach(r=>{Db(r).forEach(n=>{en(n,t)})}),t}function Js(e,t){let r=Fb(e.consequence,t);if(r.length===0)return e.when;let n=new Map(e.when.scalars);return r.forEach(i=>n.set(v(i.subject),i)),{...e.when,scalars:n}}function Db(e){let t=[...e.when.scalars.values()].flatMap(n=>n.subject.kind==="element"?[n.subject.locator]:[]),r=Sd(e.consequence);return r==null?t:[...t,r]}function Sd(e){return e.kind==="not"?Sd(e.predicate):"locator"in e?e.locator:void 0}function en(e,t){if(e.by==="inside"){let r=bd(Zs(e.scope));t.set(r,[...t.get(r)??[],e]),en(e.scope,t),en(e.target,t);return}if(e.by==="surface"){en(e.container,t);return}e.by==="frame"&&en(e.element,t)}function bd(e){return _n(e,"visible")}function Zs(e){return e.by==="frame"?e.element:e}function Fb(e,t){let r=_b(e);if(r!=null)return(t.get(bd(Zs(r)))??[]).map(i=>yd(i,!1));let n=jb(e);return n==null?[]:[yd(Zs(n),!0)]}function _b(e){return e.kind!=="not"||e.predicate.kind!=="visible"?null:e.predicate.locator}function yd(e,t){return{expect:{expect:"is",value:t},subject:{kind:"element",locator:e,state:"visible"}}}function jb(e){return e.kind!=="visible"||e.locator.by!=="inside"?null:e.locator.scope}async function vd({context:e,facts:t}){let n=[...t.reduce((s,a)=>{let l=he(a.consequence);if(l==null)return s;let c=v(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=>xd(a.consequence,c.consequence)).map(c=>[a,c]))),i=gd(t),o=await Promise.all(n.map(async([s,a])=>{let l=await ot({context:e,general:s.when,specific:a.when}),c=await ot({context:e,general:a.when,specific:s.when});return l!==c?null:l||await _c({aligned:!0,context:e,patterns:[Js(s,i),Js(a,i)]})?Wb(s,a):null}));return Ub(o.filter(s=>s!=null))}function xd(e,t){let r=he(e),n=he(t);return r==null||n==null||v(r.subject)!==v(n.subject)?!1:Bb(r,n)}function Bb(e,t){return Vb(e)?Rd(e,t):e.expect.expect==="is"&&t.expect.expect==="is"?S(e.expect.value)!==S(t.expect.value):Rd(e,t)}function Vb(e){return e.subject.kind==="element"&&e.subject.state==="text"}function Wb(e,t){let r=Qr(e),n=Qr(t);return{a:e.consequence,aProducers:r,b:t.consequence,bProducers:n,tests:[...new Set([...wd(e),...wd(t)])],when:e.when}}function wd(e){return e.origin==null?[]:e.origin.kind==="declared"?[]:e.origin.kind==="test"?[e.origin.test]:Ct(e.origin)}function Ub(e){return[...e.reduce((r,n)=>{let i=[S(n.a),S(n.b)].toSorted((a,l)=>a.localeCompare(l)).join("|"),o=r.get(i),s=o==null?n:{...o,tests:[...new Set([...o.tests,...n.tests])]};return new Map([...r,[i,s]])},new Map).values()]}function Rd(e,t){let r=[e.expect,t.expect],n=r.find(o=>o.expect==="is"),i=r.find(o=>o.expect==="not");return n==null||i==null?!1:S(n.value)===S(i.value)}function Ed(e,t){return e.flatMap(r=>{let n=zb(r),i=new Set(r.requiredState.absences.map(o=>o.entity));return t.flatMap(o=>Gb(r,o,n,i))})}function zb(e){return new Set(e.steps.flatMap(t=>t.expect.flatMap(r=>r.kind==="state"&&r.assertion.kind==="deleted"?[r.entity]:[])))}function Gb(e,t,r,n){let{source:i,target:o}=t.reference;return!r.has(o)||r.has(i)||n.has(i)?[]:[{dataRule:t,source:i,target:o,transition:Ye(e)}]}var I=wc(Ad(),1),ce={actual:e=>I.default.red(e),bad:e=>I.default.red(I.default.bold(e)),bold:e=>I.default.bold(e),dim:e=>I.default.dim(e),expected:e=>I.default.green(e),good:e=>I.default.green(I.default.bold(e)),heading:e=>I.default.bold(I.default.cyan(e)),path:e=>I.default.cyan(I.default.underline(e)),warn:e=>I.default.yellow(I.default.bold(e))},Yb={assertion:I.default.yellow,consistency:I.default.magenta,"data rule":I.default.yellow,driver:I.default.red,fact:I.default.yellow,"impossible action":I.default.cyan,"model drift":I.default.red,precondition:I.default.yellow,reachability:I.default.yellow,redundancy:I.default.yellow,skipped:I.default.red,surface:I.default.yellow};function oe(e){return`${I.default.red(I.default.bold("\u2717"))} ${Yb[e](I.default.bold(e))}`}var Xb=I.default.red("\u2717"),kN=I.default.green("\u2713"),Zb=I.default.dim("\u203A"),Jb=8;function Pd(e,t,r){let n=r==null?"":` ${ce.dim(r)}`;return` ${ce.dim(e.padStart(Jb))} ${t}${n}`}function Md(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)":Qb(t.value)}function Qb(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 bi(e){let t=[...e.entities.map(r=>Si(r)),...e.absences.map(r=>`no ${Si(r)}`),...[...e.scalars.values()].filter(r=>r.subject.kind!=="path").filter(r=>!Id(r)).map(r=>wi(r))];return t.length===0?"always":t.join(" \u2227 ")}function wi(e){let t=ew(e.subject);return e.expect.expect==="absent"?`${t} absent`:e.subject.kind==="element"&&tw(e.expect.value)?e.expect.value?t:`not ${t}`:`${t} ${e.expect.expect==="not"?"\u2260":"="} ${Ze(e.expect.value)}`}function ue(e){return e.by==="role"?e.name==null?e.role:`${e.role} ${Ze(e.name)}`:e.by==="inside"?`${ue(e.scope)} \u25B8 ${ue(e.target)}`:e.by==="surface"?ue(e.container):e.by==="frame"?`frame ${ue(e.element)}`:Ze(e.value)}function Ze(e){return e===null?"\u2205":typeof e=="string"?`"${e}"`:typeof e!="object"?String(e):"ref"in e?`{${e.ref}}`:ea(e)}function ea(e){return e.template.map(t=>typeof t=="string"?t:":id").join("")}function Od(e,t){let r=new Set(t.entities.map(o=>Si(o))),n=new Set(t.scalars.keys()),i=[...e.entities.map(o=>Si(o)).filter(o=>!r.has(o)),...[...e.scalars].filter(([o])=>!n.has(o)).map(([,o])=>o).filter(o=>o.subject.kind!=="path"&&!Id(o)).map(o=>wi(o))];return i.length===0?"nothing beyond the shared state":i.join(" \u2227 ")}function Id(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 ew(e){return e.kind==="variable"?e.name:e.kind==="element"?`${e.state} ${ue(e.locator)}`:e.kind==="query"?`url query "${e.key}"`:e.kind==="title"||e.kind==="viewport"?e.kind:`url ${e.kind}`}function tw(e){return typeof e=="boolean"}function Si(e){let t=Object.entries(e.literals).map(([r,n])=>`${r}=${Ze(n)}`);return t.length===0?e.entity:`${e.entity}(${t.join(", ")})`}function Je(e){return e.by==="testId"?`testId=${e.value}`:e.by==="inside"?`${Je(e.scope)} \u25B8 ${Je(e.target)}`:e.by==="surface"?Je(e.container):e.by==="frame"?`frame ${Je(e.element)}`:e.name==null?e.role:`${e.role} "${e.name}"`}function Vt(e){return e.kind==="variable"?`global variable "${e.name}"`:e.kind==="element"?`${e.state} ${Je(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 vi(e){return e.url!=null?`${e.kind} ${e.url}`:e.locator!=null?`${e.kind} ${Je(e.locator)}`:e.kind}function Wt(e){if(e.kind==="not")return`not ${Wt(e.inner)}`;if(e.kind==="browser"){let t=nr(e.key);return e.value===null?`${t} absent`:`${t}="${e.value}"`}return e.kind==="value"||e.kind==="text"?`${e.kind} ${Je(e.locator)}="${e.value}"`:`${e.kind} ${Je(e.locator)}`}function Ut(e){let{field:t,source:r,target:n,targetField:i}=e.reference;return`${r}.${t} \u2192 ${n}.${i}`}function ta(e){return`${e.intent} \u203A ${vi(e.action)}`}function ra(e){return e.kind==="data-rule"?`data rule ${Ut(e.dataRule)}`:`${e.kind} ${Wt(e.check)}`}function Q(e){return e==null?"\u2205":JSON.stringify(e)}function na(e){return e.kind==="unexpected-row"?`${e.entity} "${e.key}" present in the app but the test expected none`:e.kind==="missing-row"?`${e.entity} "${e.key}" expected by the test but missing in the app`:e.kind==="wrong-value"?`${e.entity}.${e.field} [${e.key}] expected=${Q(e.snapshot)} actual=${Q(e.sut)}`:e.kind==="expected-change"?e.direction!=null?`${e.entity}.${e.field} [${e.key}] expected to have ${e.direction} from ${Q(e.from)} but showed ${Q(e.value)}`:`${e.entity}.${e.field} [${e.key}] expected to change but stayed ${Q(e.value)}`:`${Vt(e.subject)} expected=${ia(e.want)} actual=${Q(e.sut)}`}function xi(e){return{label:ra(e.source),step:ta(e.step)}}function Td(e){return e.expect==="absent"?"absent":e.expect==="not"?`not ${Q(e.value)}`:Q(e.value)}function ia(e){return e.expect==="absent"?"absent":e.expect==="not"?`anything but ${Q(e.value)}`:Q(e.value)}function rw(e){return e==null?"{ \u2026 }":`{ ${Object.entries(e).map(([r,n])=>`${r}: ${JSON.stringify(n)}`).join(", ")} }`}function Nd({evidencePath:e,finding:t}){let r=nw(t);return e==null?r:`${r} Evidence: ${ce.path(e)}`}function Ei(e){return sw(aw(e))}function nw(e){return e.kind==="consistency"?yw(e):e.kind==="pending-check"?Rw(e.source,e.step,e.budget):e.kind==="impossible-action"?`${oe("impossible action")} "${e.step.intent}" ran ${vi(e.step.action)} from a state the test calls impossible.`:e.kind==="unrunnable"?`${oe("model drift")} "${e.intent}" couldn't run \u2014 ${$d(e)}.`:e.kind==="lift-visibility"?`${oe("reachability")} ${ue(e.locator)} is visible by step ${String(e.visibleIndex+1)} but declared at step ${String(e.declaredIndex+1)}.`:`${oe("driver")} Browser failed at "${e.step.intent}" \u2014 ${jr(e.error)}. Environment, not app or test.`}var iw=new RegExp(`${String.fromCodePoint(27)}\\[[0-9;]*m`,"g");function oa(e){if(e.kind==="entities")return"a required row was not present";if(e.kind==="condition")return"a required condition did not hold";let t=e.want==null?"absent":Ze(e.want),r=e.got===void 0?"absent":Ze(e.got);return`${ow(e.subject)} needed ${t} but was ${r}`}function ow(e){return e.kind==="element"?`${e.state} ${ue(e.locator)}`:e.kind==="variable"?`"${e.name}"`:e.kind==="query"?`url query "${e.key}"`:e.kind==="actor"?"signed-in actor":`url ${e.kind}`}function $d(e){return e.unmet==null?cw(e.reason):oa(e.unmet)}function sw(e){return e.replaceAll(iw,"").replaceAll(/\s+/g," ").trim()}function aw(e){if(e.kind==="consistency"){let t=e.step==null?"":` after "${e.step.intent}"`;return`${na(e.mismatch)}${t}`}return e.kind==="pending-check"?`${xw(e.source)} failed at "${e.step.intent}": ${Ew(e.source)}`:e.kind==="impossible-action"?`"${e.step.intent}" ran from a state the test says can't happen`:e.kind==="unrunnable"?`model drift: planned step "${e.intent}" could not run \u2014 ${$d(e)}. Fix the model and recompile \u2014 do not dismiss`:e.kind==="lift-visibility"?`visible(${ue(e.locator)}) declared at step ${String(e.declaredIndex+1)} but already visible at step ${String(e.visibleIndex+1)}`:`driver failed at "${e.step.intent}": ${jr(e.error)}`}var lw={"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 cw(e){return lw[e]}function Ld({debugDir:e,runId:t}){let r=`${e}/${t}`;return Pd("behavior",ce.path(`${r}/behavior.jsonl`),void 0)}function tn(e){return e.kind==="drag"?`drag ${ue(e.source)} to ${ue(e.target)}`:"locator"in e&&e.locator!=null?`${e.kind} ${ue(e.locator)}`:"url"in e?`${e.kind} ${uw(e.url)}`:e.kind}function uw(e){return typeof e=="string"?e:"ref"in e?`{${e.ref}}`:ea(e)}function ft(e){return e.kind==="not"?`not ${ft(e.predicate)}`:e.kind==="and"?e.predicates.map(t=>ft(t)).join(" \u2227 "):e.kind==="when"?e.branches.map(t=>t.name).join(" | "):dw(e)}function dw(e){return"locator"in e?pw(e):e.kind==="browser"?`${e.name}=${Ze(e.value)}`:e.kind==="singleton"?`${e.singleton}=${Ze(e.assertion.value)}`:e.kind==="count"?Wn(e):e.kind==="actor"?e.target.kind==="anonymous"?"actor is signed out":`actor is ${e.target.ref.ref}`:""}function pw(e){let t=ue(e.locator);if(e.kind==="value"||e.kind==="text"){let r=rt(e.value)?e.value.value:e.value;return`${e.kind} ${t}=${Ze(r)}`}return`${e.kind} ${t}`}function Ri(e){return e==null?"At the end of the run":`After ${hw(e.action)} in ${e.intent}`}var fw={click:"clicking",fill:"filling",goto:"opening",hover:"hovering over",press:"pressing",select:"selecting",upload:"uploading to"};function hw(e){return e.url!=null?`opening ${e.url}`:e.locator!=null?`${fw[e.kind]??e.kind} ${Pt(e.locator)}`:e.kind}function Pt(e){return e.by==="testId"?`the element with testId "${e.value}"`:e.by==="inside"?`${Pt(e.target)} inside ${Pt(e.scope)}`:e.by==="surface"?Pt(e.container):e.by==="frame"?`the frame of ${Pt(e.element)}`:e.name==null?`the ${e.role}`:`the "${e.name}" ${e.role}`}function mw(e){return e.kind==="not"&&e.inner.kind==="visible"?`${Pt(e.inner.locator)} never disappeared`:e.kind==="visible"?`${Pt(e.locator)} never appeared`:e.kind==="value"||e.kind==="text"?`${Pt(e.locator)} never showed "${e.value}"`:`the check ${Wt(e)} never held`}function yw(e){let t=e.pending?gw(e):bw(e.mismatch,e.step);return`${oe("consistency")} ${t}`}function gw(e){let t=`${Fd(e.budget)} wait window`,{mismatch:r}=e,n=Ri(e.step);return r.kind==="wrong-value"?`${n}, ${r.entity}.${r.field} [${r.key}] never became ${ce.expected(Q(r.snapshot))} (still ${ce.actual(Q(r.sut))}) in the ${t}.`:r.kind==="unexpected-row"?`${n}, ${r.entity} row "${r.key}" still present after the ${t}.`:r.kind==="missing-row"?`${n}, ${r.entity} row "${r.key}" never appeared in the ${t}.`:r.kind==="expected-change"?r.direction!=null?`${n}, ${r.entity}.${r.field} [${r.key}] didn't ${r.direction} from ${Q(r.from)} (showed ${ce.actual(Q(r.value))}) in the ${t}.`:`${n}, ${r.entity}.${r.field} [${r.key}] never changed from ${ce.actual(Q(r.value))} in the ${t}.`:Sw({at:n,mismatch:r,window:t})}function Sw({at:e,mismatch:t,window:r}){let n=Vt(t.subject),i=`showed ${ce.actual(Q(t.sut))}, not ${ce.expected(ia(t.want))}`;return`${e}, ${n} ${i} through the ${r}.${Dd(t.subject)}`}function Dd(e){return e.kind!=="element"?"":" Likely a stale fact \u2014 if this value changes across revisits, use ephemeral() or Entity.updated({...})."}function Fd(e){return`${String(dt[e]/1e3)}s`}function bw(e,t){let r=Ri(t);return e.kind==="wrong-value"?`${r}, ${e.entity}.${e.field} [${e.key}] showed ${ce.actual(Q(e.sut))}, expected ${ce.expected(Q(e.snapshot))}.`:e.kind==="scalar-mismatch"?`${r}, ${Vt(e.subject)} showed ${ce.actual(Q(e.sut))}, expected ${ce.expected(ia(e.want))}.${ww(e)}`:e.kind==="unexpected-row"?`${r}, unexpected ${e.entity} row "${e.key}" ${rw(e.row)}.`:e.kind==="missing-row"?`${r}, expected ${e.entity} row "${e.key}" but found none.`:`${r}, ${e.entity}.${e.field} [${e.key}] stayed ${ce.actual(Q(e.value))}, expected a change.`}function ww(e){return e.subject.kind==="actor"&&e.sut==null?" No signed-in actor observed. If auth lives outside cookies, currentActor must read a `ripplo-actor` cookie set on sign-in. See /ripplo:setup.":Dd(e.subject)}function Rw(e,t,r){let n=`${Fd(r)} wait window`;return e.kind==="data-rule"?`${oe("data rule")} ${Ri(t)}, ${Ut(e.dataRule)} broke \u2014 a referenced row went missing.`:e.kind==="fact"?`${oe("fact")} A fact from ${vw(e.origin)} predicts ${Wt(e.check)} here but it didn't hold. Usually a stale prediction \u2014 an earlier step changed the record without declaring it. Fix with Entity.updated({...}) or ephemeral().`:`${oe("assertion")} ${Ri(t)}, ${mw(e.check)} within the ${n}.`}function vw(e){return e==null?"another workflow":e.kind==="test"?`an assertion in test "${e.test}"`:e.kind==="declared"?`the declared fact "${e.name}"`:`tests ${Ct(e).map(r=>JSON.stringify(r)).join(", ")}`}function xw(e){return e.kind==="data-rule"?"data rule":e.kind==="fact"?"fact":"assertion"}function Ew(e){return e.kind==="data-rule"?Ut(e.dataRule):Wt(e.check)}function ur(e){let t=le(e.scalars,{kind:"path"});return typeof t=="string"?t:null}function _d(e){return e.kind==="data-rule"?S({kind:e.kind,rule:Ys(e.dataRule)}):S(e)}function dr(e){return e.filter(t=>t.kind!=="unrunnable")}function ki({actual:e,canon:t,pre:r,predicted:n}){return[...[...new Set([...n.entities.keys(),...e.entities.keys()])].flatMap(s=>Pw({actual:e.entities.get(s),canon:t,entity:s,pre:r.entities.get(s),predicted:n.entities.get(s)})),...kw(r.scalars,n.scalars,e.scalars)]}function kw(e,t,r){let n=Qe(r,v({kind:"path"}))!==void 0;return[...[...t.entries()].flatMap(([o,s])=>{if(s.subject.kind==="actor")return[];let a=Qe(r,o),l=n&&wt(s.subject)&&s.expect.expect!=="absent",c=a===void 0&&l?null:a;if(!s.declared||c===void 0||Dt({got:c,subject:s.subject,want:s.expect}))return[];let u=Qe(e,o);return[{mismatch:{kind:"scalar-mismatch",subject:s.subject,sut:c,want:s.expect},pending:u!==void 0&&rn(u,c)}]}),...Cw(e,t,r),...Aw(e,t,r)]}function Qe(e,t){let r=e.get(t);return r==null||r.expect.expect!=="is"?void 0:r.expect.value}function Cw(e,t,r){let n=v({kind:"path"});if(Qe(r,n)===void 0)return[];let i=!rn(Qe(e,n),Qe(r,n));return[...new Set([...e.keys(),...r.keys()])].flatMap(s=>{let a=(e.get(s)??r.get(s))?.subject;if(a==null||!wt(a)||t.has(s))return[];let c=i&&a.kind!=="path"?null:Qe(e,s)??null,u=Qe(r,s)??null;return rn(c,u)?[]:[{mismatch:{kind:"scalar-mismatch",subject:a,sut:u,want:{expect:"is",value:c}},pending:!1}]})}function Aw(e,t,r){let n=v({kind:"actor"}),i=t.get(n);if(i==null)return[];let o=Qe(r,n);if(Dt({got:o,subject:{kind:"actor"},want:i.expect}))return[];let s=Qe(e,n);return[{mismatch:{kind:"scalar-mismatch",subject:{kind:"actor"},sut:o??null,want:i.expect},pending:s!==void 0&&rn(s,o)}]}function Pw({actual:e,canon:t,entity:r,pre:n,predicted:i}){return[...new Set([...i?.keys()??[],...e?.keys()??[]])].flatMap(s=>Mw({actual:e?.get(s),canon:t,entity:r,key:s,predicted:i?.get(s),preHadKey:n?.has(s)??!1,preRow:n?.get(s)}))}function Mw({actual:e,canon:t,entity:r,key:n,predicted:i,preHadKey:o,preRow:s}){if(i==null)return[{mismatch:{entity:r,key:n,kind:"unexpected-row",row:e},pending:o}];if(e==null)return[{mismatch:{entity:r,key:n,kind:"missing-row"},pending:!o}];let a=(c,u,d)=>rn(t(r,c,u),t(r,c,d));return[...new Set([...Object.keys(i),...Object.keys(e)])].filter(c=>!a(c,i[c],e[c])).map(c=>({mismatch:{entity:r,field:c,key:n,kind:"wrong-value",snapshot:i[c],sut:e[c]},pending:s==null?e[c]===void 0:a(c,s[c],e[c])}))}function rn(e,t){return jd(e)===jd(t)}function jd(e){return e==null?"\u2205":JSON.stringify(e)}function Ci(e){let t=Ow(e.entities),r=Iw(e.singletons);return n=>Tw(n,t,r)}function Ow(e){return new Map(e.flatMap(t=>Object.entries(t.props).map(([r,n])=>[Bd(t.name,r),n.consistency])))}function Bd(e,t){return`${e}.${t}`}function Iw(e){return new Map(e.map(t=>[t.name,t.consistency]))}function Tw(e,t,r){return e.kind==="scalar-mismatch"?Nw(e.subject,r):e.kind==="unexpected-row"||e.kind==="missing-row"?"strict":t.get(Bd(e.entity,e.field))??"strict"}function Nw(e,t){return e.kind==="variable"?t.get(e.name)??"strict":"eventual"}function Ai(e){let t=new Set(e.valueSpaces.filter(r=>r.kind==="datetime").map(r=>r.name));return(r,n,i)=>{if(!t.has(`${r}.${n}`)||typeof i!="string")return i;let o=Date.parse(i);return Number.isNaN(o)?i:new Date(o).toISOString()}}var De=class extends Error{name="AbortError";constructor(){super("aborted")}};function nn(e){return e instanceof Error&&e.name==="AbortError"}function Oe(e){if(e.aborted)throw new De}function Mt(e,t){return t.aborted?Promise.reject(new De):new Promise((r,n)=>{let i=()=>{clearTimeout(o),n(new De)},o=setTimeout(()=>{t.removeEventListener("abort",i),r()},e);t.addEventListener("abort",i,{once:!0})})}var $w={check:"Check",clear:"Clear",click:"Click",dblclick:"Double-click",fill:"Fill",goto:"Go to",hover:"Hover",press:"Press",select:"Select",uncheck:"Uncheck",upload:"Upload"};function Vd(e){let t=$w[e.kind]??e.kind;return e.kind==="press"&&e.key!=null?`${t}: ${e.key}`:t}function Mi(e){return e.kind==="data-rule"?"data rule":Wd(e.check)}function Wd(e){return e.kind==="not"?`not ${Wd(e.inner)}`:e.kind==="browser"?nr(e.key):`${Pi(e.locator)} ${e.kind}`}function Pi(e){return e.by==="testId"?"element":e.by==="inside"?Pi(e.target):e.by==="surface"?Pi(e.container):e.by==="frame"?Pi(e.element):e.role}function Ud(e){return e.kind==="goto"?e.url:e.kind==="press"?e.key:e.value==null?void 0:String(e.value)}function Oi(e){return e.kind==="data-rule"?void 0:Gd(e.check)}function zd(e){return e.kind==="data-rule"?!1:Ii(e.check)}function Ii(e){return e.kind==="not"?Ii(e.inner):e.kind==="browser"&&Qc(e.key)}function Gd(e){if(e.kind==="not")return Gd(e.inner);if(e.kind==="value"||e.kind==="text"||e.kind==="browser")return e.value??void 0}function qd({atMs:e,findings:t,step:r}){return r.urlChecks.map(n=>({atMs:e,ephemeral:!1,kind:"assertion",label:Mi({check:n,kind:"step"}),outcome:t.length>0?"failed":"passed",rrwebIds:[],url:!0,value:Oi({check:n,kind:"step"})}))}function Ti({action:e,actionLabel:t,outcome:r,rrwebIds:n,startMs:i}){return{atMs:i,ephemeral:!1,kind:"action",label:t,outcome:r,rrwebIds:n,url:!1,value:Ud(e)}}var Lw=()=>[],Dw=()=>Le;async function $i({canon:e,classify:t,dataRuleChecks:r,derive:n,initialSnapshot:i,observe:o,onAssertion:s,onStep:a,steps:l,stopAfterStep:c},u){return Zd({acc:[],canon:e,classify:t,dataRuleChecks:r??Lw,derive:n??Dw,index:0,observe:o,onAssertion:s,onStep:a,signal:u,snapshot:i,steps:l,stopAfterStep:c})}async function Zd({acc:e,canon:t,classify:r,dataRuleChecks:n,derive:i,index:o,observe:s,onAssertion:a,onStep:l,signal:c,snapshot:u,steps:d,stopAfterStep:p}){Oe(c);let m=d[o];if(m==null)return{finalModel:u,findings:e};let y=Date.now(),f=await m.targetIds(),h=Vd(m.step.action);if(!m.requiredState(u)){let w={kind:"impossible-action",step:m.step};return sa(l,{annotations:[Ti({action:m.step.action,actionLabel:h,outcome:"failed",rrwebIds:f,startMs:y})],endMs:Date.now(),findings:[w],index:o,post:u,pre:u,source:m.source,startMs:y,url:ur(u)}),{finalModel:u,findings:[...e,w]}}return m.perform().match(()=>Fw({acc:e,actionLabel:h,canon:t,classify:r,dataRuleChecks:n,derive:i,index:o,observe:s,onAssertion:a,onStep:l,rrwebIds:f,signal:c,snapshot:u,startMs:y,step:m,steps:d,stopAfterStep:p}),w=>{let x=Ni(w,m);return sa(l,{annotations:[Ti({action:m.step.action,actionLabel:h,outcome:"failed",rrwebIds:f,startMs:y})],endMs:Date.now(),findings:[x],index:o,post:u,pre:u,source:m.source,startMs:y,url:ur(u)}),Promise.resolve({finalModel:u,findings:[...e,x]})})}async function Fw({acc:e,actionLabel:t,canon:r,classify:n,dataRuleChecks:i,derive:o,index:s,observe:a,onAssertion:l,onStep:c,rrwebIds:u,signal:d,snapshot:p,startMs:m,step:y,steps:f,stopAfterStep:h}){let w=y.effect(p),x=o(w),g={...w,scalars:Ae(x,w.scalars)},E=await zw({canon:r,claimed:new Set([...y.assertedScalars,...x.keys()]),classify:n,observe:a,pre:p,predicted:g,signal:d,step:y}),T={...E.snapshot,scalars:new Map([...[...E.snapshot.scalars].filter(([,fe])=>fe.subject.kind!=="element"),...[...w.scalars].filter(([,fe])=>fe.subject.kind==="element")])},j=Date.now(),te=[...y.pendingChecks,...i(p,E.snapshot)],W=await _w({onAssertion:l,pendingChecks:te,signal:d,step:y,windowStartMs:m}),G=[...W.findings,...E.findings];sa(c,{annotations:[Ti({action:y.step.action,actionLabel:t,outcome:G.length>0?"failed":"passed",rrwebIds:u,startMs:m}),...qd({atMs:j,findings:E.findings,step:y}),...W.annotations],endMs:Date.now(),findings:G,index:s,post:E.snapshot,pre:p,source:y.source,startMs:m,url:ur(E.snapshot)});let re=[...e,...G];return G.length>0?{finalModel:T,findings:re}:h!=null&&s+1>=h?{finalModel:T,findings:re}:Zd({acc:re,canon:r,classify:n,dataRuleChecks:i,derive:o,index:s+1,observe:a,onAssertion:l,onStep:c,signal:d,snapshot:T,steps:f,stopAfterStep:h})}async function _w({onAssertion:e,pendingChecks:t,signal:r,step:n,windowStartMs:i}){let o=[...new Map(t.map(a=>[_d(a.source),a])).values()],s=await Promise.all(o.map(async a=>{let l=await Bw({pendingCheck:a,signal:r,windowStartMs:i}),c=Date.now(),u=await a.targetIds();return{atMs:c,outcome:l,pendingCheck:a,rrwebIds:u}}));return s.forEach(a=>{Vw(e,a.pendingCheck,a.outcome,n)}),{annotations:s.filter(a=>a.pendingCheck.source.kind==="step").map(a=>({atMs:a.atMs,ephemeral:a.pendingCheck.ephemeral,kind:"assertion",label:Mi(a.pendingCheck.source),outcome:Jd(a.outcome),rrwebIds:a.rrwebIds,url:zd(a.pendingCheck.source),value:Oi(a.pendingCheck.source)})),findings:s.flatMap(a=>Ww(a.pendingCheck,a.outcome,n))}}var jw=250;function Bw({pendingCheck:e,windowStartMs:t}){if(e.check.kind==="decided"){let i=e.check.passed?"passed":"failed";return Promise.resolve({kind:i})}let r=Date.now()-t,n=Math.max(jw,Vs[e.budget].timeoutMs-r);return e.check.wait(n).match(i=>i?{kind:"passed"}:{kind:"failed"},i=>{if(i.kind==="aborted")throw new De;return{error:i,kind:"error"}})}function Vw(e,t,r,n){e?.({outcome:Jd(r),source:t.source,step:n.step,waitBudget:t.budget,waitMs:dt[t.budget]})}function Jd(e){return e.kind==="passed"?"passed":e.kind==="error"?"error":"failed"}function Ww(e,t,r){return t.kind==="error"?[Ni(t.error,r)]:t.kind==="failed"?[{budget:e.budget,kind:"pending-check",source:e.source,step:r.step}]:[]}function Ni(e,t){return{error:e,kind:"driver-error",step:t.step}}function sa(e,t){e?.(t)}function Kd(e){return e().match(t=>({observed:t,ok:!0}),t=>({error:t,ok:!1}))}function Uw(e,t,r){return r.reconcile==null?e:r.reconcile(e,t)}function Hd(e,t,r){let n=e.probed.filter(i=>!i.pending&&r(i.mismatch)==="strict");return n.length>0?{findings:n.map(i=>Qd(i,t)),snapshot:e.adopted}:e.probed.length===0?{findings:[],snapshot:e.adopted}:null}function Qd(e,t){return{budget:t.sync,kind:"consistency",mismatch:e.mismatch,pending:e.pending,step:t.step}}function Yd({canon:e,pre:t,predicted:r,step:n},i){let o=n.verifyChanges==null?[]:n.verifyChanges(r,i),s=Uw(r,i,n),a=o.map(l=>({mismatch:l,pending:!0}));return{adopted:s,probed:[...a,...ki({actual:i.snapshot,canon:e,pre:t,predicted:s})]}}function Xd(e,t,r){return{findings:[...e.probed.map(n=>Qd(n,t)),...r],snapshot:e.adopted}}async function zw({canon:e,claimed:t,classify:r,observe:n,pre:i,predicted:o,signal:s,step:a}){let l=Vs[a.sync],c=Date.now()+l.timeoutMs,u=Ae(i.scalars,o.scalars),d=new Map([...u].filter(([h,w])=>w.declared&&(w.subject.kind!=="element"||t.has(h)))),p=()=>n(d),m=await Kd(p);if(!m.ok)return{findings:[Ni(m.error,a)],snapshot:o};let y=Yd({canon:e,pre:i,predicted:o,step:a},m.observed),f=0;for(;Date.now()<c;){Oe(s);let h=Hd(y,a,r);if(h!=null)return h;await Mt(Mu(l,f),s),f+=1;let w=await Kd(p);if(!w.ok)return Xd(y,a,[Ni(w.error,a)]);y=Yd({canon:e,pre:i,predicted:o,step:a},w.observed)}return Hd(y,a,r)??Xd(y,a,[])}function aa(e){let t=e.predicates.filter(o=>sp(o)),r=t.filter(o=>o.assertion.kind==="created"),n=np(t);if(r.length===0&&n.length===0&&e.deferred.length===0)return;let i=t.filter(o=>o.assertion.kind==="updated");return(o,s)=>{let a=r.reduce((u,d)=>Xw(u,s,d,e),{env:e.env,snapshot:o}),l=n.reduce((u,d)=>Yw(u,s,d,e.env),a.snapshot),c=i.reduce((u,d)=>Gw(u,s,d),a.env);return eR(l,e.deferred,c)}}function rp(e,t,r){return new Map([...e,...Object.entries(r).map(([n,i])=>[ke(M,`${t}.${n}`),i])])}function Gw(e,t,r){let n=ct(t.snapshot,r.entity,r.key,e).at(0);return n==null?e:rp(e,r.assertion.as,n)}function la(e){let t=np(e.predicates.filter(r=>sp(r)));if(t.length!==0)return(r,n)=>t.flatMap(i=>qw(i,r,n,e.env))}function np(e){return e.filter(t=>t.assertion.kind==="updated"&&ip(t.assertion.props).length>0)}function ip(e){return op(e).map(([t])=>t)}function op(e){return Object.entries(e).flatMap(([t,r])=>xt(r)?[[t,r.direction]]:[])}function sp(e){return e.assertion.kind==="created"||e.assertion.kind==="updated"}function qw(e,t,r,n){let i=ct(t,e.entity,e.key,n).at(0),o=ct(r.snapshot,e.entity,e.key,n).at(0);if(i==null||o==null)return[];let s=Wr(Kw(e.key,n));return op(e.assertion.props).flatMap(([a,l])=>Hw(i[a],o[a],l)?[]:[{direction:l,entity:e.entity,field:a,from:i[a],key:s,kind:"expected-change",value:o[a]}])}function Kw(e,t){let r=Object.fromEntries(Object.entries(e).filter(n=>!pe(n[1])&&!ye(n[1])));return rr(r,M,Re(t))}function Hw(e,t,r){return r==null?ep(e)!==ep(t):r==="increased"?tp(e,t):tp(t,e)}function ep(e){return e==null?"\u2205":JSON.stringify(e)}function tp(e,t){return(typeof e=="number"&&typeof t=="number"||typeof e=="string"&&typeof t=="string")&&e<t}function Yw(e,t,r,n){let i=ip(r.assertion.props),o=ct(t.snapshot,r.entity,r.key,n).at(0);return o==null?e:lu(e,r.entity,r.key,n,s=>({...s,...Object.fromEntries(i.flatMap(a=>{let l=o[a];return l===void 0?[]:[[a,l]]}))}))}function Xw(e,t,r,n){if(r.assertion.kind!=="created")return e;let i=rr(r.assertion.props,M,Re(n.env)),o=e.snapshot.entities.get(r.entity);if(o==null)return e;let s=Zw({identityFields:n.identities.get(r.entity)??[],props:i,set:o});if(s==null)return e;let a=Jw(t.snapshot.entities.get(r.entity),o,i);if(a==null)return e;let[l,c]=a,u=new Map(o);return u.delete(s),u.set(l,{...c,...i}),{env:rp(e.env,r.assertion.as,c),snapshot:{...e.snapshot,entities:new Map(e.snapshot.entities).set(r.entity,u)}}}function Zw({identityFields:e,props:t,set:r}){let n=Wr(t);if(r.has(n))return n;if(e.length===0)return null;let i=Object.entries(t),o=[...r].find(([,s])=>e.every(a=>au(s[a]))&&i.every(([a,l])=>Li(s[a])===Li(l)));return o==null?null:o[0]}function Jw(e,t,r){if(e==null)return;let n=Object.entries(r),i=[...e].filter(([o])=>!t.has(o)).map(([o,s])=>({entry:[o,s],score:n.filter(([a,l])=>Li(s[a])===Li(l)).length}));return Qw(i,n.length)}function Li(e){return e==null?"\u2205":JSON.stringify(e)}function Qw(e,t){let r=e.reduce((i,o)=>Math.max(i,o.score),0);if(r===0)return;let n=e.filter(i=>i.score===r);if(!(r<t&&n.length!==1))return n[0]?.entry}function eR(e,t,r){let n=t.reduce((i,o)=>{let s=tR(o.value,r);return s==null||typeof s!="string"?i:at(i,{declared:!0,expect:{expect:"is",value:s},subject:o.key})},e.scalars);return{...e,scalars:n}}function tR(e,t){try{return qe(e,M,Re(t))}catch{return}}function ca(e,t){if(e.kind==="visible"||e.kind==="unobstructed"||e.kind==="disabled"||e.kind==="enabled"||e.kind==="focused"||e.kind==="checked"||e.kind==="expanded"||e.kind==="pressed")return{kind:e.kind,locator:ae(e.locator,t)};if(e.kind==="not"){let r=ca(e.predicate,t);return r==null?null:{inner:r,kind:"not"}}return e.kind==="value"||e.kind==="text"?rR(e,t):e.kind!=="browser"?null:{key:Kn(e.name,e.part),kind:"browser",value:e.value===null?null:qe(e.value,M,t)}}function pr(e,t){let{env:r,identities:n}=t,i=e.expect.filter(f=>f.kind==="state"),o=pR(i),s=t.snapshot==null?void 0:sr(t.snapshot,i,t),a={counts:s==null?void 0:ge(s),env:r},l={counts:t.snapshot==null?void 0:ge(t.snapshot),env:r},{clears:c,deferred:u,sets:d}=sR(e,a,o),p=ei(e),m=fR(e.action,l),y=nR(e);return{action:m,assertedScalars:[...d.keys()],label:e.action.kind,pendingChecks:e.expect.flatMap(f=>yR(f,a,p)),reconcile:aa({deferred:u,env:r,identities:n,predicates:i}),urlChecks:e.expect.flatMap(f=>mR(f,a)),verifyChanges:la({deferred:u,env:r,identities:n,predicates:i}),effect:f=>su(sr(f,i,t),{clears:c,forget:y,sets:d})}}function rR(e,t){let r=rt(e.value);return{kind:e.kind,locator:ae(e.locator,t),match:r?e.value.kind:"exact",value:qe(r?e.value.value:e.value,M,t)}}function nR(e){return e.action.kind==="goto"||e.action.kind==="actor"||iR(e)?"hard":Bt(e)?"soft-path":"none"}function iR(e){return e.expect.some(t=>t.kind==="actor")}function oR(e){return e.action.kind!=="actor"?null:{expect:{expect:"is",value:{ref:`${e.action.ref.ref}.id`}},subject:{kind:"actor"}}}function sR(e,t,r){let n=e.action.kind==="goto"?qr(e.action.url):[],i=oR(e),o=kt(e.expect).flatMap(l=>{let c=he(l);return c==null?[]:[c]}),s=[...n,...o,...i==null?[]:[i]].map(l=>({declared:!0,entry:l}));return[...Kr(e).map(l=>({declared:!1,entry:l})),...s].reduce((l,{declared:c,entry:u})=>aR({acc:l,captures:r,declared:c,entry:u,scope:t}),{clears:[],deferred:[],sets:Le})}function aR({acc:e,captures:t,declared:r,entry:n,scope:i}){if(lR(n,t))return n.expect.expect==="is"&&ap(n.expect.value)?{...e,deferred:[...e.deferred,{key:dR(n.subject),value:n.expect.value}]}:e;let o=lt({declared:r,entry:n,scope:i});return o.expect.expect==="absent"&&!wt(o.subject)?{...e,clears:[...e.clears,v(o.subject)]}:{...e,sets:at(e.sets,o)}}function lR(e,t){return e.subject.kind==="element"||e.subject.kind==="variable"?!1:e.expect.expect==="is"&&ap(e.expect.value)&&cR(e.expect.value,t)}function ap(e){return typeof e=="string"||typeof e=="object"}function cR(e,t){return uR(e).some(r=>t.has(ar(r)))}function uR(e){return typeof e=="string"?[]:U(e)?[e.ref]:e.template.filter(t=>typeof t!="string").map(t=>t.ref)}function dR(e){if(e.kind==="element"||e.kind==="variable"||e.kind==="actor")throw new Error("expected a browser subject");return e}function pR(e){return new Set(e.flatMap(t=>t.assertion.kind==="created"||t.assertion.kind==="updated"?[t.assertion.as]:[]))}function fR(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:hR(e,t),target:e.kind==="drag"?ae(e.target,t):void 0,url:e.kind==="goto"?qe(e.url,M,t):void 0,value:"value"in e?Yc(e.value,t):void 0}}function hR(e,t){if(e.kind==="drag")return ae(e.source,t);if(!(!("locator"in e)||e.locator==null))return ae(e.locator,t)}function mR(e,t){if(e.kind!=="browser"&&e.kind!=="not")return[];try{let r=ca(e,t);return r!=null&&Ii(r)?[r]:[]}catch(r){if(r instanceof st)return[];throw r}}function yR(e,t,r){if(e.kind==="browser"||e.kind==="singleton")return[];let n=ca(e,t),i=r?"slow":"fast",o="wait"in e?e.wait??i:i;return n==null?[]:[{budget:o,check:n,ephemeral:Qt(e)}]}import{err as gR,errAsync as SR,ok as lp,okAsync as cp,Result as bR}from"neverthrow";function fr(e,t,r){let n=MR(e),i={env:new Map,generate:r.generate,generatedParams:new Set,indexed:n,overrides:new Map(Object.entries(r.params??{}).map(([s,a])=>[$e(s),a]))};OR(t.params,M,i);let o=t.world.map(s=>IR(s,M,i));return r.materialize(o).andThen(s=>LR(s,i.env,n).asyncAndThen(a=>wR({base:a,rows:s,signIn:r.signIn,test:t}).map(l=>RR({base:l,generatedParams:i.generatedParams,lockfile:e,test:t}))))}function Di(e,t){let r=new Map(t.map(n=>[n.name,n]));return n=>cp(CR(n,e,r).rows)}function Fi(e){return t=>{let r=t.map(n=>({as:n.as,entity:n.entity,fields:n.fields}));return e(r).andThen(n=>kR(t,n))}}function da(e,t){let r=on(t);return Object.fromEntries(Object.entries(e).filter(([n,i])=>r.includes(n)&&i!=null))}function on(e){return Object.keys(e.props)}function wR({base:e,rows:t,signIn:r,test:n}){if(n.actor.kind!=="user"||r==null)return cp(e);let i=n.actor.alias,o=t.find(s=>s.as===i);return o==null?SR(ys(i)):r({entity:o.entity,row:o.row}).map(s=>({...e,auth:s}))}function RR({base:e,generatedParams:t,lockfile:r,test:n}){let i=Object.fromEntries(r.singletons.map(d=>[d.name,d.default])),o=Object.fromEntries(Object.entries(n.singletons).map(([d,p])=>[d,Ce(p,M,Re(e.env))])),s=Object.entries(n.singletons).filter(([,d])=>vR(d,t)).map(([d])=>d),a={...i,...o},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=xR(e.aliases,n);return{...e,clientState:c,generatedSingletons:s,snapshot:{...e.snapshot,scalars:Ae(e.snapshot.scalars,new Map([...Object.entries(a).map(([d,p])=>[v({kind:"variable",name:d}),{declared:!0,expect:{expect:"is",value:p},subject:{kind:"variable",name:d}}]),...u,...ER(n)]))}}}function vR(e,t){return U(e)?t.has(ke(M,e.ref)):Ge(e)?e.template.some(r=>typeof r!="string"&&"ref"in r&&t.has(ke(M,r.ref))):!1}function xR(e,t){if(t.actor.kind!=="user")return[];let r=t.actor.alias,n=e.find(i=>i.alias===r);return n==null?[]:[[v({kind:"actor"}),{declared:!1,expect:{expect:"is",value:n.key},subject:{kind:"actor"}}]]}function ER(e){return[[v({kind:"viewport"}),{declared:!1,expect:{expect:"is",value:e.viewport},subject:{kind:"viewport"}}]]}function kR(e,t){let r=new Map(t.map(n=>[n.as,n]));return bR.combine(e.map(n=>{let i=r.get(n.as);return i==null?gR(ys(n.as)):lp({as:n.as,entity:n.entity,generatedFields:n.generatedFields,row:i.row})}))}function CR(e,t,r){return e.reduce((n,i)=>{let o=AR(i.fields,n.env),s=DR({generate:t,model:i.model,seedPrefix:i.seedPrefix,set:o,valueSpaces:r}),a=Object.entries(s).map(([c,u])=>[`${i.as}.${c}`,u]),l=Object.keys(s).filter(c=>!(c in o));return{env:new Map([...n.env,...a]),rows:[...n.rows,{as:i.as,entity:i.entity,generatedFields:[...new Set([...i.generatedFields,...l])],row:s}]}},{env:new Map,rows:[]})}function AR(e,t){return Object.fromEntries(Object.entries(e).map(([r,n])=>{if(U(n))return[r,PR(t,n.ref)];if(Ge(n))throw new Error(`template value not allowed in entity field "${r}"`);return[r,n]}))}function PR(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 MR(e){return{models:new Map(e.entities.map(t=>[t.name,t])),valueSpaces:new Map(e.valueSpaces.map(t=>[t.name,t]))}}function OR(e,t,r){Object.entries(e).forEach(([n,i])=>{let o=ke(t,n),s=r.indexed.valueSpaces.get(i.valueSpace);if(s==null)throw new Error(`unknown valueSpace "${i.valueSpace}" for param "${o}"`);let a=r.overrides.get(o);a==null&&r.generatedParams.add(o);let l=a??r.generate.value({anchor:void 0,nullable:!1,seed:o,space:s,type:vc(s),valueSpace:i.valueSpace});r.env.set(o,l)})}function IR(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 i=ke(t,e.as),o=TR(e.set,t,r.env),s=$R(n,o,i,r),a=Object.entries(e.set).filter(([,l])=>U(l)&&r.generatedParams.has(ke(t,l.ref))).map(([l])=>l);return{as:i,entity:e.entity,fields:{...s,...o},generatedFields:[...Object.keys(s),...a],model:n,seedPrefix:i}}function TR(e,t,r){return Object.fromEntries(Object.entries(e).map(([n,i])=>[n,NR(i,t,r)]))}function NR(e,t,r){if(!U(e))return e;let n=ke(t,e.ref);return r.get(n)??{ref:n}}function $R(e,t,r,n){return Object.fromEntries(Object.entries(e.props).filter(([i,o])=>!o.optional&&!e.identity.includes(i)&&!(i in t)).map(([i,o])=>[i,up({field:i,generate:n.generate,model:e,seedPrefix:r,spec:o,valueSpaces:n.indexed.valueSpaces})]))}function LR(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(ke($e(a.as),u),d));let c=n.get(a.entity)??new Map;c.set(ua(a.row,l),da(a.row,l)),n.set(a.entity,c)});let i=e.flatMap(a=>{let l=r.models.get(a.entity);return l==null?[]:[{alias:a.as,entity:a.entity,key:ua(a.row,l)}]}),o=e.flatMap(a=>{let l=r.models.get(a.entity);if(l==null)return[];let c=ua(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 lp({aliases:i,auth:void 0,env:t,generated:o,principals:s,snapshot:{entities:FR(n),scalars:Le}})}function DR({generate:e,model:t,seedPrefix:r,set:n,valueSpaces:i}){return{...Object.fromEntries(Object.entries(t.props).filter(([s])=>!(s in n)).map(([s,a])=>[s,up({field:s,generate:e,model:t,seedPrefix:r,spec:a,valueSpaces:i})])),...n}}function up({field:e,generate:t,model:r,seedPrefix:n,spec:i,valueSpaces:o}){let s=`${r.name}.${e}`;return t.value({anchor:void 0,nullable:i.optional,seed:ke(n,e),space:o.get(s),type:i.type,valueSpace:s})}function ua(e,t){return t.identity.map(r=>String(e[r])).join(":")}function FR(e){return new Map([...e].map(([t,r])=>[t,new Map(r)]))}function sn(e,t,r){let n=Pe(e.requiredState,t);return n==null?null:new Map([...Object.entries(r).map(([i,o])=>[$e(i),o]),...n])}function an(e,t,r){let n={env:t,identities:e.identities,snapshot:r},i=du(e.whenSteps,r,n),o=i.at(-1)??e.effectStep,s=pr(o,n),a=jR(e,n),l=i.reduce((c,u)=>{let d=pr(u,{...n,snapshot:c.current});return{current:d.effect(c.current),steps:[...c.steps,{action:d.action,assertedScalars:d.assertedScalars,effect:d.effect,pendingChecks:d.pendingChecks,reconcile:d.reconcile,source:u,urlChecks:d.urlChecks,verifyChanges:d.verifyChanges}]}},{current:r,steps:[]});return{effect:BR(s.effect,a),steps:l.steps}}function ji(e,t,r){return Pe(e.requiredState,r)==null?!1:_i(t(r))!==_i(r)||VR(e)||_R(e)}function _R(e){return[...e.nav,...e.steps].every(t=>t.expect.every(r=>r.kind!=="state"))}var dp=new WeakMap;function _i(e){let t=dp.get(e);if(t!=null)return t;let r=S({entities:[...e.entities].toSorted(([n],[i])=>n.localeCompare(i)).map(([n,i])=>[n,[...i].toSorted(([o],[s])=>o.localeCompare(s))]),scalars:ks(e.scalars).map(([n,i])=>[n,i.expect])});return dp.set(e,r),r}function jR(e,t){let r=e.nav.at(-1);if(r!=null)return pr(r,t).action.url}function BR(e,t){if(t==null)return e;let r=or(t);return n=>{let i=e(n);return{...i,scalars:Ae(i.scalars,r)}}}function VR(e){return e.effectStep.expect.some(t=>t.kind==="state"&&t.assertion.kind==="updated"&&Object.values(t.assertion.props).some(r=>xt(r)))}function hr(e,t,r){let n=sn(e,t.snapshot,r);if(n==null)return null;let i=WR(e,n,t.snapshot);return i==null||!ji(e,i.effect,t.snapshot)?null:{next:{snapshot:i.effect(t.snapshot)},resolved:i}}function pp(e,t,r){let n=sn(e,t.snapshot,r);if(n==null)return"required-state-unsatisfied";try{return an(e,n,t.snapshot),"no-effect"}catch(i){if(i instanceof st)return"unresolvable";throw i}}function WR(e,t,r){try{return an(e,t,r)}catch(n){if(n instanceof st)return null;throw n}}function Bi(e,t,r){return e.flatMap((n,i)=>{let o=r(n),s=hr(n,t,o);return s==null?[]:[{idx:i,label:Ye(n),params:o,stepRun:s}]})}function pa(e,t){let r=[...t.entities].flatMap(([o,s])=>[...s].map(([a,l])=>UR({entity:o,key:a,pre:e,row:l}))),n=[...e.entities].flatMap(([o,s])=>[...s].flatMap(([a,l])=>zR({entity:o,key:a,post:t,row:l}))),i=[...t.scalars.values()].flatMap(o=>{if(o.subject.kind!=="variable"||o.expect.expect!=="is")return[];let s=o.subject.name;return[{changed:le(e.scalars,o.subject)!==o.expect.value,name:s,value:o.expect.value}]});return{rows:[...r,...n],singletons:i}}function UR({entity:e,key:t,pre:r,row:n}){let i=GR(r.entities.get(e),t),o=Object.entries(n).map(([s,a])=>({changed:i==null||i[s]!==a,field:s,value:a}));return{changed:i==null||o.some(s=>s.changed),entity:e,fields:o,key:t,status:i==null?"created":"present"}}function zR({entity:e,key:t,post:r,row:n}){if(r.entities.get(e)?.has(t)===!0)return[];let i=Object.entries(n).map(([o,s])=>({changed:!1,field:o,value:s}));return[{changed:!0,entity:e,fields:i,key:t,status:"deleted"}]}function GR(e,t){return e?.get(t)}function mr(e,t,r){return t.steps.map(n=>({assertedScalars:n.assertedScalars,effect:n.effect,pendingChecks:n.pendingChecks.map(i=>({budget:i.budget,check:{kind:"poll",wait:o=>r.awaitCheck(i.check,o)},ephemeral:i.ephemeral,source:{check:i.check,kind:"step"},targetIds:()=>r.locateIds(fp(i.check))})),reconcile:n.reconcile,source:n.source,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)}))}function fp(e){if(e.kind==="not")return fp(e.inner);if(e.kind!=="browser")return e.locator}async function hp({current:e,driver:t,index:r,next:n,state:i}){if(n==null||qR(n))return[];if(Bt(e.transition.effectStep))return[];let o=hr(n.transition,i,n.params);if(o==null)return[];let s=mr(n.transition,o.resolved,t).flatMap(c=>c.pendingChecks.flatMap(u=>{let d=KR(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[v(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=le(l.snapshot.scalars,u)===!0,p=le(i.snapshot.scalars,u)===!1;return d&&p}).map(c=>({declaredIndex:r+1,kind:"lift-visibility",locator:c,visibleIndex:r}))}function qR(e){return e.transition.nav.length>0||e.transition.steps.some(t=>t.action.kind==="goto"||Bt(t))}function KR(e){if(e.kind!=="data-rule")return e.check.kind==="visible"?e.check.locator:void 0}async function ha(e,t){let{params:r,transition:n}=e.stepRun,i={snapshot:li(e.facts,e.state.snapshot)},o=hr(n,i,r);if(o==null){let a=pp(n,i,r),l={intent:n.intent,kind:"unrunnable",reason:a,test:n.test,unmet:a==="required-state-unsatisfied"?Jn(n.requiredState,i.snapshot)??void 0:void 0};return{label:Ye(n),next:e.state,result:{finalModel:e.state.snapshot,findings:[l]}}}let s=await $i({canon:e.canon,classify:e.classify,initialSnapshot:e.state.snapshot,observe:e.driver.observe,onAssertion:e.onAssertion,onStep:e.onStep,steps:mr(e.stepRun.transition,o.resolved,e.driver),stopAfterStep:e.stopAfterStep==null?void 0:e.stopAfterStep-e.stepBase,dataRuleChecks:(a,l)=>e.dataRules.flatMap(c=>yp(c,l)),derive:a=>Jr(e.facts,a)},t);return{label:Ye(e.stepRun.transition),next:{snapshot:s.finalModel},result:s}}function yp(e,t){return pi(e,t)?[{budget:"fast",check:{kind:"decided",passed:!1},ephemeral:!1,source:{dataRule:e,kind:"data-rule"},targetIds:()=>Promise.resolve([])}]:[]}function Vi(e,t){return fa({acc:{findings:[],ran:[]},index:0,params:e,signal:t,state:e.initialState,stepBase:0})}async function fa({acc:e,index:t,params:r,signal:n,state:i,stepBase:o}){Oe(n);let s=r.sequence[t];if(s==null)return e;let a=Date.now(),l=[],c=await ha({canon:r.canon,classify:r.classify,dataRules:r.dataRules,driver:r.driver,facts:r.facts,onAssertion:r.onAssertion,state:i,stepBase:o,stepRun:s,stopAfterStep:r.stopAfterStep,onStep:p=>{l.push(p.index),r.onEvent({annotations:p.annotations,endMs:p.endMs,findings:p.findings,index:o+p.index,kind:"step",source:p.source,startMs:p.startMs,state:pa(p.pre,p.post),url:p.url})}},n);if(c==null)return fa({acc:e,index:t+1,params:r,signal:n,state:i,stepBase:o});r.onEvent({endMs:Date.now(),intent:s.transition.intent,kind:"ran",startMs:a});let u=await HR({index:t,outcome:c,params:r,signal:n,state:i,stepBase:o,stepRun:s},l),d={findings:[...e.findings,...c.result.findings,...u],ran:[...e.ran,c.label]};return c.result.findings.length>0||u.length>0||r.stopAfterStep!=null&&o+l.length>=r.stopAfterStep?d:fa({acc:d,index:t+1,params:r,signal:n,state:c.next,stepBase:o+l.length})}async function HR(e,t){let{index:r,outcome:n,params:i,stepBase:o,stepRun:s}=e,a=t.length>0;!a&&n.result.findings.length>0&&mp(i,s,e.state,o,n.result.findings);let l=i.sequence[r+1],c=a?await hp({current:s,driver:i.driver,index:r,next:l,state:n.next}):[];return n.result.findings.forEach(u=>{i.onEvent({finding:u,kind:"finding"})}),c.length>0&&l!=null&&mp(i,l,n.next,o+t.length,c),c}function mp(e,t,r,n,i){let o=Date.now(),s=le(r.snapshot.scalars,{kind:"path"});e.onEvent({annotations:[],endMs:o,findings:i,index:n,kind:"step",source:t.transition.steps[0]??t.transition.effectStep,startMs:o,state:pa(r.snapshot,r.snapshot),url:typeof s=="string"?s:null})}function gp(e){return J(e).flatMap(t=>YR(t.test))}function YR(e){let t=new Map(e.world.map(n=>[n.as,n])),r=JR(e.steps);return e.steps.flatMap((n,i)=>n.expect.filter(o=>QR(o)).flatMap(o=>XR({createdAliases:r,predicate:o,setByAlias:t,stepIndex:i,test:e})))}function XR(e){let{createdAliases:t,predicate:r,setByAlias:n,stepIndex:i,test:o}=e,s=ZR(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:i,test:`${o.workflow}/${o.slug}`}))}function ZR(e){return Object.values(e.key).flatMap(t=>U(t)?[ar(t.ref)]:[]).at(0)}function JR(e){return new Set(e.flatMap(t=>t.expect.flatMap(r=>r.kind==="state"&&r.assertion.kind==="created"?[r.assertion.as]:[])))}function QR(e){return e.kind==="state"&&e.assertion.kind==="updated"}function Sp(e){return J(e).flatMap(({test:t})=>ev(t.steps,ne(t)))}function ev(e,t){return e.reduce((r,n)=>{let i=tv(n.action).filter(o=>!rv(o,r.pre)).map(o=>({action:n.action,ephemeralOnly:r.ephemeralKeys.has(S(de(o))),target:o,test:t}));return{ephemeralKeys:new Set([...r.ephemeralKeys,...nv(n)]),pre:He(r.pre,[n]),violations:[...r.violations,...i]}},{ephemeralKeys:new Set,pre:Lt,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 rv(e,t){let r=S(de(e)),n=[...t.values()].filter(o=>o.subject.kind==="element"&&S(de(o.subject.locator))===r);if(n.length===0)return!1;let i=o=>n.some(s=>s.subject.kind==="element"&&s.subject.state===o&&s.expect.expect==="is"&&s.expect.value===!1);return!i("visible")&&!i("enabled")}function nv(e){return Qn(e.expect).filter(t=>Qt(t)).flatMap(t=>bp(t)).map(t=>S(de(t)))}function bp(e){return e.kind==="not"?bp(e.predicate):"locator"in e?[e.locator]:[]}function wp(e){let t=Xe(e);return J(e).flatMap(({test:r})=>[...av(r.steps,ne(r),t),...iv(r.steps,r.actor,ne(r))])}function iv(e,t,r){return e.reduce((n,i,o)=>{let s=i.action.kind==="actor"?{alias:i.action.ref.ref,kind:"user"}:n.actor,a=ov(i).filter(l=>sv(l.target,s)).map(l=>({predicate:l,stepIndex:o,test:r}));return{actor:Xr(n.actor,[i]),flagged:[...n.flagged,...a]}},{actor:t,flagged:[]}).flagged}function ov(e){return e.expect.filter(t=>t.kind==="actor")}function sv(e,t){return e.kind==="anonymous"?t.kind==="anonymous":t.kind==="user"&&t.alias===e.ref.ref}function av(e,t,r){let n=ii(Lt,r),i=new Set(n.keys());return e.reduce((o,s,a)=>{let l=dv(s),c=lv({acc:o,assertions:l,stepIndex:a,test:t}),u=ii(He(o.pattern,[s]),r);return{assertedKeys:new Set([...cv({acc:o,assertions:l,pattern:u,step:s}),...i]),pattern:u,redundant:[...o.redundant,...c]}},{assertedKeys:i,pattern:n,redundant:[]}).redundant}function lv({acc:e,assertions:t,stepIndex:r,test:n}){return t.reduce((i,{entry:o,predicate:s})=>{let a=v(o.subject),l=S(o.expect),c=e.pattern.get(a),u=c!=null&&e.assertedKeys.has(a)&&S(c.expect)===l,d=i.seen.get(a)===l;return{flagged:u||d?[...i.flagged,{predicate:s,stepIndex:r,test:n}]:i.flagged,seen:new Map([...i.seen,[a,l]])}},{flagged:[],seen:new Map}).flagged}function cv({acc:e,assertions:t,pattern:r,step:n}){let i=new Set([...uv(n),...Kr(n)].map(a=>v(a.subject))),o=[...e.assertedKeys].filter(a=>r.has(a)&&!i.has(a)),s=t.map(({entry:a})=>v(a.subject)).filter(a=>r.has(a));return new Set([...o,...s])}function uv(e){return e.action.kind==="goto"?qr(e.action.url):[]}function dv(e){return kt(e.expect).flatMap(t=>{if(t.kind==="actor")return[];let r=he(t);return r==null?[]:[{entry:r,predicate:t}]})}var pv=2;function Rp(e){return J(e).flatMap(({test:t})=>t.steps.reduce((n,i,o)=>{let s=fv(i,n.pre),a=s.length>=pv?[...n.violations,{hidden:s,stepIndex:o,test:ne(t)}]:n.violations;return{pre:He(n.pre,[i]),violations:a}},{pre:Lt,violations:[]}).violations)}function fv(e,t){return e.expect.flatMap(r=>{let n=hv(r);return n!=null&&!ma(n)&&mv(n,t)?[n]:[]})}function hv(e){return e.kind!=="not"||e.predicate.kind!=="visible"?null:e.predicate.locator}function ma(e){return e.by==="surface"?!0:e.by==="inside"?ma(e.scope)||ma(e.target):!1}function mv(e,t){let r=t.get(v({kind:"element",locator:e,state:"visible"}));return r!=null&&r.expect.expect==="is"&&r.expect.value===!0}function xp(e){return J(e).flatMap(({test:t})=>{let r=ne(t);return t.steps.reduce((n,i,o)=>yv(n,i,o,r),{found:[],open:new Set}).found})}function yv(e,t,r,n){let i=t.action.kind==="goto"?new Set:e.open,o=vp(t,gv),s=vp(t,Sv),a=new Set([...i,...o].filter(c=>!s.has(c))),l=bv(t).flatMap(c=>a.has(S(de(c.surface)))?[]:[{...c,stepIndex:r,test:n}]);return{found:[...e.found,...l],open:a}}function vp(e,t){return new Set(e.expect.flatMap(r=>{let n=t(r);return n==null?[]:[S(de(n))]}))}function gv(e){return e.kind!=="visible"?null:e.locator.by==="surface"?e.locator:null}function Sv(e){return e.kind!=="not"||e.predicate.kind!=="visible"?null:e.predicate.locator.by==="surface"?e.predicate.locator:null}function bv(e){return e.expect.flatMap(t=>{if(t.kind!=="visible"||t.locator.by!=="inside")return[];let r=Ep(t.locator);return r==null?[]:[{content:t.locator,surface:r}]})}function Ep(e){return e.by!=="inside"?null:e.scope.by==="surface"?e.scope:Ep(e.scope)}function Cp(e){switch(e.kind){case"cascade-gap":{let{gap:t}=e;return`${oe("data rule")} ${t.transition} deletes ${t.target} but leaves ${t.source} rows pointing at it, breaking ${Ut(t.dataRule)}. Cascade the delete or declare the cleanup.`}case"create-gap":return wv(e.gap);case"unreachable-interaction":{let{violation:t}=e,r=ue(t.target);return t.ephemeralOnly?`${oe("reachability")} ${t.test}: ${tn(t.action)}, but ${r} was only declared inside ephemeral(...), which grants no reachability. Assert a durable visible(...) first.`:`${oe("reachability")} ${t.test}: ${tn(t.action)}, but no prior step declared ${r} reachable. Assert visible(...) on it first.`}case"redundant-assertion":{let{redundancy:t}=e;return`${oe("redundancy")} ${t.test}: step ${String(t.stepIndex+1)} restates "${ft(t.predicate)}" \u2014 already asserted and unchanged since. Delete it.`}case"missing-precondition":{let{missing:t}=e;return`${oe("precondition")} ${t.test}: step ${String(t.stepIndex+1)} updates ${t.entity}.${t.field} but no earlier step or seed establishes its prior value. Set it on the step that creates the row, or seed it (a value, arbitrary(...), or null) \u2014 don't split the journey into a separate workflow.`}case"fact-conflict":return Rv(e.conflict);case"unmodeled-surface":{let{surface:t}=e,r=t.hidden.map(n=>ue(n)).join(", ");return`${oe("surface")} ${t.test}: step ${String(t.stepIndex+1)} hides ${String(t.hidden.length)} elements at once (${r}). Elements hidden together are one surface \u2014 declare surface(...) and scope them to it.`}case"unpinned-surface-content":{let{content:t}=e,r=ue(t.surface);return`${oe("surface")} ${t.test}: step ${String(t.stepIndex+1)} asserts ${ue(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 wv(e){let t=e.missing.length===1?"field":"fields",r=e.missing.length===1?"it":"them";return`${oe("data rule")} ${e.transition} creates ${e.entity} without required ${t} ${e.missing.join(", ")}. Set ${r} or drop the requirement.`}function Rv(e){return[`${oe("fact")} Two facts contradict on overlapping states \u2014 "${ft(e.a)}" vs "${ft(e.b)}".`,` Shared state: ${bi(e.when)}.`,kp(e.a,e.aProducers,e.when),kp(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 kp(e,t,r){let n=t.map(i=>` - ${i.test} adds ${Od(i.when,r)}`);return[` "${ft(e)}" declared by:`,...n].join(`
6
- `)}var vv=24301;function Wi(e,t){return e.reduce((r,n)=>Cv(r,t[n.idx]?.paramSpaces),new Map)}function yr(e,t){return Object.fromEntries(Object.entries(e.paramSpaces).map(([r,n])=>[r,xv(n,n?.name==null?0:t.get(n.name)??0)]))}var Ap=new WeakMap;function xv(e,t){if(e==null)return Pp(void 0,t);let r=Ap.get(e)??new Map;Ap.set(e,r);let n=r.get(t);if(n!=null)return n;let i=Pp(e,t);return r.set(t,i),i}function Ev(e){return e==null?Pv(10):e.kind==="enum"?nt.constantFrom(...e.values):e.kind==="number"?nt.integer({max:e.max,min:e.min}):e.kind==="boolean"?nt.boolean():e.kind==="datetime"?Mv():kv(e)}function Pp(e,t){let[r]=nt.sample(Ev(e),{numRuns:1,seed:vv+t});if(r==null)throw new Error("arbitrary produced no sample");return r}function kv(e){let t=e.refine??e.pattern;return nt.stringMatching(new RegExp(`^(?:${t})$`,"u")).filter(r=>(e.minLength==null||r.length>=e.minLength)&&(e.maxLength==null||r.length<=e.maxLength))}function Cv(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 Av="abcdefghijklmnopqrstuvwxyz0123456789".match(/./g)??[],Pv=e=>nt.array(nt.constantFrom(...Av),{maxLength:e,minLength:1}).map(t=>t.join(""));function Mv(){return nt.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 Ov=new Map;function Ui(e){return yr(e,Ov)}import{z as L}from"zod";var gr=L.enum(["crash","data-rule","fact","frame","model-drift"]),Mp=L.object({intent:L.string().min(1),test:L.string().min(1)}),Iv=L.union([L.object({kind:L.literal("scalar-mismatch"),subject:L.string().min(1)}),L.object({entity:L.string().min(1),kind:L.string().min(1)})]),Tv=L.discriminatedUnion("kind",[L.object({kind:L.literal("consistency"),layer:gr,mismatch:Iv,step:Mp.nullable()}),L.object({kind:L.literal("pending-check"),layer:gr,source:L.string().min(1),step:Mp}),L.object({intent:L.string().min(1),kind:L.literal("unrunnable"),layer:gr,reason:L.string().min(1),test:L.string().min(1)}),L.object({error:L.string().min(1),kind:L.literal("driver-error"),layer:gr,step:L.string().min(1)}),L.object({kind:L.literal("impossible-action"),layer:gr,step:L.string().min(1)})]);function ya(e){return e.kind==="driver-error"?"crash":e.kind==="unrunnable"?"model-drift":e.kind==="pending-check"?e.source.kind==="data-rule"?"data-rule":e.source.kind==="fact"?"fact":"frame":"frame"}function ln(e,t){let r=t.map(o=>({finding:o,line:Ei(o),part:Ip(o)})).toSorted((o,s)=>S(o.part).localeCompare(S(s.part))),n=r.map(o=>o.part),i=r.at(0)?.finding;return{layer:Lv(n),signature:S({baseState:e,parts:n.map(o=>S(o))}),sourceTest:i==null?void 0:Nv(i),title:r.at(0)?.line}}function Nv(e){switch(e.kind){case"pending-check":case"impossible-action":case"driver-error":return e.step.test;case"consistency":return e.step?.test;case"unrunnable":return e.test;case"lift-visibility":return}}var Op={crash:0,"data-rule":1,fact:2,frame:3,"model-drift":4};function Ip(e){let t=ya(e);switch(e.kind){case"consistency":return{kind:"consistency",layer:t,mismatch:$v(e.mismatch),step:e.step==null?null:{intent:e.step.intent,test:e.step.test}};case"pending-check":return{kind:"pending-check",layer:t,source:e.source.kind,step:{intent:e.step.intent,test:e.step.test}};case"unrunnable":return{intent:e.intent,kind:"unrunnable",layer:t,reason:e.reason,test:e.test};case"driver-error":return{error:e.error.kind,kind:"driver-error",layer:t,step:e.step.intent};case"impossible-action":return{kind:"impossible-action",layer:t,step:e.step.intent};case"lift-visibility":return{kind:"impossible-action",layer:t,step:`lift:${String(e.visibleIndex)}`}}}function $v(e){return e.kind==="scalar-mismatch"?{kind:e.kind,subject:Vt(e.subject)}:{entity:e.entity,kind:e.kind}}function Lv(e){return e.map(r=>r.layer).toSorted((r,n)=>Op[r]-Op[n]).at(0)??"frame"}function Sa(e){let t=new Map(e.entities.flatMap(i=>Object.entries(i.props).flatMap(([o,s])=>s.valueSpace==null?[]:[[`${i.name}.${o}`,s.valueSpace]]))),r=new Map(e.singletons.flatMap(i=>i.valueSpace==null?[]:[[i.name,i.valueSpace]]));return e.workflows.flatMap(i=>i.steps.flatMap(o=>o.expect.flatMap(s=>zi(s)))).reduce((i,o)=>{let s=o.kind==="field"?t.get(o.key):r.get(o.key);if(s==null)return i;let a=i.get(s)??[];return a.includes(o.value)?i:new Map([...i,[s,[...a,o.value]]])},new Map)}function zi(e){return e.kind==="not"?zi(e.predicate):e.kind==="and"?e.predicates.flatMap(t=>zi(t)):e.kind!=="when"?[]:e.branches.flatMap(t=>[...t.condition==null?[]:ga(t.condition),...t.consequence.flatMap(r=>zi(r))])}function ga(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"?ga(e.predicate):e.kind==="and"||e.kind==="or"?e.predicates.flatMap(t=>ga(t)):Object.entries(e.where).flatMap(([t,r])=>r===null||typeof r=="object"?[]:[{key:`${e.entity}.${t}`,kind:"field",value:r}])}import{z as Tp}from"zod";var Np=Tp.object({maxAttemptLength:Tp.number().int().positive()}),ba={even:{maxAttemptLength:12}};function $p(e){return ba[e]}function Gi(e){return{startingPoint:e.startingPoint.name,steps:Lp(e,e.startingPoint.snapshot,[])}}function Lp(e,t,r){if(r.length>=e.strategy.maxAttemptLength)return r;let n=li(e.facts,t),i=Bi(e.corpus,{snapshot:n},jv(e,r)),o=Fv(i,e.corpus,e.random());return o==null?r:Lp(e,o.stepRun.next.snapshot,[...r,{idx:o.idx,params:o.params}])}var Dv=.02;function Fv(e,t,r){let n=e.map(a=>_v(a.idx,t)),i=n.reduce((a,l)=>a+l,0);if(i<=0)return null;let o=r*i,s=n.reduce((a,l,c)=>{if(a.hit!=null)return a;let u=a.acc+l;return{acc:u,hit:u>o?c:null}},{acc:0,hit:null});return e[s.hit??e.length-1]??null}function _v(e,t){return t[e]?.effectStep.action.kind==="goto"?Dv:1}function jv(e,t){let r=Wi(t,e.corpus);return n=>Vv({drawn:yr(n,r),params:e,prior:r,rule:n})}var Bv=3;function Vv({drawn:e,params:t,prior:r,rule:n}){return Object.fromEntries(Object.entries(e).map(([i,o])=>{let s=n.paramSpaces[i],a=s==null?void 0:t.literals.get(s.name);if(s==null||a==null||a.length===0)return[i,o];let l=r.get(s.name)??0;return l%Bv!==1?[i,o]:[i,a[l%a.length]??o]}))}function Dp(e){return Math.max(9e4,e*1e4)}import{z as R}from"zod";var Fp=R.object({baseStateTest:Tc,lockfileHash:R.string().min(1),stepRuns:R.array(R.object({idx:R.number().int().nonnegative(),params:R.record(R.string(),R.union([ls,R.null()]))}))}),_p=R.object({baseStateRef:R.string().min(1),steps:R.array(R.object({index:R.number().int().nonnegative(),params:R.record(R.string(),R.union([ls,R.null()])),test:R.string().min(1)}))}),jp=R.object({actions:R.array(R.string()),label:R.string().min(1)}),wa=R.object({test:R.string().min(1),text:R.string()}),qi=R.object({baseLabel:R.string(),baseState:R.string().min(1),durationMs:R.number().int().nonnegative(),signature:R.string().optional(),steps:R.array(wa)}),Ra=R.enum(["driver","infra","trail"]),va=R.discriminatedUnion("source",[R.object({source:R.literal("empty-trail")}),R.object({source:R.literal("bad-assign")}),R.object({detail:R.string(),source:R.literal("config")}),R.object({source:R.literal("lockfile-stale")}),R.object({detail:R.string(),source:R.literal("transport")}),R.object({category:Ra,kind:R.string(),source:R.literal("runtime")})]);function Bp(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 Vp=R.discriminatedUnion("kind",[R.object({kind:R.literal("aborted")}),R.object({error:va,kind:R.literal("error")}),R.object({kind:R.literal("clean"),trail:qi}),R.object({kind:R.literal("flaky"),trail:qi}),R.object({kind:R.literal("seen"),trail:qi}),R.object({kind:R.literal("finding"),runId:R.string().optional(),trail:qi})]);function Ki(e,{sweep:t}){let r=Me(J(e),n=>S({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=>Uv(n))]:r}function Wv(e){return e.world.filter(t=>{let r={...e,world:e.world.filter(n=>n!==t)};return Cu(r).every(n=>ar(n)!==t.as)})}function Hi(e,t,r){return fr(e,t.test,r)}function Uv(e){return Wv(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 Yi(e){let t=Hr(e);if(t.length===0)return null;let r=Ki(e,{sweep:!1}),n=await zv(e,r);if(n.length===0)return null;let i=cr(e);return{corpus:t,facts:{facts:i.facts.filter(o=>!o.localConsequence),overlays:Xe(e),overrides:i.overrides},literals:Sa(e),startingPoints:n,startingPointTests:new Map(r.map(o=>[o.name,o.test]))}}function Wp({lockfileHash:e,prepared:t,random:r,strategy:n}){let i=t.startingPoints[Math.floor(r()*t.startingPoints.length)];if(i==null)return null;let o=Gi({corpus:t.corpus,facts:t.facts,literals:t.literals,random:r,startingPoint:i,strategy:n}),s=t.startingPointTests.get(o.startingPoint);return s==null||o.steps.length===0?null:{baseStateTest:s,lockfileHash:e,stepRuns:o.steps.map(a=>({idx:a.idx,params:a.params}))}}async function zv(e,t){let r={generate:_r,materialize:Di(_r,e.valueSpaces),params:void 0,signIn:void 0};return(await Promise.all(t.map(async i=>(await Hi(e,i,r)).match(s=>({name:i.name,snapshot:s.snapshot}),()=>null)))).flatMap(i=>i==null?[]:[i])}import{createServer as ix}from"http";import{mkdir as ox,rm as sx,writeFile as ax}from"fs/promises";import lx from"path";import{z as D}from"zod";var cx="otlp-port",zp=D.object({key:D.string(),value:D.object({boolValue:D.boolean().optional(),doubleValue:D.number().optional(),intValue:D.union([D.string(),D.number()]).optional(),stringValue:D.string().optional()})}),ux=D.object({attributes:D.array(zp).default([]),endTimeUnixNano:D.string(),kind:D.number().default(0),name:D.string(),parentSpanId:D.string().optional(),spanId:D.string(),startTimeUnixNano:D.string(),status:D.object({code:D.number(),message:D.string().optional()}).optional(),traceId:D.string()}),dx=D.object({resourceSpans:D.array(D.object({resource:D.object({attributes:D.array(zp).default([])}).optional(),scopeSpans:D.array(D.object({spans:D.array(ux).default([])})).default([])})).default([])});async function xa({localDir:e,onRrwebBatch:t,onSpan:r,writePortFile:n}){let{port:i,server:o}=await px({onRrwebBatch:t,onSpan:r}),s=lx.join(e,cx);return n&&(await ox(e,{recursive:!0}),await ax(s,String(i),{encoding:"utf8"})),{port:i,stop:async()=>{n&&await sx(s,{force:!0}),await gx(o)}}}function px(e){return new Promise((t,r)=>{let n=ix((i,o)=>{fx(i,o,e)});n.on("error",r),n.listen(0,()=>{let i=n.address();if(i==null||typeof i=="string"){r(new Error("otlp_receiver_no_port"));return}t({port:i.port,server:n})})})}function fx(e,t,r){let n=hx(e.url);if(n!=null){Up(e).then(i=>{r.onRrwebBatch(n,i),Xi(t)}).catch(()=>{Xi(t)});return}Up(e).then(i=>{mx(dx.parse(JSON.parse(i.toString("utf8"))),r.onSpan),Xi(t)}).catch(()=>{Xi(t)})}function hx(e){if(e==null||!e.startsWith("/rrweb/"))return;let t=decodeURIComponent(e.slice(7));return t.length===0?void 0:t}function Up(e){return new Promise((t,r)=>{let n=[];e.on("data",i=>{n.push(i)}),e.on("end",()=>{t(Buffer.concat(n))}),e.on("error",r)})}function Xi(e){e.writeHead(200,{"content-type":"application/json"}),e.end("{}")}function mx(e,t){e.resourceSpans.flatMap(r=>r.scopeSpans).flatMap(r=>r.spans).forEach(r=>{t({attributes:yx(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:Ec(r.kind),status:{code:kc(r.status?.code??0),message:r.status?.message},timeNanos:r.startTimeUnixNano,traceId:r.traceId})})}function yx(e){return Object.fromEntries(e.map(({key:t,value:r})=>[t,String(r.stringValue??r.intValue??r.doubleValue??r.boolValue??"")]))}function gx(e){return new Promise((t,r)=>{e.close(n=>{if(n==null){t();return}r(n)}),e.closeAllConnections()})}import{ResultAsync as cn}from"neverthrow";function zt(e,t,r){if(t==null)throw new Error("action requires a locator");return ht(e,t,r)}function ht(e,t,r){if(t.by==="inside"){if(t.scope.by==="frame"){let o=ht(e,t.scope.element,{visibleOnly:!1});return ht(o.contentFrame(),t.target,r)}let i=ht(e,t.scope,r);return ht(i,t.target,r)}if(t.by==="surface")return ht(e,t.container,r);if(t.by==="frame")return ht(e,t.element,r);let n=t.by==="testId"?e.getByTestId(t.value):e.locator(Ea(t.role,t.name));return r.visibleOnly?n.filter({visible:!0}):n}function Ea(e,t){return t==null?`role=${e}`:`role=${e}[name=${JSON.stringify(t)}i]`}var ka=3e4,Sr=class extends Error{mountKey;constructor(t){super("client-mount-unmounted"),this.mountKey=t}},Gt=class extends Error{readyKey;timeoutMs;constructor(t,r){super("app-not-ready"),this.readyKey=t,this.timeoutMs=r}};function Ca(e){return{read:t=>Sx(t,e),seedScript:t=>`globalThis[${JSON.stringify(Ic)}] = ${JSON.stringify(t)};`}}async function Sx(e,t){let r=Ae(or(e.url()),Gp([[{kind:"title"},await e.title()],[{kind:"viewport"},vx(e.viewportSize())]]));if(t.length===0)return{scalars:r};let n=await e.evaluate(wx,{mountKey:cs,names:t,timeoutMs:bx});if(n.kind==="unmounted")throw new Sr(cs);let i=Gp(Object.entries(n.values).map(([o,s])=>[{kind:"variable",name:o},s]));return{scalars:Ae(r,i)}}function Gp(e){return new Map(e.flatMap(([t,r])=>r===void 0?[]:[[v(t),{declared:!0,expect:{expect:"is",value:r},subject:t}]]))}var bx=ka;async function wx(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 Rx=768;function vx(e){return e==null?"":e.width<Rx?"mobile":"desktop"}async function Zi({page:e,readiness:t,signal:r,startMs:n,tries:i,url:o}){if(Oe(r),!await xx(e,o)){if(Date.now()-n>=t.budgetMs)throw new Gt(Vn,t.budgetMs);let a=t.backoffMs[Math.min(i,t.backoffMs.length-1)]??8e3;await Mt(a,r),await Zi({page:e,readiness:t,signal:r,startMs:n,tries:i+1,url:o});return}let s=Math.max(0,t.budgetMs-(Date.now()-n));if(!await Ax(e,r,Math.min(s,kx(t,i)))){if(Date.now()-n>=t.budgetMs)throw new Gt(Vn,t.budgetMs);await Zi({page:e,readiness:t,signal:r,startMs:n,tries:i+1,url:o})}}function Aa(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 Ji(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 xx(e,t){let r=await Ex(e,t);return r==="net-error"?!1:r==null||r.status()<400}async function Ex(e,t){try{return await e.goto(t,{waitUntil:"domcontentloaded"})}catch(r){if(Aa(r))return"net-error";throw r}}function kx(e,t){return t===0?e.budgetMs/2:e.budgetMs}var Cx=50;async function Ax(e,t,r){let n=Date.now()+r;for(;Date.now()<n;){if(Oe(t),await qp(e))return!0;await Mt(Cx,t)}return qp(e)}async function qp(e){try{return await e.evaluate(Px,Vn)}catch(t){if(Ji(t))return!1;throw t}}function Px(e){return Reflect.get(globalThis,e)===!0}async function Pa(e,t,r){if(r.kind==="browser")return Ix(e,t,r.key,r.value);if(r.kind==="not")return!await Pa(e,t,r.inner);let n=zt(e,r.locator,{visibleOnly:!0});return r.kind==="value"?Kp(await n.inputValue(),r.value,r.match):r.kind==="text"?Kp(await n.textContent()??"",r.value,r.match):r.kind==="unobstructed"?Mx(n):Ox(n,r.kind)}function Kp(e,t,r){let n=ir(e),i=ir(t);return r==="contains"?n.includes(i):r==="startsWith"?n.startsWith(i):n===i}function Mx(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 i=2,o=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},(m,y)=>u+i+(d-i*2)*y/(p-1)),c=a(r.left,r.width,o).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 Ox(e,t){return t==="visible"?e.isVisible():t==="disabled"?e.isDisabled():t==="enabled"?e.isEnabled():t==="checked"?e.isChecked():t==="expanded"?Hp(e,r=>r.getAttribute("aria-expanded")==="true"):t==="pressed"?Hp(e,r=>r.getAttribute("aria-pressed")==="true"):e.evaluate(r=>r===r.ownerDocument.activeElement)}async function Hp(e,t){return await e.count()===0?!1:e.evaluate(t)}async function Ix(e,t,r,n){let i=await t.read(e),o=le(i.scalars,r);return n===null?o===void 0:o===n}var Ma={backoffMs:[500,1e3,2e3,4e3,8e3],budgetMs:ka},Tx={readiness:Ma,readSession:void 0,switchActor:void 0};function Oa(e,t,r,n,{readiness:i,readSession:o,switchActor:s}=Tx){return{awaitCheck:(a,l)=>cn.fromPromise(Lx({check:a,engine:r,page:e,signal:n,timeoutMs:l}),c=>nn(c)?{kind:"aborted"}:Qi(c)),evaluate:a=>cn.fromPromise(Xp(Ia(e,r,a),`check ${a.kind}`),Qi),locateIds:a=>Hx(e,a),observe:a=>cn.fromPromise(o==null?Promise.resolve(void 0):o(),Qi).andThen(l=>t.read(l)).andThen(l=>cn.fromPromise(Xp(jx({backend:l,engine:r,page:e,tracked:a}),"observe"),Qi)),perform:a=>cn.fromPromise(Qp(e,a,0,n,{readiness:i,switchActor:s}),l=>Nx(a,l))}}function Qi(e){return e instanceof Sr?Un(e.mountKey):bs(e)}async function Ia(e,t,r){try{return await Pa(e,t,r)}catch(n){if(Ji(n))return!1;throw n}}function Nx(e,t){return t instanceof Gt?fs(t.readyKey,t.timeoutMs):t instanceof Sr?Un(t.mountKey):Ss(e.kind,t)}var $x=75;function Lx(e){return e.check.kind==="visible"?Dx({locator:e.check.locator,page:e.page,signal:e.signal,timeoutMs:e.timeoutMs}):Zp(e,Date.now()+e.timeoutMs)}async function Zp(e,t){return Oe(e.signal),await Ia(e.page,e.engine,e.check)?!0:Date.now()>=t?!1:(await Mt($x,e.signal),Zp(e,t))}async function Dx({locator:e,page:t,signal:r,timeoutMs:n}){try{return await Promise.race([zt(t,e,{visibleOnly:!0}).waitFor({state:"visible",timeout:n}),Fx(r)]),!0}catch(i){if(_x(i))return!1;throw i}}function Fx(e){return new Promise((t,r)=>{if(e.aborted){r(new De);return}e.addEventListener("abort",()=>{r(new De)},{once:!0})})}function _x(e){return e instanceof Error&&e.name==="TimeoutError"}async function jx({backend:e,engine:t,page:r,tracked:n}){let i=await Jp(r,t,0),o=await Bx(r,t,n);return{snapshot:{...e,scalars:new Map([...e.scalars,...i.scalars,...o])}}}async function Bx(e,t,r){let n=await Promise.all([...r.values()].filter(i=>i.subject.kind==="element").map(async i=>{let o=await Vx(e,t,i.subject);return[v(i.subject),{declared:!0,expect:{expect:"is",value:o},subject:i.subject}]}));return new Map(n)}async function Vx(e,t,r){return r.state==="value"||r.state==="text"?Wx(e,r.locator,r.state):Ia(e,t,{kind:r.state,locator:r.locator})}async function Wx(e,t,r){try{let n=zt(e,t,{visibleOnly:!0});return r==="value"?await n.inputValue():await n.textContent()??""}catch{return""}}var Ux=[100,250,500];async function Jp(e,t,r){try{return await t.read(e)}catch(n){let i=Ux[r];if(i==null||!Ji(n))throw n;return await ef(i),Jp(e,t,r+1)}}var Yp=35e3;function Xp(e,t){let r,n=new Promise((i,o)=>{r=setTimeout(()=>{o(new Error(`driver op "${t}" exceeded ${String(Yp)}ms`))},Yp)});return Promise.race([e,n]).finally(()=>{clearTimeout(r)})}var zx=[250,750,2e3];async function Qp(e,t,r,n,i){try{await Gx(e,t,n,i.readiness,i.switchActor)}catch(o){let s=zx[r];if(s==null||!Aa(o))throw o;await ef(s),await Qp(e,t,r+1,n,i)}}async function Gx(e,t,r,n,i){if(t.kind==="actor"){if(i==null)throw new Error("this driver cannot switch actors");await i(Ot(t.actorRef,t,"actorRef"));return}if(t.kind==="goto"){await Zi({page:e,readiness:n,signal:r,startMs:Date.now(),tries:0,url:Ot(t.url,t,"url")});return}if(t.kind==="press"&&t.locator==null){await e.keyboard.press(Ot(t.key,t,"key"));return}let o=t.kind!=="upload";await qx(e,zt(e,t.locator,{visibleOnly:o}),t)}function Ot(e,t,r){if(e==null)throw new Error(`action "${t.kind}" requires ${r}`);return e}function qx(e,t,r){switch(r.kind){case"goto":throw new Error("goto must not be located");case"fill":return t.fill(String(Ot(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 Kx(e,t,String(Ot(r.value,r,"value")));case"upload":return t.setInputFiles(Ot(r.files,r,"files"));case"press":return t.press(Ot(r.key,r,"key"));case"drag":return t.dragTo(zt(e,Ot(r.target,r,"target"),{visibleOnly:!0}));case"actor":throw new Error("actor switch must not be located")}}async function Kx(e,t,r){if(await t.evaluate(i=>i.tagName==="SELECT")){await t.selectOption(r);return}await t.click(),await t.fill(r),await e.locator(Ea("option",r)).filter({visible:!0}).click()}function ef(e){return new Promise(t=>{setTimeout(t,e)})}async function Hx(e,t){if(t==null)return[];try{let r=ht(e,t,{visibleOnly:!1});if(await r.count()===0)return[];let n=await r.first().evaluate(Yx);return n>0?[n]:[]}catch{return[]}}function Yx(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 i=n.getId;if(typeof i!="function")return-1;let o=i.call(n,e);return typeof o=="number"?o:-1}import Xx from"path";var rf={desktop:{height:720,width:1280},mobile:{height:844,width:390}};function nf(e){return rf[e]}var tF=rf.desktop;async function Ta({baseUrl:e,browser:t,capture:r,clientState:n,engine:i,fixturesDir:o,networkHeaders:s,observeActor:a,reader:l,session:c,signal:u,signInActor:d,viewport:p}){let m=await t.newContext({baseURL:e,ignoreHTTPSErrors:!0,reducedMotion:"reduce",storageState:c==null?void 0:{cookies:$a(c.cookies,e),origins:c.origins},viewport:p});s!=null&&await Qx(m,e,s),c?.headers!=null&&await m.setExtraHTTPHeaders(c.headers),await m.addInitScript("globalThis.__name = globalThis.__name ?? ((target) => target);"),await m.addInitScript(i.seedScript(n));let y=r==null?eE():await r.hub.attach(m,r.runId),f=await m.newPage();y.onPage(f);let h=f,w=Zx({baseUrl:e,context:m,page:f,signInActor:d}),x=a?Jx(e,m):void 0;return{context:m,driver:nE(tE(Oa(h,l,i,u,{readiness:Ma,readSession:x,switchActor:w}),o),y),emitAssertion:y.emitAssertion,close:()=>iE({context:m,handle:y})}}async function Na(e,t){let r=await sf(e,void 0);try{return await t(r)}finally{await r.close()}}async function of(e){let{chromium:t}=await import("playwright");return t.launchPersistentContext(e,{headless:!1,viewport:null})}function Zx({baseUrl:e,context:t,page:r,signInActor:n}){if(n!=null)return async i=>{let o=await n(i).match(s=>s,s=>{throw new Error(`actor switch failed: ${s.kind}`)});await t.clearCookies(),await t.addCookies($a(o.cookies,e)),o.headers!=null&&await t.setExtraHTTPHeaders(o.headers),await r.reload()}}function $a(e,t){let r=new URL(t).hostname;return e.map(n=>({...n,domain:r}))}function Jx(e,t){return async()=>{let r=await t.cookies();return{cookies:$a(r,e),headers:void 0,origins:[]}}}async function Qx(e,t,r){let n=new URL(t).host;await e.route(i=>i.host===n,i=>i.continue({headers:{...i.request().headers(),...r}}))}function eE(){return{emitAction:()=>{},emitAssertion:()=>{},finish:()=>Promise.resolve(),onPage:()=>{}}}async function sf(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 eo({cacheDir:e,headed:t}){let r;return{acquire:async()=>{let o=r;if(o!=null){let s=await o.catch(()=>{});if(s?.isConnected()===!0)return s;r===o&&(r=void 0)}return r??=sf(t,e),r},close:async()=>{let o=r;r=void 0,o!=null&&await o.then(s=>s.close()).catch(()=>{})}}}function tE(e,t){return{awaitCheck:e.awaitCheck,evaluate:e.evaluate,locateIds:e.locateIds,observe:e.observe,perform:r=>e.perform(rE(r,t))}}function rE(e,t){return e.kind!=="upload"||e.files==null?e:{...e,files:e.files.map(r=>Xx.join(t,r))}}function nE(e,t){return{awaitCheck:e.awaitCheck,evaluate:e.evaluate,locateIds:e.locateIds,observe:e.observe,perform:r=>(t.emitAction(r),e.perform(r))}}async function iE({context:e,handle:t}){await tf(t.finish()),await tf(e.close())}var oE=15e3;async function tf(e){let t,r=new Promise(n=>{t=setTimeout(n,oE)});await Promise.race([e.catch(()=>{}),r]).finally(()=>{clearTimeout(t)})}import{err as sE,ok as aE,Result as La}from"neverthrow";function Da(e,t,r){return{read:n=>r.read(e.map(i=>i.name),t,n).andThen(i=>lE(e,i))}}function lE(e,t){return La.combine(e.map(r=>cE(r,t.entities[r.name]??[]).map(n=>[r.name,n]))).map(r=>({entities:new Map(r),scalars:new Map([...pE(t.singletons),...fE(t.actor)])}))}function cE(e,t){let r=on(e);return La.combine(t.map(n=>uE(n,e).map(i=>[i,dE(n,r)]))).map(n=>new Map(n))}function uE(e,t){return La.combine(t.identity.map(r=>{let n=e[r];return n==null?sE(ms(t.name,r)):aE(String(n))})).map(r=>r.join(":"))}function dE(e,t){let r=t.map(n=>[n,e[n]]).filter(n=>n[1]!=null);return Object.fromEntries(r)}function pE(e){return Object.entries(e).map(([t,r])=>[v({kind:"variable",name:t}),{declared:!0,expect:{expect:"is",value:r},subject:{kind:"variable",name:t}}])}function fE(e){return e==null?[]:[[v({kind:"actor"}),{declared:!1,expect:{expect:"is",value:e},subject:{kind:"actor"}}]]}var af=wc(Iy(),1);import hE from"crypto";import{err as mE,errAsync as Fa,ok as yE,ResultAsync as br}from"neverthrow";var gE=1e4,SE=[250,750,2e3],bE=[500,1e3,2e3,3e3];function _a({baseUrl:e,extraHeaders:t,runId:r,secret:n},i){let o=new af.Webhook(n),s=(a,l,c)=>wE({baseUrl:e,body:l,extraHeaders:t,path:a,retry:c.retry,schema:c.schema,signal:c.signal,webhook:o});return{query:{read:(a,l,c)=>s("/state",{entities:a,runId:r,session:c,singletons:l},{retry:"transient",schema:Dc,signal:i}).map(u=>({actor:u.actor,entities:u.entities,singletons:u.singletons}))},ready:()=>cf(e,t,i,0),setupWorld:a=>s("/setup",{entities:a,runId:r},{retry:"connection",schema:$c,signal:i}).map(l=>l.rows),signIn:({entity:a,row:l})=>s("/sign-in",{entity:a,row:l,runId:r},{retry:"connection",schema:Lc,signal:i}).map(c=>c.session),teardown:()=>s("/teardown",{runId:r},{retry:"connection",schema:Fc,signal:void 0}).map(()=>{})}}function wE(e){return lf(e.retry,()=>EE(e),0)}function lf(e,t,r){return t().orElse(n=>{let i=SE[r];return i==null||!vE(n,e)?Fa(n):br.fromSafePromise(uf(i)).andThen(()=>lf(e,t,r+1))})}function cf(e,t,r,n){return br.fromPromise(fetch(e,{headers:t,method:"HEAD",signal:df(r)}),i=>er("",i)).map(()=>{}).orElse(()=>{let i=bE[n];return i==null||r.aborted?Fa(gs(e)):br.fromSafePromise(uf(i)).andThen(()=>cf(e,t,r,n+1))})}var RE=new Set(["EAI_AGAIN","ECONNREFUSED","ENOTFOUND"]);function vE(e,t){return e.kind==="aborted"?!1:xE(e)?!0:t==="connection"?!1:e.kind==="engine-network"||e.kind==="engine-http"&&e.status>=500}function xE(e){return e.kind==="engine-network"&&e.code!=null&&RE.has(e.code)}function uf(e){return new Promise(t=>{setTimeout(t,e)})}function EE({baseUrl:e,body:t,extraHeaders:r,path:n,schema:i,signal:o,webhook:s}){let a=JSON.stringify(t);return br.fromPromise(fetch(`${e}${n}`,{body:a,headers:{...r,"Content-Type":"application/json",...kE(s,a)},method:"PUT",signal:df(o)}),l=>er(n,l)).andThen(l=>CE(l,n)).andThen(l=>AE(i,l,n)).mapErr(l=>o?.aborted===!0?ws():l)}function kE(e,t){let r=`msg_${hE.randomUUID()}`,n=new Date;return{"webhook-id":r,"webhook-signature":e.sign(r,n,t),"webhook-timestamp":String(Math.floor(n.getTime()/1e3))}}function df(e){let t=AbortSignal.timeout(gE);return e==null?t:AbortSignal.any([e,t])}function CE(e,t){return e.ok?br.fromPromise(e.json(),r=>er(t,r)):br.fromPromise(e.text().catch(()=>""),r=>er(t,r)).andThen(r=>Fa(ps(t,e.status,r)))}function AE(e,t,r){let n=e.safeParse(t);return n.success?yE(n.data):mE(hs(r,n.error))}import AO from"path";import{err as Jt,errAsync as PO,ok as $r,ResultAsync as pc}from"neverthrow";import yy from"path";import{z as Be}from"zod";import PE from"path";function pf({debugDir:e,runId:t,worker:r}){let n=PE.join(e,t,"behavior.jsonl");return r.open({file:n,runId:t}),{close:i=>r.close({noticeLineIfNoRrweb:i?.noticeIfNoRrweb==null?"":JSON.stringify(ME(i.noticeIfNoRrweb)),runId:t}),emit:i=>{let o={...i,timestamp:OE(i.timeNanos)};r.line({line:JSON.stringify(o),runId:t,timeNanos:i.timeNanos})},emitRrwebBatch:i=>{r.rrwebBatch({data:i,runId:t})}}}function wr(e){return String(BigInt(Math.round(e))*1000000n)}function ME(e){return{kind:"notice",message:e,source:"capture",timeNanos:"0"}}function OE(e){return Number(BigInt(e)/1000000n)}import{existsSync as IE}from"fs";import{createRequire as TE}from"module";import{fileURLToPath as NE}from"url";import{Worker as $E}from"worker_threads";var LE=TE(import.meta.url);function ff(e){let t=new $E(DE(),{workerData:e});t.unref();let r=new Map,n={next:0};t.on("message",o=>{let s=r.get(o.seq);s!=null&&(r.delete(o.seq),s())});let i=o=>{t.postMessage(o)};return{close:({noticeLineIfNoRrweb:o,runId:s})=>{let a=n.next;return n.next+=1,new Promise(l=>{r.set(a,l),i({noticeLineIfNoRrweb:o,runId:s,seq:a,t:"close"})})},line:({line:o,runId:s,timeNanos:a})=>{i({line:o,runId:s,t:"line",timeNanos:a})},open:({file:o,runId:s})=>{i({file:o,runId:s,t:"open"})},rrwebBatch:({data:o,runId:s})=>{i({data:o,runId:s,t:"rrweb-batch"})},terminate:async()=>{await t.terminate()}}}function DE(){try{return LE.resolve("@ripplo/runtime/capture-worker")}catch{let e=["../../dist/capture-worker.js","./capture-worker.js"].map(r=>NE(new URL(r,import.meta.url))),t=e.find(r=>IE(r));if(t==null)throw new Error(`capture-worker.js not found; looked at: ${e.join(", ")}`);return t}}import{readFile as FE}from"fs/promises";import{createRequire as _E}from"module";import{fileURLToPath as jE}from"url";var BE=_E(import.meta.url);function ja(e,t){try{return BE.resolve(e)}catch{return jE(new URL(`assets/${t}`,import.meta.url))}}var VE=ja("@ripplo/browser-trace/bundle","browser-trace.js");async function mf(e,t){await e.addInitScript(`globalThis.__ripploRunId = ${JSON.stringify(t)};`),await e.addInitScript(await WE())}var hf;function WE(){return hf??=FE(VE,{encoding:"utf8"}),hf}import{readFile as dO}from"fs/promises";var UE=Object.defineProperty,zE=(e,t,r)=>t in e?UE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,b=(e,t,r)=>zE(e,typeof t!="symbol"?t+"":t,r),yf,GE=Object.defineProperty,qE=(e,t,r)=>t in e?GE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,gf=(e,t,r)=>qE(e,typeof t!="symbol"?t+"":t,r),se=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(se||{}),Sf={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},bf={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},to={},KE=()=>!!globalThis.Zone;function Ul(e){if(to[e])return to[e];let t=globalThis[e],r=t.prototype,n=e in Sf?Sf[e]:void 0,i=!!(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]"))})),o=e in bf?bf[e]:void 0,s=!!(o&&o.every(a=>{var l;return typeof r[a]=="function"&&((l=r[a])==null?void 0:l.toString().includes("[native code]"))}));if(i&&s&&!KE())return to[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?to[e]=c:r}catch{return r}}var Ba={};function St(e,t,r){var n;let i=`${e}.${String(r)}`;if(Ba[i])return Ba[i].call(t);let o=Ul(e),s=(n=Object.getOwnPropertyDescriptor(o,r))==null?void 0:n.get;return s?(Ba[i]=s,s.call(t)):t[r]}var Va={};function yh(e,t,r){let n=`${e}.${String(r)}`;if(Va[n])return Va[n].bind(t);let o=Ul(e)[r];return typeof o!="function"?t[r]:(Va[n]=o,o.bind(t))}function HE(e){return St("Node",e,"ownerDocument")}function YE(e){return St("Node",e,"childNodes")}function XE(e){return St("Node",e,"parentNode")}function ZE(e){return St("Node",e,"parentElement")}function JE(e){return St("Node",e,"textContent")}function QE(e,t){return yh("Node",e,"contains")(t)}function ek(e){return yh("Node",e,"getRootNode")()}function tk(e){return!e||!("host"in e)?null:St("ShadowRoot",e,"host")}function rk(e){return e.styleSheets}function nk(e){return!e||!("shadowRoot"in e)?null:St("Element",e,"shadowRoot")}function ik(e,t){return St("Element",e,"querySelector")(t)}function ok(e,t){return St("Element",e,"querySelectorAll")(t)}function sk(){return Ul("MutationObserver").constructor}function ak(e,t,r){try{if(!(t in e))return()=>{};let n=e[t],i=r(n);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=i,()=>{e[t]=n}}catch{return()=>{}}}var me={ownerDocument:HE,childNodes:YE,parentNode:XE,parentElement:ZE,textContent:JE,contains:QE,getRootNode:ek,host:tk,styleSheets:rk,shadowRoot:nk,querySelector:ik,querySelectorAll:ok,mutationObserver:sk,patch:ak};function gh(e){return e.nodeType===e.ELEMENT_NODE}function mn(e){let t=e&&"host"in e&&"mode"in e&&me.host(e)||null;return!!(t&&"shadowRoot"in t&&me.shadowRoot(t)===e)}function yn(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function lk(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 ck(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 el(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,i=>Sh(i,r)).join("");return lk(n)}catch{return null}}function Sh(e,t){if(dk(e)){let r;try{r=el(e.styleSheet)||ck(e)}catch{r=e.cssText}return e.styleSheet.href?$o(r,e.styleSheet.href):r}else{let r=e.cssText;return pk(e)&&e.selectorText.includes(":")&&(r=uk(r)),t?$o(r,t):r}}function uk(e){let t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function dk(e){return"styleSheet"in e}function pk(e){return"selectorText"in e}var Io=class{constructor(){gf(this,"idNodeMap",new Map),gf(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 i=this.nodeMetaMap.get(n);i&&this.nodeMetaMap.set(r,i)}this.idNodeMap.set(t,r)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function fk(){return new Io}function To({element:e,maskInputOptions:t,tagName:r,type:n,value:i,maskInputFn:o}){let s=i||"",a=n&&Kt(n);return(t[r.toLowerCase()]||a&&t[a])&&(o?s=o(s,e):s="*".repeat(s.length)),s}function Kt(e){return e.toLowerCase()}var wf="__rrweb_original__";function hk(e){let t=e.getContext("2d");if(!t)return!0;let r=50;for(let n=0;n<e.width;n+=r)for(let i=0;i<e.height;i+=r){let o=t.getImageData,s=wf in o?o[wf]:o;if(new Uint32Array(s.call(t,n,i,Math.min(r,e.width-n),Math.min(r,e.height-i)).data.buffer).some(l=>l!==0))return!1}return!0}function No(e){let t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?Kt(t):null}function bh(e,t){let r;try{r=new URL(e,t??window.location.href)}catch{return null}let n=/\.([0-9a-z]+)(?:$)/i,i=r.pathname.match(n);return i?.[1]??null}function mk(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var yk=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,gk=/^(?:[a-z+]+:)?\/\//i,Sk=/^www\..*/i,bk=/^(data:)([^,]*),(.*)/i;function $o(e,t){return(e||"").replace(yk,(r,n,i,o,s,a)=>{let l=i||s||a,c=n||o||"";if(!l)return r;if(gk.test(l)||Sk.test(l))return`url(${c}${l}${c})`;if(bk.test(l))return`url(${c}${l}${c})`;if(l[0]==="/")return`url(${c}${mk(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 ro(e,t=!1){return t?e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,""):e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"").replace(/0px/g,"0")}function wk(e,t,r=!1){let n=Array.from(t.childNodes),i=[],o=0;if(n.length>1&&e&&typeof e=="string"){let s=ro(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=ro(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),m=s.split(p),y=-1;if(m.length===2)y=m[0].length;else if(m.length>2&&m[0]===""&&n[l-1].textContent!=="")y=s.indexOf(p,1);else if(m.length===1){if(p=p.substring(0,p.length-1),m=s.split(p),m.length<=1)return i.push(e),i;d=u+1}else d===c.length-1&&(y=s.indexOf(p));if(m.length>=2&&d>u){let f=n[l-1].textContent;if(f&&typeof f=="string"){let h=ro(f).length;y=s.indexOf(p,h)}y===-1&&(y=m[0].length)}if(y!==-1){let f=Math.floor(y/a);for(;f>0&&f<e.length;){if(o+=1,o>50*n.length)return i.push(e),i;let h=ro(e.substring(0,f),r);if(h.length===y){i.push(e.substring(0,f)),e=e.substring(f),s=s.substring(y);break}else h.length<y?f+=Math.max(1,Math.floor((y-h.length)/a)):f-=Math.max(1,Math.floor((h.length-y)*a))}break}}}}return i.push(e),i}function Rk(e,t){return wk(e,t).join("/* rr_split */")}var vk=1,xk=new RegExp("[^a-z0-9-_:]"),Sn=-2;function wh(){return vk++}function Ek(e){if(e instanceof HTMLFormElement)return"form";let t=Kt(e.tagName);return xk.test(t)?"div":t}var Rr,Rf,kk=/^[^ \t\n\r\u000c]+/,Ck=/^[, \t\n\r\u000c]+/;function Ak(e,t){if(t.trim()==="")return t;let r=0;function n(o){let s,a=o.exec(t.substring(r));return a?(s=a[0],r+=s.length,s):""}let i=[];for(;n(Ck),!(r>=t.length);){let o=n(kk);if(o.slice(-1)===",")o=Er(e,o.substring(0,o.length-1)),i.push(o);else{let s="";o=Er(e,o);let a=!1;for(;;){let l=t.charAt(r);if(l===""){i.push((o+s).trim());break}else if(a)l===")"&&(a=!1);else if(l===","){r+=1,i.push((o+s).trim());break}else l==="("&&(a=!0);s+=l,r+=1}}}return i.join(", ")}var vf=new WeakMap;function Er(e,t){return!t||t.trim()===""?t:zl(e,t)}function Pk(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function zl(e,t){let r=vf.get(e);if(r||(r=e.createElement("a"),vf.set(e,r)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return r.setAttribute("href",t),r.href}function Rh(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)?Er(e,n):r==="srcset"?Ak(e,n):r==="style"?$o(n,zl(e)):t==="object"&&r==="data"?Er(e,n):n)}function vh(e,t,r){return["video","audio"].includes(e)&&t==="autoplay"}function Mk(e,t,r){try{if(typeof t=="string"){if(e.classList.contains(t))return!0}else for(let n=e.classList.length;n--;){let i=e.classList[n];if(t.test(i))return!0}if(r)return e.matches(r)}catch{}return!1}function Lo(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return r?Lo(me.parentNode(e),t,r):!1;for(let n=e.classList.length;n--;){let i=e.classList[n];if(t.test(i))return!0}return r?Lo(me.parentNode(e),t,r):!1}function xh(e,t,r,n){let i;if(gh(e)){if(i=e,!me.childNodes(i).length)return!1}else{if(me.parentElement(e)===null)return!1;i=me.parentElement(e)}try{if(typeof t=="string"){if(n){if(i.closest(`.${t}`))return!0}else if(i.classList.contains(t))return!0}else if(Lo(i,t,n))return!0;if(r){if(n){if(i.closest(r))return!0}else if(i.matches(r))return!0}}catch{}return!1}function Ok(e,t,r){let n=e.contentWindow;if(!n)return;let i=!1,o;try{o=n.document.readyState}catch{return}if(o!=="complete"){let a=setTimeout(()=>{i||(t(),i=!0)},r);e.addEventListener("load",()=>{clearTimeout(a),i=!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 Ik(e,t,r){let n=!1,i;try{i=e.sheet}catch{return}if(i)return;let o=setTimeout(()=>{n||(t(),n=!0)},r);e.addEventListener("load",()=>{clearTimeout(o),n=!0,t()})}function Tk(e,t){let{doc:r,mirror:n,blockClass:i,blockSelector:o,needsMask:s,inlineStylesheet:a,maskInputOptions:l={},maskTextFn:c,maskInputFn:u,dataURLOptions:d={},inlineImages:p,recordCanvas:m,keepIframeSrcFn:y,newlyAddedElement:f=!1,cssCaptured:h=!1}=t,w=Nk(r,n);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:se.Document,childNodes:[],compatMode:e.compatMode}:{type:se.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:se.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:w};case e.ELEMENT_NODE:return Lk(e,{doc:r,blockClass:i,blockSelector:o,inlineStylesheet:a,maskInputOptions:l,maskInputFn:u,dataURLOptions:d,inlineImages:p,recordCanvas:m,keepIframeSrcFn:y,newlyAddedElement:f,rootId:w});case e.TEXT_NODE:return $k(e,{doc:r,needsMask:s,maskTextFn:c,rootId:w,cssCaptured:h});case e.CDATA_SECTION_NODE:return{type:se.CDATA,textContent:"",rootId:w};case e.COMMENT_NODE:return{type:se.Comment,textContent:me.textContent(e)||"",rootId:w};default:return!1}}function Nk(e,t){if(!t.hasNode(e))return;let r=t.getId(e);return r===1?void 0:r}function $k(e,t){let{needsMask:r,maskTextFn:n,rootId:i,cssCaptured:o}=t,s=me.parentNode(e),a=s&&s.tagName,l="",c=a==="STYLE"?!0:void 0,u=a==="SCRIPT"?!0:void 0;return u?l="SCRIPT_PLACEHOLDER":o||(l=me.textContent(e),c&&l&&(l=$o(l,zl(t.doc)))),!c&&!u&&l&&r&&(l=n?n(l,me.parentElement(e)):l.replace(/[\S]/g,"*")),{type:se.Text,textContent:l||"",rootId:i}}function Lk(e,t){let{doc:r,blockClass:n,blockSelector:i,inlineStylesheet:o,maskInputOptions:s={},maskInputFn:a,dataURLOptions:l={},inlineImages:c,recordCanvas:u,keepIframeSrcFn:d,newlyAddedElement:p=!1,rootId:m}=t,y=Mk(e,n,i),f=Ek(e),h={},w=e.attributes.length;for(let g=0;g<w;g++){let E=e.attributes[g];vh(f,E.name,E.value)||(h[E.name]=Rh(r,f,Kt(E.name),E.value))}if(f==="link"&&o){let g=Array.from(r.styleSheets).find(T=>T.href===e.href),E=null;g&&(E=el(g)),E&&(delete h.rel,delete h.href,h._cssText=E)}if(f==="style"&&e.sheet){let g=el(e.sheet);g&&(e.childNodes.length>1&&(g=Rk(g,e)),h._cssText=g)}if(["input","textarea","select"].includes(f)){let g=e.value,E=e.checked;h.type!=="radio"&&h.type!=="checkbox"&&h.type!=="submit"&&h.type!=="button"&&g?h.value=To({element:e,type:No(e),tagName:f,value:g,maskInputOptions:s,maskInputFn:a}):E&&(h.checked=E)}if(f==="option"&&(e.selected&&!s.select?h.selected=!0:delete h.selected),f==="dialog"&&e.open&&(h.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"),f==="canvas"&&u){if(e.__context==="2d")hk(e)||(h.rr_dataURL=e.toDataURL(l.type,l.quality));else if(!("__context"in e)){let g=e.toDataURL(l.type,l.quality),E=r.createElement("canvas");E.width=e.width,E.height=e.height;let T=E.toDataURL(l.type,l.quality);g!==T&&(h.rr_dataURL=g)}}if(f==="img"&&c){Rr||(Rr=r.createElement("canvas"),Rf=Rr.getContext("2d"));let g=e,E=g.currentSrc||g.getAttribute("src")||"<unknown-src>",T=g.crossOrigin,j=()=>{g.removeEventListener("load",j);try{Rr.width=g.naturalWidth,Rr.height=g.naturalHeight,Rf.drawImage(g,0,0),h.rr_dataURL=Rr.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=${E}! Error: ${te}`)}g.crossOrigin==="anonymous"&&(T?h.crossOrigin=T:g.removeAttribute("crossorigin"))};g.complete&&g.naturalWidth!==0?j():g.addEventListener("load",j)}if(["audio","video"].includes(f)){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)),y){let{width:g,height:E}=e.getBoundingClientRect();h={class:h.class,rr_width:`${g}px`,rr_height:`${E}px`}}f==="iframe"&&!d(h.src)&&(e.contentDocument||(h.rr_src=h.src),delete h.src);let x;try{customElements.get(f)&&(x=!0)}catch{}return{type:se.Element,tagName:f,attributes:h,childNodes:[],isSVG:Pk(e)||void 0,needBlock:y,rootId:m,isCustom:x}}function z(e){return e==null?"":e.toLowerCase()}function Eh(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 Dk(e,t){if(t.comment&&e.type===se.Comment)return!0;if(e.type===se.Element){if(t.script&&(e.tagName==="script"||e.tagName==="link"&&(e.attributes.rel==="preload"&&e.attributes.as==="script"||e.attributes.rel==="modulepreload")||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&bh(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(z(e.attributes.name).match(/^msapplication-tile(image|color)$/)||z(e.attributes.name)==="application-name"||z(e.attributes.rel)==="icon"||z(e.attributes.rel)==="apple-touch-icon"||z(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&z(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(z(e.attributes.property).match(/^(og|twitter|fb):/)||z(e.attributes.name).match(/^(og|twitter):/)||z(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(z(e.attributes.name)==="robots"||z(e.attributes.name)==="googlebot"||z(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(z(e.attributes.name)==="author"||z(e.attributes.name)==="generator"||z(e.attributes.name)==="framework"||z(e.attributes.name)==="publisher"||z(e.attributes.name)==="progid"||z(e.attributes.property).match(/^article:/)||z(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(z(e.attributes.name)==="google-site-verification"||z(e.attributes.name)==="yandex-verification"||z(e.attributes.name)==="csrf-token"||z(e.attributes.name)==="p:domain_verify"||z(e.attributes.name)==="verify-v1"||z(e.attributes.name)==="verification"||z(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function kr(e,t){let{doc:r,mirror:n,blockClass:i,blockSelector:o,maskTextClass:s,maskTextSelector:a,skipChild:l=!1,inlineStylesheet:c=!0,maskInputOptions:u={},maskTextFn:d,maskInputFn:p,slimDOMOptions:m,dataURLOptions:y={},inlineImages:f=!1,recordCanvas:h=!1,onSerialize:w,onIframeLoad:x,iframeLoadTimeout:g=5e3,onStylesheetLoad:E,stylesheetLoadTimeout:T=5e3,keepIframeSrcFn:j=()=>!1,newlyAddedElement:te=!1,cssCaptured:W=!1}=t,{needsMask:G}=t,{preserveWhiteSpace:re=!0}=t;G||(G=xh(e,s,a,G===void 0));let fe=Tk(e,{doc:r,mirror:n,blockClass:i,blockSelector:o,needsMask:G,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:p,dataURLOptions:y,inlineImages:f,recordCanvas:h,keepIframeSrcFn:j,newlyAddedElement:te,cssCaptured:W});if(!fe)return console.warn(e,"not serialized"),null;let Ve;n.hasNode(e)?Ve=n.getId(e):Dk(fe,m)||!re&&fe.type===se.Text&&!fe.textContent.replace(/^\s+|\s+$/gm,"").length?Ve=Sn:Ve=wh();let N=Object.assign(fe,{id:Ve});if(n.add(e,N),Ve===Sn)return null;w&&w(e);let Dr=!l;if(N.type===se.Element){Dr=Dr&&!N.needBlock,delete N.needBlock;let ie=me.shadowRoot(e);ie&&yn(ie)&&(N.isShadowHost=!0)}if((N.type===se.Document||N.type===se.Element)&&Dr){m.headWhitespace&&N.type===se.Element&&N.tagName==="head"&&(re=!1);let ie={doc:r,mirror:n,blockClass:i,blockSelector:o,needsMask:G,maskTextClass:s,maskTextSelector:a,skipChild:l,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:p,slimDOMOptions:m,dataURLOptions:y,inlineImages:f,recordCanvas:h,preserveWhiteSpace:re,onSerialize:w,onIframeLoad:x,iframeLoadTimeout:g,onStylesheetLoad:E,stylesheetLoadTimeout:T,keepIframeSrcFn:j,cssCaptured:!1};if(!(N.type===se.Element&&N.tagName==="textarea"&&N.attributes.value!==void 0)){N.type===se.Element&&N.attributes._cssText!==void 0&&typeof N.attributes._cssText=="string"&&(ie.cssCaptured=!0);for(let Tt of Array.from(me.childNodes(e))){let We=kr(Tt,ie);We&&N.childNodes.push(We)}}let Ie=null;if(gh(e)&&(Ie=me.shadowRoot(e)))for(let Tt of Array.from(me.childNodes(Ie))){let We=kr(Tt,ie);We&&(yn(Ie)&&(We.isShadow=!0),N.childNodes.push(We))}}let Fr=me.parentNode(e);return Fr&&mn(Fr)&&yn(Fr)&&(N.isShadow=!0),N.type===se.Element&&N.tagName==="iframe"&&Ok(e,()=>{let ie=e.contentDocument;if(ie&&x){let Ie=kr(ie,{doc:ie,mirror:n,blockClass:i,blockSelector:o,needsMask:G,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:p,slimDOMOptions:m,dataURLOptions:y,inlineImages:f,recordCanvas:h,preserveWhiteSpace:re,onSerialize:w,onIframeLoad:x,iframeLoadTimeout:g,onStylesheetLoad:E,stylesheetLoadTimeout:T,keepIframeSrcFn:j});Ie&&x(e,Ie)}},g),N.type===se.Element&&N.tagName==="link"&&typeof N.attributes.rel=="string"&&(N.attributes.rel==="stylesheet"||N.attributes.rel==="preload"&&typeof N.attributes.href=="string"&&bh(N.attributes.href)==="css")&&Ik(e,()=>{if(E){let ie=kr(e,{doc:r,mirror:n,blockClass:i,blockSelector:o,needsMask:G,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:p,slimDOMOptions:m,dataURLOptions:y,inlineImages:f,recordCanvas:h,preserveWhiteSpace:re,onSerialize:w,onIframeLoad:x,iframeLoadTimeout:g,onStylesheetLoad:E,stylesheetLoadTimeout:T,keepIframeSrcFn:j});ie&&E(e,ie)}},T),N}function Fk(e,t){let{mirror:r=new Io,blockClass:n="rr-block",blockSelector:i=null,maskTextClass:o="rr-mask",maskTextSelector:s=null,inlineStylesheet:a=!0,inlineImages:l=!1,recordCanvas:c=!1,maskAllInputs:u=!1,maskTextFn:d,maskInputFn:p,slimDOM:m=!1,dataURLOptions:y,preserveWhiteSpace:f,onSerialize:h,onIframeLoad:w,iframeLoadTimeout:x,onStylesheetLoad:g,stylesheetLoadTimeout:E,keepIframeSrcFn:T=()=>!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=Eh(m);return kr(e,{doc:e,mirror:r,blockClass:n,blockSelector:i,maskTextClass:o,maskTextSelector:s,skipChild:!1,inlineStylesheet:a,maskInputOptions:j,maskTextFn:d,maskInputFn:p,slimDOMOptions:te,dataURLOptions:y,inlineImages:l,recordCanvas:c,preserveWhiteSpace:f,onSerialize:h,onIframeLoad:w,iframeLoadTimeout:x,onStylesheetLoad:g,stylesheetLoadTimeout:E,keepIframeSrcFn:T,newlyAddedElement:!1})}var _k=/(max|min)-device-(width|height)/,vF=new RegExp(_k.source,"g");function jk(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Bk(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 i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}),r}var Gl={exports:{}},q=String,kh=function(){return{isColorSupported:!1,reset:q,bold:q,dim:q,italic:q,underline:q,inverse:q,hidden:q,strikethrough:q,black:q,red:q,green:q,yellow:q,blue:q,magenta:q,cyan:q,white:q,gray:q,bgBlack:q,bgRed:q,bgGreen:q,bgYellow:q,bgBlue:q,bgMagenta:q,bgCyan:q,bgWhite:q}};Gl.exports=kh();Gl.exports.createColors=kh;var Vk=Gl.exports,Wk={},Uk=Object.freeze(Object.defineProperty({__proto__:null,default:Wk},Symbol.toStringTag,{value:"Module"})),_e=Bk(Uk),xf=Vk,Ef=_e,tl=class Ch extends Error{constructor(t,r,n,i,o,s){super(t),this.name="CssSyntaxError",this.reason=t,o&&(this.file=o),i&&(this.source=i),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,Ch)}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=xf.isColorSupported),Ef&&t&&(r=Ef(r));let n=r.split(/\r?\n/),i=Math.max(this.line-3,0),o=Math.min(this.line+2,n.length),s=String(o).length,a,l;if(t){let{bold:c,gray:u,red:d}=xf.createColors(!0);a=p=>c(d(p)),l=p=>u(p)}else a=l=c=>c;return n.slice(i,o).map((c,u)=>{let d=i+1+u,p=" "+(" "+d).slice(-s)+" | ";if(d===this.line){let m=l(p.replace(/\d/g," "))+c.slice(0,this.column-1).replace(/[^\t]/g," ");return a(">")+l(p)+c+`
7
- `+m+a("^")}return" "+l(p)+c}).join(`
8
- `)}toString(){let t=this.showSourceCode();return t&&(t=`
9
-
10
- `+t+`
11
- `),this.name+": "+this.message+t}},ql=tl;tl.default=tl;var Pn={};Pn.isClean=Symbol("isClean");Pn.my=Symbol("my");var kf={after:`
12
- `,beforeClose:`
13
- `,beforeComment:`
14
- `,beforeDecl:`
15
- `,beforeOpen:" ",beforeRule:`
16
- `,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function zk(e){return e[0].toUpperCase()+e.slice(1)}var rl=class{constructor(t){this.builder=t}atrule(t,r){let n="@"+t.name,i=t.params?this.rawValue(t,"params"):"";if(typeof t.raws.afterName<"u"?n+=t.raws.afterName:i&&(n+=" "),t.nodes)this.block(t,n+i);else{let o=(t.raws.between||"")+(r?";":"");this.builder(n+i+o,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 i=t.parent,o=0;for(;i&&i.type!=="root";)o+=1,i=i.parent;if(n.includes(`
17
- `)){let s=this.raw(t,null,"indent");if(s.length)for(let a=0;a<o;a++)n+=s}return n}block(t,r){let n=this.raw(t,"between","beforeOpen");this.builder(r+n+"{",t,"start");let i;t.nodes&&t.nodes.length?(this.body(t),i=this.raw(t,"after")):i=this.raw(t,"after","emptyBody"),i&&this.builder(i),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 i=0;i<t.nodes.length;i++){let o=t.nodes[i],s=this.raw(o,"before");s&&this.builder(s),this.stringify(o,r!==i||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"),i=t.prop+n+this.rawValue(t,"value");t.important&&(i+=t.raws.important||" !important"),r&&(i+=";"),this.builder(i,t)}document(t){this.body(t)}raw(t,r,n){let i;if(n||(n=r),r&&(i=t.raws[r],typeof i<"u"))return i;let o=t.parent;if(n==="before"&&(!o||o.type==="root"&&o.first===t||o&&o.type==="document"))return"";if(!o)return kf[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"+zk(n);this[a]?i=this[a](s,t):s.walk(l=>{if(i=l.raws[r],typeof i<"u")return!1})}return typeof i>"u"&&(i=kf[n]),s.rawCache[n]=i,i}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(i=>{if(typeof i.raws.before<"u")return n=i.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(i=>{if(typeof i.raws.before<"u")return n=i.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 i=n.parent;if(i&&i!==t&&i.parent&&i.parent===t&&typeof n.raws.before<"u"){let o=n.raws.before.split(`
22
- `);return r=o[o.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],i=t.raws[r];return i&&i.value===n?i.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)}},Ah=rl;rl.default=rl;var Gk=Ah;function nl(e,t){new Gk(t).stringify(e)}var Ho=nl;nl.default=nl;var{isClean:no,my:qk}=Pn,Kk=ql,Hk=Ah,Yk=Ho;function il(e,t){let r=new e.constructor;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n)||n==="proxyCache")continue;let i=e[n],o=typeof i;n==="parent"&&o==="object"?t&&(r[n]=t):n==="source"?r[n]=i:Array.isArray(i)?r[n]=i.map(s=>il(s,r)):(o==="object"&&i!==null&&(i=il(i)),r[n]=i)}return r}var ol=class{constructor(t={}){this.raws={},this[no]=!1,this[qk]=!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=il(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:i}=this.rangeBy(r);return this.source.input.error(t,{column:i.column,line:i.line},{column:n.column,line:n.line},r)}return new Kk(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[no]){this[no]=!1;let t=this;for(;t=t.parent;)t[no]=!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 i=r.indexOf(t.word);i!==-1&&(n=this.positionInside(i,r))}return n}positionInside(t,r){let n=r||this.toString(),i=this.source.start.column,o=this.source.start.line;for(let s=0;s<t;s++)n[s]===`
23
- `?(i=1,o+=1):i+=1;return{column:i,line:o}}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 i=this.toString(),o=i.indexOf(t.word);o!==-1&&(r=this.positionInside(o,i),n=this.positionInside(o+t.word.length,i))}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 Hk().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 i of t)i===this?n=!0:n?(this.parent.insertAfter(r,i),r=i):this.parent.insertBefore(r,i);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={},i=r==null;r=r||new Map;let o=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=o,r.set(a.input,o),o++),n[s]={end:a.end,inputId:l,start:a.start}}else n[s]=a}return i&&(n.inputs=[...r.keys()].map(s=>s.toJSON())),n}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(t=Yk){t.stringify&&(t=t.stringify);let r="";return t(this,n=>{r+=n}),r}warn(t,r,n){let i={node:this};for(let o in n)i[o]=n[o];return t.warn(r,i)}get proxyOf(){return this}},Yo=ol;ol.default=ol;var Xk=Yo,sl=class extends Xk{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]==="$"}},Xo=sl;sl.default=sl;var Zk="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",Jk=(e,t=21)=>(r=t)=>{let n="",i=r;for(;i--;)n+=e[Math.random()*e.length|0];return n},Qk=(e=21)=>{let t="",r=e;for(;r--;)t+=Zk[Math.random()*64|0];return t},eC={nanoid:Qk,customAlphabet:Jk},{SourceMapConsumer:Cf,SourceMapGenerator:Af}=_e,{existsSync:tC,readFileSync:rC}=_e,{dirname:Wa,join:nC}=_e;function iC(e){return Buffer?Buffer.from(e,"base64").toString():window.atob(e)}var al=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,i=this.loadMap(r.from,n);!this.mapFile&&r.from&&(this.mapFile=r.from),this.mapFile&&(this.root=Wa(this.mapFile)),i&&(this.text=i)}consumer(){return this.consumerCache||(this.consumerCache=new Cf(this.text)),this.consumerCache}decodeInline(t){let r=/^data:application\/json;charset=utf-?8;base64,/,n=/^data:application\/json;base64,/,i=/^data:application\/json;charset=utf-?8,/,o=/^data:application\/json,/;if(i.test(t)||o.test(t))return decodeURIComponent(t.substr(RegExp.lastMatch.length));if(r.test(t)||n.test(t))return iC(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()),i=t.indexOf("*/",n);n>-1&&i>-1&&(this.annotation=this.getAnnotationURL(t.substring(n,i)))}loadFile(t){if(this.root=Wa(t),tC(t))return this.mapFile=t,rC(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 i=this.loadFile(n);if(!i)throw new Error("Unable to load previous source map: "+n.toString());return i}}else{if(r instanceof Cf)return Af.fromSourceMap(r).toString();if(r instanceof Af)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=nC(Wa(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)}},Ph=al;al.default=al;var{SourceMapConsumer:oC,SourceMapGenerator:sC}=_e,{fileURLToPath:Pf,pathToFileURL:io}=_e,{isAbsolute:ll,resolve:cl}=_e,{nanoid:aC}=eC,Ua=_e,Mf=ql,lC=Ph,za=Symbol("fromOffsetCache"),cC=!!(oC&&sC),Of=!!(cl&&ll),Do=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&&(!Of||/^\w+:\/\//.test(r.from)||ll(r.from)?this.file=r.from:this.file=cl(r.from)),Of&&cC){let n=new lC(this.css,r);if(n.text){this.map=n;let i=n.consumer().file;!this.file&&i&&(this.file=this.mapResolve(i))}}this.file||(this.id="<input css "+aC(6)+">"),this.map&&(this.map.file=this.from)}error(t,r,n,i={}){let o,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?o=new Mf(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,i.plugin):o=new Mf(t,s===void 0?r:{column:n,line:r},s===void 0?n:{column:a,line:s},this.css,this.file,i.plugin),o.input={column:n,endColumn:a,endLine:s,line:r,source:this.css},this.file&&(io&&(o.input.url=io(this.file).toString()),o.input.file=this.file),o}fromOffset(t){let r,n;if(this[za])n=this[za];else{let o=this.css.split(`
24
- `);n=new Array(o.length);let s=0;for(let a=0,l=o.length;a<l;a++)n[a]=s,s+=o[a].length+1;this[za]=n}r=n[n.length-1];let i=0;if(t>=r)i=n.length-1;else{let o=n.length-2,s;for(;i<o;)if(s=i+(o-i>>1),t<n[s])o=s-1;else if(t>=n[s+1])i=s+1;else{i=s;break}}return{col:t-n[i]+1,line:i+1}}mapResolve(t){return/^\w+:\/\//.test(t)?t:cl(this.map.consumer().sourceRoot||this.map.root||".",t)}origin(t,r,n,i){if(!this.map)return!1;let o=this.map.consumer(),s=o.originalPositionFor({column:r,line:t});if(!s.source)return!1;let a;typeof n=="number"&&(a=o.originalPositionFor({column:i,line:n}));let l;ll(s.source)?l=io(s.source):l=new URL(s.source,this.map.consumer().sourceRoot||io(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(Pf)c.file=Pf(l);else throw new Error("file: protocol is not available in this PostCSS build");let u=o.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}},Zo=Do;Do.default=Do;Ua&&Ua.registerInput&&Ua.registerInput(Do);var{SourceMapConsumer:Mh,SourceMapGenerator:ko}=_e,{dirname:Co,relative:Oh,resolve:Ih,sep:Th}=_e,{pathToFileURL:If}=_e,uC=Zo,dC=!!(Mh&&ko),pC=!!(Co&&Ih&&Oh&&Th),fC=class{constructor(t,r,n,i){this.stringify=t,this.mapOpts=n.map||{},this.root=r,this.opts=n,this.css=i,this.originalCSS=i,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||Co(t.file),i;this.mapOpts.sourcesContent===!1?(i=new Mh(t.text),i.sourcesContent&&(i.sourcesContent=null)):i=t.consumer(),this.map.applySourceMap(i,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(),pC&&dC&&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=ko.fromSourceMap(t,{ignoreInvalidMapping:!0})}else this.map=new ko({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 ko({file:this.outputFile(),ignoreInvalidMapping:!0});let t=1,r=1,n="<no source>",i={generated:{column:0,line:0},original:{column:0,line:0},source:""},o,s;this.stringify(this.root,(a,l,c)=>{if(this.css+=a,l&&c!=="end"&&(i.generated.line=t,i.generated.column=r-1,l.source&&l.source.start?(i.source=this.sourcePath(l),i.original.line=l.source.start.line,i.original.column=l.source.start.column-1,this.map.addMapping(i)):(i.source=n,i.original.line=1,i.original.column=0,this.map.addMapping(i))),o=a.match(/\n/g),o?(t+=o.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?(i.source=this.sourcePath(l),i.original.line=l.source.end.line,i.original.column=l.source.end.column-1,i.generated.line=t,i.generated.column=r-2,this.map.addMapping(i)):(i.source=n,i.original.line=1,i.original.column=0,i.generated.line=t,i.generated.column=r-1,this.map.addMapping(i)))}})}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?Co(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(n=Co(Ih(n,this.mapOpts.annotation)));let i=Oh(n,t);return this.memoizedPaths.set(t,i),i}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 uC(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 i=this.usesFileUrls?this.toFileUrl(n):this.toUrl(this.path(n));this.map.setSourceContent(i,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(If){let n=If(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;Th==="\\"&&(t=t.replace(/\\/g,"/"));let n=encodeURI(t).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(t,n),n}},Nh=fC,hC=Yo,ul=class extends hC{constructor(t){super(t),this.type="comment"}},Jo=ul;ul.default=ul;var{isClean:$h,my:Lh}=Pn,Dh=Xo,Fh=Jo,mC=Yo,_h,Kl,Hl,jh;function Bh(e){return e.map(t=>(t.nodes&&(t.nodes=Bh(t.nodes)),delete t.source,t))}function Vh(e){if(e[$h]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)Vh(t)}var yt=class Wh extends mC{append(...t){for(let r of t){let n=this.normalize(r,this.last);for(let i of n)this.proxyOf.nodes.push(i)}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,i;for(;this.indexes[r]<this.proxyOf.nodes.length&&(n=this.indexes[r],i=t(this.proxyOf.nodes[n],n),i!==!1);)this.indexes[r]+=1;return delete this.indexes[r],i}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(i=>typeof i=="function"?(o,s)=>i(o.toProxy(),s):i)):r==="every"||r==="some"?n=>t[r]((i,...o)=>n(i.toProxy(),...o)):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),i=this.normalize(r,this.proxyOf.nodes[n]).reverse();n=this.index(t);for(let s of i)this.proxyOf.nodes.splice(n+1,0,s);let o;for(let s in this.indexes)o=this.indexes[s],n<o&&(this.indexes[s]=o+i.length);return this.markDirty(),this}insertBefore(t,r){let n=this.index(t),i=n===0?"prepend":!1,o=this.normalize(r,this.proxyOf.nodes[n],i).reverse();n=this.index(t);for(let a of o)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+o.length);return this.markDirty(),this}normalize(t,r){if(typeof t=="string")t=Bh(_h(t).nodes);else if(typeof t>"u")t=[];else if(Array.isArray(t)){t=t.slice(0);for(let i of t)i.parent&&i.parent.removeChild(i,"ignore")}else if(t.type==="root"&&this.type!=="document"){t=t.nodes.slice(0);for(let i of t)i.parent&&i.parent.removeChild(i,"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 Dh(t)]}else if(t.selector)t=[new Kl(t)];else if(t.name)t=[new Hl(t)];else if(t.text)t=[new Fh(t)];else throw new Error("Unknown node type in node creation");return t.map(i=>(i[Lh]||Wh.rebuild(i),i=i.proxyOf,i.parent&&i.parent.removeChild(i),i[$h]&&Vh(i),typeof i.raws.before>"u"&&r&&typeof r.raws.before<"u"&&(i.raws.before=r.raws.before.replace(/\S/g,"")),i.parent=this.proxyOf,i))}prepend(...t){t=t.reverse();for(let r of t){let n=this.normalize(r,this.first,"prepend").reverse();for(let i of n)this.proxyOf.nodes.unshift(i);for(let i in this.indexes)this.indexes[i]=this.indexes[i]+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(i=>{r.props&&!r.props.includes(i.prop)||r.fast&&!i.value.includes(r.fast)||(i.value=i.value.replace(t,n))}),this.markDirty(),this}some(t){return this.nodes.some(t)}walk(t){return this.each((r,n)=>{let i;try{i=t(r,n)}catch(o){throw r.addToError(o)}return i!==!1&&r.walk&&(i=r.walk(t)),i})}walkAtRules(t,r){return r?t instanceof RegExp?this.walk((n,i)=>{if(n.type==="atrule"&&t.test(n.name))return r(n,i)}):this.walk((n,i)=>{if(n.type==="atrule"&&n.name===t)return r(n,i)}):(r=t,this.walk((n,i)=>{if(n.type==="atrule")return r(n,i)}))}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,i)=>{if(n.type==="decl"&&t.test(n.prop))return r(n,i)}):this.walk((n,i)=>{if(n.type==="decl"&&n.prop===t)return r(n,i)}):(r=t,this.walk((n,i)=>{if(n.type==="decl")return r(n,i)}))}walkRules(t,r){return r?t instanceof RegExp?this.walk((n,i)=>{if(n.type==="rule"&&t.test(n.selector))return r(n,i)}):this.walk((n,i)=>{if(n.type==="rule"&&n.selector===t)return r(n,i)}):(r=t,this.walk((n,i)=>{if(n.type==="rule")return r(n,i)}))}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]}};yt.registerParse=e=>{_h=e};yt.registerRule=e=>{Kl=e};yt.registerAtRule=e=>{Hl=e};yt.registerRoot=e=>{jh=e};var Ht=yt;yt.default=yt;yt.rebuild=e=>{e.type==="atrule"?Object.setPrototypeOf(e,Hl.prototype):e.type==="rule"?Object.setPrototypeOf(e,Kl.prototype):e.type==="decl"?Object.setPrototypeOf(e,Dh.prototype):e.type==="comment"?Object.setPrototypeOf(e,Fh.prototype):e.type==="root"&&Object.setPrototypeOf(e,jh.prototype),e[Lh]=!0,e.nodes&&e.nodes.forEach(t=>{yt.rebuild(t)})};var yC=Ht,Uh,zh,bn=class extends yC{constructor(t){super({type:"document",...t}),this.nodes||(this.nodes=[])}toResult(t={}){return new Uh(new zh,this,t).stringify()}};bn.registerLazyResult=e=>{Uh=e};bn.registerProcessor=e=>{zh=e};var Yl=bn;bn.default=bn;var Tf={},Gh=function(t){Tf[t]||(Tf[t]=!0,typeof console<"u"&&console.warn&&console.warn(t))},dl=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}},qh=dl;dl.default=dl;var gC=qh,pl=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 gC(t,r);return this.messages.push(n),n}warnings(){return this.messages.filter(t=>t.type==="warning")}get content(){return this.css}},Xl=pl;pl.default=pl;var Ga=39,Nf=34,oo=92,$f=47,so=10,un=32,ao=12,lo=9,co=13,SC=91,bC=93,wC=40,RC=41,vC=123,xC=125,EC=59,kC=42,CC=58,AC=64,uo=/[\t\n\f\r "#'()/;[\\\]{}]/g,po=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,PC=/.[\r\n"'(/\\]/,Lf=/[\da-f]/i,MC=function(t,r={}){let n=t.css.valueOf(),i=r.ignoreErrors,o,s,a,l,c,u,d,p,m,y,f=n.length,h=0,w=[],x=[];function g(){return h}function E(W){throw t.error("Unclosed "+W,h)}function T(){return x.length===0&&h>=f}function j(W){if(x.length)return x.pop();if(h>=f)return;let G=W?W.ignoreUnclosed:!1;switch(o=n.charCodeAt(h),o){case so:case un:case lo:case co:case ao:{s=h;do s+=1,o=n.charCodeAt(s);while(o===un||o===so||o===lo||o===co||o===ao);y=["space",n.slice(h,s)],h=s-1;break}case SC:case bC:case vC:case xC:case CC:case EC:case RC:{let re=String.fromCharCode(o);y=[re,re,h];break}case wC:{if(p=w.length?w.pop()[1]:"",m=n.charCodeAt(h+1),p==="url"&&m!==Ga&&m!==Nf&&m!==un&&m!==so&&m!==lo&&m!==ao&&m!==co){s=h;do{if(u=!1,s=n.indexOf(")",s+1),s===-1)if(i||G){s=h;break}else E("bracket");for(d=s;n.charCodeAt(d-1)===oo;)d-=1,u=!u}while(u);y=["brackets",n.slice(h,s+1),h,s],h=s}else s=n.indexOf(")",h+1),l=n.slice(h,s+1),s===-1||PC.test(l)?y=["(","(",h]:(y=["brackets",l,h,s],h=s);break}case Ga:case Nf:{a=o===Ga?"'":'"',s=h;do{if(u=!1,s=n.indexOf(a,s+1),s===-1)if(i||G){s=h+1;break}else E("string");for(d=s;n.charCodeAt(d-1)===oo;)d-=1,u=!u}while(u);y=["string",n.slice(h,s+1),h,s],h=s;break}case AC:{uo.lastIndex=h+1,uo.test(n),uo.lastIndex===0?s=n.length-1:s=uo.lastIndex-2,y=["at-word",n.slice(h,s+1),h,s],h=s;break}case oo:{for(s=h,c=!0;n.charCodeAt(s+1)===oo;)s+=1,c=!c;if(o=n.charCodeAt(s+1),c&&o!==$f&&o!==un&&o!==so&&o!==lo&&o!==co&&o!==ao&&(s+=1,Lf.test(n.charAt(s)))){for(;Lf.test(n.charAt(s+1));)s+=1;n.charCodeAt(s+1)===un&&(s+=1)}y=["word",n.slice(h,s+1),h,s],h=s;break}default:{o===$f&&n.charCodeAt(h+1)===kC?(s=n.indexOf("*/",h+2)+1,s===0&&(i||G?s=n.length:E("comment")),y=["comment",n.slice(h,s+1),h,s],h=s):(po.lastIndex=h+1,po.test(n),po.lastIndex===0?s=n.length-1:s=po.lastIndex-2,y=["word",n.slice(h,s+1),h,s],w.push(y),h=s);break}}return h++,y}function te(W){x.push(W)}return{back:te,endOfFile:T,nextToken:j,position:g}},Kh=Ht,Fo=class extends Kh{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)}},Zl=Fo;Fo.default=Fo;Kh.registerAtRule(Fo);var Hh=Ht,Yh,Xh,Ar=class extends Hh{constructor(t){super(t),this.type="root",this.nodes||(this.nodes=[])}normalize(t,r,n){let i=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 o of i)o.raws.before=r.raws.before}return i}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 Yh(new Xh,this,t).stringify()}};Ar.registerLazyResult=e=>{Yh=e};Ar.registerProcessor=e=>{Xh=e};var Mn=Ar;Ar.default=Ar;Hh.registerRoot(Ar);var wn={comma(e){return wn.split(e,[","],!0)},space(e){let t=[" ",`
29
- `," "];return wn.split(e,t)},split(e,t,r){let n=[],i="",o=!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)&&(o=!0),o?(i!==""&&n.push(i.trim()),i="",o=!1):i+=u;return(r||i!=="")&&n.push(i.trim()),n}},Zh=wn;wn.default=wn;var Jh=Ht,OC=Zh,_o=class extends Jh{constructor(t){super(t),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return OC.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)}},Jl=_o;_o.default=_o;Jh.registerRule(_o);var IC=Xo,TC=MC,NC=Jo,$C=Zl,LC=Mn,Df=Jl,Ff={empty:!0,space:!0};function DC(e){for(let t=e.length-1;t>=0;t--){let r=e[t],n=r[3]||r[2];if(n)return n}}var FC=class{constructor(t){this.input=t,this.root=new LC,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 $C;r.name=t[1].slice(1),r.name===""&&this.unnamedAtrule(r,t),this.init(r,t[2]);let n,i,o,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(o=l.length-1,i=l[o];i&&i[0]==="space";)i=l[--o];i&&(r.source.end=this.getPosition(i[3]||i[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,i;for(let o=r-1;o>=0&&(i=t[o],!(i[0]!=="space"&&(n+=1,n===2)));o--);throw this.input.error("Missed semicolon",i[0]==="word"?i[3]+1:i[2])}colon(t){let r=0,n,i,o;for(let[s,a]of t.entries()){if(n=a,i=n[0],i==="("&&(r+=1),i===")"&&(r-=1),r===0&&i===":")if(!o)this.doubleColon(n);else{if(o[0]==="word"&&o[1]==="progid")continue;return s}o=n}return!1}comment(t){let r=new NC;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 i=n.match(/^(\s*)([^]*\S)(\s*)$/);r.text=i[2],r.raws.left=i[1],r.raws.right=i[3]}}createTokenizer(){this.tokenizer=TC(this.input)}decl(t,r){let n=new IC;this.init(n,t[0][2]);let i=t[t.length-1];for(i[0]===";"&&(this.semicolon=!0,t.pop()),n.source.end=this.getPosition(i[3]||i[2]||DC(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 o;for(;t.length;)if(o=t.shift(),o[0]===":"){n.raws.between+=o[1];break}else o[0]==="word"&&/\w/.test(o[1])&&this.unknownWord([o]),n.raws.between+=o[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(o=t[c],o[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(o[1].toLowerCase()==="important"){let u=t.slice(0),d="";for(let p=c;p>0;p--){let m=u[p][0];if(d.trim().indexOf("!")===0&&m!=="space")break;d=u.pop()[1]+d}d.trim().indexOf("!")===0&&(n.important=!0,n.raws.important=d,t=u)}if(o[0]!=="space"&&o[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 Df;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,i=!1,o=null,s=[],a=t[1].startsWith("--"),l=[],c=t;for(;c;){if(n=c[0],l.push(c),n==="("||n==="[")o||(o=c),s.push(n==="("?")":"]");else if(a&&i&&n==="{")o||(o=c),s.push("}");else if(s.length===0)if(n===";")if(i){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===":"&&(i=!0);else n===s[s.length-1]&&(s.pop(),s.length===0&&(o=null));c=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(r=!0),s.length>0&&this.unclosedBracket(o),r&&i){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,i){let o,s,a=n.length,l="",c=!0,u,d;for(let p=0;p<a;p+=1)o=n[p],s=o[0],s==="space"&&p===a-1&&!i?c=!1:s==="comment"?(d=n[p-1]?n[p-1][0]:"empty",u=n[p+1]?n[p+1][0]:"empty",!Ff[d]&&!Ff[u]?l.slice(-1)===","?c=!1:l+=o[1]:c=!1):l+=o[1];if(!c){let p=n.reduce((m,y)=>m+y[1],"");t.raws[r]={raw:p,value:l}}t[r]=l}rule(t){t.pop();let r=new Df;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 i=r;i<t.length;i++)n+=t[i][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})}},_C=FC,jC=Ht,BC=_C,VC=Zo;function jo(e,t){let r=new VC(e,t),n=new BC(r);try{n.parse()}catch(i){throw process.env.NODE_ENV!=="production"&&i.name==="CssSyntaxError"&&t&&t.from&&(/\.scss$/i.test(t.from)?i.message+=`
30
- You tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser`:/\.sass/i.test(t.from)?i.message+=`
31
- You tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser`:/\.less$/i.test(t.from)&&(i.message+=`
32
- You tried to parse Less with the standard CSS parser; try again with the postcss-less parser`)),i}return n.root}var Ql=jo;jo.default=jo;jC.registerParse(jo);var{isClean:et,my:WC}=Pn,UC=Nh,zC=Ho,GC=Ht,qC=Yl,KC=Gh,_f=Xl,HC=Ql,YC=Mn,XC={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},ZC={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},JC={Once:!0,postcssPlugin:!0,prepare:!0},Pr=0;function dn(e){return typeof e=="object"&&typeof e.then=="function"}function Qh(e){let t=!1,r=XC[e.type];return e.type==="decl"?t=e.prop.toLowerCase():e.type==="atrule"&&(t=e.name.toLowerCase()),t&&e.append?[r,r+"-"+t,Pr,r+"Exit",r+"Exit-"+t]:t?[r,r+"-"+t,r+"Exit",r+"Exit-"+t]:e.append?[r,Pr,r+"Exit"]:[r,r+"Exit"]}function jf(e){let t;return e.type==="document"?t=["Document",Pr,"DocumentExit"]:e.type==="root"?t=["Root",Pr,"RootExit"]:t=Qh(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function fl(e){return e[et]=!1,e.nodes&&e.nodes.forEach(t=>fl(t)),e}var hl={},Mr=class em{constructor(t,r,n){this.stringified=!1,this.processed=!1;let i;if(typeof r=="object"&&r!==null&&(r.type==="root"||r.type==="document"))i=fl(r);else if(r instanceof em||r instanceof _f)i=fl(r.root),r.map&&(typeof n.map>"u"&&(n.map={}),n.map.inline||(n.map.inline=!1),n.map.prev=r.map);else{let o=HC;n.syntax&&(o=n.syntax.parse),n.parser&&(o=n.parser),o.parse&&(o=o.parse);try{i=o(r,n)}catch(s){this.processed=!0,this.error=s}i&&!i[WC]&&GC.rebuild(i)}this.result=new _f(t,i,n),this.helpers={...hl,postcss:hl,result:this.result},this.plugins=this.processor.plugins.map(o=>typeof o=="object"&&o.prepare?{...o,...o.prepare(this.result)}:o)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(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 i=n.postcssPlugin,o=n.postcssVersion,s=this.result.processor.version,a=o.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 "+i+" uses "+o+". Perhaps this is the source of the error below.")}}catch(i){console&&console.error&&console.error(i)}return t}prepareVisitors(){this.listeners={};let t=(r,n,i)=>{this.listeners[n]||(this.listeners[n]=[]),this.listeners[n].push([r,i])};for(let r of this.plugins)if(typeof r=="object")for(let n in r){if(!ZC[n]&&/^[A-Z]/.test(n))throw new Error(`Unknown event ${n} in ${r.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!JC[n])if(typeof r[n]=="object")for(let i in r[n])i==="*"?t(r,n,r[n][i]):t(r,n+"-"+i.toLowerCase(),r[n][i]);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(dn(n))try{await n}catch(i){throw this.handleError(i)}}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[et];){t[et]=!0;let r=[jf(t)];for(;r.length>0;){let n=this.visitTick(r);if(dn(n))try{await n}catch(i){let o=r[r.length-1].node;throw this.handleError(i,o)}}}if(this.listeners.OnceExit)for(let[r,n]of this.listeners.OnceExit){this.result.lastPlugin=r;try{if(t.type==="document"){let i=t.nodes.map(o=>n(o,this.helpers));await Promise.all(i)}else await n(t,this.helpers)}catch(i){throw this.handleError(i)}}}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 dn(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=zC;t.syntax&&(r=t.syntax.stringify),t.stringifier&&(r=t.stringifier),r.stringify&&(r=r.stringify);let i=new UC(r,this.result.root,this.result.opts).generate();return this.result.css=i[0],this.result.map=i[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(dn(r))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[et];)t[et]=!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||KC("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,i]of t){this.result.lastPlugin=n;let o;try{o=i(r,this.helpers)}catch(s){throw this.handleError(s,r.proxyOf)}if(r.type!=="root"&&r.type!=="document"&&!r.parent)return!0;if(dn(o))throw this.getAsyncError()}}visitTick(t){let r=t[t.length-1],{node:n,visitors:i}=r;if(n.type!=="root"&&n.type!=="document"&&!n.parent){t.pop();return}if(i.length>0&&r.visitorIndex<i.length){let[s,a]=i[r.visitorIndex];r.visitorIndex+=1,r.visitorIndex===i.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[et]){a[et]=!0,t.push(jf(a));return}r.iterator=0,delete n.indexes[s]}let o=r.events;for(;r.eventIndex<o.length;){let s=o[r.eventIndex];if(r.eventIndex+=1,s===Pr){n.nodes&&n.nodes.length&&(n[et]=!0,r.iterator=n.getIterator());return}else if(this.listeners[s]){r.visitors=this.listeners[s];return}}t.pop()}walkSync(t){t[et]=!0;let r=Qh(t);for(let n of r)if(n===Pr)t.nodes&&t.each(i=>{i[et]||this.walkSync(i)});else{let i=this.listeners[n];if(i&&this.visitSync(i,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"}};Mr.registerPostcss=e=>{hl=e};var tm=Mr;Mr.default=Mr;YC.registerLazyResult(Mr);qC.registerLazyResult(Mr);var QC=Nh,eA=Ho,tA=Gh,rA=Ql,nA=Xl,ml=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 i,o=eA;this.result=new nA(this._processor,i,this._opts),this.result.css=r;let s=this;Object.defineProperty(this.result,"root",{get(){return s.root}});let a=new QC(o,i,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||tA("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=rA;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"}},iA=ml;ml.default=ml;var oA=iA,sA=tm,aA=Yl,lA=Mn,Rn=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 oA(this,t,r):new sA(this,t,r)}use(t){return this.plugins=this.plugins.concat(this.normalize([t])),this}},cA=Rn;Rn.default=Rn;lA.registerProcessor(Rn);aA.registerProcessor(Rn);var uA=Xo,dA=Ph,pA=Jo,fA=Zl,hA=Zo,mA=Mn,yA=Jl;function vn(e,t){if(Array.isArray(e))return e.map(i=>vn(i));let{inputs:r,...n}=e;if(r){t=[];for(let i of r){let o={...i,__proto__:hA.prototype};o.map&&(o.map={...o.map,__proto__:dA.prototype}),t.push(o)}}if(n.nodes&&(n.nodes=e.nodes.map(i=>vn(i,t))),n.source){let{inputId:i,...o}=n.source;n.source=o,i!=null&&(n.source.input=t[i])}if(n.type==="root")return new mA(n);if(n.type==="decl")return new uA(n);if(n.type==="rule")return new yA(n);if(n.type==="comment")return new pA(n);if(n.type==="atrule")return new fA(n);throw new Error("Unknown node type: "+e.type)}var gA=vn;vn.default=vn;var SA=ql,rm=Xo,bA=tm,wA=Ht,ec=cA,RA=Ho,vA=gA,nm=Yl,xA=qh,im=Jo,om=Zl,EA=Xl,kA=Zo,CA=Ql,AA=Zh,sm=Jl,am=Mn,PA=Yo;function F(...e){return e.length===1&&Array.isArray(e[0])&&(e=e[0]),new ec(e)}F.plugin=function(t,r){let n=!1;function i(...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 ec().version,a}let o;return Object.defineProperty(i,"postcss",{get(){return o||(o=i()),o}}),i.process=function(s,a,l){return F([i(l)]).process(s,a)},i};F.stringify=RA;F.parse=CA;F.fromJSON=vA;F.list=AA;F.comment=e=>new im(e);F.atRule=e=>new om(e);F.decl=e=>new rm(e);F.rule=e=>new sm(e);F.root=e=>new am(e);F.document=e=>new nm(e);F.CssSyntaxError=SA;F.Declaration=rm;F.Container=wA;F.Processor=ec;F.Document=nm;F.Comment=im;F.Warning=xA;F.AtRule=om;F.Result=EA;F.Input=kA;F.Rule=sm;F.Root=am;F.Node=PA;bA.registerPostcss(F);var MA=F;F.default=F;var H=jk(MA);H.stringify;H.fromJSON;H.plugin;H.parse;H.list;H.document;H.comment;H.atRule;H.rule;H.decl;H.root;H.CssSyntaxError;H.Declaration;H.Container;H.Processor;H.Document;H.Comment;H.Warning;H.AtRule;H.Result;H.Input;H.Rule;H.Root;H.Node;var OA=Object.defineProperty,IA=(e,t,r)=>t in e?OA(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Te=(e,t,r)=>IA(e,typeof t!="symbol"?t+"":t,r);function TA(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function NA(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 i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}),r}var tc={exports:{}},K=String,lm=function(){return{isColorSupported:!1,reset:K,bold:K,dim:K,italic:K,underline:K,inverse:K,hidden:K,strikethrough:K,black:K,red:K,green:K,yellow:K,blue:K,magenta:K,cyan:K,white:K,gray:K,bgBlack:K,bgRed:K,bgGreen:K,bgYellow:K,bgBlue:K,bgMagenta:K,bgCyan:K,bgWhite:K}};tc.exports=lm();tc.exports.createColors=lm;var $A=tc.exports,LA={},DA=Object.freeze(Object.defineProperty({__proto__:null,default:LA},Symbol.toStringTag,{value:"Module"})),je=NA(DA),Bf=$A,Vf=je,yl=class cm extends Error{constructor(t,r,n,i,o,s){super(t),this.name="CssSyntaxError",this.reason=t,o&&(this.file=o),i&&(this.source=i),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,cm)}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=Bf.isColorSupported),Vf&&t&&(r=Vf(r));let n=r.split(/\r?\n/),i=Math.max(this.line-3,0),o=Math.min(this.line+2,n.length),s=String(o).length,a,l;if(t){let{bold:c,gray:u,red:d}=Bf.createColors(!0);a=p=>c(d(p)),l=p=>u(p)}else a=l=c=>c;return n.slice(i,o).map((c,u)=>{let d=i+1+u,p=" "+(" "+d).slice(-s)+" | ";if(d===this.line){let m=l(p.replace(/\d/g," "))+c.slice(0,this.column-1).replace(/[^\t]/g," ");return a(">")+l(p)+c+`
35
- `+m+a("^")}return" "+l(p)+c}).join(`
36
- `)}toString(){let t=this.showSourceCode();return t&&(t=`
37
-
38
- `+t+`
39
- `),this.name+": "+this.message+t}},rc=yl;yl.default=yl;var On={};On.isClean=Symbol("isClean");On.my=Symbol("my");var Wf={after:`
40
- `,beforeClose:`
41
- `,beforeComment:`
42
- `,beforeDecl:`
43
- `,beforeOpen:" ",beforeRule:`
44
- `,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function FA(e){return e[0].toUpperCase()+e.slice(1)}var gl=class{constructor(t){this.builder=t}atrule(t,r){let n="@"+t.name,i=t.params?this.rawValue(t,"params"):"";if(typeof t.raws.afterName<"u"?n+=t.raws.afterName:i&&(n+=" "),t.nodes)this.block(t,n+i);else{let o=(t.raws.between||"")+(r?";":"");this.builder(n+i+o,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 i=t.parent,o=0;for(;i&&i.type!=="root";)o+=1,i=i.parent;if(n.includes(`
45
- `)){let s=this.raw(t,null,"indent");if(s.length)for(let a=0;a<o;a++)n+=s}return n}block(t,r){let n=this.raw(t,"between","beforeOpen");this.builder(r+n+"{",t,"start");let i;t.nodes&&t.nodes.length?(this.body(t),i=this.raw(t,"after")):i=this.raw(t,"after","emptyBody"),i&&this.builder(i),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 i=0;i<t.nodes.length;i++){let o=t.nodes[i],s=this.raw(o,"before");s&&this.builder(s),this.stringify(o,r!==i||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"),i=t.prop+n+this.rawValue(t,"value");t.important&&(i+=t.raws.important||" !important"),r&&(i+=";"),this.builder(i,t)}document(t){this.body(t)}raw(t,r,n){let i;if(n||(n=r),r&&(i=t.raws[r],typeof i<"u"))return i;let o=t.parent;if(n==="before"&&(!o||o.type==="root"&&o.first===t||o&&o.type==="document"))return"";if(!o)return Wf[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"+FA(n);this[a]?i=this[a](s,t):s.walk(l=>{if(i=l.raws[r],typeof i<"u")return!1})}return typeof i>"u"&&(i=Wf[n]),s.rawCache[n]=i,i}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(i=>{if(typeof i.raws.before<"u")return n=i.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(i=>{if(typeof i.raws.before<"u")return n=i.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 i=n.parent;if(i&&i!==t&&i.parent&&i.parent===t&&typeof n.raws.before<"u"){let o=n.raws.before.split(`
50
- `);return r=o[o.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],i=t.raws[r];return i&&i.value===n?i.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)}},um=gl;gl.default=gl;var _A=um;function Sl(e,t){new _A(t).stringify(e)}var Qo=Sl;Sl.default=Sl;var{isClean:fo,my:jA}=On,BA=rc,VA=um,WA=Qo;function bl(e,t){let r=new e.constructor;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n)||n==="proxyCache")continue;let i=e[n],o=typeof i;n==="parent"&&o==="object"?t&&(r[n]=t):n==="source"?r[n]=i:Array.isArray(i)?r[n]=i.map(s=>bl(s,r)):(o==="object"&&i!==null&&(i=bl(i)),r[n]=i)}return r}var wl=class{constructor(t={}){this.raws={},this[fo]=!1,this[jA]=!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=bl(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:i}=this.rangeBy(r);return this.source.input.error(t,{column:i.column,line:i.line},{column:n.column,line:n.line},r)}return new BA(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[fo]){this[fo]=!1;let t=this;for(;t=t.parent;)t[fo]=!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 i=r.indexOf(t.word);i!==-1&&(n=this.positionInside(i,r))}return n}positionInside(t,r){let n=r||this.toString(),i=this.source.start.column,o=this.source.start.line;for(let s=0;s<t;s++)n[s]===`
51
- `?(i=1,o+=1):i+=1;return{column:i,line:o}}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 i=this.toString(),o=i.indexOf(t.word);o!==-1&&(r=this.positionInside(o,i),n=this.positionInside(o+t.word.length,i))}else t.start?r={column:t.start.column,line:t.start.line}:t.index&&(r=this.positionInside(t.index)),t.end?n={column:t.end.column,line:t.end.line}:typeof t.endIndex=="number"?n=this.positionInside(t.endIndex):t.index&&(n=this.positionInside(t.index+1));return(n.line<r.line||n.line===r.line&&n.column<=r.column)&&(n={column:r.column+1,line:r.line}),{end:n,start:r}}raw(t,r){return new VA().raw(this,t,r)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...t){if(this.parent){let r=this,n=!1;for(let i of t)i===this?n=!0:n?(this.parent.insertAfter(r,i),r=i):this.parent.insertBefore(r,i);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={},i=r==null;r=r||new Map;let o=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=o,r.set(a.input,o),o++),n[s]={end:a.end,inputId:l,start:a.start}}else n[s]=a}return i&&(n.inputs=[...r.keys()].map(s=>s.toJSON())),n}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(t=WA){t.stringify&&(t=t.stringify);let r="";return t(this,n=>{r+=n}),r}warn(t,r,n){let i={node:this};for(let o in n)i[o]=n[o];return t.warn(r,i)}get proxyOf(){return this}},es=wl;wl.default=wl;var UA=es,Rl=class extends UA{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]==="$"}},ts=Rl;Rl.default=Rl;var zA="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",GA=(e,t=21)=>(r=t)=>{let n="",i=r;for(;i--;)n+=e[Math.random()*e.length|0];return n},qA=(e=21)=>{let t="",r=e;for(;r--;)t+=zA[Math.random()*64|0];return t},KA={nanoid:qA,customAlphabet:GA},{SourceMapConsumer:Uf,SourceMapGenerator:zf}=je,{existsSync:HA,readFileSync:YA}=je,{dirname:qa,join:XA}=je;function ZA(e){return Buffer?Buffer.from(e,"base64").toString():window.atob(e)}var vl=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,i=this.loadMap(r.from,n);!this.mapFile&&r.from&&(this.mapFile=r.from),this.mapFile&&(this.root=qa(this.mapFile)),i&&(this.text=i)}consumer(){return this.consumerCache||(this.consumerCache=new Uf(this.text)),this.consumerCache}decodeInline(t){let r=/^data:application\/json;charset=utf-?8;base64,/,n=/^data:application\/json;base64,/,i=/^data:application\/json;charset=utf-?8,/,o=/^data:application\/json,/;if(i.test(t)||o.test(t))return decodeURIComponent(t.substr(RegExp.lastMatch.length));if(r.test(t)||n.test(t))return ZA(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()),i=t.indexOf("*/",n);n>-1&&i>-1&&(this.annotation=this.getAnnotationURL(t.substring(n,i)))}loadFile(t){if(this.root=qa(t),HA(t))return this.mapFile=t,YA(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 i=this.loadFile(n);if(!i)throw new Error("Unable to load previous source map: "+n.toString());return i}}else{if(r instanceof Uf)return zf.fromSourceMap(r).toString();if(r instanceof zf)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=XA(qa(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)}},dm=vl;vl.default=vl;var{SourceMapConsumer:JA,SourceMapGenerator:QA}=je,{fileURLToPath:Gf,pathToFileURL:ho}=je,{isAbsolute:xl,resolve:El}=je,{nanoid:eP}=KA,Ka=je,qf=rc,tP=dm,Ha=Symbol("fromOffsetCache"),rP=!!(JA&&QA),Kf=!!(El&&xl),Bo=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&&(!Kf||/^\w+:\/\//.test(r.from)||xl(r.from)?this.file=r.from:this.file=El(r.from)),Kf&&rP){let n=new tP(this.css,r);if(n.text){this.map=n;let i=n.consumer().file;!this.file&&i&&(this.file=this.mapResolve(i))}}this.file||(this.id="<input css "+eP(6)+">"),this.map&&(this.map.file=this.from)}error(t,r,n,i={}){let o,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?o=new qf(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,i.plugin):o=new qf(t,s===void 0?r:{column:n,line:r},s===void 0?n:{column:a,line:s},this.css,this.file,i.plugin),o.input={column:n,endColumn:a,endLine:s,line:r,source:this.css},this.file&&(ho&&(o.input.url=ho(this.file).toString()),o.input.file=this.file),o}fromOffset(t){let r,n;if(this[Ha])n=this[Ha];else{let o=this.css.split(`
52
- `);n=new Array(o.length);let s=0;for(let a=0,l=o.length;a<l;a++)n[a]=s,s+=o[a].length+1;this[Ha]=n}r=n[n.length-1];let i=0;if(t>=r)i=n.length-1;else{let o=n.length-2,s;for(;i<o;)if(s=i+(o-i>>1),t<n[s])o=s-1;else if(t>=n[s+1])i=s+1;else{i=s;break}}return{col:t-n[i]+1,line:i+1}}mapResolve(t){return/^\w+:\/\//.test(t)?t:El(this.map.consumer().sourceRoot||this.map.root||".",t)}origin(t,r,n,i){if(!this.map)return!1;let o=this.map.consumer(),s=o.originalPositionFor({column:r,line:t});if(!s.source)return!1;let a;typeof n=="number"&&(a=o.originalPositionFor({column:i,line:n}));let l;xl(s.source)?l=ho(s.source):l=new URL(s.source,this.map.consumer().sourceRoot||ho(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(Gf)c.file=Gf(l);else throw new Error("file: protocol is not available in this PostCSS build");let u=o.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}},rs=Bo;Bo.default=Bo;Ka&&Ka.registerInput&&Ka.registerInput(Bo);var{SourceMapConsumer:pm,SourceMapGenerator:Ao}=je,{dirname:Po,relative:fm,resolve:hm,sep:mm}=je,{pathToFileURL:Hf}=je,nP=rs,iP=!!(pm&&Ao),oP=!!(Po&&hm&&fm&&mm),sP=class{constructor(t,r,n,i){this.stringify=t,this.mapOpts=n.map||{},this.root=r,this.opts=n,this.css=i,this.originalCSS=i,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||Po(t.file),i;this.mapOpts.sourcesContent===!1?(i=new pm(t.text),i.sourcesContent&&(i.sourcesContent=null)):i=t.consumer(),this.map.applySourceMap(i,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(),oP&&iP&&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=Ao.fromSourceMap(t,{ignoreInvalidMapping:!0})}else this.map=new Ao({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 Ao({file:this.outputFile(),ignoreInvalidMapping:!0});let t=1,r=1,n="<no source>",i={generated:{column:0,line:0},original:{column:0,line:0},source:""},o,s;this.stringify(this.root,(a,l,c)=>{if(this.css+=a,l&&c!=="end"&&(i.generated.line=t,i.generated.column=r-1,l.source&&l.source.start?(i.source=this.sourcePath(l),i.original.line=l.source.start.line,i.original.column=l.source.start.column-1,this.map.addMapping(i)):(i.source=n,i.original.line=1,i.original.column=0,this.map.addMapping(i))),o=a.match(/\n/g),o?(t+=o.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?(i.source=this.sourcePath(l),i.original.line=l.source.end.line,i.original.column=l.source.end.column-1,i.generated.line=t,i.generated.column=r-2,this.map.addMapping(i)):(i.source=n,i.original.line=1,i.original.column=0,i.generated.line=t,i.generated.column=r-1,this.map.addMapping(i)))}})}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?Po(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(n=Po(hm(n,this.mapOpts.annotation)));let i=fm(n,t);return this.memoizedPaths.set(t,i),i}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 nP(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 i=this.usesFileUrls?this.toFileUrl(n):this.toUrl(this.path(n));this.map.setSourceContent(i,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(Hf){let n=Hf(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;mm==="\\"&&(t=t.replace(/\\/g,"/"));let n=encodeURI(t).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(t,n),n}},ym=sP,aP=es,kl=class extends aP{constructor(t){super(t),this.type="comment"}},ns=kl;kl.default=kl;var{isClean:gm,my:Sm}=On,bm=ts,wm=ns,lP=es,Rm,nc,ic,vm;function xm(e){return e.map(t=>(t.nodes&&(t.nodes=xm(t.nodes)),delete t.source,t))}function Em(e){if(e[gm]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)Em(t)}var gt=class km extends lP{append(...t){for(let r of t){let n=this.normalize(r,this.last);for(let i of n)this.proxyOf.nodes.push(i)}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,i;for(;this.indexes[r]<this.proxyOf.nodes.length&&(n=this.indexes[r],i=t(this.proxyOf.nodes[n],n),i!==!1);)this.indexes[r]+=1;return delete this.indexes[r],i}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(i=>typeof i=="function"?(o,s)=>i(o.toProxy(),s):i)):r==="every"||r==="some"?n=>t[r]((i,...o)=>n(i.toProxy(),...o)):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),i=this.normalize(r,this.proxyOf.nodes[n]).reverse();n=this.index(t);for(let s of i)this.proxyOf.nodes.splice(n+1,0,s);let o;for(let s in this.indexes)o=this.indexes[s],n<o&&(this.indexes[s]=o+i.length);return this.markDirty(),this}insertBefore(t,r){let n=this.index(t),i=n===0?"prepend":!1,o=this.normalize(r,this.proxyOf.nodes[n],i).reverse();n=this.index(t);for(let a of o)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+o.length);return this.markDirty(),this}normalize(t,r){if(typeof t=="string")t=xm(Rm(t).nodes);else if(typeof t>"u")t=[];else if(Array.isArray(t)){t=t.slice(0);for(let i of t)i.parent&&i.parent.removeChild(i,"ignore")}else if(t.type==="root"&&this.type!=="document"){t=t.nodes.slice(0);for(let i of t)i.parent&&i.parent.removeChild(i,"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 bm(t)]}else if(t.selector)t=[new nc(t)];else if(t.name)t=[new ic(t)];else if(t.text)t=[new wm(t)];else throw new Error("Unknown node type in node creation");return t.map(i=>(i[Sm]||km.rebuild(i),i=i.proxyOf,i.parent&&i.parent.removeChild(i),i[gm]&&Em(i),typeof i.raws.before>"u"&&r&&typeof r.raws.before<"u"&&(i.raws.before=r.raws.before.replace(/\S/g,"")),i.parent=this.proxyOf,i))}prepend(...t){t=t.reverse();for(let r of t){let n=this.normalize(r,this.first,"prepend").reverse();for(let i of n)this.proxyOf.nodes.unshift(i);for(let i in this.indexes)this.indexes[i]=this.indexes[i]+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(i=>{r.props&&!r.props.includes(i.prop)||r.fast&&!i.value.includes(r.fast)||(i.value=i.value.replace(t,n))}),this.markDirty(),this}some(t){return this.nodes.some(t)}walk(t){return this.each((r,n)=>{let i;try{i=t(r,n)}catch(o){throw r.addToError(o)}return i!==!1&&r.walk&&(i=r.walk(t)),i})}walkAtRules(t,r){return r?t instanceof RegExp?this.walk((n,i)=>{if(n.type==="atrule"&&t.test(n.name))return r(n,i)}):this.walk((n,i)=>{if(n.type==="atrule"&&n.name===t)return r(n,i)}):(r=t,this.walk((n,i)=>{if(n.type==="atrule")return r(n,i)}))}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,i)=>{if(n.type==="decl"&&t.test(n.prop))return r(n,i)}):this.walk((n,i)=>{if(n.type==="decl"&&n.prop===t)return r(n,i)}):(r=t,this.walk((n,i)=>{if(n.type==="decl")return r(n,i)}))}walkRules(t,r){return r?t instanceof RegExp?this.walk((n,i)=>{if(n.type==="rule"&&t.test(n.selector))return r(n,i)}):this.walk((n,i)=>{if(n.type==="rule"&&n.selector===t)return r(n,i)}):(r=t,this.walk((n,i)=>{if(n.type==="rule")return r(n,i)}))}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]}};gt.registerParse=e=>{Rm=e};gt.registerRule=e=>{nc=e};gt.registerAtRule=e=>{ic=e};gt.registerRoot=e=>{vm=e};var Yt=gt;gt.default=gt;gt.rebuild=e=>{e.type==="atrule"?Object.setPrototypeOf(e,ic.prototype):e.type==="rule"?Object.setPrototypeOf(e,nc.prototype):e.type==="decl"?Object.setPrototypeOf(e,bm.prototype):e.type==="comment"?Object.setPrototypeOf(e,wm.prototype):e.type==="root"&&Object.setPrototypeOf(e,vm.prototype),e[Sm]=!0,e.nodes&&e.nodes.forEach(t=>{gt.rebuild(t)})};var cP=Yt,Cm,Am,xn=class extends cP{constructor(t){super({type:"document",...t}),this.nodes||(this.nodes=[])}toResult(t={}){return new Cm(new Am,this,t).stringify()}};xn.registerLazyResult=e=>{Cm=e};xn.registerProcessor=e=>{Am=e};var oc=xn;xn.default=xn;var Yf={},Pm=function(t){Yf[t]||(Yf[t]=!0,typeof console<"u"&&console.warn&&console.warn(t))},Cl=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}},Mm=Cl;Cl.default=Cl;var uP=Mm,Al=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 uP(t,r);return this.messages.push(n),n}warnings(){return this.messages.filter(t=>t.type==="warning")}get content(){return this.css}},sc=Al;Al.default=Al;var Ya=39,Xf=34,mo=92,Zf=47,yo=10,pn=32,go=12,So=9,bo=13,dP=91,pP=93,fP=40,hP=41,mP=123,yP=125,gP=59,SP=42,bP=58,wP=64,wo=/[\t\n\f\r "#'()/;[\\\]{}]/g,Ro=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,RP=/.[\r\n"'(/\\]/,Jf=/[\da-f]/i,vP=function(t,r={}){let n=t.css.valueOf(),i=r.ignoreErrors,o,s,a,l,c,u,d,p,m,y,f=n.length,h=0,w=[],x=[];function g(){return h}function E(W){throw t.error("Unclosed "+W,h)}function T(){return x.length===0&&h>=f}function j(W){if(x.length)return x.pop();if(h>=f)return;let G=W?W.ignoreUnclosed:!1;switch(o=n.charCodeAt(h),o){case yo:case pn:case So:case bo:case go:{s=h;do s+=1,o=n.charCodeAt(s);while(o===pn||o===yo||o===So||o===bo||o===go);y=["space",n.slice(h,s)],h=s-1;break}case dP:case pP:case mP:case yP:case bP:case gP:case hP:{let re=String.fromCharCode(o);y=[re,re,h];break}case fP:{if(p=w.length?w.pop()[1]:"",m=n.charCodeAt(h+1),p==="url"&&m!==Ya&&m!==Xf&&m!==pn&&m!==yo&&m!==So&&m!==go&&m!==bo){s=h;do{if(u=!1,s=n.indexOf(")",s+1),s===-1)if(i||G){s=h;break}else E("bracket");for(d=s;n.charCodeAt(d-1)===mo;)d-=1,u=!u}while(u);y=["brackets",n.slice(h,s+1),h,s],h=s}else s=n.indexOf(")",h+1),l=n.slice(h,s+1),s===-1||RP.test(l)?y=["(","(",h]:(y=["brackets",l,h,s],h=s);break}case Ya:case Xf:{a=o===Ya?"'":'"',s=h;do{if(u=!1,s=n.indexOf(a,s+1),s===-1)if(i||G){s=h+1;break}else E("string");for(d=s;n.charCodeAt(d-1)===mo;)d-=1,u=!u}while(u);y=["string",n.slice(h,s+1),h,s],h=s;break}case wP:{wo.lastIndex=h+1,wo.test(n),wo.lastIndex===0?s=n.length-1:s=wo.lastIndex-2,y=["at-word",n.slice(h,s+1),h,s],h=s;break}case mo:{for(s=h,c=!0;n.charCodeAt(s+1)===mo;)s+=1,c=!c;if(o=n.charCodeAt(s+1),c&&o!==Zf&&o!==pn&&o!==yo&&o!==So&&o!==bo&&o!==go&&(s+=1,Jf.test(n.charAt(s)))){for(;Jf.test(n.charAt(s+1));)s+=1;n.charCodeAt(s+1)===pn&&(s+=1)}y=["word",n.slice(h,s+1),h,s],h=s;break}default:{o===Zf&&n.charCodeAt(h+1)===SP?(s=n.indexOf("*/",h+2)+1,s===0&&(i||G?s=n.length:E("comment")),y=["comment",n.slice(h,s+1),h,s],h=s):(Ro.lastIndex=h+1,Ro.test(n),Ro.lastIndex===0?s=n.length-1:s=Ro.lastIndex-2,y=["word",n.slice(h,s+1),h,s],w.push(y),h=s);break}}return h++,y}function te(W){x.push(W)}return{back:te,endOfFile:T,nextToken:j,position:g}},Om=Yt,Vo=class extends Om{constructor(t){super(t),this.type="atrule"}append(...t){return this.proxyOf.nodes||(this.nodes=[]),super.append(...t)}prepend(...t){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...t)}},ac=Vo;Vo.default=Vo;Om.registerAtRule(Vo);var Im=Yt,Tm,Nm,Or=class extends Im{constructor(t){super(t),this.type="root",this.nodes||(this.nodes=[])}normalize(t,r,n){let i=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 o of i)o.raws.before=r.raws.before}return i}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 Tm(new Nm,this,t).stringify()}};Or.registerLazyResult=e=>{Tm=e};Or.registerProcessor=e=>{Nm=e};var In=Or;Or.default=Or;Im.registerRoot(Or);var En={comma(e){return En.split(e,[","],!0)},space(e){let t=[" ",`
57
- `," "];return En.split(e,t)},split(e,t,r){let n=[],i="",o=!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)&&(o=!0),o?(i!==""&&n.push(i.trim()),i="",o=!1):i+=u;return(r||i!=="")&&n.push(i.trim()),n}},$m=En;En.default=En;var Lm=Yt,xP=$m,Wo=class extends Lm{constructor(t){super(t),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return xP.comma(this.selector)}set selectors(t){let r=this.selector?this.selector.match(/,\s*/):null,n=r?r[0]:","+this.raw("between","beforeOpen");this.selector=t.join(n)}},lc=Wo;Wo.default=Wo;Lm.registerRule(Wo);var EP=ts,kP=vP,CP=ns,AP=ac,PP=In,Qf=lc,eh={empty:!0,space:!0};function MP(e){for(let t=e.length-1;t>=0;t--){let r=e[t],n=r[3]||r[2];if(n)return n}}var OP=class{constructor(t){this.input=t,this.root=new PP,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 AP;r.name=t[1].slice(1),r.name===""&&this.unnamedAtrule(r,t),this.init(r,t[2]);let n,i,o,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(o=l.length-1,i=l[o];i&&i[0]==="space";)i=l[--o];i&&(r.source.end=this.getPosition(i[3]||i[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,i;for(let o=r-1;o>=0&&(i=t[o],!(i[0]!=="space"&&(n+=1,n===2)));o--);throw this.input.error("Missed semicolon",i[0]==="word"?i[3]+1:i[2])}colon(t){let r=0,n,i,o;for(let[s,a]of t.entries()){if(n=a,i=n[0],i==="("&&(r+=1),i===")"&&(r-=1),r===0&&i===":")if(!o)this.doubleColon(n);else{if(o[0]==="word"&&o[1]==="progid")continue;return s}o=n}return!1}comment(t){let r=new CP;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 i=n.match(/^(\s*)([^]*\S)(\s*)$/);r.text=i[2],r.raws.left=i[1],r.raws.right=i[3]}}createTokenizer(){this.tokenizer=kP(this.input)}decl(t,r){let n=new EP;this.init(n,t[0][2]);let i=t[t.length-1];for(i[0]===";"&&(this.semicolon=!0,t.pop()),n.source.end=this.getPosition(i[3]||i[2]||MP(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 o;for(;t.length;)if(o=t.shift(),o[0]===":"){n.raws.between+=o[1];break}else o[0]==="word"&&/\w/.test(o[1])&&this.unknownWord([o]),n.raws.between+=o[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(o=t[c],o[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(o[1].toLowerCase()==="important"){let u=t.slice(0),d="";for(let p=c;p>0;p--){let m=u[p][0];if(d.trim().indexOf("!")===0&&m!=="space")break;d=u.pop()[1]+d}d.trim().indexOf("!")===0&&(n.important=!0,n.raws.important=d,t=u)}if(o[0]!=="space"&&o[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 Qf;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,i=!1,o=null,s=[],a=t[1].startsWith("--"),l=[],c=t;for(;c;){if(n=c[0],l.push(c),n==="("||n==="[")o||(o=c),s.push(n==="("?")":"]");else if(a&&i&&n==="{")o||(o=c),s.push("}");else if(s.length===0)if(n===";")if(i){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===":"&&(i=!0);else n===s[s.length-1]&&(s.pop(),s.length===0&&(o=null));c=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(r=!0),s.length>0&&this.unclosedBracket(o),r&&i){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,i){let o,s,a=n.length,l="",c=!0,u,d;for(let p=0;p<a;p+=1)o=n[p],s=o[0],s==="space"&&p===a-1&&!i?c=!1:s==="comment"?(d=n[p-1]?n[p-1][0]:"empty",u=n[p+1]?n[p+1][0]:"empty",!eh[d]&&!eh[u]?l.slice(-1)===","?c=!1:l+=o[1]:c=!1):l+=o[1];if(!c){let p=n.reduce((m,y)=>m+y[1],"");t.raws[r]={raw:p,value:l}}t[r]=l}rule(t){t.pop();let r=new Qf;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 i=r;i<t.length;i++)n+=t[i][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})}},IP=OP,TP=Yt,NP=IP,$P=rs;function Uo(e,t){let r=new $P(e,t),n=new NP(r);try{n.parse()}catch(i){throw process.env.NODE_ENV!=="production"&&i.name==="CssSyntaxError"&&t&&t.from&&(/\.scss$/i.test(t.from)?i.message+=`
58
- You tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser`:/\.sass/i.test(t.from)?i.message+=`
59
- You tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser`:/\.less$/i.test(t.from)&&(i.message+=`
60
- You tried to parse Less with the standard CSS parser; try again with the postcss-less parser`)),i}return n.root}var cc=Uo;Uo.default=Uo;TP.registerParse(Uo);var{isClean:tt,my:LP}=On,DP=ym,FP=Qo,_P=Yt,jP=oc,BP=Pm,th=sc,VP=cc,WP=In,UP={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},zP={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},GP={Once:!0,postcssPlugin:!0,prepare:!0},Ir=0;function fn(e){return typeof e=="object"&&typeof e.then=="function"}function Dm(e){let t=!1,r=UP[e.type];return e.type==="decl"?t=e.prop.toLowerCase():e.type==="atrule"&&(t=e.name.toLowerCase()),t&&e.append?[r,r+"-"+t,Ir,r+"Exit",r+"Exit-"+t]:t?[r,r+"-"+t,r+"Exit",r+"Exit-"+t]:e.append?[r,Ir,r+"Exit"]:[r,r+"Exit"]}function rh(e){let t;return e.type==="document"?t=["Document",Ir,"DocumentExit"]:e.type==="root"?t=["Root",Ir,"RootExit"]:t=Dm(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function Pl(e){return e[tt]=!1,e.nodes&&e.nodes.forEach(t=>Pl(t)),e}var Ml={},Tr=class Fm{constructor(t,r,n){this.stringified=!1,this.processed=!1;let i;if(typeof r=="object"&&r!==null&&(r.type==="root"||r.type==="document"))i=Pl(r);else if(r instanceof Fm||r instanceof th)i=Pl(r.root),r.map&&(typeof n.map>"u"&&(n.map={}),n.map.inline||(n.map.inline=!1),n.map.prev=r.map);else{let o=VP;n.syntax&&(o=n.syntax.parse),n.parser&&(o=n.parser),o.parse&&(o=o.parse);try{i=o(r,n)}catch(s){this.processed=!0,this.error=s}i&&!i[LP]&&_P.rebuild(i)}this.result=new th(t,i,n),this.helpers={...Ml,postcss:Ml,result:this.result},this.plugins=this.processor.plugins.map(o=>typeof o=="object"&&o.prepare?{...o,...o.prepare(this.result)}:o)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(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 i=n.postcssPlugin,o=n.postcssVersion,s=this.result.processor.version,a=o.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 "+i+" uses "+o+". Perhaps this is the source of the error below.")}}catch(i){console&&console.error&&console.error(i)}return t}prepareVisitors(){this.listeners={};let t=(r,n,i)=>{this.listeners[n]||(this.listeners[n]=[]),this.listeners[n].push([r,i])};for(let r of this.plugins)if(typeof r=="object")for(let n in r){if(!zP[n]&&/^[A-Z]/.test(n))throw new Error(`Unknown event ${n} in ${r.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!GP[n])if(typeof r[n]=="object")for(let i in r[n])i==="*"?t(r,n,r[n][i]):t(r,n+"-"+i.toLowerCase(),r[n][i]);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(fn(n))try{await n}catch(i){throw this.handleError(i)}}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[tt];){t[tt]=!0;let r=[rh(t)];for(;r.length>0;){let n=this.visitTick(r);if(fn(n))try{await n}catch(i){let o=r[r.length-1].node;throw this.handleError(i,o)}}}if(this.listeners.OnceExit)for(let[r,n]of this.listeners.OnceExit){this.result.lastPlugin=r;try{if(t.type==="document"){let i=t.nodes.map(o=>n(o,this.helpers));await Promise.all(i)}else await n(t,this.helpers)}catch(i){throw this.handleError(i)}}}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 fn(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=FP;t.syntax&&(r=t.syntax.stringify),t.stringifier&&(r=t.stringifier),r.stringify&&(r=r.stringify);let i=new DP(r,this.result.root,this.result.opts).generate();return this.result.css=i[0],this.result.map=i[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(fn(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||BP("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,i]of t){this.result.lastPlugin=n;let o;try{o=i(r,this.helpers)}catch(s){throw this.handleError(s,r.proxyOf)}if(r.type!=="root"&&r.type!=="document"&&!r.parent)return!0;if(fn(o))throw this.getAsyncError()}}visitTick(t){let r=t[t.length-1],{node:n,visitors:i}=r;if(n.type!=="root"&&n.type!=="document"&&!n.parent){t.pop();return}if(i.length>0&&r.visitorIndex<i.length){let[s,a]=i[r.visitorIndex];r.visitorIndex+=1,r.visitorIndex===i.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(rh(a));return}r.iterator=0,delete n.indexes[s]}let o=r.events;for(;r.eventIndex<o.length;){let s=o[r.eventIndex];if(r.eventIndex+=1,s===Ir){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=Dm(t);for(let n of r)if(n===Ir)t.nodes&&t.each(i=>{i[tt]||this.walkSync(i)});else{let i=this.listeners[n];if(i&&this.visitSync(i,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"}};Tr.registerPostcss=e=>{Ml=e};var _m=Tr;Tr.default=Tr;WP.registerLazyResult(Tr);jP.registerLazyResult(Tr);var qP=ym,KP=Qo,HP=Pm,YP=cc,XP=sc,Ol=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 i,o=KP;this.result=new XP(this._processor,i,this._opts),this.result.css=r;let s=this;Object.defineProperty(this.result,"root",{get(){return s.root}});let a=new qP(o,i,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||HP("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=YP;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"}},ZP=Ol;Ol.default=Ol;var JP=ZP,QP=_m,eM=oc,tM=In,kn=class{constructor(t=[]){this.version="8.4.38",this.plugins=this.normalize(t)}normalize(t){let r=[];for(let n of t)if(n.postcss===!0?n=n():n.postcss&&(n=n.postcss),typeof n=="object"&&Array.isArray(n.plugins))r=r.concat(n.plugins);else if(typeof n=="object"&&n.postcssPlugin)r.push(n);else if(typeof n=="function")r.push(n);else if(typeof n=="object"&&(n.parse||n.stringify)){if(process.env.NODE_ENV!=="production")throw new Error("PostCSS syntaxes cannot be used as plugins. Instead, please use one of the syntax/parser/stringifier options as outlined in your PostCSS runner documentation.")}else throw new Error(n+" is not a PostCSS plugin");return r}process(t,r={}){return!this.plugins.length&&!r.parser&&!r.stringifier&&!r.syntax?new JP(this,t,r):new QP(this,t,r)}use(t){return this.plugins=this.plugins.concat(this.normalize([t])),this}},rM=kn;kn.default=kn;tM.registerProcessor(kn);eM.registerProcessor(kn);var nM=ts,iM=dm,oM=ns,sM=ac,aM=rs,lM=In,cM=lc;function Cn(e,t){if(Array.isArray(e))return e.map(i=>Cn(i));let{inputs:r,...n}=e;if(r){t=[];for(let i of r){let o={...i,__proto__:aM.prototype};o.map&&(o.map={...o.map,__proto__:iM.prototype}),t.push(o)}}if(n.nodes&&(n.nodes=e.nodes.map(i=>Cn(i,t))),n.source){let{inputId:i,...o}=n.source;n.source=o,i!=null&&(n.source.input=t[i])}if(n.type==="root")return new lM(n);if(n.type==="decl")return new nM(n);if(n.type==="rule")return new cM(n);if(n.type==="comment")return new oM(n);if(n.type==="atrule")return new sM(n);throw new Error("Unknown node type: "+e.type)}var uM=Cn;Cn.default=Cn;var dM=rc,jm=ts,pM=_m,fM=Yt,uc=rM,hM=Qo,mM=uM,Bm=oc,yM=Mm,Vm=ns,Wm=ac,gM=sc,SM=rs,bM=cc,wM=$m,Um=lc,zm=In,RM=es;function _(...e){return e.length===1&&Array.isArray(e[0])&&(e=e[0]),new uc(e)}_.plugin=function(t,r){let n=!1;function i(...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 uc().version,a}let o;return Object.defineProperty(i,"postcss",{get(){return o||(o=i()),o}}),i.process=function(s,a,l){return _([i(l)]).process(s,a)},i};_.stringify=hM;_.parse=bM;_.fromJSON=mM;_.list=wM;_.comment=e=>new Vm(e);_.atRule=e=>new Wm(e);_.decl=e=>new jm(e);_.rule=e=>new Um(e);_.root=e=>new zm(e);_.document=e=>new Bm(e);_.CssSyntaxError=dM;_.Declaration=jm;_.Container=fM;_.Processor=uc;_.Document=Bm;_.Comment=Vm;_.Warning=yM;_.AtRule=Wm;_.Result=gM;_.Input=SM;_.Rule=Um;_.Root=zm;_.Node=RM;pM.registerPostcss(_);var vM=_;_.default=_;var Y=TA(vM);Y.stringify;Y.fromJSON;Y.plugin;Y.parse;Y.list;Y.document;Y.comment;Y.atRule;Y.rule;Y.decl;Y.root;Y.CssSyntaxError;Y.Declaration;Y.Container;Y.Processor;Y.Document;Y.Comment;Y.Warning;Y.AtRule;Y.Result;Y.Input;Y.Rule;Y.Root;Y.Node;var Il=class e{constructor(...t){Te(this,"parentElement",null),Te(this,"parentNode",null),Te(this,"ownerDocument"),Te(this,"firstChild",null),Te(this,"lastChild",null),Te(this,"previousSibling",null),Te(this,"nextSibling",null),Te(this,"ELEMENT_NODE",1),Te(this,"TEXT_NODE",3),Te(this,"nodeType"),Te(this,"nodeName"),Te(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 nh={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},ih={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},vo={},xM=()=>!!globalThis.Zone;function dc(e){if(vo[e])return vo[e];let t=globalThis[e],r=t.prototype,n=e in nh?nh[e]:void 0,i=!!(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]"))})),o=e in ih?ih[e]:void 0,s=!!(o&&o.every(a=>{var l;return typeof r[a]=="function"&&((l=r[a])==null?void 0:l.toString().includes("[native code]"))}));if(i&&s&&!xM())return vo[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?vo[e]=c:r}catch{return r}}var Xa={};function bt(e,t,r){var n;let i=`${e}.${String(r)}`;if(Xa[i])return Xa[i].call(t);let o=dc(e),s=(n=Object.getOwnPropertyDescriptor(o,r))==null?void 0:n.get;return s?(Xa[i]=s,s.call(t)):t[r]}var Za={};function Gm(e,t,r){let n=`${e}.${String(r)}`;if(Za[n])return Za[n].bind(t);let o=dc(e)[r];return typeof o!="function"?t[r]:(Za[n]=o,o.bind(t))}function EM(e){return bt("Node",e,"ownerDocument")}function kM(e){return bt("Node",e,"childNodes")}function CM(e){return bt("Node",e,"parentNode")}function AM(e){return bt("Node",e,"parentElement")}function PM(e){return bt("Node",e,"textContent")}function MM(e,t){return Gm("Node",e,"contains")(t)}function OM(e){return Gm("Node",e,"getRootNode")()}function IM(e){return!e||!("host"in e)?null:bt("ShadowRoot",e,"host")}function TM(e){return e.styleSheets}function NM(e){return!e||!("shadowRoot"in e)?null:bt("Element",e,"shadowRoot")}function $M(e,t){return bt("Element",e,"querySelector")(t)}function LM(e,t){return bt("Element",e,"querySelectorAll")(t)}function qm(){return dc("MutationObserver").constructor}function Xt(e,t,r){try{if(!(t in e))return()=>{};let n=e[t],i=r(n);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=i,()=>{e[t]=n}}catch{return()=>{}}}var k={ownerDocument:EM,childNodes:kM,parentNode:CM,parentElement:AM,textContent:PM,contains:MM,getRootNode:OM,host:IM,styleSheets:TM,shadowRoot:NM,querySelector:$M,querySelectorAll:LM,mutationObserver:qm,patch:Xt};function Se(e,t,r=document){let n={capture:!0,passive:!0};return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}var vr=`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.`,oh={map:{},getId(){return console.error(vr),-1},getNode(){return console.error(vr),null},removeNodeFromMap(){console.error(vr)},has(){return console.error(vr),!1},reset(){console.error(vr)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(oh=new Proxy(oh,{get(e,t,r){return t==="map"&&console.error(vr),Reflect.get(e,t,r)}}));function An(e,t,r={}){let n=null,i=0;return function(...o){let s=Date.now();!i&&r.leading===!1&&(i=s);let a=t-(s-i),l=this;a<=0||a>t?(n&&(clearTimeout(n),n=null),i=s,e.apply(l,o)):!n&&r.trailing!==!1&&(n=setTimeout(()=>{i=r.leading===!1?0:Date.now(),n=null,e.apply(l,o)},a))}}function is(e,t,r,n,i=window){let o=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,n?r:{set(s){setTimeout(()=>{r.set.call(this,s)},0),o&&o.set&&o.set.call(this,s)}}),()=>is(e,t,o||{},!0)}var zo=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(zo=()=>new Date().getTime());function Km(e){var t,r,n,i;let o=e.document;return{left:o.scrollingElement?o.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:o.documentElement.scrollLeft||o?.body&&((t=k.parentElement(o.body))==null?void 0:t.scrollLeft)||((r=o?.body)==null?void 0:r.scrollLeft)||0,top:o.scrollingElement?o.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:o?.documentElement.scrollTop||o?.body&&((n=k.parentElement(o.body))==null?void 0:n.scrollTop)||((i=o?.body)==null?void 0:i.scrollTop)||0}}function Hm(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Ym(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Xm(e){return e?e.nodeType===e.ELEMENT_NODE?e:k.parentElement(e):null}function be(e,t,r,n){if(!e)return!1;let i=Xm(e);if(!i)return!1;try{if(typeof t=="string"){if(i.classList.contains(t)||n&&i.closest("."+t)!==null)return!0}else if(Lo(i,t,n))return!0}catch{}return!!(r&&(i.matches(r)||n&&i.closest(r)!==null))}function DM(e,t){return t.getId(e)!==-1}function Ja(e,t,r){return e.tagName==="TITLE"&&r.headTitleMutations?!0:t.getId(e)===Sn}function Zm(e,t){if(mn(e))return!1;let r=t.getId(e);if(!t.has(r))return!0;let n=k.parentNode(e);return n&&n.nodeType===e.DOCUMENT_NODE?!1:n?Zm(n,t):!0}function Tl(e){return!!e.changedTouches}function FM(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 Jm(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function Qm(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function Nl(e){return e?e instanceof Il&&"shadowRoot"in e?!!e.shadowRoot:!!k.shadowRoot(e):!1}var $l=class{constructor(){b(this,"id",1),b(this,"styleIDMap",new WeakMap),b(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 ey(e){var t;let r=null;return"getRootNode"in e&&((t=k.getRootNode(e))==null?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&k.host(k.getRootNode(e))&&(r=k.host(k.getRootNode(e))),r}function _M(e){let t=e,r;for(;r=ey(t);)t=r;return t}function jM(e){let t=k.ownerDocument(e);if(!t)return!1;let r=_M(e);return k.contains(t,r)}function ty(e){let t=k.ownerDocument(e);return t?k.contains(t,e)||jM(e):!1}var P=(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))(P||{}),C=(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))(C||{}),ve=(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))(ve||{}),mt=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(mt||{}),Nr=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(Nr||{}),xr=(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))(xr||{});var ry=(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))(ry||{});function sh(e){return"__ln"in e}var Ll=class{constructor(){b(this,"length",0),b(this,"head",null),b(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&&sh(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&&sh(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--)}},ah=(e,t)=>`${e}@${t}`,Dl=class{constructor(){b(this,"frozen",!1),b(this,"locked",!1),b(this,"texts",[]),b(this,"attributes",[]),b(this,"attributeMap",new WeakMap),b(this,"removes",[]),b(this,"mapRemoves",[]),b(this,"movedMap",{}),b(this,"addedSet",new Set),b(this,"movedSet",new Set),b(this,"droppedSet",new Set),b(this,"removesSubTreeCache",new Set),b(this,"mutationCb"),b(this,"blockClass"),b(this,"blockSelector"),b(this,"maskTextClass"),b(this,"maskTextSelector"),b(this,"inlineStylesheet"),b(this,"maskInputOptions"),b(this,"maskTextFn"),b(this,"maskInputFn"),b(this,"keepIframeSrcFn"),b(this,"recordCanvas"),b(this,"inlineImages"),b(this,"slimDOMOptions"),b(this,"dataURLOptions"),b(this,"doc"),b(this,"mirror"),b(this,"iframeManager"),b(this,"stylesheetManager"),b(this,"shadowDomManager"),b(this,"canvasManager"),b(this,"processedNodeManager"),b(this,"unattachedDoc"),b(this,"processMutations",t=>{t.forEach(this.processMutation),this.emit()}),b(this,"emit",()=>{if(this.frozen||this.locked)return;let t=[],r=new Set,n=new Ll,i=l=>{let c=l,u=Sn;for(;u===Sn;)c=c&&c.nextSibling,u=c&&this.mirror.getId(c);return u},o=l=>{let c=k.parentNode(l);if(!c||!ty(l))return;let u=!1;if(l.nodeType===Node.TEXT_NODE){let y=c.tagName;if(y==="TEXTAREA")return;y==="STYLE"&&this.addedSet.has(c)&&(u=!0)}let d=mn(c)?this.mirror.getId(ey(l)):this.mirror.getId(c),p=i(l);if(d===-1||p===-1)return n.addNode(l);let m=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:y=>{Jm(y,this.mirror)&&this.iframeManager.addIframe(y),Qm(y,this.mirror)&&this.stylesheetManager.trackLinkElement(y),Nl(l)&&this.shadowDomManager.addShadowRoot(k.shadowRoot(l),this.doc)},onIframeLoad:(y,f)=>{this.iframeManager.attachIframe(y,f),this.shadowDomManager.observeAttachShadow(y)},onStylesheetLoad:(y,f)=>{this.stylesheetManager.attachLinkElement(y,f)},cssCaptured:u});m&&(t.push({parentId:d,nextId:p,node:m}),r.add(m.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let l of this.movedSet)lh(this.removesSubTreeCache,l,this.mirror)&&!this.movedSet.has(k.parentNode(l))||o(l);for(let l of this.addedSet)!ch(this.droppedSet,l)&&!lh(this.removesSubTreeCache,l,this.mirror)||ch(this.movedSet,l)?o(l):this.droppedSet.add(l);let s=null;for(;n.length;){let l=null;if(s){let c=this.mirror.getId(k.parentNode(s.value)),u=i(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(k.parentNode(u.value));if(i(u.value)===-1)continue;if(d!==-1){l=u;break}else{let m=u.value,y=k.parentNode(m);if(y&&y.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let f=k.host(y);if(this.mirror.getId(f)!==-1){l=u;break}}}}}}if(!l){for(;n.head;)n.removeNode(n.head.value);break}s=l.previous,n.removeNode(l.value),o(l.value)}let a={texts:this.texts.map(l=>{let c=l.node,u=k.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))}),b(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(k.childNodes(t),i=>k.textContent(i)||"").join("");r.attributes.value=To({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:No(t),value:n,maskInputFn:this.maskInputFn})}),b(this,"processMutation",t=>{if(!Ja(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{let r=k.textContent(t.target);!be(t.target,this.blockClass,this.blockSelector,!1)&&r!==t.oldValue&&this.texts.push({value:xh(t.target,this.maskTextClass,this.maskTextSelector,!0)&&r?this.maskTextFn?this.maskTextFn(r,Xm(t.target)):r.replace(/[\S]/g,"*"):r,node:t.target});break}case"attributes":{let r=t.target,n=t.attributeName,i=t.target.getAttribute(n);if(n==="value"){let s=No(r);i=To({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:s,value:i,maskInputFn:this.maskInputFn})}if(be(t.target,this.blockClass,this.blockSelector,!1)||i===t.oldValue)return;let o=this.attributeMap.get(t.target);if(r.tagName==="IFRAME"&&n==="src"&&!this.keepIframeSrcFn(i))if(!r.contentDocument)n="rr_src";else return;if(o||(o={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(o),this.attributeMap.set(t.target,o)),n==="type"&&r.tagName==="INPUT"&&(t.oldValue||"").toLowerCase()==="password"&&r.setAttribute("data-rr-is-password","true"),!vh(r.tagName,n))if(o.attributes[n]=Rh(this.doc,Kt(r.tagName),Kt(n),i),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===""?o.styleDiff[a]=l:o.styleDiff[a]=[l,c]:o._unchangedStyles[a]=[l,c]}for(let a of Array.from(s.style))r.style.getPropertyValue(a)===""&&(o.styleDiff[a]=!1)}else n==="open"&&r.tagName==="DIALOG"&&(r.matches("dialog:modal")?o.attributes.rr_open_mode="modal":o.attributes.rr_open_mode="non-modal");break}case"childList":{if(be(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),i=mn(t.target)?this.mirror.getId(k.host(t.target)):this.mirror.getId(t.target);be(t.target,this.blockClass,this.blockSelector,!1)||Ja(r,this.mirror,this.slimDOMOptions)||!DM(r,this.mirror)||(this.addedSet.has(r)?(Fl(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(t.target)&&n===-1||Zm(t.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[ah(n,i)]?Fl(this.movedSet,r):(this.removes.push({parentId:i,id:n,isShadow:mn(t.target)&&yn(t.target)?!0:void 0}),BM(r,this.removesSubTreeCache))),this.mapRemoves.push(r))});break}}}),b(this,"genAdds",(t,r)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!(this.addedSet.has(t)||this.movedSet.has(t))){if(this.mirror.hasNode(t)){if(Ja(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[ah(this.mirror.getId(t),n)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);be(t,this.blockClass,this.blockSelector,!1)||(k.childNodes(t).forEach(n=>this.genAdds(n)),Nl(t)&&k.childNodes(k.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 Fl(e,t){e.delete(t),k.childNodes(t).forEach(r=>Fl(e,r))}function BM(e,t){let r=[e];for(;r.length;){let n=r.pop();t.has(n)||(t.add(n),k.childNodes(n).forEach(i=>r.push(i)))}}function lh(e,t,r){return e.size===0?!1:VM(e,t)}function VM(e,t,r){let n=k.parentNode(t);return n?e.has(n):!1}function ch(e,t){return e.size===0?!1:ny(e,t)}function ny(e,t){let r=k.parentNode(t);return r?e.has(r)?!0:ny(e,r):!1}var gn;function WM(e){gn=e}function UM(){gn=void 0}var O=e=>gn?(...r)=>{try{return e(...r)}catch(n){if(gn&&gn(n)===!0)return;throw n}}:e,qt=[];function Tn(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 iy(e,t){let r=new Dl;qt.push(r),r.init(e);let n=new(qm())(O(r.processMutations.bind(r)));return n.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),n}function zM({mousemoveCb:e,sampling:t,doc:r,mirror:n}){if(t.mousemove===!1)return()=>{};let i=typeof t.mousemove=="number"?t.mousemove:50,o=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500,s=[],a,l=An(O(d=>{let p=Date.now()-a;e(s.map(m=>(m.timeOffset-=p,m)),d),s=[],a=null}),o),c=O(An(O(d=>{let p=Tn(d),{clientX:m,clientY:y}=Tl(d)?d.changedTouches[0]:d;a||(a=zo()),s.push({x:m,y,id:n.getId(p),timeOffset:zo()-a}),l(typeof DragEvent<"u"&&d instanceof DragEvent?C.Drag:d instanceof MouseEvent?C.MouseMove:C.TouchMove)}),i,{trailing:!1})),u=[Se("mousemove",c,r),Se("touchmove",c,r),Se("drag",c,r)];return O(()=>{u.forEach(d=>d())})}function GM({mouseInteractionCb:e,doc:t,mirror:r,blockClass:n,blockSelector:i,sampling:o}){if(o.mouseInteraction===!1)return()=>{};let s=o.mouseInteraction===!0||o.mouseInteraction===void 0?{}:o.mouseInteraction,a=[],l=null,c=u=>d=>{let p=Tn(d);if(be(p,n,i,!0))return;let m=null,y=u;if("pointerType"in d){switch(d.pointerType){case"mouse":m=mt.Mouse;break;case"touch":m=mt.Touch;break;case"pen":m=mt.Pen;break}m===mt.Touch?ve[u]===ve.MouseDown?y="TouchStart":ve[u]===ve.MouseUp&&(y="TouchEnd"):mt.Pen}else Tl(d)&&(m=mt.Touch);m!==null?(l=m,(y.startsWith("Touch")&&m===mt.Touch||y.startsWith("Mouse")&&m===mt.Mouse)&&(m=null)):ve[u]===ve.Click&&(m=l,l=null);let f=Tl(d)?d.changedTouches[0]:d;if(!f)return;let h=r.getId(p),{clientX:w,clientY:x}=f;O(e)({type:ve[y],id:h,x:w,y:x,...m!==null&&{pointerType:m}})};return Object.keys(ve).filter(u=>Number.isNaN(Number(u))&&!u.endsWith("_Departed")&&s[u]!==!1).forEach(u=>{let d=Kt(u),p=c(u);if(window.PointerEvent)switch(ve[u]){case ve.MouseDown:case ve.MouseUp:d=d.replace("mouse","pointer");break;case ve.TouchStart:case ve.TouchEnd:return}a.push(Se(d,p,t))}),O(()=>{a.forEach(u=>u())})}function oy({scrollCb:e,doc:t,mirror:r,blockClass:n,blockSelector:i,sampling:o}){let s=O(An(O(a=>{let l=Tn(a);if(!l||be(l,n,i,!0))return;let c=r.getId(l);if(l===t&&t.defaultView){let u=Km(t.defaultView);e({id:c,x:u.left,y:u.top})}else e({id:c,x:l.scrollLeft,y:l.scrollTop})}),o.scroll||100));return Se("scroll",s,t)}function qM({viewportResizeCb:e},{win:t}){let r=-1,n=-1,i=O(An(O(()=>{let o=Hm(),s=Ym();(r!==o||n!==s)&&(e({width:Number(s),height:Number(o)}),r=o,n=s)}),200));return Se("resize",i,t)}var KM=["INPUT","TEXTAREA","SELECT"],uh=new WeakMap;function HM({inputCb:e,doc:t,mirror:r,blockClass:n,blockSelector:i,ignoreClass:o,ignoreSelector:s,maskInputOptions:a,maskInputFn:l,sampling:c,userTriggeredOnInput:u}){function d(x){let g=Tn(x),E=x.isTrusted,T=g&&g.tagName;if(g&&T==="OPTION"&&(g=k.parentElement(g)),!g||!T||KM.indexOf(T)<0||be(g,n,i,!0)||g.classList.contains(o)||s&&g.matches(s))return;let j=g.value,te=!1,W=No(g)||"";W==="radio"||W==="checkbox"?te=g.checked:(a[T.toLowerCase()]||a[W])&&(j=To({element:g,maskInputOptions:a,tagName:T,type:W,value:j,maskInputFn:l})),p(g,u?{text:j,isChecked:te,userTriggered:E}:{text:j,isChecked:te});let G=g.name;W==="radio"&&G&&te&&t.querySelectorAll(`input[type="radio"][name="${G}"]`).forEach(re=>{if(re!==g){let fe=re.value;p(re,u?{text:fe,isChecked:!te,userTriggered:!1}:{text:fe,isChecked:!te})}})}function p(x,g){let E=uh.get(x);if(!E||E.text!==g.text||E.isChecked!==g.isChecked){uh.set(x,g);let T=r.getId(x);O(e)({...g,id:T})}}let y=(c.input==="last"?["change"]:["input","change"]).map(x=>Se(x,O(d),t)),f=t.defaultView;if(!f)return()=>{y.forEach(x=>x())};let h=f.Object.getOwnPropertyDescriptor(f.HTMLInputElement.prototype,"value"),w=[[f.HTMLInputElement.prototype,"value"],[f.HTMLInputElement.prototype,"checked"],[f.HTMLSelectElement.prototype,"value"],[f.HTMLTextAreaElement.prototype,"value"],[f.HTMLSelectElement.prototype,"selectedIndex"],[f.HTMLOptionElement.prototype,"selected"]];return h&&h.set&&y.push(...w.map(x=>is(x[0],x[1],{set(){O(d)({target:this,isTrusted:!1})}},!1,f))),O(()=>{y.forEach(x=>x())})}function Go(e){let t=[];function r(n,i){if(xo("CSSGroupingRule")&&n.parentRule instanceof CSSGroupingRule||xo("CSSMediaRule")&&n.parentRule instanceof CSSMediaRule||xo("CSSSupportsRule")&&n.parentRule instanceof CSSSupportsRule||xo("CSSConditionRule")&&n.parentRule instanceof CSSConditionRule){let s=Array.from(n.parentRule.cssRules).indexOf(n);i.unshift(s)}else if(n.parentStyleSheet){let s=Array.from(n.parentStyleSheet.cssRules).indexOf(n);i.unshift(s)}return i}return r(e,t)}function It(e,t,r){let n,i;return e?(e.ownerNode?n=t.getId(e.ownerNode):i=r.getId(e),{styleId:i,id:n}):{}}function YM({styleSheetRuleCb:e,mirror:t,stylesheetManager:r},{win:n}){if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return()=>{};let i=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:O((u,d,p)=>{let[m,y]=p,{id:f,styleId:h}=It(d,t,r.styleMirror);return(f&&f!==-1||h&&h!==-1)&&e({id:f,styleId:h,adds:[{rule:m,index:y}]}),u.apply(d,p)})}),n.CSSStyleSheet.prototype.addRule=function(u,d,p=this.cssRules.length){let m=`${u} { ${d} }`;return n.CSSStyleSheet.prototype.insertRule.apply(this,[m,p])};let o=n.CSSStyleSheet.prototype.deleteRule;n.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:O((u,d,p)=>{let[m]=p,{id:y,styleId:f}=It(d,t,r.styleMirror);return(y&&y!==-1||f&&f!==-1)&&e({id:y,styleId:f,removes:[{index:m}]}),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:O((u,d,p)=>{let[m]=p,{id:y,styleId:f}=It(d,t,r.styleMirror);return(y&&y!==-1||f&&f!==-1)&&e({id:y,styleId:f,replace:m}),u.apply(d,p)})}));let a;n.CSSStyleSheet.prototype.replaceSync&&(a=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:O((u,d,p)=>{let[m]=p,{id:y,styleId:f}=It(d,t,r.styleMirror);return(y&&y!==-1||f&&f!==-1)&&e({id:y,styleId:f,replaceSync:m}),u.apply(d,p)})}));let l={};Eo("CSSGroupingRule")?l.CSSGroupingRule=n.CSSGroupingRule:(Eo("CSSMediaRule")&&(l.CSSMediaRule=n.CSSMediaRule),Eo("CSSConditionRule")&&(l.CSSConditionRule=n.CSSConditionRule),Eo("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:O((p,m,y)=>{let[f,h]=y,{id:w,styleId:x}=It(m.parentStyleSheet,t,r.styleMirror);return(w&&w!==-1||x&&x!==-1)&&e({id:w,styleId:x,adds:[{rule:f,index:[...Go(m),h||0]}]}),p.apply(m,y)})}),d.prototype.deleteRule=new Proxy(c[u].deleteRule,{apply:O((p,m,y)=>{let[f]=y,{id:h,styleId:w}=It(m.parentStyleSheet,t,r.styleMirror);return(h&&h!==-1||w&&w!==-1)&&e({id:h,styleId:w,removes:[{index:[...Go(m),f]}]}),p.apply(m,y)})})}),O(()=>{n.CSSStyleSheet.prototype.insertRule=i,n.CSSStyleSheet.prototype.deleteRule=o,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 sy({mirror:e,stylesheetManager:t},r){var n,i,o;let s=null;r.nodeName==="#document"?s=e.getId(r):s=e.getId(k.host(r));let a=r.nodeName==="#document"?(n=r.defaultView)==null?void 0:n.Document:(o=(i=r.ownerDocument)==null?void 0:i.defaultView)==null?void 0:o.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}}),O(()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})}))}function XM({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:r,stylesheetManager:n},{win:i}){let o=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:O((a,l,c)=>{var u;let[d,p,m]=c;if(r.has(d))return o.apply(l,[d,p,m]);let{id:y,styleId:f}=It((u=l.parentRule)==null?void 0:u.parentStyleSheet,t,n.styleMirror);return(y&&y!==-1||f&&f!==-1)&&e({id:y,styleId:f,set:{property:d,value:p,priority:m},index:Go(l.parentRule)}),a.apply(l,c)})});let s=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(s,{apply:O((a,l,c)=>{var u;let[d]=c;if(r.has(d))return s.apply(l,[d]);let{id:p,styleId:m}=It((u=l.parentRule)==null?void 0:u.parentStyleSheet,t,n.styleMirror);return(p&&p!==-1||m&&m!==-1)&&e({id:p,styleId:m,remove:{property:d},index:Go(l.parentRule)}),a.apply(l,c)})}),O(()=>{i.CSSStyleDeclaration.prototype.setProperty=o,i.CSSStyleDeclaration.prototype.removeProperty=s})}function ZM({mediaInteractionCb:e,blockClass:t,blockSelector:r,mirror:n,sampling:i,doc:o}){let s=O(l=>An(O(c=>{let u=Tn(c);if(!u||be(u,t,r,!0))return;let{currentTime:d,volume:p,muted:m,playbackRate:y,loop:f}=u;e({type:l,id:n.getId(u),currentTime:d,volume:p,muted:m,playbackRate:y,loop:f})}),i.media||500)),a=[Se("play",s(xr.Play),o),Se("pause",s(xr.Pause),o),Se("seeked",s(xr.Seeked),o),Se("volumechange",s(xr.VolumeChange),o),Se("ratechange",s(xr.RateChange),o)];return O(()=>{a.forEach(l=>l())})}function JM({fontCb:e,doc:t}){let r=t.defaultView;if(!r)return()=>{};let n=[],i=new WeakMap,o=r.FontFace;r.FontFace=function(l,c,u){let d=new o(l,c,u);return i.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=Xt(t.fonts,"add",function(a){return function(l){return setTimeout(O(()=>{let c=i.get(l);c&&(e(c),i.delete(l))}),0),a.apply(this,[l])}});return n.push(()=>{r.FontFace=o}),n.push(s),O(()=>{n.forEach(a=>a())})}function QM(e){let{doc:t,mirror:r,blockClass:n,blockSelector:i,selectionCb:o}=e,s=!0,a=O(()=>{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:m,startOffset:y,endContainer:f,endOffset:h}=p;be(m,n,i,!0)||be(f,n,i,!0)||c.push({start:r.getId(m),startOffset:y,end:r.getId(f),endOffset:h})}o({ranges:c})});return a(),Se("selectionchange",a)}function eO({doc:e,customElementCb:t}){let r=e.defaultView;return!r||!r.customElements?()=>{}:Xt(r.customElements,"define",function(i){return function(o,s,a){try{t({define:{name:o}})}catch{console.warn(`Custom element callback failed for ${o}`)}return i.apply(this,[o,s,a])}})}function tO(e,t){let{mutationCb:r,mousemoveCb:n,mouseInteractionCb:i,scrollCb:o,viewportResizeCb:s,inputCb:a,mediaInteractionCb:l,styleSheetRuleCb:c,styleDeclarationCb:u,canvasMutationCb:d,fontCb:p,selectionCb:m,customElementCb:y}=e;e.mutationCb=(...f)=>{t.mutation&&t.mutation(...f),r(...f)},e.mousemoveCb=(...f)=>{t.mousemove&&t.mousemove(...f),n(...f)},e.mouseInteractionCb=(...f)=>{t.mouseInteraction&&t.mouseInteraction(...f),i(...f)},e.scrollCb=(...f)=>{t.scroll&&t.scroll(...f),o(...f)},e.viewportResizeCb=(...f)=>{t.viewportResize&&t.viewportResize(...f),s(...f)},e.inputCb=(...f)=>{t.input&&t.input(...f),a(...f)},e.mediaInteractionCb=(...f)=>{t.mediaInteaction&&t.mediaInteaction(...f),l(...f)},e.styleSheetRuleCb=(...f)=>{t.styleSheetRule&&t.styleSheetRule(...f),c(...f)},e.styleDeclarationCb=(...f)=>{t.styleDeclaration&&t.styleDeclaration(...f),u(...f)},e.canvasMutationCb=(...f)=>{t.canvasMutation&&t.canvasMutation(...f),d(...f)},e.fontCb=(...f)=>{t.font&&t.font(...f),p(...f)},e.selectionCb=(...f)=>{t.selection&&t.selection(...f),m(...f)},e.customElementCb=(...f)=>{t.customElement&&t.customElement(...f),y(...f)}}function rO(e,t={}){let r=e.doc.defaultView;if(!r)return()=>{};tO(e,t);let n;e.recordDOM&&(n=iy(e,e.doc));let i=zM(e),o=GM(e),s=oy(e),a=qM(e,{win:r}),l=HM(e),c=ZM(e),u=()=>{},d=()=>{},p=()=>{},m=()=>{};e.recordDOM&&(u=YM(e,{win:r}),d=sy(e,e.doc),p=XM(e,{win:r}),e.collectFonts&&(m=JM(e)));let y=QM(e),f=eO(e),h=[];for(let w of e.plugins)h.push(w.observer(w.callback,r,w.options));return O(()=>{qt.forEach(w=>w.reset()),n?.disconnect(),i(),o(),s(),a(),l(),c(),u(),d(),p(),m(),y(),f(),h.forEach(w=>w())})}function xo(e){return typeof window[e]<"u"}function Eo(e){return!!(typeof window[e]<"u"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}var qo=class{constructor(t){b(this,"iframeIdToRemoteIdMap",new WeakMap),b(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=t}getId(t,r,n,i){let o=n||this.getIdToRemoteIdMap(t),s=i||this.getRemoteIdToIdMap(t),a=o.get(r);return a||(a=this.generateIdFn(),o.set(r,a),s.set(a,r)),a}getIds(t,r){let n=this.getIdToRemoteIdMap(t),i=this.getRemoteIdToIdMap(t);return r.map(o=>this.getId(t,o,n,i))}getRemoteId(t,r,n){let i=n||this.getRemoteIdToIdMap(t);if(typeof r!="number")return r;let o=i.get(r);return o||-1}getRemoteIds(t,r){let n=this.getRemoteIdToIdMap(t);return r.map(i=>this.getRemoteId(t,i,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}},_l=class{constructor(t){b(this,"iframes",new WeakMap),b(this,"crossOriginIframeMap",new WeakMap),b(this,"crossOriginIframeMirror",new qo(wh)),b(this,"crossOriginIframeStyleMirror"),b(this,"crossOriginIframeRootIdMap",new WeakMap),b(this,"mirror"),b(this,"mutationCb"),b(this,"wrappedEmit"),b(this,"loadListener"),b(this,"stylesheetManager"),b(this,"recordCrossOriginIframes"),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new qo(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,i;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))),(i=this.loadListener)==null||i.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 i=this.crossOriginIframeMap.get(t.source);if(!i)return;let o=this.transformCrossOriginEvent(i,r.data.event);o&&this.wrappedEmit(o,r.data.isCheckout)}transformCrossOriginEvent(t,r){var n;switch(r.type){case P.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(r.data.node,t);let i=r.data.node.id;return this.crossOriginIframeRootIdMap.set(t,i),this.patchRootIdOnNode(r.data.node,i),{timestamp:r.timestamp,type:P.IncrementalSnapshot,data:{source:C.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:r.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case P.Meta:case P.Load:case P.DomContentLoaded:return!1;case P.Plugin:return r;case P.Custom:return this.replaceIds(r.data.payload,t,["id","parentId","previousId","nextId"]),r;case P.IncrementalSnapshot:switch(r.data.source){case C.Mutation:return r.data.adds.forEach(i=>{this.replaceIds(i,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(i.node,t);let o=this.crossOriginIframeRootIdMap.get(t);o&&this.patchRootIdOnNode(i.node,o)}),r.data.removes.forEach(i=>{this.replaceIds(i,t,["parentId","id"])}),r.data.attributes.forEach(i=>{this.replaceIds(i,t,["id"])}),r.data.texts.forEach(i=>{this.replaceIds(i,t,["id"])}),r;case C.Drag:case C.TouchMove:case C.MouseMove:return r.data.positions.forEach(i=>{this.replaceIds(i,t,["id"])}),r;case C.ViewportResize:return!1;case C.MediaInteraction:case C.MouseInteraction:case C.Scroll:case C.CanvasMutation:case C.Input:return this.replaceIds(r.data,t,["id"]),r;case C.StyleSheetRule:case C.StyleDeclaration:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleId"]),r;case C.Font:return r;case C.Selection:return r.data.ranges.forEach(i=>{this.replaceIds(i,t,["start","end"])}),r;case C.AdoptedStyleSheet:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleIds"]),(n=r.data.styles)==null||n.forEach(i=>{this.replaceStyleIds(i,t,["styleId"])}),r}}return!1}replace(t,r,n,i){for(let o of i)!Array.isArray(r[o])&&typeof r[o]!="number"||(Array.isArray(r[o])?r[o]=t.getIds(n,r[o]):r[o]=t.getId(n,r[o]));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!==ry.Document&&!t.rootId&&(t.rootId=r),"childNodes"in t&&t.childNodes.forEach(n=>{this.patchRootIdOnNode(n,r)})}},jl=class{constructor(t){b(this,"shadowDoms",new WeakSet),b(this,"mutationCb"),b(this,"scrollCb"),b(this,"bypassOptions"),b(this,"mirror"),b(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(!yn(t)||this.shadowDoms.has(t))return;this.shadowDoms.add(t);let n=iy({...this.bypassOptions,doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},t);this.restoreHandlers.push(()=>n.disconnect()),this.restoreHandlers.push(oy({...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(k.host(t))),this.restoreHandlers.push(sy({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(Xt(t.prototype,"attachShadow",function(i){return function(o){let s=i.call(this,o),a=k.shadowRoot(this);return a&&ty(this)&&n.addShadowRoot(a,r),s}}))}reset(){this.restoreHandlers.forEach(t=>{try{t()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}},Cr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",nO=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(hn=0;hn<Cr.length;hn++)nO[Cr.charCodeAt(hn)]=hn;var hn,iO=function(e){var t=new Uint8Array(e),r,n=t.length,i="";for(r=0;r<n;r+=3)i+=Cr[t[r]>>2],i+=Cr[(t[r]&3)<<4|t[r+1]>>4],i+=Cr[(t[r+1]&15)<<2|t[r+2]>>6],i+=Cr[t[r+2]&63];return n%3===2?i=i.substring(0,i.length-1)+"=":n%3===1&&(i=i.substring(0,i.length-2)+"=="),i};var dh=new Map;function oO(e,t){let r=dh.get(e);return r||(r=new Map,dh.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}var ay=(e,t,r)=>{if(!e||!(cy(e,t)||typeof e=="object"))return;let n=e.constructor.name,i=oO(r,n),o=i.indexOf(e);return o===-1&&(o=i.length,i.push(e)),o};function Mo(e,t,r){if(e instanceof Array)return e.map(n=>Mo(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,i=iO(e);return{rr_type:n,base64:i}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[Mo(e.buffer,t,r),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){let n=e.constructor.name,{src:i}=e;return{rr_type:n,src:i}}else if(e instanceof HTMLCanvasElement){let n="HTMLImageElement",i=e.toDataURL();return{rr_type:n,src:i}}else{if(e instanceof ImageData)return{rr_type:e.constructor.name,args:[Mo(e.data,t,r),e.width,e.height]};if(cy(e,t)||typeof e=="object"){let n=e.constructor.name,i=ay(e,t,r);return{rr_type:n,index:i}}}}return e}var ly=(e,t,r)=>e.map(n=>Mo(n,t,r)),cy=(e,t)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(i=>typeof t[i]=="function").find(i=>e instanceof t[i]);function sO(e,t,r,n){let i=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(let s of o)try{if(typeof t.CanvasRenderingContext2D.prototype[s]!="function")continue;let a=Xt(t.CanvasRenderingContext2D.prototype,s,function(l){return function(...c){return be(this.canvas,r,n,!0)||setTimeout(()=>{let u=ly(c,t,this);e(this.canvas,{type:Nr["2D"],property:s,args:u})},0),l.apply(this,c)}});i.push(a)}catch{let a=is(t.CanvasRenderingContext2D.prototype,s,{set(l){e(this.canvas,{type:Nr["2D"],property:s,args:[l],setter:!0})}});i.push(a)}return()=>{i.forEach(s=>s())}}function aO(e){return e==="experimental-webgl"?"webgl":e}function ph(e,t,r,n){let i=[];try{let o=Xt(e.HTMLCanvasElement.prototype,"getContext",function(s){return function(a,...l){if(!be(this,t,r,!0)){let c=aO(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])}});i.push(o)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{i.forEach(o=>o())}}function fh(e,t,r,n,i,o){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=Xt(e,l,function(u){return function(...d){let p=u.apply(this,d);if(ay(p,o,this),"tagName"in this.canvas&&!be(this.canvas,n,i,!0)){let m=ly(d,o,this),y={type:t,property:l,args:m};r(this.canvas,y)}return p}});s.push(c)}catch{let c=is(e,l,{set(u){r(this.canvas,{type:t,property:l,args:[u],setter:!0})}});s.push(c)}return s}function lO(e,t,r,n){let i=[];return i.push(...fh(t.WebGLRenderingContext.prototype,Nr.WebGL,e,r,n,t)),typeof t.WebGL2RenderingContext<"u"&&i.push(...fh(t.WebGL2RenderingContext.prototype,Nr.WebGL2,e,r,n,t)),()=>{i.forEach(o=>o())}}var uy="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",cO=e=>Uint8Array.from(atob(e),t=>t.charCodeAt(0)),hh=typeof window<"u"&&window.Blob&&new Blob([cO(uy)],{type:"text/javascript;charset=utf-8"});function uO(e){let t;try{if(t=hh&&(window.URL||window.webkitURL).createObjectURL(hh),!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,"+uy,{name:e?.name})}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}var Bl=class{constructor(t){b(this,"pendingCanvasMutations",new Map),b(this,"rafStamps",{latestId:0,invokeId:null}),b(this,"mirror"),b(this,"mutationCb"),b(this,"resetObservers"),b(this,"frozen",!1),b(this,"locked",!1),b(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:i,blockSelector:o,recordCanvas:s,dataURLOptions:a}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,s&&r==="all"&&this.initCanvasMutationObserver(n,i,o),s&&typeof r=="number"&&this.initCanvasFPSObserver(r,n,i,o,{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,i,o){let s=ph(r,n,i,!0),a=new Map,l=new uO;l.onmessage=y=>{let{id:f}=y.data;if(a.set(f,!1),!("base64"in y.data))return;let{base64:h,type:w,width:x,height:g}=y.data;this.mutationCb({id:f,type:Nr["2D"],commands:[{property:"clearRect",args:[0,0,x,g]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:h}],type:w}]},0,0]}]})};let c=1e3/t,u=0,d,p=()=>{let y=[];return r.document.querySelectorAll("canvas").forEach(f=>{be(f,n,i,!0)||y.push(f)}),y},m=y=>{if(u&&y-u<c){d=requestAnimationFrame(m);return}u=y,p().forEach(async f=>{var h;let w=this.mirror.getId(f);if(a.get(w)||f.width===0||f.height===0)return;if(a.set(w,!0),["webgl","webgl2"].includes(f.__context)){let g=f.getContext(f.__context);((h=g?.getContextAttributes())==null?void 0:h.preserveDrawingBuffer)===!1&&g.clear(g.COLOR_BUFFER_BIT)}let x=await createImageBitmap(f);l.postMessage({id:w,bitmap:x,width:f.width,height:f.height,dataURLOptions:o.dataURLOptions},[x])}),d=requestAnimationFrame(m)};d=requestAnimationFrame(m),this.resetObservers=()=>{s(),cancelAnimationFrame(d)}}initCanvasMutationObserver(t,r,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let i=ph(t,r,n,!1),o=sO(this.processMutation.bind(this),t,r,n),s=lO(this.processMutation.bind(this),t,r,n);this.resetObservers=()=>{i(),o(),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 i=n.map(s=>{let{type:a,...l}=s;return l}),{type:o}=n[0];this.mutationCb({id:r,type:o,commands:i}),this.pendingCanvasMutations.delete(t)}},Vl=class{constructor(t){b(this,"trackedLinkElements",new WeakSet),b(this,"mutationCb"),b(this,"adoptedStyleSheetCb"),b(this,"styleMirror",new $l),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:[]},i=[];for(let o of t){let s;this.styleMirror.has(o)?s=this.styleMirror.getId(o):(s=this.styleMirror.add(o),i.push({styleId:s,rules:Array.from(o.rules||CSSRule,(a,l)=>({rule:Sh(a,o.href),index:l}))})),n.styleIds.push(s)}i.length>0&&(n.styles=i),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}},Wl=class{constructor(){b(this,"nodeMap",new WeakMap),b(this,"active",!1)}inOtherBuffer(t,r){let n=this.nodeMap.get(t);return n&&Array.from(n).some(i=>i!==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(){}},ee,Oo,Qa,Ko=!1;try{if(Array.from([1],e=>e*2)[0]!==2){let e=document.createElement("iframe");document.body.appendChild(e),Array.from=((yf=e.contentWindow)==null?void 0:yf.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}var Fe=fk();function Zt(e={}){let{emit:t,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:i="rr-block",blockSelector:o=null,ignoreClass:s="rr-ignore",ignoreSelector:a=null,maskTextClass:l="rr-mask",maskTextSelector:c=null,inlineStylesheet:u=!0,maskAllInputs:d,maskInputOptions:p,slimDOMOptions:m,maskInputFn:y,maskTextFn:f,hooks:h,packFn:w,sampling:x={},dataURLOptions:g={},mousemoveWait:E,recordDOM:T=!0,recordCanvas:j=!1,recordCrossOriginIframes:te=!1,recordAfter:W=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:G=!1,collectFonts:re=!1,inlineImages:fe=!1,plugins:Ve,keepIframeSrcFn:N=()=>!1,ignoreCSSAttributes:Dr=new Set([]),errorHandler:Fr}=e;WM(Fr);let ie=te?window.parent===window:!0,Ie=!1;if(!ie)try{window.parent.document&&(Ie=!1)}catch{Ie=!0}if(ie&&!t)throw new Error("emit function is required");if(!ie&&!Ie)return()=>{};E!==void 0&&x.mousemove===void 0&&(x.mousemove=E),Fe.reset();let Tt=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},We=Eh(m);FM();let yc,os=0,gc=$=>{for(let Ne of Ve||[])Ne.eventProcessor&&($=Ne.eventProcessor($));return w&&!Ie&&($=w($)),$};ee=($,Ne)=>{var X;let Z=$;if(Z.timestamp=zo(),(X=qt[0])!=null&&X.isFrozen()&&Z.type!==P.FullSnapshot&&!(Z.type===P.IncrementalSnapshot&&Z.data.source===C.Mutation)&&qt.forEach(xe=>xe.unfreeze()),ie)t?.(gc(Z),Ne);else if(Ie){let xe={type:"rrweb",event:gc(Z),origin:window.location.origin,isCheckout:Ne};window.parent.postMessage(xe,"*")}if(Z.type===P.FullSnapshot)yc=Z,os=0;else if(Z.type===P.IncrementalSnapshot){if(Z.data.source===C.Mutation&&Z.data.isAttachIframe)return;os++;let xe=n&&os>=n,B=r&&Z.timestamp-yc.timestamp>r;(xe||B)&&Oo(!0)}};let Dn=$=>{ee({type:P.IncrementalSnapshot,data:{source:C.Mutation,...$}})},Sc=$=>ee({type:P.IncrementalSnapshot,data:{source:C.Scroll,...$}}),bc=$=>ee({type:P.IncrementalSnapshot,data:{source:C.CanvasMutation,...$}}),My=$=>ee({type:P.IncrementalSnapshot,data:{source:C.AdoptedStyleSheet,...$}}),Nt=new Vl({mutationCb:Dn,adoptedStyleSheetCb:My}),$t=new _l({mirror:Fe,mutationCb:Dn,stylesheetManager:Nt,recordCrossOriginIframes:te,wrappedEmit:ee});for(let $ of Ve||[])$.getMirror&&$.getMirror({nodeMirror:Fe,crossOriginIframeMirror:$t.crossOriginIframeMirror,crossOriginIframeStyleMirror:$t.crossOriginIframeStyleMirror});let ss=new Wl;Qa=new Bl({recordCanvas:j,mutationCb:bc,win:window,blockClass:i,blockSelector:o,mirror:Fe,sampling:x.canvas,dataURLOptions:g});let Fn=new jl({mutationCb:Dn,scrollCb:Sc,bypassOptions:{blockClass:i,blockSelector:o,maskTextClass:l,maskTextSelector:c,inlineStylesheet:u,maskInputOptions:Tt,dataURLOptions:g,maskTextFn:f,maskInputFn:y,recordCanvas:j,inlineImages:fe,sampling:x,slimDOMOptions:We,iframeManager:$t,stylesheetManager:Nt,canvasManager:Qa,keepIframeSrcFn:N,processedNodeManager:ss},mirror:Fe});Oo=($=!1)=>{if(!T)return;ee({type:P.Meta,data:{href:window.location.href,width:Ym(),height:Hm()}},$),Nt.reset(),Fn.init(),qt.forEach(X=>X.lock());let Ne=Fk(document,{mirror:Fe,blockClass:i,blockSelector:o,maskTextClass:l,maskTextSelector:c,inlineStylesheet:u,maskAllInputs:Tt,maskTextFn:f,maskInputFn:y,slimDOM:We,dataURLOptions:g,recordCanvas:j,inlineImages:fe,onSerialize:X=>{Jm(X,Fe)&&$t.addIframe(X),Qm(X,Fe)&&Nt.trackLinkElement(X),Nl(X)&&Fn.addShadowRoot(k.shadowRoot(X),document)},onIframeLoad:(X,Z)=>{$t.attachIframe(X,Z),Fn.observeAttachShadow(X)},onStylesheetLoad:(X,Z)=>{Nt.attachLinkElement(X,Z)},keepIframeSrcFn:N});if(!Ne)return console.warn("Failed to snapshot the document");ee({type:P.FullSnapshot,data:{node:Ne,initialOffset:Km(window)}},$),qt.forEach(X=>X.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&Nt.adoptStyleSheets(document.adoptedStyleSheets,Fe.getId(document))};try{let $=[],Ne=Z=>{var xe;return O(rO)({mutationCb:Dn,mousemoveCb:(B,as)=>ee({type:P.IncrementalSnapshot,data:{source:as,positions:B}}),mouseInteractionCb:B=>ee({type:P.IncrementalSnapshot,data:{source:C.MouseInteraction,...B}}),scrollCb:Sc,viewportResizeCb:B=>ee({type:P.IncrementalSnapshot,data:{source:C.ViewportResize,...B}}),inputCb:B=>ee({type:P.IncrementalSnapshot,data:{source:C.Input,...B}}),mediaInteractionCb:B=>ee({type:P.IncrementalSnapshot,data:{source:C.MediaInteraction,...B}}),styleSheetRuleCb:B=>ee({type:P.IncrementalSnapshot,data:{source:C.StyleSheetRule,...B}}),styleDeclarationCb:B=>ee({type:P.IncrementalSnapshot,data:{source:C.StyleDeclaration,...B}}),canvasMutationCb:bc,fontCb:B=>ee({type:P.IncrementalSnapshot,data:{source:C.Font,...B}}),selectionCb:B=>{ee({type:P.IncrementalSnapshot,data:{source:C.Selection,...B}})},customElementCb:B=>{ee({type:P.IncrementalSnapshot,data:{source:C.CustomElement,...B}})},blockClass:i,ignoreClass:s,ignoreSelector:a,maskTextClass:l,maskTextSelector:c,maskInputOptions:Tt,inlineStylesheet:u,sampling:x,recordDOM:T,recordCanvas:j,inlineImages:fe,userTriggeredOnInput:G,collectFonts:re,doc:Z,maskInputFn:y,maskTextFn:f,keepIframeSrcFn:N,blockSelector:o,slimDOMOptions:We,dataURLOptions:g,mirror:Fe,iframeManager:$t,stylesheetManager:Nt,shadowDomManager:Fn,processedNodeManager:ss,canvasManager:Qa,ignoreCSSAttributes:Dr,plugins:((xe=Ve?.filter(B=>B.observer))==null?void 0:xe.map(B=>({observer:B.observer,options:B.options,callback:as=>ee({type:P.Plugin,data:{plugin:B.name,payload:as}})})))||[]},h)};$t.addLoadListener(Z=>{try{$.push(Ne(Z.contentDocument))}catch(xe){console.warn(xe)}});let X=()=>{Oo(),$.push(Ne(document)),Ko=!0};return["interactive","complete"].includes(document.readyState)?X():($.push(Se("DOMContentLoaded",()=>{ee({type:P.DomContentLoaded,data:{}}),W==="DOMContentLoaded"&&X()})),$.push(Se("load",()=>{ee({type:P.Load,data:{}}),W==="load"&&X()},window))),()=>{$.forEach(Z=>{try{Z()}catch(xe){String(xe).toLowerCase().includes("cross-origin")||console.warn(xe)}}),ss.destroy(),Ko=!1,UM()}}catch($){console.warn($)}}Zt.addCustomEvent=(e,t)=>{if(!Ko)throw new Error("please add custom event after start recording");ee({type:P.Custom,data:{tag:e,payload:t}})};Zt.freezePage=()=>{qt.forEach(e=>e.freeze())};Zt.takeFullSnapshot=e=>{if(!Ko)throw new Error("please take full snapshot after start recording");Oo(e)};Zt.mirror=Fe;var mh;(function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"})(mh||(mh={}));var t_=5*1e3;var{addCustomEvent:r_}=Zt,{freezePage:n_}=Zt,{takeFullSnapshot:i_}=Zt;var fy="__ripploEmitRrwebEvent";function hy(){return{eventTypes:dy(P),incrementalSources:dy(C)}}function dy(e){return Object.fromEntries(Object.entries(e).filter(t=>typeof t[1]=="number").map(([t,r])=>[r,t]))}var pO=ja("@ripplo/rrweb-bundle/bundle","rrweb.js"),py;function my(){return py??=dO(pO,{encoding:"utf8"}),py}async function $n({clientVersion:e,debugDir:t,writeOtlpPortFile:r}){let n=new Map,i=ff(hy()),o=await xa({localDir:yy.join(yy.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 my();return{attach:async(l,c)=>{let u=pf({debugDir:t,runId:c,worker:i});u.emit({clientVersion:e,kind:"meta",source:"capture",timeNanos:"0"}),n.set(c,u),await mf(l,c),await l.addInitScript(`globalThis.__ripploCapturePort = ${String(o.port)};`),await hO(l,u),await gO(l,u);let d=[];return{emitAction:p=>{wO(u,p)},emitAssertion:p=>{RO(u,p)},finish:()=>SO(u,{pages:d,registry:n,runId:c}),onPage:p=>{d.push(p),bO(u,s,p)}}},debugDir:t,close:async()=>{await o.stop(),await i.terminate()},injectSpan:(l,c)=>{n.get(l)?.emit(c)}}}async function fO(e){await Promise.all(e.map(t=>t.evaluate("globalThis.__ripploFlushRrweb ? globalThis.__ripploFlushRrweb() : undefined").catch(()=>{})))}async function hO(e,t){await e.exposeBinding(fy,(r,n)=>{let i=typeof n=="string"?n:JSON.stringify(n);t.emitRrwebBatch(Buffer.from(i,"utf8"))})}var mO="__ripploEventPush",yO=Be.discriminatedUnion("kind",[Be.object({kind:Be.literal("console"),level:Be.string(),text:Be.string(),timestamp:Be.number()}),Be.object({kind:Be.literal("error"),message:Be.string(),stack:Be.string().optional(),timestamp:Be.number()})]);async function gO(e,t){await e.exposeBinding(mO,(r,n)=>{let i=yO.safeParse(n);if(!i.success)return;let o=i.data;if(o.kind==="console"){t.emit({kind:"console",level:o.level,source:"browser",text:o.text,timeNanos:wr(o.timestamp)});return}t.emit({kind:"error",message:o.message,source:"browser",stack:o.stack,timeNanos:wr(o.timestamp)})})}async function SO(e,t){await fO(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 bO(e,t,r){r.on("load",()=>{r.addScriptTag({content:t}).catch(()=>{})}),r.on("requestfinished",n=>{kO(e,n).catch(()=>{})}),r.url()!=="about:blank"&&r.addScriptTag({content:t}).catch(()=>{})}function wO(e,t){e.emit({action:t.kind,kind:"action",source:"test",target:vO(t),timeNanos:wr(Date.now()),value:xO(t)})}function RO(e,t){let r=xi(t);e.emit({kind:"assertion",label:r.label,outcome:t.outcome,source:"test",step:r.step,timeNanos:wr(Date.now()),wait:t.waitBudget,waitMs:t.waitMs})}function vO(e){if(e.url!=null)return e.url;if(e.locator!=null)return Nn(e.locator)}function Nn(e){return e.by==="testId"?`testId=${e.value}`:e.by==="inside"?`${Nn(e.scope)} \u25B8 ${Nn(e.target)}`:e.by==="surface"?Nn(e.container):e.by==="frame"?`frame ${Nn(e.element)}`:`${e.role} ${e.name??""}`.trim()}function xO(e){return e.value!=null?typeof e.value=="object"?JSON.stringify(e.value):String(e.value):e.key}var EO=/^http:\/\/127\.0\.0\.1:\d+\/rrweb\//;async function kO(e,t){if(EO.test(t.url()))return;let r=await t.response();if(r==null)return;let n=t.resourceType(),i=n==="fetch"||n==="xhr",o=t.timing(),s=t.headers().traceparent?.split("-"),a=o.startTime;e.emit({durationMs:Math.max(0,o.responseEnd),kind:"network",method:t.method(),requestBody:i?t.postData()??void 0:void 0,resourceType:n,responseBody:i?await CO(r):void 0,source:"browser",spanId:s?.[2],status:r.status(),timeNanos:wr(a>0?a:Date.now()),traceId:s?.[1],url:r.url()})}async function CO(e){try{return await e.text()}catch{return}}function Ln(e){return{aborted:!0,findings:[],ran:[],teardown:e}}function fc(e,t){return new pc(_O(e,t))}function MO(e,t){return new pc(OO(e,t))}async function OO(e,t){let r=await of(e.profileDir).catch(()=>{});if(r==null)return Jt(Ue(new Error("launch")));try{return $r(await IO({context:r,params:e,signal:t}))}catch(n){return Jt(Ue(n))}finally{await r.close().catch(ze)}}async function IO({context:e,params:t,signal:r}){let n=e.pages()[0]??await e.newPage(),i=await $n({clientVersion:t.clientVersion,debugDir:t.debugDir,writeOtlpPortFile:!0}),o=await i.attach(e,t.runId);return o.onPage(n),e.on("page",s=>{o.onPage(s)}),await n.goto(t.startUrl).catch(ze),t.onReady(),await TO(e,r),await o.finish(),await i.close(),{behaviorPath:AO.join(t.debugDir,t.runId,"behavior.jsonl")}}function TO(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",i=>i.on("close",n)),e.pages().forEach(i=>i.on("close",n))})}function NO(e,t){return new pc($O(e,t))}async function $O(e,t){let r=LO(e),n=wy({lockfile:e.lockfile,options:e.options,runId:e.runId,signal:t}),i=async o=>{try{return $r(await DO({established:o,params:e,signal:t}))}catch(s){return await o.teardown().match(ze,ze),Jt(zn(s)?s:Ue(s))}};return by(n,r).match(i,async o=>(await hc(n.teardown),Jt(o)))}function LO(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 DO({established:e,params:t,signal:r}){let n=eo({cacheDir:void 0,headed:!0}),i=await n.acquire(),{result:o,session:s}=await Sy({browser:i,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 t.onReady(),await FO(i,s.context),await e.teardown().match(ze,ze),await n.close(),{kind:"handed-over",ran:o.ran.length}}function FO(e,t){return new Promise(r=>{let n=()=>{r()};e.on("disconnected",n),t.on("close",n),t.on("page",i=>i.on("close",n)),t.pages().forEach(i=>i.on("close",n))})}async function _O({browser:e,hub:t,request:r},n){if(n.aborted)return $r(Ln("skipped"));let i=wy({lockfile:r.lockfile,options:r.options,runId:r.runId,signal:n}),o=async s=>{try{return await BO({browser:e,established:s,hub:t,request:r,signal:n})}catch(a){return Jt(zn(a)?a:Ue(a))}};return by(i,r).match(o,s=>jO(s,i.teardown))}async function jO(e,t){return e.kind!=="aborted"?Jt(e):$r(Ln(await hc(t)))}function hc(e){return e().match(()=>"done",()=>"failed")}async function BO(e){let t=await VO(e);if(t.kind==="completed"){let n=Date.now();return e.established.teardown().match(()=>(e.request.onPhase?.("teardown",Date.now()-n),$r({aborted:!1,...t.result})),i=>Jt(i))}let r=await hc(e.established.teardown);if(t.kind==="aborted")return $r(Ln(r));throw t.error}function gy(e,t,r){return Yr(e,t).map(n=>({params:{...Ui(n),...r},transition:n}))}async function Sy(e){let{established:t,lockfile:r,signal:n}=e,i=Date.now(),o=await Ta({baseUrl:e.options.baseUrl,browser:e.browser,capture:e.capture,clientState:t.clientState,engine:Ca(zO(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()-i);try{let s=cr(r),a=Date.now(),l=await Vi({canon:Ai(r),classify:Ci(r),dataRules:s.dataRules,driver:o.driver,facts:{facts:Gs(s.facts,ne(e.test)),overlays:Xe(r),overrides:s.overrides},initialState:{snapshot:t.snapshot},onAssertion:o.emitAssertion,sequence:e.sequence,stopAfterStep:e.stopAfterStep,onEvent:c=>{e.onEvent?.(c)}},n);return e.onPhase?.("drive",Date.now()-a),{result:l,session:o}}catch(s){throw await o.close().catch(ze),s}}async function VO({browser:e,established:t,hub:r,request:n,signal:i}){try{Oe(i),n.onEvent?.({aliases:t.aliases,generated:t.generated,generatedSingletons:t.generatedSingletons,kind:"world"});let{result:o,session:s}=await Sy({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??gy(n.lockfile,n.test,n.params),signal:i,stopAfterStep:void 0,test:n.test,viewport:nf(n.test.viewport)});return await s.close(),{kind:"completed",result:o}}catch(o){return nn(o)?{kind:"aborted"}:{error:o,kind:"threw"}}}function by(e,t){let r=Date.now();return e.ready().andThen(()=>{t.onPhase?.("engine",Date.now()-r);let n=Date.now();return fr(t.lockfile,t.test,{generate:Bn(jn(t.options.generate,t.runId),new Date().toISOString()),materialize:e.materialize,params:t.params,signIn:e.signIn}).map(i=>(t.onPhase?.("world",Date.now()-n),{aliases:i.aliases,auth:i.auth,clientState:i.clientState,generated:i.generated,generatedSingletons:i.generatedSingletons,observeActor:i.principals.size>0,reader:e.reader,signInActor:WO(e.signIn,i.principals),snapshot:i.snapshot,teardown:e.teardown}))})}function WO(e,t){return r=>{let n=t.get(r);return n==null?PO(Ue(new Error(`no seeded principal for actor "${r}"`))):e({entity:n.entity,row:n.row})}}function wy({lockfile:e,options:t,runId:r,signal:n}){let i=_a({baseUrl:t.engineUrl,extraHeaders:void 0,runId:r,secret:t.secret},n);return{materialize:Fi(i.setupWorld),reader:Da(e.entities,UO(e),i.query),ready:i.ready,signIn:i.signIn,teardown:i.teardown}}function UO(e){return e.singletons.filter(t=>t.source==="backend").map(t=>t.name)}function zO(e){return e.singletons.filter(t=>t.source==="client").map(t=>t.name)}import{err as GO,ok as qO,ResultAsync as KO}from"neverthrow";function HO({cacheDir:e,clientVersion:t,debugDir:r,headed:n,writeOtlpPortFile:i}){let o=eo({cacheDir:e,headed:n}),s,a,l=async()=>(s??=$n({clientVersion:t,debugDir:r,writeOtlpPortFile:i}),a=await s,a),c=async(p,m)=>{if(m.aborted)return qO(Ln("skipped"));try{let y=await l();if(p.options.headed&&!n)return await Na(!0,async h=>fc({browser:h,hub:y,request:p},m));let f=await o.acquire();return await fc({browser:f,hub:y,request:p},m)}catch(y){return GO(Ue(y))}};return{close:async()=>{await o.close();let p=s;s=void 0,a=void 0,p!=null&&await p.then(m=>m.close()).catch(()=>{})},prewarm:async()=>{await l(),await o.acquire()},injectSpan:(p,m)=>{a?.injectSpan(p,m)},runOnce:(p,m)=>new KO(c(p,m))}}import{z as A}from"zod";function YO(e){let t=e.split(`
65
- `).map(i=>dI(i)).filter(i=>i!=null),r=oI(t),n=t.map(i=>QO(i,r)).filter(i=>i!=null).filter(i=>i.kind==="input"||i.element!=null);return XO(n)}function XO(e){return e.filter((t,r)=>{let n=e[r+1];return!(t.kind==="input"&&n?.kind==="input"&&ZO(t.element,n.element))})}function ZO(e,t){return e?.testId===t?.testId&&e?.ariaLabel===t?.ariaLabel&&e?.placeholder===t?.placeholder}var JO={2:"click",3:"contextmenu",4:"dblclick"};function QO(e,t){return e.rrwebType==="IncrementalSnapshot:MouseInteraction"?eI(e,t):e.rrwebType==="IncrementalSnapshot:Input"?tI(e,t):null}function eI(e,t){let r=gI.safeParse(e.event.data);if(!r.success)return null;let n=JO[r.data.type];if(n==null)return null;let i=Ry(r.data.id,t.nodes);return{element:vy(i,t),kind:n,timeNanos:e.timeNanos,value:void 0}}function tI(e,t){let r=SI.safeParse(e.event.data);return r.success?{element:vy(r.data.id,t),kind:"input",timeNanos:e.timeNanos,value:r.data.text??rI(r.data.isChecked)}:null}function rI(e){return e==null?void 0:String(e)}var nI=new Set(["button","a","input","select","textarea","summary"]);function Ry(e,t){let r=t.get(e);if(r!=null)return iI(r)?e:r.parentId==null?void 0:Ry(r.parentId,t)}function iI(e){return e.attrs["data-testid"]!=null||e.attrs["aria-label"]!=null||e.attrs.role!=null||nI.has(e.tag??"")}function vy(e,t){let r=e==null?void 0:t.nodes.get(e);if(!(r==null||e==null))return{ariaLabel:Lr(r,"aria-label"),href:Lr(r,"href"),name:Lr(r,"name"),placeholder:Lr(r,"placeholder"),role:Lr(r,"role"),tag:r.tag,testId:Lr(r,"data-testid"),text:xy(e,t)}}function Lr(e,t){let r=e.attrs[t];return typeof r=="string"?r:typeof r=="number"||typeof r=="boolean"?String(r):void 0}function xy(e,t){let r=t.nodes.get(e);if(r==null)return;let n=r.text?.trim()??"",o=(t.children.get(e)??[]).map(a=>xy(a,t)??""),s=[n,...o].filter(a=>a.length>0).join(" ");return s.length===0?void 0:s.slice(0,100)}function oI(e){let t=e.flatMap(i=>sI(i).flatMap(o=>mc(o,void 0))),r=e.flatMap(i=>aI(i).flatMap(o=>mc(o.node,o.parentId??void 0))),n=cI(new Map([...t,...r]),e);return{children:lI(n),nodes:n}}function sI(e){if(e.rrwebType!=="FullSnapshot")return[];let t=hI.safeParse(e.event.data);return t.success?[t.data.node]:[]}function aI(e){if(e.rrwebType!=="IncrementalSnapshot:Mutation")return[];let t=Ey.safeParse(e.event.data);return t.success?t.data.adds.flatMap(r=>{let n=mI.safeParse(r);return n.success?[n.data]:[]}):[]}function lI(e){let t=new Map;return e.forEach((r,n)=>{r.parentId!=null&&t.set(r.parentId,[...t.get(r.parentId)??[],n])}),t}function mc(e,t){let r=fI.safeParse(e);if(!r.success)return[];let n=r.data,i=n.childNodes??[];return[[n.id,{attrs:{...n.attributes},parentId:t,tag:n.tagName,text:n.textContent}],...i.flatMap(s=>mc(s,n.id))]}function cI(e,t){return t.flatMap(n=>uI(n)).reduce((n,i)=>{let o=n.get(i.id);return o==null?n:new Map(n).set(i.id,{...o,attrs:{...o.attrs,...i.attributes}})},e)}function uI(e){if(e.rrwebType!=="IncrementalSnapshot:Mutation")return[];let t=Ey.safeParse(e.event.data);return t.success?t.data.attributes.flatMap(r=>{let n=yI.safeParse(r);return n.success?[n.data]:[]}):[]}function dI(e){if(e.trim().length===0)return null;let t=bI.safeParse(pI(e));return t.success?t.data:null}function pI(e){try{return JSON.parse(e)}catch{return null}}var fI=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()}),hI=A.object({node:A.unknown()}),mI=A.object({node:A.unknown(),parentId:A.number().nullable().default(null)}),yI=A.object({attributes:A.record(A.string(),A.unknown()),id:A.number()}),Ey=A.object({adds:A.array(A.unknown()).default([]),attributes:A.array(A.unknown()).default([])}),gI=A.object({id:A.number(),type:A.number()}),SI=A.object({id:A.number(),isChecked:A.boolean().optional(),text:A.string().optional()}),bI=A.object({event:A.object({data:A.unknown()}),kind:A.literal("rrweb"),rrwebType:A.string(),timeNanos:A.string()});function wI(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 RI(e,t){let r=await Ay({attemptIndex:0,capture:!1,params:e,stepRuns:e.stepRuns},t);if(r.kind!=="completed")return ky(r);let n=Cy(r.findings);if(n!=null)return{error:n,kind:"error"};let i=dr(r.findings);if(i.length===0)return{kind:"clean",ranCount:r.ranCount,timing:{confirm:void 0,detect:r.timing}};let o=ln(e.baseState.name,i);return e.seenSignature!=null&&await e.seenSignature(o.signature)?{kind:"seen",ranCount:r.ranCount,signature:o.signature,timing:{confirm:void 0,detect:r.timing},title:o.title,verifierLayer:o.layer}:vI(e,o,r.timing,t)}function ky(e){return e.kind==="error"?{error:e.error,kind:"error"}:{kind:e.kind}}function Cy(e){let t=e.find(r=>r.kind==="driver-error"&&Gn(r.error));return t!=null&&t.kind==="driver-error"?t.error:void 0}async function vI(e,t,r,n){let i=await Ay({attemptIndex:1,capture:!0,params:e,stepRuns:e.stepRuns},n);if(i.kind!=="completed")return ky(i);let o=Cy(i.findings);if(o!=null)return{error:o,kind:"error"};let s={confirm:i.timing,detect:r},a=dr(i.findings);return a.length===0||ln(e.baseState.name,a).signature!==t.signature?{kind:"flaky",ranCount:i.ranCount,timing:s}:{baseState:e.baseState.name,captureEvents:i.events,kind:"finding",ranCount:i.ranCount,runId:i.runId,signature:t.signature,sourceTest:t.sourceTest,timing:s,title:t.title,verifierLayer:t.layer}}async function Ay({attemptIndex:e,capture:t,params:r,stepRuns:n},i){let o=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:o,sequence:xI(r,n),test:r.baseState.test,onPhase:(c,u)=>{a.push({ms:u,phase:c})}},i)).match(c=>c.aborted?{kind:"aborted"}:{events:s,findings:c.findings,kind:"completed",ranCount:c.ran.length,runId:o,timing:wI(a)},c=>({error:c,kind:"error"}))}function xI(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 Py(e,t){let r=await Yi(e);if(r==null)return{kind:"unplannable"};let n=[...r.startingPointTests.values()].find(o=>ne(o)===t.baseStateRef);if(n==null)return{kind:"unplannable"};let i=t.steps.map(o=>{let s=r.corpus.find(a=>a.test===o.test&&a.index===o.index);return s==null?null:{params:o.params,transition:s}});return i.some(o=>o==null)?{kind:"unplannable"}:{baseTest:n,kind:"ok",sequence:i.filter(o=>o!=null)}}async function EI({capture:e,lockfile:t,options:r,repro:n,runId:i,session:o,signal:s}){let a=await Py(t,n);return a.kind==="unplannable"?{kind:"unplannable"}:(await o.runOnce({capture:e,lockfile:t,onEvent:void 0,onPhase:void 0,options:r,params:void 0,runId:i,sequence:a.sequence,test:a.baseTest},s)).match(c=>{if(c.aborted)return{kind:"aborted"};let u=dr(c.findings);return u.length>0?{findings:u,kind:"still-fails"}:{kind:"resolved"}},c=>({kind:"state-unavailable",reason:c.kind}))}export{nr as a,v as b,dt as c,ne as d,J as e,Hr as f,Gn as g,Uc as h,jr as i,si as j,tr as k,nd as l,Ct as m,fi as n,hd as o,vd as p,Ed as q,gp as r,Sp as s,wp as t,Rp as u,xp as v,ce as w,Md as x,bi as y,Vt as z,Wt as A,Ut as B,ta as C,Q as D,Td as E,Nd as F,Ei as G,oa as H,Ld as I,tn as J,ft as K,Cp as L,$p as M,Dp as N,Fp as O,_p as P,Bp as Q,Vp as R,Yi as S,Wp as T,xa as U,MO as V,NO as W,gy as X,HO as Y,YO as Z,RI as _,Py as $,EI as aa};
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
- */