ripplo 0.7.61 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-ZPCVY23H.js → chunk-D6FZ55DP.js} +1 -1
- package/dist/chunk-E4AOUQQ7.js +10 -0
- package/dist/{chunk-5YQYVDNN.js → chunk-GOFUUPKD.js} +1 -1
- package/dist/chunk-KMZ3L5YA.js +4 -0
- package/dist/chunk-NIKFQP6W.js +301 -0
- package/dist/chunk-NNH3YVVO.js +4 -0
- package/dist/chunk-SAYJ5AQK.js +55 -0
- package/dist/chunk-THHZNLXN.js +48 -0
- package/dist/chunk-VGYX2VAS.js +85 -0
- package/dist/daemon-MBF7JVEN.js +139 -0
- package/dist/daemon-VIHSG5KP.js +4 -0
- package/dist/daemon-lock-HIZ6UWXO.js +4 -0
- package/dist/index.js +228 -237
- package/dist/solve-worker.js +4 -0
- package/dist/status-G5OG62JI.js +4 -0
- package/package.json +5 -5
- package/dist/chunk-63TU4VJ7.js +0 -4
- package/dist/chunk-6SKODQ54.js +0 -136
- package/dist/chunk-7C6PFZJF.js +0 -287
- package/dist/chunk-LHXEVZIV.js +0 -10
- package/dist/chunk-PXYDLKAG.js +0 -48
- package/dist/daemon-47WHU7QZ.js +0 -139
- package/dist/daemon-MTPTV22N.js +0 -4
- package/dist/daemon-lock-6NG7JHQO.js +0 -4
- package/dist/status-UG3NHVXY.js +0 -4
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __ripploCreateRequire } from "node:module";
|
|
3
|
+
const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
|
|
4
|
+
import{C as cs,D as xc,E as _r,F as kc,J as jr,K as Ec,O as Cc,P as Ac,Q as Pc,R as Mc,W as it,X as Oc,Z as Ic,a as S,b as gc,c as ls,d as tt,e as Lr,f as ce,g as Sc,h as nt,i as _n,j as Dr,k as Fr,l as bc,p as wc,q as Rc,r as ue,s as ye,t as Jt,u as vc,v as $t,w as rt,x as ke,y as G,z as we}from"./chunk-SAYJ5AQK.js";import{a as by}from"./chunk-NNH3YVVO.js";import{a as Sy,b as yc}from"./chunk-KMZ3L5YA.js";var ip=Sy((aL,la)=>{"use strict";var $i=process||{},np=$i.argv||[],Ti=$i.env||{},ER=!(Ti.NO_COLOR||np.includes("--no-color"))&&(!!Ti.FORCE_COLOR||np.includes("--color")||$i.platform==="win32"||($i.stdout||{}).isTTY&&Ti.TERM!=="dumb"||!!Ti.CI),CR=(e,t,n=e)=>r=>{let i=""+r,o=i.indexOf(t,e.length);return~o?e+AR(i,t,n,o)+t:e+i+t},AR=(e,t,n,r)=>{let i="",o=0;do i+=e.substring(o,r)+n,o=r+t.length,r=e.indexOf(t,o);while(~r);return i+e.substring(o)},rp=(e=ER)=>{let t=e?CR:()=>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")}};la.exports=rp();la.exports.createColors=rp});import{z as wy}from"zod";import{stringify as Ry}from"safe-stable-stringify";var us=wy.string().brand(),M=us.parse("");function Ne(e){return us.parse(e)}function Ee(e,t){return us.parse(e.length===0?t:`${e}.${t}`)}function W(e){return gc.safeParse(e).success}function Tc(e){let t=e.lastIndexOf(".");return t===-1?void 0:{alias:e.slice(0,t),field:e.slice(t+1)}}function Ue(e){return typeof e=="object"&&e!==null&&"template"in e}function $c(e){return typeof e!="string"&&"count"in e}function Re(e){return{counts:void 0,env:e}}function ds(e,t,n){let r=Ee(t,e.ref);if(!n.has(r))throw new Error(`unresolved binding ref "${r}"`);return n.get(r)??null}function jn(e,t,n){return Br(e).every(r=>n.has(Ee(t,r)))}function ze(e,t,n){return typeof e=="string"?e:W(e)?String(ds(e,t,n.env)):e.template.map(r=>xy(r,t,n)).join("")}function Ce(e,t,n){return e===null||typeof e=="number"||typeof e=="boolean"?e:W(e)?ds(e,t,n.env):ze(e,t,n)}function Nc(e,t){return Ce(e,M,t)}function Bn(e){return Ry(e)}function Qt(e,t,n){return Object.fromEntries(Object.entries(e).map(([r,i])=>[r,Ce(i,t,n)]))}function Br(e){return e==null||typeof e!="object"?[]:Ue(e)?e.template.flatMap(t=>typeof t=="string"?[]:$c(t)?vy(t):[t.ref]):[e.ref]}function vy(e){return Object.values(e.count.where).flatMap(t=>Lc(t))}function Lc(e){return e==null||typeof e!="object"?[]:"kind"in e?e.kind==="within"?Object.values(e.selection.where).flatMap(t=>Lc(t)):e.kind==="anyOf"?e.values.flatMap(t=>Br(t)):Br(e.value):Br(e)}function xy(e,t,n){if(typeof e=="string")return e;if(!$c(e))return String(ds(e,t,n.env));if(n.counts==null)throw new Error(`no state in scope to count ${e.count.entity} rows`);return String(n.counts(e,n.env))}function de(e,t){return e.by==="role"?{by:"role",name:e.name==null?void 0:ze(e.name,M,t),role:e.role}:e.by==="inside"?{by:"inside",scope:de(e.scope,t),target:de(e.target,t)}:e.by==="surface"?{by:"surface",container:de(e.container,t),overlay:e.overlay}:{by:"testId",value:ze(e.value,M,t)}}function Vn(e,t){if(e==null)return new Set;if(e.by==="inside")return new Set([...Vn(e.scope,t),...Vn(e.target,t)]);if(e.by==="surface")return Vn(e.container,t);let n=e.by==="role"?e.name:e.value;return new Set(t(n))}var ky="https://ripplo.invalid";var Dc={hash:void 0,path:void 0,query:{},title:void 0,viewport:void 0};function _c(e){return e.kind!=="title"&&e.kind!=="viewport"}function en(e){return e.kind==="query"?`url query "${e.key}"`:e.kind==="title"||e.kind==="viewport"?e.kind:`url ${e.kind}`}function Vr(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 Wn(e){let t=new URL(e,ky),n=Object.fromEntries(t.searchParams.entries());return{hash:t.hash.length>0?t.hash.slice(1):void 0,path:t.pathname,query:n,title:void 0,viewport:void 0}}function jc(e){if(typeof e=="string")return Fc(Wn(e));let t=W(e)?[e]:e.template,n=t.findIndex(c=>typeof c=="string"&&/[?#]/.test(c)),r=t[n];if(n===-1||typeof r!="string")return{...Dc,path:e};let i=[...t.slice(0,n),r.slice(0,r.search(/[?#]/))].filter(c=>typeof c!="string"||c.length>0),o=t.slice(n),s={template:i};if(o.some(c=>typeof c!="string"))return{...Dc,path:s};let a=o.filter(c=>typeof c=="string").join(""),l=Wn(`/p${a.slice(a.search(/[?#]/))}`);return{...Fc(l),path:s}}function Bc(e){let n=[[{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}]),r=Object.entries(e.query).map(([i,o])=>({clause:o,key:{key:i,kind:"query"}}));return[...n,...r]}function Fc(e){return{hash:e.hash,path:e.path,query:e.query,title:e.title,viewport:e.viewport}}var Le=new Map;function R(e){return e.kind!=="element"?S(e):Lr(e.locator,e.state)}function ot(e,t){return new Map([...Vc(e,t),[R(t.subject),t]])}function ps(e,t){return new Map([...Vc(e,t),[R(t.subject),t]])}function Ae(e,t){return new Map([...e,...t])}function fs(e){return e.kind==="element"}function bt(e){return e.kind==="path"||e.kind==="query"||e.kind==="hash"}function ae(e,t){let n=e.get(R(t));return n==null||n.expect.expect!=="is"?void 0:n.expect.value}function nn(e){let t=Wn(e),n=[[{kind:"path"},t.path],[{kind:"hash"},t.hash],...Object.entries(t.query).map(r=>[{key:r[0],kind:"query"},r[1]])];return new Map(n.flatMap(([r,i])=>i===void 0?[]:[[R(r),{declared:!0,expect:{expect:"is",value:i},subject:r}]]))}function hs(e){return[...e].toSorted(([t],[n])=>t.localeCompare(n))}function Vc(e,t){return Ey(t)?Cy(e,t.subject):Py(t)?My(e,t.subject):e}function Ey(e){return e.subject.kind==="element"&&e.subject.state==="visible"&&e.expect.expect==="is"&&e.expect.value===!1}function Cy(e,t){if(t.kind!=="element")return e;let n=S(ce(t.locator)),r=[...e].filter(([,i])=>Ay(i,n));return r.length===e.size?e:new Map(r)}function Ay(e,t){if(e.subject.kind!=="element")return!0;let n=ce(e.subject.locator);return Wr(n,t)?!1:S(n)!==t?!0:e.subject.state!=="text"&&e.subject.state!=="value"}function Wr(e,t){return e.by!=="inside"?!1:S(e.scope)===t||S(e.target)===t||Wr(e.scope,t)||Wr(e.target,t)}function Py(e){return e.subject.kind==="element"&&e.subject.state==="visible"&&e.expect.expect==="is"&&e.expect.value===!0&&Wc(e.subject.locator)}function Wc(e){return e.by==="surface"&&e.overlay}function My(e,t){if(t.kind!=="element")return e;let n=S(ce(t.locator)),r=[...e].filter(([,i])=>Oy(i,n));return r.length===e.size?e:new Map(r)}function Oy(e,t){if(e.subject.kind!=="element"||Wc(e.subject.locator))return!0;let n=ce(e.subject.locator);return S(n)===t||Wr(n,t)}function st({declared:e,entry:t,scope:n}){let r=t.subject.kind==="element"?{...t.subject,locator:de(t.subject.locator,n)}:t.subject;if(t.expect.expect==="absent")return{declared:e,expect:{expect:"absent"},subject:r};let i=Ce(t.expect.value,M,n),o=$y(r)&&typeof i=="number"?String(i):i;return{declared:e,expect:{expect:t.expect.expect,value:o},subject:r}}function Nt({got:e,subject:t,want:n}){if(n.expect==="absent")return e===void 0;if(Iy(t)){let r=Ty(e,n.value);return n.expect==="is"?r:!r}return n.expect==="is"?e===n.value:e!==n.value}function Iy(e){return e.kind==="element"&&e.state==="text"}function tn(e){return e.replaceAll(/\s+/gu," ").trim()}function Ty(e,t){return typeof e=="string"&&typeof t=="string"&&tn(e)===tn(t)}function $y(e){return e.kind==="element"&&(e.state==="value"||e.state==="text")}function rn(e){let t=ae(e.scalars,{kind:"path"});return typeof t=="string"?t:null}import Ny from"better-sqlite3";var Uc={current:null};function Ur(){let e=Uc.current;if(e!=null)return e;let t={columns:new Map,db:new Ny(":memory:"),loaded:null,statements:new Map};return Uc.current=t,t}function Lt(e,t){let n=e.statements.get(t);if(n!=null)return n;let r=e.db.prepare(t);return e.statements.set(t,r),r}function Ge(e,t,n){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);n.filter(s=>i?.has(s)!==!0).forEach(s=>{e.db.exec(`ALTER TABLE "${t}" ADD COLUMN "${s}"`),i?.add(s),e.loaded=null})}function zr(e,t){t.entities.forEach((n,r)=>{let i=[...new Set([...n.values()].flatMap(o=>Object.keys(o)))];Ge(e,r,i)})}function Un(e,t,n){Ge(e,t,Object.keys(n)),Object.values(n).forEach(r=>{ue(r)&&(Ge(e,r.selection.entity,[r.field]),Un(e,r.selection.entity,r.selection.where))})}function Gr(e,t){e.loaded!==t&&(e.columns.forEach((n,r)=>{Lt(e,`DELETE FROM "${r}"`).run();let i=t.entities.get(r);if(i==null||i.size===0)return;let o=[...n],s=o.map(d=>`"${d}"`).join(", "),a=o.map(()=>"?").join(", "),l=o.length===0?"(__as)":`(__as, ${s})`,c=o.length===0?"(?)":`(?, ${a})`,u=Lt(e,`INSERT INTO "${r}" ${l} VALUES ${c}`);i.forEach((d,p)=>{u.run(p,...o.map(m=>Ly(d[m])))})}),e.loaded=t)}function Ly(e){return typeof e=="boolean"?e?1:0:typeof e=="string"||typeof e=="number"?e:e instanceof Date?e.toISOString():null}function ms({entity:e,snapshot:t,where:n}){let r=Ur();Un(r,e,n),zr(r,t),Gr(r,t);let o=`SELECT r.__as AS __as FROM "${e}" r WHERE ${Rt(n,{depth:0,refExpr:Dy,row:"r"})} ORDER BY r.rowid`;return Lt(r,o).all().flatMap(s=>{let a=s!=null&&typeof s=="object"?Reflect.get(s,"__as"):null;return typeof a=="string"?[a]:[]})}function zc(e){let t=e.snapshot.entities.get(e.entity);return t==null||t.size===0?[]:ms(e).flatMap(n=>{let r=t.get(n);return r==null?[]:[r]})}function Dy(e){throw new Error(`sql-where: unresolved ref "${e}" \u2014 resolve refs before matching`)}function Rt(e,t){let n=Object.entries(e).map(([r,i])=>Fy({column:`${t.row}."${r}"`,scope:t,want:i}));return n.length===0?"1":n.join(" AND ")}function Fy({column:e,scope:t,want:n}){if(ue(n)){let r=`w${String(t.depth)}`,i=Rt(n.selection.where,{...t,depth:t.depth+1,row:r});return`${e} IN (SELECT ${r}."${n.field}" FROM "${n.selection.entity}" ${r} WHERE ${i})`}return ye(n)?jy({column:e,scope:t,want:n}):`${e} IS ${Dt(n,t.refExpr)}`}function Dt(e,t){let n=_y(e);if(n!=null)return t(n);if(e instanceof Date)return wt(e.toISOString());if(e!=null&&typeof e=="object")throw new Error("sql-where: template values must be resolved before compiling");return wt(e)}function wt(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 _y(e){if(e!=null&&typeof e=="object"&&"ref"in e)return typeof e.ref=="string"?e.ref:void 0}function jy({column:e,scope:t,want:n}){let{refExpr:r}=t;if(n.kind==="not")return`${e} IS NOT ${Dt(n.value,r)}`;if(n.kind==="anyOf")return`(${n.values.map(o=>`${e} IS ${Dt(o,r)}`).join(" OR ")})`;if(n.kind==="compare"){let i={gt:">",gte:">=",lt:"<",lte:"<="}[n.op];return`${e} ${i} ${Dt(n.value,r)}`}return n.kind==="contains"?`instr(${e}, ${Dt(n.value,r)}) > 0`:`substr(${e}, 1, length(${Dt(n.value,r)})) IS ${Dt(n.value,r)}`}function vt(e){return typeof e=="object"&&e!==null&&"kind"in e}function xt(e){return Object.fromEntries(Object.entries(e).filter(t=>!vt(t[1])))}function gs(e){return new Map(e.entities.filter(t=>t.identityKind==="surrogate").map(t=>[t.name,t.identity]))}function ge(e){return(t,n)=>at(e,t.count.entity,t.count.where,n).length}function on(e,t,n){return t.reduce((r,i)=>Wy(r,i,n,e),e)}function Gc(e,{clears:t,forget:n,sets:r}){let i=new Set(t),o=By(e,n,r),s=[...e.scalars].filter(([l,c])=>!i.has(l)&&!(o&&(fs(c.subject)||Vy(c.subject)))),a=[...r.values()].reduce((l,c)=>ot(l,c),new Map(s));return{...e,scalars:a}}function By(e,t,n){if(t==="hard")return!0;if(t==="none")return!1;let r=ae(e.scalars,{kind:"path"}),i=ae(n,{kind:"path"});return i!==void 0&&i!==r}function Vy(e){return e.kind==="query"||e.kind==="hash"}function Wy(e,t,n,r){let{env:i,identities:o}=n;if(!Gy(t,i))return e;if(t.assertion.kind==="created"){let l=Qt(t.assertion.props,M,{counts:ge(e),env:i}),c=Uy({entity:t.entity,identities:o,props:l},e);return Ky(e,t.entity,Bn(c),c)}let s=Hc({entity:t.entity,env:i,key:t.key,snapshot:r});if(t.assertion.kind==="deleted")return ys(e,t.entity,l=>new Map([...l].filter(([c])=>!s.has(c))));let a=Qt(xt(t.assertion.props),M,{counts:ge(e),env:i});return ys(e,t.entity,l=>new Map([...l].map(([c,u])=>s.has(c)?[c,{...u,...a}]:[c,u])))}var Ss="#surrogate#";function qc(e){return typeof e=="string"&&e.includes(Ss)}function Uy({entity:e,identities:t,props:n},r){let i=(t.get(e)??[]).filter(a=>!(a in n));if(i.length===0)return n;let o=zy(r.entities.get(e),e),s=Object.fromEntries(i.map(a=>[a,`${e}${Ss}${String(o)}`]));return{...n,...s}}function zy(e,t){let n=`${t}${Ss}`;return[...(e??new Map).values()].flatMap(i=>Object.values(i)).filter(i=>typeof i=="string"&&i.startsWith(n)).map(i=>Number(i.slice(n.length))).filter(i=>Number.isFinite(i)).reduce((i,o)=>Math.max(i,o),0)+1}function Gy(e,t){return("props"in e.assertion?[e.key,xt(e.assertion.props)]:[e.key]).every(r=>Object.values(r).every(i=>ue(i)||qy(i).every(o=>!W(o)||t.has(Ne(o.ref)))))}function qy(e){return ye(e)?e.kind==="anyOf"?e.values:[e.value]:[e]}function Ky(e,t,n,r){let i=new Map([...e.entities.get(t)??[],[n,r]]);return{...e,entities:new Map([...e.entities,[t,i]])}}function ys(e,t,n){let r=n(e.entities.get(t)??new Map);return{...e,entities:new Map([...e.entities,[t,r]])}}function at(e,t,n,r){return zc({entity:t,snapshot:e,where:bs(n,{env:r,snapshot:e})})}function Kc(e,t,n,r,i){let o=Hc({entity:t,env:r,key:n,snapshot:e});return ys(e,t,s=>new Map([...s].map(([a,l])=>[a,o.has(a)?i(l):l])))}function Hc({entity:e,env:t,key:n,snapshot:r}){return new Set(ms({entity:e,snapshot:r,where:bs(n,{env:t,snapshot:r})}))}function bs(e,t){return Object.fromEntries(Object.entries(e).map(([n,r])=>[n,Hy(r,t)]))}function Hy(e,t){return ue(e)?{...e,selection:{...e.selection,where:bs(e.selection.where,t)}}:ye(e)?e.kind==="anyOf"?{...e,values:e.values.map(n=>qr(n,t))}:e.kind==="contains"||e.kind==="startsWith"?{...e,value:String(qr(e.value,t))}:{...e,value:qr(e.value,t)}:qr(e,t)}function qr(e,t){return Ce(e,M,{counts:ge(t.snapshot),env:t.env})}function Zc(e,t,n){return e.reduce((r,i)=>{let o=on(r.snapshot,Yy(i),n);return{resolved:[...r.resolved,Zy(i,o,n.env)],snapshot:o}},{resolved:[],snapshot:t}).resolved}function Ft(e,t){if(e.kind==="count")return at(t.snapshot,e.entity,e.where,t.env).length===e.value;if(e.kind==="exists")return at(t.snapshot,e.entity,e.where,t.env).length>0;if(e.kind==="singleton"){let n=Ce(e.assertion.value,M,{counts:ge(t.snapshot),env:t.env});return Yc(ae(t.snapshot.scalars,{kind:"variable",name:e.singleton}))===Yc(n)}return e.kind==="not"?!Ft(e.predicate,t):e.kind==="or"?e.predicates.some(n=>Ft(n,t)):e.predicates.every(n=>Ft(n,t))}function Yy(e){return e.expect.filter(t=>t.kind==="state")}function Zy(e,t,n){return e.expect.some(r=>r.kind==="when")?{...e,expect:e.expect.flatMap(r=>Xc(r,{env:n,snapshot:t}))}:e}function Xc(e,t){if(e.kind!=="when")return[e];let n=Xy(e,t);return n==null?[]:n.flatMap(r=>Xc(r,t))}function Xy(e,t){return e.branches.find(n=>n.condition==null||Ft(n.condition,t))?.consequence}function Yc(e){return e==null?"\u2205":JSON.stringify(e)}var Jc=2e4;function tu(e,t){let n=["__stage_a","__stage_b"],r=t.entities.reduce((a,l,c)=>{let u=n[c%2]??"__stage_a";e.db.exec(`DROP TABLE IF EXISTS ${u}`);let d=a==null?"":"prev.*, ",p=a==null?"":`${a} prev, `,m=Qy({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}`),Jy(e,u),u},null);if(r==null)return{};let i=eg(t),o=i.length===0?"":` WHERE ${i.join(" AND ")}`,s=e.db.prepare(`SELECT * FROM ${r} s${o} LIMIT 1`).get();return s==null||typeof s!="object"?null:{...s}}function Jy(e,t){let n=e.db.prepare(`SELECT COUNT(*) AS n FROM ${t}`).get(),r=n!=null&&typeof n=="object"?Reflect.get(n,"n"):0;if(typeof r=="number"&&r>Jc)throw new Error(`sql-staged: pattern too weakly constrained \u2014 ${String(r)} partial assignments exceed the ${String(Jc)} cap`)}function Qy({index:e,pattern:t,prev:n}){let r=t.entities[e];if(r==null)return"1";let i=Object.entries(r.literals).map(([u,d])=>`t."${u}" IS ${wt(d)}`),o=new Map(t.entities.slice(0,e).map((u,d)=>[u.alias,d])),s=r.relations.flatMap(u=>{let d=o.get(u.targetAlias);return d==null?[]:[`t."${u.field}" = ${Qc(t,d,u.targetField)}`]}),a=t.entities.slice(0,e).flatMap((u,d)=>u.relations.flatMap(p=>p.targetAlias===r.alias?[`${Qc(t,d,p.field)} = t."${p.targetField}"`]:[])),l=t.entities.slice(0,e).flatMap((u,d)=>u.entity===r.entity&&n!=null?[`t.__as <> prev."a${String(d)}"`]:[]),c=[...i,...s,...a,...l];return c.length===0?"1":c.join(" AND ")}function Qc(e,t,n){let r=e.entities[t]?.entity??"";return`(SELECT b."${n}" FROM "${r}" b WHERE b.__as = prev."a${String(t)}")`}function eu(e,t,n){let r=e.entities[t]?.entity??"";return`(SELECT r."${n}" FROM "${r}" r WHERE r.__as = s."a${String(t)}")`}function eg(e){let t=new Map(e.entities.map((a,l)=>[a.alias,l])),n=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 eu(e,c,a.slice(l+1))},r=e.absences.map(a=>{let l=[...Object.entries(a.literals).map(([u,d])=>`x."${u}" IS ${wt(d)}`),...a.relations.map(u=>{let d=t.get(u.targetAlias);return d==null?"0":`x."${u.field}" = ${eu(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:n,row:"c"},s=e.conditions.flatMap(a=>ws(a,o));return[...r,...i,...s]}function ws(e,t){if(e.kind==="singleton")return[];if(e.kind==="not"){let n=ws(e.predicate,t);return n.length===0?[]:[`NOT (${n.join(" AND ")})`]}return e.kind==="and"||e.kind==="or"?tg(e,t):[ng(e,t)]}function tg(e,t){let n=e.predicates.flatMap(i=>ws(i,t)),r=e.kind==="and"?" AND ":" OR ";return n.length===0?[]:[`(${n.join(r)})`]}function ng(e,t){return e.kind==="count"?`(SELECT COUNT(*) FROM "${e.entity}" c WHERE ${Rt(e.where,t)}) = ${String(e.value)}`:`EXISTS (SELECT 1 FROM "${e.entity}" c WHERE ${Rt(e.where,t)})`}var nu=new WeakMap,rg=60;function ou(e,t){let n=Ur(),r=ig(t);if(og(e.actor,r))return null;if(sg(n,e),zr(n,t),Gr(n,t),e.entities.length>rg){let s=tu(n,e);return s==null?null:iu({pattern:e,picked:s,snapshot:t})}let i=nu.get(e)??lg(e);nu.set(e,i);let o=i.includes(":actor")?Lt(n,i).get({actor:r}):Lt(n,i).get();return o==null||typeof o!="object"?null:iu({pattern:e,picked:o,snapshot:t})}function ig(e){let t=e.scalars.get(R({kind:"actor"})),n=t!=null&&t.expect.expect==="is"?t.expect.value:null;return typeof n=="string"?n:null}function og(e,t){return e.kind==="user"?t==null:e.kind==="anonymous"?t!=null:!1}function sg(e,t){t.entities.forEach(n=>{Ge(e,n.entity,[...Object.keys(n.literals),...n.relations.map(r=>r.field)]),n.relations.forEach(r=>{let i=t.entities.find(o=>o.alias===r.targetAlias);i!=null&&Ge(e,i.entity,[r.targetField])})}),t.absences.forEach(n=>{Ge(e,n.entity,[...Object.keys(n.literals),...n.relations.map(r=>r.field)]),n.relations.forEach(r=>{let i=t.entities.find(o=>o.alias===r.targetAlias);i!=null&&Ge(e,i.entity,[r.targetField])})}),t.conditions.forEach(n=>{vs(e,n),Rs({condition:n,pattern:t,store:e})}),t.exclusives.forEach(n=>{Ge(e,n,[])})}function Rs({condition:e,pattern:t,store:n}){if(e.kind!=="singleton"){if(e.kind==="not"){Rs({condition:e.predicate,pattern:t,store:n});return}if(e.kind==="and"||e.kind==="or"){e.predicates.forEach(r=>{Rs({condition:r,pattern:t,store:n})});return}su(e.where).forEach(r=>{let i=r.indexOf(".");if(i===-1)return;let o=r.slice(0,i),s=t.entities.find(a=>a.alias===o);s!=null&&Ge(n,s.entity,[r.slice(i+1)])})}}function su(e){return Object.values(e).flatMap(t=>ag(t))}function ag(e){return ue(e)?su(e.selection.where):ye(e)?(e.kind==="anyOf"?e.values:[e.value]).flatMap(n=>ru(n)):ru(e)}function ru(e){return e!=null&&typeof e=="object"&&"ref"in e?typeof e.ref=="string"?[e.ref]:[]:[]}function vs(e,t){if(t.kind!=="singleton"){if(t.kind==="not"){vs(e,t.predicate);return}if(t.kind==="and"||t.kind==="or"){t.predicates.forEach(n=>{vs(e,n)});return}Un(e,t.entity,t.where)}}function iu({pattern:e,picked:t,snapshot:n}){let r=e.entities.map((i,o)=>{let s=Reflect.get(t,`a${String(o)}`),a=typeof s=="string"?n.entities.get(i.entity)?.get(s):null;return a==null?null:[i.alias,a]});return r.some(i=>i==null)?null:new Map(r.filter(i=>i!=null))}function lg(e){let t=new Map(e.entities.map((s,a)=>[s.alias,`t${String(a)}`])),n=e.entities.length===0?"1":e.entities.map((s,a)=>`t${String(a)}.__as AS a${String(a)}`).join(", "),r=e.entities.length===0?"":` FROM ${e.entities.map((s,a)=>`"${s.entity}" t${String(a)}`).join(", ")}`,i=[...cg(e,t),...e.entities.flatMap((s,a)=>ug({alias:`t${String(a)}`,aliases:t,constraint:s})),...dg(e,t),...e.absences.map(s=>pg(s,t)),...e.conditions.flatMap(s=>xs(s)?[]:[ks(s,t)]),...fg(e,t)],o=i.length===0?"":` WHERE ${i.join(" AND ")}`;return`SELECT ${n}${r}${o} LIMIT 1`}function cg(e,t){if(e.actor.kind!=="user")return[];let n=t.get(e.actor.alias);return n==null?[]:[`${n}.__as = :actor`]}function xs(e){return e.kind==="singleton"?!0:e.kind==="not"?xs(e.predicate):e.kind==="and"||e.kind==="or"?e.predicates.some(t=>xs(t)):!1}function ug({alias:e,aliases:t,constraint:n}){let r=Object.entries(n.literals).map(([o,s])=>`${e}."${o}" IS ${wt(s)}`),i=n.relations.map(o=>{let s=t.get(o.targetAlias);return s==null?"1":`${e}."${o.field}" = ${s}."${o.targetField}"`});return[...r,...i]}function dg(e,t){return e.entities.flatMap((n,r)=>e.entities.slice(r+1).flatMap((i,o)=>{if(n.entity!==i.entity)return[];let s=t.get(n.alias),a=t.get(e.entities[r+1+o]?.alias??i.alias);return s==null||a==null?[]:[`${s}.__as <> ${a}.__as`]}))}function pg(e,t){let n=[...Object.entries(e.literals).map(([i,o])=>`x."${i}" IS ${wt(o)}`),...e.relations.map(i=>{let o=t.get(i.targetAlias);return o==null?"0":`x."${i.field}" = ${o}."${i.targetField}"`})],r=n.length===0?"":` WHERE ${n.join(" AND ")}`;return`NOT EXISTS (SELECT 1 FROM "${e.entity}" x${r})`}function fg(e,t){return e.exclusives.map(n=>{let r=e.entities.map(s=>s.entity===n?t.get(s.alias):null).filter(s=>s!=null),i=r.map(s=>`${s}.__as`).join(", "),o=r.length===0?"":` WHERE x.__as NOT IN (${i})`;return`NOT EXISTS (SELECT 1 FROM "${n}" x${o})`})}function ks(e,t){let n={depth:0,refExpr:hg(t),row:"c"};if(e.kind==="count")return`(SELECT COUNT(*) FROM "${e.entity}" c WHERE ${Rt(e.where,n)}) = ${String(e.value)}`;if(e.kind==="exists")return`EXISTS (SELECT 1 FROM "${e.entity}" c WHERE ${Rt(e.where,n)})`;if(e.kind==="singleton")throw new Error("sql-match: singleton conditions are evaluated by the scalar stage");if(e.kind==="not")return`NOT (${ks(e.predicate,t)})`;let r=e.predicates.map(o=>ks(o,t)),i=e.kind==="and"?" AND ":" OR ";return`(${r.join(i)})`}function hg(e){return t=>{let n=t.indexOf("."),r=n===-1?void 0:e.get(t.slice(0,n));if(r==null)throw new Error(`sql-match: unresolved ref "${t}"`);return`${r}."${t.slice(n+1)}"`}}function Pe(e,t){let n=Es(e,t);if(n==null)return null;let r=yg(e.scalars,t,uu(n));return r==null?null:e.conditions.every(o=>Ft(o,{env:r,snapshot:t}))?r:null}function Es(e,t){return ou(e,t)}function Kr(e,t){let n=Es(e,t);if(n==null)return{kind:"entities"};let r=mg(e.scalars,t,uu(n));if(r.unmet!=null)return r.unmet;let i=e.conditions.find(o=>!Ft(o,{env:r.env,snapshot:t}));return i==null?null:{condition:i,kind:"condition"}}function mg(e,t,n){return[...e.values()].reduce((r,i)=>{if(r.unmet!=null)return r;let o=au(i,t,r.env);if(o!=null)return{env:o,unmet:null};let s=lu(i.subject,r.env),a=s==null?void 0:cu(t,s),l=i.expect.expect==="absent"?null:i.expect.value;return{env:r.env,unmet:{got:a,kind:"scalar",subject:i.subject,want:l}}},{env:n,unmet:null})}function au(e,t,n){let r=lu(e.subject,n);if(r==null)return null;let i=cu(t,r);return e.expect.expect==="absent"?i===void 0?n:null:e.expect.expect==="not"?Rg({clause:e.expect.value,env:n,got:i,snapshot:t,subject:r}):gg({clause:e.expect.value,env:n,got:i,snapshot:t,subject:r})}function yg(e,t,n){return[...e.values()].reduce((r,i)=>r==null?null:au(i,t,r),n)}function gg({clause:e,env:t,got:n,snapshot:r,subject:i}){if(Sg(i,e,t))return n===void 0?null:new Map([...t,[Ne(bg(e)),n]]);if(!jn(e,M,t))return null;let o=Ce(e,M,{counts:ge(r),env:t});return Nt({got:n,subject:i,want:{expect:"is",value:o}})?t:null}function Sg(e,t,n){return e.kind==="element"&&(e.state==="value"||e.state==="text")&&W(t)&&!jn(t,M,n)}function bg(e){if(!W(e))throw new Error("expected a ref clause");return e.ref}function lu(e,t){return e.kind!=="element"?e:wg(e.locator,t)?{...e,locator:de(e.locator,Re(t))}:null}function wg(e,t){return[...Vn(e,n=>n==null?[]:[n])].every(n=>jn(n,M,t))}function cu(e,t){let n=e.scalars.get(R(t));return n==null||n.expect.expect!=="is"?void 0:n.expect.value}function Rg({clause:e,env:t,got:n,snapshot:r,subject:i}){if(!jn(e,M,t))return null;let o=Ce(e,M,{counts:ge(r),env:t});return Nt({got:n,subject:i,want:{expect:"not",value:o}})?t:null}function uu(e){return new Map([...e].flatMap(([t,n])=>Object.entries(n).flatMap(r=>{let i=r[1];return typeof i=="string"||typeof i=="number"||typeof i=="boolean"?[[Ne(`${t}.${r[0]}`),i]]:[]})))}function Me(e,t){return[...new Map(e.map(n=>[t(n),n])).values()]}function du(e){return[...vg(e.action),...e.expect.flatMap(t=>lt(t))]}function lt(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=tt(e.value)?e.value.value:e.value;return[...we(e.locator),...G(t)]}case"singleton":return G(e.assertion.value);case"browser":return G(e.value);case"state":return[...e.assertion.kind==="deleted"?[]:Object.values(xt(e.assertion.props)).flatMap(t=>G(t)),...Object.values(e.key).flatMap(t=>Cs(t))];case"not":return lt(e.predicate);case"when":return e.branches.flatMap(t=>[...t.condition==null?[]:lt(t.condition),...t.consequence.flatMap(n=>lt(n))]);case"and":case"or":return e.predicates.flatMap(t=>lt(t));case"count":case"exists":return Object.values(e.where).flatMap(t=>Cs(t));case"actor":return e.target.kind==="anonymous"?[]:[e.target.ref.ref]}}function vg(e){return e.kind==="goto"?G(e.url):e.kind==="actor"?[e.ref.ref]:e.kind==="fill"||e.kind==="select"?[...we(e.locator),...G(e.value)]:e.kind==="press"?e.locator==null?[]:we(e.locator):e.kind==="drag"?[...we(e.source),...we(e.target)]:we(e.locator)}function Cs(e){return ue(e)?Object.values(e.selection.where).flatMap(t=>Cs(t)):ye(e)?(e.kind==="anyOf"?e.values:[e.value]).flatMap(n=>G(n)):G(e)}function Hr(e){return e.flatMap(t=>t.kind==="and"?Hr(t.predicates):[t])}function kt(e){return Hr(e).filter(t=>!Jt(t))}function Yr(e){return e.action.kind==="goto"?!0:As(e.expect).some(t=>t.kind==="browser"&&t.name==="url"&&t.value!==null)}function _t(e){return e.action.kind==="goto"?!0:As(e.expect).some(t=>t.kind==="browser"&&t.name==="url"&&t.value!==null&&(t.part===void 0||t.part.kind==="path"))}function As(e){return e.flatMap(t=>t.kind==="and"?As(t.predicates):[t])}function qe(e,t){return t.reduce((n,r)=>{let i=[...Mg(r),...Gn(r),...Og(r)],o=xg(r,n,i)?Pg(n):n;return i.reduce((s,a)=>ps(s,a),o)},e)}function he(e){return e.kind==="not"?kg(e.predicate):e.kind==="singleton"?{expect:{expect:"is",value:e.assertion.value},subject:{kind:"variable",name:e.singleton}}:Eg(e)}function zn(e){return Bc(jc(e)).map(({clause:t,key:n})=>({expect:t===null?{expect:"absent"}:{expect:"is",value:t},subject:n}))}function xg(e,t,n){if(e.action.kind==="goto")return!0;if(!_t(e))return!1;let r=t.get(R({kind:"path"})),i=n.find(o=>o.subject.kind==="path");return i==null?!1:r==null||S(r.expect)!==S(i.expect)}function kg(e){return e.kind==="value"||e.kind==="text"?tt(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 tt(e.value)?null:{expect:{expect:"is",value:e.value},subject:{kind:"element",locator:e.locator,state:e.kind}};let n=Cg(e);return n==null?null:{expect:{expect:"is",value:n.value!==t},subject:{kind:"element",locator:n.locator,state:n.state}}}function Eg(e){return e.kind==="browser"?{expect:e.value===null?{expect:"absent"}:{expect:"is",value:e.value},subject:Vr(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 Gn(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 Cg(e){return Ag(e)?e.kind==="disabled"?{locator:e.locator,state:"enabled",value:!1}:{locator:e.locator,state:e.kind,value:!0}:null}function Ag(e){return e.kind==="visible"||e.kind==="disabled"||e.kind==="enabled"||e.kind==="focused"||e.kind==="checked"||e.kind==="expanded"||e.kind==="pressed"}function Pg(e){return new Map([...e].filter(([,t])=>t.subject.kind==="variable"||t.subject.kind==="viewport"))}function Mg(e){return e.action.kind==="goto"?zn(e.action.url):[]}function Og(e){return kt(e.expect).flatMap(t=>{let n=he(t);return n==null?[]:[n]})}function Ps(e){return e.includes("async")?"async":e.includes("slow")?"slow":"fast"}var ct={async:12e4,fast:5e3,slow:3e4},Ms={async:{backoffMs:[500,1e3,2e3,5e3],timeoutMs:ct.async},fast:{backoffMs:[100,250,500,1e3],timeoutMs:ct.fast},slow:{backoffMs:[250,500,1e3,2e3],timeoutMs:ct.slow}};function fu(e,t){return e.backoffMs[Math.min(t,e.backoffMs.length-1)]??0}function re(e){return`${e.workflow}/${e.slug}`}var hu=new WeakMap;function J(e){let t=hu.get(e);if(t!=null)return t;let n=e.workflows.flatMap(r=>r.tests.map(i=>({ref:re(i),test:i,workflow:r})));return hu.set(e,n),n}function Ke(e){return`${e.test}#${String(e.index)}`}function qn(e){let t=J(e).flatMap(n=>Kn(e,n.test));return Me(t,n=>`${n.test}:${S(n.steps)}`)}function Kn(e,t){let n=Su(t),r=gu(n,t.singletons,t.actor),i=Qg(t,Jg(e)),o=Tg(e,t),s=gs(e);return Ng(r,eS(t.steps),n).reduce((l,{chunk:c,requiredState:u},d)=>({offset:l.offset+c.length,transitions:[...l.transitions,Yg({chunk:c,identities:s,index:d,intent:t.intent,namespace:n.namespace,paramSpaceOf:i,requiredState:u,testRef:re(t),whenChunk:o.slice(l.offset,l.offset+c.length)})]}),{offset:0,transitions:[]}).transitions}function mu(e){return[R({kind:"viewport"}),{expect:{expect:"is",value:e},subject:{kind:"viewport"}}]}var Ig=R({kind:"viewport"});function yu(e){let t=e.scalars.get(Ig);return t==null||t.expect.expect!=="is"||typeof t.expect.value!="string"?null:t.expect.value}function gu(e,t,n){return{absences:Gg(e),actor:n,conditions:[],entities:Hg(e),exclusives:e.exclusives,scalars:new Map(Object.entries(t).filter(([,r])=>!W(r)&&!Ue(r)).map(([r,i])=>[R({kind:"variable",name:r}),{expect:{expect:"is",value:i},subject:{kind:"variable",name:r}}]))}}function Tg(e,t){let n=e.workflows.find(r=>r.name===t.workflow);return n==null||n.steps.length!==t.steps.length?t.steps:n.steps}function Zr(e,t,n){return Object.values(e).flatMap(r=>W(r)?sn(r.ref,n):[]).find(r=>r.entity===t)?.aliasPath}function Hn(e,t){return t.reduce((n,r)=>$g(r)??n,e)}function $g(e){if(e.action.kind==="actor")return{alias:e.action.ref.ref,kind:"user"};let t=e.expect.find(n=>n.kind==="actor");return t==null?null:t.target.kind==="anonymous"?vc:{alias:t.target.ref.ref,kind:"user"}}function Ng(e,t,n){return t.reduce((r,i)=>({requiredState:Lg(r.requiredState,i,n),withRequiredState:[...r.withRequiredState,{chunk:i,requiredState:zg(r.requiredState,i)}]}),{requiredState:e,withRequiredState:[]}).withRequiredState}function Lg(e,t,n){let r=t.flatMap(i=>i.expect.filter(o=>o.kind==="state")).reduce((i,o)=>Dg(i,o,n),e);return{...r,actor:Hn(r.actor,t),scalars:qe(r.scalars,t)}}function Dg(e,t,n){return t.assertion.kind==="deleted"?Fg(e,t,n):t.assertion.kind==="created"?Bg(e,t.entity,t.assertion.as,t.assertion.props,n):Wg(e,t,n)}function Fg(e,t,n){let r=Zr(t.key,t.entity,n.namespace),i=e.entities.find(a=>a.alias===r),o=Yn(_g(t.key),n),s=i==null?{entity:t.entity,params:{},...o}:{entity:i.entity,params:{},...jg(i,o)};return{...e,absences:[...e.absences,s],entities:e.entities.filter(a=>a.alias!==r)}}function _g(e){return Object.fromEntries(Object.entries(e).flatMap(t=>{let n=t[1];return ue(n)||ye(n)?[]:[[t[0],n]]}))}function jg(e,t){return{literals:{...e.literals,...t.literals},relations:[...e.relations.filter(n=>!t.relations.some(r=>r.field===n.field)),...t.relations]}}function Bg(e,t,n,r,i){let o=Yn(r,i);return{...e,absences:e.absences.filter(s=>s.entity!==t||!Vg(o,s)),entities:[...e.entities,{alias:n,entity:t,...o}]}}function Vg(e,t){return Object.entries(t.literals).every(([r,i])=>e.literals[r]===i)&&t.relations.every(r=>e.relations.some(i=>i.field===r.field&&i.targetAlias===r.targetAlias&&i.targetField===r.targetField))}function Wg(e,t,n){if(t.assertion.kind!=="updated")return e;let r=Zr(t.key,t.entity,n.namespace);if(r==null)return e;let i=Yn(xt(t.assertion.props),n),o=Object.entries(t.assertion.props).filter(([,a])=>vt(a)).map(([a])=>a),s=a=>a.alias===r?Ug(a,i,o):a;return{...e,entities:e.entities.map(a=>s(a))}}function Ug(e,t,n){let r=Object.entries(e.literals).filter(([i])=>!n.includes(i)&&!(i in t.literals));return{...e,literals:{...Object.fromEntries(r),...t.literals},relations:[...e.relations.filter(i=>!t.relations.some(o=>o.field===i.field)),...t.relations]}}function zg(e,t){return t[0]?.action.kind!=="goto"?e:{...e,scalars:new Map([...e.scalars].filter(([,n])=>n.subject.kind==="variable"||n.subject.kind==="viewport"))}}function Xr(e,t){let n=Su(t);return{namespace:n.namespace,requiredState:gu(n,t.singletons,t.actor)}}function Os(e,t){return[...new Set(e)].flatMap(n=>sn(n,t))}function Su(e){return{absences:e.absent,exclusives:e.exclusive,namespace:new Map(e.world.map(t=>[t.as,t.entity])),setups:e.world}}function Gg(e){return e.absences.map(t=>({entity:t.entity,...Yn(t.where,e),params:qg(t.where,e)}))}function Yn(e,t){let n=Object.entries(e),r=Object.fromEntries(n.flatMap(([o,s])=>W(s)||Ue(s)?[]:[[o,s]])),i=n.flatMap(o=>{let s=o[1];if(!W(s))return[];let a=sn(s.ref,t.namespace).at(0);return a==null?[]:[{entity:a.entity,field:o[0],targetAlias:a.aliasPath,targetField:a.field}]});return{literals:r,relations:i}}function qg(e,t){return Object.fromEntries(Object.entries(e).flatMap(n=>{let r=n[1];return!W(r)||sn(r.ref,t.namespace).at(0)!=null?[]:[[n[0],r.ref]]}))}function Kg(e,t){return e.map(n=>({alias:n.as,entity:n.entity,...Yn(n.set,t)}))}function Hg(e){return Kg(e.setups,e)}function sn(e,t){let n=Tc(e);if(n==null)return[];let r=t.get(n.alias);return r==null?[]:[{aliasPath:n.alias,entity:r,field:n.field,ref:e}]}function Yg(e){let t=e.chunk.findIndex(s=>s.action.kind!=="goto"),n=t===-1?e.chunk:e.chunk.slice(0,t),r=e.chunk.slice(n.length),i=r.at(-1)??e.chunk.at(-1);if(i==null)throw new Error("empty transition chunk");let o=[...new Set(e.chunk.flatMap(s=>du(s)))];return{effectStep:i,identities:e.identities,index:e.index,intent:e.intent,namespace:e.namespace,nav:n,paramSpaces:Object.fromEntries(o.filter(s=>e.paramSpaceOf.has(s)).map(s=>[s,e.paramSpaceOf.get(s)])),requiredState:e.requiredState,steps:r,test:e.testRef,wait:Ps(e.chunk.flatMap(s=>[...Zg(s),...Xg(s)])),whenSteps:e.whenChunk}}function Zg(e){return e.expect.flatMap(t=>t.kind==="state"&&t.wait!=null?[t.wait]:[])}function Xg(e){return Yr(e)?["slow"]:[]}function Jg(e){return new Map(e.valueSpaces.map(t=>[t.name,t]))}function Qg(e,t){return new Map(Object.entries(e.params).map(([n,r])=>[n,t.get(r.valueSpace)]))}function eS(e){return e.map(t=>[t])}function Jr(e){return Me(J(e).flatMap(t=>tS(e,t.test)),Is)}function Is(e){return S({holds:ke(e.holds),reference:e.reference,when:ke(e.when)})}function Qr(e,t){return Pe(e.when,t)==null?!1:Pe(e.holds,t)==null}function tS(e,t){let n=Xr(e,t);return n.requiredState.entities.flatMap(r=>r.relations.flatMap(i=>nS(e,r,i,n.namespace)?oS(r,i,n.namespace):[]))}function nS(e,t,n,r){let i=r.get(n.targetAlias);return i!=null&&!rS(e,t.entity,n.field)&&iS(e,i,n.targetField)}function rS(e,t,n){return e.entities.find(r=>r.name===t)?.props[n]?.optional===!0}function iS(e,t,n){return e.entities.find(r=>r.name===t)?.identity.includes(n)===!0}function oS(e,t,n){let r=n.get(t.targetAlias);if(r==null)return[];let i=bu(e.alias,e.entity),o=bu(t.targetAlias,r);return[{holds:rt({entities:[{...i,relations:[t]},o]}),reference:{field:t.field,source:e.entity,target:r,targetField:t.targetField},when:rt({entities:[i]})}]}function bu(e,t){return{alias:e,entity:t,literals:{},relations:[]}}function wu(e){return e.kind==="data-rule"?S({kind:e.kind,rule:Is(e.dataRule)}):S(e)}function an(e){return e.filter(t=>t.kind!=="unrunnable")}function ei({actual:e,canon:t,pre:n,predicted:r}){return[...[...new Set([...r.entities.keys(),...e.entities.keys()])].flatMap(s=>cS({actual:e.entities.get(s),canon:t,entity:s,pre:n.entities.get(s),predicted:r.entities.get(s)})),...sS(n.scalars,r.scalars,e.scalars)]}function sS(e,t,n){let r=He(n,R({kind:"path"}))!==void 0;return[...[...t.entries()].flatMap(([o,s])=>{if(s.subject.kind==="actor")return[];let a=He(n,o),l=r&&bt(s.subject)&&s.expect.expect!=="absent",c=a===void 0&&l?null:a;if(!s.declared||c===void 0||Nt({got:c,subject:s.subject,want:s.expect}))return[];let u=He(e,o);return[{mismatch:{kind:"scalar-mismatch",subject:s.subject,sut:c,want:s.expect},pending:u!==void 0&&Zn(u,c)}]}),...aS(e,t,n),...lS(e,t,n)]}function He(e,t){let n=e.get(t);return n==null||n.expect.expect!=="is"?void 0:n.expect.value}function aS(e,t,n){let r=R({kind:"path"});if(He(n,r)===void 0)return[];let i=!Zn(He(e,r),He(n,r));return[...new Set([...e.keys(),...n.keys()])].flatMap(s=>{let a=(e.get(s)??n.get(s))?.subject;if(a==null||!bt(a)||t.has(s))return[];let c=i&&a.kind!=="path"?null:He(e,s)??null,u=He(n,s)??null;return Zn(c,u)?[]:[{mismatch:{kind:"scalar-mismatch",subject:a,sut:u,want:{expect:"is",value:c}},pending:!1}]})}function lS(e,t,n){let r=R({kind:"actor"}),i=t.get(r);if(i==null)return[];let o=He(n,r);if(Nt({got:o,subject:{kind:"actor"},want:i.expect}))return[];let s=He(e,r);return[{mismatch:{kind:"scalar-mismatch",subject:{kind:"actor"},sut:o??null,want:i.expect},pending:s!==void 0&&Zn(s,o)}]}function cS({actual:e,canon:t,entity:n,pre:r,predicted:i}){return[...new Set([...i?.keys()??[],...e?.keys()??[]])].flatMap(s=>uS({actual:e?.get(s),canon:t,entity:n,key:s,predicted:i?.get(s),preHadKey:r?.has(s)??!1,preRow:r?.get(s)}))}function uS({actual:e,canon:t,entity:n,key:r,predicted:i,preHadKey:o,preRow:s}){if(i==null)return[{mismatch:{entity:n,key:r,kind:"unexpected-row",row:e},pending:o}];if(e==null)return[{mismatch:{entity:n,key:r,kind:"missing-row"},pending:!o}];let a=(c,u,d)=>Zn(t(n,c,u),t(n,c,d));return[...new Set([...Object.keys(i),...Object.keys(e)])].filter(c=>!a(c,i[c],e[c])).map(c=>({mismatch:{entity:n,field:c,key:r,kind:"wrong-value",snapshot:i[c],sut:e[c]},pending:s==null?e[c]===void 0:a(c,s[c],e[c])}))}function Zn(e,t){return Ru(e)===Ru(t)}function Ru(e){return e==null?"\u2205":JSON.stringify(e)}function ti(e){let t=dS(e.entities),n=pS(e.singletons);return r=>fS(r,t,n)}function dS(e){return new Map(e.flatMap(t=>Object.entries(t.props).map(([n,r])=>[vu(t.name,n),r.consistency])))}function vu(e,t){return`${e}.${t}`}function pS(e){return new Map(e.map(t=>[t.name,t.consistency]))}function fS(e,t,n){return e.kind==="scalar-mismatch"?hS(e.subject,n):e.kind==="unexpected-row"||e.kind==="missing-row"?"strict":t.get(vu(e.entity,e.field))??"strict"}function hS(e,t){return e.kind==="variable"?t.get(e.name)??"strict":"eventual"}function ni(e){let t=new Set(e.valueSpaces.filter(n=>n.kind==="datetime").map(n=>n.name));return(n,r,i)=>{if(!t.has(`${n}.${r}`)||typeof i!="string")return i;let o=Date.parse(i);return Number.isNaN(o)?i:new Date(o).toISOString()}}function Ts({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 mS=Ts();function $s(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!e.includes("\x1B")&&!e.includes("\x9B")?e:e.replace(mS,"")}function Ns(e,t,n){return{detail:n.slice(0,500),kind:"engine-http",path:e,status:t}}function ln(e,t){return{code:Au(t),kind:"engine-network",message:Xn(t),path:e}}function ri(e){return{kind:"client-mount-missing",mountKey:e}}function Ls(e,t){return{kind:"app-not-ready",readyKey:e,timeoutMs:t}}function Ds(e,t){return{kind:"engine-decode",message:Xn(t),path:e}}function Fs(e,t){return{entity:e,field:t,kind:"state-identity"}}function _s(e){return{as:e,kind:"setup-missing-row"}}function Ye(e){return{kind:"driver-launch",message:Xn(e)}}function js(e){return{kind:"engine-unreachable",url:e}}function Bs(e,t){return{action:e,kind:"action-failed",message:Xn(t)}}function Vs(e){return{kind:"check-failed",message:Xn(e)}}function Ws(){return{kind:"aborted"}}var yS=["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"],gS=new Set(yS);function ii(e){if(typeof e!="object"||e==null||!("kind"in e))return!1;let{kind:t}=e;return typeof t=="string"&&gS.has(t)}var SS=["app-not-ready","client-mount-missing","driver-launch","engine-decode","engine-http","engine-network","engine-unreachable"],ku=new Set(SS);function oi(e){return ku.has(e.kind)}function Eu(e){return ku.has(e)}var xu=300;function jt(e){switch(e.kind){case"engine-http":return`engine ${e.path} returned ${String(e.status)}: ${Cu(e.detail)}${vS(e.status)}`;case"engine-network":return`engine ${e.path} request failed: ${e.message}${bS(e.code)}${RS(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 Cu(e){let t=e.replaceAll(/\s+/gu," ").trim();return t.length<=xu?t:`${t.slice(0,xu)}\u2026 [truncated]`}function bS(e){return e==null?"":` (${e})`}var wS=new Set(["EAI_AGAIN","ECONNREFUSED","ENOTFOUND"]);function RS(e,t){return e!=null&&wS.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 vS(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 Au(e){if(!(typeof e!="object"||e==null))return"code"in e&&typeof e.code=="string"?e.code:"cause"in e?Au(e.cause):void 0}function Xn(e){let t=e instanceof Error?e.message:String(e);return Cu($s(t))}var De=class extends Error{name="AbortError";constructor(){super("aborted")}};function Jn(e){return e instanceof Error&&e.name==="AbortError"}function Oe(e){if(e.aborted)throw new De}function Et(e,t){return t.aborted?Promise.reject(new De):new Promise((n,r)=>{let i=()=>{clearTimeout(o),r(new De)},o=setTimeout(()=>{t.removeEventListener("abort",i),n()},e);t.addEventListener("abort",i,{once:!0})})}var xS={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 Pu(e){let t=xS[e.kind]??e.kind;return e.kind==="press"&&e.key!=null?`${t}: ${e.key}`:t}function si(e){return e.kind==="data-rule"?"data rule":Mu(e.check)}function Mu(e){return e.kind==="not"?`not ${Mu(e.inner)}`:e.kind==="browser"?en(e.key):`${Us(e.locator)} ${e.kind}`}function Us(e){return e.by==="testId"?"element":e.by==="inside"?Us(e.target):e.by==="surface"?Us(e.container):e.role}function Ou(e){return e.kind==="goto"?e.url:e.kind==="press"?e.key:e.value==null?void 0:String(e.value)}function ai(e){return e.kind==="data-rule"?void 0:Tu(e.check)}function Iu(e){return e.kind==="data-rule"?!1:li(e.check)}function li(e){return e.kind==="not"?li(e.inner):e.kind==="browser"&&_c(e.key)}function Tu(e){if(e.kind==="not")return Tu(e.inner);if(e.kind==="value"||e.kind==="text"||e.kind==="browser")return e.value??void 0}function $u({atMs:e,findings:t,step:n}){return n.urlChecks.map(r=>({atMs:e,ephemeral:!1,kind:"assertion",label:si({check:r,kind:"step"}),outcome:t.length>0?"failed":"passed",rrwebIds:[],url:!0,value:ai({check:r,kind:"step"})}))}function ci({action:e,actionLabel:t,outcome:n,rrwebIds:r,startMs:i}){return{atMs:i,ephemeral:!1,kind:"action",label:t,outcome:n,rrwebIds:r,url:!1,value:Ou(e)}}var kS=()=>[],ES=()=>Le;async function di({canon:e,classify:t,dataRuleChecks:n,derive:r,initialSnapshot:i,observe:o,onAssertion:s,onStep:a,steps:l,stopAfterStep:c},u){return _u({acc:[],canon:e,classify:t,dataRuleChecks:n??kS,derive:r??ES,index:0,observe:o,onAssertion:s,onStep:a,signal:u,snapshot:i,steps:l,stopAfterStep:c})}async function _u({acc:e,canon:t,classify:n,dataRuleChecks:r,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=Pu(m.step.action);if(!m.requiredState(u)){let w={kind:"impossible-action",step:m.step};return zs(l,{annotations:[ci({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:rn(u)}),{finalModel:u,findings:[...e,w]}}return m.perform().match(()=>CS({acc:e,actionLabel:h,canon:t,classify:n,dataRuleChecks:r,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 v=ui(w,m);return zs(l,{annotations:[ci({action:m.step.action,actionLabel:h,outcome:"failed",rrwebIds:f,startMs:y})],endMs:Date.now(),findings:[v],index:o,post:u,pre:u,source:m.source,startMs:y,url:rn(u)}),Promise.resolve({finalModel:u,findings:[...e,v]})})}async function CS({acc:e,actionLabel:t,canon:n,classify:r,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),v=o(w),g={...w,scalars:Ae(v,w.scalars)},x=await TS({canon:n,claimed:new Set([...y.assertedScalars,...v.keys()]),classify:r,observe:a,pre:p,predicted:g,signal:d,step:y}),T={...x.snapshot,scalars:new Map([...[...x.snapshot.scalars].filter(([,fe])=>fe.subject.kind!=="element"),...[...w.scalars].filter(([,fe])=>fe.subject.kind==="element")])},j=Date.now(),te=[...y.pendingChecks,...i(p,x.snapshot)],V=await AS({onAssertion:l,pendingChecks:te,signal:d,step:y}),z=[...V.findings,...x.findings];zs(c,{annotations:[ci({action:y.step.action,actionLabel:t,outcome:z.length>0?"failed":"passed",rrwebIds:u,startMs:m}),...$u({atMs:j,findings:x.findings,step:y}),...V.annotations],endMs:Date.now(),findings:z,index:s,post:x.snapshot,pre:p,source:y.source,startMs:m,url:rn(x.snapshot)});let ne=[...e,...z];return z.length>0?{finalModel:T,findings:ne}:h!=null&&s+1>=h?{finalModel:T,findings:ne}:_u({acc:ne,canon:n,classify:r,dataRuleChecks:i,derive:o,index:s+1,observe:a,onAssertion:l,onStep:c,signal:d,snapshot:T,steps:f,stopAfterStep:h})}async function AS({onAssertion:e,pendingChecks:t,signal:n,step:r}){let i=[...new Map(t.map(s=>[wu(s.source),s])).values()],o=await Promise.all(i.map(async s=>{let a=await PS(s,n),l=Date.now(),c=await s.targetIds();return{atMs:l,outcome:a,pendingCheck:s,rrwebIds:c}}));return o.forEach(s=>{MS(e,s.pendingCheck,s.outcome,r)}),{annotations:o.filter(s=>s.pendingCheck.source.kind==="step").map(s=>({atMs:s.atMs,ephemeral:s.pendingCheck.ephemeral,kind:"assertion",label:si(s.pendingCheck.source),outcome:ju(s.outcome),rrwebIds:s.rrwebIds,url:Iu(s.pendingCheck.source),value:ai(s.pendingCheck.source)})),findings:o.flatMap(s=>OS(s.pendingCheck,s.outcome,r))}}function PS(e,t){if(e.check.kind==="decided"){let n=e.check.passed?"passed":"failed";return Promise.resolve({kind:n})}return e.check.wait(Ms[e.budget].timeoutMs).match(n=>n?{kind:"passed"}:{kind:"failed"},n=>{if(n.kind==="aborted")throw new De;return{error:n,kind:"error"}})}function MS(e,t,n,r){e?.({outcome:ju(n),source:t.source,step:r.step,waitBudget:t.budget,waitMs:ct[t.budget]})}function ju(e){return e.kind==="passed"?"passed":e.kind==="error"?"error":"failed"}function OS(e,t,n){return t.kind==="error"?[ui(t.error,n)]:t.kind==="failed"?[{budget:e.budget,kind:"pending-check",source:e.source,step:n.step}]:[]}function ui(e,t){return{error:e,kind:"driver-error",step:t.step}}function zs(e,t){e?.(t)}function Nu(e){return e().match(t=>({observed:t,ok:!0}),t=>({error:t,ok:!1}))}function IS(e,t,n){return n.reconcile==null?e:n.reconcile(e,t)}function Lu({canon:e,pre:t,predicted:n,step:r},i){let o=r.verifyChanges==null?[]:r.verifyChanges(n,i),s=IS(n,i,r),a=o.map(l=>({mismatch:l,pending:!0}));return{adopted:s,probed:[...a,...ei({actual:i.snapshot,canon:e,pre:t,predicted:s})]}}function Bu(e,t){return{budget:t.sync,kind:"consistency",mismatch:e.mismatch,pending:e.pending,step:t.step}}function Du(e,t,n){let r=e.probed.filter(i=>!i.pending&&n(i.mismatch)==="strict");return r.length>0?{findings:r.map(i=>Bu(i,t)),snapshot:e.adopted}:e.probed.length===0?{findings:[],snapshot:e.adopted}:null}function Fu(e,t,n){return{findings:[...e.probed.map(r=>Bu(r,t)),...n],snapshot:e.adopted}}async function TS({canon:e,claimed:t,classify:n,observe:r,pre:i,predicted:o,signal:s,step:a}){let l=Ms[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=()=>r(d),m=await Nu(p);if(!m.ok)return{findings:[ui(m.error,a)],snapshot:o};let y=Lu({canon:e,pre:i,predicted:o,step:a},m.observed),f=0;for(;Date.now()<c;){Oe(s);let h=Du(y,a,n);if(h!=null)return h;await Et(fu(l,f),s),f+=1;let w=await Nu(p);if(!w.ok)return Fu(y,a,[ui(w.error,a)]);y=Lu({canon:e,pre:i,predicted:o,step:a},w.observed)}return Du(y,a,n)??Fu(y,a,[])}function Gs(e){let t=e.predicates.filter(o=>Ku(o)),n=t.filter(o=>o.assertion.kind==="created"),r=zu(t);if(n.length===0&&r.length===0&&e.deferred.length===0)return;let i=t.filter(o=>o.assertion.kind==="updated");return(o,s)=>{let a=n.reduce((u,d)=>_S(u,s,d,e),{env:e.env,snapshot:o}),l=r.reduce((u,d)=>FS(u,s,d,e.env),a.snapshot),c=i.reduce((u,d)=>$S(u,s,d),a.env);return WS(l,e.deferred,c)}}function Uu(e,t,n){return new Map([...e,...Object.entries(n).map(([r,i])=>[Ee(M,`${t}.${r}`),i])])}function $S(e,t,n){let r=at(t.snapshot,n.entity,n.key,e).at(0);return r==null?e:Uu(e,n.assertion.as,r)}function qs(e){let t=zu(e.predicates.filter(n=>Ku(n)));if(t.length!==0)return(n,r)=>t.flatMap(i=>NS(i,n,r,e.env))}function zu(e){return e.filter(t=>t.assertion.kind==="updated"&&Gu(t.assertion.props).length>0)}function Gu(e){return qu(e).map(([t])=>t)}function qu(e){return Object.entries(e).flatMap(([t,n])=>vt(n)?[[t,n.direction]]:[])}function Ku(e){return e.assertion.kind==="created"||e.assertion.kind==="updated"}function NS(e,t,n,r){let i=at(t,e.entity,e.key,r).at(0),o=at(n.snapshot,e.entity,e.key,r).at(0);if(i==null||o==null)return[];let s=Bn(LS(e.key,r));return qu(e.assertion.props).flatMap(([a,l])=>DS(i[a],o[a],l)?[]:[{direction:l,entity:e.entity,field:a,from:i[a],key:s,kind:"expected-change",value:o[a]}])}function LS(e,t){let n=Object.fromEntries(Object.entries(e).filter(r=>!ue(r[1])&&!ye(r[1])));return Qt(n,M,Re(t))}function DS(e,t,n){return n==null?Vu(e)!==Vu(t):n==="increased"?Wu(e,t):Wu(t,e)}function Vu(e){return e==null?"\u2205":JSON.stringify(e)}function Wu(e,t){return(typeof e=="number"&&typeof t=="number"||typeof e=="string"&&typeof t=="string")&&e<t}function FS(e,t,n,r){let i=Gu(n.assertion.props),o=at(t.snapshot,n.entity,n.key,r).at(0);return o==null?e:Kc(e,n.entity,n.key,r,s=>({...s,...Object.fromEntries(i.flatMap(a=>{let l=o[a];return l===void 0?[]:[[a,l]]}))}))}function _S(e,t,n,r){if(n.assertion.kind!=="created")return e;let i=Qt(n.assertion.props,M,Re(r.env)),o=e.snapshot.entities.get(n.entity);if(o==null)return e;let s=jS({identityFields:r.identities.get(n.entity)??[],props:i,set:o});if(s==null)return e;let a=BS(t.snapshot.entities.get(n.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:Uu(e.env,n.assertion.as,c),snapshot:{...e.snapshot,entities:new Map(e.snapshot.entities).set(n.entity,u)}}}function jS({identityFields:e,props:t,set:n}){let r=Bn(t);if(n.has(r))return r;if(e.length===0)return null;let i=Object.entries(t),o=[...n].find(([,s])=>e.every(a=>qc(s[a]))&&i.every(([a,l])=>pi(s[a])===pi(l)));return o==null?null:o[0]}function BS(e,t,n){if(e==null)return;let r=Object.entries(n),i=[...e].filter(([o])=>!t.has(o)).map(([o,s])=>({entry:[o,s],score:r.filter(([a,l])=>pi(s[a])===pi(l)).length}));return VS(i,r.length)}function pi(e){return e==null?"\u2205":JSON.stringify(e)}function VS(e,t){let n=e.reduce((i,o)=>Math.max(i,o.score),0);if(n===0)return;let r=e.filter(i=>i.score===n);if(!(n<t&&r.length!==1))return r[0]?.entry}function WS(e,t,n){let r=t.reduce((i,o)=>{let s=US(o.value,n);return s==null||typeof s!="string"?i:ot(i,{declared:!0,expect:{expect:"is",value:s},subject:o.key})},e.scalars);return{...e,scalars:r}}function US(e,t){try{return ze(e,M,Re(t))}catch{return}}function Ks(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:de(e.locator,t)};if(e.kind==="not"){let n=Ks(e.predicate,t);return n==null?null:{inner:n,kind:"not"}}return e.kind==="value"||e.kind==="text"?zS(e,t):e.kind!=="browser"?null:{key:Vr(e.name,e.part),kind:"browser",value:e.value===null?null:ze(e.value,M,t)}}function cn(e,t){let{env:n,identities:r}=t,i=e.expect.filter(f=>f.kind==="state"),o=eb(i),s=t.snapshot==null?void 0:on(t.snapshot,i,t),a={counts:s==null?void 0:ge(s),env:n},l={counts:t.snapshot==null?void 0:ge(t.snapshot),env:n},{clears:c,deferred:u,sets:d}=HS(e,a,o),p=Yr(e),m=tb(e.action,l),y=GS(e);return{action:m,assertedScalars:[...d.keys()],label:e.action.kind,pendingChecks:e.expect.flatMap(f=>ib(f,a,p)),reconcile:Gs({deferred:u,env:n,identities:r,predicates:i}),urlChecks:e.expect.flatMap(f=>rb(f,a)),verifyChanges:qs({deferred:u,env:n,identities:r,predicates:i}),effect:f=>Gc(on(f,i,t),{clears:c,forget:y,sets:d})}}function zS(e,t){let n=tt(e.value);return{kind:e.kind,locator:de(e.locator,t),match:n?e.value.kind:"exact",value:ze(n?e.value.value:e.value,M,t)}}function GS(e){return e.action.kind==="goto"||e.action.kind==="actor"||qS(e)?"hard":_t(e)?"soft-path":"none"}function qS(e){return e.expect.some(t=>t.kind==="actor")}function KS(e){return e.action.kind!=="actor"?null:{expect:{expect:"is",value:{ref:`${e.action.ref.ref}.id`}},subject:{kind:"actor"}}}function HS(e,t,n){let r=e.action.kind==="goto"?zn(e.action.url):[],i=KS(e),o=kt(e.expect).flatMap(l=>{let c=he(l);return c==null?[]:[c]}),s=[...r,...o,...i==null?[]:[i]].map(l=>({declared:!0,entry:l}));return[...Gn(e).map(l=>({declared:!1,entry:l})),...s].reduce((l,{declared:c,entry:u})=>YS({acc:l,captures:n,declared:c,entry:u,scope:t}),{clears:[],deferred:[],sets:Le})}function YS({acc:e,captures:t,declared:n,entry:r,scope:i}){if(ZS(r,t))return r.expect.expect==="is"&&Hu(r.expect.value)?{...e,deferred:[...e.deferred,{key:QS(r.subject),value:r.expect.value}]}:e;let o=st({declared:n,entry:r,scope:i});return o.expect.expect==="absent"&&!bt(o.subject)?{...e,clears:[...e.clears,R(o.subject)]}:{...e,sets:ot(e.sets,o)}}function ZS(e,t){return e.subject.kind==="element"||e.subject.kind==="variable"?!1:e.expect.expect==="is"&&Hu(e.expect.value)&&XS(e.expect.value,t)}function Hu(e){return typeof e=="string"||typeof e=="object"}function XS(e,t){return JS(e).some(n=>t.has(n.split(".")[0]??n))}function JS(e){return typeof e=="string"?[]:W(e)?[e.ref]:e.template.filter(t=>typeof t!="string").map(t=>t.ref)}function QS(e){if(e.kind==="element"||e.kind==="variable"||e.kind==="actor")throw new Error("expected a browser subject");return e}function eb(e){return new Set(e.flatMap(t=>t.assertion.kind==="created"||t.assertion.kind==="updated"?[t.assertion.as]:[]))}function tb(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:nb(e,t),target:e.kind==="drag"?de(e.target,t):void 0,url:e.kind==="goto"?ze(e.url,M,t):void 0,value:"value"in e?Nc(e.value,t):void 0}}function nb(e,t){if(e.kind==="drag")return de(e.source,t);if(!(!("locator"in e)||e.locator==null))return de(e.locator,t)}function rb(e,t){if(e.kind!=="browser"&&e.kind!=="not")return[];try{let n=Ks(e,t);return n!=null&&li(n)?[n]:[]}catch{return[]}}function ib(e,t,n){if(e.kind==="browser"||e.kind==="singleton")return[];let r=Ks(e,t),i=n?"slow":"fast",o="wait"in e?e.wait??i:i;return r==null?[]:[{budget:o,check:r,ephemeral:Jt(e)}]}import{err as ob,errAsync as sb,ok as Yu,okAsync as Zu,Result as ab}from"neverthrow";function un(e,t,n){let r=gb(e),i={env:new Map,generate:n.generate,generatedParams:new Set,indexed:r,overrides:new Map(Object.entries(n.params??{}).map(([s,a])=>[Ne(s),a]))};Sb(t.params,M,i);let o=t.world.map(s=>bb(s,M,i));return n.materialize(o).andThen(s=>xb(s,i.env,r).asyncAndThen(a=>lb({base:a,rows:s,signIn:n.signIn,test:t}).map(l=>cb({base:l,generatedParams:i.generatedParams,lockfile:e,test:t}))))}function fi(e,t){let n=new Map(t.map(r=>[r.name,r]));return r=>Zu(hb(r,e,n).rows)}function hi(e){return t=>{let n=t.map(r=>({as:r.as,entity:r.entity,fields:r.fields}));return e(n).andThen(r=>fb(t,r))}}function Ys(e,t){let n=Qn(t);return Object.fromEntries(Object.entries(e).filter(([r,i])=>n.includes(r)&&i!=null))}function Qn(e){return Object.keys(e.props)}function lb({base:e,rows:t,signIn:n,test:r}){if(r.actor.kind!=="user"||n==null)return Zu(e);let i=r.actor.alias,o=t.find(s=>s.as===i);return o==null?sb(_s(i)):n({entity:o.entity,row:o.row}).map(s=>({...e,auth:s}))}function cb({base:e,generatedParams:t,lockfile:n,test:r}){let i=Object.fromEntries(n.singletons.map(d=>[d.name,d.default])),o=Object.fromEntries(Object.entries(r.singletons).map(([d,p])=>[d,Ce(p,M,Re(e.env))])),s=Object.entries(r.singletons).filter(([,d])=>ub(d,t)).map(([d])=>d),a={...i,...o},l=new Set(n.singletons.filter(d=>d.source==="client").map(d=>d.name)),c=Object.fromEntries(Object.entries(a).filter(([d])=>l.has(d))),u=db(e.aliases,r);return{...e,clientState:c,generatedSingletons:s,snapshot:{...e.snapshot,scalars:Ae(e.snapshot.scalars,new Map([...Object.entries(a).map(([d,p])=>[R({kind:"variable",name:d}),{declared:!0,expect:{expect:"is",value:p},subject:{kind:"variable",name:d}}]),...u,...pb(r)]))}}}function ub(e,t){return W(e)?t.has(Ee(M,e.ref)):Ue(e)?e.template.some(n=>typeof n!="string"&&"ref"in n&&t.has(Ee(M,n.ref))):!1}function db(e,t){if(t.actor.kind!=="user")return[];let n=t.actor.alias,r=e.find(i=>i.alias===n);return r==null?[]:[[R({kind:"actor"}),{declared:!1,expect:{expect:"is",value:r.key},subject:{kind:"actor"}}]]}function pb(e){return[[R({kind:"viewport"}),{declared:!1,expect:{expect:"is",value:e.viewport},subject:{kind:"viewport"}}]]}function fb(e,t){let n=new Map(t.map(r=>[r.as,r]));return ab.combine(e.map(r=>{let i=n.get(r.as);return i==null?ob(_s(r.as)):Yu({as:r.as,entity:r.entity,generatedFields:r.generatedFields,row:i.row})}))}function hb(e,t,n){return e.reduce((r,i)=>{let o=mb(i.fields,r.env),s=kb({generate:t,model:i.model,seedPrefix:i.seedPrefix,set:o,valueSpaces:n}),a=Object.entries(s).map(([c,u])=>[`${i.as}.${c}`,u]),l=Object.keys(s).filter(c=>!(c in o));return{env:new Map([...r.env,...a]),rows:[...r.rows,{as:i.as,entity:i.entity,generatedFields:[...new Set([...i.generatedFields,...l])],row:s}]}},{env:new Map,rows:[]})}function mb(e,t){return Object.fromEntries(Object.entries(e).map(([n,r])=>{if(W(r))return[n,yb(t,r.ref)];if(Ue(r))throw new Error(`template value not allowed in entity field "${n}"`);return[n,r]}))}function yb(e,t){let n=e.get(t);if(n==null)throw new Error(`setup ref "${t}" was not produced by an earlier entity`);return n}function gb(e){return{models:new Map(e.entities.map(t=>[t.name,t])),valueSpaces:new Map(e.valueSpaces.map(t=>[t.name,t]))}}function Sb(e,t,n){Object.entries(e).forEach(([r,i])=>{let o=Ee(t,r),s=n.indexed.valueSpaces.get(i.valueSpace);if(s==null)throw new Error(`unknown valueSpace "${i.valueSpace}" for param "${o}"`);let a=n.overrides.get(o);a==null&&n.generatedParams.add(o);let l=a??n.generate.value({anchor:void 0,nullable:!1,seed:o,space:s,type:Sc(s),valueSpace:i.valueSpace});n.env.set(o,l)})}function bb(e,t,n){let r=n.indexed.models.get(e.entity);if(r==null)throw new Error(`model "${e.entity}" not found for setup "${e.as}"`);let i=Ee(t,e.as),o=wb(e.set,t,n.env),s=vb(r,o,i,n),a=Object.entries(e.set).filter(([,l])=>W(l)&&n.generatedParams.has(Ee(t,l.ref))).map(([l])=>l);return{as:i,entity:e.entity,fields:{...s,...o},generatedFields:[...Object.keys(s),...a],model:r,seedPrefix:i}}function wb(e,t,n){return Object.fromEntries(Object.entries(e).map(([r,i])=>[r,Rb(i,t,n)]))}function Rb(e,t,n){if(!W(e))return e;let r=Ee(t,e.ref);return n.get(r)??{ref:r}}function vb(e,t,n,r){return Object.fromEntries(Object.entries(e.props).filter(([i,o])=>!o.optional&&!e.identity.includes(i)&&!(i in t)).map(([i,o])=>[i,Xu({field:i,generate:r.generate,model:e,seedPrefix:n,spec:o,valueSpaces:r.indexed.valueSpaces})]))}function xb(e,t,n){let r=new Map;e.forEach(a=>{let l=n.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(Ee(Ne(a.as),u),d));let c=r.get(a.entity)??new Map;c.set(Hs(a.row,l),Ys(a.row,l)),r.set(a.entity,c)});let i=e.flatMap(a=>{let l=n.models.get(a.entity);return l==null?[]:[{alias:a.as,entity:a.entity,key:Hs(a.row,l)}]}),o=e.flatMap(a=>{let l=n.models.get(a.entity);if(l==null)return[];let c=Hs(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 Yu({aliases:i,auth:void 0,env:t,generated:o,principals:s,snapshot:{entities:Eb(r),scalars:Le}})}function kb({generate:e,model:t,seedPrefix:n,set:r,valueSpaces:i}){return{...Object.fromEntries(Object.entries(t.props).filter(([s])=>!(s in r)).map(([s,a])=>[s,Xu({field:s,generate:e,model:t,seedPrefix:n,spec:a,valueSpaces:i})])),...r}}function Xu({field:e,generate:t,model:n,seedPrefix:r,spec:i,valueSpaces:o}){let s=`${n.name}.${e}`;return t.value({anchor:void 0,nullable:i.optional,seed:Ee(r,e),space:o.get(s),type:i.type,valueSpace:s})}function Hs(e,t){return t.identity.map(n=>String(e[n])).join(":")}function Eb(e){return new Map([...e].map(([t,n])=>[t,new Map(n)]))}function er(e,t,n){let r=Pe(e.requiredState,t);return r==null?null:new Map([...Object.entries(n).map(([i,o])=>[Ne(i),o]),...r])}function tr(e,t,n){let r={env:t,identities:e.identities,snapshot:n},i=Zc(e.whenSteps,n,r),o=i.at(-1)??e.effectStep,s=cn(o,r),a=Ab(e,r),l=i.reduce((c,u)=>{let d=cn(u,{...r,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:n,steps:[]});return{effect:Pb(s.effect,a),steps:l.steps}}function yi(e,t,n){return Pe(e.requiredState,n)==null?!1:mi(t(n))!==mi(n)||Mb(e)||Cb(e)}function Cb(e){return[...e.nav,...e.steps].every(t=>t.expect.every(n=>n.kind!=="state"))}var Ju=new WeakMap;function mi(e){let t=Ju.get(e);if(t!=null)return t;let n=S({entities:[...e.entities].toSorted(([r],[i])=>r.localeCompare(i)).map(([r,i])=>[r,[...i].toSorted(([o],[s])=>o.localeCompare(s))]),scalars:hs(e.scalars).map(([r,i])=>[r,i.expect])});return Ju.set(e,n),n}function Ab(e,t){let n=e.nav.at(-1);if(n!=null)return cn(n,t).action.url}function Pb(e,t){if(t==null)return e;let n=nn(t);return r=>{let i=e(r);return{...i,scalars:Ae(i.scalars,n)}}}function Mb(e){return e.effectStep.expect.some(t=>t.kind==="state"&&t.assertion.kind==="updated"&&Object.values(t.assertion.props).some(n=>vt(n)))}function dn(e,t,n){let r=er(e,t.snapshot,n);if(r==null)return null;let i=Ob(e,r,t.snapshot);return i==null||!yi(e,i.effect,t.snapshot)?null:{next:{snapshot:i.effect(t.snapshot)},resolved:i}}function Qu(e,t,n){let r=er(e,t.snapshot,n);if(r==null)return"required-state-unsatisfied";try{return tr(e,r,t.snapshot),"no-effect"}catch{return"unresolvable"}}function Ob(e,t,n){try{return tr(e,t,n)}catch{return null}}function gi(e,t,n){return e.flatMap((r,i)=>{let o=n(r),s=dn(r,t,o);return s==null?[]:[{idx:i,label:Ke(r),params:o,stepRun:s}]})}import{createHash as $b}from"crypto";function ed(e,t){let n=rt({conditions:e.when,...Ib(e,t)});return e.expect.map(r=>({consequence:r,localConsequence:!1,origin:{kind:"declared",name:e.name},refs:new Set,when:n}))}var Zs="@actor";function Ib(e,t){if(!e.when.some(o=>Xs(o).some(s=>s.startsWith(`${Zs}.`))))return{};let r=t.entities.filter(o=>o.principal),i=r[0];if(i==null||r.length>1)throw new Error(`the declared fact "${e.name}" uses actor.id, which needs exactly one principal entity`);return{actor:{alias:Zs,kind:"user"},entities:[{alias:Zs,entity:i.name,literals:{},relations:[]}]}}function Xs(e){return e.kind==="not"?Xs(e.predicate):e.kind==="and"||e.kind==="or"?e.predicates.flatMap(t=>Xs(t)):e.kind==="singleton"?G(e.assertion.value):Object.values(e.where).flatMap(t=>td(t))}function td(e){return ue(e)?Object.values(e.selection.where).flatMap(t=>td(t)):ye(e)?Tb(e):G(e)}function Tb(e){switch(e.kind){case"not":case"compare":return G(e.value);case"anyOf":return e.values.flatMap(t=>G(t));case"contains":case"startsWith":return G(e.value)}}function Xe(e){return e.surfaces.filter(t=>t.by==="surface"&&t.overlay)}function Si(e,t){return{...e,scalars:bi(e.scalars,t)}}function bi(e,t){return id(e,t,n=>({expect:{expect:"is",value:!1},subject:{kind:"element",locator:n,state:"visible"}}))}function rd(e,t){let n=id(e.scalars,t,r=>({declared:!1,expect:{expect:"is",value:!1},subject:{kind:"element",locator:de(r,Re(new Map)),state:"visible"}}));return{...e,scalars:n}}function id(e,t,n){let r=t.filter(i=>!e.has(nd(i))).map(i=>[nd(i),n(i)]);return r.length===0?e:new Map([...e,...r])}function nd(e){return R({kind:"element",locator:e,state:"visible"})}var od=new WeakMap;function ut(e){let t=od.get(e);if(t!=null)return t;let n=$b("sha256").update(S({consequence:e.consequence,when:ke(e.when)})).digest("base64");return od.set(e,n),n}function Ri(e){let t=e.facts.flatMap(o=>ed(o,e)),n=new Set(Xe(e).map(o=>S(ce(o)))),r=J(e).map(o=>Qs(e,o)),i=Me(r.flatMap(o=>o.steps.flatMap(s=>s.facts)),ut).filter(o=>!Nb(o.consequence,n));return Promise.resolve([...t,...i])}function Js(e,t){return e.filter(n=>!_b(n)||jb(n)===t)}function vi(e){return e.kind==="not"?vi(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 Nb(e,t){if(e.kind!=="visible")return!1;let n=ce(e.locator);return t.has(S(n))?!0:n.by==="inside"&&t.has(S(ce(n.scope)))}function xi(e,t){if(e.facts.length===0)return t;let n=nr(e,t);return n.size===0?t:{...t,scalars:Ae(n,t.scalars)}}function nr(e,t){let n=rd(t,e.overlays),r=e.facts.flatMap(s=>{let a=Pe(s.when,n);if(a==null)return[];let l=Lb(s.consequence,a,n);return l==null?[]:[{entry:l,factKey:ut(s),key:R(l.subject)}]}),i=r.filter(s=>!Fb({m:s,matched:r,overrides:e.overrides})),o=Db(i);return i.reduce((s,a)=>o.has(a.key)?s:ot(s,a.entry),Le)}function Lb(e,t,n){let r=he(e);if(r==null)return null;try{return st({declared:!0,entry:r,scope:{counts:ge(n),env:t}})}catch{return null}}function Db(e){let t=e.reduce((n,r)=>new Map([...n,[r.key,[...n.get(r.key)??[],S(r.entry.expect)]]]),new Map);return new Set([...t].flatMap(([n,r])=>new Set(r).size>1?[n]:[]))}function Fb({m:e,matched:t,overrides:n}){let r=n.get(e.factKey);return r==null?!1:t.some(i=>i.key===e.key&&r.has(i.factKey))}function _b(e){return e.origin?.kind==="test"&&e.localConsequence}function jb(e){let{origin:t}=e;if(!(t==null||t.kind!=="test"))return t.test}var sd=new WeakMap;function Qs(e,t){let n=sd.get(t);if(n!=null)return n;let r=Bb(e,t);return sd.set(t,r),r}function Bb(e,{test:t,workflow:n}){let r=Xr(e,t),i=Vb(r,t.viewport),o=Xe(e),s=Wb(n.steps),a=t.steps.reduce((l,c)=>{let u=zb(l.requiredState,c,i,o),d=Qb({branchConditions:s,namespace:i.namespace,origin:{kind:"test",test:re(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:Si(i.requiredState,o),steps:[]});return{initial:Si(i.requiredState,o),steps:a.steps}}function Vb(e,t){return{...e,requiredState:{...e.requiredState,scalars:new Map([...e.requiredState.scalars,mu(t)])}}}function Wb(e){return e.flatMap(n=>n.expect).flatMap(n=>wi(n)).reduce((n,r)=>{let i=S(r.consequence),o=n.get(i),s=o==null?r.condition:{kind:"or",predicates:[o,r.condition]};return new Map([...n,[i,s]])},new Map)}function wi(e){return e.kind==="not"?wi(e.predicate):e.kind==="and"||e.kind==="or"?e.predicates.flatMap(t=>wi(t)):e.kind!=="when"?[]:e.branches.flatMap((t,n)=>{let r=Ub(e.branches,n);return t.consequence.flatMap(i=>[{condition:r,consequence:i},...wi(i)])})}function Ub(e,t){let n=e.slice(0,t).flatMap(o=>o.condition==null?[]:[o.condition]).map(o=>({kind:"not",predicate:o})),r=e[t]?.condition,i=r==null?n:[...n,r];return i.length===1&&i[0]!=null?i[0]:{kind:"and",predicates:i}}function zb(e,t,n,r){let{entities:i}=Gb(e,t,n),o=qe(e.scalars,[t]),s=Hn(e.actor,[t]);return Si({...e,actor:s,entities:i,scalars:o},r)}function Gb(e,t,n){return t.expect.reduce((r,i)=>i.kind==="state"?qb(r,i,n):r,e)}function qb(e,t,n){if(t.assertion.kind==="created"){let o=Kb(t.assertion.as,t.entity,t.assertion.props,n);return{...e,entities:[...e.entities,o]}}let r=Zr(t.key,t.entity,n.namespace);if(r==null)return e;if(t.assertion.kind==="deleted")return Zb(e,r);let i=xt(t.assertion.props);return{...e,entities:e.entities.map(o=>o.alias===r?cd(o,i,n):o)}}function Kb(e,t,n,r){return cd({alias:e,entity:t,literals:{},relations:[]},n,r)}function cd(e,t,n){return Object.entries(t).reduce((r,[i,o])=>{if(Ue(o))return r;if(W(o)){let s=Hb(o.ref,i,n.namespace);return{...r,literals:Yb(r.literals,i),relations:s==null?r.relations:[...ad(r.relations,i),s]}}return{...r,literals:{...r.literals,[i]:o},relations:ad(r.relations,i)}},e)}function Hb(e,t,n){let[r]=sn(e,n);return r==null?void 0:{entity:r.entity,field:t,targetAlias:r.aliasPath,targetField:r.field}}function Yb(e,t){return Object.fromEntries(Object.entries(e).filter(([n])=>n!==t))}function ad(e,t){return e.filter(n=>n.field!==t)}function Zb(e,t){let n=e.entities.find(i=>i.alias===t),r=Xb(e,t);return n==null?r:{...r,absences:[...r.absences,{entity:n.entity,literals:n.literals,params:{},relations:n.relations}]}}function Xb(e,t){return{...e,entities:e.entities.filter(n=>n.alias!==t)}}var Jb=16;function Qb(e){return kt(e.step.expect).filter(t=>vi(t)).flatMap(t=>ew(t,e))}function ew(e,t){let n=he(e);if(n==null)return[];if(lt(e).some(a=>t.paramNames.has(a)))return[];let r=R(n.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!==r))},s=tw(o,t.pre,t.paramNames);return s==null||s.entities.length>Jb?[]:ke(s)===ke(t.pre)?[]:[{consequence:e,localConsequence:Os(lt(e),t.namespace).length>0,origin:t.origin,refs:new Set(Os([...rw(s),...lt(e)],t.namespace).map(a=>a.aliasPath)),when:s}]}function tw(e,t,n){let r=[...e.scalars.values()].map(i=>nw(i,t,n));return r.some(i=>i==null)?null:{...e,scalars:new Map(r.flatMap(i=>i==null?[]:[[R(i.subject),i]]))}}function nw(e,t,n){if(!ld(e,n))return e;if(e.subject.kind!=="element"||e.expect.expect==="absent"||we(e.subject.locator).some(i=>n.has(i)))return null;let r=t.scalars.get(R(e.subject));return r==null||r.expect.expect!=="is"||ld(r,n)?null:{expect:{expect:"not",value:r.expect.value},subject:e.subject}}function ld(e,t){let n=e.expect.expect==="absent"?[]:G(e.expect.value);return[...e.subject.kind==="element"?we(e.subject.locator):[],...n].some(i=>t.has(i))}function rw(e){return[...e.scalars.values()].flatMap(t=>bt(t.subject)&&t.expect.expect!=="absent"?G(t.expect.value):[])}function ea(e,t){let n=[...t.entities].flatMap(([o,s])=>[...s].map(([a,l])=>iw({entity:o,key:a,pre:e,row:l}))),r=[...e.entities].flatMap(([o,s])=>[...s].flatMap(([a,l])=>ow({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:ae(e.scalars,o.subject)!==o.expect.value,name:s,value:o.expect.value}]});return{rows:[...n,...r],singletons:i}}function iw({entity:e,key:t,pre:n,row:r}){let i=sw(n.entities.get(e),t),o=Object.entries(r).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 ow({entity:e,key:t,post:n,row:r}){if(n.entities.get(e)?.has(t)===!0)return[];let i=Object.entries(r).map(([o,s])=>({changed:!1,field:o,value:s}));return[{changed:!0,entity:e,fields:i,key:t,status:"deleted"}]}function sw(e,t){return e?.get(t)}function pn(e,t,n){return t.steps.map(r=>({assertedScalars:r.assertedScalars,effect:r.effect,pendingChecks:r.pendingChecks.map(i=>({budget:i.budget,check:{kind:"poll",wait:o=>n.awaitCheck(i.check,o)},ephemeral:i.ephemeral,source:{check:i.check,kind:"step"},targetIds:()=>n.locateIds(ud(i.check))})),reconcile:r.reconcile,source:r.source,step:{action:r.action,intent:e.intent,test:e.test},sync:e.wait,urlChecks:r.urlChecks,verifyChanges:r.verifyChanges,perform:()=>n.perform(r.action),requiredState:()=>!0,targetIds:()=>n.locateIds(r.action.locator)}))}function ud(e){if(e.kind==="not")return ud(e.inner);if(e.kind!=="browser")return e.locator}async function dd({current:e,driver:t,index:n,next:r,state:i}){if(r==null||aw(r))return[];if(_t(e.transition.effectStep))return[];let o=dn(r.transition,i,r.params);if(o==null)return[];let s=pn(r.transition,o.resolved,t).flatMap(c=>c.pendingChecks.flatMap(u=>{let d=lw(u.source);return d==null?[]:[d]}));if(s.length===0)return[];let a=new Map(s.map(c=>{let u={kind:"element",locator:c,state:"visible"};return[R(u),{declared:!0,expect:{expect:"is",value:!0},subject:u}]})),l=await t.observe(a).match(c=>c,()=>null);return l==null?[]:s.filter(c=>{let u={kind:"element",locator:c,state:"visible"},d=ae(l.snapshot.scalars,u)===!0,p=ae(i.snapshot.scalars,u)===!1;return d&&p}).map(c=>({declaredIndex:n+1,kind:"lift-visibility",locator:c,visibleIndex:n}))}function aw(e){return e.transition.nav.length>0||e.transition.steps.some(t=>t.action.kind==="goto"||_t(t))}function lw(e){if(e.kind!=="data-rule")return e.check.kind==="visible"?e.check.locator:void 0}async function na(e,t){let{params:n,transition:r}=e.stepRun,i={snapshot:xi(e.facts,e.state.snapshot)},o=dn(r,i,n);if(o==null){let a=Qu(r,i,n),l={intent:r.intent,kind:"unrunnable",reason:a,test:r.test,unmet:a==="required-state-unsatisfied"?Kr(r.requiredState,i.snapshot)??void 0:void 0};return{label:Ke(r),next:e.state,result:{finalModel:e.state.snapshot,findings:[l]}}}let s=await di({canon:e.canon,classify:e.classify,initialSnapshot:e.state.snapshot,observe:e.driver.observe,onAssertion:e.onAssertion,onStep:e.onStep,steps:pn(e.stepRun.transition,o.resolved,e.driver),stopAfterStep:e.stopAfterStep==null?void 0:e.stopAfterStep-e.stepBase,dataRuleChecks:(a,l)=>e.dataRules.flatMap(c=>fd(c,l)),derive:a=>nr(e.facts,a)},t);return{label:Ke(e.stepRun.transition),next:{snapshot:s.finalModel},result:s}}function fd(e,t){return Qr(e,t)?[{budget:"fast",check:{kind:"decided",passed:!1},ephemeral:!1,source:{dataRule:e,kind:"data-rule"},targetIds:()=>Promise.resolve([])}]:[]}function ki(e,t){return ta({acc:{findings:[],ran:[]},index:0,params:e,signal:t,state:e.initialState,stepBase:0})}async function ta({acc:e,index:t,params:n,signal:r,state:i,stepBase:o}){Oe(r);let s=n.sequence[t];if(s==null)return e;let a=Date.now(),l=[],c=await na({canon:n.canon,classify:n.classify,dataRules:n.dataRules,driver:n.driver,facts:n.facts,onAssertion:n.onAssertion,state:i,stepBase:o,stepRun:s,stopAfterStep:n.stopAfterStep,onStep:p=>{l.push(p.index),n.onEvent({annotations:p.annotations,endMs:p.endMs,findings:p.findings,index:o+p.index,kind:"step",source:p.source,startMs:p.startMs,state:ea(p.pre,p.post),url:p.url})}},r);if(c==null)return ta({acc:e,index:t+1,params:n,signal:r,state:i,stepBase:o});n.onEvent({endMs:Date.now(),intent:s.transition.intent,kind:"ran",startMs:a});let u=await cw({index:t,outcome:c,params:n,signal:r,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||n.stopAfterStep!=null&&o+l.length>=n.stopAfterStep?d:ta({acc:d,index:t+1,params:n,signal:r,state:c.next,stepBase:o+l.length})}async function cw(e,t){let{index:n,outcome:r,params:i,stepBase:o,stepRun:s}=e,a=t.length>0;!a&&r.result.findings.length>0&&pd(i,s,e.state,o,r.result.findings);let l=i.sequence[n+1],c=a?await dd({current:s,driver:i.driver,index:n,next:l,state:r.next}):[];return r.result.findings.forEach(u=>{i.onEvent({finding:u,kind:"finding"})}),c.length>0&&l!=null&&pd(i,l,r.next,o+t.length,c),c}function pd(e,t,n,r,i){let o=Date.now(),s=ae(n.snapshot.scalars,{kind:"path"});e.onEvent({annotations:[],endMs:o,findings:i,index:r,kind:"step",source:t.transition.steps[0]??t.transition.effectStep,startMs:o,state:ea(n.snapshot,n.snapshot),url:typeof s=="string"?s:null})}var hd=new WeakMap;function fn(e){let t=hd.get(e);if(t!=null)return t;let n={entities:e.entities,singletonSchemas:e.singletons,valueSpaces:e.valueSpaces};return Ic(n,e.solved),hd.set(e,n),n}import*as Ed from"remeda";var md=new WeakMap;function ra(e){let t=md.get(e);if(t!==void 0)return t;let n=uw(e);return md.set(e,n),n}function uw(e){let t=bw(e);return t==null?null:{absenceKeys:new Set(e.absences.map(n=>S(n))),conditionKeys:new Set(e.conditions.map(n=>S(n))),pinned:hw(e),snapshot:t,specific:e}}var yd=new WeakMap,gd=new WeakMap;function ia(e,t){if(t==null)return null;let n=gd.get(e)??new Map;gd.set(e,n);let r=ke(t.specific),i=n.get(r);if(i!==void 0)return i;let o=dw(e,t);return n.set(r,o),o}function Ci(e,t){return ia(e,ra(t))}function dw(e,t){let{absenceKeys:n,conditionKeys:r,pinned:i,snapshot:o,specific:s}=t,a=pw(e);if(!a.conditionKeys.every(p=>r.has(p))||!a.scalarEntries.every(([p])=>s.scalars.has(p)))return!1;let l=a.absenceEntries.filter(p=>!n.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])=>fw({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=rt({absences:l,actor:e.actor,entities:e.entities,exclusives:e.exclusives,scalars:u});return Pe(d,o)!=null}function pw(e){let t=yd.get(e);if(t!=null)return t;let n={absenceEntries:e.absences.map(r=>({absence:r,key:S(r)})),conditionKeys:e.conditions.map(r=>S(r)),entityOf:new Map(e.entities.map(r=>[r.alias,r.entity])),scalarEntries:[...e.scalars]};return yd.set(e,n),n}function fw({entry:e,generalEntityOf:t,host:n,key:r,pinned:i}){if(n==null)return"false";let o=S(n.expect)===S(e.expect);return o&&yw(e.expect)?"skip":n.expect.expect!=="is"?mw({entry:e,host:n,identical:o}):e.expect.expect==="absent"?"false":gw({entry:e,generalEntityOf:t,key:r,pinned:i,want:e.expect,wantOfHost:n.expect})}function hw(e){let t=new Map(e.entities.map(o=>[o.alias,o.entity])),r=[...[...e.scalars.values()].flatMap(o=>[...o.expect.expect==="absent"?[]:G(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=r.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(r),byEntity:new Set(i)}}function mw({entry:e,host:t,identical:n}){return n||t.expect.expect==="absent"&&e.expect.expect==="not"?"defer":"false"}function yw(e){return e.expect==="absent"?!0:G(e.value).every(t=>!t.includes("."))}function gw({entry:e,generalEntityOf:t,key:n,pinned:r,want:i,wantOfHost:o}){if(Sd(i.value)||Sd(o.value))return"false";if(i.expect==="not")return G(i.value).length===0&&G(o.value).length===0?[n,e]:"defer";let s=new Set(G(i.value).filter(a=>a.includes(".")).map(a=>Sw({generalEntityOf:t,pinned:r,ref:a})));return s.has("false")?"false":s.has("defer")?"defer":[n,{expect:vd(i),subject:kd(e.subject)}]}function Sw({generalEntityOf:e,pinned:t,ref:n}){if(t.byAlias.has(n))return"ok";let r=n.indexOf("."),i=e.get(n.slice(0,r));return i==null?"false":t.byEntity.has(`${i}.${n.slice(r+1)}`)?"defer":"false"}function Sd(e){return e!==null&&typeof e=="object"&&"template"in e&&e.template.some(t=>typeof t!="string"&&"count"in t)}var bd=new WeakMap;function bw(e){let t=bd.get(e);if(t!==void 0)return t;let n=ww(e);return bd.set(e,n),n}function ww(e){let t=Rw(e),n=Pe(rt({absences:e.absences,conditions:e.conditions,entities:e.entities,exclusives:e.exclusives}),t);if(n==null)return null;let r=xw(e,n,t);return r==null?null:{...t,scalars:vw(r,e)}}function Rw(e){let t=new Map(e.entities.map(s=>[s.alias,s])),n=[...e.scalars.values()].flatMap(s=>[...s.expect.expect==="absent"?[]:G(s.expect.value),...s.subject.kind==="element"?we(s.subject.locator):[]]),r=[...e.entities.flatMap(s=>s.relations.map(a=>[a.targetAlias,a.targetField])),...n.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(r.filter(([a])=>a===s.alias).map(([a,l])=>[l,wd(t,a,l)])),...s.literals,...Object.fromEntries(s.relations.map(a=>[a.field,wd(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 wd(e,t,n){let i=e.get(t)?.literals[n];return i!==void 0?i:`\xA4${t}.${n}`}function vw(e,t){return t.actor.kind!=="user"?e:new Map([...e,[R({kind:"actor"}),{declared:!1,expect:{expect:"is",value:t.actor.alias},subject:{kind:"actor"}}]])}function xw(e,t,n){let r=[...e.scalars.values()].filter(i=>i.expect.expect==="is").map(i=>{try{return st({declared:!0,entry:{expect:vd(i.expect),subject:kd(i.subject)},scope:{counts:ge(n),env:t}})}catch{return null}});return r.some(i=>i==null)?null:new Map(r.flatMap(i=>i==null?[]:[[R(i.subject),i]]))}function vd(e){return e.expect==="absent"?e:{...e,value:xd(e.value)}}function xd(e){return e===null||typeof e!="object"?e:"ref"in e?e.ref.includes(".")?e:`\xA4param:${e.ref}`:{template:e.template.map(t=>typeof t=="string"||"count"in t||t.ref.includes(".")?t:`\xA4param:${t.ref}`)}}function kd(e){return e.kind!=="element"?e:{...e,locator:Ei(e.locator)}}function Ei(e){return e.by==="inside"?{by:"inside",scope:Ei(e.scope),target:Ei(e.target)}:e.by==="role"?e.name==null?e:{...e,name:Rd(e.name)}:e.by==="surface"?{...e,container:Ei(e.container)}:{...e,value:Rd(e.value)}}function Rd(e){let t=xd(e);return typeof t=="string"||typeof t=="object"?kw(t,e):e}function kw(e,t){return typeof e=="string"||e!==null&&typeof e=="object"&&!("count"in e)?e:t}var Cd=new Map;async function Ai({context:e,facts:t}){let n=Ed.groupBy(t.filter(o=>he(o.consequence)!=null),o=>Ew(o)),i=Object.values(n).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})=>{it({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 it({context:e,general:s.when,specific:a.when}))||Ci(a.when,s.when)!==!1&&await it({context:e,general:a.when,specific:s.when}))return l;let d=ut(s),p=l.get(d)??new Set;return new Map([...l,[d,new Set([...p,ut(a)])]])},Promise.resolve(Cd))}function Ad(e){let t=he(e.consequence);if(t==null)return null;try{let n=st({declared:!0,entry:t,scope:Re(new Map)});return R(n.subject)}catch{return null}}function Ew(e){let t=he(e.consequence);if(t==null)throw new Error("fact consequence has no pattern entry");return R(t.subject)}import*as oa from"remeda";function Ct(e){return[...new Set(e.producers.map(t=>t.test))]}function rr(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 Pd(e,t){let{context:n,pool:r,timelines:i}=Aw(e,t),o=Cw(n),s=r.map(l=>yu(l.fact.when)),a=await Promise.all([...i.values()].map(l=>{let c=l.locked.test.viewport,u=r.filter((d,p)=>s[p]==null||s[p]===c);return Pw({entry:l,pool:u,resolve:o})}));return{pool:r,reports:a}}function Md(e,t){return{...Td(e.consequence),declared:e.origin?.kind==="test",key:ut(e),label:jr(e.consequence),labelTokens:Ec(e.consequence),origins:t}}function Cw(e){return(t,n)=>it({context:e,general:t,specific:n})}function Aw(e,t){let n=J(e),r=new Map(n.map(a=>[a.ref,{locked:a,timeline:Qs(e,a)}])),i=Tw(r),o=Iw(r),s=$w({facts:t,originSites:i,witnessSites:o});return{context:fn(e),pool:s,timelines:r}}async function Pw(e){let{entry:t,pool:n,resolve:r}=e,{locked:i}=t,o=new Set(t.timeline.steps.flatMap(c=>c.facts.map(u=>S(u.consequence)))),s=n.filter(c=>!c.originWorkflows.has(i.test.workflow)).filter(c=>!o.has(c.consequenceKey)),a=await Ow({candidates:s,resolve:r,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 Mw(e,t){return e.map(n=>({candidate:n,holds:ia(n.fact.when,t)}))}async function Ow({candidates:e,resolve:t,timeline:n}){let i=await[n.initial,...n.steps.map(o=>o.post)].reduce(async(o,s,a)=>{let l=await o,c=e.filter(f=>!l.has(f)),u=Mw(c,ra(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 n.steps.length===0?[]:[...i].map(([o,s])=>({borrowed:o.borrowed,stepIndex:s}))}function Od(e,t){return`${e}#${S(t)}`}function Iw(e){let t=[...e.values()].flatMap(n=>n.timeline.steps.flatMap((r,i)=>r.facts.map(o=>[Od(n.locked.ref,o.consequence),Id(n.locked,i)])));return new Map(Object.entries(oa.groupBy(t,([n])=>n)).map(([n,r])=>{let[,i]=r[0];return[n,i]}))}function Id(e,t){return{stepIndex:t,testRef:e.ref,testSlug:e.test.slug,workflowIntent:e.workflow.intent,workflowSlug:e.test.workflow}}function Tw(e){let t=[...e.values()].flatMap(n=>n.timeline.steps.flatMap((r,i)=>r.facts.map(o=>[ut(o),Id(n.locked,i)])));return new Map(Object.entries(oa.groupBy(t,([n])=>n)).map(([n,r])=>[n,r.map(([,i])=>i)]))}function $w({facts:e,originSites:t,witnessSites:n}){return e.filter(r=>!(r.origin?.kind==="test"&&r.localConsequence)).map(r=>{let i=ut(r),s=r.origin?.kind==="test"?t.get(i)??[]:Nw(r,n);return{borrowed:Md(r,s),consequenceKey:S(r.consequence),fact:r,originWorkflows:new Set(s.map(a=>a.workflowSlug))}}).filter(r=>r.borrowed.origins.length>0)}function Td(e){if(e.kind==="not"){let t=Td(e.predicate);return{...t,negated:!t.negated}}return"locator"in e?{checkKind:e.kind,negated:!1,subject:bc(de(e.locator,Re(new Map)))}:{checkKind:void 0,negated:!1,subject:void 0}}function Nw(e,t){return e.origin?.kind!=="generalized"?[]:Ct(e.origin).map(n=>{let r=t.get(Od(n,e.consequence));if(r==null)throw new Error(`missing witness site for ${n} in generalized fact origin`);return r})}function $d(e){let t;return n=>{if(t!==void 0&&t.input===n)return t.output;let r=e(n);return t={input:n,output:r},r}}var Pi=$d(async e=>{let t=fn(e),n=await Ri(e);return{dataRules:Jr(e),facts:n,overrides:await Ai({context:t,facts:n})}});function Nd(e){let t=Me(e,ke),n=Me(t.flatMap(c=>[...c.scalars.values()]),S),r=Me(t.flatMap(c=>c.entities),S),i=Me(t.flatMap(c=>c.absences),S),o=Mi(n,S),s=Mi(r,S),a=Mi(i,S),l=Mi(t,ke);return{absenceTable:i.map(c=>({...c,relations:[...c.relations]})),constraintTable:r.map(c=>({...c,relations:[...c.relations]})),patternTable:t.map(c=>({absences:c.absences.map(u=>Oi(a,S(u))),actor:c.actor,conditions:[...c.conditions],entities:c.entities.map(u=>Oi(s,S(u))),exclusives:[...c.exclusives],scalars:[...c.scalars.values()].map(u=>Oi(o,S(u)))})),scalarTable:n.map(c=>({expect:c.expect,subject:c.subject})),indexOf:c=>Oi(l,ke(c))}}function Ld(e){return e.patternTable.map(t=>({absences:t.absences.map(n=>At(e.absenceTable,n)),actor:t.actor,conditions:t.conditions,entities:t.entities.map(n=>At(e.constraintTable,n)),exclusives:t.exclusives,scalars:new Map(t.scalars.map(n=>{let r=At(e.scalarTable,n);return[R(r.subject),r]}))}))}function At(e,t){let n=e[t];if(n==null)throw new Error("compiled checks table index out of range \u2014 recompile");return n}function Mi(e,t){return new Map(e.map((n,r)=>[t(n),r]))}function Oi(e,t){let n=e.get(t);if(n==null)throw new Error("compiled checks pattern missing from table");return n}async function Fd(e){let t=await Pi(e),{pool:n,reports:r}=await Pd(e,t.facts),i=Nd([...t.facts.flatMap(a=>jw(a)),...t.dataRules.flatMap(a=>[a.when,a.holds])]),o=new Map(t.facts.map((a,l)=>[a,l])),s=new Map(n.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:n.map(a=>({fact:_d(o,a.fact),origins:a.borrowed.origins.map(l=>({...l}))})),factReports:r.map(a=>Uw(a,s)),facts:t.facts.map(a=>Bw(a,i)),overrides:Ww(t.overrides),patternTable:i.patternTable,scalarTable:i.scalarTable}}var Dd=new WeakMap;function hn(e){let t=Dd.get(e);if(t!=null)return t;let n=Lw(e),r=Ld(n),i={dataRules:n.dataRules.map(o=>({holds:At(r,o.holds),reference:o.reference,when:At(r,o.when)})),facts:n.facts.map(o=>Dw(o,r)),overrides:_w(n.overrides)};return Dd.set(e,i),i}function Lw(e){return e.checks}function _d(e,t){let n=e.get(t);if(n==null)throw new Error("compiled checks item missing from index");return n}function Dw(e,t){return{consequence:e.consequence,localConsequence:e.localConsequence,origin:Fw(e.origin,t),refs:new Set(e.refs),when:At(t,e.when)}}function Fw(e,t){return e==null||e.kind!=="generalized"?e:{kind:"generalized",producers:e.producers.map(n=>({test:n.test,when:At(t,n.when)}))}}function _w(e){return new Map(Object.entries(e).map(([t,n])=>[t,new Set(n)]))}function jw(e){let t=e.origin?.kind==="generalized"?e.origin.producers.map(n=>n.when):[];return[e.when,...t]}function Bw(e,t){return{consequence:e.consequence,localConsequence:e.localConsequence,origin:Vw(e.origin,t),refs:[...e.refs],when:t.indexOf(e.when)}}function Vw(e,t){return e==null||e.kind!=="generalized"?e:{kind:"generalized",producers:e.producers.map(n=>({test:n.test,when:t.indexOf(n.when)}))}}function Ww(e){return Object.fromEntries([...e].map(([t,n])=>[t,[...n].toSorted((r,i)=>r.localeCompare(i))]).toSorted(([t],[n])=>t.localeCompare(n)))}function Uw(e,t){return{steps:e.steps.map(n=>({borrowed:n.borrowed.map(r=>_d(t,r)),stepIndex:n.stepIndex})),testRef:e.testRef,testSlug:e.testSlug,workflowSlug:e.workflowSlug}}function Bd(e){let t=new Map;return e.forEach(n=>{zw(n).forEach(r=>{Ii(r,t)})}),t}function sa(e,t){let n=Gw(e.consequence,t);if(n.length===0)return e.when;let r=new Map(e.when.scalars);return n.forEach(i=>r.set(R(i.subject),i)),{...e.when,scalars:r}}function zw(e){let t=[...e.when.scalars.values()].flatMap(r=>r.subject.kind==="element"?[r.subject.locator]:[]),n=Vd(e.consequence);return n==null?t:[...t,n]}function Vd(e){return e.kind==="not"?Vd(e.predicate):"locator"in e?e.locator:void 0}function Ii(e,t){if(e.by==="inside"){let n=Wd(e.scope);t.set(n,[...t.get(n)??[],e]),Ii(e.scope,t),Ii(e.target,t);return}e.by==="surface"&&Ii(e.container,t)}function Wd(e){return Lr(e,"visible")}function Gw(e,t){let n=qw(e);if(n!=null)return(t.get(Wd(n))??[]).map(i=>jd(i,!1));let r=Kw(e);return r==null?[]:[jd(r,!0)]}function qw(e){return e.kind!=="not"||e.predicate.kind!=="visible"?null:e.predicate.locator}function jd(e,t){return{expect:{expect:"is",value:t},subject:{kind:"element",locator:e,state:"visible"}}}function Kw(e){return e.kind!=="visible"||e.locator.by!=="inside"?null:e.locator.scope}async function Gd({context:e,facts:t}){let r=[...t.reduce((s,a)=>{let l=he(a.consequence);if(l==null)return s;let c=R(l.subject);return new Map([...s,[c,[...s.get(c)??[],a]]])},new Map).values()].flatMap(s=>s.flatMap((a,l)=>s.slice(l+1).filter(c=>qd(a.consequence,c.consequence)).map(c=>[a,c]))),i=Bd(t),o=await Promise.all(r.map(async([s,a])=>{let l=await it({context:e,general:s.when,specific:a.when}),c=await it({context:e,general:a.when,specific:s.when});return l!==c?null:l||await Oc({aligned:!0,context:e,patterns:[sa(s,i),sa(a,i)]})?Zw(s,a):null}));return Xw(o.filter(s=>s!=null))}function qd(e,t){let n=he(e),r=he(t);return n==null||r==null||R(n.subject)!==R(r.subject)?!1:Hw(n,r)}function Hw(e,t){return Yw(e)?zd(e,t):e.expect.expect==="is"&&t.expect.expect==="is"?S(e.expect.value)!==S(t.expect.value):zd(e,t)}function Yw(e){return e.subject.kind==="element"&&e.subject.state==="text"}function Zw(e,t){let n=rr(e),r=rr(t);return{a:e.consequence,aProducers:n,b:t.consequence,bProducers:r,tests:[...new Set([...Ud(e),...Ud(t)])],when:e.when}}function Ud(e){return e.origin==null?[]:e.origin.kind==="declared"?[]:e.origin.kind==="test"?[e.origin.test]:Ct(e.origin)}function Xw(e){return[...e.reduce((n,r)=>{let i=[S(r.a),S(r.b)].toSorted((a,l)=>a.localeCompare(l)).join("|"),o=n.get(i),s=o==null?r:{...o,tests:[...new Set([...o.tests,...r.tests])]};return new Map([...n,[i,s]])},new Map).values()]}function zd(e,t){let n=[e.expect,t.expect],r=n.find(o=>o.expect==="is"),i=n.find(o=>o.expect==="not");return r==null||i==null?!1:S(r.value)===S(i.value)}function Kd(e,t){return e.flatMap(n=>{let r=Jw(n),i=new Set(n.requiredState.absences.map(o=>o.entity));return t.flatMap(o=>Qw(n,o,r,i))})}function Jw(e){return new Set(e.steps.flatMap(t=>t.expect.flatMap(n=>n.kind==="state"&&n.assertion.kind==="deleted"?[n.entity]:[])))}function Qw(e,t,n,r){let{source:i,target:o}=t.reference;return!n.has(o)||n.has(i)||r.has(i)?[]:[{dataRule:t,source:i,target:o,transition:Ke(e)}]}function Hd(e){return J(e).flatMap(t=>eR(t.test))}function eR(e){let t=new Map(e.world.map(r=>[r.as,r])),n=rR(e.steps);return e.steps.flatMap((r,i)=>r.expect.filter(o=>iR(o)).flatMap(o=>tR({createdAliases:n,predicate:o,setByAlias:t,stepIndex:i,test:e})))}function tR(e){let{createdAliases:t,predicate:n,setByAlias:r,stepIndex:i,test:o}=e,s=nR(n);if(s==null||t.has(s))return[];let a=r.get(s);return a==null?[]:Object.keys(n.assertion.props).filter(l=>!(l in a.set)).map(l=>({entity:n.entity,field:l,stepIndex:i,test:`${o.workflow}/${o.slug}`}))}function nR(e){return Object.values(e.key).flatMap(t=>W(t)?[t.ref.split(".")[0]]:[]).find(t=>t!=null)}function rR(e){return new Set(e.flatMap(t=>t.expect.flatMap(n=>n.kind==="state"&&n.assertion.kind==="created"?[n.assertion.as]:[])))}function iR(e){return e.kind==="state"&&e.assertion.kind==="updated"}function Yd(e){return J(e).flatMap(({test:t})=>oR(t.steps,re(t)))}function oR(e,t){return e.reduce((n,r)=>{let i=sR(r.action).filter(o=>!aR(o,n.pre)).map(o=>({action:r.action,ephemeralOnly:n.ephemeralKeys.has(S(ce(o))),target:o,test:t}));return{ephemeralKeys:new Set([...n.ephemeralKeys,...lR(r)]),pre:qe(n.pre,[r]),violations:[...n.violations,...i]}},{ephemeralKeys:new Set,pre:$t,violations:[]}).violations}function sR(e){return e.kind==="goto"||e.kind==="upload"?[]:e.kind==="drag"?[e.source,e.target]:"locator"in e&&e.locator!=null?[e.locator]:[]}function aR(e,t){let n=S(ce(e)),r=[...t.values()].filter(o=>o.subject.kind==="element"&&S(ce(o.subject.locator))===n);if(r.length===0)return!1;let i=o=>r.some(s=>s.subject.kind==="element"&&s.subject.state===o&&s.expect.expect==="is"&&s.expect.value===!1);return!i("visible")&&!i("enabled")}function lR(e){return Hr(e.expect).filter(t=>Jt(t)).flatMap(t=>Zd(t)).map(t=>S(ce(t)))}function Zd(e){return e.kind==="not"?Zd(e.predicate):"locator"in e?[e.locator]:[]}function Xd(e){let t=Xe(e);return J(e).flatMap(({test:n})=>[...pR(n.steps,re(n),t),...cR(n.steps,n.actor,re(n))])}function cR(e,t,n){return e.reduce((r,i,o)=>{let s=i.action.kind==="actor"?{alias:i.action.ref.ref,kind:"user"}:r.actor,a=uR(i).filter(l=>dR(l.target,s)).map(l=>({predicate:l,stepIndex:o,test:n}));return{actor:Hn(r.actor,[i]),flagged:[...r.flagged,...a]}},{actor:t,flagged:[]}).flagged}function uR(e){return e.expect.filter(t=>t.kind==="actor")}function dR(e,t){return e.kind==="anonymous"?t.kind==="anonymous":t.kind==="user"&&t.alias===e.ref.ref}function pR(e,t,n){let r=bi($t,n),i=new Set(r.keys());return e.reduce((o,s,a)=>{let l=yR(s),c=fR({acc:o,assertions:l,stepIndex:a,test:t}),u=bi(qe(o.pattern,[s]),n);return{assertedKeys:new Set([...hR({acc:o,assertions:l,pattern:u,step:s}),...i]),pattern:u,redundant:[...o.redundant,...c]}},{assertedKeys:i,pattern:r,redundant:[]}).redundant}function fR({acc:e,assertions:t,stepIndex:n,test:r}){return t.reduce((i,{entry:o,predicate:s})=>{let a=R(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:n,test:r}]:i.flagged,seen:new Map([...i.seen,[a,l]])}},{flagged:[],seen:new Map}).flagged}function hR({acc:e,assertions:t,pattern:n,step:r}){let i=new Set([...mR(r),...Gn(r)].map(a=>R(a.subject))),o=[...e.assertedKeys].filter(a=>n.has(a)&&!i.has(a)),s=t.map(({entry:a})=>R(a.subject)).filter(a=>n.has(a));return new Set([...o,...s])}function mR(e){return e.action.kind==="goto"?zn(e.action.url):[]}function yR(e){return kt(e.expect).flatMap(t=>{if(t.kind==="actor")return[];let n=he(t);return n==null?[]:[{entry:n,predicate:t}]})}var gR=2;function Jd(e){return J(e).flatMap(({test:t})=>t.steps.reduce((r,i,o)=>{let s=SR(i,r.pre),a=s.length>=gR?[...r.violations,{hidden:s,stepIndex:o,test:re(t)}]:r.violations;return{pre:qe(r.pre,[i]),violations:a}},{pre:$t,violations:[]}).violations)}function SR(e,t){return e.expect.flatMap(n=>{let r=bR(n);return r!=null&&!aa(r)&&wR(r,t)?[r]:[]})}function bR(e){return e.kind!=="not"||e.predicate.kind!=="visible"?null:e.predicate.locator}function aa(e){return e.by==="surface"?!0:e.by==="inside"?aa(e.scope)||aa(e.target):!1}function wR(e,t){let n=t.get(R({kind:"element",locator:e,state:"visible"}));return n!=null&&n.expect.expect==="is"&&n.expect.value===!0}function ep(e){return J(e).flatMap(({test:t})=>{let n=re(t);return t.steps.reduce((r,i,o)=>RR(r,i,o,n),{found:[],open:new Set}).found})}function RR(e,t,n,r){let i=t.action.kind==="goto"?new Set:e.open,o=Qd(t,vR),s=Qd(t,xR),a=new Set([...i,...o].filter(c=>!s.has(c))),l=kR(t).flatMap(c=>a.has(S(ce(c.surface)))?[]:[{...c,stepIndex:n,test:r}]);return{found:[...e.found,...l],open:a}}function Qd(e,t){return new Set(e.expect.flatMap(n=>{let r=t(n);return r==null?[]:[S(ce(r))]}))}function vR(e){return e.kind!=="visible"?null:e.locator.by==="surface"?e.locator:null}function xR(e){return e.kind!=="not"||e.predicate.kind!=="visible"?null:e.predicate.locator.by==="surface"?e.predicate.locator:null}function kR(e){return e.expect.flatMap(t=>{if(t.kind!=="visible"||t.locator.by!=="inside")return[];let n=tp(t.locator);return n==null?[]:[{content:t.locator,surface:n}]})}function tp(e){return e.by!=="inside"?null:e.scope.by==="surface"?e.scope:tp(e.scope)}var I=yc(ip(),1),le={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))},PR={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"))} ${PR[e](I.default.bold(e))}`}var MR=I.default.red("\u2717"),lL=I.default.green("\u2713"),OR=I.default.dim("\u203A"),IR=8;function op(e,t,n){let r=n==null?"":` ${le.dim(n)}`;return` ${le.dim(e.padStart(IR))} ${t}${r}`}function sp(e){let t=[...e.scalars.values()].find(n=>n.subject.kind==="path"&&n.expect.expect==="is")?.expect;return t==null||t.expect==="absent"?"(any view)":TR(t.value)}function TR(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 Li(e){let t=[...e.entities.map(n=>Ni(n)),...e.absences.map(n=>`no ${Ni(n)}`),...[...e.scalars.values()].filter(n=>n.subject.kind!=="path").filter(n=>!lp(n)).map(n=>Di(n))];return t.length===0?"always":t.join(" \u2227 ")}function Di(e){let t=$R(e.subject);return e.expect.expect==="absent"?`${t} absent`:e.subject.kind==="element"&&NR(e.expect.value)?e.expect.value?t:`not ${t}`:`${t} ${e.expect.expect==="not"?"\u2260":"="} ${Je(e.expect.value)}`}function pe(e){return e.by==="role"?e.name==null?e.role:`${e.role} ${Je(e.name)}`:e.by==="inside"?`${pe(e.scope)} \u25B8 ${pe(e.target)}`:e.by==="surface"?pe(e.container):Je(e.value)}function Je(e){return e===null?"\u2205":typeof e=="string"?`"${e}"`:typeof e!="object"?String(e):"ref"in e?`{${e.ref}}`:ca(e)}function ca(e){return e.template.map(t=>typeof t=="string"?t:":id").join("")}function ap(e,t){let n=new Set(t.entities.map(o=>Ni(o))),r=new Set(t.scalars.keys()),i=[...e.entities.map(o=>Ni(o)).filter(o=>!n.has(o)),...[...e.scalars].filter(([o])=>!r.has(o)).map(([,o])=>o).filter(o=>o.subject.kind!=="path"&&!lp(o)).map(o=>Di(o))];return i.length===0?"nothing beyond the shared state":i.join(" \u2227 ")}function lp(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 $R(e){return e.kind==="variable"?e.name:e.kind==="element"?`${e.state} ${pe(e.locator)}`:e.kind==="query"?`url query "${e.key}"`:e.kind==="title"||e.kind==="viewport"?e.kind:`url ${e.kind}`}function NR(e){return typeof e=="boolean"}function Ni(e){let t=Object.entries(e.literals).map(([n,r])=>`${n}=${Je(r)}`);return t.length===0?e.entity:`${e.entity}(${t.join(", ")})`}function dt(e){return e.by==="testId"?`testId=${e.value}`:e.by==="inside"?`${dt(e.scope)} \u25B8 ${dt(e.target)}`:e.by==="surface"?dt(e.container):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} ${dt(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 _i(e){return e.url!=null?`${e.kind} ${e.url}`:e.locator!=null?`${e.kind} ${dt(e.locator)}`:e.kind}function ft(e){if(e.kind==="not")return`not ${ft(e.inner)}`;if(e.kind==="browser"){let t=en(e.key);return e.value===null?`${t} absent`:`${t}="${e.value}"`}return e.kind==="value"||e.kind==="text"?`${e.kind} ${dt(e.locator)}="${e.value}"`:`${e.kind} ${dt(e.locator)}`}function Wt(e){let{field:t,source:n,target:r,targetField:i}=e.reference;return`${n}.${t} \u2192 ${r}.${i}`}function ir(e){return`${e.intent} \u203A ${_i(e.action)}`}function ua(e){return e.kind==="data-rule"?`data rule ${Wt(e.dataRule)}`:`${e.kind} ${ft(e.check)}`}function Q(e){return e==null?"\u2205":JSON.stringify(e)}function da(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=${pa(e.want)} actual=${Q(e.sut)}`}function ji(e){return{label:ua(e.source),step:ir(e.step)}}function cp(e){return e.expect==="absent"?"absent":e.expect==="not"?`not ${Q(e.value)}`:Q(e.value)}function pa(e){return e.expect==="absent"?"absent":e.expect==="not"?`anything but ${Q(e.value)}`:Q(e.value)}function LR(e){return e==null?"{ \u2026 }":`{ ${Object.entries(e).map(([n,r])=>`${n}: ${JSON.stringify(r)}`).join(", ")} }`}function Bi({evidencePath:e,finding:t}){let n=DR(t);return e==null?n:`${n} Evidence: ${le.path(e)}`}function Vi(e){return jR(BR(e))}function DR(e){return e.kind==="consistency"?YR(e):e.kind==="pending-check"?ev(e.source,e.step,e.budget):e.kind==="impossible-action"?`${oe("impossible action")} "${e.step.intent}" ran ${_i(e.step.action)} from a state the test calls impossible.`:e.kind==="unrunnable"?`${oe("model drift")} "${e.intent}" couldn't run \u2014 ${up(e)}.`:e.kind==="lift-visibility"?`${oe("reachability")} ${pe(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 ${jt(e.error)}. Environment, not app or test.`}var FR=new RegExp(`${String.fromCodePoint(27)}\\[[0-9;]*m`,"g");function fa(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":Je(e.want),n=e.got===void 0?"absent":Je(e.got);return`${_R(e.subject)} needed ${t} but was ${n}`}function _R(e){return e.kind==="element"?`${e.state} ${pe(e.locator)}`:e.kind==="variable"?`"${e.name}"`:e.kind==="query"?`url query "${e.key}"`:e.kind==="actor"?"signed-in actor":`url ${e.kind}`}function up(e){return e.unmet==null?WR(e.reason):fa(e.unmet)}function jR(e){return e.replaceAll(FR,"").replaceAll(/\s+/g," ").trim()}function BR(e){if(e.kind==="consistency"){let t=e.step==null?"":` after "${e.step.intent}"`;return`${da(e.mismatch)}${t}`}return e.kind==="pending-check"?`${nv(e.source)} failed at "${e.step.intent}": ${rv(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 ${up(e)}. Fix the model and recompile \u2014 do not dismiss`:e.kind==="lift-visibility"?`visible(${pe(e.locator)}) declared at step ${String(e.declaredIndex+1)} but already visible at step ${String(e.visibleIndex+1)}`:`driver failed at "${e.step.intent}": ${jt(e.error)}`}var VR={"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 WR(e){return VR[e]}function dp({debugDir:e,runId:t}){let n=`${e}/${t}`;return op("behavior",le.path(`${n}/behavior.jsonl`),void 0)}function or(e){return e.kind==="drag"?`drag ${pe(e.source)} to ${pe(e.target)}`:"locator"in e&&e.locator!=null?`${e.kind} ${pe(e.locator)}`:"url"in e?`${e.kind} ${UR(e.url)}`:e.kind}function UR(e){return typeof e=="string"?e:"ref"in e?`{${e.ref}}`:ca(e)}function pt(e){return e.kind==="not"?`not ${pt(e.predicate)}`:e.kind==="and"?e.predicates.map(t=>pt(t)).join(" \u2227 "):e.kind==="when"?e.branches.map(t=>t.name).join(" | "):zR(e)}function zR(e){return"locator"in e?GR(e):e.kind==="browser"?`${e.name}=${Je(e.value)}`:e.kind==="singleton"?`${e.singleton}=${Je(e.assertion.value)}`:e.kind==="count"?jr(e):e.kind==="actor"?e.target.kind==="anonymous"?"actor is signed out":`actor is ${e.target.ref.ref}`:""}function GR(e){let t=pe(e.locator);if(e.kind==="value"||e.kind==="text"){let n=tt(e.value)?e.value.value:e.value;return`${e.kind} ${t}=${Je(n)}`}return`${e.kind} ${t}`}function Fi(e){return e==null?"At the end of the run":`After ${KR(e.action)} in ${e.intent}`}var qR={click:"clicking",fill:"filling",goto:"opening",hover:"hovering over",press:"pressing",select:"selecting",upload:"uploading to"};function KR(e){return e.url!=null?`opening ${e.url}`:e.locator!=null?`${qR[e.kind]??e.kind} ${Bt(e.locator)}`:e.kind}function Bt(e){return e.by==="testId"?`the element with testId "${e.value}"`:e.by==="inside"?`${Bt(e.target)} inside ${Bt(e.scope)}`:e.by==="surface"?Bt(e.container):e.name==null?`the ${e.role}`:`the "${e.name}" ${e.role}`}function HR(e){return e.kind==="not"&&e.inner.kind==="visible"?`${Bt(e.inner.locator)} never disappeared`:e.kind==="visible"?`${Bt(e.locator)} never appeared`:e.kind==="value"||e.kind==="text"?`${Bt(e.locator)} never showed "${e.value}"`:`the check ${ft(e)} never held`}function YR(e){let t=e.pending?ZR(e):JR(e.mismatch,e.step);return`${oe("consistency")} ${t}`}function ZR(e){let t=`${fp(e.budget)} wait window`,{mismatch:n}=e,r=Fi(e.step);return n.kind==="wrong-value"?`${r}, ${n.entity}.${n.field} [${n.key}] never became ${le.expected(Q(n.snapshot))} (still ${le.actual(Q(n.sut))}) in the ${t}.`:n.kind==="unexpected-row"?`${r}, ${n.entity} row "${n.key}" still present after the ${t}.`:n.kind==="missing-row"?`${r}, ${n.entity} row "${n.key}" never appeared in the ${t}.`:n.kind==="expected-change"?n.direction!=null?`${r}, ${n.entity}.${n.field} [${n.key}] didn't ${n.direction} from ${Q(n.from)} (showed ${le.actual(Q(n.value))}) in the ${t}.`:`${r}, ${n.entity}.${n.field} [${n.key}] never changed from ${le.actual(Q(n.value))} in the ${t}.`:XR({at:r,mismatch:n,window:t})}function XR({at:e,mismatch:t,window:n}){let r=Vt(t.subject),i=`showed ${le.actual(Q(t.sut))}, not ${le.expected(pa(t.want))}`;return`${e}, ${r} ${i} through the ${n}.${pp(t.subject)}`}function pp(e){return e.kind!=="element"?"":" Likely a stale fact \u2014 if this value changes across revisits, use ephemeral() or Entity.updated({...})."}function fp(e){return`${String(ct[e]/1e3)}s`}function JR(e,t){let n=Fi(t);return e.kind==="wrong-value"?`${n}, ${e.entity}.${e.field} [${e.key}] showed ${le.actual(Q(e.sut))}, expected ${le.expected(Q(e.snapshot))}.`:e.kind==="scalar-mismatch"?`${n}, ${Vt(e.subject)} showed ${le.actual(Q(e.sut))}, expected ${le.expected(pa(e.want))}.${QR(e)}`:e.kind==="unexpected-row"?`${n}, unexpected ${e.entity} row "${e.key}" ${LR(e.row)}.`:e.kind==="missing-row"?`${n}, expected ${e.entity} row "${e.key}" but found none.`:`${n}, ${e.entity}.${e.field} [${e.key}] stayed ${le.actual(Q(e.value))}, expected a change.`}function QR(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.":pp(e.subject)}function ev(e,t,n){let r=`${fp(n)} wait window`;return e.kind==="data-rule"?`${oe("data rule")} ${Fi(t)}, ${Wt(e.dataRule)} broke \u2014 a referenced row went missing.`:e.kind==="fact"?`${oe("fact")} A fact from ${tv(e.origin)} predicts ${ft(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")} ${Fi(t)}, ${HR(e.check)} within the ${r}.`}function tv(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(n=>JSON.stringify(n)).join(", ")}`}function nv(e){return e.kind==="data-rule"?"data rule":e.kind==="fact"?"fact":"assertion"}function rv(e){return e.kind==="data-rule"?Wt(e.dataRule):ft(e.check)}function mp(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 ${Wt(t.dataRule)}. Cascade the delete or declare the cleanup.`}case"create-gap":return iv(e.gap);case"unreachable-interaction":{let{violation:t}=e,n=pe(t.target);return t.ephemeralOnly?`${oe("reachability")} ${t.test}: ${or(t.action)}, but ${n} was only declared inside ephemeral(...), which grants no reachability. Assert a durable visible(...) first.`:`${oe("reachability")} ${t.test}: ${or(t.action)}, but no prior step declared ${n} reachable. Assert visible(...) on it first.`}case"redundant-assertion":{let{redundancy:t}=e;return`${oe("redundancy")} ${t.test}: step ${String(t.stepIndex+1)} restates "${pt(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 ov(e.conflict);case"unmodeled-surface":{let{surface:t}=e,n=t.hidden.map(r=>pe(r)).join(", ");return`${oe("surface")} ${t.test}: step ${String(t.stepIndex+1)} hides ${String(t.hidden.length)} elements at once (${n}). Elements hidden together are one surface \u2014 declare surface(...) and scope them to it.`}case"unpinned-surface-content":{let{content:t}=e,n=pe(t.surface);return`${oe("surface")} ${t.test}: step ${String(t.stepIndex+1)} asserts ${pe(t.content)} but never opens ${n}. A content fact holds only while its surface is active \u2014 assert visible(${n}) here or on a prior open step.`}}}function iv(e){let t=e.missing.length===1?"field":"fields",n=e.missing.length===1?"it":"them";return`${oe("data rule")} ${e.transition} creates ${e.entity} without required ${t} ${e.missing.join(", ")}. Set ${n} or drop the requirement.`}function ov(e){return[`${oe("fact")} Two facts contradict on overlapping states \u2014 "${pt(e.a)}" vs "${pt(e.b)}".`,` Shared state: ${Li(e.when)}.`,hp(e.a,e.aProducers,e.when),hp(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 hp(e,t,n){let r=t.map(i=>` - ${i.test} adds ${ap(i.when,n)}`);return[` "${pt(e)}" declared by:`,...r].join(`
|
|
6
|
+
`)}var sv=24301;function Wi(e,t){return e.reduce((n,r)=>uv(n,t[r.idx]?.paramSpaces),new Map)}function mn(e,t){return Object.fromEntries(Object.entries(e.paramSpaces).map(([n,r])=>[n,av(r,r?.name==null?0:t.get(r.name)??0)]))}var yp=new WeakMap;function av(e,t){if(e==null)return gp(void 0,t);let n=yp.get(e)??new Map;yp.set(e,n);let r=n.get(t);if(r!=null)return r;let i=gp(e,t);return n.set(t,i),i}function lv(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"?fv():cv(e)}function gp(e,t){let[n]=nt.sample(lv(e),{numRuns:1,seed:sv+t});if(n==null)throw new Error("arbitrary produced no sample");return n}function cv(e){let t=e.refine??e.pattern;return nt.stringMatching(new RegExp(`^(?:${t})$`,"u")).filter(n=>(e.minLength==null||n.length>=e.minLength)&&(e.maxLength==null||n.length<=e.maxLength))}function uv(e,t){return t==null?e:Object.values(t).reduce((n,r)=>r==null?n:new Map([...n,[r.name,(n.get(r.name)??0)+1]]),e)}var dv="abcdefghijklmnopqrstuvwxyz0123456789".match(/./g)??[],pv=e=>nt.array(nt.constantFrom(...dv),{maxLength:e,minLength:1}).map(t=>t.join(""));function fv(){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 hv=new Map;function Ui(e){return mn(e,hv)}import{z as L}from"zod";var yn=L.enum(["crash","data-rule","fact","frame","model-drift"]),Sp=L.object({intent:L.string().min(1),test:L.string().min(1)}),mv=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)})]),yv=L.discriminatedUnion("kind",[L.object({kind:L.literal("consistency"),layer:yn,mismatch:mv,step:Sp.nullable()}),L.object({kind:L.literal("pending-check"),layer:yn,source:L.string().min(1),step:Sp}),L.object({intent:L.string().min(1),kind:L.literal("unrunnable"),layer:yn,reason:L.string().min(1),test:L.string().min(1)}),L.object({error:L.string().min(1),kind:L.literal("driver-error"),layer:yn,step:L.string().min(1)}),L.object({kind:L.literal("impossible-action"),layer:yn,step:L.string().min(1)})]);function ha(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 sr(e,t){let n=t.map(o=>({finding:o,line:Vi(o),part:wp(o)})).toSorted((o,s)=>S(o.part).localeCompare(S(s.part))),r=n.map(o=>o.part),i=n.at(0)?.finding;return{layer:bv(r),signature:S({baseState:e,parts:r.map(o=>S(o))}),sourceTest:i==null?void 0:gv(i),title:n.at(0)?.line}}function gv(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 bp={crash:0,"data-rule":1,fact:2,frame:3,"model-drift":4};function wp(e){let t=ha(e);switch(e.kind){case"consistency":return{kind:"consistency",layer:t,mismatch:Sv(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 Sv(e){return e.kind==="scalar-mismatch"?{kind:e.kind,subject:Vt(e.subject)}:{entity:e.entity,kind:e.kind}}function bv(e){return e.map(n=>n.layer).toSorted((n,r)=>bp[n]-bp[r]).at(0)??"frame"}function ya(e){let t=new Map(e.entities.flatMap(i=>Object.entries(i.props).flatMap(([o,s])=>s.valueSpace==null?[]:[[`${i.name}.${o}`,s.valueSpace]]))),n=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):n.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?[]:ma(t.condition),...t.consequence.flatMap(n=>zi(n))])}function ma(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"?ma(e.predicate):e.kind==="and"||e.kind==="or"?e.predicates.flatMap(t=>ma(t)):Object.entries(e.where).flatMap(([t,n])=>n===null||typeof n=="object"?[]:[{key:`${e.entity}.${t}`,kind:"field",value:n}])}import{z as Rp}from"zod";var vp=Rp.object({maxAttemptLength:Rp.number().int().positive()}),ga={even:{maxAttemptLength:12}};function xp(e){return ga[e]}function Gi(e){return{startingPoint:e.startingPoint.name,steps:kp(e,e.startingPoint.snapshot,[])}}function kp(e,t,n){if(n.length>=e.strategy.maxAttemptLength)return n;let r=xi(e.facts,t),i=gi(e.corpus,{snapshot:r},xv(e,n)),o=vv(i,e.corpus,e.random());return o==null?n:kp(e,o.stepRun.next.snapshot,[...n,{idx:o.idx,params:o.params}])}var wv=.02;function Rv(e,t){return t[e]?.effectStep.action.kind==="goto"?wv:1}function vv(e,t,n){let r=e.map(a=>Rv(a.idx,t)),i=r.reduce((a,l)=>a+l,0);if(i<=0)return null;let o=n*i,s=r.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 xv(e,t){let n=Wi(t,e.corpus);return r=>Ev({drawn:mn(r,n),params:e,prior:n,rule:r})}var kv=3;function Ev({drawn:e,params:t,prior:n,rule:r}){return Object.fromEntries(Object.entries(e).map(([i,o])=>{let s=r.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=n.get(s.name)??0;return l%kv!==1?[i,o]:[i,a[l%a.length]??o]}))}import{z as A}from"zod";var Ep=A.object({baseStateTest:kc,lockfileHash:A.string().min(1),stepRuns:A.array(A.object({idx:A.number().int().nonnegative(),params:A.record(A.string(),A.union([ls,A.null()]))}))}),Cp=A.object({baseStateRef:A.string().min(1),steps:A.array(A.object({index:A.number().int().nonnegative(),params:A.record(A.string(),A.union([ls,A.null()])),test:A.string().min(1)}))}),Ap=A.object({actions:A.array(A.string()),label:A.string().min(1)}),Sa=A.object({test:A.string().min(1),text:A.string()}),Cv=A.object({baseLabel:A.string(),baseState:A.string().min(1),durationMs:A.number().int().nonnegative(),signature:A.string().optional(),steps:A.array(Sa)}),Pp=A.object({kind:A.enum(["aborted","clean","error","flaky","finding","seen"]),reason:A.string().optional(),runId:A.string().optional(),trail:Cv.optional()});function qi(e,{sweep:t}){let n=Me(J(e),r=>S({a:r.test.actor,s:r.test.singletons,v:r.test.viewport,w:r.test.world})).map(r=>({name:r.ref,test:r.test}));return t?[...n,...n.flatMap(r=>Av(r))]:n}function Ki(e,t,n){return un(e,t.test,n)}function Av(e){return Pv(e.test).map(t=>{let n={...t,as:`${t.as}~2`},r=`${e.name} +${t.entity}`;return{name:r,test:{...e.test,name:r,world:[...e.test.world,n]}}})}function Pv(e){return e.world.filter(t=>{let n=S({...e,world:e.world.filter(r=>r!==t)});return!n.includes(`"${t.as}.`)&&!n.includes(`"ref":"${t.as}"`)})}async function Hi(e){let t=qn(e);if(t.length===0)return null;let n=qi(e,{sweep:!1}),r=await Mv(e,n);if(r.length===0)return null;let i=hn(e);return{corpus:t,facts:{facts:i.facts.filter(o=>!o.localConsequence),overlays:Xe(e),overrides:i.overrides},literals:ya(e),startingPoints:r,startingPointTests:new Map(n.map(o=>[o.name,o.test]))}}function Mp({lockfileHash:e,prepared:t,random:n,strategy:r}){let i=t.startingPoints[Math.floor(n()*t.startingPoints.length)];if(i==null)return null;let o=Gi({corpus:t.corpus,facts:t.facts,literals:t.literals,random:n,startingPoint:i,strategy:r}),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 Mv(e,t){let n={generate:_n,materialize:fi(_n,e.valueSpaces),params:void 0,signIn:void 0};return(await Promise.all(t.map(async i=>(await Ki(e,i,n)).match(s=>({name:i.name,snapshot:s.snapshot}),()=>null)))).flatMap(i=>i==null?[]:[i])}import{ResultAsync as ar}from"neverthrow";function Ut(e,t,n){if(t==null)throw new Error("action requires a locator");return gn(e,t,n)}function gn(e,t,n){if(t.by==="inside"){let i=gn(e,t.scope,n);return gn(i,t.target,n)}if(t.by==="surface")return gn(e,t.container,n);let r=t.by==="testId"?e.getByTestId(t.value):e.locator(ba(t.role,t.name));return n.visibleOnly?r.filter({visible:!0}):r}function ba(e,t){return t==null?`role=${e}`:`role=${e}[name=${JSON.stringify(t)}i]`}var wa=3e4,Sn=class extends Error{mountKey;constructor(t){super("client-mount-unmounted"),this.mountKey=t}},zt=class extends Error{readyKey;timeoutMs;constructor(t,n){super("app-not-ready"),this.readyKey=t,this.timeoutMs=n}};function Ra(e){return{read:t=>Vv(t,e),seedScript:t=>`globalThis[${JSON.stringify(xc)}] = ${JSON.stringify(t)};`}}async function Vv(e,t){let n=Ae(nn(e.url()),Op([[{kind:"title"},await e.title()],[{kind:"viewport"},Gv(e.viewportSize())]]));if(t.length===0)return{scalars:n};let r=await e.evaluate(Uv,{mountKey:cs,names:t,timeoutMs:Wv});if(r.kind==="unmounted")throw new Sn(cs);let i=Op(Object.entries(r.values).map(([o,s])=>[{kind:"variable",name:o},s]));return{scalars:Ae(n,i)}}function Op(e){return new Map(e.flatMap(([t,n])=>n===void 0?[]:[[R(t),{declared:!0,expect:{expect:"is",value:n},subject:t}]]))}var Wv=wa;async function Uv(e){let t=Date.now()+e.timeoutMs;for(;Reflect.get(globalThis,e.mountKey)==null&&Date.now()<t;)await new Promise(r=>setTimeout(r,25));let n=Reflect.get(globalThis,e.mountKey);return n==null?{kind:"unmounted"}:{kind:"values",values:Object.fromEntries(e.names.map(r=>[r,n.readSingleton(r)??null]))}}var zv=768;function Gv(e){return e==null?"":e.width<zv?"mobile":"desktop"}async function Yi({page:e,readiness:t,signal:n,startMs:r,tries:i,url:o}){if(Oe(n),!await qv(e,o)){if(Date.now()-r>=t.budgetMs)throw new zt(_r,t.budgetMs);let a=t.backoffMs[Math.min(i,t.backoffMs.length-1)]??8e3;await Et(a,n),await Yi({page:e,readiness:t,signal:n,startMs:r,tries:i+1,url:o});return}let s=Math.max(0,t.budgetMs-(Date.now()-r));if(!await Zv(e,n,Math.min(s,Hv(t,i)))){if(Date.now()-r>=t.budgetMs)throw new zt(_r,t.budgetMs);await Yi({page:e,readiness:t,signal:n,startMs:r,tries:i+1,url:o})}}function va(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 Zi(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 qv(e,t){let n=await Kv(e,t);return n==="net-error"?!1:n==null||n.status()<400}async function Kv(e,t){try{return await e.goto(t,{waitUntil:"domcontentloaded"})}catch(n){if(va(n))return"net-error";throw n}}function Hv(e,t){return t===0?e.budgetMs/2:e.budgetMs}var Yv=50;async function Zv(e,t,n){let r=Date.now()+n;for(;Date.now()<r;){if(Oe(t),await Ip(e))return!0;await Et(Yv,t)}return Ip(e)}async function Ip(e){try{return await e.evaluate(Xv,_r)}catch(t){if(Zi(t))return!1;throw t}}function Xv(e){return Reflect.get(globalThis,e)===!0}async function xa(e,t,n){if(n.kind==="browser")return ex(e,t,n.key,n.value);if(n.kind==="not")return!await xa(e,t,n.inner);let r=Ut(e,n.locator,{visibleOnly:!0});return n.kind==="value"?Tp(await r.inputValue(),n.value,n.match):n.kind==="text"?Tp(await r.textContent()??"",n.value,n.match):n.kind==="unobstructed"?Jv(r):Qv(r,n.kind)}function Tp(e,t,n){let r=tn(e),i=tn(t);return n==="contains"?r.includes(i):n==="startsWith"?r.startsWith(i):r===i}function Jv(e){return e.evaluate(t=>{let n=t.getBoundingClientRect(),r=t.ownerDocument.defaultView;if(r==null||n.width<=0||n.height<=0)return!1;let i=2,o=Math.min(9,Math.max(3,Math.round(n.width/12))),s=Math.min(5,Math.max(2,Math.round(n.height/12))),a=(u,d,p)=>Array.from({length:p},(m,y)=>u+i+(d-i*2)*y/(p-1)),c=a(n.left,n.width,o).flatMap(u=>a(n.top,n.height,s).map(d=>({x:u,y:d}))).filter(u=>u.x>=0&&u.y>=0&&u.x<=r.innerWidth&&u.y<=r.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 Qv(e,t){return t==="visible"?e.isVisible():t==="disabled"?e.isDisabled():t==="enabled"?e.isEnabled():t==="checked"?e.isChecked():t==="expanded"?$p(e,n=>n.getAttribute("aria-expanded")==="true"):t==="pressed"?$p(e,n=>n.getAttribute("aria-pressed")==="true"):e.evaluate(n=>n===n.ownerDocument.activeElement)}async function $p(e,t){return await e.count()===0?!1:e.evaluate(t)}async function ex(e,t,n,r){let i=await t.read(e),o=ae(i.scalars,n);return r===null?o===void 0:o===r}var ka={backoffMs:[500,1e3,2e3,4e3,8e3],budgetMs:wa},tx={readiness:ka,readSession:void 0,switchActor:void 0};function Ea(e,t,n,r,{readiness:i,readSession:o,switchActor:s}=tx){return{awaitCheck:(a,l)=>ar.fromPromise(ix({check:a,engine:n,page:e,signal:r,timeoutMs:l}),c=>Jn(c)?{kind:"aborted"}:Xi(c)),evaluate:a=>ar.fromPromise(Lp(Ca(e,n,a),`check ${a.kind}`),Xi),locateIds:a=>gx(e,a),observe:a=>ar.fromPromise(o==null?Promise.resolve(void 0):o(),Xi).andThen(l=>t.read(l)).andThen(l=>ar.fromPromise(Lp(lx({backend:l,engine:n,page:e,tracked:a}),"observe"),Xi)),perform:a=>ar.fromPromise(_p(e,a,0,r,{readiness:i,switchActor:s}),l=>nx(a,l))}}function Xi(e){return e instanceof Sn?ri(e.mountKey):Vs(e)}async function Ca(e,t,n){try{return await xa(e,t,n)}catch(r){if(Zi(r))return!1;throw r}}function nx(e,t){return t instanceof zt?Ls(t.readyKey,t.timeoutMs):t instanceof Sn?ri(t.mountKey):Bs(e.kind,t)}var rx=75;function ix(e){return e.check.kind==="visible"?ox({locator:e.check.locator,page:e.page,signal:e.signal,timeoutMs:e.timeoutMs}):Dp(e,Date.now()+e.timeoutMs)}async function Dp(e,t){return Oe(e.signal),await Ca(e.page,e.engine,e.check)?!0:Date.now()>=t?!1:(await Et(rx,e.signal),Dp(e,t))}async function ox({locator:e,page:t,signal:n,timeoutMs:r}){try{return await Promise.race([Ut(t,e,{visibleOnly:!0}).waitFor({state:"visible",timeout:r}),sx(n)]),!0}catch(i){if(ax(i))return!1;throw i}}function sx(e){return new Promise((t,n)=>{if(e.aborted){n(new De);return}e.addEventListener("abort",()=>{n(new De)},{once:!0})})}function ax(e){return e instanceof Error&&e.name==="TimeoutError"}async function lx({backend:e,engine:t,page:n,tracked:r}){let i=await Fp(n,t,0),o=await cx(n,t,r);return{snapshot:{...e,scalars:new Map([...e.scalars,...i.scalars,...o])}}}async function cx(e,t,n){let r=await Promise.all([...n.values()].filter(i=>i.subject.kind==="element").map(async i=>{let o=await ux(e,t,i.subject);return[R(i.subject),{declared:!0,expect:{expect:"is",value:o},subject:i.subject}]}));return new Map(r)}async function ux(e,t,n){return n.state==="value"||n.state==="text"?dx(e,n.locator,n.state):Ca(e,t,{kind:n.state,locator:n.locator})}async function dx(e,t,n){try{let r=Ut(e,t,{visibleOnly:!0});return n==="value"?await r.inputValue():await r.textContent()??""}catch{return""}}var px=[100,250,500];async function Fp(e,t,n){try{return await t.read(e)}catch(r){let i=px[n];if(i==null||!Zi(r))throw r;return await jp(i),Fp(e,t,n+1)}}var Np=35e3;function Lp(e,t){let n,r=new Promise((i,o)=>{n=setTimeout(()=>{o(new Error(`driver op "${t}" exceeded ${String(Np)}ms`))},Np)});return Promise.race([e,r]).finally(()=>{clearTimeout(n)})}var fx=[250,750,2e3];async function _p(e,t,n,r,i){try{await hx(e,t,r,i.readiness,i.switchActor)}catch(o){let s=fx[n];if(s==null||!va(o))throw o;await jp(s),await _p(e,t,n+1,r,i)}}async function hx(e,t,n,r,i){if(t.kind==="actor"){if(i==null)throw new Error("this driver cannot switch actors");await i(Pt(t.actorRef,t,"actorRef"));return}if(t.kind==="goto"){await Yi({page:e,readiness:r,signal:n,startMs:Date.now(),tries:0,url:Pt(t.url,t,"url")});return}if(t.kind==="press"&&t.locator==null){await e.keyboard.press(Pt(t.key,t,"key"));return}let o=t.kind!=="upload";await mx(e,Ut(e,t.locator,{visibleOnly:o}),t)}function Pt(e,t,n){if(e==null)throw new Error(`action "${t.kind}" requires ${n}`);return e}function mx(e,t,n){switch(n.kind){case"goto":throw new Error("goto must not be located");case"fill":return t.fill(String(Pt(n.value,n,"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 yx(e,t,String(Pt(n.value,n,"value")));case"upload":return t.setInputFiles(Pt(n.files,n,"files"));case"press":return t.press(Pt(n.key,n,"key"));case"drag":return t.dragTo(Ut(e,Pt(n.target,n,"target"),{visibleOnly:!0}));case"actor":throw new Error("actor switch must not be located")}}async function yx(e,t,n){if(await t.evaluate(i=>i.tagName==="SELECT")){await t.selectOption(n);return}await t.click(),await t.fill(n),await e.locator(ba("option",n)).filter({visible:!0}).click()}function jp(e){return new Promise(t=>{setTimeout(t,e)})}async function gx(e,t){if(t==null)return[];try{let n=gn(e,t,{visibleOnly:!1});if(await n.count()===0)return[];let r=await n.first().evaluate(Sx);return r>0?[r]:[]}catch{return[]}}function Sx(e){return globalThis.__ripploRrwebMirror?.getId(e)??-1}import bx from"path";var Vp={desktop:{height:720,width:1280},mobile:{height:844,width:390}};function Wp(e){return Vp[e]}var AD=Vp.desktop;async function Aa({baseUrl:e,browser:t,capture:n,clientState:r,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:Ma(c.cookies,e),origins:c.origins},viewport:p});s!=null&&await vx(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(r));let y=n==null?xx():await n.hub.attach(m,n.runId),f=await m.newPage();y.onPage(f);let h=f,w=wx({baseUrl:e,context:m,page:f,signInActor:d}),v=a?Rx(e,m):void 0;return{context:m,driver:Cx(kx(Ea(h,l,i,u,{readiness:ka,readSession:v,switchActor:w}),o),y),emitAssertion:y.emitAssertion,close:()=>Ax({context:m,handle:y})}}async function Pa(e,t){let n=await zp(e,void 0);try{return await t(n)}finally{await n.close()}}async function Up(e){let{chromium:t}=await import("playwright");return t.launchPersistentContext(e,{headless:!1,viewport:null})}function wx({baseUrl:e,context:t,page:n,signInActor:r}){if(r!=null)return async i=>{let o=await r(i).match(s=>s,s=>{throw new Error(`actor switch failed: ${s.kind}`)});await t.clearCookies(),await t.addCookies(Ma(o.cookies,e)),o.headers!=null&&await t.setExtraHTTPHeaders(o.headers),await n.reload()}}function Ma(e,t){let n=new URL(t).hostname;return e.map(r=>({...r,domain:n}))}function Rx(e,t){return async()=>{let n=await t.cookies();return{cookies:Ma(n,e),headers:void 0,origins:[]}}}async function vx(e,t,n){let r=new URL(t).host;await e.route(i=>i.host===r,i=>i.continue({headers:{...i.request().headers(),...n}}))}function xx(){return{emitAction:()=>{},emitAssertion:()=>{},finish:()=>Promise.resolve(),onPage:()=>{}}}async function zp(e,t){let{chromium:n}=await import("playwright"),r=t==null?[]:[`--disk-cache-dir=${t}`,"--disk-cache-size=268435456"];return n.launch({args:r,headless:!e})}function Ji({cacheDir:e,headed:t}){let n;return{acquire:async()=>{let o=n;if(o!=null){let s=await o.catch(()=>{});if(s?.isConnected()===!0)return s;n===o&&(n=void 0)}return n??=zp(t,e),n},close:async()=>{let o=n;n=void 0,o!=null&&await o.then(s=>s.close()).catch(()=>{})}}}function kx(e,t){return{awaitCheck:e.awaitCheck,evaluate:e.evaluate,locateIds:e.locateIds,observe:e.observe,perform:n=>e.perform(Ex(n,t))}}function Ex(e,t){return e.kind!=="upload"||e.files==null?e:{...e,files:e.files.map(n=>bx.join(t,n))}}function Cx(e,t){return{awaitCheck:e.awaitCheck,evaluate:e.evaluate,locateIds:e.locateIds,observe:e.observe,perform:n=>(t.emitAction(n),e.perform(n))}}async function Ax({context:e,handle:t}){await Bp(t.finish()),await Bp(e.close())}var Px=15e3;async function Bp(e){let t,n=new Promise(r=>{t=setTimeout(r,Px)});await Promise.race([e.catch(()=>{}),n]).finally(()=>{clearTimeout(t)})}import{err as Mx,ok as Ox,Result as Oa}from"neverthrow";function Ia(e,t,n){return{read:r=>n.read(e.map(i=>i.name),t,r).andThen(i=>Ix(e,i))}}function Ix(e,t){return Oa.combine(e.map(n=>Tx(n,t.entities[n.name]??[]).map(r=>[n.name,r]))).map(n=>({entities:new Map(n),scalars:new Map([...Lx(t.singletons),...Dx(t.actor)])}))}function Tx(e,t){let n=Qn(e);return Oa.combine(t.map(r=>$x(r,e).map(i=>[i,Nx(r,n)]))).map(r=>new Map(r))}function $x(e,t){return Oa.combine(t.identity.map(n=>{let r=e[n];return r==null?Mx(Fs(t.name,n)):Ox(String(r))})).map(n=>n.join(":"))}function Nx(e,t){let n=t.map(r=>[r,e[r]]).filter(r=>r[1]!=null);return Object.fromEntries(n)}function Lx(e){return Object.entries(e).map(([t,n])=>[R({kind:"variable",name:t}),{declared:!0,expect:{expect:"is",value:n},subject:{kind:"variable",name:t}}])}function Dx(e){return e==null?[]:[[R({kind:"actor"}),{declared:!1,expect:{expect:"is",value:e},subject:{kind:"actor"}}]]}var Gp=yc(by(),1);import Fx from"crypto";import{err as _x,errAsync as Ta,ok as jx,ResultAsync as bn}from"neverthrow";var Bx=1e4,Vx=[250,750,2e3],Wx=[500,1e3,2e3,3e3];function $a({baseUrl:e,extraHeaders:t,runId:n,secret:r},i){let o=new Gp.Webhook(r),s=(a,l,c)=>Ux({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:n,session:c,singletons:l},{retry:"transient",schema:Pc,signal:i}).map(u=>({actor:u.actor,entities:u.entities,singletons:u.singletons}))},ready:()=>Kp(e,t,i,0),setupWorld:a=>s("/setup",{entities:a,runId:n},{retry:"connection",schema:Cc,signal:i}).map(l=>l.rows),signIn:({entity:a,row:l})=>s("/sign-in",{entity:a,row:l,runId:n},{retry:"connection",schema:Ac,signal:i}).map(c=>c.session),teardown:()=>s("/teardown",{runId:n},{retry:"connection",schema:Mc,signal:void 0}).map(()=>{})}}function Ux(e){return qp(e.retry,()=>Kx(e),0)}function qp(e,t,n){return t().orElse(r=>{let i=Vx[n];return i==null||!Gx(r,e)?Ta(r):bn.fromSafePromise(Hp(i)).andThen(()=>qp(e,t,n+1))})}function Kp(e,t,n,r){return bn.fromPromise(fetch(e,{headers:t,method:"HEAD",signal:Yp(n)}),i=>ln("",i)).map(()=>{}).orElse(()=>{let i=Wx[r];return i==null||n.aborted?Ta(js(e)):bn.fromSafePromise(Hp(i)).andThen(()=>Kp(e,t,n,r+1))})}var zx=new Set(["EAI_AGAIN","ECONNREFUSED","ENOTFOUND"]);function Gx(e,t){return e.kind==="aborted"?!1:qx(e)?!0:t==="connection"?!1:e.kind==="engine-network"||e.kind==="engine-http"&&e.status>=500}function qx(e){return e.kind==="engine-network"&&e.code!=null&&zx.has(e.code)}function Hp(e){return new Promise(t=>{setTimeout(t,e)})}function Kx({baseUrl:e,body:t,extraHeaders:n,path:r,schema:i,signal:o,webhook:s}){let a=JSON.stringify(t);return bn.fromPromise(fetch(`${e}${r}`,{body:a,headers:{...n,"Content-Type":"application/json",...Hx(s,a)},method:"PUT",signal:Yp(o)}),l=>ln(r,l)).andThen(l=>Yx(l,r)).andThen(l=>Zx(i,l,r)).mapErr(l=>o?.aborted===!0?Ws():l)}function Hx(e,t){let n=`msg_${Fx.randomUUID()}`,r=new Date;return{"webhook-id":n,"webhook-signature":e.sign(n,r,t),"webhook-timestamp":String(Math.floor(r.getTime()/1e3))}}function Yp(e){let t=AbortSignal.timeout(Bx);return e==null?t:AbortSignal.any([e,t])}function Yx(e,t){return e.ok?bn.fromPromise(e.json(),n=>ln(t,n)):bn.fromPromise(e.text().catch(()=>""),n=>ln(t,n)).andThen(n=>Ta(Ns(t,e.status,n)))}function Zx(e,t,n){let r=e.safeParse(t);return r.success?jx(r.data):_x(Ds(n,r.error))}import uO from"path";import{err as Xt,errAsync as dO,ok as Nn,ResultAsync as lc}from"neverthrow";import ry from"path";import{z as Be}from"zod";import Xx from"path";function Zp({debugDir:e,runId:t,worker:n}){let r=Xx.join(e,t,"behavior.jsonl");return n.open({file:r,runId:t}),{close:i=>n.close({noticeLineIfNoRrweb:i?.noticeIfNoRrweb==null?"":JSON.stringify(Jx(i.noticeIfNoRrweb)),runId:t}),emit:i=>{let o={...i,timestamp:Qx(i.timeNanos)};n.line({line:JSON.stringify(o),runId:t,timeNanos:i.timeNanos})},emitRrwebBatch:i=>{n.rrwebBatch({data:i,runId:t})}}}function wn(e){return String(BigInt(Math.round(e))*1000000n)}function Jx(e){return{kind:"notice",message:e,source:"capture",timeNanos:"0"}}function Qx(e){return Number(BigInt(e)/1000000n)}import{existsSync as ek}from"fs";import{createRequire as tk}from"module";import{fileURLToPath as nk}from"url";import{Worker as rk}from"worker_threads";var ik=tk(import.meta.url);function Xp(e){let t=new rk(ok(),{workerData:e});t.unref();let n=new Map,r={next:0};t.on("message",o=>{let s=n.get(o.seq);s!=null&&(n.delete(o.seq),s())});let i=o=>{t.postMessage(o)};return{close:({noticeLineIfNoRrweb:o,runId:s})=>{let a=r.next;return r.next+=1,new Promise(l=>{n.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 ok(){try{return ik.resolve("@ripplo/runtime/capture-worker")}catch{let e=["../../dist/capture-worker.js","./capture-worker.js"].map(n=>nk(new URL(n,import.meta.url))),t=e.find(n=>ek(n));if(t==null)throw new Error(`capture-worker.js not found; looked at: ${e.join(", ")}`);return t}}import{readFile as sk}from"fs/promises";import{createRequire as ak}from"module";import{fileURLToPath as lk}from"url";var ck=ak(import.meta.url);function Na(e,t){try{return ck.resolve(e)}catch{return lk(new URL(`assets/${t}`,import.meta.url))}}var uk=Na("@ripplo/browser-trace/bundle","browser-trace.js");async function Qp(e,t){await e.addInitScript(`globalThis.__ripploRunId = ${JSON.stringify(t)};`),await e.addInitScript(await dk())}var Jp;function dk(){return Jp??=sk(uk,{encoding:"utf8"}),Jp}import{createServer as pk}from"http";import{mkdir as fk,rm as hk,writeFile as mk}from"fs/promises";import yk from"path";import{z as D}from"zod";var gk="otlp-port",tf=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()})}),Sk=D.object({attributes:D.array(tf).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()}),bk=D.object({resourceSpans:D.array(D.object({resource:D.object({attributes:D.array(tf).default([])}).optional(),scopeSpans:D.array(D.object({spans:D.array(Sk).default([])})).default([])})).default([])});async function La({localDir:e,onRrwebBatch:t,onSpan:n,writePortFile:r}){let{port:i,server:o}=await wk({onRrwebBatch:t,onSpan:n}),s=yk.join(e,gk);return r&&(await fk(e,{recursive:!0}),await mk(s,String(i),{encoding:"utf8"})),{port:i,stop:async()=>{r&&await hk(s,{force:!0}),await Ek(o)}}}function wk(e){return new Promise((t,n)=>{let r=pk((i,o)=>{Rk(i,o,e)});r.on("error",n),r.listen(0,()=>{let i=r.address();if(i==null||typeof i=="string"){n(new Error("otlp_receiver_no_port"));return}t({port:i.port,server:r})})})}function Rk(e,t,n){let r=vk(e.url);if(r!=null){ef(e).then(i=>{n.onRrwebBatch(r,i),Qi(t)}).catch(()=>{Qi(t)});return}ef(e).then(i=>{xk(bk.parse(JSON.parse(i.toString("utf8"))),n.onSpan),Qi(t)}).catch(()=>{Qi(t)})}function vk(e){if(e==null||!e.startsWith("/rrweb/"))return;let t=decodeURIComponent(e.slice(7));return t.length===0?void 0:t}function ef(e){return new Promise((t,n)=>{let r=[];e.on("data",i=>{r.push(i)}),e.on("end",()=>{t(Buffer.concat(r))}),e.on("error",n)})}function Qi(e){e.writeHead(200,{"content-type":"application/json"}),e.end("{}")}function xk(e,t){e.resourceSpans.flatMap(n=>n.scopeSpans).flatMap(n=>n.spans).forEach(n=>{t({attributes:kk(n.attributes),durationMs:Number((BigInt(n.endTimeUnixNano)-BigInt(n.startTimeUnixNano))/1000000n),kind:"span",name:n.name,parentSpanId:n.parentSpanId,source:"server",spanId:n.spanId,spanKind:wc(n.kind),status:{code:Rc(n.status?.code??0),message:n.status?.message},timeNanos:n.startTimeUnixNano,traceId:n.traceId})})}function kk(e){return Object.fromEntries(e.map(({key:t,value:n})=>[t,String(n.stringValue??n.intValue??n.doubleValue??n.boolValue??"")]))}function Ek(e){return new Promise((t,n)=>{e.close(r=>{if(r==null){t();return}n(r)}),e.closeAllConnections()})}import{readFile as HM}from"fs/promises";var Ck=Object.defineProperty,Ak=(e,t,n)=>t in e?Ck(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,b=(e,t,n)=>Ak(e,typeof t!="symbol"?t+"":t,n),nf,Pk=Object.defineProperty,Mk=(e,t,n)=>t in e?Pk(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,rf=(e,t,n)=>Mk(e,typeof t!="symbol"?t+"":t,n),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||{}),of={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},sf={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},eo={},Ok=()=>!!globalThis.Zone;function jl(e){if(eo[e])return eo[e];let t=globalThis[e],n=t.prototype,r=e in of?of[e]:void 0,i=!!(r&&r.every(a=>{var l,c;return!!((c=(l=Object.getOwnPropertyDescriptor(n,a))==null?void 0:l.get)!=null&&c.toString().includes("[native code]"))})),o=e in sf?sf[e]:void 0,s=!!(o&&o.every(a=>{var l;return typeof n[a]=="function"&&((l=n[a])==null?void 0:l.toString().includes("[native code]"))}));if(i&&s&&!Ok())return eo[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?eo[e]=c:n}catch{return n}}var Da={};function gt(e,t,n){var r;let i=`${e}.${String(n)}`;if(Da[i])return Da[i].call(t);let o=jl(e),s=(r=Object.getOwnPropertyDescriptor(o,n))==null?void 0:r.get;return s?(Da[i]=s,s.call(t)):t[n]}var Fa={};function rh(e,t,n){let r=`${e}.${String(n)}`;if(Fa[r])return Fa[r].bind(t);let o=jl(e)[n];return typeof o!="function"?t[n]:(Fa[r]=o,o.bind(t))}function Ik(e){return gt("Node",e,"ownerDocument")}function Tk(e){return gt("Node",e,"childNodes")}function $k(e){return gt("Node",e,"parentNode")}function Nk(e){return gt("Node",e,"parentElement")}function Lk(e){return gt("Node",e,"textContent")}function Dk(e,t){return rh("Node",e,"contains")(t)}function Fk(e){return rh("Node",e,"getRootNode")()}function _k(e){return!e||!("host"in e)?null:gt("ShadowRoot",e,"host")}function jk(e){return e.styleSheets}function Bk(e){return!e||!("shadowRoot"in e)?null:gt("Element",e,"shadowRoot")}function Vk(e,t){return gt("Element",e,"querySelector")(t)}function Wk(e,t){return gt("Element",e,"querySelectorAll")(t)}function Uk(){return jl("MutationObserver").constructor}function zk(e,t,n){try{if(!(t in e))return()=>{};let r=e[t],i=n(r);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=i,()=>{e[t]=r}}catch{return()=>{}}}var me={ownerDocument:Ik,childNodes:Tk,parentNode:$k,parentElement:Nk,textContent:Lk,contains:Dk,getRootNode:Fk,host:_k,styleSheets:jk,shadowRoot:Bk,querySelector:Vk,querySelectorAll:Wk,mutationObserver:Uk,patch:zk};function ih(e){return e.nodeType===e.ELEMENT_NODE}function fr(e){let t=e&&"host"in e&&"mode"in e&&me.host(e)||null;return!!(t&&"shadowRoot"in t&&me.shadowRoot(t)===e)}function hr(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function Gk(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 qk(e){let{cssText:t}=e;if(t.split('"').length<3)return t;let n=["@import",`url(${JSON.stringify(e.href)})`];return e.layerName===""?n.push("layer"):e.layerName&&n.push(`layer(${e.layerName})`),e.supportsText&&n.push(`supports(${e.supportsText})`),e.media.length&&n.push(e.media.mediaText),n.join(" ")+";"}function Za(e){try{let t=e.rules||e.cssRules;if(!t)return null;let n=e.href;!n&&e.ownerNode&&(n=e.ownerNode.baseURI);let r=Array.from(t,i=>oh(i,n)).join("");return Gk(r)}catch{return null}}function oh(e,t){if(Hk(e)){let n;try{n=Za(e.styleSheet)||qk(e)}catch{n=e.cssText}return e.styleSheet.href?$o(n,e.styleSheet.href):n}else{let n=e.cssText;return Yk(e)&&e.selectorText.includes(":")&&(n=Kk(n)),t?$o(n,t):n}}function Kk(e){let t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function Hk(e){return"styleSheet"in e}function Yk(e){return"selectorText"in e}var Oo=class{constructor(){rf(this,"idNodeMap",new Map),rf(this,"nodeMetaMap",new WeakMap)}getId(t){var n;return t?((n=this.getMeta(t))==null?void 0:n.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 n=this.getId(t);this.idNodeMap.delete(n),t.childNodes&&t.childNodes.forEach(r=>this.removeNodeFromMap(r))}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,n){let r=n.id;this.idNodeMap.set(r,t),this.nodeMetaMap.set(t,n)}replace(t,n){let r=this.getNode(t);if(r){let i=this.nodeMetaMap.get(r);i&&this.nodeMetaMap.set(n,i)}this.idNodeMap.set(t,n)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function Zk(){return new Oo}function Io({element:e,maskInputOptions:t,tagName:n,type:r,value:i,maskInputFn:o}){let s=i||"",a=r&&qt(r);return(t[n.toLowerCase()]||a&&t[a])&&(o?s=o(s,e):s="*".repeat(s.length)),s}function qt(e){return e.toLowerCase()}var af="__rrweb_original__";function Xk(e){let t=e.getContext("2d");if(!t)return!0;let n=50;for(let r=0;r<e.width;r+=n)for(let i=0;i<e.height;i+=n){let o=t.getImageData,s=af in o?o[af]:o;if(new Uint32Array(s.call(t,r,i,Math.min(n,e.width-r),Math.min(n,e.height-i)).data.buffer).some(l=>l!==0))return!1}return!0}function To(e){let t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?qt(t):null}function sh(e,t){let n;try{n=new URL(e,t??window.location.href)}catch{return null}let r=/\.([0-9a-z]+)(?:$)/i,i=n.pathname.match(r);return i?.[1]??null}function Jk(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var Qk=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,eE=/^(?:[a-z+]+:)?\/\//i,tE=/^www\..*/i,nE=/^(data:)([^,]*),(.*)/i;function $o(e,t){return(e||"").replace(Qk,(n,r,i,o,s,a)=>{let l=i||s||a,c=r||o||"";if(!l)return n;if(eE.test(l)||tE.test(l))return`url(${c}${l}${c})`;if(nE.test(l))return`url(${c}${l}${c})`;if(l[0]==="/")return`url(${c}${Jk(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 to(e,t=!1){return t?e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,""):e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"").replace(/0px/g,"0")}function rE(e,t,n=!1){let r=Array.from(t.childNodes),i=[],o=0;if(r.length>1&&e&&typeof e=="string"){let s=to(e,n),a=s.length/e.length;for(let l=1;l<r.length;l++)if(r[l].textContent&&typeof r[l].textContent=="string"){let c=to(r[l].textContent,n),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]===""&&r[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=r[l-1].textContent;if(f&&typeof f=="string"){let h=to(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*r.length)return i.push(e),i;let h=to(e.substring(0,f),n);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 iE(e,t){return rE(e,t).join("/* rr_split */")}var oE=1,sE=new RegExp("[^a-z0-9-_:]"),yr=-2;function ah(){return oE++}function aE(e){if(e instanceof HTMLFormElement)return"form";let t=qt(e.tagName);return sE.test(t)?"div":t}var Rn,lf,lE=/^[^ \t\n\r\u000c]+/,cE=/^[, \t\n\r\u000c]+/;function uE(e,t){if(t.trim()==="")return t;let n=0;function r(o){let s,a=o.exec(t.substring(n));return a?(s=a[0],n+=s.length,s):""}let i=[];for(;r(cE),!(n>=t.length);){let o=r(lE);if(o.slice(-1)===",")o=kn(e,o.substring(0,o.length-1)),i.push(o);else{let s="";o=kn(e,o);let a=!1;for(;;){let l=t.charAt(n);if(l===""){i.push((o+s).trim());break}else if(a)l===")"&&(a=!1);else if(l===","){n+=1,i.push((o+s).trim());break}else l==="("&&(a=!0);s+=l,n+=1}}}return i.join(", ")}var cf=new WeakMap;function kn(e,t){return!t||t.trim()===""?t:Bl(e,t)}function dE(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function Bl(e,t){let n=cf.get(e);if(n||(n=e.createElement("a"),cf.set(e,n)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return n.setAttribute("href",t),n.href}function lh(e,t,n,r){return r&&(n==="src"||n==="href"&&!(t==="use"&&r[0]==="#")||n==="xlink:href"&&r[0]!=="#"||n==="background"&&["table","td","th"].includes(t)?kn(e,r):n==="srcset"?uE(e,r):n==="style"?$o(r,Bl(e)):t==="object"&&n==="data"?kn(e,r):r)}function ch(e,t,n){return["video","audio"].includes(e)&&t==="autoplay"}function pE(e,t,n){try{if(typeof t=="string"){if(e.classList.contains(t))return!0}else for(let r=e.classList.length;r--;){let i=e.classList[r];if(t.test(i))return!0}if(n)return e.matches(n)}catch{}return!1}function No(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return n?No(me.parentNode(e),t,n):!1;for(let r=e.classList.length;r--;){let i=e.classList[r];if(t.test(i))return!0}return n?No(me.parentNode(e),t,n):!1}function uh(e,t,n,r){let i;if(ih(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(r){if(i.closest(`.${t}`))return!0}else if(i.classList.contains(t))return!0}else if(No(i,t,r))return!0;if(n){if(r){if(i.closest(n))return!0}else if(i.matches(n))return!0}}catch{}return!1}function fE(e,t,n){let r=e.contentWindow;if(!r)return;let i=!1,o;try{o=r.document.readyState}catch{return}if(o!=="complete"){let a=setTimeout(()=>{i||(t(),i=!0)},n);e.addEventListener("load",()=>{clearTimeout(a),i=!0,t()});return}let s="about:blank";if(r.location.href!==s||e.src===s||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}function hE(e,t,n){let r=!1,i;try{i=e.sheet}catch{return}if(i)return;let o=setTimeout(()=>{r||(t(),r=!0)},n);e.addEventListener("load",()=>{clearTimeout(o),r=!0,t()})}function mE(e,t){let{doc:n,mirror:r,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=yE(n,r);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 SE(e,{doc:n,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 gE(e,{doc:n,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 yE(e,t){if(!t.hasNode(e))return;let n=t.getId(e);return n===1?void 0:n}function gE(e,t){let{needsMask:n,maskTextFn:r,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,Bl(t.doc)))),!c&&!u&&l&&n&&(l=r?r(l,me.parentElement(e)):l.replace(/[\S]/g,"*")),{type:se.Text,textContent:l||"",rootId:i}}function SE(e,t){let{doc:n,blockClass:r,blockSelector:i,inlineStylesheet:o,maskInputOptions:s={},maskInputFn:a,dataURLOptions:l={},inlineImages:c,recordCanvas:u,keepIframeSrcFn:d,newlyAddedElement:p=!1,rootId:m}=t,y=pE(e,r,i),f=aE(e),h={},w=e.attributes.length;for(let g=0;g<w;g++){let x=e.attributes[g];ch(f,x.name,x.value)||(h[x.name]=lh(n,f,qt(x.name),x.value))}if(f==="link"&&o){let g=Array.from(n.styleSheets).find(T=>T.href===e.href),x=null;g&&(x=Za(g)),x&&(delete h.rel,delete h.href,h._cssText=x)}if(f==="style"&&e.sheet){let g=Za(e.sheet);g&&(e.childNodes.length>1&&(g=iE(g,e)),h._cssText=g)}if(["input","textarea","select"].includes(f)){let g=e.value,x=e.checked;h.type!=="radio"&&h.type!=="checkbox"&&h.type!=="submit"&&h.type!=="button"&&g?h.value=Io({element:e,type:To(e),tagName:f,value:g,maskInputOptions:s,maskInputFn:a}):x&&(h.checked=x)}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")Xk(e)||(h.rr_dataURL=e.toDataURL(l.type,l.quality));else if(!("__context"in e)){let g=e.toDataURL(l.type,l.quality),x=n.createElement("canvas");x.width=e.width,x.height=e.height;let T=x.toDataURL(l.type,l.quality);g!==T&&(h.rr_dataURL=g)}}if(f==="img"&&c){Rn||(Rn=n.createElement("canvas"),lf=Rn.getContext("2d"));let g=e,x=g.currentSrc||g.getAttribute("src")||"<unknown-src>",T=g.crossOrigin,j=()=>{g.removeEventListener("load",j);try{Rn.width=g.naturalWidth,Rn.height=g.naturalHeight,lf.drawImage(g,0,0),h.rr_dataURL=Rn.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=${x}! 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:x}=e.getBoundingClientRect();h={class:h.class,rr_width:`${g}px`,rr_height:`${x}px`}}f==="iframe"&&!d(h.src)&&(e.contentDocument||(h.rr_src=h.src),delete h.src);let v;try{customElements.get(f)&&(v=!0)}catch{}return{type:se.Element,tagName:f,attributes:h,childNodes:[],isSVG:dE(e)||void 0,needBlock:y,rootId:m,isCustom:v}}function U(e){return e==null?"":e.toLowerCase()}function dh(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 bE(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"&&sh(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(U(e.attributes.name).match(/^msapplication-tile(image|color)$/)||U(e.attributes.name)==="application-name"||U(e.attributes.rel)==="icon"||U(e.attributes.rel)==="apple-touch-icon"||U(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&U(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(U(e.attributes.property).match(/^(og|twitter|fb):/)||U(e.attributes.name).match(/^(og|twitter):/)||U(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(U(e.attributes.name)==="robots"||U(e.attributes.name)==="googlebot"||U(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(U(e.attributes.name)==="author"||U(e.attributes.name)==="generator"||U(e.attributes.name)==="framework"||U(e.attributes.name)==="publisher"||U(e.attributes.name)==="progid"||U(e.attributes.property).match(/^article:/)||U(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(U(e.attributes.name)==="google-site-verification"||U(e.attributes.name)==="yandex-verification"||U(e.attributes.name)==="csrf-token"||U(e.attributes.name)==="p:domain_verify"||U(e.attributes.name)==="verify-v1"||U(e.attributes.name)==="verification"||U(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function En(e,t){let{doc:n,mirror:r,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:v,iframeLoadTimeout:g=5e3,onStylesheetLoad:x,stylesheetLoadTimeout:T=5e3,keepIframeSrcFn:j=()=>!1,newlyAddedElement:te=!1,cssCaptured:V=!1}=t,{needsMask:z}=t,{preserveWhiteSpace:ne=!0}=t;z||(z=uh(e,s,a,z===void 0));let fe=mE(e,{doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:z,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:p,dataURLOptions:y,inlineImages:f,recordCanvas:h,keepIframeSrcFn:j,newlyAddedElement:te,cssCaptured:V});if(!fe)return console.warn(e,"not serialized"),null;let Ve;r.hasNode(e)?Ve=r.getId(e):bE(fe,m)||!ne&&fe.type===se.Text&&!fe.textContent.replace(/^\s+|\s+$/gm,"").length?Ve=yr:Ve=ah();let $=Object.assign(fe,{id:Ve});if(r.add(e,$),Ve===yr)return null;w&&w(e);let Dn=!l;if($.type===se.Element){Dn=Dn&&!$.needBlock,delete $.needBlock;let ie=me.shadowRoot(e);ie&&hr(ie)&&($.isShadowHost=!0)}if(($.type===se.Document||$.type===se.Element)&&Dn){m.headWhitespace&&$.type===se.Element&&$.tagName==="head"&&(ne=!1);let ie={doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:z,maskTextClass:s,maskTextSelector:a,skipChild:l,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:p,slimDOMOptions:m,dataURLOptions:y,inlineImages:f,recordCanvas:h,preserveWhiteSpace:ne,onSerialize:w,onIframeLoad:v,iframeLoadTimeout:g,onStylesheetLoad:x,stylesheetLoadTimeout:T,keepIframeSrcFn:j,cssCaptured:!1};if(!($.type===se.Element&&$.tagName==="textarea"&&$.attributes.value!==void 0)){$.type===se.Element&&$.attributes._cssText!==void 0&&typeof $.attributes._cssText=="string"&&(ie.cssCaptured=!0);for(let Ot of Array.from(me.childNodes(e))){let We=En(Ot,ie);We&&$.childNodes.push(We)}}let Ie=null;if(ih(e)&&(Ie=me.shadowRoot(e)))for(let Ot of Array.from(me.childNodes(Ie))){let We=En(Ot,ie);We&&(hr(Ie)&&(We.isShadow=!0),$.childNodes.push(We))}}let Fn=me.parentNode(e);return Fn&&fr(Fn)&&hr(Fn)&&($.isShadow=!0),$.type===se.Element&&$.tagName==="iframe"&&fE(e,()=>{let ie=e.contentDocument;if(ie&&v){let Ie=En(ie,{doc:ie,mirror:r,blockClass:i,blockSelector:o,needsMask:z,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:p,slimDOMOptions:m,dataURLOptions:y,inlineImages:f,recordCanvas:h,preserveWhiteSpace:ne,onSerialize:w,onIframeLoad:v,iframeLoadTimeout:g,onStylesheetLoad:x,stylesheetLoadTimeout:T,keepIframeSrcFn:j});Ie&&v(e,Ie)}},g),$.type===se.Element&&$.tagName==="link"&&typeof $.attributes.rel=="string"&&($.attributes.rel==="stylesheet"||$.attributes.rel==="preload"&&typeof $.attributes.href=="string"&&sh($.attributes.href)==="css")&&hE(e,()=>{if(x){let ie=En(e,{doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:z,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:p,slimDOMOptions:m,dataURLOptions:y,inlineImages:f,recordCanvas:h,preserveWhiteSpace:ne,onSerialize:w,onIframeLoad:v,iframeLoadTimeout:g,onStylesheetLoad:x,stylesheetLoadTimeout:T,keepIframeSrcFn:j});ie&&x(e,ie)}},T),$}function wE(e,t){let{mirror:n=new Oo,blockClass:r="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:v,onStylesheetLoad:g,stylesheetLoadTimeout:x,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=dh(m);return En(e,{doc:e,mirror:n,blockClass:r,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:v,onStylesheetLoad:g,stylesheetLoadTimeout:x,keepIframeSrcFn:T,newlyAddedElement:!1})}var RE=/(max|min)-device-(width|height)/,eF=new RegExp(RE.source,"g");function vE(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function xE(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var Vl={exports:{}},q=String,ph=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}};Vl.exports=ph();Vl.exports.createColors=ph;var kE=Vl.exports,EE={},CE=Object.freeze(Object.defineProperty({__proto__:null,default:EE},Symbol.toStringTag,{value:"Module"})),_e=xE(CE),uf=kE,df=_e,Xa=class fh extends Error{constructor(t,n,r,i,o,s){super(t),this.name="CssSyntaxError",this.reason=t,o&&(this.file=o),i&&(this.source=i),s&&(this.plugin=s),typeof n<"u"&&typeof r<"u"&&(typeof n=="number"?(this.line=n,this.column=r):(this.line=n.line,this.column=n.column,this.endLine=r.line,this.endColumn=r.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,fh)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(t){if(!this.source)return"";let n=this.source;t==null&&(t=uf.isColorSupported),df&&t&&(n=df(n));let r=n.split(/\r?\n/),i=Math.max(this.line-3,0),o=Math.min(this.line+2,r.length),s=String(o).length,a,l;if(t){let{bold:c,gray:u,red:d}=uf.createColors(!0);a=p=>c(d(p)),l=p=>u(p)}else a=l=c=>c;return r.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}},Wl=Xa;Xa.default=Xa;var Cr={};Cr.isClean=Symbol("isClean");Cr.my=Symbol("my");var pf={after:`
|
|
12
|
+
`,beforeClose:`
|
|
13
|
+
`,beforeComment:`
|
|
14
|
+
`,beforeDecl:`
|
|
15
|
+
`,beforeOpen:" ",beforeRule:`
|
|
16
|
+
`,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function AE(e){return e[0].toUpperCase()+e.slice(1)}var Ja=class{constructor(t){this.builder=t}atrule(t,n){let r="@"+t.name,i=t.params?this.rawValue(t,"params"):"";if(typeof t.raws.afterName<"u"?r+=t.raws.afterName:i&&(r+=" "),t.nodes)this.block(t,r+i);else{let o=(t.raws.between||"")+(n?";":"");this.builder(r+i+o,t)}}beforeAfter(t,n){let r;t.type==="decl"?r=this.raw(t,null,"beforeDecl"):t.type==="comment"?r=this.raw(t,null,"beforeComment"):n==="before"?r=this.raw(t,null,"beforeRule"):r=this.raw(t,null,"beforeClose");let i=t.parent,o=0;for(;i&&i.type!=="root";)o+=1,i=i.parent;if(r.includes(`
|
|
17
|
+
`)){let s=this.raw(t,null,"indent");if(s.length)for(let a=0;a<o;a++)r+=s}return r}block(t,n){let r=this.raw(t,"between","beforeOpen");this.builder(n+r+"{",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 n=t.nodes.length-1;for(;n>0&&t.nodes[n].type==="comment";)n-=1;let r=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,n!==i||r)}}comment(t){let n=this.raw(t,"left","commentLeft"),r=this.raw(t,"right","commentRight");this.builder("/*"+n+t.text+r+"*/",t)}decl(t,n){let r=this.raw(t,"between","colon"),i=t.prop+r+this.rawValue(t,"value");t.important&&(i+=t.raws.important||" !important"),n&&(i+=";"),this.builder(i,t)}document(t){this.body(t)}raw(t,n,r){let i;if(r||(r=n),n&&(i=t.raws[n],typeof i<"u"))return i;let o=t.parent;if(r==="before"&&(!o||o.type==="root"&&o.first===t||o&&o.type==="document"))return"";if(!o)return pf[r];let s=t.root();if(s.rawCache||(s.rawCache={}),typeof s.rawCache[r]<"u")return s.rawCache[r];if(r==="before"||r==="after")return this.beforeAfter(t,r);{let a="raw"+AE(r);this[a]?i=this[a](s,t):s.walk(l=>{if(i=l.raws[n],typeof i<"u")return!1})}return typeof i>"u"&&(i=pf[r]),s.rawCache[r]=i,i}rawBeforeClose(t){let n;return t.walk(r=>{if(r.nodes&&r.nodes.length>0&&typeof r.raws.after<"u")return n=r.raws.after,n.includes(`
|
|
18
|
+
`)&&(n=n.replace(/[^\n]+$/,"")),!1}),n&&(n=n.replace(/\S/g,"")),n}rawBeforeComment(t,n){let r;return t.walkComments(i=>{if(typeof i.raws.before<"u")return r=i.raws.before,r.includes(`
|
|
19
|
+
`)&&(r=r.replace(/[^\n]+$/,"")),!1}),typeof r>"u"?r=this.raw(n,null,"beforeDecl"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeDecl(t,n){let r;return t.walkDecls(i=>{if(typeof i.raws.before<"u")return r=i.raws.before,r.includes(`
|
|
20
|
+
`)&&(r=r.replace(/[^\n]+$/,"")),!1}),typeof r>"u"?r=this.raw(n,null,"beforeRule"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeOpen(t){let n;return t.walk(r=>{if(r.type!=="decl"&&(n=r.raws.between,typeof n<"u"))return!1}),n}rawBeforeRule(t){let n;return t.walk(r=>{if(r.nodes&&(r.parent!==t||t.first!==r)&&typeof r.raws.before<"u")return n=r.raws.before,n.includes(`
|
|
21
|
+
`)&&(n=n.replace(/[^\n]+$/,"")),!1}),n&&(n=n.replace(/\S/g,"")),n}rawColon(t){let n;return t.walkDecls(r=>{if(typeof r.raws.between<"u")return n=r.raws.between.replace(/[^\s:]/g,""),!1}),n}rawEmptyBody(t){let n;return t.walk(r=>{if(r.nodes&&r.nodes.length===0&&(n=r.raws.after,typeof n<"u"))return!1}),n}rawIndent(t){if(t.raws.indent)return t.raws.indent;let n;return t.walk(r=>{let i=r.parent;if(i&&i!==t&&i.parent&&i.parent===t&&typeof r.raws.before<"u"){let o=r.raws.before.split(`
|
|
22
|
+
`);return n=o[o.length-1],n=n.replace(/\S/g,""),!1}}),n}rawSemicolon(t){let n;return t.walk(r=>{if(r.nodes&&r.nodes.length&&r.last.type==="decl"&&(n=r.raws.semicolon,typeof n<"u"))return!1}),n}rawValue(t,n){let r=t[n],i=t.raws[n];return i&&i.value===r?i.raw:r}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,n){if(!this[t.type])throw new Error("Unknown AST node type "+t.type+". Maybe you need to change PostCSS stringifier.");this[t.type](t,n)}},hh=Ja;Ja.default=Ja;var PE=hh;function Qa(e,t){new PE(t).stringify(e)}var Ko=Qa;Qa.default=Qa;var{isClean:no,my:ME}=Cr,OE=Wl,IE=hh,TE=Ko;function el(e,t){let n=new e.constructor;for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r)||r==="proxyCache")continue;let i=e[r],o=typeof i;r==="parent"&&o==="object"?t&&(n[r]=t):r==="source"?n[r]=i:Array.isArray(i)?n[r]=i.map(s=>el(s,n)):(o==="object"&&i!==null&&(i=el(i)),n[r]=i)}return n}var tl=class{constructor(t={}){this.raws={},this[no]=!1,this[ME]=!0;for(let n in t)if(n==="nodes"){this.nodes=[];for(let r of t[n])typeof r.clone=="function"?this.append(r.clone()):this.append(r)}else this[n]=t[n]}addToError(t){if(t.postcssNode=this,t.stack&&this.source&&/\n\s{4}at /.test(t.stack)){let n=this.source;t.stack=t.stack.replace(/\n\s{4}at /,`$&${n.input.from}:${n.start.line}:${n.start.column}$&`)}return t}after(t){return this.parent.insertAfter(this,t),this}assign(t={}){for(let n in t)this[n]=t[n];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 n=el(this);for(let r in t)n[r]=t[r];return n}cloneAfter(t={}){let n=this.clone(t);return this.parent.insertAfter(this,n),n}cloneBefore(t={}){let n=this.clone(t);return this.parent.insertBefore(this,n),n}error(t,n={}){if(this.source){let{end:r,start:i}=this.rangeBy(n);return this.source.input.error(t,{column:i.column,line:i.line},{column:r.column,line:r.line},n)}return new OE(t)}getProxyProcessor(){return{get(t,n){return n==="proxyOf"?t:n==="root"?()=>t.root().toProxy():t[n]},set(t,n,r){return t[n]===r||(t[n]=r,(n==="prop"||n==="value"||n==="name"||n==="params"||n==="important"||n==="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,n){let r=this.source.start;if(t.index)r=this.positionInside(t.index,n);else if(t.word){n=this.toString();let i=n.indexOf(t.word);i!==-1&&(r=this.positionInside(i,n))}return r}positionInside(t,n){let r=n||this.toString(),i=this.source.start.column,o=this.source.start.line;for(let s=0;s<t;s++)r[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 n={column:this.source.start.column,line:this.source.start.line},r=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:n.column+1,line:n.line};if(t.word){let i=this.toString(),o=i.indexOf(t.word);o!==-1&&(n=this.positionInside(o,i),r=this.positionInside(o+t.word.length,i))}else t.start?n={column:t.start.column,line:t.start.line}:t.index&&(n=this.positionInside(t.index)),t.end?r={column:t.end.column,line:t.end.line}:typeof t.endIndex=="number"?r=this.positionInside(t.endIndex):t.index&&(r=this.positionInside(t.index+1));return(r.line<n.line||r.line===n.line&&r.column<=n.column)&&(r={column:n.column+1,line:n.line}),{end:r,start:n}}raw(t,n){return new IE().raw(this,t,n)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...t){if(this.parent){let n=this,r=!1;for(let i of t)i===this?r=!0:r?(this.parent.insertAfter(n,i),n=i):this.parent.insertBefore(n,i);r||this.remove()}return this}root(){let t=this;for(;t.parent&&t.parent.type!=="document";)t=t.parent;return t}toJSON(t,n){let r={},i=n==null;n=n||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))r[s]=a.map(l=>typeof l=="object"&&l.toJSON?l.toJSON(null,n):l);else if(typeof a=="object"&&a.toJSON)r[s]=a.toJSON(null,n);else if(s==="source"){let l=n.get(a.input);l==null&&(l=o,n.set(a.input,o),o++),r[s]={end:a.end,inputId:l,start:a.start}}else r[s]=a}return i&&(r.inputs=[...n.keys()].map(s=>s.toJSON())),r}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(t=TE){t.stringify&&(t=t.stringify);let n="";return t(this,r=>{n+=r}),n}warn(t,n,r){let i={node:this};for(let o in r)i[o]=r[o];return t.warn(n,i)}get proxyOf(){return this}},Ho=tl;tl.default=tl;var $E=Ho,nl=class extends $E{constructor(t){t&&typeof t.value<"u"&&typeof t.value!="string"&&(t={...t,value:String(t.value)}),super(t),this.type="decl"}get variable(){return this.prop.startsWith("--")||this.prop[0]==="$"}},Yo=nl;nl.default=nl;var NE="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",LE=(e,t=21)=>(n=t)=>{let r="",i=n;for(;i--;)r+=e[Math.random()*e.length|0];return r},DE=(e=21)=>{let t="",n=e;for(;n--;)t+=NE[Math.random()*64|0];return t},FE={nanoid:DE,customAlphabet:LE},{SourceMapConsumer:ff,SourceMapGenerator:hf}=_e,{existsSync:_E,readFileSync:jE}=_e,{dirname:_a,join:BE}=_e;function VE(e){return Buffer?Buffer.from(e,"base64").toString():window.atob(e)}var rl=class{constructor(t,n){if(n.map===!1)return;this.loadAnnotation(t),this.inline=this.startWith(this.annotation,"data:");let r=n.map?n.map.prev:void 0,i=this.loadMap(n.from,r);!this.mapFile&&n.from&&(this.mapFile=n.from),this.mapFile&&(this.root=_a(this.mapFile)),i&&(this.text=i)}consumer(){return this.consumerCache||(this.consumerCache=new ff(this.text)),this.consumerCache}decodeInline(t){let n=/^data:application\/json;charset=utf-?8;base64,/,r=/^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(n.test(t)||r.test(t))return VE(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 n=t.match(/\/\*\s*# sourceMappingURL=/gm);if(!n)return;let r=t.lastIndexOf(n.pop()),i=t.indexOf("*/",r);r>-1&&i>-1&&(this.annotation=this.getAnnotationURL(t.substring(r,i)))}loadFile(t){if(this.root=_a(t),_E(t))return this.mapFile=t,jE(t,"utf-8").toString().trim()}loadMap(t,n){if(n===!1)return!1;if(n){if(typeof n=="string")return n;if(typeof n=="function"){let r=n(t);if(r){let i=this.loadFile(r);if(!i)throw new Error("Unable to load previous source map: "+r.toString());return i}}else{if(n instanceof ff)return hf.fromSourceMap(n).toString();if(n instanceof hf)return n.toString();if(this.isMap(n))return JSON.stringify(n);throw new Error("Unsupported previous source map format: "+n.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let r=this.annotation;return t&&(r=BE(_a(t),r)),this.loadFile(r)}}}startWith(t,n){return t?t.substr(0,n.length)===n:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}},mh=rl;rl.default=rl;var{SourceMapConsumer:WE,SourceMapGenerator:UE}=_e,{fileURLToPath:mf,pathToFileURL:ro}=_e,{isAbsolute:il,resolve:ol}=_e,{nanoid:zE}=FE,ja=_e,yf=Wl,GE=mh,Ba=Symbol("fromOffsetCache"),qE=!!(WE&&UE),gf=!!(ol&&il),Lo=class{constructor(t,n={}){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,n.from&&(!gf||/^\w+:\/\//.test(n.from)||il(n.from)?this.file=n.from:this.file=ol(n.from)),gf&&qE){let r=new GE(this.css,n);if(r.text){this.map=r;let i=r.consumer().file;!this.file&&i&&(this.file=this.mapResolve(i))}}this.file||(this.id="<input css "+zE(6)+">"),this.map&&(this.map.file=this.from)}error(t,n,r,i={}){let o,s,a;if(n&&typeof n=="object"){let c=n,u=r;if(typeof c.offset=="number"){let d=this.fromOffset(c.offset);n=d.line,r=d.col}else n=c.line,r=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(!r){let c=this.fromOffset(n);n=c.line,r=c.col}let l=this.origin(n,r,s,a);return l?o=new yf(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 yf(t,s===void 0?n:{column:r,line:n},s===void 0?r:{column:a,line:s},this.css,this.file,i.plugin),o.input={column:r,endColumn:a,endLine:s,line:n,source:this.css},this.file&&(ro&&(o.input.url=ro(this.file).toString()),o.input.file=this.file),o}fromOffset(t){let n,r;if(this[Ba])r=this[Ba];else{let o=this.css.split(`
|
|
24
|
+
`);r=new Array(o.length);let s=0;for(let a=0,l=o.length;a<l;a++)r[a]=s,s+=o[a].length+1;this[Ba]=r}n=r[r.length-1];let i=0;if(t>=n)i=r.length-1;else{let o=r.length-2,s;for(;i<o;)if(s=i+(o-i>>1),t<r[s])o=s-1;else if(t>=r[s+1])i=s+1;else{i=s;break}}return{col:t-r[i]+1,line:i+1}}mapResolve(t){return/^\w+:\/\//.test(t)?t:ol(this.map.consumer().sourceRoot||this.map.root||".",t)}origin(t,n,r,i){if(!this.map)return!1;let o=this.map.consumer(),s=o.originalPositionFor({column:n,line:t});if(!s.source)return!1;let a;typeof r=="number"&&(a=o.originalPositionFor({column:i,line:r}));let l;il(s.source)?l=ro(s.source):l=new URL(s.source,this.map.consumer().sourceRoot||ro(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(mf)c.file=mf(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 n of["hasBOM","css","file","id"])this[n]!=null&&(t[n]=this[n]);return this.map&&(t.map={...this.map},t.map.consumerCache&&(t.map.consumerCache=void 0)),t}get from(){return this.file||this.id}},Zo=Lo;Lo.default=Lo;ja&&ja.registerInput&&ja.registerInput(Lo);var{SourceMapConsumer:yh,SourceMapGenerator:ko}=_e,{dirname:Eo,relative:gh,resolve:Sh,sep:bh}=_e,{pathToFileURL:Sf}=_e,KE=Zo,HE=!!(yh&&ko),YE=!!(Eo&&Sh&&gh&&bh),ZE=class{constructor(t,n,r,i){this.stringify=t,this.mapOpts=r.map||{},this.root=n,this.opts=r,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 n=`
|
|
25
|
+
`;this.css.includes(`\r
|
|
26
|
+
`)&&(n=`\r
|
|
27
|
+
`),this.css+=n+"/*# sourceMappingURL="+t+" */"}applyPrevMaps(){for(let t of this.previous()){let n=this.toUrl(this.path(t.file)),r=t.root||Eo(t.file),i;this.mapOpts.sourcesContent===!1?(i=new yh(t.text),i.sourcesContent&&(i.sourcesContent=null)):i=t.consumer(),this.map.applySourceMap(i,n,this.toUrl(this.path(r)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1)if(this.root){let t;for(let n=this.root.nodes.length-1;n>=0;n--)t=this.root.nodes[n],t.type==="comment"&&t.text.indexOf("# sourceMappingURL=")===0&&this.root.removeChild(n)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),YE&&HE&&this.isMap())return this.generateMap();{let t="";return this.stringify(this.root,n=>{t+=n}),[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,n=1,r="<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=n-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=r,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
|
+
`),n=a.length-s):n+=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=n-2,this.map.addMapping(i)):(i.source=r,i.original.line=1,i.original.column=0,i.generated.line=t,i.generated.column=n-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(n=>n.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 n=this.memoizedPaths.get(t);if(n)return n;let r=this.opts.to?Eo(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(r=Eo(Sh(r,this.mapOpts.annotation)));let i=gh(r,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 n=t.source.input.map;this.previousMaps.includes(n)||this.previousMaps.push(n)}});else{let t=new KE(this.originalCSS,this.opts);t.map&&this.previousMaps.push(t.map)}return this.previousMaps}setSourcesContent(){let t={};if(this.root)this.root.walk(n=>{if(n.source){let r=n.source.input.from;if(r&&!t[r]){t[r]=!0;let i=this.usesFileUrls?this.toFileUrl(r):this.toUrl(this.path(r));this.map.setSourceContent(i,n.source.input.css)}}});else if(this.css){let n=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(n,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 n=this.memoizedFileURLs.get(t);if(n)return n;if(Sf){let r=Sf(t).toString();return this.memoizedFileURLs.set(t,r),r}else throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(t){let n=this.memoizedURLs.get(t);if(n)return n;bh==="\\"&&(t=t.replace(/\\/g,"/"));let r=encodeURI(t).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(t,r),r}},wh=ZE,XE=Ho,sl=class extends XE{constructor(t){super(t),this.type="comment"}},Xo=sl;sl.default=sl;var{isClean:Rh,my:vh}=Cr,xh=Yo,kh=Xo,JE=Ho,Eh,Ul,zl,Ch;function Ah(e){return e.map(t=>(t.nodes&&(t.nodes=Ah(t.nodes)),delete t.source,t))}function Ph(e){if(e[Rh]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)Ph(t)}var mt=class Mh extends JE{append(...t){for(let n of t){let r=this.normalize(n,this.last);for(let i of r)this.proxyOf.nodes.push(i)}return this.markDirty(),this}cleanRaws(t){if(super.cleanRaws(t),this.nodes)for(let n of this.nodes)n.cleanRaws(t)}each(t){if(!this.proxyOf.nodes)return;let n=this.getIterator(),r,i;for(;this.indexes[n]<this.proxyOf.nodes.length&&(r=this.indexes[n],i=t(this.proxyOf.nodes[r],r),i!==!1);)this.indexes[n]+=1;return delete this.indexes[n],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,n){return n==="proxyOf"?t:t[n]?n==="each"||typeof n=="string"&&n.startsWith("walk")?(...r)=>t[n](...r.map(i=>typeof i=="function"?(o,s)=>i(o.toProxy(),s):i)):n==="every"||n==="some"?r=>t[n]((i,...o)=>r(i.toProxy(),...o)):n==="root"?()=>t.root().toProxy():n==="nodes"?t.nodes.map(r=>r.toProxy()):n==="first"||n==="last"?t[n].toProxy():t[n]:t[n]},set(t,n,r){return t[n]===r||(t[n]=r,(n==="name"||n==="params"||n==="selector")&&t.markDirty()),!0}}}index(t){return typeof t=="number"?t:(t.proxyOf&&(t=t.proxyOf),this.proxyOf.nodes.indexOf(t))}insertAfter(t,n){let r=this.index(t),i=this.normalize(n,this.proxyOf.nodes[r]).reverse();r=this.index(t);for(let s of i)this.proxyOf.nodes.splice(r+1,0,s);let o;for(let s in this.indexes)o=this.indexes[s],r<o&&(this.indexes[s]=o+i.length);return this.markDirty(),this}insertBefore(t,n){let r=this.index(t),i=r===0?"prepend":!1,o=this.normalize(n,this.proxyOf.nodes[r],i).reverse();r=this.index(t);for(let a of o)this.proxyOf.nodes.splice(r,0,a);let s;for(let a in this.indexes)s=this.indexes[a],r<=s&&(this.indexes[a]=s+o.length);return this.markDirty(),this}normalize(t,n){if(typeof t=="string")t=Ah(Eh(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 xh(t)]}else if(t.selector)t=[new Ul(t)];else if(t.name)t=[new zl(t)];else if(t.text)t=[new kh(t)];else throw new Error("Unknown node type in node creation");return t.map(i=>(i[vh]||Mh.rebuild(i),i=i.proxyOf,i.parent&&i.parent.removeChild(i),i[Rh]&&Ph(i),typeof i.raws.before>"u"&&n&&typeof n.raws.before<"u"&&(i.raws.before=n.raws.before.replace(/\S/g,"")),i.parent=this.proxyOf,i))}prepend(...t){t=t.reverse();for(let n of t){let r=this.normalize(n,this.first,"prepend").reverse();for(let i of r)this.proxyOf.nodes.unshift(i);for(let i in this.indexes)this.indexes[i]=this.indexes[i]+r.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 n;for(let r in this.indexes)n=this.indexes[r],n>=t&&(this.indexes[r]=n-1);return this.markDirty(),this}replaceValues(t,n,r){return r||(r=n,n={}),this.walkDecls(i=>{n.props&&!n.props.includes(i.prop)||n.fast&&!i.value.includes(n.fast)||(i.value=i.value.replace(t,r))}),this.markDirty(),this}some(t){return this.nodes.some(t)}walk(t){return this.each((n,r)=>{let i;try{i=t(n,r)}catch(o){throw n.addToError(o)}return i!==!1&&n.walk&&(i=n.walk(t)),i})}walkAtRules(t,n){return n?t instanceof RegExp?this.walk((r,i)=>{if(r.type==="atrule"&&t.test(r.name))return n(r,i)}):this.walk((r,i)=>{if(r.type==="atrule"&&r.name===t)return n(r,i)}):(n=t,this.walk((r,i)=>{if(r.type==="atrule")return n(r,i)}))}walkComments(t){return this.walk((n,r)=>{if(n.type==="comment")return t(n,r)})}walkDecls(t,n){return n?t instanceof RegExp?this.walk((r,i)=>{if(r.type==="decl"&&t.test(r.prop))return n(r,i)}):this.walk((r,i)=>{if(r.type==="decl"&&r.prop===t)return n(r,i)}):(n=t,this.walk((r,i)=>{if(r.type==="decl")return n(r,i)}))}walkRules(t,n){return n?t instanceof RegExp?this.walk((r,i)=>{if(r.type==="rule"&&t.test(r.selector))return n(r,i)}):this.walk((r,i)=>{if(r.type==="rule"&&r.selector===t)return n(r,i)}):(n=t,this.walk((r,i)=>{if(r.type==="rule")return n(r,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]}};mt.registerParse=e=>{Eh=e};mt.registerRule=e=>{Ul=e};mt.registerAtRule=e=>{zl=e};mt.registerRoot=e=>{Ch=e};var Kt=mt;mt.default=mt;mt.rebuild=e=>{e.type==="atrule"?Object.setPrototypeOf(e,zl.prototype):e.type==="rule"?Object.setPrototypeOf(e,Ul.prototype):e.type==="decl"?Object.setPrototypeOf(e,xh.prototype):e.type==="comment"?Object.setPrototypeOf(e,kh.prototype):e.type==="root"&&Object.setPrototypeOf(e,Ch.prototype),e[vh]=!0,e.nodes&&e.nodes.forEach(t=>{mt.rebuild(t)})};var QE=Kt,Oh,Ih,gr=class extends QE{constructor(t){super({type:"document",...t}),this.nodes||(this.nodes=[])}toResult(t={}){return new Oh(new Ih,this,t).stringify()}};gr.registerLazyResult=e=>{Oh=e};gr.registerProcessor=e=>{Ih=e};var Gl=gr;gr.default=gr;var bf={},Th=function(t){bf[t]||(bf[t]=!0,typeof console<"u"&&console.warn&&console.warn(t))},al=class{constructor(t,n={}){if(this.type="warning",this.text=t,n.node&&n.node.source){let r=n.node.rangeBy(n);this.line=r.start.line,this.column=r.start.column,this.endLine=r.end.line,this.endColumn=r.end.column}for(let r in n)this[r]=n[r]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}},$h=al;al.default=al;var eC=$h,ll=class{constructor(t,n,r){this.processor=t,this.messages=[],this.root=n,this.opts=r,this.css=void 0,this.map=void 0}toString(){return this.css}warn(t,n={}){n.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(n.plugin=this.lastPlugin.postcssPlugin);let r=new eC(t,n);return this.messages.push(r),r}warnings(){return this.messages.filter(t=>t.type==="warning")}get content(){return this.css}},ql=ll;ll.default=ll;var Va=39,wf=34,io=92,Rf=47,oo=10,lr=32,so=12,ao=9,lo=13,tC=91,nC=93,rC=40,iC=41,oC=123,sC=125,aC=59,lC=42,cC=58,uC=64,co=/[\t\n\f\r "#'()/;[\\\]{}]/g,uo=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,dC=/.[\r\n"'(/\\]/,vf=/[\da-f]/i,pC=function(t,n={}){let r=t.css.valueOf(),i=n.ignoreErrors,o,s,a,l,c,u,d,p,m,y,f=r.length,h=0,w=[],v=[];function g(){return h}function x(V){throw t.error("Unclosed "+V,h)}function T(){return v.length===0&&h>=f}function j(V){if(v.length)return v.pop();if(h>=f)return;let z=V?V.ignoreUnclosed:!1;switch(o=r.charCodeAt(h),o){case oo:case lr:case ao:case lo:case so:{s=h;do s+=1,o=r.charCodeAt(s);while(o===lr||o===oo||o===ao||o===lo||o===so);y=["space",r.slice(h,s)],h=s-1;break}case tC:case nC:case oC:case sC:case cC:case aC:case iC:{let ne=String.fromCharCode(o);y=[ne,ne,h];break}case rC:{if(p=w.length?w.pop()[1]:"",m=r.charCodeAt(h+1),p==="url"&&m!==Va&&m!==wf&&m!==lr&&m!==oo&&m!==ao&&m!==so&&m!==lo){s=h;do{if(u=!1,s=r.indexOf(")",s+1),s===-1)if(i||z){s=h;break}else x("bracket");for(d=s;r.charCodeAt(d-1)===io;)d-=1,u=!u}while(u);y=["brackets",r.slice(h,s+1),h,s],h=s}else s=r.indexOf(")",h+1),l=r.slice(h,s+1),s===-1||dC.test(l)?y=["(","(",h]:(y=["brackets",l,h,s],h=s);break}case Va:case wf:{a=o===Va?"'":'"',s=h;do{if(u=!1,s=r.indexOf(a,s+1),s===-1)if(i||z){s=h+1;break}else x("string");for(d=s;r.charCodeAt(d-1)===io;)d-=1,u=!u}while(u);y=["string",r.slice(h,s+1),h,s],h=s;break}case uC:{co.lastIndex=h+1,co.test(r),co.lastIndex===0?s=r.length-1:s=co.lastIndex-2,y=["at-word",r.slice(h,s+1),h,s],h=s;break}case io:{for(s=h,c=!0;r.charCodeAt(s+1)===io;)s+=1,c=!c;if(o=r.charCodeAt(s+1),c&&o!==Rf&&o!==lr&&o!==oo&&o!==ao&&o!==lo&&o!==so&&(s+=1,vf.test(r.charAt(s)))){for(;vf.test(r.charAt(s+1));)s+=1;r.charCodeAt(s+1)===lr&&(s+=1)}y=["word",r.slice(h,s+1),h,s],h=s;break}default:{o===Rf&&r.charCodeAt(h+1)===lC?(s=r.indexOf("*/",h+2)+1,s===0&&(i||z?s=r.length:x("comment")),y=["comment",r.slice(h,s+1),h,s],h=s):(uo.lastIndex=h+1,uo.test(r),uo.lastIndex===0?s=r.length-1:s=uo.lastIndex-2,y=["word",r.slice(h,s+1),h,s],w.push(y),h=s);break}}return h++,y}function te(V){v.push(V)}return{back:te,endOfFile:T,nextToken:j,position:g}},Nh=Kt,Do=class extends Nh{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)}},Kl=Do;Do.default=Do;Nh.registerAtRule(Do);var Lh=Kt,Dh,Fh,An=class extends Lh{constructor(t){super(t),this.type="root",this.nodes||(this.nodes=[])}normalize(t,n,r){let i=super.normalize(t);if(n){if(r==="prepend")this.nodes.length>1?n.raws.before=this.nodes[1].raws.before:delete n.raws.before;else if(this.first!==n)for(let o of i)o.raws.before=n.raws.before}return i}removeChild(t,n){let r=this.index(t);return!n&&r===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[r].raws.before),super.removeChild(t)}toResult(t={}){return new Dh(new Fh,this,t).stringify()}};An.registerLazyResult=e=>{Dh=e};An.registerProcessor=e=>{Fh=e};var Ar=An;An.default=An;Lh.registerRoot(An);var Sr={comma(e){return Sr.split(e,[","],!0)},space(e){let t=[" ",`
|
|
29
|
+
`," "];return Sr.split(e,t)},split(e,t,n){let r=[],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!==""&&r.push(i.trim()),i="",o=!1):i+=u;return(n||i!=="")&&r.push(i.trim()),r}},_h=Sr;Sr.default=Sr;var jh=Kt,fC=_h,Fo=class extends jh{constructor(t){super(t),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return fC.comma(this.selector)}set selectors(t){let n=this.selector?this.selector.match(/,\s*/):null,r=n?n[0]:","+this.raw("between","beforeOpen");this.selector=t.join(r)}},Hl=Fo;Fo.default=Fo;jh.registerRule(Fo);var hC=Yo,mC=pC,yC=Xo,gC=Kl,SC=Ar,xf=Hl,kf={empty:!0,space:!0};function bC(e){for(let t=e.length-1;t>=0;t--){let n=e[t],r=n[3]||n[2];if(r)return r}}var wC=class{constructor(t){this.input=t,this.root=new SC,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 n=new gC;n.name=t[1].slice(1),n.name===""&&this.unnamedAtrule(n,t),this.init(n,t[2]);let r,i,o,s=!1,a=!1,l=[],c=[];for(;!this.tokenizer.endOfFile();){if(t=this.tokenizer.nextToken(),r=t[0],r==="("||r==="["?c.push(r==="("?")":"]"):r==="{"&&c.length>0?c.push("}"):r===c[c.length-1]&&c.pop(),c.length===0)if(r===";"){n.source.end=this.getPosition(t[2]),n.source.end.offset++,this.semicolon=!0;break}else if(r==="{"){a=!0;break}else if(r==="}"){if(l.length>0){for(o=l.length-1,i=l[o];i&&i[0]==="space";)i=l[--o];i&&(n.source.end=this.getPosition(i[3]||i[2]),n.source.end.offset++)}this.end(t);break}else l.push(t);else l.push(t);if(this.tokenizer.endOfFile()){s=!0;break}}n.raws.between=this.spacesAndCommentsFromEnd(l),l.length?(n.raws.afterName=this.spacesAndCommentsFromStart(l),this.raw(n,"params",l),s&&(t=l[l.length-1],n.source.end=this.getPosition(t[3]||t[2]),n.source.end.offset++,this.spaces=n.raws.between,n.raws.between="")):(n.raws.afterName="",n.params=""),a&&(n.nodes=[],this.current=n)}checkMissedSemicolon(t){let n=this.colon(t);if(n===!1)return;let r=0,i;for(let o=n-1;o>=0&&(i=t[o],!(i[0]!=="space"&&(r+=1,r===2)));o--);throw this.input.error("Missed semicolon",i[0]==="word"?i[3]+1:i[2])}colon(t){let n=0,r,i,o;for(let[s,a]of t.entries()){if(r=a,i=r[0],i==="("&&(n+=1),i===")"&&(n-=1),n===0&&i===":")if(!o)this.doubleColon(r);else{if(o[0]==="word"&&o[1]==="progid")continue;return s}o=r}return!1}comment(t){let n=new yC;this.init(n,t[2]),n.source.end=this.getPosition(t[3]||t[2]),n.source.end.offset++;let r=t[1].slice(2,-2);if(/^\s*$/.test(r))n.text="",n.raws.left=r,n.raws.right="";else{let i=r.match(/^(\s*)([^]*\S)(\s*)$/);n.text=i[2],n.raws.left=i[1],n.raws.right=i[3]}}createTokenizer(){this.tokenizer=mC(this.input)}decl(t,n){let r=new hC;this.init(r,t[0][2]);let i=t[t.length-1];for(i[0]===";"&&(this.semicolon=!0,t.pop()),r.source.end=this.getPosition(i[3]||i[2]||bC(t)),r.source.end.offset++;t[0][0]!=="word";)t.length===1&&this.unknownWord(t),r.raws.before+=t.shift()[1];for(r.source.start=this.getPosition(t[0][2]),r.prop="";t.length;){let c=t[0][0];if(c===":"||c==="space"||c==="comment")break;r.prop+=t.shift()[1]}r.raws.between="";let o;for(;t.length;)if(o=t.shift(),o[0]===":"){r.raws.between+=o[1];break}else o[0]==="word"&&/\w/.test(o[1])&&this.unknownWord([o]),r.raws.between+=o[1];(r.prop[0]==="_"||r.prop[0]==="*")&&(r.raws.before+=r.prop[0],r.prop=r.prop.slice(1));let 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"){r.important=!0;let u=this.stringFrom(t,c);u=this.spacesFromEnd(t)+u,u!==" !important"&&(r.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&&(r.important=!0,r.raws.important=d,t=u)}if(o[0]!=="space"&&o[0]!=="comment")break}t.some(c=>c[0]!=="space"&&c[0]!=="comment")&&(r.raws.between+=s.map(c=>c[1]).join(""),s=[]),this.raw(r,"value",s.concat(t),n),r.value.includes(":")&&!n&&this.checkMissedSemicolon(t)}doubleColon(t){throw this.input.error("Double colon",{offset:t[2]},{offset:t[2]+t[1].length})}emptyRule(t){let n=new xf;this.init(n,t[2]),n.selector="",n.raws.between="",this.current=n}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 n=this.current.nodes[this.current.nodes.length-1];n&&n.type==="rule"&&!n.raws.ownSemicolon&&(n.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(t){let n=this.input.fromOffset(t);return{column:n.col,line:n.line,offset:t}}init(t,n){this.current.push(t),t.source={input:this.input,start:this.getPosition(n)},t.raws.before=this.spaces,this.spaces="",t.type!=="comment"&&(this.semicolon=!1)}other(t){let n=!1,r=null,i=!1,o=null,s=[],a=t[1].startsWith("--"),l=[],c=t;for(;c;){if(r=c[0],l.push(c),r==="("||r==="[")o||(o=c),s.push(r==="("?")":"]");else if(a&&i&&r==="{")o||(o=c),s.push("}");else if(s.length===0)if(r===";")if(i){this.decl(l,a);return}else break;else if(r==="{"){this.rule(l);return}else if(r==="}"){this.tokenizer.back(l.pop()),n=!0;break}else r===":"&&(i=!0);else r===s[s.length-1]&&(s.pop(),s.length===0&&(o=null));c=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(n=!0),s.length>0&&this.unclosedBracket(o),n&&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,n,r,i){let o,s,a=r.length,l="",c=!0,u,d;for(let p=0;p<a;p+=1)o=r[p],s=o[0],s==="space"&&p===a-1&&!i?c=!1:s==="comment"?(d=r[p-1]?r[p-1][0]:"empty",u=r[p+1]?r[p+1][0]:"empty",!kf[d]&&!kf[u]?l.slice(-1)===","?c=!1:l+=o[1]:c=!1):l+=o[1];if(!c){let p=r.reduce((m,y)=>m+y[1],"");t.raws[n]={raw:p,value:l}}t[n]=l}rule(t){t.pop();let n=new xf;this.init(n,t[0][2]),n.raws.between=this.spacesAndCommentsFromEnd(t),this.raw(n,"selector",t),this.current=n}spacesAndCommentsFromEnd(t){let n,r="";for(;t.length&&(n=t[t.length-1][0],!(n!=="space"&&n!=="comment"));)r=t.pop()[1]+r;return r}spacesAndCommentsFromStart(t){let n,r="";for(;t.length&&(n=t[0][0],!(n!=="space"&&n!=="comment"));)r+=t.shift()[1];return r}spacesFromEnd(t){let n,r="";for(;t.length&&(n=t[t.length-1][0],n==="space");)r=t.pop()[1]+r;return r}stringFrom(t,n){let r="";for(let i=n;i<t.length;i++)r+=t[i][1];return t.splice(n,t.length-n),r}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,n){throw this.input.error("At-rule without name",{offset:n[2]},{offset:n[2]+n[1].length})}},RC=wC,vC=Kt,xC=RC,kC=Zo;function _o(e,t){let n=new kC(e,t),r=new xC(n);try{r.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 r.root}var Yl=_o;_o.default=_o;vC.registerParse(_o);var{isClean:Qe,my:EC}=Cr,CC=wh,AC=Ko,PC=Kt,MC=Gl,OC=Th,Ef=ql,IC=Yl,TC=Ar,$C={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},NC={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},LC={Once:!0,postcssPlugin:!0,prepare:!0},Pn=0;function cr(e){return typeof e=="object"&&typeof e.then=="function"}function Bh(e){let t=!1,n=$C[e.type];return e.type==="decl"?t=e.prop.toLowerCase():e.type==="atrule"&&(t=e.name.toLowerCase()),t&&e.append?[n,n+"-"+t,Pn,n+"Exit",n+"Exit-"+t]:t?[n,n+"-"+t,n+"Exit",n+"Exit-"+t]:e.append?[n,Pn,n+"Exit"]:[n,n+"Exit"]}function Cf(e){let t;return e.type==="document"?t=["Document",Pn,"DocumentExit"]:e.type==="root"?t=["Root",Pn,"RootExit"]:t=Bh(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function cl(e){return e[Qe]=!1,e.nodes&&e.nodes.forEach(t=>cl(t)),e}var ul={},Mn=class Vh{constructor(t,n,r){this.stringified=!1,this.processed=!1;let i;if(typeof n=="object"&&n!==null&&(n.type==="root"||n.type==="document"))i=cl(n);else if(n instanceof Vh||n instanceof Ef)i=cl(n.root),n.map&&(typeof r.map>"u"&&(r.map={}),r.map.inline||(r.map.inline=!1),r.map.prev=n.map);else{let o=IC;r.syntax&&(o=r.syntax.parse),r.parser&&(o=r.parser),o.parse&&(o=o.parse);try{i=o(n,r)}catch(s){this.processed=!0,this.error=s}i&&!i[EC]&&PC.rebuild(i)}this.result=new Ef(t,i,r),this.helpers={...ul,postcss:ul,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,n){let r=this.result.lastPlugin;try{if(n&&n.addToError(t),this.error=t,t.name==="CssSyntaxError"&&!t.plugin)t.plugin=r.postcssPlugin,t.setMessage();else if(r.postcssVersion&&process.env.NODE_ENV!=="production"){let i=r.postcssPlugin,o=r.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=(n,r,i)=>{this.listeners[r]||(this.listeners[r]=[]),this.listeners[r].push([n,i])};for(let n of this.plugins)if(typeof n=="object")for(let r in n){if(!NC[r]&&/^[A-Z]/.test(r))throw new Error(`Unknown event ${r} in ${n.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!LC[r])if(typeof n[r]=="object")for(let i in n[r])i==="*"?t(n,r,n[r][i]):t(n,r+"-"+i.toLowerCase(),n[r][i]);else typeof n[r]=="function"&&t(n,r,n[r])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let t=0;t<this.plugins.length;t++){let n=this.plugins[t],r=this.runOnRoot(n);if(cr(r))try{await r}catch(i){throw this.handleError(i)}}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[Qe];){t[Qe]=!0;let n=[Cf(t)];for(;n.length>0;){let r=this.visitTick(n);if(cr(r))try{await r}catch(i){let o=n[n.length-1].node;throw this.handleError(i,o)}}}if(this.listeners.OnceExit)for(let[n,r]of this.listeners.OnceExit){this.result.lastPlugin=n;try{if(t.type==="document"){let i=t.nodes.map(o=>r(o,this.helpers));await Promise.all(i)}else await r(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 n=this.result.root.nodes.map(r=>t.Once(r,this.helpers));return cr(n[0])?Promise.all(n):n}return t.Once(this.result.root,this.helpers)}else if(typeof t=="function")return t(this.result.root,this.result)}catch(n){throw this.handleError(n)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let t=this.result.opts,n=AC;t.syntax&&(n=t.syntax.stringify),t.stringifier&&(n=t.stringifier),n.stringify&&(n=n.stringify);let i=new CC(n,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 n=this.runOnRoot(t);if(cr(n))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[Qe];)t[Qe]=!0,this.walkSync(t);if(this.listeners.OnceExit)if(t.type==="document")for(let n of t.nodes)this.visitSync(this.listeners.OnceExit,n);else this.visitSync(this.listeners.OnceExit,t)}return this.result}then(t,n){return process.env.NODE_ENV!=="production"&&("from"in this.opts||OC("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,n)}toString(){return this.css}visitSync(t,n){for(let[r,i]of t){this.result.lastPlugin=r;let o;try{o=i(n,this.helpers)}catch(s){throw this.handleError(s,n.proxyOf)}if(n.type!=="root"&&n.type!=="document"&&!n.parent)return!0;if(cr(o))throw this.getAsyncError()}}visitTick(t){let n=t[t.length-1],{node:r,visitors:i}=n;if(r.type!=="root"&&r.type!=="document"&&!r.parent){t.pop();return}if(i.length>0&&n.visitorIndex<i.length){let[s,a]=i[n.visitorIndex];n.visitorIndex+=1,n.visitorIndex===i.length&&(n.visitors=[],n.visitorIndex=0),this.result.lastPlugin=s;try{return a(r.toProxy(),this.helpers)}catch(l){throw this.handleError(l,r)}}if(n.iterator!==0){let s=n.iterator,a;for(;a=r.nodes[r.indexes[s]];)if(r.indexes[s]+=1,!a[Qe]){a[Qe]=!0,t.push(Cf(a));return}n.iterator=0,delete r.indexes[s]}let o=n.events;for(;n.eventIndex<o.length;){let s=o[n.eventIndex];if(n.eventIndex+=1,s===Pn){r.nodes&&r.nodes.length&&(r[Qe]=!0,n.iterator=r.getIterator());return}else if(this.listeners[s]){n.visitors=this.listeners[s];return}}t.pop()}walkSync(t){t[Qe]=!0;let n=Bh(t);for(let r of n)if(r===Pn)t.nodes&&t.each(i=>{i[Qe]||this.walkSync(i)});else{let i=this.listeners[r];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"}};Mn.registerPostcss=e=>{ul=e};var Wh=Mn;Mn.default=Mn;TC.registerLazyResult(Mn);MC.registerLazyResult(Mn);var DC=wh,FC=Ko,_C=Th,jC=Yl,BC=ql,dl=class{constructor(t,n,r){n=n.toString(),this.stringified=!1,this._processor=t,this._css=n,this._opts=r,this._map=void 0;let i,o=FC;this.result=new BC(this._processor,i,this._opts),this.result.css=n;let s=this;Object.defineProperty(this.result,"root",{get(){return s.root}});let a=new DC(o,i,this._opts,n);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,n){return process.env.NODE_ENV!=="production"&&("from"in this._opts||_C("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,n)}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,n=jC;try{t=n(this._css,this._opts)}catch(r){this.error=r}if(this.error)throw this.error;return this._root=t,t}get[Symbol.toStringTag](){return"NoWorkResult"}},VC=dl;dl.default=dl;var WC=VC,UC=Wh,zC=Gl,GC=Ar,br=class{constructor(t=[]){this.version="8.4.38",this.plugins=this.normalize(t)}normalize(t){let n=[];for(let r of t)if(r.postcss===!0?r=r():r.postcss&&(r=r.postcss),typeof r=="object"&&Array.isArray(r.plugins))n=n.concat(r.plugins);else if(typeof r=="object"&&r.postcssPlugin)n.push(r);else if(typeof r=="function")n.push(r);else if(typeof r=="object"&&(r.parse||r.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(r+" is not a PostCSS plugin");return n}process(t,n={}){return!this.plugins.length&&!n.parser&&!n.stringifier&&!n.syntax?new WC(this,t,n):new UC(this,t,n)}use(t){return this.plugins=this.plugins.concat(this.normalize([t])),this}},qC=br;br.default=br;GC.registerProcessor(br);zC.registerProcessor(br);var KC=Yo,HC=mh,YC=Xo,ZC=Kl,XC=Zo,JC=Ar,QC=Hl;function wr(e,t){if(Array.isArray(e))return e.map(i=>wr(i));let{inputs:n,...r}=e;if(n){t=[];for(let i of n){let o={...i,__proto__:XC.prototype};o.map&&(o.map={...o.map,__proto__:HC.prototype}),t.push(o)}}if(r.nodes&&(r.nodes=e.nodes.map(i=>wr(i,t))),r.source){let{inputId:i,...o}=r.source;r.source=o,i!=null&&(r.source.input=t[i])}if(r.type==="root")return new JC(r);if(r.type==="decl")return new KC(r);if(r.type==="rule")return new QC(r);if(r.type==="comment")return new YC(r);if(r.type==="atrule")return new ZC(r);throw new Error("Unknown node type: "+e.type)}var eA=wr;wr.default=wr;var tA=Wl,Uh=Yo,nA=Wh,rA=Kt,Zl=qC,iA=Ko,oA=eA,zh=Gl,sA=$h,Gh=Xo,qh=Kl,aA=ql,lA=Zo,cA=Yl,uA=_h,Kh=Hl,Hh=Ar,dA=Ho;function F(...e){return e.length===1&&Array.isArray(e[0])&&(e=e[0]),new Zl(e)}F.plugin=function(t,n){let r=!1;function i(...s){console&&console.warn&&!r&&(r=!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=n(...s);return a.postcssPlugin=t,a.postcssVersion=new Zl().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=iA;F.parse=cA;F.fromJSON=oA;F.list=uA;F.comment=e=>new Gh(e);F.atRule=e=>new qh(e);F.decl=e=>new Uh(e);F.rule=e=>new Kh(e);F.root=e=>new Hh(e);F.document=e=>new zh(e);F.CssSyntaxError=tA;F.Declaration=Uh;F.Container=rA;F.Processor=Zl;F.Document=zh;F.Comment=Gh;F.Warning=sA;F.AtRule=qh;F.Result=aA;F.Input=lA;F.Rule=Kh;F.Root=Hh;F.Node=dA;nA.registerPostcss(F);var pA=F;F.default=F;var H=vE(pA);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 fA=Object.defineProperty,hA=(e,t,n)=>t in e?fA(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Te=(e,t,n)=>hA(e,typeof t!="symbol"?t+"":t,n);function mA(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function yA(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var Xl={exports:{}},K=String,Yh=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}};Xl.exports=Yh();Xl.exports.createColors=Yh;var gA=Xl.exports,SA={},bA=Object.freeze(Object.defineProperty({__proto__:null,default:SA},Symbol.toStringTag,{value:"Module"})),je=yA(bA),Af=gA,Pf=je,pl=class Zh extends Error{constructor(t,n,r,i,o,s){super(t),this.name="CssSyntaxError",this.reason=t,o&&(this.file=o),i&&(this.source=i),s&&(this.plugin=s),typeof n<"u"&&typeof r<"u"&&(typeof n=="number"?(this.line=n,this.column=r):(this.line=n.line,this.column=n.column,this.endLine=r.line,this.endColumn=r.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,Zh)}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 n=this.source;t==null&&(t=Af.isColorSupported),Pf&&t&&(n=Pf(n));let r=n.split(/\r?\n/),i=Math.max(this.line-3,0),o=Math.min(this.line+2,r.length),s=String(o).length,a,l;if(t){let{bold:c,gray:u,red:d}=Af.createColors(!0);a=p=>c(d(p)),l=p=>u(p)}else a=l=c=>c;return r.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}},Jl=pl;pl.default=pl;var Pr={};Pr.isClean=Symbol("isClean");Pr.my=Symbol("my");var Mf={after:`
|
|
40
|
+
`,beforeClose:`
|
|
41
|
+
`,beforeComment:`
|
|
42
|
+
`,beforeDecl:`
|
|
43
|
+
`,beforeOpen:" ",beforeRule:`
|
|
44
|
+
`,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function wA(e){return e[0].toUpperCase()+e.slice(1)}var fl=class{constructor(t){this.builder=t}atrule(t,n){let r="@"+t.name,i=t.params?this.rawValue(t,"params"):"";if(typeof t.raws.afterName<"u"?r+=t.raws.afterName:i&&(r+=" "),t.nodes)this.block(t,r+i);else{let o=(t.raws.between||"")+(n?";":"");this.builder(r+i+o,t)}}beforeAfter(t,n){let r;t.type==="decl"?r=this.raw(t,null,"beforeDecl"):t.type==="comment"?r=this.raw(t,null,"beforeComment"):n==="before"?r=this.raw(t,null,"beforeRule"):r=this.raw(t,null,"beforeClose");let i=t.parent,o=0;for(;i&&i.type!=="root";)o+=1,i=i.parent;if(r.includes(`
|
|
45
|
+
`)){let s=this.raw(t,null,"indent");if(s.length)for(let a=0;a<o;a++)r+=s}return r}block(t,n){let r=this.raw(t,"between","beforeOpen");this.builder(n+r+"{",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 n=t.nodes.length-1;for(;n>0&&t.nodes[n].type==="comment";)n-=1;let r=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,n!==i||r)}}comment(t){let n=this.raw(t,"left","commentLeft"),r=this.raw(t,"right","commentRight");this.builder("/*"+n+t.text+r+"*/",t)}decl(t,n){let r=this.raw(t,"between","colon"),i=t.prop+r+this.rawValue(t,"value");t.important&&(i+=t.raws.important||" !important"),n&&(i+=";"),this.builder(i,t)}document(t){this.body(t)}raw(t,n,r){let i;if(r||(r=n),n&&(i=t.raws[n],typeof i<"u"))return i;let o=t.parent;if(r==="before"&&(!o||o.type==="root"&&o.first===t||o&&o.type==="document"))return"";if(!o)return Mf[r];let s=t.root();if(s.rawCache||(s.rawCache={}),typeof s.rawCache[r]<"u")return s.rawCache[r];if(r==="before"||r==="after")return this.beforeAfter(t,r);{let a="raw"+wA(r);this[a]?i=this[a](s,t):s.walk(l=>{if(i=l.raws[n],typeof i<"u")return!1})}return typeof i>"u"&&(i=Mf[r]),s.rawCache[r]=i,i}rawBeforeClose(t){let n;return t.walk(r=>{if(r.nodes&&r.nodes.length>0&&typeof r.raws.after<"u")return n=r.raws.after,n.includes(`
|
|
46
|
+
`)&&(n=n.replace(/[^\n]+$/,"")),!1}),n&&(n=n.replace(/\S/g,"")),n}rawBeforeComment(t,n){let r;return t.walkComments(i=>{if(typeof i.raws.before<"u")return r=i.raws.before,r.includes(`
|
|
47
|
+
`)&&(r=r.replace(/[^\n]+$/,"")),!1}),typeof r>"u"?r=this.raw(n,null,"beforeDecl"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeDecl(t,n){let r;return t.walkDecls(i=>{if(typeof i.raws.before<"u")return r=i.raws.before,r.includes(`
|
|
48
|
+
`)&&(r=r.replace(/[^\n]+$/,"")),!1}),typeof r>"u"?r=this.raw(n,null,"beforeRule"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeOpen(t){let n;return t.walk(r=>{if(r.type!=="decl"&&(n=r.raws.between,typeof n<"u"))return!1}),n}rawBeforeRule(t){let n;return t.walk(r=>{if(r.nodes&&(r.parent!==t||t.first!==r)&&typeof r.raws.before<"u")return n=r.raws.before,n.includes(`
|
|
49
|
+
`)&&(n=n.replace(/[^\n]+$/,"")),!1}),n&&(n=n.replace(/\S/g,"")),n}rawColon(t){let n;return t.walkDecls(r=>{if(typeof r.raws.between<"u")return n=r.raws.between.replace(/[^\s:]/g,""),!1}),n}rawEmptyBody(t){let n;return t.walk(r=>{if(r.nodes&&r.nodes.length===0&&(n=r.raws.after,typeof n<"u"))return!1}),n}rawIndent(t){if(t.raws.indent)return t.raws.indent;let n;return t.walk(r=>{let i=r.parent;if(i&&i!==t&&i.parent&&i.parent===t&&typeof r.raws.before<"u"){let o=r.raws.before.split(`
|
|
50
|
+
`);return n=o[o.length-1],n=n.replace(/\S/g,""),!1}}),n}rawSemicolon(t){let n;return t.walk(r=>{if(r.nodes&&r.nodes.length&&r.last.type==="decl"&&(n=r.raws.semicolon,typeof n<"u"))return!1}),n}rawValue(t,n){let r=t[n],i=t.raws[n];return i&&i.value===r?i.raw:r}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,n){if(!this[t.type])throw new Error("Unknown AST node type "+t.type+". Maybe you need to change PostCSS stringifier.");this[t.type](t,n)}},Xh=fl;fl.default=fl;var RA=Xh;function hl(e,t){new RA(t).stringify(e)}var Jo=hl;hl.default=hl;var{isClean:po,my:vA}=Pr,xA=Jl,kA=Xh,EA=Jo;function ml(e,t){let n=new e.constructor;for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r)||r==="proxyCache")continue;let i=e[r],o=typeof i;r==="parent"&&o==="object"?t&&(n[r]=t):r==="source"?n[r]=i:Array.isArray(i)?n[r]=i.map(s=>ml(s,n)):(o==="object"&&i!==null&&(i=ml(i)),n[r]=i)}return n}var yl=class{constructor(t={}){this.raws={},this[po]=!1,this[vA]=!0;for(let n in t)if(n==="nodes"){this.nodes=[];for(let r of t[n])typeof r.clone=="function"?this.append(r.clone()):this.append(r)}else this[n]=t[n]}addToError(t){if(t.postcssNode=this,t.stack&&this.source&&/\n\s{4}at /.test(t.stack)){let n=this.source;t.stack=t.stack.replace(/\n\s{4}at /,`$&${n.input.from}:${n.start.line}:${n.start.column}$&`)}return t}after(t){return this.parent.insertAfter(this,t),this}assign(t={}){for(let n in t)this[n]=t[n];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 n=ml(this);for(let r in t)n[r]=t[r];return n}cloneAfter(t={}){let n=this.clone(t);return this.parent.insertAfter(this,n),n}cloneBefore(t={}){let n=this.clone(t);return this.parent.insertBefore(this,n),n}error(t,n={}){if(this.source){let{end:r,start:i}=this.rangeBy(n);return this.source.input.error(t,{column:i.column,line:i.line},{column:r.column,line:r.line},n)}return new xA(t)}getProxyProcessor(){return{get(t,n){return n==="proxyOf"?t:n==="root"?()=>t.root().toProxy():t[n]},set(t,n,r){return t[n]===r||(t[n]=r,(n==="prop"||n==="value"||n==="name"||n==="params"||n==="important"||n==="text")&&t.markDirty()),!0}}}markDirty(){if(this[po]){this[po]=!1;let t=this;for(;t=t.parent;)t[po]=!1}}next(){if(!this.parent)return;let t=this.parent.index(this);return this.parent.nodes[t+1]}positionBy(t,n){let r=this.source.start;if(t.index)r=this.positionInside(t.index,n);else if(t.word){n=this.toString();let i=n.indexOf(t.word);i!==-1&&(r=this.positionInside(i,n))}return r}positionInside(t,n){let r=n||this.toString(),i=this.source.start.column,o=this.source.start.line;for(let s=0;s<t;s++)r[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 n={column:this.source.start.column,line:this.source.start.line},r=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:n.column+1,line:n.line};if(t.word){let i=this.toString(),o=i.indexOf(t.word);o!==-1&&(n=this.positionInside(o,i),r=this.positionInside(o+t.word.length,i))}else t.start?n={column:t.start.column,line:t.start.line}:t.index&&(n=this.positionInside(t.index)),t.end?r={column:t.end.column,line:t.end.line}:typeof t.endIndex=="number"?r=this.positionInside(t.endIndex):t.index&&(r=this.positionInside(t.index+1));return(r.line<n.line||r.line===n.line&&r.column<=n.column)&&(r={column:n.column+1,line:n.line}),{end:r,start:n}}raw(t,n){return new kA().raw(this,t,n)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...t){if(this.parent){let n=this,r=!1;for(let i of t)i===this?r=!0:r?(this.parent.insertAfter(n,i),n=i):this.parent.insertBefore(n,i);r||this.remove()}return this}root(){let t=this;for(;t.parent&&t.parent.type!=="document";)t=t.parent;return t}toJSON(t,n){let r={},i=n==null;n=n||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))r[s]=a.map(l=>typeof l=="object"&&l.toJSON?l.toJSON(null,n):l);else if(typeof a=="object"&&a.toJSON)r[s]=a.toJSON(null,n);else if(s==="source"){let l=n.get(a.input);l==null&&(l=o,n.set(a.input,o),o++),r[s]={end:a.end,inputId:l,start:a.start}}else r[s]=a}return i&&(r.inputs=[...n.keys()].map(s=>s.toJSON())),r}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(t=EA){t.stringify&&(t=t.stringify);let n="";return t(this,r=>{n+=r}),n}warn(t,n,r){let i={node:this};for(let o in r)i[o]=r[o];return t.warn(n,i)}get proxyOf(){return this}},Qo=yl;yl.default=yl;var CA=Qo,gl=class extends CA{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]==="$"}},es=gl;gl.default=gl;var AA="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",PA=(e,t=21)=>(n=t)=>{let r="",i=n;for(;i--;)r+=e[Math.random()*e.length|0];return r},MA=(e=21)=>{let t="",n=e;for(;n--;)t+=AA[Math.random()*64|0];return t},OA={nanoid:MA,customAlphabet:PA},{SourceMapConsumer:Of,SourceMapGenerator:If}=je,{existsSync:IA,readFileSync:TA}=je,{dirname:Wa,join:$A}=je;function NA(e){return Buffer?Buffer.from(e,"base64").toString():window.atob(e)}var Sl=class{constructor(t,n){if(n.map===!1)return;this.loadAnnotation(t),this.inline=this.startWith(this.annotation,"data:");let r=n.map?n.map.prev:void 0,i=this.loadMap(n.from,r);!this.mapFile&&n.from&&(this.mapFile=n.from),this.mapFile&&(this.root=Wa(this.mapFile)),i&&(this.text=i)}consumer(){return this.consumerCache||(this.consumerCache=new Of(this.text)),this.consumerCache}decodeInline(t){let n=/^data:application\/json;charset=utf-?8;base64,/,r=/^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(n.test(t)||r.test(t))return NA(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 n=t.match(/\/\*\s*# sourceMappingURL=/gm);if(!n)return;let r=t.lastIndexOf(n.pop()),i=t.indexOf("*/",r);r>-1&&i>-1&&(this.annotation=this.getAnnotationURL(t.substring(r,i)))}loadFile(t){if(this.root=Wa(t),IA(t))return this.mapFile=t,TA(t,"utf-8").toString().trim()}loadMap(t,n){if(n===!1)return!1;if(n){if(typeof n=="string")return n;if(typeof n=="function"){let r=n(t);if(r){let i=this.loadFile(r);if(!i)throw new Error("Unable to load previous source map: "+r.toString());return i}}else{if(n instanceof Of)return If.fromSourceMap(n).toString();if(n instanceof If)return n.toString();if(this.isMap(n))return JSON.stringify(n);throw new Error("Unsupported previous source map format: "+n.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let r=this.annotation;return t&&(r=$A(Wa(t),r)),this.loadFile(r)}}}startWith(t,n){return t?t.substr(0,n.length)===n:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}},Jh=Sl;Sl.default=Sl;var{SourceMapConsumer:LA,SourceMapGenerator:DA}=je,{fileURLToPath:Tf,pathToFileURL:fo}=je,{isAbsolute:bl,resolve:wl}=je,{nanoid:FA}=OA,Ua=je,$f=Jl,_A=Jh,za=Symbol("fromOffsetCache"),jA=!!(LA&&DA),Nf=!!(wl&&bl),jo=class{constructor(t,n={}){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,n.from&&(!Nf||/^\w+:\/\//.test(n.from)||bl(n.from)?this.file=n.from:this.file=wl(n.from)),Nf&&jA){let r=new _A(this.css,n);if(r.text){this.map=r;let i=r.consumer().file;!this.file&&i&&(this.file=this.mapResolve(i))}}this.file||(this.id="<input css "+FA(6)+">"),this.map&&(this.map.file=this.from)}error(t,n,r,i={}){let o,s,a;if(n&&typeof n=="object"){let c=n,u=r;if(typeof c.offset=="number"){let d=this.fromOffset(c.offset);n=d.line,r=d.col}else n=c.line,r=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(!r){let c=this.fromOffset(n);n=c.line,r=c.col}let l=this.origin(n,r,s,a);return l?o=new $f(t,l.endLine===void 0?l.line:{column:l.column,line:l.line},l.endLine===void 0?l.column:{column:l.endColumn,line:l.endLine},l.source,l.file,i.plugin):o=new $f(t,s===void 0?n:{column:r,line:n},s===void 0?r:{column:a,line:s},this.css,this.file,i.plugin),o.input={column:r,endColumn:a,endLine:s,line:n,source:this.css},this.file&&(fo&&(o.input.url=fo(this.file).toString()),o.input.file=this.file),o}fromOffset(t){let n,r;if(this[za])r=this[za];else{let o=this.css.split(`
|
|
52
|
+
`);r=new Array(o.length);let s=0;for(let a=0,l=o.length;a<l;a++)r[a]=s,s+=o[a].length+1;this[za]=r}n=r[r.length-1];let i=0;if(t>=n)i=r.length-1;else{let o=r.length-2,s;for(;i<o;)if(s=i+(o-i>>1),t<r[s])o=s-1;else if(t>=r[s+1])i=s+1;else{i=s;break}}return{col:t-r[i]+1,line:i+1}}mapResolve(t){return/^\w+:\/\//.test(t)?t:wl(this.map.consumer().sourceRoot||this.map.root||".",t)}origin(t,n,r,i){if(!this.map)return!1;let o=this.map.consumer(),s=o.originalPositionFor({column:n,line:t});if(!s.source)return!1;let a;typeof r=="number"&&(a=o.originalPositionFor({column:i,line:r}));let l;bl(s.source)?l=fo(s.source):l=new URL(s.source,this.map.consumer().sourceRoot||fo(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(Tf)c.file=Tf(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 n of["hasBOM","css","file","id"])this[n]!=null&&(t[n]=this[n]);return this.map&&(t.map={...this.map},t.map.consumerCache&&(t.map.consumerCache=void 0)),t}get from(){return this.file||this.id}},ts=jo;jo.default=jo;Ua&&Ua.registerInput&&Ua.registerInput(jo);var{SourceMapConsumer:Qh,SourceMapGenerator:Co}=je,{dirname:Ao,relative:em,resolve:tm,sep:nm}=je,{pathToFileURL:Lf}=je,BA=ts,VA=!!(Qh&&Co),WA=!!(Ao&&tm&&em&&nm),UA=class{constructor(t,n,r,i){this.stringify=t,this.mapOpts=r.map||{},this.root=n,this.opts=r,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 n=`
|
|
53
|
+
`;this.css.includes(`\r
|
|
54
|
+
`)&&(n=`\r
|
|
55
|
+
`),this.css+=n+"/*# sourceMappingURL="+t+" */"}applyPrevMaps(){for(let t of this.previous()){let n=this.toUrl(this.path(t.file)),r=t.root||Ao(t.file),i;this.mapOpts.sourcesContent===!1?(i=new Qh(t.text),i.sourcesContent&&(i.sourcesContent=null)):i=t.consumer(),this.map.applySourceMap(i,n,this.toUrl(this.path(r)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1)if(this.root){let t;for(let n=this.root.nodes.length-1;n>=0;n--)t=this.root.nodes[n],t.type==="comment"&&t.text.indexOf("# sourceMappingURL=")===0&&this.root.removeChild(n)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),WA&&VA&&this.isMap())return this.generateMap();{let t="";return this.stringify(this.root,n=>{t+=n}),[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=Co.fromSourceMap(t,{ignoreInvalidMapping:!0})}else this.map=new Co({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 Co({file:this.outputFile(),ignoreInvalidMapping:!0});let t=1,n=1,r="<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=n-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=r,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
|
+
`),n=a.length-s):n+=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=n-2,this.map.addMapping(i)):(i.source=r,i.original.line=1,i.original.column=0,i.generated.line=t,i.generated.column=n-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(n=>n.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 n=this.memoizedPaths.get(t);if(n)return n;let r=this.opts.to?Ao(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(r=Ao(tm(r,this.mapOpts.annotation)));let i=em(r,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 n=t.source.input.map;this.previousMaps.includes(n)||this.previousMaps.push(n)}});else{let t=new BA(this.originalCSS,this.opts);t.map&&this.previousMaps.push(t.map)}return this.previousMaps}setSourcesContent(){let t={};if(this.root)this.root.walk(n=>{if(n.source){let r=n.source.input.from;if(r&&!t[r]){t[r]=!0;let i=this.usesFileUrls?this.toFileUrl(r):this.toUrl(this.path(r));this.map.setSourceContent(i,n.source.input.css)}}});else if(this.css){let n=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(n,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 n=this.memoizedFileURLs.get(t);if(n)return n;if(Lf){let r=Lf(t).toString();return this.memoizedFileURLs.set(t,r),r}else throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(t){let n=this.memoizedURLs.get(t);if(n)return n;nm==="\\"&&(t=t.replace(/\\/g,"/"));let r=encodeURI(t).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(t,r),r}},rm=UA,zA=Qo,Rl=class extends zA{constructor(t){super(t),this.type="comment"}},ns=Rl;Rl.default=Rl;var{isClean:im,my:om}=Pr,sm=es,am=ns,GA=Qo,lm,Ql,ec,cm;function um(e){return e.map(t=>(t.nodes&&(t.nodes=um(t.nodes)),delete t.source,t))}function dm(e){if(e[im]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)dm(t)}var yt=class pm extends GA{append(...t){for(let n of t){let r=this.normalize(n,this.last);for(let i of r)this.proxyOf.nodes.push(i)}return this.markDirty(),this}cleanRaws(t){if(super.cleanRaws(t),this.nodes)for(let n of this.nodes)n.cleanRaws(t)}each(t){if(!this.proxyOf.nodes)return;let n=this.getIterator(),r,i;for(;this.indexes[n]<this.proxyOf.nodes.length&&(r=this.indexes[n],i=t(this.proxyOf.nodes[r],r),i!==!1);)this.indexes[n]+=1;return delete this.indexes[n],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,n){return n==="proxyOf"?t:t[n]?n==="each"||typeof n=="string"&&n.startsWith("walk")?(...r)=>t[n](...r.map(i=>typeof i=="function"?(o,s)=>i(o.toProxy(),s):i)):n==="every"||n==="some"?r=>t[n]((i,...o)=>r(i.toProxy(),...o)):n==="root"?()=>t.root().toProxy():n==="nodes"?t.nodes.map(r=>r.toProxy()):n==="first"||n==="last"?t[n].toProxy():t[n]:t[n]},set(t,n,r){return t[n]===r||(t[n]=r,(n==="name"||n==="params"||n==="selector")&&t.markDirty()),!0}}}index(t){return typeof t=="number"?t:(t.proxyOf&&(t=t.proxyOf),this.proxyOf.nodes.indexOf(t))}insertAfter(t,n){let r=this.index(t),i=this.normalize(n,this.proxyOf.nodes[r]).reverse();r=this.index(t);for(let s of i)this.proxyOf.nodes.splice(r+1,0,s);let o;for(let s in this.indexes)o=this.indexes[s],r<o&&(this.indexes[s]=o+i.length);return this.markDirty(),this}insertBefore(t,n){let r=this.index(t),i=r===0?"prepend":!1,o=this.normalize(n,this.proxyOf.nodes[r],i).reverse();r=this.index(t);for(let a of o)this.proxyOf.nodes.splice(r,0,a);let s;for(let a in this.indexes)s=this.indexes[a],r<=s&&(this.indexes[a]=s+o.length);return this.markDirty(),this}normalize(t,n){if(typeof t=="string")t=um(lm(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 sm(t)]}else if(t.selector)t=[new Ql(t)];else if(t.name)t=[new ec(t)];else if(t.text)t=[new am(t)];else throw new Error("Unknown node type in node creation");return t.map(i=>(i[om]||pm.rebuild(i),i=i.proxyOf,i.parent&&i.parent.removeChild(i),i[im]&&dm(i),typeof i.raws.before>"u"&&n&&typeof n.raws.before<"u"&&(i.raws.before=n.raws.before.replace(/\S/g,"")),i.parent=this.proxyOf,i))}prepend(...t){t=t.reverse();for(let n of t){let r=this.normalize(n,this.first,"prepend").reverse();for(let i of r)this.proxyOf.nodes.unshift(i);for(let i in this.indexes)this.indexes[i]=this.indexes[i]+r.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 n;for(let r in this.indexes)n=this.indexes[r],n>=t&&(this.indexes[r]=n-1);return this.markDirty(),this}replaceValues(t,n,r){return r||(r=n,n={}),this.walkDecls(i=>{n.props&&!n.props.includes(i.prop)||n.fast&&!i.value.includes(n.fast)||(i.value=i.value.replace(t,r))}),this.markDirty(),this}some(t){return this.nodes.some(t)}walk(t){return this.each((n,r)=>{let i;try{i=t(n,r)}catch(o){throw n.addToError(o)}return i!==!1&&n.walk&&(i=n.walk(t)),i})}walkAtRules(t,n){return n?t instanceof RegExp?this.walk((r,i)=>{if(r.type==="atrule"&&t.test(r.name))return n(r,i)}):this.walk((r,i)=>{if(r.type==="atrule"&&r.name===t)return n(r,i)}):(n=t,this.walk((r,i)=>{if(r.type==="atrule")return n(r,i)}))}walkComments(t){return this.walk((n,r)=>{if(n.type==="comment")return t(n,r)})}walkDecls(t,n){return n?t instanceof RegExp?this.walk((r,i)=>{if(r.type==="decl"&&t.test(r.prop))return n(r,i)}):this.walk((r,i)=>{if(r.type==="decl"&&r.prop===t)return n(r,i)}):(n=t,this.walk((r,i)=>{if(r.type==="decl")return n(r,i)}))}walkRules(t,n){return n?t instanceof RegExp?this.walk((r,i)=>{if(r.type==="rule"&&t.test(r.selector))return n(r,i)}):this.walk((r,i)=>{if(r.type==="rule"&&r.selector===t)return n(r,i)}):(n=t,this.walk((r,i)=>{if(r.type==="rule")return n(r,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=>{lm=e};yt.registerRule=e=>{Ql=e};yt.registerAtRule=e=>{ec=e};yt.registerRoot=e=>{cm=e};var Ht=yt;yt.default=yt;yt.rebuild=e=>{e.type==="atrule"?Object.setPrototypeOf(e,ec.prototype):e.type==="rule"?Object.setPrototypeOf(e,Ql.prototype):e.type==="decl"?Object.setPrototypeOf(e,sm.prototype):e.type==="comment"?Object.setPrototypeOf(e,am.prototype):e.type==="root"&&Object.setPrototypeOf(e,cm.prototype),e[om]=!0,e.nodes&&e.nodes.forEach(t=>{yt.rebuild(t)})};var qA=Ht,fm,hm,Rr=class extends qA{constructor(t){super({type:"document",...t}),this.nodes||(this.nodes=[])}toResult(t={}){return new fm(new hm,this,t).stringify()}};Rr.registerLazyResult=e=>{fm=e};Rr.registerProcessor=e=>{hm=e};var tc=Rr;Rr.default=Rr;var Df={},mm=function(t){Df[t]||(Df[t]=!0,typeof console<"u"&&console.warn&&console.warn(t))},vl=class{constructor(t,n={}){if(this.type="warning",this.text=t,n.node&&n.node.source){let r=n.node.rangeBy(n);this.line=r.start.line,this.column=r.start.column,this.endLine=r.end.line,this.endColumn=r.end.column}for(let r in n)this[r]=n[r]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}},ym=vl;vl.default=vl;var KA=ym,xl=class{constructor(t,n,r){this.processor=t,this.messages=[],this.root=n,this.opts=r,this.css=void 0,this.map=void 0}toString(){return this.css}warn(t,n={}){n.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(n.plugin=this.lastPlugin.postcssPlugin);let r=new KA(t,n);return this.messages.push(r),r}warnings(){return this.messages.filter(t=>t.type==="warning")}get content(){return this.css}},nc=xl;xl.default=xl;var Ga=39,Ff=34,ho=92,_f=47,mo=10,ur=32,yo=12,go=9,So=13,HA=91,YA=93,ZA=40,XA=41,JA=123,QA=125,eP=59,tP=42,nP=58,rP=64,bo=/[\t\n\f\r "#'()/;[\\\]{}]/g,wo=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,iP=/.[\r\n"'(/\\]/,jf=/[\da-f]/i,oP=function(t,n={}){let r=t.css.valueOf(),i=n.ignoreErrors,o,s,a,l,c,u,d,p,m,y,f=r.length,h=0,w=[],v=[];function g(){return h}function x(V){throw t.error("Unclosed "+V,h)}function T(){return v.length===0&&h>=f}function j(V){if(v.length)return v.pop();if(h>=f)return;let z=V?V.ignoreUnclosed:!1;switch(o=r.charCodeAt(h),o){case mo:case ur:case go:case So:case yo:{s=h;do s+=1,o=r.charCodeAt(s);while(o===ur||o===mo||o===go||o===So||o===yo);y=["space",r.slice(h,s)],h=s-1;break}case HA:case YA:case JA:case QA:case nP:case eP:case XA:{let ne=String.fromCharCode(o);y=[ne,ne,h];break}case ZA:{if(p=w.length?w.pop()[1]:"",m=r.charCodeAt(h+1),p==="url"&&m!==Ga&&m!==Ff&&m!==ur&&m!==mo&&m!==go&&m!==yo&&m!==So){s=h;do{if(u=!1,s=r.indexOf(")",s+1),s===-1)if(i||z){s=h;break}else x("bracket");for(d=s;r.charCodeAt(d-1)===ho;)d-=1,u=!u}while(u);y=["brackets",r.slice(h,s+1),h,s],h=s}else s=r.indexOf(")",h+1),l=r.slice(h,s+1),s===-1||iP.test(l)?y=["(","(",h]:(y=["brackets",l,h,s],h=s);break}case Ga:case Ff:{a=o===Ga?"'":'"',s=h;do{if(u=!1,s=r.indexOf(a,s+1),s===-1)if(i||z){s=h+1;break}else x("string");for(d=s;r.charCodeAt(d-1)===ho;)d-=1,u=!u}while(u);y=["string",r.slice(h,s+1),h,s],h=s;break}case rP:{bo.lastIndex=h+1,bo.test(r),bo.lastIndex===0?s=r.length-1:s=bo.lastIndex-2,y=["at-word",r.slice(h,s+1),h,s],h=s;break}case ho:{for(s=h,c=!0;r.charCodeAt(s+1)===ho;)s+=1,c=!c;if(o=r.charCodeAt(s+1),c&&o!==_f&&o!==ur&&o!==mo&&o!==go&&o!==So&&o!==yo&&(s+=1,jf.test(r.charAt(s)))){for(;jf.test(r.charAt(s+1));)s+=1;r.charCodeAt(s+1)===ur&&(s+=1)}y=["word",r.slice(h,s+1),h,s],h=s;break}default:{o===_f&&r.charCodeAt(h+1)===tP?(s=r.indexOf("*/",h+2)+1,s===0&&(i||z?s=r.length:x("comment")),y=["comment",r.slice(h,s+1),h,s],h=s):(wo.lastIndex=h+1,wo.test(r),wo.lastIndex===0?s=r.length-1:s=wo.lastIndex-2,y=["word",r.slice(h,s+1),h,s],w.push(y),h=s);break}}return h++,y}function te(V){v.push(V)}return{back:te,endOfFile:T,nextToken:j,position:g}},gm=Ht,Bo=class extends gm{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)}},rc=Bo;Bo.default=Bo;gm.registerAtRule(Bo);var Sm=Ht,bm,wm,On=class extends Sm{constructor(t){super(t),this.type="root",this.nodes||(this.nodes=[])}normalize(t,n,r){let i=super.normalize(t);if(n){if(r==="prepend")this.nodes.length>1?n.raws.before=this.nodes[1].raws.before:delete n.raws.before;else if(this.first!==n)for(let o of i)o.raws.before=n.raws.before}return i}removeChild(t,n){let r=this.index(t);return!n&&r===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[r].raws.before),super.removeChild(t)}toResult(t={}){return new bm(new wm,this,t).stringify()}};On.registerLazyResult=e=>{bm=e};On.registerProcessor=e=>{wm=e};var Mr=On;On.default=On;Sm.registerRoot(On);var vr={comma(e){return vr.split(e,[","],!0)},space(e){let t=[" ",`
|
|
57
|
+
`," "];return vr.split(e,t)},split(e,t,n){let r=[],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!==""&&r.push(i.trim()),i="",o=!1):i+=u;return(n||i!=="")&&r.push(i.trim()),r}},Rm=vr;vr.default=vr;var vm=Ht,sP=Rm,Vo=class extends vm{constructor(t){super(t),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return sP.comma(this.selector)}set selectors(t){let n=this.selector?this.selector.match(/,\s*/):null,r=n?n[0]:","+this.raw("between","beforeOpen");this.selector=t.join(r)}},ic=Vo;Vo.default=Vo;vm.registerRule(Vo);var aP=es,lP=oP,cP=ns,uP=rc,dP=Mr,Bf=ic,Vf={empty:!0,space:!0};function pP(e){for(let t=e.length-1;t>=0;t--){let n=e[t],r=n[3]||n[2];if(r)return r}}var fP=class{constructor(t){this.input=t,this.root=new dP,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 n=new uP;n.name=t[1].slice(1),n.name===""&&this.unnamedAtrule(n,t),this.init(n,t[2]);let r,i,o,s=!1,a=!1,l=[],c=[];for(;!this.tokenizer.endOfFile();){if(t=this.tokenizer.nextToken(),r=t[0],r==="("||r==="["?c.push(r==="("?")":"]"):r==="{"&&c.length>0?c.push("}"):r===c[c.length-1]&&c.pop(),c.length===0)if(r===";"){n.source.end=this.getPosition(t[2]),n.source.end.offset++,this.semicolon=!0;break}else if(r==="{"){a=!0;break}else if(r==="}"){if(l.length>0){for(o=l.length-1,i=l[o];i&&i[0]==="space";)i=l[--o];i&&(n.source.end=this.getPosition(i[3]||i[2]),n.source.end.offset++)}this.end(t);break}else l.push(t);else l.push(t);if(this.tokenizer.endOfFile()){s=!0;break}}n.raws.between=this.spacesAndCommentsFromEnd(l),l.length?(n.raws.afterName=this.spacesAndCommentsFromStart(l),this.raw(n,"params",l),s&&(t=l[l.length-1],n.source.end=this.getPosition(t[3]||t[2]),n.source.end.offset++,this.spaces=n.raws.between,n.raws.between="")):(n.raws.afterName="",n.params=""),a&&(n.nodes=[],this.current=n)}checkMissedSemicolon(t){let n=this.colon(t);if(n===!1)return;let r=0,i;for(let o=n-1;o>=0&&(i=t[o],!(i[0]!=="space"&&(r+=1,r===2)));o--);throw this.input.error("Missed semicolon",i[0]==="word"?i[3]+1:i[2])}colon(t){let n=0,r,i,o;for(let[s,a]of t.entries()){if(r=a,i=r[0],i==="("&&(n+=1),i===")"&&(n-=1),n===0&&i===":")if(!o)this.doubleColon(r);else{if(o[0]==="word"&&o[1]==="progid")continue;return s}o=r}return!1}comment(t){let n=new cP;this.init(n,t[2]),n.source.end=this.getPosition(t[3]||t[2]),n.source.end.offset++;let r=t[1].slice(2,-2);if(/^\s*$/.test(r))n.text="",n.raws.left=r,n.raws.right="";else{let i=r.match(/^(\s*)([^]*\S)(\s*)$/);n.text=i[2],n.raws.left=i[1],n.raws.right=i[3]}}createTokenizer(){this.tokenizer=lP(this.input)}decl(t,n){let r=new aP;this.init(r,t[0][2]);let i=t[t.length-1];for(i[0]===";"&&(this.semicolon=!0,t.pop()),r.source.end=this.getPosition(i[3]||i[2]||pP(t)),r.source.end.offset++;t[0][0]!=="word";)t.length===1&&this.unknownWord(t),r.raws.before+=t.shift()[1];for(r.source.start=this.getPosition(t[0][2]),r.prop="";t.length;){let c=t[0][0];if(c===":"||c==="space"||c==="comment")break;r.prop+=t.shift()[1]}r.raws.between="";let o;for(;t.length;)if(o=t.shift(),o[0]===":"){r.raws.between+=o[1];break}else o[0]==="word"&&/\w/.test(o[1])&&this.unknownWord([o]),r.raws.between+=o[1];(r.prop[0]==="_"||r.prop[0]==="*")&&(r.raws.before+=r.prop[0],r.prop=r.prop.slice(1));let 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"){r.important=!0;let u=this.stringFrom(t,c);u=this.spacesFromEnd(t)+u,u!==" !important"&&(r.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&&(r.important=!0,r.raws.important=d,t=u)}if(o[0]!=="space"&&o[0]!=="comment")break}t.some(c=>c[0]!=="space"&&c[0]!=="comment")&&(r.raws.between+=s.map(c=>c[1]).join(""),s=[]),this.raw(r,"value",s.concat(t),n),r.value.includes(":")&&!n&&this.checkMissedSemicolon(t)}doubleColon(t){throw this.input.error("Double colon",{offset:t[2]},{offset:t[2]+t[1].length})}emptyRule(t){let n=new Bf;this.init(n,t[2]),n.selector="",n.raws.between="",this.current=n}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 n=this.current.nodes[this.current.nodes.length-1];n&&n.type==="rule"&&!n.raws.ownSemicolon&&(n.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(t){let n=this.input.fromOffset(t);return{column:n.col,line:n.line,offset:t}}init(t,n){this.current.push(t),t.source={input:this.input,start:this.getPosition(n)},t.raws.before=this.spaces,this.spaces="",t.type!=="comment"&&(this.semicolon=!1)}other(t){let n=!1,r=null,i=!1,o=null,s=[],a=t[1].startsWith("--"),l=[],c=t;for(;c;){if(r=c[0],l.push(c),r==="("||r==="[")o||(o=c),s.push(r==="("?")":"]");else if(a&&i&&r==="{")o||(o=c),s.push("}");else if(s.length===0)if(r===";")if(i){this.decl(l,a);return}else break;else if(r==="{"){this.rule(l);return}else if(r==="}"){this.tokenizer.back(l.pop()),n=!0;break}else r===":"&&(i=!0);else r===s[s.length-1]&&(s.pop(),s.length===0&&(o=null));c=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(n=!0),s.length>0&&this.unclosedBracket(o),n&&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,n,r,i){let o,s,a=r.length,l="",c=!0,u,d;for(let p=0;p<a;p+=1)o=r[p],s=o[0],s==="space"&&p===a-1&&!i?c=!1:s==="comment"?(d=r[p-1]?r[p-1][0]:"empty",u=r[p+1]?r[p+1][0]:"empty",!Vf[d]&&!Vf[u]?l.slice(-1)===","?c=!1:l+=o[1]:c=!1):l+=o[1];if(!c){let p=r.reduce((m,y)=>m+y[1],"");t.raws[n]={raw:p,value:l}}t[n]=l}rule(t){t.pop();let n=new Bf;this.init(n,t[0][2]),n.raws.between=this.spacesAndCommentsFromEnd(t),this.raw(n,"selector",t),this.current=n}spacesAndCommentsFromEnd(t){let n,r="";for(;t.length&&(n=t[t.length-1][0],!(n!=="space"&&n!=="comment"));)r=t.pop()[1]+r;return r}spacesAndCommentsFromStart(t){let n,r="";for(;t.length&&(n=t[0][0],!(n!=="space"&&n!=="comment"));)r+=t.shift()[1];return r}spacesFromEnd(t){let n,r="";for(;t.length&&(n=t[t.length-1][0],n==="space");)r=t.pop()[1]+r;return r}stringFrom(t,n){let r="";for(let i=n;i<t.length;i++)r+=t[i][1];return t.splice(n,t.length-n),r}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,n){throw this.input.error("At-rule without name",{offset:n[2]},{offset:n[2]+n[1].length})}},hP=fP,mP=Ht,yP=hP,gP=ts;function Wo(e,t){let n=new gP(e,t),r=new yP(n);try{r.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 r.root}var oc=Wo;Wo.default=Wo;mP.registerParse(Wo);var{isClean:et,my:SP}=Pr,bP=rm,wP=Jo,RP=Ht,vP=tc,xP=mm,Wf=nc,kP=oc,EP=Mr,CP={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},AP={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},PP={Once:!0,postcssPlugin:!0,prepare:!0},In=0;function dr(e){return typeof e=="object"&&typeof e.then=="function"}function xm(e){let t=!1,n=CP[e.type];return e.type==="decl"?t=e.prop.toLowerCase():e.type==="atrule"&&(t=e.name.toLowerCase()),t&&e.append?[n,n+"-"+t,In,n+"Exit",n+"Exit-"+t]:t?[n,n+"-"+t,n+"Exit",n+"Exit-"+t]:e.append?[n,In,n+"Exit"]:[n,n+"Exit"]}function Uf(e){let t;return e.type==="document"?t=["Document",In,"DocumentExit"]:e.type==="root"?t=["Root",In,"RootExit"]:t=xm(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function kl(e){return e[et]=!1,e.nodes&&e.nodes.forEach(t=>kl(t)),e}var El={},Tn=class km{constructor(t,n,r){this.stringified=!1,this.processed=!1;let i;if(typeof n=="object"&&n!==null&&(n.type==="root"||n.type==="document"))i=kl(n);else if(n instanceof km||n instanceof Wf)i=kl(n.root),n.map&&(typeof r.map>"u"&&(r.map={}),r.map.inline||(r.map.inline=!1),r.map.prev=n.map);else{let o=kP;r.syntax&&(o=r.syntax.parse),r.parser&&(o=r.parser),o.parse&&(o=o.parse);try{i=o(n,r)}catch(s){this.processed=!0,this.error=s}i&&!i[SP]&&RP.rebuild(i)}this.result=new Wf(t,i,r),this.helpers={...El,postcss:El,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,n){let r=this.result.lastPlugin;try{if(n&&n.addToError(t),this.error=t,t.name==="CssSyntaxError"&&!t.plugin)t.plugin=r.postcssPlugin,t.setMessage();else if(r.postcssVersion&&process.env.NODE_ENV!=="production"){let i=r.postcssPlugin,o=r.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=(n,r,i)=>{this.listeners[r]||(this.listeners[r]=[]),this.listeners[r].push([n,i])};for(let n of this.plugins)if(typeof n=="object")for(let r in n){if(!AP[r]&&/^[A-Z]/.test(r))throw new Error(`Unknown event ${r} in ${n.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!PP[r])if(typeof n[r]=="object")for(let i in n[r])i==="*"?t(n,r,n[r][i]):t(n,r+"-"+i.toLowerCase(),n[r][i]);else typeof n[r]=="function"&&t(n,r,n[r])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let t=0;t<this.plugins.length;t++){let n=this.plugins[t],r=this.runOnRoot(n);if(dr(r))try{await r}catch(i){throw this.handleError(i)}}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[et];){t[et]=!0;let n=[Uf(t)];for(;n.length>0;){let r=this.visitTick(n);if(dr(r))try{await r}catch(i){let o=n[n.length-1].node;throw this.handleError(i,o)}}}if(this.listeners.OnceExit)for(let[n,r]of this.listeners.OnceExit){this.result.lastPlugin=n;try{if(t.type==="document"){let i=t.nodes.map(o=>r(o,this.helpers));await Promise.all(i)}else await r(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 n=this.result.root.nodes.map(r=>t.Once(r,this.helpers));return dr(n[0])?Promise.all(n):n}return t.Once(this.result.root,this.helpers)}else if(typeof t=="function")return t(this.result.root,this.result)}catch(n){throw this.handleError(n)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let t=this.result.opts,n=wP;t.syntax&&(n=t.syntax.stringify),t.stringifier&&(n=t.stringifier),n.stringify&&(n=n.stringify);let i=new bP(n,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 n=this.runOnRoot(t);if(dr(n))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 n of t.nodes)this.visitSync(this.listeners.OnceExit,n);else this.visitSync(this.listeners.OnceExit,t)}return this.result}then(t,n){return process.env.NODE_ENV!=="production"&&("from"in this.opts||xP("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,n)}toString(){return this.css}visitSync(t,n){for(let[r,i]of t){this.result.lastPlugin=r;let o;try{o=i(n,this.helpers)}catch(s){throw this.handleError(s,n.proxyOf)}if(n.type!=="root"&&n.type!=="document"&&!n.parent)return!0;if(dr(o))throw this.getAsyncError()}}visitTick(t){let n=t[t.length-1],{node:r,visitors:i}=n;if(r.type!=="root"&&r.type!=="document"&&!r.parent){t.pop();return}if(i.length>0&&n.visitorIndex<i.length){let[s,a]=i[n.visitorIndex];n.visitorIndex+=1,n.visitorIndex===i.length&&(n.visitors=[],n.visitorIndex=0),this.result.lastPlugin=s;try{return a(r.toProxy(),this.helpers)}catch(l){throw this.handleError(l,r)}}if(n.iterator!==0){let s=n.iterator,a;for(;a=r.nodes[r.indexes[s]];)if(r.indexes[s]+=1,!a[et]){a[et]=!0,t.push(Uf(a));return}n.iterator=0,delete r.indexes[s]}let o=n.events;for(;n.eventIndex<o.length;){let s=o[n.eventIndex];if(n.eventIndex+=1,s===In){r.nodes&&r.nodes.length&&(r[et]=!0,n.iterator=r.getIterator());return}else if(this.listeners[s]){n.visitors=this.listeners[s];return}}t.pop()}walkSync(t){t[et]=!0;let n=xm(t);for(let r of n)if(r===In)t.nodes&&t.each(i=>{i[et]||this.walkSync(i)});else{let i=this.listeners[r];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"}};Tn.registerPostcss=e=>{El=e};var Em=Tn;Tn.default=Tn;EP.registerLazyResult(Tn);vP.registerLazyResult(Tn);var MP=rm,OP=Jo,IP=mm,TP=oc,$P=nc,Cl=class{constructor(t,n,r){n=n.toString(),this.stringified=!1,this._processor=t,this._css=n,this._opts=r,this._map=void 0;let i,o=OP;this.result=new $P(this._processor,i,this._opts),this.result.css=n;let s=this;Object.defineProperty(this.result,"root",{get(){return s.root}});let a=new MP(o,i,this._opts,n);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,n){return process.env.NODE_ENV!=="production"&&("from"in this._opts||IP("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,n)}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,n=TP;try{t=n(this._css,this._opts)}catch(r){this.error=r}if(this.error)throw this.error;return this._root=t,t}get[Symbol.toStringTag](){return"NoWorkResult"}},NP=Cl;Cl.default=Cl;var LP=NP,DP=Em,FP=tc,_P=Mr,xr=class{constructor(t=[]){this.version="8.4.38",this.plugins=this.normalize(t)}normalize(t){let n=[];for(let r of t)if(r.postcss===!0?r=r():r.postcss&&(r=r.postcss),typeof r=="object"&&Array.isArray(r.plugins))n=n.concat(r.plugins);else if(typeof r=="object"&&r.postcssPlugin)n.push(r);else if(typeof r=="function")n.push(r);else if(typeof r=="object"&&(r.parse||r.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(r+" is not a PostCSS plugin");return n}process(t,n={}){return!this.plugins.length&&!n.parser&&!n.stringifier&&!n.syntax?new LP(this,t,n):new DP(this,t,n)}use(t){return this.plugins=this.plugins.concat(this.normalize([t])),this}},jP=xr;xr.default=xr;_P.registerProcessor(xr);FP.registerProcessor(xr);var BP=es,VP=Jh,WP=ns,UP=rc,zP=ts,GP=Mr,qP=ic;function kr(e,t){if(Array.isArray(e))return e.map(i=>kr(i));let{inputs:n,...r}=e;if(n){t=[];for(let i of n){let o={...i,__proto__:zP.prototype};o.map&&(o.map={...o.map,__proto__:VP.prototype}),t.push(o)}}if(r.nodes&&(r.nodes=e.nodes.map(i=>kr(i,t))),r.source){let{inputId:i,...o}=r.source;r.source=o,i!=null&&(r.source.input=t[i])}if(r.type==="root")return new GP(r);if(r.type==="decl")return new BP(r);if(r.type==="rule")return new qP(r);if(r.type==="comment")return new WP(r);if(r.type==="atrule")return new UP(r);throw new Error("Unknown node type: "+e.type)}var KP=kr;kr.default=kr;var HP=Jl,Cm=es,YP=Em,ZP=Ht,sc=jP,XP=Jo,JP=KP,Am=tc,QP=ym,Pm=ns,Mm=rc,eM=nc,tM=ts,nM=oc,rM=Rm,Om=ic,Im=Mr,iM=Qo;function _(...e){return e.length===1&&Array.isArray(e[0])&&(e=e[0]),new sc(e)}_.plugin=function(t,n){let r=!1;function i(...s){console&&console.warn&&!r&&(r=!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=n(...s);return a.postcssPlugin=t,a.postcssVersion=new sc().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=XP;_.parse=nM;_.fromJSON=JP;_.list=rM;_.comment=e=>new Pm(e);_.atRule=e=>new Mm(e);_.decl=e=>new Cm(e);_.rule=e=>new Om(e);_.root=e=>new Im(e);_.document=e=>new Am(e);_.CssSyntaxError=HP;_.Declaration=Cm;_.Container=ZP;_.Processor=sc;_.Document=Am;_.Comment=Pm;_.Warning=QP;_.AtRule=Mm;_.Result=eM;_.Input=tM;_.Rule=Om;_.Root=Im;_.Node=iM;YP.registerPostcss(_);var oM=_;_.default=_;var Y=mA(oM);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 Al=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=[],n=this.firstChild;for(;n;)t.push(n),n=n.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,n){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 zf={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Gf={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Ro={},sM=()=>!!globalThis.Zone;function ac(e){if(Ro[e])return Ro[e];let t=globalThis[e],n=t.prototype,r=e in zf?zf[e]:void 0,i=!!(r&&r.every(a=>{var l,c;return!!((c=(l=Object.getOwnPropertyDescriptor(n,a))==null?void 0:l.get)!=null&&c.toString().includes("[native code]"))})),o=e in Gf?Gf[e]:void 0,s=!!(o&&o.every(a=>{var l;return typeof n[a]=="function"&&((l=n[a])==null?void 0:l.toString().includes("[native code]"))}));if(i&&s&&!sM())return Ro[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?Ro[e]=c:n}catch{return n}}var qa={};function St(e,t,n){var r;let i=`${e}.${String(n)}`;if(qa[i])return qa[i].call(t);let o=ac(e),s=(r=Object.getOwnPropertyDescriptor(o,n))==null?void 0:r.get;return s?(qa[i]=s,s.call(t)):t[n]}var Ka={};function Tm(e,t,n){let r=`${e}.${String(n)}`;if(Ka[r])return Ka[r].bind(t);let o=ac(e)[n];return typeof o!="function"?t[n]:(Ka[r]=o,o.bind(t))}function aM(e){return St("Node",e,"ownerDocument")}function lM(e){return St("Node",e,"childNodes")}function cM(e){return St("Node",e,"parentNode")}function uM(e){return St("Node",e,"parentElement")}function dM(e){return St("Node",e,"textContent")}function pM(e,t){return Tm("Node",e,"contains")(t)}function fM(e){return Tm("Node",e,"getRootNode")()}function hM(e){return!e||!("host"in e)?null:St("ShadowRoot",e,"host")}function mM(e){return e.styleSheets}function yM(e){return!e||!("shadowRoot"in e)?null:St("Element",e,"shadowRoot")}function gM(e,t){return St("Element",e,"querySelector")(t)}function SM(e,t){return St("Element",e,"querySelectorAll")(t)}function $m(){return ac("MutationObserver").constructor}function Yt(e,t,n){try{if(!(t in e))return()=>{};let r=e[t],i=n(r);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=i,()=>{e[t]=r}}catch{return()=>{}}}var k={ownerDocument:aM,childNodes:lM,parentNode:cM,parentElement:uM,textContent:dM,contains:pM,getRootNode:fM,host:hM,styleSheets:mM,shadowRoot:yM,querySelector:gM,querySelectorAll:SM,mutationObserver:$m,patch:Yt};function Se(e,t,n=document){let r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}var vn=`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.`,qf={map:{},getId(){return console.error(vn),-1},getNode(){return console.error(vn),null},removeNodeFromMap(){console.error(vn)},has(){return console.error(vn),!1},reset(){console.error(vn)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(qf=new Proxy(qf,{get(e,t,n){return t==="map"&&console.error(vn),Reflect.get(e,t,n)}}));function Er(e,t,n={}){let r=null,i=0;return function(...o){let s=Date.now();!i&&n.leading===!1&&(i=s);let a=t-(s-i),l=this;a<=0||a>t?(r&&(clearTimeout(r),r=null),i=s,e.apply(l,o)):!r&&n.trailing!==!1&&(r=setTimeout(()=>{i=n.leading===!1?0:Date.now(),r=null,e.apply(l,o)},a))}}function rs(e,t,n,r,i=window){let o=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,r?n:{set(s){setTimeout(()=>{n.set.call(this,s)},0),o&&o.set&&o.set.call(this,s)}}),()=>rs(e,t,o||{},!0)}var Uo=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(Uo=()=>new Date().getTime());function Nm(e){var t,n,r,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)||((n=o?.body)==null?void 0:n.scrollLeft)||0,top:o.scrollingElement?o.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:o?.documentElement.scrollTop||o?.body&&((r=k.parentElement(o.body))==null?void 0:r.scrollTop)||((i=o?.body)==null?void 0:i.scrollTop)||0}}function Lm(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Dm(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Fm(e){return e?e.nodeType===e.ELEMENT_NODE?e:k.parentElement(e):null}function be(e,t,n,r){if(!e)return!1;let i=Fm(e);if(!i)return!1;try{if(typeof t=="string"){if(i.classList.contains(t)||r&&i.closest("."+t)!==null)return!0}else if(No(i,t,r))return!0}catch{}return!!(n&&(i.matches(n)||r&&i.closest(n)!==null))}function bM(e,t){return t.getId(e)!==-1}function Ha(e,t,n){return e.tagName==="TITLE"&&n.headTitleMutations?!0:t.getId(e)===yr}function _m(e,t){if(fr(e))return!1;let n=t.getId(e);if(!t.has(n))return!0;let r=k.parentNode(e);return r&&r.nodeType===e.DOCUMENT_NODE?!1:r?_m(r,t):!0}function Pl(e){return!!e.changedTouches}function wM(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 Bm(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function Ml(e){return e?e instanceof Al&&"shadowRoot"in e?!!e.shadowRoot:!!k.shadowRoot(e):!1}var Ol=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,n){if(this.has(t))return this.getId(t);let r;return n===void 0?r=this.id++:r=n,this.styleIDMap.set(t,r),this.idStyleMap.set(r,t),r}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 Vm(e){var t;let n=null;return"getRootNode"in e&&((t=k.getRootNode(e))==null?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&k.host(k.getRootNode(e))&&(n=k.host(k.getRootNode(e))),n}function RM(e){let t=e,n;for(;n=Vm(t);)t=n;return t}function vM(e){let t=k.ownerDocument(e);if(!t)return!1;let n=RM(e);return k.contains(t,n)}function Wm(e){let t=k.ownerDocument(e);return t?k.contains(t,e)||vM(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||{}),E=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(E||{}),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||{}),ht=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(ht||{}),$n=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))($n||{}),xn=(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))(xn||{});var Um=(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))(Um||{});function Kf(e){return"__ln"in e}var Il=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 n=this.head;for(let r=0;r<t;r++)n=n?.next||null;return n}addNode(t){let n={value:t,previous:null,next:null};if(t.__ln=n,t.previousSibling&&Kf(t.previousSibling)){let r=t.previousSibling.__ln.next;n.next=r,n.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=n,r&&(r.previous=n)}else if(t.nextSibling&&Kf(t.nextSibling)&&t.nextSibling.__ln.previous){let r=t.nextSibling.__ln.previous;n.previous=r,n.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=n,r&&(r.next=n)}else this.head&&(this.head.previous=n),n.next=this.head,this.head=n;n.next===null&&(this.tail=n),this.length++}removeNode(t){let n=t.__ln;this.head&&(n.previous?(n.previous.next=n.next,n.next?n.next.previous=n.previous:this.tail=n.previous):(this.head=n.next,this.head?this.head.previous=null:this.tail=null),t.__ln&&delete t.__ln,this.length--)}},Hf=(e,t)=>`${e}@${t}`,Tl=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=[],n=new Set,r=new Il,i=l=>{let c=l,u=yr;for(;u===yr;)c=c&&c.nextSibling,u=c&&this.mirror.getId(c);return u},o=l=>{let c=k.parentNode(l);if(!c||!Wm(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=fr(c)?this.mirror.getId(Vm(l)):this.mirror.getId(c),p=i(l);if(d===-1||p===-1)return r.addNode(l);let m=En(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),Bm(y,this.mirror)&&this.stylesheetManager.trackLinkElement(y),Ml(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}),n.add(m.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let l of this.movedSet)Yf(this.removesSubTreeCache,l,this.mirror)&&!this.movedSet.has(k.parentNode(l))||o(l);for(let l of this.addedSet)!Zf(this.droppedSet,l)&&!Yf(this.removesSubTreeCache,l,this.mirror)||Zf(this.movedSet,l)?o(l):this.droppedSet.add(l);let s=null;for(;r.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=r.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(;r.head;)r.removeNode(r.head.value);break}s=l.previous,r.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=>!n.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=>!n.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 n=this.attributeMap.get(t);n||(n={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(n),this.attributeMap.set(t,n));let r=Array.from(k.childNodes(t),i=>k.textContent(i)||"").join("");n.attributes.value=Io({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:To(t),value:r,maskInputFn:this.maskInputFn})}),b(this,"processMutation",t=>{if(!Ha(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{let n=k.textContent(t.target);!be(t.target,this.blockClass,this.blockSelector,!1)&&n!==t.oldValue&&this.texts.push({value:uh(t.target,this.maskTextClass,this.maskTextSelector,!0)&&n?this.maskTextFn?this.maskTextFn(n,Fm(t.target)):n.replace(/[\S]/g,"*"):n,node:t.target});break}case"attributes":{let n=t.target,r=t.attributeName,i=t.target.getAttribute(r);if(r==="value"){let s=To(n);i=Io({element:n,maskInputOptions:this.maskInputOptions,tagName:n.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(n.tagName==="IFRAME"&&r==="src"&&!this.keepIframeSrcFn(i))if(!n.contentDocument)r="rr_src";else return;if(o||(o={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(o),this.attributeMap.set(t.target,o)),r==="type"&&n.tagName==="INPUT"&&(t.oldValue||"").toLowerCase()==="password"&&n.setAttribute("data-rr-is-password","true"),!ch(n.tagName,r))if(o.attributes[r]=lh(this.doc,qt(n.tagName),qt(r),i),r==="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(n.style)){let l=n.style.getPropertyValue(a),c=n.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))n.style.getPropertyValue(a)===""&&(o.styleDiff[a]=!1)}else r==="open"&&n.tagName==="DIALOG"&&(n.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(n=>this.genAdds(n,t.target)),t.removedNodes.forEach(n=>{let r=this.mirror.getId(n),i=fr(t.target)?this.mirror.getId(k.host(t.target)):this.mirror.getId(t.target);be(t.target,this.blockClass,this.blockSelector,!1)||Ha(n,this.mirror,this.slimDOMOptions)||!bM(n,this.mirror)||(this.addedSet.has(n)?($l(this.addedSet,n),this.droppedSet.add(n)):this.addedSet.has(t.target)&&r===-1||_m(t.target,this.mirror)||(this.movedSet.has(n)&&this.movedMap[Hf(r,i)]?$l(this.movedSet,n):(this.removes.push({parentId:i,id:r,isShadow:fr(t.target)&&hr(t.target)?!0:void 0}),xM(n,this.removesSubTreeCache))),this.mapRemoves.push(n))});break}}}),b(this,"genAdds",(t,n)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!(this.addedSet.has(t)||this.movedSet.has(t))){if(this.mirror.hasNode(t)){if(Ha(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);let r=null;n&&this.mirror.hasNode(n)&&(r=this.mirror.getId(n)),r&&r!==-1&&(this.movedMap[Hf(this.mirror.getId(t),r)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);be(t,this.blockClass,this.blockSelector,!1)||(k.childNodes(t).forEach(r=>this.genAdds(r)),Ml(t)&&k.childNodes(k.shadowRoot(t)).forEach(r=>{this.processedNodeManager.add(r,this),this.genAdds(r,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(n=>{this[n]=t[n]})}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 $l(e,t){e.delete(t),k.childNodes(t).forEach(n=>$l(e,n))}function xM(e,t){let n=[e];for(;n.length;){let r=n.pop();t.has(r)||(t.add(r),k.childNodes(r).forEach(i=>n.push(i)))}}function Yf(e,t,n){return e.size===0?!1:kM(e,t)}function kM(e,t,n){let r=k.parentNode(t);return r?e.has(r):!1}function Zf(e,t){return e.size===0?!1:zm(e,t)}function zm(e,t){let n=k.parentNode(t);return n?e.has(n)?!0:zm(e,n):!1}var mr;function EM(e){mr=e}function CM(){mr=void 0}var O=e=>mr?(...n)=>{try{return e(...n)}catch(r){if(mr&&mr(r)===!0)return;throw r}}:e,Gt=[];function Or(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 Gm(e,t){let n=new Tl;Gt.push(n),n.init(e);let r=new($m())(O(n.processMutations.bind(n)));return r.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),r}function AM({mousemoveCb:e,sampling:t,doc:n,mirror:r}){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=Er(O(d=>{let p=Date.now()-a;e(s.map(m=>(m.timeOffset-=p,m)),d),s=[],a=null}),o),c=O(Er(O(d=>{let p=Or(d),{clientX:m,clientY:y}=Pl(d)?d.changedTouches[0]:d;a||(a=Uo()),s.push({x:m,y,id:r.getId(p),timeOffset:Uo()-a}),l(typeof DragEvent<"u"&&d instanceof DragEvent?E.Drag:d instanceof MouseEvent?E.MouseMove:E.TouchMove)}),i,{trailing:!1})),u=[Se("mousemove",c,n),Se("touchmove",c,n),Se("drag",c,n)];return O(()=>{u.forEach(d=>d())})}function PM({mouseInteractionCb:e,doc:t,mirror:n,blockClass:r,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=Or(d);if(be(p,r,i,!0))return;let m=null,y=u;if("pointerType"in d){switch(d.pointerType){case"mouse":m=ht.Mouse;break;case"touch":m=ht.Touch;break;case"pen":m=ht.Pen;break}m===ht.Touch?ve[u]===ve.MouseDown?y="TouchStart":ve[u]===ve.MouseUp&&(y="TouchEnd"):ht.Pen}else Pl(d)&&(m=ht.Touch);m!==null?(l=m,(y.startsWith("Touch")&&m===ht.Touch||y.startsWith("Mouse")&&m===ht.Mouse)&&(m=null)):ve[u]===ve.Click&&(m=l,l=null);let f=Pl(d)?d.changedTouches[0]:d;if(!f)return;let h=n.getId(p),{clientX:w,clientY:v}=f;O(e)({type:ve[y],id:h,x:w,y:v,...m!==null&&{pointerType:m}})};return Object.keys(ve).filter(u=>Number.isNaN(Number(u))&&!u.endsWith("_Departed")&&s[u]!==!1).forEach(u=>{let d=qt(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 qm({scrollCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,sampling:o}){let s=O(Er(O(a=>{let l=Or(a);if(!l||be(l,r,i,!0))return;let c=n.getId(l);if(l===t&&t.defaultView){let u=Nm(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 MM({viewportResizeCb:e},{win:t}){let n=-1,r=-1,i=O(Er(O(()=>{let o=Lm(),s=Dm();(n!==o||r!==s)&&(e({width:Number(s),height:Number(o)}),n=o,r=s)}),200));return Se("resize",i,t)}var OM=["INPUT","TEXTAREA","SELECT"],Xf=new WeakMap;function IM({inputCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,ignoreClass:o,ignoreSelector:s,maskInputOptions:a,maskInputFn:l,sampling:c,userTriggeredOnInput:u}){function d(v){let g=Or(v),x=v.isTrusted,T=g&&g.tagName;if(g&&T==="OPTION"&&(g=k.parentElement(g)),!g||!T||OM.indexOf(T)<0||be(g,r,i,!0)||g.classList.contains(o)||s&&g.matches(s))return;let j=g.value,te=!1,V=To(g)||"";V==="radio"||V==="checkbox"?te=g.checked:(a[T.toLowerCase()]||a[V])&&(j=Io({element:g,maskInputOptions:a,tagName:T,type:V,value:j,maskInputFn:l})),p(g,u?{text:j,isChecked:te,userTriggered:x}:{text:j,isChecked:te});let z=g.name;V==="radio"&&z&&te&&t.querySelectorAll(`input[type="radio"][name="${z}"]`).forEach(ne=>{if(ne!==g){let fe=ne.value;p(ne,u?{text:fe,isChecked:!te,userTriggered:!1}:{text:fe,isChecked:!te})}})}function p(v,g){let x=Xf.get(v);if(!x||x.text!==g.text||x.isChecked!==g.isChecked){Xf.set(v,g);let T=n.getId(v);O(e)({...g,id:T})}}let y=(c.input==="last"?["change"]:["input","change"]).map(v=>Se(v,O(d),t)),f=t.defaultView;if(!f)return()=>{y.forEach(v=>v())};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(v=>rs(v[0],v[1],{set(){O(d)({target:this,isTrusted:!1})}},!1,f))),O(()=>{y.forEach(v=>v())})}function zo(e){let t=[];function n(r,i){if(vo("CSSGroupingRule")&&r.parentRule instanceof CSSGroupingRule||vo("CSSMediaRule")&&r.parentRule instanceof CSSMediaRule||vo("CSSSupportsRule")&&r.parentRule instanceof CSSSupportsRule||vo("CSSConditionRule")&&r.parentRule instanceof CSSConditionRule){let s=Array.from(r.parentRule.cssRules).indexOf(r);i.unshift(s)}else if(r.parentStyleSheet){let s=Array.from(r.parentStyleSheet.cssRules).indexOf(r);i.unshift(s)}return i}return n(e,t)}function Mt(e,t,n){let r,i;return e?(e.ownerNode?r=t.getId(e.ownerNode):i=n.getId(e),{styleId:i,id:r}):{}}function TM({styleSheetRuleCb:e,mirror:t,stylesheetManager:n},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};let i=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:O((u,d,p)=>{let[m,y]=p,{id:f,styleId:h}=Mt(d,t,n.styleMirror);return(f&&f!==-1||h&&h!==-1)&&e({id:f,styleId:h,adds:[{rule:m,index:y}]}),u.apply(d,p)})}),r.CSSStyleSheet.prototype.addRule=function(u,d,p=this.cssRules.length){let m=`${u} { ${d} }`;return r.CSSStyleSheet.prototype.insertRule.apply(this,[m,p])};let o=r.CSSStyleSheet.prototype.deleteRule;r.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:O((u,d,p)=>{let[m]=p,{id:y,styleId:f}=Mt(d,t,n.styleMirror);return(y&&y!==-1||f&&f!==-1)&&e({id:y,styleId:f,removes:[{index:m}]}),u.apply(d,p)})}),r.CSSStyleSheet.prototype.removeRule=function(u){return r.CSSStyleSheet.prototype.deleteRule.apply(this,[u])};let s;r.CSSStyleSheet.prototype.replace&&(s=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(s,{apply:O((u,d,p)=>{let[m]=p,{id:y,styleId:f}=Mt(d,t,n.styleMirror);return(y&&y!==-1||f&&f!==-1)&&e({id:y,styleId:f,replace:m}),u.apply(d,p)})}));let a;r.CSSStyleSheet.prototype.replaceSync&&(a=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:O((u,d,p)=>{let[m]=p,{id:y,styleId:f}=Mt(d,t,n.styleMirror);return(y&&y!==-1||f&&f!==-1)&&e({id:y,styleId:f,replaceSync:m}),u.apply(d,p)})}));let l={};xo("CSSGroupingRule")?l.CSSGroupingRule=r.CSSGroupingRule:(xo("CSSMediaRule")&&(l.CSSMediaRule=r.CSSMediaRule),xo("CSSConditionRule")&&(l.CSSConditionRule=r.CSSConditionRule),xo("CSSSupportsRule")&&(l.CSSSupportsRule=r.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:v}=Mt(m.parentStyleSheet,t,n.styleMirror);return(w&&w!==-1||v&&v!==-1)&&e({id:w,styleId:v,adds:[{rule:f,index:[...zo(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}=Mt(m.parentStyleSheet,t,n.styleMirror);return(h&&h!==-1||w&&w!==-1)&&e({id:h,styleId:w,removes:[{index:[...zo(m),f]}]}),p.apply(m,y)})})}),O(()=>{r.CSSStyleSheet.prototype.insertRule=i,r.CSSStyleSheet.prototype.deleteRule=o,s&&(r.CSSStyleSheet.prototype.replace=s),a&&(r.CSSStyleSheet.prototype.replaceSync=a),Object.entries(l).forEach(([u,d])=>{d.prototype.insertRule=c[u].insertRule,d.prototype.deleteRule=c[u].deleteRule})})}function Km({mirror:e,stylesheetManager:t},n){var r,i,o;let s=null;n.nodeName==="#document"?s=e.getId(n):s=e.getId(k.host(n));let a=n.nodeName==="#document"?(r=n.defaultView)==null?void 0:r.Document:(o=(i=n.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(n,"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(n,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})}))}function $M({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:r},{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(n.has(d))return o.apply(l,[d,p,m]);let{id:y,styleId:f}=Mt((u=l.parentRule)==null?void 0:u.parentStyleSheet,t,r.styleMirror);return(y&&y!==-1||f&&f!==-1)&&e({id:y,styleId:f,set:{property:d,value:p,priority:m},index:zo(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(n.has(d))return s.apply(l,[d]);let{id:p,styleId:m}=Mt((u=l.parentRule)==null?void 0:u.parentStyleSheet,t,r.styleMirror);return(p&&p!==-1||m&&m!==-1)&&e({id:p,styleId:m,remove:{property:d},index:zo(l.parentRule)}),a.apply(l,c)})}),O(()=>{i.CSSStyleDeclaration.prototype.setProperty=o,i.CSSStyleDeclaration.prototype.removeProperty=s})}function NM({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:r,sampling:i,doc:o}){let s=O(l=>Er(O(c=>{let u=Or(c);if(!u||be(u,t,n,!0))return;let{currentTime:d,volume:p,muted:m,playbackRate:y,loop:f}=u;e({type:l,id:r.getId(u),currentTime:d,volume:p,muted:m,playbackRate:y,loop:f})}),i.media||500)),a=[Se("play",s(xn.Play),o),Se("pause",s(xn.Pause),o),Se("seeked",s(xn.Seeked),o),Se("volumechange",s(xn.VolumeChange),o),Se("ratechange",s(xn.RateChange),o)];return O(()=>{a.forEach(l=>l())})}function LM({fontCb:e,doc:t}){let n=t.defaultView;if(!n)return()=>{};let r=[],i=new WeakMap,o=n.FontFace;n.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=Yt(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 r.push(()=>{n.FontFace=o}),r.push(s),O(()=>{r.forEach(a=>a())})}function DM(e){let{doc:t,mirror:n,blockClass:r,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,r,i,!0)||be(f,r,i,!0)||c.push({start:n.getId(m),startOffset:y,end:n.getId(f),endOffset:h})}o({ranges:c})});return a(),Se("selectionchange",a)}function FM({doc:e,customElementCb:t}){let n=e.defaultView;return!n||!n.customElements?()=>{}:Yt(n.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 _M(e,t){let{mutationCb:n,mousemoveCb:r,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),n(...f)},e.mousemoveCb=(...f)=>{t.mousemove&&t.mousemove(...f),r(...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 jM(e,t={}){let n=e.doc.defaultView;if(!n)return()=>{};_M(e,t);let r;e.recordDOM&&(r=Gm(e,e.doc));let i=AM(e),o=PM(e),s=qm(e),a=MM(e,{win:n}),l=IM(e),c=NM(e),u=()=>{},d=()=>{},p=()=>{},m=()=>{};e.recordDOM&&(u=TM(e,{win:n}),d=Km(e,e.doc),p=$M(e,{win:n}),e.collectFonts&&(m=LM(e)));let y=DM(e),f=FM(e),h=[];for(let w of e.plugins)h.push(w.observer(w.callback,n,w.options));return O(()=>{Gt.forEach(w=>w.reset()),r?.disconnect(),i(),o(),s(),a(),l(),c(),u(),d(),p(),m(),y(),f(),h.forEach(w=>w())})}function vo(e){return typeof window[e]<"u"}function xo(e){return!!(typeof window[e]<"u"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}var Go=class{constructor(t){b(this,"iframeIdToRemoteIdMap",new WeakMap),b(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=t}getId(t,n,r,i){let o=r||this.getIdToRemoteIdMap(t),s=i||this.getRemoteIdToIdMap(t),a=o.get(n);return a||(a=this.generateIdFn(),o.set(n,a),s.set(a,n)),a}getIds(t,n){let r=this.getIdToRemoteIdMap(t),i=this.getRemoteIdToIdMap(t);return n.map(o=>this.getId(t,o,r,i))}getRemoteId(t,n,r){let i=r||this.getRemoteIdToIdMap(t);if(typeof n!="number")return n;let o=i.get(n);return o||-1}getRemoteIds(t,n){let r=this.getRemoteIdToIdMap(t);return n.map(i=>this.getRemoteId(t,i,r))}reset(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){let n=this.iframeIdToRemoteIdMap.get(t);return n||(n=new Map,this.iframeIdToRemoteIdMap.set(t,n)),n}getRemoteIdToIdMap(t){let n=this.iframeRemoteIdToIdMap.get(t);return n||(n=new Map,this.iframeRemoteIdToIdMap.set(t,n)),n}},Nl=class{constructor(t){b(this,"iframes",new WeakMap),b(this,"crossOriginIframeMap",new WeakMap),b(this,"crossOriginIframeMirror",new Go(ah)),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 Go(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,n){var r,i;this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:n}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&((r=t.contentWindow)==null||r.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 n=t;if(n.data.type!=="rrweb"||n.origin!==n.data.origin||!t.source)return;let i=this.crossOriginIframeMap.get(t.source);if(!i)return;let o=this.transformCrossOriginEvent(i,n.data.event);o&&this.wrappedEmit(o,n.data.isCheckout)}transformCrossOriginEvent(t,n){var r;switch(n.type){case P.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(n.data.node,t);let i=n.data.node.id;return this.crossOriginIframeRootIdMap.set(t,i),this.patchRootIdOnNode(n.data.node,i),{timestamp:n.timestamp,type:P.IncrementalSnapshot,data:{source:E.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:n.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case P.Meta:case P.Load:case P.DomContentLoaded:return!1;case P.Plugin:return n;case P.Custom:return this.replaceIds(n.data.payload,t,["id","parentId","previousId","nextId"]),n;case P.IncrementalSnapshot:switch(n.data.source){case E.Mutation:return n.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)}),n.data.removes.forEach(i=>{this.replaceIds(i,t,["parentId","id"])}),n.data.attributes.forEach(i=>{this.replaceIds(i,t,["id"])}),n.data.texts.forEach(i=>{this.replaceIds(i,t,["id"])}),n;case E.Drag:case E.TouchMove:case E.MouseMove:return n.data.positions.forEach(i=>{this.replaceIds(i,t,["id"])}),n;case E.ViewportResize:return!1;case E.MediaInteraction:case E.MouseInteraction:case E.Scroll:case E.CanvasMutation:case E.Input:return this.replaceIds(n.data,t,["id"]),n;case E.StyleSheetRule:case E.StyleDeclaration:return this.replaceIds(n.data,t,["id"]),this.replaceStyleIds(n.data,t,["styleId"]),n;case E.Font:return n;case E.Selection:return n.data.ranges.forEach(i=>{this.replaceIds(i,t,["start","end"])}),n;case E.AdoptedStyleSheet:return this.replaceIds(n.data,t,["id"]),this.replaceStyleIds(n.data,t,["styleIds"]),(r=n.data.styles)==null||r.forEach(i=>{this.replaceStyleIds(i,t,["styleId"])}),n}}return!1}replace(t,n,r,i){for(let o of i)!Array.isArray(n[o])&&typeof n[o]!="number"||(Array.isArray(n[o])?n[o]=t.getIds(r,n[o]):n[o]=t.getId(r,n[o]));return n}replaceIds(t,n,r){return this.replace(this.crossOriginIframeMirror,t,n,r)}replaceStyleIds(t,n,r){return this.replace(this.crossOriginIframeStyleMirror,t,n,r)}replaceIdOnNode(t,n){this.replaceIds(t,n,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(r=>{this.replaceIdOnNode(r,n)})}patchRootIdOnNode(t,n){t.type!==Um.Document&&!t.rootId&&(t.rootId=n),"childNodes"in t&&t.childNodes.forEach(r=>{this.patchRootIdOnNode(r,n)})}},Ll=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,n){if(!hr(t)||this.shadowDoms.has(t))return;this.shadowDoms.add(t);let r=Gm({...this.bypassOptions,doc:n,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},t);this.restoreHandlers.push(()=>r.disconnect()),this.restoreHandlers.push(qm({...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(Km({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t))},0)}observeAttachShadow(t){!t.contentWindow||!t.contentDocument||this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,n){let r=this;this.restoreHandlers.push(Yt(t.prototype,"attachShadow",function(i){return function(o){let s=i.call(this,o),a=k.shadowRoot(this);return a&&Wm(this)&&r.addShadowRoot(a,n),s}}))}reset(){this.restoreHandlers.forEach(t=>{try{t()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}},Cn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",BM=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(pr=0;pr<Cn.length;pr++)BM[Cn.charCodeAt(pr)]=pr;var pr,VM=function(e){var t=new Uint8Array(e),n,r=t.length,i="";for(n=0;n<r;n+=3)i+=Cn[t[n]>>2],i+=Cn[(t[n]&3)<<4|t[n+1]>>4],i+=Cn[(t[n+1]&15)<<2|t[n+2]>>6],i+=Cn[t[n+2]&63];return r%3===2?i=i.substring(0,i.length-1)+"=":r%3===1&&(i=i.substring(0,i.length-2)+"=="),i};var Jf=new Map;function WM(e,t){let n=Jf.get(e);return n||(n=new Map,Jf.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}var Hm=(e,t,n)=>{if(!e||!(Zm(e,t)||typeof e=="object"))return;let r=e.constructor.name,i=WM(n,r),o=i.indexOf(e);return o===-1&&(o=i.length,i.push(e)),o};function Po(e,t,n){if(e instanceof Array)return e.map(r=>Po(r,t,n));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 r=e.constructor.name,i=VM(e);return{rr_type:r,base64:i}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[Po(e.buffer,t,n),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){let r=e.constructor.name,{src:i}=e;return{rr_type:r,src:i}}else if(e instanceof HTMLCanvasElement){let r="HTMLImageElement",i=e.toDataURL();return{rr_type:r,src:i}}else{if(e instanceof ImageData)return{rr_type:e.constructor.name,args:[Po(e.data,t,n),e.width,e.height]};if(Zm(e,t)||typeof e=="object"){let r=e.constructor.name,i=Hm(e,t,n);return{rr_type:r,index:i}}}}return e}var Ym=(e,t,n)=>e.map(r=>Po(r,t,n)),Zm=(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 UM(e,t,n,r){let i=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(let s of o)try{if(typeof t.CanvasRenderingContext2D.prototype[s]!="function")continue;let a=Yt(t.CanvasRenderingContext2D.prototype,s,function(l){return function(...c){return be(this.canvas,n,r,!0)||setTimeout(()=>{let u=Ym(c,t,this);e(this.canvas,{type:$n["2D"],property:s,args:u})},0),l.apply(this,c)}});i.push(a)}catch{let a=rs(t.CanvasRenderingContext2D.prototype,s,{set(l){e(this.canvas,{type:$n["2D"],property:s,args:[l],setter:!0})}});i.push(a)}return()=>{i.forEach(s=>s())}}function zM(e){return e==="experimental-webgl"?"webgl":e}function Qf(e,t,n,r){let i=[];try{let o=Yt(e.HTMLCanvasElement.prototype,"getContext",function(s){return function(a,...l){if(!be(this,t,n,!0)){let c=zM(a);if("__context"in this||(this.__context=c),r&&["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 eh(e,t,n,r,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=Yt(e,l,function(u){return function(...d){let p=u.apply(this,d);if(Hm(p,o,this),"tagName"in this.canvas&&!be(this.canvas,r,i,!0)){let m=Ym(d,o,this),y={type:t,property:l,args:m};n(this.canvas,y)}return p}});s.push(c)}catch{let c=rs(e,l,{set(u){n(this.canvas,{type:t,property:l,args:[u],setter:!0})}});s.push(c)}return s}function GM(e,t,n,r){let i=[];return i.push(...eh(t.WebGLRenderingContext.prototype,$n.WebGL,e,n,r,t)),typeof t.WebGL2RenderingContext<"u"&&i.push(...eh(t.WebGL2RenderingContext.prototype,$n.WebGL2,e,n,r,t)),()=>{i.forEach(o=>o())}}var Xm="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",qM=e=>Uint8Array.from(atob(e),t=>t.charCodeAt(0)),th=typeof window<"u"&&window.Blob&&new Blob([qM(Xm)],{type:"text/javascript;charset=utf-8"});function KM(e){let t;try{if(t=th&&(window.URL||window.webkitURL).createObjectURL(th),!t)throw"";let n=new Worker(t,{name:e?.name});return n.addEventListener("error",()=>{(window.URL||window.webkitURL).revokeObjectURL(t)}),n}catch{return new Worker("data:text/javascript;base64,"+Xm,{name:e?.name})}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}var Dl=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:n="all",win:r,blockClass:i,blockSelector:o,recordCanvas:s,dataURLOptions:a}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,s&&n==="all"&&this.initCanvasMutationObserver(r,i,o),s&&typeof n=="number"&&this.initCanvasFPSObserver(n,r,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,n,r,i,o){let s=Qf(n,r,i,!0),a=new Map,l=new KM;l.onmessage=y=>{let{id:f}=y.data;if(a.set(f,!1),!("base64"in y.data))return;let{base64:h,type:w,width:v,height:g}=y.data;this.mutationCb({id:f,type:$n["2D"],commands:[{property:"clearRect",args:[0,0,v,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 n.document.querySelectorAll("canvas").forEach(f=>{be(f,r,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 v=await createImageBitmap(f);l.postMessage({id:w,bitmap:v,width:f.width,height:f.height,dataURLOptions:o.dataURLOptions},[v])}),d=requestAnimationFrame(m)};d=requestAnimationFrame(m),this.resetObservers=()=>{s(),cancelAnimationFrame(d)}}initCanvasMutationObserver(t,n,r){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let i=Qf(t,n,r,!1),o=UM(this.processMutation.bind(this),t,n,r),s=GM(this.processMutation.bind(this),t,n,r);this.resetObservers=()=>{i(),o(),s()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let t=n=>{this.rafStamps.latestId=n,requestAnimationFrame(t)};requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,n)=>{let r=this.mirror.getId(n);this.flushPendingCanvasMutationFor(n,r)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,n){if(this.frozen||this.locked)return;let r=this.pendingCanvasMutations.get(t);if(!r||n===-1)return;let i=r.map(s=>{let{type:a,...l}=s;return l}),{type:o}=r[0];this.mutationCb({id:n,type:o,commands:i}),this.pendingCanvasMutations.delete(t)}},Fl=class{constructor(t){b(this,"trackedLinkElements",new WeakSet),b(this,"mutationCb"),b(this,"adoptedStyleSheetCb"),b(this,"styleMirror",new Ol),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,n){"_cssText"in n.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:n.id,attributes:n.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,n){if(t.length===0)return;let r={id:n,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:oh(a,o.href),index:l}))})),r.styleIds.push(s)}i.length>0&&(r.styles=i),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}},_l=class{constructor(){b(this,"nodeMap",new WeakMap),b(this,"active",!1)}inOtherBuffer(t,n){let r=this.nodeMap.get(t);return r&&Array.from(r).some(i=>i!==n)}add(t,n){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(n))}destroy(){}},ee,Mo,Ya,qo=!1;try{if(Array.from([1],e=>e*2)[0]!==2){let e=document.createElement("iframe");document.body.appendChild(e),Array.from=((nf=e.contentWindow)==null?void 0:nf.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}var Fe=Zk();function Zt(e={}){let{emit:t,checkoutEveryNms:n,checkoutEveryNth:r,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:v={},dataURLOptions:g={},mousemoveWait:x,recordDOM:T=!0,recordCanvas:j=!1,recordCrossOriginIframes:te=!1,recordAfter:V=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:z=!1,collectFonts:ne=!1,inlineImages:fe=!1,plugins:Ve,keepIframeSrcFn:$=()=>!1,ignoreCSSAttributes:Dn=new Set([]),errorHandler:Fn}=e;EM(Fn);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()=>{};x!==void 0&&v.mousemove===void 0&&(v.mousemove=x),Fe.reset();let Ot=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=dh(m);wM();let pc,os=0,fc=N=>{for(let $e of Ve||[])$e.eventProcessor&&(N=$e.eventProcessor(N));return w&&!Ie&&(N=w(N)),N};ee=(N,$e)=>{var Z;let X=N;if(X.timestamp=Uo(),(Z=Gt[0])!=null&&Z.isFrozen()&&X.type!==P.FullSnapshot&&!(X.type===P.IncrementalSnapshot&&X.data.source===E.Mutation)&&Gt.forEach(xe=>xe.unfreeze()),ie)t?.(fc(X),$e);else if(Ie){let xe={type:"rrweb",event:fc(X),origin:window.location.origin,isCheckout:$e};window.parent.postMessage(xe,"*")}if(X.type===P.FullSnapshot)pc=X,os=0;else if(X.type===P.IncrementalSnapshot){if(X.data.source===E.Mutation&&X.data.isAttachIframe)return;os++;let xe=r&&os>=r,B=n&&X.timestamp-pc.timestamp>n;(xe||B)&&Mo(!0)}};let $r=N=>{ee({type:P.IncrementalSnapshot,data:{source:E.Mutation,...N}})},hc=N=>ee({type:P.IncrementalSnapshot,data:{source:E.Scroll,...N}}),mc=N=>ee({type:P.IncrementalSnapshot,data:{source:E.CanvasMutation,...N}}),gy=N=>ee({type:P.IncrementalSnapshot,data:{source:E.AdoptedStyleSheet,...N}}),It=new Fl({mutationCb:$r,adoptedStyleSheetCb:gy}),Tt=new Nl({mirror:Fe,mutationCb:$r,stylesheetManager:It,recordCrossOriginIframes:te,wrappedEmit:ee});for(let N of Ve||[])N.getMirror&&N.getMirror({nodeMirror:Fe,crossOriginIframeMirror:Tt.crossOriginIframeMirror,crossOriginIframeStyleMirror:Tt.crossOriginIframeStyleMirror});let ss=new _l;Ya=new Dl({recordCanvas:j,mutationCb:mc,win:window,blockClass:i,blockSelector:o,mirror:Fe,sampling:v.canvas,dataURLOptions:g});let Nr=new Ll({mutationCb:$r,scrollCb:hc,bypassOptions:{blockClass:i,blockSelector:o,maskTextClass:l,maskTextSelector:c,inlineStylesheet:u,maskInputOptions:Ot,dataURLOptions:g,maskTextFn:f,maskInputFn:y,recordCanvas:j,inlineImages:fe,sampling:v,slimDOMOptions:We,iframeManager:Tt,stylesheetManager:It,canvasManager:Ya,keepIframeSrcFn:$,processedNodeManager:ss},mirror:Fe});Mo=(N=!1)=>{if(!T)return;ee({type:P.Meta,data:{href:window.location.href,width:Dm(),height:Lm()}},N),It.reset(),Nr.init(),Gt.forEach(Z=>Z.lock());let $e=wE(document,{mirror:Fe,blockClass:i,blockSelector:o,maskTextClass:l,maskTextSelector:c,inlineStylesheet:u,maskAllInputs:Ot,maskTextFn:f,maskInputFn:y,slimDOM:We,dataURLOptions:g,recordCanvas:j,inlineImages:fe,onSerialize:Z=>{jm(Z,Fe)&&Tt.addIframe(Z),Bm(Z,Fe)&&It.trackLinkElement(Z),Ml(Z)&&Nr.addShadowRoot(k.shadowRoot(Z),document)},onIframeLoad:(Z,X)=>{Tt.attachIframe(Z,X),Nr.observeAttachShadow(Z)},onStylesheetLoad:(Z,X)=>{It.attachLinkElement(Z,X)},keepIframeSrcFn:$});if(!$e)return console.warn("Failed to snapshot the document");ee({type:P.FullSnapshot,data:{node:$e,initialOffset:Nm(window)}},N),Gt.forEach(Z=>Z.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&It.adoptStyleSheets(document.adoptedStyleSheets,Fe.getId(document))};try{let N=[],$e=X=>{var xe;return O(jM)({mutationCb:$r,mousemoveCb:(B,as)=>ee({type:P.IncrementalSnapshot,data:{source:as,positions:B}}),mouseInteractionCb:B=>ee({type:P.IncrementalSnapshot,data:{source:E.MouseInteraction,...B}}),scrollCb:hc,viewportResizeCb:B=>ee({type:P.IncrementalSnapshot,data:{source:E.ViewportResize,...B}}),inputCb:B=>ee({type:P.IncrementalSnapshot,data:{source:E.Input,...B}}),mediaInteractionCb:B=>ee({type:P.IncrementalSnapshot,data:{source:E.MediaInteraction,...B}}),styleSheetRuleCb:B=>ee({type:P.IncrementalSnapshot,data:{source:E.StyleSheetRule,...B}}),styleDeclarationCb:B=>ee({type:P.IncrementalSnapshot,data:{source:E.StyleDeclaration,...B}}),canvasMutationCb:mc,fontCb:B=>ee({type:P.IncrementalSnapshot,data:{source:E.Font,...B}}),selectionCb:B=>{ee({type:P.IncrementalSnapshot,data:{source:E.Selection,...B}})},customElementCb:B=>{ee({type:P.IncrementalSnapshot,data:{source:E.CustomElement,...B}})},blockClass:i,ignoreClass:s,ignoreSelector:a,maskTextClass:l,maskTextSelector:c,maskInputOptions:Ot,inlineStylesheet:u,sampling:v,recordDOM:T,recordCanvas:j,inlineImages:fe,userTriggeredOnInput:z,collectFonts:ne,doc:X,maskInputFn:y,maskTextFn:f,keepIframeSrcFn:$,blockSelector:o,slimDOMOptions:We,dataURLOptions:g,mirror:Fe,iframeManager:Tt,stylesheetManager:It,shadowDomManager:Nr,processedNodeManager:ss,canvasManager:Ya,ignoreCSSAttributes:Dn,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)};Tt.addLoadListener(X=>{try{N.push($e(X.contentDocument))}catch(xe){console.warn(xe)}});let Z=()=>{Mo(),N.push($e(document)),qo=!0};return["interactive","complete"].includes(document.readyState)?Z():(N.push(Se("DOMContentLoaded",()=>{ee({type:P.DomContentLoaded,data:{}}),V==="DOMContentLoaded"&&Z()})),N.push(Se("load",()=>{ee({type:P.Load,data:{}}),V==="load"&&Z()},window))),()=>{N.forEach(X=>{try{X()}catch(xe){String(xe).toLowerCase().includes("cross-origin")||console.warn(xe)}}),ss.destroy(),qo=!1,CM()}}catch(N){console.warn(N)}}Zt.addCustomEvent=(e,t)=>{if(!qo)throw new Error("please add custom event after start recording");ee({type:P.Custom,data:{tag:e,payload:t}})};Zt.freezePage=()=>{Gt.forEach(e=>e.freeze())};Zt.takeFullSnapshot=e=>{if(!qo)throw new Error("please take full snapshot after start recording");Mo(e)};Zt.mirror=Fe;var nh;(function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"})(nh||(nh={}));var $F=5*1e3;var{addCustomEvent:NF}=Zt,{freezePage:LF}=Zt,{takeFullSnapshot:DF}=Zt;var ey="__ripploEmitRrwebEvent";function ty(){return{eventTypes:Jm(P),incrementalSources:Jm(E)}}function Jm(e){return Object.fromEntries(Object.entries(e).filter(t=>typeof t[1]=="number").map(([t,n])=>[n,t]))}var YM=Na("@ripplo/rrweb-bundle/bundle","rrweb.js"),Qm;function ny(){return Qm??=HM(YM,{encoding:"utf8"}),Qm}async function Ir({clientVersion:e,debugDir:t,writeOtlpPortFile:n}){let r=new Map,i=Xp(ty()),o=await La({localDir:ry.join(ry.dirname(t),".local"),writePortFile:n,onRrwebBatch:(l,c)=>{r.get(l)?.emitRrwebBatch(c)},onSpan:l=>{let c=l.attributes["ripplo.run"];c!=null&&r.get(c)?.emit(l)}}),s=await ny();return{attach:async(l,c)=>{let u=Zp({debugDir:t,runId:c,worker:i});u.emit({clientVersion:e,kind:"meta",source:"capture",timeNanos:"0"}),r.set(c,u),await Qp(l,c),await l.addInitScript(`globalThis.__ripploCapturePort = ${String(o.port)};`),await XM(l,u),await eO(l,u);let d=[];return{emitAction:p=>{rO(u,p)},emitAssertion:p=>{iO(u,p)},finish:()=>tO(u,{pages:d,registry:r,runId:c}),onPage:p=>{d.push(p),nO(u,s,p)}}},debugDir:t,close:async()=>{await o.stop(),await i.terminate()},injectSpan:(l,c)=>{r.get(l)?.emit(c)}}}async function ZM(e){await Promise.all(e.map(t=>t.evaluate("globalThis.__ripploFlushRrweb ? globalThis.__ripploFlushRrweb() : undefined").catch(()=>{})))}async function XM(e,t){await e.exposeBinding(ey,(n,r)=>{let i=typeof r=="string"?r:JSON.stringify(r);t.emitRrwebBatch(Buffer.from(i,"utf8"))})}var JM="__ripploEventPush",QM=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 eO(e,t){await e.exposeBinding(JM,(n,r)=>{let i=QM.safeParse(r);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:wn(o.timestamp)});return}t.emit({kind:"error",message:o.message,source:"browser",stack:o.stack,timeNanos:wn(o.timestamp)})})}async function tO(e,t){await ZM(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 nO(e,t,n){n.on("load",()=>{n.addScriptTag({content:t}).catch(()=>{})}),n.on("requestfinished",r=>{lO(e,r).catch(()=>{})}),n.url()!=="about:blank"&&n.addScriptTag({content:t}).catch(()=>{})}function rO(e,t){e.emit({action:t.kind,kind:"action",source:"test",target:oO(t),timeNanos:wn(Date.now()),value:sO(t)})}function iO(e,t){let n=ji(t);e.emit({kind:"assertion",label:n.label,outcome:t.outcome,source:"test",step:n.step,timeNanos:wn(Date.now()),wait:t.waitBudget,waitMs:t.waitMs})}function oO(e){if(e.url!=null)return e.url;if(e.locator!=null)return is(e.locator)}function is(e){return e.by==="testId"?`testId=${e.value}`:e.by==="inside"?`${is(e.scope)} \u25B8 ${is(e.target)}`:e.by==="surface"?is(e.container):`${e.role} ${e.name??""}`.trim()}function sO(e){return e.value!=null?typeof e.value=="object"?JSON.stringify(e.value):String(e.value):e.key}var aO=/^http:\/\/127\.0\.0\.1:\d+\/rrweb\//;async function lO(e,t){if(aO.test(t.url()))return;let n=await t.response();if(n==null)return;let r=t.resourceType(),i=r==="fetch"||r==="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:r,responseBody:i?await cO(n):void 0,source:"browser",spanId:s?.[2],status:n.status(),timeNanos:wn(a>0?a:Date.now()),traceId:s?.[1],url:n.url()})}async function cO(e){try{return await e.text()}catch{return}}function Tr(e){return{aborted:!0,findings:[],ran:[],teardown:e}}function cc(e,t){return new lc(RO(e,t))}function pO(e,t){return new lc(fO(e,t))}async function fO(e,t){let n=await Up(e.profileDir).catch(()=>{});if(n==null)return Xt(Ye(new Error("launch")));try{return Nn(await hO({context:n,params:e,signal:t}))}catch(r){return Xt(Ye(r))}finally{await n.close().catch(Ze)}}async function hO({context:e,params:t,signal:n}){let r=e.pages()[0]??await e.newPage(),i=await Ir({clientVersion:t.clientVersion,debugDir:t.debugDir,writeOtlpPortFile:!0}),o=await i.attach(e,t.runId);return o.onPage(r),e.on("page",s=>{o.onPage(s)}),await r.goto(t.startUrl).catch(Ze),t.onReady(),await mO(e,n),await o.finish(),await i.close(),{behaviorPath:uO.join(t.debugDir,t.runId,"behavior.jsonl")}}function mO(e,t){return new Promise(n=>{let r=()=>{n()};t.addEventListener("abort",r,{once:!0}),e.on("close",r),e.browser()?.on("disconnected",r),e.on("page",i=>i.on("close",r)),e.pages().forEach(i=>i.on("close",r))})}function yO(e,t){return new lc(gO(e,t))}async function gO(e,t){let n=SO(e),r=ay({lockfile:e.lockfile,options:e.options,runId:e.runId,signal:t}),i=async o=>{try{return Nn(await bO({established:o,params:e,signal:t}))}catch(s){return await o.teardown().match(Ze,Ze),Xt(ii(s)?s:Ye(s))}};return sy(r,n).match(i,async o=>(await uc(r.teardown),Xt(o)))}function SO(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 bO({established:e,params:t,signal:n}){let r=Ji({cacheDir:void 0,headed:!0}),i=await r.acquire(),{result:o,session:s}=await oy({browser:i,capture:null,established:e,lockfile:t.lockfile,onEvent:void 0,onPhase:void 0,options:t.options,sequence:t.sequence,signal:n,stopAfterStep:t.stopAfterStep,test:t.test,viewport:null});return t.onReady(),await wO(i,s.context),await e.teardown().match(Ze,Ze),await r.close(),{kind:"handed-over",ran:o.ran.length}}function wO(e,t){return new Promise(n=>{let r=()=>{n()};e.on("disconnected",r),t.on("close",r),t.on("page",i=>i.on("close",r)),t.pages().forEach(i=>i.on("close",r))})}async function RO({browser:e,hub:t,request:n},r){if(r.aborted)return Nn(Tr("skipped"));let i=ay({lockfile:n.lockfile,options:n.options,runId:n.runId,signal:r}),o=async s=>{try{return await xO({browser:e,established:s,hub:t,request:n,signal:r})}catch(a){return Xt(ii(a)?a:Ye(a))}};return sy(i,n).match(o,s=>vO(s,i.teardown))}async function vO(e,t){return e.kind!=="aborted"?Xt(e):Nn(Tr(await uc(t)))}function uc(e){return e().match(()=>"done",()=>"failed")}async function xO(e){let t=await kO(e);if(t.kind==="completed"){let r=Date.now();return e.established.teardown().match(()=>(e.request.onPhase?.("teardown",Date.now()-r),Nn({aborted:!1,...t.result})),i=>Xt(i))}let n=await uc(e.established.teardown);if(t.kind==="aborted")return Nn(Tr(n));throw t.error}function iy(e,t,n){return Kn(e,t).map(r=>({params:{...Ui(r),...n},transition:r}))}async function oy(e){let{established:t,lockfile:n,signal:r}=e,i=Date.now(),o=await Aa({baseUrl:e.options.baseUrl,browser:e.browser,capture:e.capture,clientState:t.clientState,engine:Ra(AO(n)),fixturesDir:e.options.fixturesDir,networkHeaders:void 0,observeActor:t.observeActor,reader:t.reader,session:t.auth,signal:r,signInActor:t.signInActor,viewport:e.viewport});e.onPhase?.("browser",Date.now()-i);try{let s=hn(n),a=Date.now(),l=await ki({canon:ni(n),classify:ti(n),dataRules:s.dataRules,driver:o.driver,facts:{facts:Js(s.facts,re(e.test)),overlays:Xe(n),overrides:s.overrides},initialState:{snapshot:t.snapshot},onAssertion:o.emitAssertion,sequence:e.sequence,stopAfterStep:e.stopAfterStep,onEvent:c=>{e.onEvent?.(c)}},r);return e.onPhase?.("drive",Date.now()-a),{result:l,session:o}}catch(s){throw await o.close().catch(Ze),s}}async function kO({browser:e,established:t,hub:n,request:r,signal:i}){try{Oe(i),r.onEvent?.({aliases:t.aliases,generated:t.generated,generatedSingletons:t.generatedSingletons,kind:"world"});let{result:o,session:s}=await oy({browser:e,capture:r.capture?{hub:n,runId:r.runId}:null,established:t,lockfile:r.lockfile,onEvent:r.onEvent,onPhase:r.onPhase,options:r.options,sequence:r.sequence??iy(r.lockfile,r.test,r.params),signal:i,stopAfterStep:void 0,test:r.test,viewport:Wp(r.test.viewport)});return await s.close(),{kind:"completed",result:o}}catch(o){return Jn(o)?{kind:"aborted"}:{error:o,kind:"threw"}}}function sy(e,t){let n=Date.now();return e.ready().andThen(()=>{t.onPhase?.("engine",Date.now()-n);let r=Date.now();return un(t.lockfile,t.test,{generate:Fr(Dr(t.options.generate,t.runId),new Date().toISOString()),materialize:e.materialize,params:t.params,signIn:e.signIn}).map(i=>(t.onPhase?.("world",Date.now()-r),{aliases:i.aliases,auth:i.auth,clientState:i.clientState,generated:i.generated,generatedSingletons:i.generatedSingletons,observeActor:i.principals.size>0,reader:e.reader,signInActor:EO(e.signIn,i.principals),snapshot:i.snapshot,teardown:e.teardown}))})}function EO(e,t){return n=>{let r=t.get(n);return r==null?dO(Ye(new Error(`no seeded principal for actor "${n}"`))):e({entity:r.entity,row:r.row})}}function ay({lockfile:e,options:t,runId:n,signal:r}){let i=$a({baseUrl:t.engineUrl,extraHeaders:void 0,runId:n,secret:t.secret},r);return{materialize:hi(i.setupWorld),reader:Ia(e.entities,CO(e),i.query),ready:i.ready,signIn:i.signIn,teardown:i.teardown}}function CO(e){return e.singletons.filter(t=>t.source==="backend").map(t=>t.name)}function AO(e){return e.singletons.filter(t=>t.source==="client").map(t=>t.name)}import{err as PO,ok as MO,ResultAsync as OO}from"neverthrow";function IO({cacheDir:e,clientVersion:t,debugDir:n,headed:r,writeOtlpPortFile:i}){let o=Ji({cacheDir:e,headed:r}),s,a,l=async()=>(s??=Ir({clientVersion:t,debugDir:n,writeOtlpPortFile:i}),a=await s,a),c=async(p,m)=>{if(m.aborted)return MO(Tr("skipped"));try{let y=await l();if(p.options.headed&&!r)return await Pa(!0,async h=>cc({browser:h,hub:y,request:p},m));let f=await o.acquire();return await cc({browser:f,hub:y,request:p},m)}catch(y){return PO(Ye(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 OO(c(p,m))}}import{z as C}from"zod";function TO(e){let t=e.split(`
|
|
65
|
+
`).map(i=>HO(i)).filter(i=>i!=null),n=WO(t),r=t.map(i=>DO(i,n)).filter(i=>i!=null).filter(i=>i.kind==="input"||i.element!=null);return $O(r)}function $O(e){return e.filter((t,n)=>{let r=e[n+1];return!(t.kind==="input"&&r?.kind==="input"&&NO(t.element,r.element))})}function NO(e,t){return e?.testId===t?.testId&&e?.ariaLabel===t?.ariaLabel&&e?.placeholder===t?.placeholder}var LO={2:"click",3:"contextmenu",4:"dblclick"};function DO(e,t){return e.rrwebType==="IncrementalSnapshot:MouseInteraction"?FO(e,t):e.rrwebType==="IncrementalSnapshot:Input"?_O(e,t):null}function FO(e,t){let n=eI.safeParse(e.event.data);if(!n.success)return null;let r=LO[n.data.type];if(r==null)return null;let i=ly(n.data.id,t.nodes);return{element:cy(i,t),kind:r,timeNanos:e.timeNanos,value:void 0}}function _O(e,t){let n=tI.safeParse(e.event.data);return n.success?{element:cy(n.data.id,t),kind:"input",timeNanos:e.timeNanos,value:n.data.text??jO(n.data.isChecked)}:null}function jO(e){return e==null?void 0:String(e)}var BO=new Set(["button","a","input","select","textarea","summary"]);function ly(e,t){let n=t.get(e);if(n!=null)return VO(n)?e:n.parentId==null?void 0:ly(n.parentId,t)}function VO(e){return e.attrs["data-testid"]!=null||e.attrs["aria-label"]!=null||e.attrs.role!=null||BO.has(e.tag??"")}function cy(e,t){let n=e==null?void 0:t.nodes.get(e);if(!(n==null||e==null))return{ariaLabel:Ln(n,"aria-label"),href:Ln(n,"href"),name:Ln(n,"name"),placeholder:Ln(n,"placeholder"),role:Ln(n,"role"),tag:n.tag,testId:Ln(n,"data-testid"),text:uy(e,t)}}function Ln(e,t){let n=e.attrs[t];return typeof n=="string"?n:typeof n=="number"||typeof n=="boolean"?String(n):void 0}function uy(e,t){let n=t.nodes.get(e);if(n==null)return;let r=n.text?.trim()??"",o=(t.children.get(e)??[]).map(a=>uy(a,t)??""),s=[r,...o].filter(a=>a.length>0).join(" ");return s.length===0?void 0:s.slice(0,100)}function WO(e){let t=e.flatMap(i=>UO(i).flatMap(o=>dc(o,void 0))),n=e.flatMap(i=>zO(i).flatMap(o=>dc(o.node,o.parentId??void 0))),r=qO(new Map([...t,...n]),e);return{children:GO(r),nodes:r}}function UO(e){if(e.rrwebType!=="FullSnapshot")return[];let t=XO.safeParse(e.event.data);return t.success?[t.data.node]:[]}function zO(e){if(e.rrwebType!=="IncrementalSnapshot:Mutation")return[];let t=dy.safeParse(e.event.data);return t.success?t.data.adds.flatMap(n=>{let r=JO.safeParse(n);return r.success?[r.data]:[]}):[]}function GO(e){let t=new Map;return e.forEach((n,r)=>{n.parentId!=null&&t.set(n.parentId,[...t.get(n.parentId)??[],r])}),t}function dc(e,t){let n=ZO.safeParse(e);if(!n.success)return[];let r=n.data,i=r.childNodes??[];return[[r.id,{attrs:{...r.attributes},parentId:t,tag:r.tagName,text:r.textContent}],...i.flatMap(s=>dc(s,r.id))]}function qO(e,t){return t.flatMap(r=>KO(r)).reduce((r,i)=>{let o=r.get(i.id);return o==null?r:new Map(r).set(i.id,{...o,attrs:{...o.attrs,...i.attributes}})},e)}function KO(e){if(e.rrwebType!=="IncrementalSnapshot:Mutation")return[];let t=dy.safeParse(e.event.data);return t.success?t.data.attributes.flatMap(n=>{let r=QO.safeParse(n);return r.success?[r.data]:[]}):[]}function HO(e){if(e.trim().length===0)return null;let t=nI.safeParse(YO(e));return t.success?t.data:null}function YO(e){try{return JSON.parse(e)}catch{return null}}var ZO=C.object({attributes:C.record(C.string(),C.unknown()).optional(),childNodes:C.array(C.unknown()).optional(),id:C.number(),tagName:C.string().optional(),textContent:C.string().optional()}),XO=C.object({node:C.unknown()}),JO=C.object({node:C.unknown(),parentId:C.number().nullable().default(null)}),QO=C.object({attributes:C.record(C.string(),C.unknown()),id:C.number()}),dy=C.object({adds:C.array(C.unknown()).default([]),attributes:C.array(C.unknown()).default([])}),eI=C.object({id:C.number(),type:C.number()}),tI=C.object({id:C.number(),isChecked:C.boolean().optional(),text:C.string().optional()}),nI=C.object({event:C.object({data:C.unknown()}),kind:C.literal("rrweb"),rrwebType:C.string(),timeNanos:C.string()});function rI(e){let t=n=>e.find(r=>r.phase===n)?.ms??0;return{browserMs:t("browser"),driveMs:t("drive"),engineMs:t("engine"),teardownMs:t("teardown"),worldMs:t("world")}}async function iI(e,t){let n=await hy({attemptIndex:0,capture:!1,params:e,stepRuns:e.stepRuns},t);if(n.kind!=="completed")return py(n);let r=fy(n.findings);if(r!=null)return{error:r,kind:"error"};let i=an(n.findings);if(i.length===0)return{kind:"clean",ranCount:n.ranCount,timing:{confirm:void 0,detect:n.timing}};let o=sr(e.baseState.name,i);return e.seenSignature!=null&&await e.seenSignature(o.signature)?{kind:"seen",ranCount:n.ranCount,signature:o.signature,timing:{confirm:void 0,detect:n.timing},title:o.title,verifierLayer:o.layer}:oI(e,o,n.timing,t)}function py(e){return e.kind==="error"?{error:e.error,kind:"error"}:{kind:e.kind}}function fy(e){let t=e.find(n=>n.kind==="driver-error"&&oi(n.error));return t!=null&&t.kind==="driver-error"?t.error:void 0}async function oI(e,t,n,r){let i=await hy({attemptIndex:1,capture:!0,params:e,stepRuns:e.stepRuns},r);if(i.kind!=="completed")return py(i);let o=fy(i.findings);if(o!=null)return{error:o,kind:"error"};let s={confirm:i.timing,detect:n},a=an(i.findings);return a.length===0||sr(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 hy({attemptIndex:e,capture:t,params:n,stepRuns:r},i){let o=n.runIdFor(e),s=[],a=[];return(await n.session.runOnce({capture:t,lockfile:n.lockfile,onEvent:t?c=>{s.push(c)}:void 0,options:n.options,params:void 0,runId:o,sequence:sI(n,r),test:n.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:rI(a)},c=>({error:c,kind:"error"}))}function sI(e,t){return t.map(n=>{let r=e.corpus[n.idx];if(r==null)throw new Error("transition index out of corpus range");return{params:n.params,transition:r}})}async function my(e,t){let n=await Hi(e);if(n==null)return{kind:"unplannable"};let r=[...n.startingPointTests.values()].find(o=>re(o)===t.baseStateRef);if(r==null)return{kind:"unplannable"};let i=t.steps.map(o=>{let s=n.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:r,kind:"ok",sequence:i.filter(o=>o!=null)}}async function aI({capture:e,lockfile:t,options:n,repro:r,runId:i,session:o,signal:s}){let a=await my(t,r);return a.kind==="unplannable"?{kind:"unplannable"}:(await o.runOnce({capture:e,lockfile:t,onEvent:void 0,onPhase:void 0,options:n,params:void 0,runId:i,sequence:a.sequence,test:a.baseTest},s)).match(c=>{if(c.aborted)return{kind:"aborted"};let u=an(c.findings);return u.length>0?{findings:u,kind:"still-fails"}:{kind:"resolved"}},c=>({kind:"state-unavailable",reason:c.kind}))}function $_(e){switch(e.kind){case"empty-response":return"ripplo daemon: cloud tunnel provisioning returned no result. Check server logs and retry.";case"server-error":return`ripplo daemon: cloud tunnel provisioning failed (${e.typename}). Run \`npx ripplo doctor\` to check your setup.`}}function N_(e){switch(e.kind){case"already-running":return`ripplo daemon: daemon already running (socket ${e.socketPath}).`;case"bind-failed":return`ripplo daemon: failed to bind IPC socket: ${e.message}`}}function L_({projectId:e,serverUrl:t}){return[`Project "${e}" (from .ripplo/project.json) was not found on ${t}, or this account does not have access to it.`,"Run `npx ripplo projects list` to see your projects, then update .ripplo/project.json (or re-run `npx ripplo init --project <id>`)."].join(`
|
|
66
|
+
`)}function D_(){return"Not signed in. Run `npx ripplo auth login`, then start the daemon again."}function F_({devSessionId:e,version:t}){return`ripplo daemon: v${t} ready as local executor for session ${e} (switch with \`npx ripplo executor cloud\` \u2014 Ctrl-C to stop)`}function __({cwd:e,pid:t}){return`ripplo daemon: another daemon is already running for this project${t==null?"":` (pid ${String(t)})`} (cwd ${e}) \u2014 this one is exiting. Run \`npx ripplo daemon status\` to inspect it, or \`npx ripplo daemon stop\` to stop it.`}function j_(e){switch(e.kind){case"not-running":return"ripplo daemon: not running.";case"stopped":return`ripplo daemon: stopped (pid ${String(e.pid)}).`;case"timeout":return`ripplo daemon: pid ${String(e.pid)} did not exit within 10s \u2014 it may be finishing a run. Check again with \`npx ripplo daemon status\`.`}}function B_(){return"ripplo daemon: lock compromised \u2014 another daemon likely took over this project. Shutting down."}function V_(e){if(e.kind==="not-running")return"daemon: not running";if(e.kind==="unresponsive")return`daemon: running but no reply within ${String(e.timeoutMs/1e3)}s \u2014 likely busy executing runs, retry when the batch drains`;let{status:t}=e,n=t.version==null?"version unknown (pre-0.7.8)":`v${t.version}`,r=`${String(t.active)} active, ${String(t.queued)} queued`,i=cI(t.explorer,t.exploring),o=`daemon: running (${n} | ${r} | ${i} | ${lI(t.progress)})`;if(t.sseHealth!=null&&!t.sseHealth.ok){let s=t.sseHealth.detail==null?"":`: ${t.sseHealth.detail}`;return`${o}
|
|
67
|
+
daemon: cannot subscribe to run dispatch${s} \u2014 server-side, restarting the daemon will not help`}return o}function lI(e){return e.attempts===0?"explore: idle":`explore: ${String(e.attempts)} attempts, ${String(e.findings)} findings`}function W_(e){let t=e.daemonVersion==null?"an older version":`v${e.daemonVersion}`;return e.kind==="restarted"?`ripplo: daemon was ${t} \u2014 restarted on the current version`:`ripplo: daemon ${t} is older than this CLI but has runs in flight \u2014 restart it when idle to update`}function U_(e){switch(e.kind){case"pass":return{kind:"pass"};case"findings":return{findingLines:uI(e.findings).map(t=>Bi({evidencePath:`.ripplo/debug/${e.runId}/behavior.jsonl`,finding:t})),kind:"findings"};case"error":return{detail:jt(e.error),kind:"error"};case"dispatch-failed":return{kind:"dispatch-error",reason:{detail:e.reason,type:"generic"}}}}function cI(e,t){return e==="stalled"?"explorer: stalled \u2014 a wedged trail is restarting on its own, no action needed":`explorer: ${e}, ${String(t)} exploring`}function uI(e){let t=new Set(e.flatMap(n=>dI(n)?[yy(n)]:[]));return e.filter(n=>!(pI(n)&&t.has(yy(n))))}function dI(e){return e.kind==="pending-check"&&e.source.kind==="step"}function yy(e){return e.kind!=="pending-check"||e.source.kind==="data-rule"?"":`${ft(e.source.check)}|${ir(e.step)}`}function pI(e){return e.kind==="pending-check"&&e.source.kind==="fact"}export{en as a,R as b,ct as c,re as d,J as e,qn as f,oi as g,Eu as h,jt as i,Ri as j,fn as k,Ad as l,Ct as m,Pi as n,Fd as o,Gd as p,Kd as q,Hd as r,Yd as s,Xd as t,Jd as u,ep as v,le as w,sp as x,Li as y,Vt as z,Wt as A,Q as B,cp as C,Bi as D,Vi as E,fa as F,dp as G,or as H,pt as I,mp as J,xp as K,Ep as L,Cp as M,Pp as N,Hi as O,Mp as P,La as Q,pO as R,yO as S,iy as T,IO as U,TO as V,iI as W,my as X,aI as Y,$_ as Z,N_ as _,L_ as $,D_ as aa,F_ as ba,__ as ca,j_ as da,B_ as ea,V_ as fa,lI as ga,W_ as ha,U_ as ia};
|
|
68
|
+
/*! Bundled license information:
|
|
69
|
+
|
|
70
|
+
rrweb/dist/rrweb.js:
|
|
71
|
+
(*! *****************************************************************************
|
|
72
|
+
Copyright (c) Microsoft Corporation.
|
|
73
|
+
|
|
74
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
75
|
+
purpose with or without fee is hereby granted.
|
|
76
|
+
|
|
77
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
78
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
79
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
80
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
81
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
82
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
83
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
84
|
+
***************************************************************************** *)
|
|
85
|
+
*/
|