ripplo 0.8.0 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/dist/chunk-2MT2MZJW.js +11 -0
  2. package/dist/chunk-4FKGHWCC.js +5 -0
  3. package/dist/chunk-4W6WIT7T.js +4 -0
  4. package/dist/{chunk-SAYJ5AQK.js → chunk-5SM4TCSW.js} +19 -19
  5. package/dist/chunk-7TYUZIUO.js +8 -0
  6. package/dist/chunk-7WZ3VIUU.js +4 -0
  7. package/dist/chunk-A7SHHSB3.js +23 -0
  8. package/dist/chunk-AQ3DMGAY.js +6 -0
  9. package/dist/chunk-AVBP7Q2M.js +8 -0
  10. package/dist/chunk-CDPYJKK7.js +9 -0
  11. package/dist/chunk-CJUKILIO.js +4 -0
  12. package/dist/chunk-CRELTIU2.js +242 -0
  13. package/dist/{chunk-D6FZ55DP.js → chunk-DBIXYJRB.js} +1 -1
  14. package/dist/chunk-EGETJKAQ.js +4 -0
  15. package/dist/chunk-EK6TENV6.js +4 -0
  16. package/dist/chunk-ESOXRGIY.js +83 -0
  17. package/dist/chunk-FEHVIHVA.js +5 -0
  18. package/dist/chunk-I2M24U3N.js +23 -0
  19. package/dist/chunk-I5BHCICM.js +6 -0
  20. package/dist/chunk-JJ4QQPAV.js +4 -0
  21. package/dist/chunk-KOKEEAEF.js +6 -0
  22. package/dist/chunk-L7GWKDGD.js +4 -0
  23. package/dist/chunk-LB65USNP.js +73 -0
  24. package/dist/chunk-LEFXRK53.js +4 -0
  25. package/dist/chunk-LKYTQXPR.js +9 -0
  26. package/dist/chunk-M7VQD4VO.js +6 -0
  27. package/dist/chunk-MHNGR6M7.js +4 -0
  28. package/dist/chunk-MOI4L3EX.js +4 -0
  29. package/dist/chunk-N2B5GZPU.js +4 -0
  30. package/dist/chunk-OQ6KNYPG.js +4 -0
  31. package/dist/chunk-OWN4P2K7.js +4 -0
  32. package/dist/chunk-OY6HNCAZ.js +4 -0
  33. package/dist/chunk-PE5WVWI5.js +48 -0
  34. package/dist/chunk-PXZV5X3C.js +7 -0
  35. package/dist/chunk-R4ZTRVDQ.js +4 -0
  36. package/dist/chunk-SWOTFHBR.js +4 -0
  37. package/dist/chunk-T5VLZ43M.js +5 -0
  38. package/dist/chunk-UVYCSHOJ.js +55 -0
  39. package/dist/chunk-WHSQBXWO.js +7 -0
  40. package/dist/chunk-WNAVYV4P.js +4 -0
  41. package/dist/chunk-XBD3OTIW.js +8 -0
  42. package/dist/chunk-XWUIRXMS.js +16 -0
  43. package/dist/cli-error-SLG6JHK2.js +4 -0
  44. package/dist/compile-write-7AV66JUA.js +4 -0
  45. package/dist/daemon-BN42ZNCJ.js +139 -0
  46. package/dist/daemon-LFFCR3TB.js +4 -0
  47. package/dist/daemon-lock-LTQMLU4Q.js +4 -0
  48. package/dist/dsl-loader-H25XGSHJ.js +4 -0
  49. package/dist/exit-plan-gate-BNAUL4FC.js +4 -0
  50. package/dist/hook.js +5 -0
  51. package/dist/index.js +202 -405
  52. package/dist/plan-reminder-VMBDQTAP.js +4 -0
  53. package/dist/post-edit-2VFE6QND.js +4 -0
  54. package/dist/post-edit-analyze-VETPP5Z4.js +4 -0
  55. package/dist/post-edit-flag-stubs-J3MCGLXI.js +4 -0
  56. package/dist/pre-bash-run-gate-PWLARIYK.js +4 -0
  57. package/dist/pre-edit-Q4U5LSWG.js +4 -0
  58. package/dist/pre-edit-ripplo-skill-gate-JD4BDCA3.js +4 -0
  59. package/dist/pre-edit-scope-gate-NZO4HVGT.js +4 -0
  60. package/dist/pre-edit-watch-gate-EUZGEH2J.js +4 -0
  61. package/dist/prompt-submit-MPRVCWOI.js +4 -0
  62. package/dist/scope-reminder-CBY4I5SG.js +4 -0
  63. package/dist/session-preamble-RJ4WNGJN.js +4 -0
  64. package/dist/solve-worker.js +1 -1
  65. package/dist/status-UBUNHH5O.js +4 -0
  66. package/dist/stop-enforce-UXBQRTFP.js +64 -0
  67. package/dist/tasks-reminder-LKSUZUFD.js +4 -0
  68. package/dist/track-skill-load-CJ74GD3Q.js +4 -0
  69. package/dist/track-skill-prompt-YSB6OOQN.js +4 -0
  70. package/package.json +2 -2
  71. package/dist/chunk-E4AOUQQ7.js +0 -10
  72. package/dist/chunk-GOFUUPKD.js +0 -8
  73. package/dist/chunk-NIKFQP6W.js +0 -301
  74. package/dist/chunk-THHZNLXN.js +0 -48
  75. package/dist/chunk-VGYX2VAS.js +0 -85
  76. package/dist/daemon-MBF7JVEN.js +0 -139
  77. package/dist/daemon-VIHSG5KP.js +0 -4
  78. package/dist/daemon-lock-HIZ6UWXO.js +0 -4
  79. package/dist/status-G5OG62JI.js +0 -4
@@ -0,0 +1,83 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __ripploCreateRequire } from "node:module";
3
+ const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
4
+ import{C as as,D as vc,E as Fr,F as xc,J as _r,K as kc,O as Ec,P as Cc,Q as Ac,R as Pc,W as it,X as Mc,Z as Oc,a as S,b as yc,c as ss,d as tt,e as Nr,f as ce,g as gc,h as nt,i as Fn,j as Lr,k as Dr,l as Sc,p as bc,q as wc,r as ue,s as ye,t as Xt,u as Rc,v as Tt,w as rt,x as ke,y as G,z as we}from"./chunk-5SM4TCSW.js";import{a as Sy}from"./chunk-NNH3YVVO.js";import{a as gy,b as mc}from"./chunk-KMZ3L5YA.js";var yd=gy((n$,Ys)=>{"use strict";var yi=process||{},hd=yi.argv||[],mi=yi.env||{},Ob=!(mi.NO_COLOR||hd.includes("--no-color"))&&(!!mi.FORCE_COLOR||hd.includes("--color")||yi.platform==="win32"||(yi.stdout||{}).isTTY&&mi.TERM!=="dumb"||!!mi.CI),Ib=(e,t,n=e)=>r=>{let i=""+r,o=i.indexOf(t,e.length);return~o?e+Tb(i,t,n,o)+t:e+i+t},Tb=(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)},md=(e=Ob)=>{let t=e?Ib:()=>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")}};Ys.exports=md();Ys.exports.createColors=md});function re(e){return`${e.workflow}/${e.slug}`}var Ic=new WeakMap;function J(e){let t=Ic.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 Ic.set(e,n),n}function ls({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 by=ls();function cs(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!e.includes("\x1B")&&!e.includes("\x9B")?e:e.replace(by,"")}function us(e,t,n){return{detail:n.slice(0,500),kind:"engine-http",path:e,status:t}}function Jt(e,t){return{code:Dc(t),kind:"engine-network",message:jn(t),path:e}}function jr(e){return{kind:"client-mount-missing",mountKey:e}}function ds(e,t){return{kind:"app-not-ready",readyKey:e,timeoutMs:t}}function ps(e,t){return{kind:"engine-decode",message:jn(t),path:e}}function fs(e,t){return{entity:e,field:t,kind:"state-identity"}}function hs(e){return{as:e,kind:"setup-missing-row"}}function Ue(e){return{kind:"driver-launch",message:jn(e)}}function ms(e){return{kind:"engine-unreachable",url:e}}function ys(e,t){return{action:e,kind:"action-failed",message:jn(t)}}function gs(e){return{kind:"check-failed",message:jn(e)}}function Ss(){return{kind:"aborted"}}var wy=["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"],Ry=new Set(wy);function Br(e){if(typeof e!="object"||e==null||!("kind"in e))return!1;let{kind:t}=e;return typeof t=="string"&&Ry.has(t)}var vy=["app-not-ready","client-mount-missing","driver-launch","engine-decode","engine-http","engine-network","engine-unreachable"],$c=new Set(vy);function Vr(e){return $c.has(e.kind)}function Nc(e){return $c.has(e)}var Tc=300;function _n(e){switch(e.kind){case"engine-http":return`engine ${e.path} returned ${String(e.status)}: ${Lc(e.detail)}${Cy(e.status)}`;case"engine-network":return`engine ${e.path} request failed: ${e.message}${xy(e.code)}${Ey(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 Lc(e){let t=e.replaceAll(/\s+/gu," ").trim();return t.length<=Tc?t:`${t.slice(0,Tc)}\u2026 [truncated]`}function xy(e){return e==null?"":` (${e})`}var ky=new Set(["EAI_AGAIN","ECONNREFUSED","ENOTFOUND"]);function Ey(e,t){return e!=null&&ky.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 Cy(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 Dc(e){if(!(typeof e!="object"||e==null))return"code"in e&&typeof e.code=="string"?e.code:"cause"in e?Dc(e.cause):void 0}function jn(e){let t=e instanceof Error?e.message:String(e);return Lc(cs(t))}var Fc=new WeakMap;function Qt(e){let t=Fc.get(e);if(t!=null)return t;let n={entities:e.entities,singletonSchemas:e.singletons,valueSpaces:e.valueSpaces};return Oc(n,e.solved),Fc.set(e,n),n}import{createHash as uS}from"crypto";import{z as Ay}from"zod";import{stringify as Py}from"safe-stable-stringify";var bs=Ay.string().brand(),M=bs.parse("");function Ne(e){return bs.parse(e)}function Ee(e,t){return bs.parse(e.length===0?t:`${e}.${t}`)}function W(e){return yc.safeParse(e).success}function _c(e){let t=e.lastIndexOf(".");return t===-1?void 0:{alias:e.slice(0,t),field:e.slice(t+1)}}function Ge(e){return typeof e=="object"&&e!==null&&"template"in e}function jc(e){return typeof e!="string"&&"count"in e}function Re(e){return{counts:void 0,env:e}}function ws(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 Bn(e,t,n){return Wr(e).every(r=>n.has(Ee(t,r)))}function qe(e,t,n){return typeof e=="string"?e:W(e)?String(ws(e,t,n.env)):e.template.map(r=>Oy(r,t,n)).join("")}function Ce(e,t,n){return e===null||typeof e=="number"||typeof e=="boolean"?e:W(e)?ws(e,t,n.env):qe(e,t,n)}function Bc(e,t){return Ce(e,M,t)}function Vn(e){return Py(e)}function en(e,t,n){return Object.fromEntries(Object.entries(e).map(([r,i])=>[r,Ce(i,t,n)]))}function Wr(e){return e==null||typeof e!="object"?[]:Ge(e)?e.template.flatMap(t=>typeof t=="string"?[]:jc(t)?My(t):[t.ref]):[e.ref]}function My(e){return Object.values(e.count.where).flatMap(t=>Vc(t))}function Vc(e){return e==null||typeof e!="object"?[]:"kind"in e?e.kind==="within"?Object.values(e.selection.where).flatMap(t=>Vc(t)):e.kind==="anyOf"?e.values.flatMap(t=>Wr(t)):Wr(e.value):Wr(e)}function Oy(e,t,n){if(typeof e=="string")return e;if(!jc(e))return String(ws(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:qe(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:qe(e.value,M,t)}}function Wn(e,t){if(e==null)return new Set;if(e.by==="inside")return new Set([...Wn(e.scope,t),...Wn(e.target,t)]);if(e.by==="surface")return Wn(e.container,t);let n=e.by==="role"?e.name:e.value;return new Set(t(n))}var Iy="https://ripplo.invalid";var Wc={hash:void 0,path:void 0,query:{},title:void 0,viewport:void 0};function zc(e){return e.kind!=="title"&&e.kind!=="viewport"}function tn(e){return e.kind==="query"?`url query "${e.key}"`:e.kind==="title"||e.kind==="viewport"?e.kind:`url ${e.kind}`}function Ur(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 Un(e){let t=new URL(e,Iy),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 Gc(e){if(typeof e=="string")return Uc(Un(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{...Wc,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{...Wc,path:s};let a=o.filter(c=>typeof c=="string").join(""),l=Un(`/p${a.slice(a.search(/[?#]/))}`);return{...Uc(l),path:s}}function qc(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 Uc(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):Nr(e.locator,e.state)}function ot(e,t){return new Map([...Kc(e,t),[R(t.subject),t]])}function Rs(e,t){return new Map([...Kc(e,t),[R(t.subject),t]])}function Ae(e,t){return new Map([...e,...t])}function vs(e){return e.kind==="element"}function St(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 rn(e){let t=Un(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 xs(e){return[...e].toSorted(([t],[n])=>t.localeCompare(n))}function Kc(e,t){return Ty(t)?$y(e,t.subject):Ly(t)?Dy(e,t.subject):e}function Ty(e){return e.subject.kind==="element"&&e.subject.state==="visible"&&e.expect.expect==="is"&&e.expect.value===!1}function $y(e,t){if(t.kind!=="element")return e;let n=S(ce(t.locator)),r=[...e].filter(([,i])=>Ny(i,n));return r.length===e.size?e:new Map(r)}function Ny(e,t){if(e.subject.kind!=="element")return!0;let n=ce(e.subject.locator);return zr(n,t)?!1:S(n)!==t?!0:e.subject.state!=="text"&&e.subject.state!=="value"}function zr(e,t){return e.by!=="inside"?!1:S(e.scope)===t||S(e.target)===t||zr(e.scope,t)||zr(e.target,t)}function Ly(e){return e.subject.kind==="element"&&e.subject.state==="visible"&&e.expect.expect==="is"&&e.expect.value===!0&&Hc(e.subject.locator)}function Hc(e){return e.by==="surface"&&e.overlay}function Dy(e,t){if(t.kind!=="element")return e;let n=S(ce(t.locator)),r=[...e].filter(([,i])=>Fy(i,n));return r.length===e.size?e:new Map(r)}function Fy(e,t){if(e.subject.kind!=="element"||Hc(e.subject.locator))return!0;let n=ce(e.subject.locator);return S(n)===t||zr(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=By(r)&&typeof i=="number"?String(i):i;return{declared:e,expect:{expect:t.expect.expect,value:o},subject:r}}function $t({got:e,subject:t,want:n}){if(n.expect==="absent")return e===void 0;if(_y(t)){let r=jy(e,n.value);return n.expect==="is"?r:!r}return n.expect==="is"?e===n.value:e!==n.value}function _y(e){return e.kind==="element"&&e.state==="text"}function nn(e){return e.replaceAll(/\s+/gu," ").trim()}function jy(e,t){return typeof e=="string"&&typeof t=="string"&&nn(e)===nn(t)}function By(e){return e.kind==="element"&&(e.state==="value"||e.state==="text")}import Vy from"better-sqlite3";var Yc={current:null};function Gr(){let e=Yc.current;if(e!=null)return e;let t={columns:new Map,db:new Vy(":memory:"),loaded:null,statements:new Map};return Yc.current=t,t}function Nt(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 Ke(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 qr(e,t){t.entities.forEach((n,r)=>{let i=[...new Set([...n.values()].flatMap(o=>Object.keys(o)))];Ke(e,r,i)})}function zn(e,t,n){Ke(e,t,Object.keys(n)),Object.values(n).forEach(r=>{ue(r)&&(Ke(e,r.selection.entity,[r.field]),zn(e,r.selection.entity,r.selection.where))})}function Kr(e,t){e.loaded!==t&&(e.columns.forEach((n,r)=>{Nt(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=Nt(e,`INSERT INTO "${r}" ${l} VALUES ${c}`);i.forEach((d,p)=>{u.run(p,...o.map(m=>Wy(d[m])))})}),e.loaded=t)}function Wy(e){return typeof e=="boolean"?e?1:0:typeof e=="string"||typeof e=="number"?e:e instanceof Date?e.toISOString():null}function ks({entity:e,snapshot:t,where:n}){let r=Gr();zn(r,e,n),qr(r,t),Kr(r,t);let o=`SELECT r.__as AS __as FROM "${e}" r WHERE ${wt(n,{depth:0,refExpr:Uy,row:"r"})} ORDER BY r.rowid`;return Nt(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?[]:ks(e).flatMap(n=>{let r=t.get(n);return r==null?[]:[r]})}function Uy(e){throw new Error(`sql-where: unresolved ref "${e}" \u2014 resolve refs before matching`)}function wt(e,t){let n=Object.entries(e).map(([r,i])=>zy({column:`${t.row}."${r}"`,scope:t,want:i}));return n.length===0?"1":n.join(" AND ")}function zy({column:e,scope:t,want:n}){if(ue(n)){let r=`w${String(t.depth)}`,i=wt(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)?qy({column:e,scope:t,want:n}):`${e} IS ${Lt(n,t.refExpr)}`}function Lt(e,t){let n=Gy(e);if(n!=null)return t(n);if(e instanceof Date)return bt(e.toISOString());if(e!=null&&typeof e=="object")throw new Error("sql-where: template values must be resolved before compiling");return bt(e)}function bt(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 Gy(e){if(e!=null&&typeof e=="object"&&"ref"in e)return typeof e.ref=="string"?e.ref:void 0}function qy({column:e,scope:t,want:n}){let{refExpr:r}=t;if(n.kind==="not")return`${e} IS NOT ${Lt(n.value,r)}`;if(n.kind==="anyOf")return`(${n.values.map(o=>`${e} IS ${Lt(o,r)}`).join(" OR ")})`;if(n.kind==="compare"){let i={gt:">",gte:">=",lt:"<",lte:"<="}[n.op];return`${e} ${i} ${Lt(n.value,r)}`}return n.kind==="contains"?`instr(${e}, ${Lt(n.value,r)}) > 0`:`substr(${e}, 1, length(${Lt(n.value,r)})) IS ${Lt(n.value,r)}`}function Rt(e){return typeof e=="object"&&e!==null&&"kind"in e}function vt(e){return Object.fromEntries(Object.entries(e).filter(t=>!Rt(t[1])))}function Cs(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)=>Yy(r,i,n,e),e)}function Xc(e,{clears:t,forget:n,sets:r}){let i=new Set(t),o=Ky(e,n,r),s=[...e.scalars].filter(([l,c])=>!i.has(l)&&!(o&&(vs(c.subject)||Hy(c.subject)))),a=[...r.values()].reduce((l,c)=>ot(l,c),new Map(s));return{...e,scalars:a}}function Ky(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 Hy(e){return e.kind==="query"||e.kind==="hash"}function Yy(e,t,n,r){let{env:i,identities:o}=n;if(!Jy(t,i))return e;if(t.assertion.kind==="created"){let l=en(t.assertion.props,M,{counts:ge(e),env:i}),c=Zy({entity:t.entity,identities:o,props:l},e);return eg(e,t.entity,Vn(c),c)}let s=eu({entity:t.entity,env:i,key:t.key,snapshot:r});if(t.assertion.kind==="deleted")return Es(e,t.entity,l=>new Map([...l].filter(([c])=>!s.has(c))));let a=en(vt(t.assertion.props),M,{counts:ge(e),env:i});return Es(e,t.entity,l=>new Map([...l].map(([c,u])=>s.has(c)?[c,{...u,...a}]:[c,u])))}var As="#surrogate#";function Jc(e){return typeof e=="string"&&e.includes(As)}function Zy({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=Xy(r.entities.get(e),e),s=Object.fromEntries(i.map(a=>[a,`${e}${As}${String(o)}`]));return{...n,...s}}function Xy(e,t){let n=`${t}${As}`;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 Jy(e,t){return("props"in e.assertion?[e.key,vt(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 eg(e,t,n,r){let i=new Map([...e.entities.get(t)??[],[n,r]]);return{...e,entities:new Map([...e.entities,[t,i]])}}function Es(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:Ps(n,{env:r,snapshot:e})})}function Qc(e,t,n,r,i){let o=eu({entity:t,env:r,key:n,snapshot:e});return Es(e,t,s=>new Map([...s].map(([a,l])=>[a,o.has(a)?i(l):l])))}function eu({entity:e,env:t,key:n,snapshot:r}){return new Set(ks({entity:e,snapshot:r,where:Ps(n,{env:t,snapshot:r})}))}function Ps(e,t){return Object.fromEntries(Object.entries(e).map(([n,r])=>[n,tg(r,t)]))}function tg(e,t){return ue(e)?{...e,selection:{...e.selection,where:Ps(e.selection.where,t)}}:ye(e)?e.kind==="anyOf"?{...e,values:e.values.map(n=>Hr(n,t))}:e.kind==="contains"||e.kind==="startsWith"?{...e,value:String(Hr(e.value,t))}:{...e,value:Hr(e.value,t)}:Hr(e,t)}function Hr(e,t){return Ce(e,M,{counts:ge(t.snapshot),env:t.env})}function nu(e,t,n){return e.reduce((r,i)=>{let o=on(r.snapshot,ng(i),n);return{resolved:[...r.resolved,rg(i,o,n.env)],snapshot:o}},{resolved:[],snapshot:t}).resolved}function Dt(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 tu(ae(t.snapshot.scalars,{kind:"variable",name:e.singleton}))===tu(n)}return e.kind==="not"?!Dt(e.predicate,t):e.kind==="or"?e.predicates.some(n=>Dt(n,t)):e.predicates.every(n=>Dt(n,t))}function ng(e){return e.expect.filter(t=>t.kind==="state")}function rg(e,t,n){return e.expect.some(r=>r.kind==="when")?{...e,expect:e.expect.flatMap(r=>ru(r,{env:n,snapshot:t}))}:e}function ru(e,t){if(e.kind!=="when")return[e];let n=ig(e,t);return n==null?[]:n.flatMap(r=>ru(r,t))}function ig(e,t){return e.branches.find(n=>n.condition==null||Dt(n.condition,t))?.consequence}function tu(e){return e==null?"\u2205":JSON.stringify(e)}var iu=2e4;function au(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=sg({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}`),og(e,u),u},null);if(r==null)return{};let i=ag(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 og(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>iu)throw new Error(`sql-staged: pattern too weakly constrained \u2014 ${String(r)} partial assignments exceed the ${String(iu)} cap`)}function sg({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 ${bt(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}" = ${ou(t,d,u.targetField)}`]}),a=t.entities.slice(0,e).flatMap((u,d)=>u.relations.flatMap(p=>p.targetAlias===r.alias?[`${ou(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 ou(e,t,n){let r=e.entities[t]?.entity??"";return`(SELECT b."${n}" FROM "${r}" b WHERE b.__as = prev."a${String(t)}")`}function su(e,t,n){let r=e.entities[t]?.entity??"";return`(SELECT r."${n}" FROM "${r}" r WHERE r.__as = s."a${String(t)}")`}function ag(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 su(e,c,a.slice(l+1))},r=e.absences.map(a=>{let l=[...Object.entries(a.literals).map(([u,d])=>`x."${u}" IS ${bt(d)}`),...a.relations.map(u=>{let d=t.get(u.targetAlias);return d==null?"0":`x."${u.field}" = ${su(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=>Ms(a,o));return[...r,...i,...s]}function Ms(e,t){if(e.kind==="singleton")return[];if(e.kind==="not"){let n=Ms(e.predicate,t);return n.length===0?[]:[`NOT (${n.join(" AND ")})`]}return e.kind==="and"||e.kind==="or"?lg(e,t):[cg(e,t)]}function lg(e,t){let n=e.predicates.flatMap(i=>Ms(i,t)),r=e.kind==="and"?" AND ":" OR ";return n.length===0?[]:[`(${n.join(r)})`]}function cg(e,t){return e.kind==="count"?`(SELECT COUNT(*) FROM "${e.entity}" c WHERE ${wt(e.where,t)}) = ${String(e.value)}`:`EXISTS (SELECT 1 FROM "${e.entity}" c WHERE ${wt(e.where,t)})`}var lu=new WeakMap,ug=60;function du(e,t){let n=Gr(),r=dg(t);if(pg(e.actor,r))return null;if(fg(n,e),qr(n,t),Kr(n,t),e.entities.length>ug){let s=au(n,e);return s==null?null:uu({pattern:e,picked:s,snapshot:t})}let i=lu.get(e)??mg(e);lu.set(e,i);let o=i.includes(":actor")?Nt(n,i).get({actor:r}):Nt(n,i).get();return o==null||typeof o!="object"?null:uu({pattern:e,picked:o,snapshot:t})}function dg(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 pg(e,t){return e.kind==="user"?t==null:e.kind==="anonymous"?t!=null:!1}function fg(e,t){t.entities.forEach(n=>{Ke(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&&Ke(e,i.entity,[r.targetField])})}),t.absences.forEach(n=>{Ke(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&&Ke(e,i.entity,[r.targetField])})}),t.conditions.forEach(n=>{Is(e,n),Os({condition:n,pattern:t,store:e})}),t.exclusives.forEach(n=>{Ke(e,n,[])})}function Os({condition:e,pattern:t,store:n}){if(e.kind!=="singleton"){if(e.kind==="not"){Os({condition:e.predicate,pattern:t,store:n});return}if(e.kind==="and"||e.kind==="or"){e.predicates.forEach(r=>{Os({condition:r,pattern:t,store:n})});return}pu(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&&Ke(n,s.entity,[r.slice(i+1)])})}}function pu(e){return Object.values(e).flatMap(t=>hg(t))}function hg(e){return ue(e)?pu(e.selection.where):ye(e)?(e.kind==="anyOf"?e.values:[e.value]).flatMap(n=>cu(n)):cu(e)}function cu(e){return e!=null&&typeof e=="object"&&"ref"in e?typeof e.ref=="string"?[e.ref]:[]:[]}function Is(e,t){if(t.kind!=="singleton"){if(t.kind==="not"){Is(e,t.predicate);return}if(t.kind==="and"||t.kind==="or"){t.predicates.forEach(n=>{Is(e,n)});return}zn(e,t.entity,t.where)}}function uu({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 mg(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=[...yg(e,t),...e.entities.flatMap((s,a)=>gg({alias:`t${String(a)}`,aliases:t,constraint:s})),...Sg(e,t),...e.absences.map(s=>bg(s,t)),...e.conditions.flatMap(s=>Ts(s)?[]:[$s(s,t)]),...wg(e,t)],o=i.length===0?"":` WHERE ${i.join(" AND ")}`;return`SELECT ${n}${r}${o} LIMIT 1`}function yg(e,t){if(e.actor.kind!=="user")return[];let n=t.get(e.actor.alias);return n==null?[]:[`${n}.__as = :actor`]}function Ts(e){return e.kind==="singleton"?!0:e.kind==="not"?Ts(e.predicate):e.kind==="and"||e.kind==="or"?e.predicates.some(t=>Ts(t)):!1}function gg({alias:e,aliases:t,constraint:n}){let r=Object.entries(n.literals).map(([o,s])=>`${e}."${o}" IS ${bt(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 Sg(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 bg(e,t){let n=[...Object.entries(e.literals).map(([i,o])=>`x."${i}" IS ${bt(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 wg(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 $s(e,t){let n={depth:0,refExpr:Rg(t),row:"c"};if(e.kind==="count")return`(SELECT COUNT(*) FROM "${e.entity}" c WHERE ${wt(e.where,n)}) = ${String(e.value)}`;if(e.kind==="exists")return`EXISTS (SELECT 1 FROM "${e.entity}" c WHERE ${wt(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 (${$s(e.predicate,t)})`;let r=e.predicates.map(o=>$s(o,t)),i=e.kind==="and"?" AND ":" OR ";return`(${r.join(i)})`}function Rg(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=Ns(e,t);if(n==null)return null;let r=xg(e.scalars,t,yu(n));return r==null?null:e.conditions.every(o=>Dt(o,{env:r,snapshot:t}))?r:null}function Ns(e,t){return du(e,t)}function Yr(e,t){let n=Ns(e,t);if(n==null)return{kind:"entities"};let r=vg(e.scalars,t,yu(n));if(r.unmet!=null)return r.unmet;let i=e.conditions.find(o=>!Dt(o,{env:r.env,snapshot:t}));return i==null?null:{condition:i,kind:"condition"}}function vg(e,t,n){return[...e.values()].reduce((r,i)=>{if(r.unmet!=null)return r;let o=fu(i,t,r.env);if(o!=null)return{env:o,unmet:null};let s=hu(i.subject,r.env),a=s==null?void 0:mu(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 fu(e,t,n){let r=hu(e.subject,n);if(r==null)return null;let i=mu(t,r);return e.expect.expect==="absent"?i===void 0?n:null:e.expect.expect==="not"?Pg({clause:e.expect.value,env:n,got:i,snapshot:t,subject:r}):kg({clause:e.expect.value,env:n,got:i,snapshot:t,subject:r})}function xg(e,t,n){return[...e.values()].reduce((r,i)=>r==null?null:fu(i,t,r),n)}function kg({clause:e,env:t,got:n,snapshot:r,subject:i}){if(Eg(i,e,t))return n===void 0?null:new Map([...t,[Ne(Cg(e)),n]]);if(!Bn(e,M,t))return null;let o=Ce(e,M,{counts:ge(r),env:t});return $t({got:n,subject:i,want:{expect:"is",value:o}})?t:null}function Eg(e,t,n){return e.kind==="element"&&(e.state==="value"||e.state==="text")&&W(t)&&!Bn(t,M,n)}function Cg(e){if(!W(e))throw new Error("expected a ref clause");return e.ref}function hu(e,t){return e.kind!=="element"?e:Ag(e.locator,t)?{...e,locator:de(e.locator,Re(t))}:null}function Ag(e,t){return[...Wn(e,n=>n==null?[]:[n])].every(n=>Bn(n,M,t))}function mu(e,t){let n=e.scalars.get(R(t));return n==null||n.expect.expect!=="is"?void 0:n.expect.value}function Pg({clause:e,env:t,got:n,snapshot:r,subject:i}){if(!Bn(e,M,t))return null;let o=Ce(e,M,{counts:ge(r),env:t});return $t({got:n,subject:i,want:{expect:"not",value:o}})?t:null}function yu(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 gu(e){return[...Mg(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(vt(e.assertion.props)).flatMap(t=>G(t)),...Object.values(e.key).flatMap(t=>Ls(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=>Ls(t));case"actor":return e.target.kind==="anonymous"?[]:[e.target.ref.ref]}}function Mg(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 Ls(e){return ue(e)?Object.values(e.selection.where).flatMap(t=>Ls(t)):ye(e)?(e.kind==="anyOf"?e.values:[e.value]).flatMap(n=>G(n)):G(e)}function Zr(e){return e.flatMap(t=>t.kind==="and"?Zr(t.predicates):[t])}function xt(e){return Zr(e).filter(t=>!Xt(t))}function Xr(e){return e.action.kind==="goto"?!0:Ds(e.expect).some(t=>t.kind==="browser"&&t.name==="url"&&t.value!==null)}function Ft(e){return e.action.kind==="goto"?!0:Ds(e.expect).some(t=>t.kind==="browser"&&t.name==="url"&&t.value!==null&&(t.part===void 0||t.part.kind==="path"))}function Ds(e){return e.flatMap(t=>t.kind==="and"?Ds(t.predicates):[t])}function He(e,t){return t.reduce((n,r)=>{let i=[...Dg(r),...qn(r),...Fg(r)],o=Og(r,n,i)?Lg(n):n;return i.reduce((s,a)=>Rs(s,a),o)},e)}function he(e){return e.kind==="not"?Ig(e.predicate):e.kind==="singleton"?{expect:{expect:"is",value:e.assertion.value},subject:{kind:"variable",name:e.singleton}}:Tg(e)}function Gn(e){return qc(Gc(e)).map(({clause:t,key:n})=>({expect:t===null?{expect:"absent"}:{expect:"is",value:t},subject:n}))}function Og(e,t,n){if(e.action.kind==="goto")return!0;if(!Ft(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 Ig(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}}:Su(e,!0)}function Su(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=$g(e);return n==null?null:{expect:{expect:"is",value:n.value!==t},subject:{kind:"element",locator:n.locator,state:n.state}}}function Tg(e){return e.kind==="browser"?{expect:e.value===null?{expect:"absent"}:{expect:"is",value:e.value},subject:Ur(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"}}:Su(e,!1)}function qn(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 $g(e){return Ng(e)?e.kind==="disabled"?{locator:e.locator,state:"enabled",value:!1}:{locator:e.locator,state:e.kind,value:!0}:null}function Ng(e){return e.kind==="visible"||e.kind==="disabled"||e.kind==="enabled"||e.kind==="focused"||e.kind==="checked"||e.kind==="expanded"||e.kind==="pressed"}function Lg(e){return new Map([...e].filter(([,t])=>t.subject.kind==="variable"||t.subject.kind==="viewport"))}function Dg(e){return e.action.kind==="goto"?Gn(e.action.url):[]}function Fg(e){return xt(e.expect).flatMap(t=>{let n=he(t);return n==null?[]:[n]})}function Fs(e){return e.includes("async")?"async":e.includes("slow")?"slow":"fast"}var ct={async:12e4,fast:5e3,slow:3e4},_s={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 bu(e,t){return e.backoffMs[Math.min(t,e.backoffMs.length-1)]??0}function Ye(e){return`${e.test}#${String(e.index)}`}function Kn(e){let t=J(e).flatMap(n=>Hn(e,n.test));return Me(t,n=>`${n.test}:${S(n.steps)}`)}function Hn(e,t){let n=xu(t),r=vu(n,t.singletons,t.actor),i=sS(t,oS(e)),o=jg(e,t),s=Cs(e);return Vg(r,aS(t.steps),n).reduce((l,{chunk:c,requiredState:u},d)=>({offset:l.offset+c.length,transitions:[...l.transitions,nS({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 wu(e){return[R({kind:"viewport"}),{expect:{expect:"is",value:e},subject:{kind:"viewport"}}]}var _g=R({kind:"viewport"});function Ru(e){let t=e.scalars.get(_g);return t==null||t.expect.expect!=="is"||typeof t.expect.value!="string"?null:t.expect.value}function vu(e,t,n){return{absences:Jg(e),actor:n,conditions:[],entities:tS(e),exclusives:e.exclusives,scalars:new Map(Object.entries(t).filter(([,r])=>!W(r)&&!Ge(r)).map(([r,i])=>[R({kind:"variable",name:r}),{expect:{expect:"is",value:i},subject:{kind:"variable",name:r}}]))}}function jg(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 Jr(e,t,n){return Object.values(e).flatMap(r=>W(r)?sn(r.ref,n):[]).find(r=>r.entity===t)?.aliasPath}function Yn(e,t){return t.reduce((n,r)=>Bg(r)??n,e)}function Bg(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"?Rc:{alias:t.target.ref.ref,kind:"user"}}function Vg(e,t,n){return t.reduce((r,i)=>({requiredState:Wg(r.requiredState,i,n),withRequiredState:[...r.withRequiredState,{chunk:i,requiredState:Xg(r.requiredState,i)}]}),{requiredState:e,withRequiredState:[]}).withRequiredState}function Wg(e,t,n){let r=t.flatMap(i=>i.expect.filter(o=>o.kind==="state")).reduce((i,o)=>Ug(i,o,n),e);return{...r,actor:Yn(r.actor,t),scalars:He(r.scalars,t)}}function Ug(e,t,n){return t.assertion.kind==="deleted"?zg(e,t,n):t.assertion.kind==="created"?Kg(e,t.entity,t.assertion.as,t.assertion.props,n):Yg(e,t,n)}function zg(e,t,n){let r=Jr(t.key,t.entity,n.namespace),i=e.entities.find(a=>a.alias===r),o=Zn(Gg(t.key),n),s=i==null?{entity:t.entity,params:{},...o}:{entity:i.entity,params:{},...qg(i,o)};return{...e,absences:[...e.absences,s],entities:e.entities.filter(a=>a.alias!==r)}}function Gg(e){return Object.fromEntries(Object.entries(e).flatMap(t=>{let n=t[1];return ue(n)||ye(n)?[]:[[t[0],n]]}))}function qg(e,t){return{literals:{...e.literals,...t.literals},relations:[...e.relations.filter(n=>!t.relations.some(r=>r.field===n.field)),...t.relations]}}function Kg(e,t,n,r,i){let o=Zn(r,i);return{...e,absences:e.absences.filter(s=>s.entity!==t||!Hg(o,s)),entities:[...e.entities,{alias:n,entity:t,...o}]}}function Hg(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 Yg(e,t,n){if(t.assertion.kind!=="updated")return e;let r=Jr(t.key,t.entity,n.namespace);if(r==null)return e;let i=Zn(vt(t.assertion.props),n),o=Object.entries(t.assertion.props).filter(([,a])=>Rt(a)).map(([a])=>a),s=a=>a.alias===r?Zg(a,i,o):a;return{...e,entities:e.entities.map(a=>s(a))}}function Zg(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 Xg(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 Qr(e,t){let n=xu(t);return{namespace:n.namespace,requiredState:vu(n,t.singletons,t.actor)}}function js(e,t){return[...new Set(e)].flatMap(n=>sn(n,t))}function xu(e){return{absences:e.absent,exclusives:e.exclusive,namespace:new Map(e.world.map(t=>[t.as,t.entity])),setups:e.world}}function Jg(e){return e.absences.map(t=>({entity:t.entity,...Zn(t.where,e),params:Qg(t.where,e)}))}function Zn(e,t){let n=Object.entries(e),r=Object.fromEntries(n.flatMap(([o,s])=>W(s)||Ge(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 eS(e,t){return e.map(n=>({alias:n.as,entity:n.entity,...Zn(n.set,t)}))}function tS(e){return eS(e.setups,e)}function sn(e,t){let n=_c(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 nS(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=>gu(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:Fs(e.chunk.flatMap(s=>[...rS(s),...iS(s)])),whenSteps:e.whenChunk}}function rS(e){return e.expect.flatMap(t=>t.kind==="state"&&t.wait!=null?[t.wait]:[])}function iS(e){return Xr(e)?["slow"]:[]}function oS(e){return new Map(e.valueSpaces.map(t=>[t.name,t]))}function sS(e,t){return new Map(Object.entries(e.params).map(([n,r])=>[n,t.get(r.valueSpace)]))}function aS(e){return e.map(t=>[t])}function ku(e,t){let n=rt({conditions:e.when,...lS(e,t)});return e.expect.map(r=>({consequence:r,localConsequence:!1,origin:{kind:"declared",name:e.name},refs:new Set,when:n}))}var Bs="@actor";function lS(e,t){if(!e.when.some(o=>Vs(o).some(s=>s.startsWith(`${Bs}.`))))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:Bs,kind:"user"},entities:[{alias:Bs,entity:i.name,literals:{},relations:[]}]}}function Vs(e){return e.kind==="not"?Vs(e.predicate):e.kind==="and"||e.kind==="or"?e.predicates.flatMap(t=>Vs(t)):e.kind==="singleton"?G(e.assertion.value):Object.values(e.where).flatMap(t=>Eu(t))}function Eu(e){return ue(e)?Object.values(e.selection.where).flatMap(t=>Eu(t)):ye(e)?cS(e):G(e)}function cS(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 Ze(e){return e.surfaces.filter(t=>t.by==="surface"&&t.overlay)}function ei(e,t){return{...e,scalars:ti(e.scalars,t)}}function ti(e,t){return Pu(e,t,n=>({expect:{expect:"is",value:!1},subject:{kind:"element",locator:n,state:"visible"}}))}function Au(e,t){let n=Pu(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 Pu(e,t,n){let r=t.filter(i=>!e.has(Cu(i))).map(i=>[Cu(i),n(i)]);return r.length===0?e:new Map([...e,...r])}function Cu(e){return R({kind:"element",locator:e,state:"visible"})}var Mu=new WeakMap;function ut(e){let t=Mu.get(e);if(t!=null)return t;let n=uS("sha256").update(S({consequence:e.consequence,when:ke(e.when)})).digest("base64");return Mu.set(e,n),n}function ri(e){let t=e.facts.flatMap(o=>ku(o,e)),n=new Set(Ze(e).map(o=>S(ce(o)))),r=J(e).map(o=>Us(e,o)),i=Me(r.flatMap(o=>o.steps.flatMap(s=>s.facts)),ut).filter(o=>!dS(o.consequence,n));return Promise.resolve([...t,...i])}function Ws(e,t){return e.filter(n=>!mS(n)||yS(n)===t)}function ii(e){return e.kind==="not"?ii(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 dS(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 oi(e,t){if(e.facts.length===0)return t;let n=Xn(e,t);return n.size===0?t:{...t,scalars:Ae(n,t.scalars)}}function Xn(e,t){let n=Au(t,e.overlays),r=e.facts.flatMap(s=>{let a=Pe(s.when,n);if(a==null)return[];let l=pS(s.consequence,a,n);return l==null?[]:[{entry:l,factKey:ut(s),key:R(l.subject)}]}),i=r.filter(s=>!hS({m:s,matched:r,overrides:e.overrides})),o=fS(i);return i.reduce((s,a)=>o.has(a.key)?s:ot(s,a.entry),Le)}function pS(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 fS(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 hS({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 mS(e){return e.origin?.kind==="test"&&e.localConsequence}function yS(e){let{origin:t}=e;if(!(t==null||t.kind!=="test"))return t.test}var Ou=new WeakMap;function Us(e,t){let n=Ou.get(t);if(n!=null)return n;let r=gS(e,t);return Ou.set(t,r),r}function gS(e,{test:t,workflow:n}){let r=Qr(e,t),i=SS(r,t.viewport),o=Ze(e),s=bS(n.steps),a=t.steps.reduce((l,c)=>{let u=RS(l.requiredState,c,i,o),d=OS({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:ei(i.requiredState,o),steps:[]});return{initial:ei(i.requiredState,o),steps:a.steps}}function SS(e,t){return{...e,requiredState:{...e.requiredState,scalars:new Map([...e.requiredState.scalars,wu(t)])}}}function bS(e){return e.flatMap(n=>n.expect).flatMap(n=>ni(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 ni(e){return e.kind==="not"?ni(e.predicate):e.kind==="and"||e.kind==="or"?e.predicates.flatMap(t=>ni(t)):e.kind!=="when"?[]:e.branches.flatMap((t,n)=>{let r=wS(e.branches,n);return t.consequence.flatMap(i=>[{condition:r,consequence:i},...ni(i)])})}function wS(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 RS(e,t,n,r){let{entities:i}=vS(e,t,n),o=He(e.scalars,[t]),s=Yn(e.actor,[t]);return ei({...e,actor:s,entities:i,scalars:o},r)}function vS(e,t,n){return t.expect.reduce((r,i)=>i.kind==="state"?xS(r,i,n):r,e)}function xS(e,t,n){if(t.assertion.kind==="created"){let o=kS(t.assertion.as,t.entity,t.assertion.props,n);return{...e,entities:[...e.entities,o]}}let r=Jr(t.key,t.entity,n.namespace);if(r==null)return e;if(t.assertion.kind==="deleted")return AS(e,r);let i=vt(t.assertion.props);return{...e,entities:e.entities.map(o=>o.alias===r?$u(o,i,n):o)}}function kS(e,t,n,r){return $u({alias:e,entity:t,literals:{},relations:[]},n,r)}function $u(e,t,n){return Object.entries(t).reduce((r,[i,o])=>{if(Ge(o))return r;if(W(o)){let s=ES(o.ref,i,n.namespace);return{...r,literals:CS(r.literals,i),relations:s==null?r.relations:[...Iu(r.relations,i),s]}}return{...r,literals:{...r.literals,[i]:o},relations:Iu(r.relations,i)}},e)}function ES(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 CS(e,t){return Object.fromEntries(Object.entries(e).filter(([n])=>n!==t))}function Iu(e,t){return e.filter(n=>n.field!==t)}function AS(e,t){let n=e.entities.find(i=>i.alias===t),r=PS(e,t);return n==null?r:{...r,absences:[...r.absences,{entity:n.entity,literals:n.literals,params:{},relations:n.relations}]}}function PS(e,t){return{...e,entities:e.entities.filter(n=>n.alias!==t)}}var MS=16;function OS(e){return xt(e.step.expect).filter(t=>ii(t)).flatMap(t=>IS(t,e))}function IS(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=TS(o,t.pre,t.paramNames);return s==null||s.entities.length>MS?[]:ke(s)===ke(t.pre)?[]:[{consequence:e,localConsequence:js(lt(e),t.namespace).length>0,origin:t.origin,refs:new Set(js([...NS(s),...lt(e)],t.namespace).map(a=>a.aliasPath)),when:s}]}function TS(e,t,n){let r=[...e.scalars.values()].map(i=>$S(i,t,n));return r.some(i=>i==null)?null:{...e,scalars:new Map(r.flatMap(i=>i==null?[]:[[R(i.subject),i]]))}}function $S(e,t,n){if(!Tu(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"||Tu(r,n)?null:{expect:{expect:"not",value:r.expect.value},subject:e.subject}}function Tu(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 NS(e){return[...e.scalars.values()].flatMap(t=>St(t.subject)&&t.expect.expect!=="absent"?G(t.expect.value):[])}import*as zu from"remeda";var Nu=new WeakMap;function zs(e){let t=Nu.get(e);if(t!==void 0)return t;let n=LS(e);return Nu.set(e,n),n}function LS(e){let t=zS(e);return t==null?null:{absenceKeys:new Set(e.absences.map(n=>S(n))),conditionKeys:new Set(e.conditions.map(n=>S(n))),pinned:jS(e),snapshot:t,specific:e}}var Lu=new WeakMap,Du=new WeakMap;function Gs(e,t){if(t==null)return null;let n=Du.get(e)??new Map;Du.set(e,n);let r=ke(t.specific),i=n.get(r);if(i!==void 0)return i;let o=DS(e,t);return n.set(r,o),o}function ai(e,t){return Gs(e,zs(t))}function DS(e,t){let{absenceKeys:n,conditionKeys:r,pinned:i,snapshot:o,specific:s}=t,a=FS(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])=>_S({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 FS(e){let t=Lu.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 Lu.set(e,n),n}function _S({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&&VS(e.expect)?"skip":n.expect.expect!=="is"?BS({entry:e,host:n,identical:o}):e.expect.expect==="absent"?"false":WS({entry:e,generalEntityOf:t,key:r,pinned:i,want:e.expect,wantOfHost:n.expect})}function jS(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 BS({entry:e,host:t,identical:n}){return n||t.expect.expect==="absent"&&e.expect.expect==="not"?"defer":"false"}function VS(e){return e.expect==="absent"?!0:G(e.value).every(t=>!t.includes("."))}function WS({entry:e,generalEntityOf:t,key:n,pinned:r,want:i,wantOfHost:o}){if(Fu(i.value)||Fu(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=>US({generalEntityOf:t,pinned:r,ref:a})));return s.has("false")?"false":s.has("defer")?"defer":[n,{expect:Vu(i),subject:Uu(e.subject)}]}function US({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 Fu(e){return e!==null&&typeof e=="object"&&"template"in e&&e.template.some(t=>typeof t!="string"&&"count"in t)}var _u=new WeakMap;function zS(e){let t=_u.get(e);if(t!==void 0)return t;let n=GS(e);return _u.set(e,n),n}function GS(e){let t=qS(e),n=Pe(rt({absences:e.absences,conditions:e.conditions,entities:e.entities,exclusives:e.exclusives}),t);if(n==null)return null;let r=HS(e,n,t);return r==null?null:{...t,scalars:KS(r,e)}}function qS(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,ju(t,a,l)])),...s.literals,...Object.fromEntries(s.relations.map(a=>[a.field,ju(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 ju(e,t,n){let i=e.get(t)?.literals[n];return i!==void 0?i:`\xA4${t}.${n}`}function KS(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 HS(e,t,n){let r=[...e.scalars.values()].filter(i=>i.expect.expect==="is").map(i=>{try{return st({declared:!0,entry:{expect:Vu(i.expect),subject:Uu(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 Vu(e){return e.expect==="absent"?e:{...e,value:Wu(e.value)}}function Wu(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 Uu(e){return e.kind!=="element"?e:{...e,locator:si(e.locator)}}function si(e){return e.by==="inside"?{by:"inside",scope:si(e.scope),target:si(e.target)}:e.by==="role"?e.name==null?e:{...e,name:Bu(e.name)}:e.by==="surface"?{...e,container:si(e.container)}:{...e,value:Bu(e.value)}}function Bu(e){let t=Wu(e);return typeof t=="string"||typeof t=="object"?YS(t,e):e}function YS(e,t){return typeof e=="string"||e!==null&&typeof e=="object"&&!("count"in e)?e:t}var Gu=new Map;async function li({context:e,facts:t}){let n=zu.groupBy(t.filter(o=>he(o.consequence)!=null),o=>ZS(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})=>ai(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(!(ai(s.when,a.when)!==!1&&await it({context:e,general:s.when,specific:a.when}))||ai(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(Gu))}function qu(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 ZS(e){let t=he(e.consequence);if(t==null)throw new Error("fact consequence has no pattern entry");return R(t.subject)}function ci(e){return Me(J(e).flatMap(t=>XS(e,t.test)),qs)}function qs(e){return S({holds:ke(e.holds),reference:e.reference,when:ke(e.when)})}function ui(e,t){return Pe(e.when,t)==null?!1:Pe(e.holds,t)==null}function XS(e,t){let n=Qr(e,t);return n.requiredState.entities.flatMap(r=>r.relations.flatMap(i=>JS(e,r,i,n.namespace)?tb(r,i,n.namespace):[]))}function JS(e,t,n,r){let i=r.get(n.targetAlias);return i!=null&&!QS(e,t.entity,n.field)&&eb(e,i,n.targetField)}function QS(e,t,n){return e.entities.find(r=>r.name===t)?.props[n]?.optional===!0}function eb(e,t,n){return e.entities.find(r=>r.name===t)?.identity.includes(n)===!0}function tb(e,t,n){let r=n.get(t.targetAlias);if(r==null)return[];let i=Ku(e.alias,e.entity),o=Ku(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 Ku(e,t){return{alias:e,entity:t,literals:{},relations:[]}}function Hu(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 di=Hu(async e=>{let t=Qt(e),n=await ri(e);return{dataRules:ci(e),facts:n,overrides:await li({context:t,facts:n})}});import*as Ks from"remeda";function kt(e){return[...new Set(e.producers.map(t=>t.test))]}function Jn(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 Yu(e,t){let{context:n,pool:r,timelines:i}=rb(e,t),o=nb(n),s=r.map(l=>Ru(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 ib({entry:l,pool:u,resolve:o})}));return{pool:r,reports:a}}function Zu(e,t){return{...Qu(e.consequence),declared:e.origin?.kind==="test",key:ut(e),label:_r(e.consequence),labelTokens:kc(e.consequence),origins:t}}function nb(e){return(t,n)=>it({context:e,general:t,specific:n})}function rb(e,t){let n=J(e),r=new Map(n.map(a=>[a.ref,{locked:a,timeline:Us(e,a)}])),i=lb(r),o=ab(r),s=cb({facts:t,originSites:i,witnessSites:o});return{context:Qt(e),pool:s,timelines:r}}async function ib(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 sb({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 ob(e,t){return e.map(n=>({candidate:n,holds:Gs(n.fact.when,t)}))}async function sb({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=ob(c,zs(s)),d=await Promise.all(u.filter(f=>f.holds==null).map(async f=>({candidate:f.candidate,holds:await t(f.candidate.fact.when,s)}))),p=new Set(d.filter(f=>f.holds).map(f=>f.candidate)),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 Xu(e,t){return`${e}#${S(t)}`}function ab(e){let t=[...e.values()].flatMap(n=>n.timeline.steps.flatMap((r,i)=>r.facts.map(o=>[Xu(n.locked.ref,o.consequence),Ju(n.locked,i)])));return new Map(Object.entries(Ks.groupBy(t,([n])=>n)).map(([n,r])=>{let[,i]=r[0];return[n,i]}))}function Ju(e,t){return{stepIndex:t,testRef:e.ref,testSlug:e.test.slug,workflowIntent:e.workflow.intent,workflowSlug:e.test.workflow}}function lb(e){let t=[...e.values()].flatMap(n=>n.timeline.steps.flatMap((r,i)=>r.facts.map(o=>[ut(o),Ju(n.locked,i)])));return new Map(Object.entries(Ks.groupBy(t,([n])=>n)).map(([n,r])=>[n,r.map(([,i])=>i)]))}function cb({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)??[]:ub(r,n);return{borrowed:Zu(r,s),consequenceKey:S(r.consequence),fact:r,originWorkflows:new Set(s.map(a=>a.workflowSlug))}}).filter(r=>r.borrowed.origins.length>0)}function Qu(e){if(e.kind==="not"){let t=Qu(e.predicate);return{...t,negated:!t.negated}}return"locator"in e?{checkKind:e.kind,negated:!1,subject:Sc(de(e.locator,Re(new Map)))}:{checkKind:void 0,negated:!1,subject:void 0}}function ub(e,t){return e.origin?.kind!=="generalized"?[]:kt(e.origin).map(n=>{let r=t.get(Xu(n,e.consequence));if(r==null)throw new Error(`missing witness site for ${n} in generalized fact origin`);return r})}function ed(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=pi(n,S),s=pi(r,S),a=pi(i,S),l=pi(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=>fi(a,S(u))),actor:c.actor,conditions:[...c.conditions],entities:c.entities.map(u=>fi(s,S(u))),exclusives:[...c.exclusives],scalars:[...c.scalars.values()].map(u=>fi(o,S(u)))})),scalarTable:n.map(c=>({expect:c.expect,subject:c.subject})),indexOf:c=>fi(l,ke(c))}}function td(e){return e.patternTable.map(t=>({absences:t.absences.map(n=>Et(e.absenceTable,n)),actor:t.actor,conditions:t.conditions,entities:t.entities.map(n=>Et(e.constraintTable,n)),exclusives:t.exclusives,scalars:new Map(t.scalars.map(n=>{let r=Et(e.scalarTable,n);return[R(r.subject),r]}))}))}function Et(e,t){let n=e[t];if(n==null)throw new Error("compiled checks table index out of range \u2014 recompile");return n}function pi(e,t){return new Map(e.map((n,r)=>[t(n),r]))}function fi(e,t){let n=e.get(t);if(n==null)throw new Error("compiled checks pattern missing from table");return n}async function rd(e){let t=await di(e),{pool:n,reports:r}=await Yu(e,t.facts),i=ed([...t.facts.flatMap(a=>mb(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:id(o,a.fact),origins:a.borrowed.origins.map(l=>({...l}))})),factReports:r.map(a=>bb(a,s)),facts:t.facts.map(a=>yb(a,i)),overrides:Sb(t.overrides),patternTable:i.patternTable,scalarTable:i.scalarTable}}var nd=new WeakMap;function an(e){let t=nd.get(e);if(t!=null)return t;let n=db(e),r=td(n),i={dataRules:n.dataRules.map(o=>({holds:Et(r,o.holds),reference:o.reference,when:Et(r,o.when)})),facts:n.facts.map(o=>pb(o,r)),overrides:hb(n.overrides)};return nd.set(e,i),i}function db(e){return e.checks}function id(e,t){let n=e.get(t);if(n==null)throw new Error("compiled checks item missing from index");return n}function pb(e,t){return{consequence:e.consequence,localConsequence:e.localConsequence,origin:fb(e.origin,t),refs:new Set(e.refs),when:Et(t,e.when)}}function fb(e,t){return e==null||e.kind!=="generalized"?e:{kind:"generalized",producers:e.producers.map(n=>({test:n.test,when:Et(t,n.when)}))}}function hb(e){return new Map(Object.entries(e).map(([t,n])=>[t,new Set(n)]))}function mb(e){let t=e.origin?.kind==="generalized"?e.origin.producers.map(n=>n.when):[];return[e.when,...t]}function yb(e,t){return{consequence:e.consequence,localConsequence:e.localConsequence,origin:gb(e.origin,t),refs:[...e.refs],when:t.indexOf(e.when)}}function gb(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 Sb(e){return Object.fromEntries([...e].map(([t,n])=>[t,[...n].toSorted((r,i)=>r.localeCompare(i))]).toSorted(([t],[n])=>t.localeCompare(n)))}function bb(e,t){return{steps:e.steps.map(n=>({borrowed:n.borrowed.map(r=>id(t,r)),stepIndex:n.stepIndex})),testRef:e.testRef,testSlug:e.testSlug,workflowSlug:e.workflowSlug}}function sd(e){let t=new Map;return e.forEach(n=>{wb(n).forEach(r=>{hi(r,t)})}),t}function Hs(e,t){let n=Rb(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 wb(e){let t=[...e.when.scalars.values()].flatMap(r=>r.subject.kind==="element"?[r.subject.locator]:[]),n=ad(e.consequence);return n==null?t:[...t,n]}function ad(e){return e.kind==="not"?ad(e.predicate):"locator"in e?e.locator:void 0}function hi(e,t){if(e.by==="inside"){let n=ld(e.scope);t.set(n,[...t.get(n)??[],e]),hi(e.scope,t),hi(e.target,t);return}e.by==="surface"&&hi(e.container,t)}function ld(e){return Nr(e,"visible")}function Rb(e,t){let n=vb(e);if(n!=null)return(t.get(ld(n))??[]).map(i=>od(i,!1));let r=xb(e);return r==null?[]:[od(r,!0)]}function vb(e){return e.kind!=="not"||e.predicate.kind!=="visible"?null:e.predicate.locator}function od(e,t){return{expect:{expect:"is",value:t},subject:{kind:"element",locator:e,state:"visible"}}}function xb(e){return e.kind!=="visible"||e.locator.by!=="inside"?null:e.locator.scope}async function dd({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=>pd(a.consequence,c.consequence)).map(c=>[a,c]))),i=sd(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 Mc({aligned:!0,context:e,patterns:[Hs(s,i),Hs(a,i)]})?Cb(s,a):null}));return Ab(o.filter(s=>s!=null))}function pd(e,t){let n=he(e),r=he(t);return n==null||r==null||R(n.subject)!==R(r.subject)?!1:kb(n,r)}function kb(e,t){return Eb(e)?ud(e,t):e.expect.expect==="is"&&t.expect.expect==="is"?S(e.expect.value)!==S(t.expect.value):ud(e,t)}function Eb(e){return e.subject.kind==="element"&&e.subject.state==="text"}function Cb(e,t){let n=Jn(e),r=Jn(t);return{a:e.consequence,aProducers:n,b:t.consequence,bProducers:r,tests:[...new Set([...cd(e),...cd(t)])],when:e.when}}function cd(e){return e.origin==null?[]:e.origin.kind==="declared"?[]:e.origin.kind==="test"?[e.origin.test]:kt(e.origin)}function Ab(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 ud(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 fd(e,t){return e.flatMap(n=>{let r=Pb(n),i=new Set(n.requiredState.absences.map(o=>o.entity));return t.flatMap(o=>Mb(n,o,r,i))})}function Pb(e){return new Set(e.steps.flatMap(t=>t.expect.flatMap(n=>n.kind==="state"&&n.assertion.kind==="deleted"?[n.entity]:[])))}function Mb(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:Ye(e)}]}var I=mc(yd(),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))},$b={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"))} ${$b[e](I.default.bold(e))}`}var Nb=I.default.red("\u2717"),r$=I.default.green("\u2713"),Lb=I.default.dim("\u203A"),Db=8;function gd(e,t,n){let r=n==null?"":` ${le.dim(n)}`;return` ${le.dim(e.padStart(Db))} ${t}${r}`}function Sd(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)":Fb(t.value)}function Fb(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 Si(e){let t=[...e.entities.map(n=>gi(n)),...e.absences.map(n=>`no ${gi(n)}`),...[...e.scalars.values()].filter(n=>n.subject.kind!=="path").filter(n=>!wd(n)).map(n=>bi(n))];return t.length===0?"always":t.join(" \u2227 ")}function bi(e){let t=_b(e.subject);return e.expect.expect==="absent"?`${t} absent`:e.subject.kind==="element"&&jb(e.expect.value)?e.expect.value?t:`not ${t}`:`${t} ${e.expect.expect==="not"?"\u2260":"="} ${Xe(e.expect.value)}`}function pe(e){return e.by==="role"?e.name==null?e.role:`${e.role} ${Xe(e.name)}`:e.by==="inside"?`${pe(e.scope)} \u25B8 ${pe(e.target)}`:e.by==="surface"?pe(e.container):Xe(e.value)}function Xe(e){return e===null?"\u2205":typeof e=="string"?`"${e}"`:typeof e!="object"?String(e):"ref"in e?`{${e.ref}}`:Zs(e)}function Zs(e){return e.template.map(t=>typeof t=="string"?t:":id").join("")}function bd(e,t){let n=new Set(t.entities.map(o=>gi(o))),r=new Set(t.scalars.keys()),i=[...e.entities.map(o=>gi(o)).filter(o=>!n.has(o)),...[...e.scalars].filter(([o])=>!r.has(o)).map(([,o])=>o).filter(o=>o.subject.kind!=="path"&&!wd(o)).map(o=>bi(o))];return i.length===0?"nothing beyond the shared state":i.join(" \u2227 ")}function wd(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 _b(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 jb(e){return typeof e=="boolean"}function gi(e){let t=Object.entries(e.literals).map(([n,r])=>`${n}=${Xe(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 jt(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 Ri(e){return e.url!=null?`${e.kind} ${e.url}`:e.locator!=null?`${e.kind} ${dt(e.locator)}`:e.kind}function Bt(e){if(e.kind==="not")return`not ${Bt(e.inner)}`;if(e.kind==="browser"){let t=tn(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 Vt(e){let{field:t,source:n,target:r,targetField:i}=e.reference;return`${n}.${t} \u2192 ${r}.${i}`}function Xs(e){return`${e.intent} \u203A ${Ri(e.action)}`}function Js(e){return e.kind==="data-rule"?`data rule ${Vt(e.dataRule)}`:`${e.kind} ${Bt(e.check)}`}function Q(e){return e==null?"\u2205":JSON.stringify(e)}function Qs(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)}`:`${jt(e.subject)} expected=${ea(e.want)} actual=${Q(e.sut)}`}function vi(e){return{label:Js(e.source),step:Xs(e.step)}}function Rd(e){return e.expect==="absent"?"absent":e.expect==="not"?`not ${Q(e.value)}`:Q(e.value)}function ea(e){return e.expect==="absent"?"absent":e.expect==="not"?`anything but ${Q(e.value)}`:Q(e.value)}function Bb(e){return e==null?"{ \u2026 }":`{ ${Object.entries(e).map(([n,r])=>`${n}: ${JSON.stringify(r)}`).join(", ")} }`}function vd({evidencePath:e,finding:t}){let n=Vb(t);return e==null?n:`${n} Evidence: ${le.path(e)}`}function xi(e){return zb(Gb(e))}function Vb(e){return e.kind==="consistency"?ew(e):e.kind==="pending-check"?ow(e.source,e.step,e.budget):e.kind==="impossible-action"?`${oe("impossible action")} "${e.step.intent}" ran ${Ri(e.step.action)} from a state the test calls impossible.`:e.kind==="unrunnable"?`${oe("model drift")} "${e.intent}" couldn't run \u2014 ${xd(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 ${_n(e.error)}. Environment, not app or test.`}var Wb=new RegExp(`${String.fromCodePoint(27)}\\[[0-9;]*m`,"g");function ta(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":Xe(e.want),n=e.got===void 0?"absent":Xe(e.got);return`${Ub(e.subject)} needed ${t} but was ${n}`}function Ub(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 xd(e){return e.unmet==null?Kb(e.reason):ta(e.unmet)}function zb(e){return e.replaceAll(Wb,"").replaceAll(/\s+/g," ").trim()}function Gb(e){if(e.kind==="consistency"){let t=e.step==null?"":` after "${e.step.intent}"`;return`${Qs(e.mismatch)}${t}`}return e.kind==="pending-check"?`${aw(e.source)} failed at "${e.step.intent}": ${lw(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 ${xd(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}": ${_n(e.error)}`}var qb={"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 Kb(e){return qb[e]}function kd({debugDir:e,runId:t}){let n=`${e}/${t}`;return gd("behavior",le.path(`${n}/behavior.jsonl`),void 0)}function Qn(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} ${Hb(e.url)}`:e.kind}function Hb(e){return typeof e=="string"?e:"ref"in e?`{${e.ref}}`:Zs(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(" | "):Yb(e)}function Yb(e){return"locator"in e?Zb(e):e.kind==="browser"?`${e.name}=${Xe(e.value)}`:e.kind==="singleton"?`${e.singleton}=${Xe(e.assertion.value)}`:e.kind==="count"?_r(e):e.kind==="actor"?e.target.kind==="anonymous"?"actor is signed out":`actor is ${e.target.ref.ref}`:""}function Zb(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}=${Xe(n)}`}return`${e.kind} ${t}`}function wi(e){return e==null?"At the end of the run":`After ${Jb(e.action)} in ${e.intent}`}var Xb={click:"clicking",fill:"filling",goto:"opening",hover:"hovering over",press:"pressing",select:"selecting",upload:"uploading to"};function Jb(e){return e.url!=null?`opening ${e.url}`:e.locator!=null?`${Xb[e.kind]??e.kind} ${_t(e.locator)}`:e.kind}function _t(e){return e.by==="testId"?`the element with testId "${e.value}"`:e.by==="inside"?`${_t(e.target)} inside ${_t(e.scope)}`:e.by==="surface"?_t(e.container):e.name==null?`the ${e.role}`:`the "${e.name}" ${e.role}`}function Qb(e){return e.kind==="not"&&e.inner.kind==="visible"?`${_t(e.inner.locator)} never disappeared`:e.kind==="visible"?`${_t(e.locator)} never appeared`:e.kind==="value"||e.kind==="text"?`${_t(e.locator)} never showed "${e.value}"`:`the check ${Bt(e)} never held`}function ew(e){let t=e.pending?tw(e):rw(e.mismatch,e.step);return`${oe("consistency")} ${t}`}function tw(e){let t=`${Cd(e.budget)} wait window`,{mismatch:n}=e,r=wi(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}.`:nw({at:r,mismatch:n,window:t})}function nw({at:e,mismatch:t,window:n}){let r=jt(t.subject),i=`showed ${le.actual(Q(t.sut))}, not ${le.expected(ea(t.want))}`;return`${e}, ${r} ${i} through the ${n}.${Ed(t.subject)}`}function Ed(e){return e.kind!=="element"?"":" Likely a stale fact \u2014 if this value changes across revisits, use ephemeral() or Entity.updated({...})."}function Cd(e){return`${String(ct[e]/1e3)}s`}function rw(e,t){let n=wi(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}, ${jt(e.subject)} showed ${le.actual(Q(e.sut))}, expected ${le.expected(ea(e.want))}.${iw(e)}`:e.kind==="unexpected-row"?`${n}, unexpected ${e.entity} row "${e.key}" ${Bb(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 iw(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.":Ed(e.subject)}function ow(e,t,n){let r=`${Cd(n)} wait window`;return e.kind==="data-rule"?`${oe("data rule")} ${wi(t)}, ${Vt(e.dataRule)} broke \u2014 a referenced row went missing.`:e.kind==="fact"?`${oe("fact")} A fact from ${sw(e.origin)} predicts ${Bt(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")} ${wi(t)}, ${Qb(e.check)} within the ${r}.`}function sw(e){return e==null?"another workflow":e.kind==="test"?`an assertion in test "${e.test}"`:e.kind==="declared"?`the declared fact "${e.name}"`:`tests ${kt(e).map(n=>JSON.stringify(n)).join(", ")}`}function aw(e){return e.kind==="data-rule"?"data rule":e.kind==="fact"?"fact":"assertion"}function lw(e){return e.kind==="data-rule"?Vt(e.dataRule):Bt(e.check)}function ln(e){let t=ae(e.scalars,{kind:"path"});return typeof t=="string"?t:null}function Ad(e){return e.kind==="data-rule"?S({kind:e.kind,rule:qs(e.dataRule)}):S(e)}function cn(e){return e.filter(t=>t.kind!=="unrunnable")}function ki({actual:e,canon:t,pre:n,predicted:r}){return[...[...new Set([...r.entities.keys(),...e.entities.keys()])].flatMap(s=>pw({actual:e.entities.get(s),canon:t,entity:s,pre:n.entities.get(s),predicted:r.entities.get(s)})),...cw(n.scalars,r.scalars,e.scalars)]}function cw(e,t,n){let r=Je(n,R({kind:"path"}))!==void 0;return[...[...t.entries()].flatMap(([o,s])=>{if(s.subject.kind==="actor")return[];let a=Je(n,o),l=r&&St(s.subject)&&s.expect.expect!=="absent",c=a===void 0&&l?null:a;if(!s.declared||c===void 0||$t({got:c,subject:s.subject,want:s.expect}))return[];let u=Je(e,o);return[{mismatch:{kind:"scalar-mismatch",subject:s.subject,sut:c,want:s.expect},pending:u!==void 0&&er(u,c)}]}),...uw(e,t,n),...dw(e,t,n)]}function Je(e,t){let n=e.get(t);return n==null||n.expect.expect!=="is"?void 0:n.expect.value}function uw(e,t,n){let r=R({kind:"path"});if(Je(n,r)===void 0)return[];let i=!er(Je(e,r),Je(n,r));return[...new Set([...e.keys(),...n.keys()])].flatMap(s=>{let a=(e.get(s)??n.get(s))?.subject;if(a==null||!St(a)||t.has(s))return[];let c=i&&a.kind!=="path"?null:Je(e,s)??null,u=Je(n,s)??null;return er(c,u)?[]:[{mismatch:{kind:"scalar-mismatch",subject:a,sut:u,want:{expect:"is",value:c}},pending:!1}]})}function dw(e,t,n){let r=R({kind:"actor"}),i=t.get(r);if(i==null)return[];let o=Je(n,r);if($t({got:o,subject:{kind:"actor"},want:i.expect}))return[];let s=Je(e,r);return[{mismatch:{kind:"scalar-mismatch",subject:{kind:"actor"},sut:o??null,want:i.expect},pending:s!==void 0&&er(s,o)}]}function pw({actual:e,canon:t,entity:n,pre:r,predicted:i}){return[...new Set([...i?.keys()??[],...e?.keys()??[]])].flatMap(s=>fw({actual:e?.get(s),canon:t,entity:n,key:s,predicted:i?.get(s),preHadKey:r?.has(s)??!1,preRow:r?.get(s)}))}function fw({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)=>er(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 er(e,t){return Pd(e)===Pd(t)}function Pd(e){return e==null?"\u2205":JSON.stringify(e)}function Ei(e){let t=hw(e.entities),n=mw(e.singletons);return r=>yw(r,t,n)}function hw(e){return new Map(e.flatMap(t=>Object.entries(t.props).map(([n,r])=>[Md(t.name,n),r.consistency])))}function Md(e,t){return`${e}.${t}`}function mw(e){return new Map(e.map(t=>[t.name,t.consistency]))}function yw(e,t,n){return e.kind==="scalar-mismatch"?gw(e.subject,n):e.kind==="unexpected-row"||e.kind==="missing-row"?"strict":t.get(Md(e.entity,e.field))??"strict"}function gw(e,t){return e.kind==="variable"?t.get(e.name)??"strict":"eventual"}function Ci(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()}}var De=class extends Error{name="AbortError";constructor(){super("aborted")}};function tr(e){return e instanceof Error&&e.name==="AbortError"}function Oe(e){if(e.aborted)throw new De}function Ct(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 Sw={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 Od(e){let t=Sw[e.kind]??e.kind;return e.kind==="press"&&e.key!=null?`${t}: ${e.key}`:t}function Ai(e){return e.kind==="data-rule"?"data rule":Id(e.check)}function Id(e){return e.kind==="not"?`not ${Id(e.inner)}`:e.kind==="browser"?tn(e.key):`${na(e.locator)} ${e.kind}`}function na(e){return e.by==="testId"?"element":e.by==="inside"?na(e.target):e.by==="surface"?na(e.container):e.role}function Td(e){return e.kind==="goto"?e.url:e.kind==="press"?e.key:e.value==null?void 0:String(e.value)}function Pi(e){return e.kind==="data-rule"?void 0:Nd(e.check)}function $d(e){return e.kind==="data-rule"?!1:Mi(e.check)}function Mi(e){return e.kind==="not"?Mi(e.inner):e.kind==="browser"&&zc(e.key)}function Nd(e){if(e.kind==="not")return Nd(e.inner);if(e.kind==="value"||e.kind==="text"||e.kind==="browser")return e.value??void 0}function Ld({atMs:e,findings:t,step:n}){return n.urlChecks.map(r=>({atMs:e,ephemeral:!1,kind:"assertion",label:Ai({check:r,kind:"step"}),outcome:t.length>0?"failed":"passed",rrwebIds:[],url:!0,value:Pi({check:r,kind:"step"})}))}function Oi({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:Td(e)}}var bw=()=>[],ww=()=>Le;async function Ti({canon:e,classify:t,dataRuleChecks:n,derive:r,initialSnapshot:i,observe:o,onAssertion:s,onStep:a,steps:l,stopAfterStep:c},u){return Bd({acc:[],canon:e,classify:t,dataRuleChecks:n??bw,derive:r??ww,index:0,observe:o,onAssertion:s,onStep:a,signal:u,snapshot:i,steps:l,stopAfterStep:c})}async function Bd({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=Od(m.step.action);if(!m.requiredState(u)){let w={kind:"impossible-action",step:m.step};return ra(l,{annotations:[Oi({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:ln(u)}),{finalModel:u,findings:[...e,w]}}return m.perform().match(()=>Rw({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=Ii(w,m);return ra(l,{annotations:[Oi({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:ln(u)}),Promise.resolve({finalModel:u,findings:[...e,v]})})}async function Rw({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 Aw({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 vw({onAssertion:l,pendingChecks:te,signal:d,step:y}),z=[...V.findings,...x.findings];ra(c,{annotations:[Oi({action:y.step.action,actionLabel:t,outcome:z.length>0?"failed":"passed",rrwebIds:u,startMs:m}),...Ld({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:ln(x.snapshot)});let ne=[...e,...z];return z.length>0?{finalModel:T,findings:ne}:h!=null&&s+1>=h?{finalModel:T,findings:ne}:Bd({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 vw({onAssertion:e,pendingChecks:t,signal:n,step:r}){let i=[...new Map(t.map(s=>[Ad(s.source),s])).values()],o=await Promise.all(i.map(async s=>{let a=await xw(s,n),l=Date.now(),c=await s.targetIds();return{atMs:l,outcome:a,pendingCheck:s,rrwebIds:c}}));return o.forEach(s=>{kw(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:Ai(s.pendingCheck.source),outcome:Vd(s.outcome),rrwebIds:s.rrwebIds,url:$d(s.pendingCheck.source),value:Pi(s.pendingCheck.source)})),findings:o.flatMap(s=>Ew(s.pendingCheck,s.outcome,r))}}function xw(e,t){if(e.check.kind==="decided"){let n=e.check.passed?"passed":"failed";return Promise.resolve({kind:n})}return e.check.wait(_s[e.budget].timeoutMs).match(n=>n?{kind:"passed"}:{kind:"failed"},n=>{if(n.kind==="aborted")throw new De;return{error:n,kind:"error"}})}function kw(e,t,n,r){e?.({outcome:Vd(n),source:t.source,step:r.step,waitBudget:t.budget,waitMs:ct[t.budget]})}function Vd(e){return e.kind==="passed"?"passed":e.kind==="error"?"error":"failed"}function Ew(e,t,n){return t.kind==="error"?[Ii(t.error,n)]:t.kind==="failed"?[{budget:e.budget,kind:"pending-check",source:e.source,step:n.step}]:[]}function Ii(e,t){return{error:e,kind:"driver-error",step:t.step}}function ra(e,t){e?.(t)}function Dd(e){return e().match(t=>({observed:t,ok:!0}),t=>({error:t,ok:!1}))}function Cw(e,t,n){return n.reconcile==null?e:n.reconcile(e,t)}function Fd({canon:e,pre:t,predicted:n,step:r},i){let o=r.verifyChanges==null?[]:r.verifyChanges(n,i),s=Cw(n,i,r),a=o.map(l=>({mismatch:l,pending:!0}));return{adopted:s,probed:[...a,...ki({actual:i.snapshot,canon:e,pre:t,predicted:s})]}}function Wd(e,t){return{budget:t.sync,kind:"consistency",mismatch:e.mismatch,pending:e.pending,step:t.step}}function _d(e,t,n){let r=e.probed.filter(i=>!i.pending&&n(i.mismatch)==="strict");return r.length>0?{findings:r.map(i=>Wd(i,t)),snapshot:e.adopted}:e.probed.length===0?{findings:[],snapshot:e.adopted}:null}function jd(e,t,n){return{findings:[...e.probed.map(r=>Wd(r,t)),...n],snapshot:e.adopted}}async function Aw({canon:e,claimed:t,classify:n,observe:r,pre:i,predicted:o,signal:s,step:a}){let l=_s[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 Dd(p);if(!m.ok)return{findings:[Ii(m.error,a)],snapshot:o};let y=Fd({canon:e,pre:i,predicted:o,step:a},m.observed),f=0;for(;Date.now()<c;){Oe(s);let h=_d(y,a,n);if(h!=null)return h;await Ct(bu(l,f),s),f+=1;let w=await Dd(p);if(!w.ok)return jd(y,a,[Ii(w.error,a)]);y=Fd({canon:e,pre:i,predicted:o,step:a},w.observed)}return _d(y,a,n)??jd(y,a,[])}function ia(e){let t=e.predicates.filter(o=>Yd(o)),n=t.filter(o=>o.assertion.kind==="created"),r=qd(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)=>$w(u,s,d,e),{env:e.env,snapshot:o}),l=r.reduce((u,d)=>Tw(u,s,d,e.env),a.snapshot),c=i.reduce((u,d)=>Pw(u,s,d),a.env);return Fw(l,e.deferred,c)}}function Gd(e,t,n){return new Map([...e,...Object.entries(n).map(([r,i])=>[Ee(M,`${t}.${r}`),i])])}function Pw(e,t,n){let r=at(t.snapshot,n.entity,n.key,e).at(0);return r==null?e:Gd(e,n.assertion.as,r)}function oa(e){let t=qd(e.predicates.filter(n=>Yd(n)));if(t.length!==0)return(n,r)=>t.flatMap(i=>Mw(i,n,r,e.env))}function qd(e){return e.filter(t=>t.assertion.kind==="updated"&&Kd(t.assertion.props).length>0)}function Kd(e){return Hd(e).map(([t])=>t)}function Hd(e){return Object.entries(e).flatMap(([t,n])=>Rt(n)?[[t,n.direction]]:[])}function Yd(e){return e.assertion.kind==="created"||e.assertion.kind==="updated"}function Mw(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=Vn(Ow(e.key,r));return Hd(e.assertion.props).flatMap(([a,l])=>Iw(i[a],o[a],l)?[]:[{direction:l,entity:e.entity,field:a,from:i[a],key:s,kind:"expected-change",value:o[a]}])}function Ow(e,t){let n=Object.fromEntries(Object.entries(e).filter(r=>!ue(r[1])&&!ye(r[1])));return en(n,M,Re(t))}function Iw(e,t,n){return n==null?Ud(e)!==Ud(t):n==="increased"?zd(e,t):zd(t,e)}function Ud(e){return e==null?"\u2205":JSON.stringify(e)}function zd(e,t){return(typeof e=="number"&&typeof t=="number"||typeof e=="string"&&typeof t=="string")&&e<t}function Tw(e,t,n,r){let i=Kd(n.assertion.props),o=at(t.snapshot,n.entity,n.key,r).at(0);return o==null?e:Qc(e,n.entity,n.key,r,s=>({...s,...Object.fromEntries(i.flatMap(a=>{let l=o[a];return l===void 0?[]:[[a,l]]}))}))}function $w(e,t,n,r){if(n.assertion.kind!=="created")return e;let i=en(n.assertion.props,M,Re(r.env)),o=e.snapshot.entities.get(n.entity);if(o==null)return e;let s=Nw({identityFields:r.identities.get(n.entity)??[],props:i,set:o});if(s==null)return e;let a=Lw(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:Gd(e.env,n.assertion.as,c),snapshot:{...e.snapshot,entities:new Map(e.snapshot.entities).set(n.entity,u)}}}function Nw({identityFields:e,props:t,set:n}){let r=Vn(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=>Jc(s[a]))&&i.every(([a,l])=>$i(s[a])===$i(l)));return o==null?null:o[0]}function Lw(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])=>$i(s[a])===$i(l)).length}));return Dw(i,r.length)}function $i(e){return e==null?"\u2205":JSON.stringify(e)}function Dw(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 Fw(e,t,n){let r=t.reduce((i,o)=>{let s=_w(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 _w(e,t){try{return qe(e,M,Re(t))}catch{return}}function sa(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=sa(e.predicate,t);return n==null?null:{inner:n,kind:"not"}}return e.kind==="value"||e.kind==="text"?jw(e,t):e.kind!=="browser"?null:{key:Ur(e.name,e.part),kind:"browser",value:e.value===null?null:qe(e.value,M,t)}}function un(e,t){let{env:n,identities:r}=t,i=e.expect.filter(f=>f.kind==="state"),o=Yw(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}=Uw(e,a,o),p=Xr(e),m=Zw(e.action,l),y=Bw(e);return{action:m,assertedScalars:[...d.keys()],label:e.action.kind,pendingChecks:e.expect.flatMap(f=>Qw(f,a,p)),reconcile:ia({deferred:u,env:n,identities:r,predicates:i}),urlChecks:e.expect.flatMap(f=>Jw(f,a)),verifyChanges:oa({deferred:u,env:n,identities:r,predicates:i}),effect:f=>Xc(on(f,i,t),{clears:c,forget:y,sets:d})}}function jw(e,t){let n=tt(e.value);return{kind:e.kind,locator:de(e.locator,t),match:n?e.value.kind:"exact",value:qe(n?e.value.value:e.value,M,t)}}function Bw(e){return e.action.kind==="goto"||e.action.kind==="actor"||Vw(e)?"hard":Ft(e)?"soft-path":"none"}function Vw(e){return e.expect.some(t=>t.kind==="actor")}function Ww(e){return e.action.kind!=="actor"?null:{expect:{expect:"is",value:{ref:`${e.action.ref.ref}.id`}},subject:{kind:"actor"}}}function Uw(e,t,n){let r=e.action.kind==="goto"?Gn(e.action.url):[],i=Ww(e),o=xt(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[...qn(e).map(l=>({declared:!1,entry:l})),...s].reduce((l,{declared:c,entry:u})=>zw({acc:l,captures:n,declared:c,entry:u,scope:t}),{clears:[],deferred:[],sets:Le})}function zw({acc:e,captures:t,declared:n,entry:r,scope:i}){if(Gw(r,t))return r.expect.expect==="is"&&Zd(r.expect.value)?{...e,deferred:[...e.deferred,{key:Hw(r.subject),value:r.expect.value}]}:e;let o=st({declared:n,entry:r,scope:i});return o.expect.expect==="absent"&&!St(o.subject)?{...e,clears:[...e.clears,R(o.subject)]}:{...e,sets:ot(e.sets,o)}}function Gw(e,t){return e.subject.kind==="element"||e.subject.kind==="variable"?!1:e.expect.expect==="is"&&Zd(e.expect.value)&&qw(e.expect.value,t)}function Zd(e){return typeof e=="string"||typeof e=="object"}function qw(e,t){return Kw(e).some(n=>t.has(n.split(".")[0]??n))}function Kw(e){return typeof e=="string"?[]:W(e)?[e.ref]:e.template.filter(t=>typeof t!="string").map(t=>t.ref)}function Hw(e){if(e.kind==="element"||e.kind==="variable"||e.kind==="actor")throw new Error("expected a browser subject");return e}function Yw(e){return new Set(e.flatMap(t=>t.assertion.kind==="created"||t.assertion.kind==="updated"?[t.assertion.as]:[]))}function Zw(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:Xw(e,t),target:e.kind==="drag"?de(e.target,t):void 0,url:e.kind==="goto"?qe(e.url,M,t):void 0,value:"value"in e?Bc(e.value,t):void 0}}function Xw(e,t){if(e.kind==="drag")return de(e.source,t);if(!(!("locator"in e)||e.locator==null))return de(e.locator,t)}function Jw(e,t){if(e.kind!=="browser"&&e.kind!=="not")return[];try{let n=sa(e,t);return n!=null&&Mi(n)?[n]:[]}catch{return[]}}function Qw(e,t,n){if(e.kind==="browser"||e.kind==="singleton")return[];let r=sa(e,t),i=n?"slow":"fast",o="wait"in e?e.wait??i:i;return r==null?[]:[{budget:o,check:r,ephemeral:Xt(e)}]}import{err as eR,errAsync as tR,ok as Xd,okAsync as Jd,Result as nR}from"neverthrow";function dn(e,t,n){let r=pR(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]))};fR(t.params,M,i);let o=t.world.map(s=>hR(s,M,i));return n.materialize(o).andThen(s=>SR(s,i.env,r).asyncAndThen(a=>rR({base:a,rows:s,signIn:n.signIn,test:t}).map(l=>iR({base:l,generatedParams:i.generatedParams,lockfile:e,test:t}))))}function Ni(e,t){let n=new Map(t.map(r=>[r.name,r]));return r=>Jd(cR(r,e,n).rows)}function Li(e){return t=>{let n=t.map(r=>({as:r.as,entity:r.entity,fields:r.fields}));return e(n).andThen(r=>lR(t,r))}}function la(e,t){let n=nr(t);return Object.fromEntries(Object.entries(e).filter(([r,i])=>n.includes(r)&&i!=null))}function nr(e){return Object.keys(e.props)}function rR({base:e,rows:t,signIn:n,test:r}){if(r.actor.kind!=="user"||n==null)return Jd(e);let i=r.actor.alias,o=t.find(s=>s.as===i);return o==null?tR(hs(i)):n({entity:o.entity,row:o.row}).map(s=>({...e,auth:s}))}function iR({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])=>oR(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=sR(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,...aR(r)]))}}}function oR(e,t){return W(e)?t.has(Ee(M,e.ref)):Ge(e)?e.template.some(n=>typeof n!="string"&&"ref"in n&&t.has(Ee(M,n.ref))):!1}function sR(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 aR(e){return[[R({kind:"viewport"}),{declared:!1,expect:{expect:"is",value:e.viewport},subject:{kind:"viewport"}}]]}function lR(e,t){let n=new Map(t.map(r=>[r.as,r]));return nR.combine(e.map(r=>{let i=n.get(r.as);return i==null?eR(hs(r.as)):Xd({as:r.as,entity:r.entity,generatedFields:r.generatedFields,row:i.row})}))}function cR(e,t,n){return e.reduce((r,i)=>{let o=uR(i.fields,r.env),s=bR({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 uR(e,t){return Object.fromEntries(Object.entries(e).map(([n,r])=>{if(W(r))return[n,dR(t,r.ref)];if(Ge(r))throw new Error(`template value not allowed in entity field "${n}"`);return[n,r]}))}function dR(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 pR(e){return{models:new Map(e.entities.map(t=>[t.name,t])),valueSpaces:new Map(e.valueSpaces.map(t=>[t.name,t]))}}function fR(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:gc(s),valueSpace:i.valueSpace});n.env.set(o,l)})}function hR(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=mR(e.set,t,n.env),s=gR(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 mR(e,t,n){return Object.fromEntries(Object.entries(e).map(([r,i])=>[r,yR(i,t,n)]))}function yR(e,t,n){if(!W(e))return e;let r=Ee(t,e.ref);return n.get(r)??{ref:r}}function gR(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,Qd({field:i,generate:r.generate,model:e,seedPrefix:n,spec:o,valueSpaces:r.indexed.valueSpaces})]))}function SR(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(aa(a.row,l),la(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:aa(a.row,l)}]}),o=e.flatMap(a=>{let l=n.models.get(a.entity);if(l==null)return[];let c=aa(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 Xd({aliases:i,auth:void 0,env:t,generated:o,principals:s,snapshot:{entities:wR(r),scalars:Le}})}function bR({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,Qd({field:s,generate:e,model:t,seedPrefix:n,spec:a,valueSpaces:i})])),...r}}function Qd({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 aa(e,t){return t.identity.map(n=>String(e[n])).join(":")}function wR(e){return new Map([...e].map(([t,n])=>[t,new Map(n)]))}function rr(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 ir(e,t,n){let r={env:t,identities:e.identities,snapshot:n},i=nu(e.whenSteps,n,r),o=i.at(-1)??e.effectStep,s=un(o,r),a=vR(e,r),l=i.reduce((c,u)=>{let d=un(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:xR(s.effect,a),steps:l.steps}}function Fi(e,t,n){return Pe(e.requiredState,n)==null?!1:Di(t(n))!==Di(n)||kR(e)||RR(e)}function RR(e){return[...e.nav,...e.steps].every(t=>t.expect.every(n=>n.kind!=="state"))}var ep=new WeakMap;function Di(e){let t=ep.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:xs(e.scalars).map(([r,i])=>[r,i.expect])});return ep.set(e,n),n}function vR(e,t){let n=e.nav.at(-1);if(n!=null)return un(n,t).action.url}function xR(e,t){if(t==null)return e;let n=rn(t);return r=>{let i=e(r);return{...i,scalars:Ae(i.scalars,n)}}}function kR(e){return e.effectStep.expect.some(t=>t.kind==="state"&&t.assertion.kind==="updated"&&Object.values(t.assertion.props).some(n=>Rt(n)))}function pn(e,t,n){let r=rr(e,t.snapshot,n);if(r==null)return null;let i=ER(e,r,t.snapshot);return i==null||!Fi(e,i.effect,t.snapshot)?null:{next:{snapshot:i.effect(t.snapshot)},resolved:i}}function tp(e,t,n){let r=rr(e,t.snapshot,n);if(r==null)return"required-state-unsatisfied";try{return ir(e,r,t.snapshot),"no-effect"}catch{return"unresolvable"}}function ER(e,t,n){try{return ir(e,t,n)}catch{return null}}function _i(e,t,n){return e.flatMap((r,i)=>{let o=n(r),s=pn(r,t,o);return s==null?[]:[{idx:i,label:Ye(r),params:o,stepRun:s}]})}function ca(e,t){let n=[...t.entities].flatMap(([o,s])=>[...s].map(([a,l])=>CR({entity:o,key:a,pre:e,row:l}))),r=[...e.entities].flatMap(([o,s])=>[...s].flatMap(([a,l])=>AR({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 CR({entity:e,key:t,pre:n,row:r}){let i=PR(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 AR({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 PR(e,t){return e?.get(t)}function fn(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(np(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 np(e){if(e.kind==="not")return np(e.inner);if(e.kind!=="browser")return e.locator}async function rp({current:e,driver:t,index:n,next:r,state:i}){if(r==null||MR(r))return[];if(Ft(e.transition.effectStep))return[];let o=pn(r.transition,i,r.params);if(o==null)return[];let s=fn(r.transition,o.resolved,t).flatMap(c=>c.pendingChecks.flatMap(u=>{let d=OR(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 MR(e){return e.transition.nav.length>0||e.transition.steps.some(t=>t.action.kind==="goto"||Ft(t))}function OR(e){if(e.kind!=="data-rule")return e.check.kind==="visible"?e.check.locator:void 0}async function da(e,t){let{params:n,transition:r}=e.stepRun,i={snapshot:oi(e.facts,e.state.snapshot)},o=pn(r,i,n);if(o==null){let a=tp(r,i,n),l={intent:r.intent,kind:"unrunnable",reason:a,test:r.test,unmet:a==="required-state-unsatisfied"?Yr(r.requiredState,i.snapshot)??void 0:void 0};return{label:Ye(r),next:e.state,result:{finalModel:e.state.snapshot,findings:[l]}}}let s=await Ti({canon:e.canon,classify:e.classify,initialSnapshot:e.state.snapshot,observe:e.driver.observe,onAssertion:e.onAssertion,onStep:e.onStep,steps:fn(e.stepRun.transition,o.resolved,e.driver),stopAfterStep:e.stopAfterStep==null?void 0:e.stopAfterStep-e.stepBase,dataRuleChecks:(a,l)=>e.dataRules.flatMap(c=>op(c,l)),derive:a=>Xn(e.facts,a)},t);return{label:Ye(e.stepRun.transition),next:{snapshot:s.finalModel},result:s}}function op(e,t){return ui(e,t)?[{budget:"fast",check:{kind:"decided",passed:!1},ephemeral:!1,source:{dataRule:e,kind:"data-rule"},targetIds:()=>Promise.resolve([])}]:[]}function ji(e,t){return ua({acc:{findings:[],ran:[]},index:0,params:e,signal:t,state:e.initialState,stepBase:0})}async function ua({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 da({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:ca(p.pre,p.post),url:p.url})}},r);if(c==null)return ua({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 IR({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:ua({acc:d,index:t+1,params:n,signal:r,state:c.next,stepBase:o+l.length})}async function IR(e,t){let{index:n,outcome:r,params:i,stepBase:o,stepRun:s}=e,a=t.length>0;!a&&r.result.findings.length>0&&ip(i,s,e.state,o,r.result.findings);let l=i.sequence[n+1],c=a?await rp({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&&ip(i,l,r.next,o+t.length,c),c}function ip(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:ca(n.snapshot,n.snapshot),url:typeof s=="string"?s:null})}function sp(e){return J(e).flatMap(t=>TR(t.test))}function TR(e){let t=new Map(e.world.map(r=>[r.as,r])),n=LR(e.steps);return e.steps.flatMap((r,i)=>r.expect.filter(o=>DR(o)).flatMap(o=>$R({createdAliases:n,predicate:o,setByAlias:t,stepIndex:i,test:e})))}function $R(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 LR(e){return new Set(e.flatMap(t=>t.expect.flatMap(n=>n.kind==="state"&&n.assertion.kind==="created"?[n.assertion.as]:[])))}function DR(e){return e.kind==="state"&&e.assertion.kind==="updated"}function ap(e){return J(e).flatMap(({test:t})=>FR(t.steps,re(t)))}function FR(e,t){return e.reduce((n,r)=>{let i=_R(r.action).filter(o=>!jR(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,...BR(r)]),pre:He(n.pre,[r]),violations:[...n.violations,...i]}},{ephemeralKeys:new Set,pre:Tt,violations:[]}).violations}function _R(e){return e.kind==="goto"||e.kind==="upload"?[]:e.kind==="drag"?[e.source,e.target]:"locator"in e&&e.locator!=null?[e.locator]:[]}function jR(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 BR(e){return Zr(e.expect).filter(t=>Xt(t)).flatMap(t=>lp(t)).map(t=>S(ce(t)))}function lp(e){return e.kind==="not"?lp(e.predicate):"locator"in e?[e.locator]:[]}function cp(e){let t=Ze(e);return J(e).flatMap(({test:n})=>[...zR(n.steps,re(n),t),...VR(n.steps,n.actor,re(n))])}function VR(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=WR(i).filter(l=>UR(l.target,s)).map(l=>({predicate:l,stepIndex:o,test:n}));return{actor:Yn(r.actor,[i]),flagged:[...r.flagged,...a]}},{actor:t,flagged:[]}).flagged}function WR(e){return e.expect.filter(t=>t.kind==="actor")}function UR(e,t){return e.kind==="anonymous"?t.kind==="anonymous":t.kind==="user"&&t.alias===e.ref.ref}function zR(e,t,n){let r=ti(Tt,n),i=new Set(r.keys());return e.reduce((o,s,a)=>{let l=HR(s),c=GR({acc:o,assertions:l,stepIndex:a,test:t}),u=ti(He(o.pattern,[s]),n);return{assertedKeys:new Set([...qR({acc:o,assertions:l,pattern:u,step:s}),...i]),pattern:u,redundant:[...o.redundant,...c]}},{assertedKeys:i,pattern:r,redundant:[]}).redundant}function GR({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 qR({acc:e,assertions:t,pattern:n,step:r}){let i=new Set([...KR(r),...qn(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 KR(e){return e.action.kind==="goto"?Gn(e.action.url):[]}function HR(e){return xt(e.expect).flatMap(t=>{if(t.kind==="actor")return[];let n=he(t);return n==null?[]:[{entry:n,predicate:t}]})}var YR=2;function up(e){return J(e).flatMap(({test:t})=>t.steps.reduce((r,i,o)=>{let s=ZR(i,r.pre),a=s.length>=YR?[...r.violations,{hidden:s,stepIndex:o,test:re(t)}]:r.violations;return{pre:He(r.pre,[i]),violations:a}},{pre:Tt,violations:[]}).violations)}function ZR(e,t){return e.expect.flatMap(n=>{let r=XR(n);return r!=null&&!pa(r)&&JR(r,t)?[r]:[]})}function XR(e){return e.kind!=="not"||e.predicate.kind!=="visible"?null:e.predicate.locator}function pa(e){return e.by==="surface"?!0:e.by==="inside"?pa(e.scope)||pa(e.target):!1}function JR(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 pp(e){return J(e).flatMap(({test:t})=>{let n=re(t);return t.steps.reduce((r,i,o)=>QR(r,i,o,n),{found:[],open:new Set}).found})}function QR(e,t,n,r){let i=t.action.kind==="goto"?new Set:e.open,o=dp(t,ev),s=dp(t,tv),a=new Set([...i,...o].filter(c=>!s.has(c))),l=nv(t).flatMap(c=>a.has(S(ce(c.surface)))?[]:[{...c,stepIndex:n,test:r}]);return{found:[...e.found,...l],open:a}}function dp(e,t){return new Set(e.expect.flatMap(n=>{let r=t(n);return r==null?[]:[S(ce(r))]}))}function ev(e){return e.kind!=="visible"?null:e.locator.by==="surface"?e.locator:null}function tv(e){return e.kind!=="not"||e.predicate.kind!=="visible"?null:e.predicate.locator.by==="surface"?e.predicate.locator:null}function nv(e){return e.expect.flatMap(t=>{if(t.kind!=="visible"||t.locator.by!=="inside")return[];let n=fp(t.locator);return n==null?[]:[{content:t.locator,surface:n}]})}function fp(e){return e.by!=="inside"?null:e.scope.by==="surface"?e.scope:fp(e.scope)}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 ${Vt(t.dataRule)}. Cascade the delete or declare the cleanup.`}case"create-gap":return rv(e.gap);case"unreachable-interaction":{let{violation:t}=e,n=pe(t.target);return t.ephemeralOnly?`${oe("reachability")} ${t.test}: ${Qn(t.action)}, but ${n} was only declared inside ephemeral(...), which grants no reachability. Assert a durable visible(...) first.`:`${oe("reachability")} ${t.test}: ${Qn(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 iv(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 rv(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 iv(e){return[`${oe("fact")} Two facts contradict on overlapping states \u2014 "${pt(e.a)}" vs "${pt(e.b)}".`,` Shared state: ${Si(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 ${bd(i.when,n)}`);return[` "${pt(e)}" declared by:`,...r].join(`
6
+ `)}var ov=24301;function Bi(e,t){return e.reduce((n,r)=>cv(n,t[r.idx]?.paramSpaces),new Map)}function hn(e,t){return Object.fromEntries(Object.entries(e.paramSpaces).map(([n,r])=>[n,sv(r,r?.name==null?0:t.get(r.name)??0)]))}var yp=new WeakMap;function sv(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 av(e){return e==null?dv(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"?pv():lv(e)}function gp(e,t){let[n]=nt.sample(av(e),{numRuns:1,seed:ov+t});if(n==null)throw new Error("arbitrary produced no sample");return n}function lv(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 cv(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 uv="abcdefghijklmnopqrstuvwxyz0123456789".match(/./g)??[],dv=e=>nt.array(nt.constantFrom(...uv),{maxLength:e,minLength:1}).map(t=>t.join(""));function pv(){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 fv=new Map;function Vi(e){return hn(e,fv)}import{z as L}from"zod";var mn=L.enum(["crash","data-rule","fact","frame","model-drift"]),Sp=L.object({intent:L.string().min(1),test:L.string().min(1)}),hv=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)})]),mv=L.discriminatedUnion("kind",[L.object({kind:L.literal("consistency"),layer:mn,mismatch:hv,step:Sp.nullable()}),L.object({kind:L.literal("pending-check"),layer:mn,source:L.string().min(1),step:Sp}),L.object({intent:L.string().min(1),kind:L.literal("unrunnable"),layer:mn,reason:L.string().min(1),test:L.string().min(1)}),L.object({error:L.string().min(1),kind:L.literal("driver-error"),layer:mn,step:L.string().min(1)}),L.object({kind:L.literal("impossible-action"),layer:mn,step:L.string().min(1)})]);function fa(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 or(e,t){let n=t.map(o=>({finding:o,line:xi(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:Sv(r),signature:S({baseState:e,parts:r.map(o=>S(o))}),sourceTest:i==null?void 0:yv(i),title:n.at(0)?.line}}function yv(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=fa(e);switch(e.kind){case"consistency":return{kind:"consistency",layer:t,mismatch:gv(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 gv(e){return e.kind==="scalar-mismatch"?{kind:e.kind,subject:jt(e.subject)}:{entity:e.entity,kind:e.kind}}function Sv(e){return e.map(n=>n.layer).toSorted((n,r)=>bp[n]-bp[r]).at(0)??"frame"}function ma(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=>Wi(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 Wi(e){return e.kind==="not"?Wi(e.predicate):e.kind==="and"?e.predicates.flatMap(t=>Wi(t)):e.kind!=="when"?[]:e.branches.flatMap(t=>[...t.condition==null?[]:ha(t.condition),...t.consequence.flatMap(n=>Wi(n))])}function ha(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"?ha(e.predicate):e.kind==="and"||e.kind==="or"?e.predicates.flatMap(t=>ha(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()}),ya={even:{maxAttemptLength:12}};function xp(e){return ya[e]}function Ui(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=oi(e.facts,t),i=_i(e.corpus,{snapshot:r},vv(e,n)),o=Rv(i,e.corpus,e.random());return o==null?n:kp(e,o.stepRun.next.snapshot,[...n,{idx:o.idx,params:o.params}])}var bv=.02;function wv(e,t){return t[e]?.effectStep.action.kind==="goto"?bv:1}function Rv(e,t,n){let r=e.map(a=>wv(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 vv(e,t){let n=Bi(t,e.corpus);return r=>kv({drawn:hn(r,n),params:e,prior:n,rule:r})}var xv=3;function kv({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%xv!==1?[i,o]:[i,a[l%a.length]??o]}))}import{z as A}from"zod";var Ep=A.object({baseStateTest:xc,lockfileHash:A.string().min(1),stepRuns:A.array(A.object({idx:A.number().int().nonnegative(),params:A.record(A.string(),A.union([ss,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([ss,A.null()])),test:A.string().min(1)}))}),Ap=A.object({actions:A.array(A.string()),label:A.string().min(1)}),ga=A.object({test:A.string().min(1),text:A.string()}),Ev=A.object({baseLabel:A.string(),baseState:A.string().min(1),durationMs:A.number().int().nonnegative(),signature:A.string().optional(),steps:A.array(ga)}),Pp=A.object({kind:A.enum(["aborted","clean","error","flaky","finding","seen"]),reason:A.string().optional(),runId:A.string().optional(),trail:Ev.optional()});function zi(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=>Cv(r))]:n}function Gi(e,t,n){return dn(e,t.test,n)}function Cv(e){return Av(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 Av(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 qi(e){let t=Kn(e);if(t.length===0)return null;let n=zi(e,{sweep:!1}),r=await Pv(e,n);if(r.length===0)return null;let i=an(e);return{corpus:t,facts:{facts:i.facts.filter(o=>!o.localConsequence),overlays:Ze(e),overrides:i.overrides},literals:ma(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=Ui({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 Pv(e,t){let n={generate:Fn,materialize:Ni(Fn,e.valueSpaces),params:void 0,signIn:void 0};return(await Promise.all(t.map(async i=>(await Gi(e,i,n)).match(s=>({name:i.name,snapshot:s.snapshot}),()=>null)))).flatMap(i=>i==null?[]:[i])}import{createServer as Bv}from"http";import{mkdir as Vv,rm as Wv,writeFile as Uv}from"fs/promises";import zv from"path";import{z as D}from"zod";var Gv="otlp-port",Ip=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()})}),qv=D.object({attributes:D.array(Ip).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()}),Kv=D.object({resourceSpans:D.array(D.object({resource:D.object({attributes:D.array(Ip).default([])}).optional(),scopeSpans:D.array(D.object({spans:D.array(qv).default([])})).default([])})).default([])});async function Sa({localDir:e,onRrwebBatch:t,onSpan:n,writePortFile:r}){let{port:i,server:o}=await Hv({onRrwebBatch:t,onSpan:n}),s=zv.join(e,Gv);return r&&(await Vv(e,{recursive:!0}),await Uv(s,String(i),{encoding:"utf8"})),{port:i,stop:async()=>{r&&await Wv(s,{force:!0}),await Qv(o)}}}function Hv(e){return new Promise((t,n)=>{let r=Bv((i,o)=>{Yv(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 Yv(e,t,n){let r=Zv(e.url);if(r!=null){Op(e).then(i=>{n.onRrwebBatch(r,i),Ki(t)}).catch(()=>{Ki(t)});return}Op(e).then(i=>{Xv(Kv.parse(JSON.parse(i.toString("utf8"))),n.onSpan),Ki(t)}).catch(()=>{Ki(t)})}function Zv(e){if(e==null||!e.startsWith("/rrweb/"))return;let t=decodeURIComponent(e.slice(7));return t.length===0?void 0:t}function Op(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 Ki(e){e.writeHead(200,{"content-type":"application/json"}),e.end("{}")}function Xv(e,t){e.resourceSpans.flatMap(n=>n.scopeSpans).flatMap(n=>n.spans).forEach(n=>{t({attributes:Jv(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:bc(n.kind),status:{code:wc(n.status?.code??0),message:n.status?.message},timeNanos:n.startTimeUnixNano,traceId:n.traceId})})}function Jv(e){return Object.fromEntries(e.map(({key:t,value:n})=>[t,String(n.stringValue??n.intValue??n.doubleValue??n.boolValue??"")]))}function Qv(e){return new Promise((t,n)=>{e.close(r=>{if(r==null){t();return}n(r)}),e.closeAllConnections()})}import{ResultAsync as sr}from"neverthrow";function Wt(e,t,n){if(t==null)throw new Error("action requires a locator");return yn(e,t,n)}function yn(e,t,n){if(t.by==="inside"){let i=yn(e,t.scope,n);return yn(i,t.target,n)}if(t.by==="surface")return yn(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,gn=class extends Error{mountKey;constructor(t){super("client-mount-unmounted"),this.mountKey=t}},Ut=class extends Error{readyKey;timeoutMs;constructor(t,n){super("app-not-ready"),this.readyKey=t,this.timeoutMs=n}};function Ra(e){return{read:t=>ex(t,e),seedScript:t=>`globalThis[${JSON.stringify(vc)}] = ${JSON.stringify(t)};`}}async function ex(e,t){let n=Ae(rn(e.url()),Tp([[{kind:"title"},await e.title()],[{kind:"viewport"},ix(e.viewportSize())]]));if(t.length===0)return{scalars:n};let r=await e.evaluate(nx,{mountKey:as,names:t,timeoutMs:tx});if(r.kind==="unmounted")throw new gn(as);let i=Tp(Object.entries(r.values).map(([o,s])=>[{kind:"variable",name:o},s]));return{scalars:Ae(n,i)}}function Tp(e){return new Map(e.flatMap(([t,n])=>n===void 0?[]:[[R(t),{declared:!0,expect:{expect:"is",value:n},subject:t}]]))}var tx=wa;async function nx(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 rx=768;function ix(e){return e==null?"":e.width<rx?"mobile":"desktop"}async function Hi({page:e,readiness:t,signal:n,startMs:r,tries:i,url:o}){if(Oe(n),!await ox(e,o)){if(Date.now()-r>=t.budgetMs)throw new Ut(Fr,t.budgetMs);let a=t.backoffMs[Math.min(i,t.backoffMs.length-1)]??8e3;await Ct(a,n),await Hi({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 cx(e,n,Math.min(s,ax(t,i)))){if(Date.now()-r>=t.budgetMs)throw new Ut(Fr,t.budgetMs);await Hi({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 Yi(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 ox(e,t){let n=await sx(e,t);return n==="net-error"?!1:n==null||n.status()<400}async function sx(e,t){try{return await e.goto(t,{waitUntil:"domcontentloaded"})}catch(n){if(va(n))return"net-error";throw n}}function ax(e,t){return t===0?e.budgetMs/2:e.budgetMs}var lx=50;async function cx(e,t,n){let r=Date.now()+n;for(;Date.now()<r;){if(Oe(t),await $p(e))return!0;await Ct(lx,t)}return $p(e)}async function $p(e){try{return await e.evaluate(ux,Fr)}catch(t){if(Yi(t))return!1;throw t}}function ux(e){return Reflect.get(globalThis,e)===!0}async function xa(e,t,n){if(n.kind==="browser")return fx(e,t,n.key,n.value);if(n.kind==="not")return!await xa(e,t,n.inner);let r=Wt(e,n.locator,{visibleOnly:!0});return n.kind==="value"?Np(await r.inputValue(),n.value,n.match):n.kind==="text"?Np(await r.textContent()??"",n.value,n.match):n.kind==="unobstructed"?dx(r):px(r,n.kind)}function Np(e,t,n){let r=nn(e),i=nn(t);return n==="contains"?r.includes(i):n==="startsWith"?r.startsWith(i):r===i}function dx(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 px(e,t){return t==="visible"?e.isVisible():t==="disabled"?e.isDisabled():t==="enabled"?e.isEnabled():t==="checked"?e.isChecked():t==="expanded"?Lp(e,n=>n.getAttribute("aria-expanded")==="true"):t==="pressed"?Lp(e,n=>n.getAttribute("aria-pressed")==="true"):e.evaluate(n=>n===n.ownerDocument.activeElement)}async function Lp(e,t){return await e.count()===0?!1:e.evaluate(t)}async function fx(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},hx={readiness:ka,readSession:void 0,switchActor:void 0};function Ea(e,t,n,r,{readiness:i,readSession:o,switchActor:s}=hx){return{awaitCheck:(a,l)=>sr.fromPromise(gx({check:a,engine:n,page:e,signal:r,timeoutMs:l}),c=>tr(c)?{kind:"aborted"}:Zi(c)),evaluate:a=>sr.fromPromise(Fp(Ca(e,n,a),`check ${a.kind}`),Zi),locateIds:a=>Ox(e,a),observe:a=>sr.fromPromise(o==null?Promise.resolve(void 0):o(),Zi).andThen(l=>t.read(l)).andThen(l=>sr.fromPromise(Fp(Rx({backend:l,engine:n,page:e,tracked:a}),"observe"),Zi)),perform:a=>sr.fromPromise(Bp(e,a,0,r,{readiness:i,switchActor:s}),l=>mx(a,l))}}function Zi(e){return e instanceof gn?jr(e.mountKey):gs(e)}async function Ca(e,t,n){try{return await xa(e,t,n)}catch(r){if(Yi(r))return!1;throw r}}function mx(e,t){return t instanceof Ut?ds(t.readyKey,t.timeoutMs):t instanceof gn?jr(t.mountKey):ys(e.kind,t)}var yx=75;function gx(e){return e.check.kind==="visible"?Sx({locator:e.check.locator,page:e.page,signal:e.signal,timeoutMs:e.timeoutMs}):_p(e,Date.now()+e.timeoutMs)}async function _p(e,t){return Oe(e.signal),await Ca(e.page,e.engine,e.check)?!0:Date.now()>=t?!1:(await Ct(yx,e.signal),_p(e,t))}async function Sx({locator:e,page:t,signal:n,timeoutMs:r}){try{return await Promise.race([Wt(t,e,{visibleOnly:!0}).waitFor({state:"visible",timeout:r}),bx(n)]),!0}catch(i){if(wx(i))return!1;throw i}}function bx(e){return new Promise((t,n)=>{if(e.aborted){n(new De);return}e.addEventListener("abort",()=>{n(new De)},{once:!0})})}function wx(e){return e instanceof Error&&e.name==="TimeoutError"}async function Rx({backend:e,engine:t,page:n,tracked:r}){let i=await jp(n,t,0),o=await vx(n,t,r);return{snapshot:{...e,scalars:new Map([...e.scalars,...i.scalars,...o])}}}async function vx(e,t,n){let r=await Promise.all([...n.values()].filter(i=>i.subject.kind==="element").map(async i=>{let o=await xx(e,t,i.subject);return[R(i.subject),{declared:!0,expect:{expect:"is",value:o},subject:i.subject}]}));return new Map(r)}async function xx(e,t,n){return n.state==="value"||n.state==="text"?kx(e,n.locator,n.state):Ca(e,t,{kind:n.state,locator:n.locator})}async function kx(e,t,n){try{let r=Wt(e,t,{visibleOnly:!0});return n==="value"?await r.inputValue():await r.textContent()??""}catch{return""}}var Ex=[100,250,500];async function jp(e,t,n){try{return await t.read(e)}catch(r){let i=Ex[n];if(i==null||!Yi(r))throw r;return await Vp(i),jp(e,t,n+1)}}var Dp=35e3;function Fp(e,t){let n,r=new Promise((i,o)=>{n=setTimeout(()=>{o(new Error(`driver op "${t}" exceeded ${String(Dp)}ms`))},Dp)});return Promise.race([e,r]).finally(()=>{clearTimeout(n)})}var Cx=[250,750,2e3];async function Bp(e,t,n,r,i){try{await Ax(e,t,r,i.readiness,i.switchActor)}catch(o){let s=Cx[n];if(s==null||!va(o))throw o;await Vp(s),await Bp(e,t,n+1,r,i)}}async function Ax(e,t,n,r,i){if(t.kind==="actor"){if(i==null)throw new Error("this driver cannot switch actors");await i(At(t.actorRef,t,"actorRef"));return}if(t.kind==="goto"){await Hi({page:e,readiness:r,signal:n,startMs:Date.now(),tries:0,url:At(t.url,t,"url")});return}if(t.kind==="press"&&t.locator==null){await e.keyboard.press(At(t.key,t,"key"));return}let o=t.kind!=="upload";await Px(e,Wt(e,t.locator,{visibleOnly:o}),t)}function At(e,t,n){if(e==null)throw new Error(`action "${t.kind}" requires ${n}`);return e}function Px(e,t,n){switch(n.kind){case"goto":throw new Error("goto must not be located");case"fill":return t.fill(String(At(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 Mx(e,t,String(At(n.value,n,"value")));case"upload":return t.setInputFiles(At(n.files,n,"files"));case"press":return t.press(At(n.key,n,"key"));case"drag":return t.dragTo(Wt(e,At(n.target,n,"target"),{visibleOnly:!0}));case"actor":throw new Error("actor switch must not be located")}}async function Mx(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 Vp(e){return new Promise(t=>{setTimeout(t,e)})}async function Ox(e,t){if(t==null)return[];try{let n=yn(e,t,{visibleOnly:!1});if(await n.count()===0)return[];let r=await n.first().evaluate(Ix);return r>0?[r]:[]}catch{return[]}}function Ix(e){return globalThis.__ripploRrwebMirror?.getId(e)??-1}import Tx from"path";var Up={desktop:{height:720,width:1280},mobile:{height:844,width:390}};function zp(e){return Up[e]}var AD=Up.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 Lx(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?Dx():await n.hub.attach(m,n.runId),f=await m.newPage();y.onPage(f);let h=f,w=$x({baseUrl:e,context:m,page:f,signInActor:d}),v=a?Nx(e,m):void 0;return{context:m,driver:jx(Fx(Ea(h,l,i,u,{readiness:ka,readSession:v,switchActor:w}),o),y),emitAssertion:y.emitAssertion,close:()=>Bx({context:m,handle:y})}}async function Pa(e,t){let n=await qp(e,void 0);try{return await t(n)}finally{await n.close()}}async function Gp(e){let{chromium:t}=await import("playwright");return t.launchPersistentContext(e,{headless:!1,viewport:null})}function $x({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 Nx(e,t){return async()=>{let n=await t.cookies();return{cookies:Ma(n,e),headers:void 0,origins:[]}}}async function Lx(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 Dx(){return{emitAction:()=>{},emitAssertion:()=>{},finish:()=>Promise.resolve(),onPage:()=>{}}}async function qp(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 Xi({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??=qp(t,e),n},close:async()=>{let o=n;n=void 0,o!=null&&await o.then(s=>s.close()).catch(()=>{})}}}function Fx(e,t){return{awaitCheck:e.awaitCheck,evaluate:e.evaluate,locateIds:e.locateIds,observe:e.observe,perform:n=>e.perform(_x(n,t))}}function _x(e,t){return e.kind!=="upload"||e.files==null?e:{...e,files:e.files.map(n=>Tx.join(t,n))}}function jx(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 Bx({context:e,handle:t}){await Wp(t.finish()),await Wp(e.close())}var Vx=15e3;async function Wp(e){let t,n=new Promise(r=>{t=setTimeout(r,Vx)});await Promise.race([e.catch(()=>{}),n]).finally(()=>{clearTimeout(t)})}import{err as Wx,ok as Ux,Result as Oa}from"neverthrow";function Ia(e,t,n){return{read:r=>n.read(e.map(i=>i.name),t,r).andThen(i=>zx(e,i))}}function zx(e,t){return Oa.combine(e.map(n=>Gx(n,t.entities[n.name]??[]).map(r=>[n.name,r]))).map(n=>({entities:new Map(n),scalars:new Map([...Hx(t.singletons),...Yx(t.actor)])}))}function Gx(e,t){let n=nr(e);return Oa.combine(t.map(r=>qx(r,e).map(i=>[i,Kx(r,n)]))).map(r=>new Map(r))}function qx(e,t){return Oa.combine(t.identity.map(n=>{let r=e[n];return r==null?Wx(fs(t.name,n)):Ux(String(r))})).map(n=>n.join(":"))}function Kx(e,t){let n=t.map(r=>[r,e[r]]).filter(r=>r[1]!=null);return Object.fromEntries(n)}function Hx(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 Yx(e){return e==null?[]:[[R({kind:"actor"}),{declared:!1,expect:{expect:"is",value:e},subject:{kind:"actor"}}]]}var Kp=mc(Sy(),1);import Zx from"crypto";import{err as Xx,errAsync as Ta,ok as Jx,ResultAsync as Sn}from"neverthrow";var Qx=1e4,ek=[250,750,2e3],tk=[500,1e3,2e3,3e3];function $a({baseUrl:e,extraHeaders:t,runId:n,secret:r},i){let o=new Kp.Webhook(r),s=(a,l,c)=>nk({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:Ac,signal:i}).map(u=>({actor:u.actor,entities:u.entities,singletons:u.singletons}))},ready:()=>Yp(e,t,i,0),setupWorld:a=>s("/setup",{entities:a,runId:n},{retry:"connection",schema:Ec,signal:i}).map(l=>l.rows),signIn:({entity:a,row:l})=>s("/sign-in",{entity:a,row:l,runId:n},{retry:"connection",schema:Cc,signal:i}).map(c=>c.session),teardown:()=>s("/teardown",{runId:n},{retry:"connection",schema:Pc,signal:void 0}).map(()=>{})}}function nk(e){return Hp(e.retry,()=>sk(e),0)}function Hp(e,t,n){return t().orElse(r=>{let i=ek[n];return i==null||!ik(r,e)?Ta(r):Sn.fromSafePromise(Zp(i)).andThen(()=>Hp(e,t,n+1))})}function Yp(e,t,n,r){return Sn.fromPromise(fetch(e,{headers:t,method:"HEAD",signal:Xp(n)}),i=>Jt("",i)).map(()=>{}).orElse(()=>{let i=tk[r];return i==null||n.aborted?Ta(ms(e)):Sn.fromSafePromise(Zp(i)).andThen(()=>Yp(e,t,n,r+1))})}var rk=new Set(["EAI_AGAIN","ECONNREFUSED","ENOTFOUND"]);function ik(e,t){return e.kind==="aborted"?!1:ok(e)?!0:t==="connection"?!1:e.kind==="engine-network"||e.kind==="engine-http"&&e.status>=500}function ok(e){return e.kind==="engine-network"&&e.code!=null&&rk.has(e.code)}function Zp(e){return new Promise(t=>{setTimeout(t,e)})}function sk({baseUrl:e,body:t,extraHeaders:n,path:r,schema:i,signal:o,webhook:s}){let a=JSON.stringify(t);return Sn.fromPromise(fetch(`${e}${r}`,{body:a,headers:{...n,"Content-Type":"application/json",...ak(s,a)},method:"PUT",signal:Xp(o)}),l=>Jt(r,l)).andThen(l=>lk(l,r)).andThen(l=>ck(i,l,r)).mapErr(l=>o?.aborted===!0?Ss():l)}function ak(e,t){let n=`msg_${Zx.randomUUID()}`,r=new Date;return{"webhook-id":n,"webhook-signature":e.sign(n,r,t),"webhook-timestamp":String(Math.floor(r.getTime()/1e3))}}function Xp(e){let t=AbortSignal.timeout(Qx);return e==null?t:AbortSignal.any([e,t])}function lk(e,t){return e.ok?Sn.fromPromise(e.json(),n=>Jt(t,n)):Sn.fromPromise(e.text().catch(()=>""),n=>Jt(t,n)).andThen(n=>Ta(us(t,e.status,n)))}function ck(e,t,n){let r=e.safeParse(t);return r.success?Jx(r.data):Xx(ps(n,r.error))}import cO from"path";import{err as Zt,errAsync as uO,ok as $n,ResultAsync as ac}from"neverthrow";import ry from"path";import{z as Be}from"zod";import uk from"path";function Jp({debugDir:e,runId:t,worker:n}){let r=uk.join(e,t,"behavior.jsonl");return n.open({file:r,runId:t}),{close:i=>n.close({noticeLineIfNoRrweb:i?.noticeIfNoRrweb==null?"":JSON.stringify(dk(i.noticeIfNoRrweb)),runId:t}),emit:i=>{let o={...i,timestamp:pk(i.timeNanos)};n.line({line:JSON.stringify(o),runId:t,timeNanos:i.timeNanos})},emitRrwebBatch:i=>{n.rrwebBatch({data:i,runId:t})}}}function bn(e){return String(BigInt(Math.round(e))*1000000n)}function dk(e){return{kind:"notice",message:e,source:"capture",timeNanos:"0"}}function pk(e){return Number(BigInt(e)/1000000n)}import{existsSync as fk}from"fs";import{createRequire as hk}from"module";import{fileURLToPath as mk}from"url";import{Worker as yk}from"worker_threads";var gk=hk(import.meta.url);function Qp(e){let t=new yk(Sk(),{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 Sk(){try{return gk.resolve("@ripplo/runtime/capture-worker")}catch{let e=["../../dist/capture-worker.js","./capture-worker.js"].map(n=>mk(new URL(n,import.meta.url))),t=e.find(n=>fk(n));if(t==null)throw new Error(`capture-worker.js not found; looked at: ${e.join(", ")}`);return t}}import{readFile as bk}from"fs/promises";import{createRequire as wk}from"module";import{fileURLToPath as Rk}from"url";var vk=wk(import.meta.url);function Na(e,t){try{return vk.resolve(e)}catch{return Rk(new URL(`assets/${t}`,import.meta.url))}}var xk=Na("@ripplo/browser-trace/bundle","browser-trace.js");async function tf(e,t){await e.addInitScript(`globalThis.__ripploRunId = ${JSON.stringify(t)};`),await e.addInitScript(await kk())}var ef;function kk(){return ef??=bk(xk,{encoding:"utf8"}),ef}import{readFile as KM}from"fs/promises";var Ek=Object.defineProperty,Ck=(e,t,n)=>t in e?Ek(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,b=(e,t,n)=>Ck(e,typeof t!="symbol"?t+"":t,n),nf,Ak=Object.defineProperty,Pk=(e,t,n)=>t in e?Ak(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,rf=(e,t,n)=>Pk(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"]},Ji={},Mk=()=>!!globalThis.Zone;function _l(e){if(Ji[e])return Ji[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&&!Mk())return Ji[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?Ji[e]=c:n}catch{return n}}var La={};function yt(e,t,n){var r;let i=`${e}.${String(n)}`;if(La[i])return La[i].call(t);let o=_l(e),s=(r=Object.getOwnPropertyDescriptor(o,n))==null?void 0:r.get;return s?(La[i]=s,s.call(t)):t[n]}var Da={};function rh(e,t,n){let r=`${e}.${String(n)}`;if(Da[r])return Da[r].bind(t);let o=_l(e)[n];return typeof o!="function"?t[n]:(Da[r]=o,o.bind(t))}function Ok(e){return yt("Node",e,"ownerDocument")}function Ik(e){return yt("Node",e,"childNodes")}function Tk(e){return yt("Node",e,"parentNode")}function $k(e){return yt("Node",e,"parentElement")}function Nk(e){return yt("Node",e,"textContent")}function Lk(e,t){return rh("Node",e,"contains")(t)}function Dk(e){return rh("Node",e,"getRootNode")()}function Fk(e){return!e||!("host"in e)?null:yt("ShadowRoot",e,"host")}function _k(e){return e.styleSheets}function jk(e){return!e||!("shadowRoot"in e)?null:yt("Element",e,"shadowRoot")}function Bk(e,t){return yt("Element",e,"querySelector")(t)}function Vk(e,t){return yt("Element",e,"querySelectorAll")(t)}function Wk(){return _l("MutationObserver").constructor}function Uk(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:Ok,childNodes:Ik,parentNode:Tk,parentElement:$k,textContent:Nk,contains:Lk,getRootNode:Dk,host:Fk,styleSheets:_k,shadowRoot:jk,querySelector:Bk,querySelectorAll:Vk,mutationObserver:Wk,patch:Uk};function ih(e){return e.nodeType===e.ELEMENT_NODE}function pr(e){let t=e&&"host"in e&&"mode"in e&&me.host(e)||null;return!!(t&&"shadowRoot"in t&&me.shadowRoot(t)===e)}function fr(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function zk(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 Gk(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 Ya(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 zk(r)}catch{return null}}function oh(e,t){if(Kk(e)){let n;try{n=Ya(e.styleSheet)||Gk(e)}catch{n=e.cssText}return e.styleSheet.href?Io(n,e.styleSheet.href):n}else{let n=e.cssText;return Hk(e)&&e.selectorText.includes(":")&&(n=qk(n)),t?Io(n,t):n}}function qk(e){let t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function Kk(e){return"styleSheet"in e}function Hk(e){return"selectorText"in e}var Po=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 Yk(){return new Po}function Mo({element:e,maskInputOptions:t,tagName:n,type:r,value:i,maskInputFn:o}){let s=i||"",a=r&&Gt(r);return(t[n.toLowerCase()]||a&&t[a])&&(o?s=o(s,e):s="*".repeat(s.length)),s}function Gt(e){return e.toLowerCase()}var af="__rrweb_original__";function Zk(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 Oo(e){let t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?Gt(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 Xk(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var Jk=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Qk=/^(?:[a-z+]+:)?\/\//i,eE=/^www\..*/i,tE=/^(data:)([^,]*),(.*)/i;function Io(e,t){return(e||"").replace(Jk,(n,r,i,o,s,a)=>{let l=i||s||a,c=r||o||"";if(!l)return n;if(Qk.test(l)||eE.test(l))return`url(${c}${l}${c})`;if(tE.test(l))return`url(${c}${l}${c})`;if(l[0]==="/")return`url(${c}${Xk(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 Qi(e,t=!1){return t?e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,""):e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"").replace(/0px/g,"0")}function nE(e,t,n=!1){let r=Array.from(t.childNodes),i=[],o=0;if(r.length>1&&e&&typeof e=="string"){let s=Qi(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=Qi(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=Qi(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=Qi(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 rE(e,t){return nE(e,t).join("/* rr_split */")}var iE=1,oE=new RegExp("[^a-z0-9-_:]"),mr=-2;function ah(){return iE++}function sE(e){if(e instanceof HTMLFormElement)return"form";let t=Gt(e.tagName);return oE.test(t)?"div":t}var wn,lf,aE=/^[^ \t\n\r\u000c]+/,lE=/^[, \t\n\r\u000c]+/;function cE(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(lE),!(n>=t.length);){let o=r(aE);if(o.slice(-1)===",")o=xn(e,o.substring(0,o.length-1)),i.push(o);else{let s="";o=xn(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 xn(e,t){return!t||t.trim()===""?t:jl(e,t)}function uE(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function jl(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)?xn(e,r):n==="srcset"?cE(e,r):n==="style"?Io(r,jl(e)):t==="object"&&n==="data"?xn(e,r):r)}function ch(e,t,n){return["video","audio"].includes(e)&&t==="autoplay"}function dE(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 To(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return n?To(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?To(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(To(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 pE(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 fE(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 hE(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=mE(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 gE(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 yE(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 mE(e,t){if(!t.hasNode(e))return;let n=t.getId(e);return n===1?void 0:n}function yE(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=Io(l,jl(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 gE(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=dE(e,r,i),f=sE(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,Gt(x.name),x.value))}if(f==="link"&&o){let g=Array.from(n.styleSheets).find(T=>T.href===e.href),x=null;g&&(x=Ya(g)),x&&(delete h.rel,delete h.href,h._cssText=x)}if(f==="style"&&e.sheet){let g=Ya(e.sheet);g&&(e.childNodes.length>1&&(g=rE(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=Mo({element:e,type:Oo(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")Zk(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){wn||(wn=n.createElement("canvas"),lf=wn.getContext("2d"));let g=e,x=g.currentSrc||g.getAttribute("src")||"<unknown-src>",T=g.crossOrigin,j=()=>{g.removeEventListener("load",j);try{wn.width=g.naturalWidth,wn.height=g.naturalHeight,lf.drawImage(g,0,0),h.rr_dataURL=wn.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:uE(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 SE(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 kn(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=hE(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):SE(fe,m)||!ne&&fe.type===se.Text&&!fe.textContent.replace(/^\s+|\s+$/gm,"").length?Ve=mr:Ve=ah();let $=Object.assign(fe,{id:Ve});if(r.add(e,$),Ve===mr)return null;w&&w(e);let Ln=!l;if($.type===se.Element){Ln=Ln&&!$.needBlock,delete $.needBlock;let ie=me.shadowRoot(e);ie&&fr(ie)&&($.isShadowHost=!0)}if(($.type===se.Document||$.type===se.Element)&&Ln){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 Mt of Array.from(me.childNodes(e))){let We=kn(Mt,ie);We&&$.childNodes.push(We)}}let Ie=null;if(ih(e)&&(Ie=me.shadowRoot(e)))for(let Mt of Array.from(me.childNodes(Ie))){let We=kn(Mt,ie);We&&(fr(Ie)&&(We.isShadow=!0),$.childNodes.push(We))}}let Dn=me.parentNode(e);return Dn&&pr(Dn)&&fr(Dn)&&($.isShadow=!0),$.type===se.Element&&$.tagName==="iframe"&&pE(e,()=>{let ie=e.contentDocument;if(ie&&v){let Ie=kn(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")&&fE(e,()=>{if(x){let ie=kn(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 bE(e,t){let{mirror:n=new Po,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 kn(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 wE=/(max|min)-device-(width|height)/,HD=new RegExp(wE.source,"g");function RE(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function vE(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 Bl={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}};Bl.exports=ph();Bl.exports.createColors=ph;var xE=Bl.exports,kE={},EE=Object.freeze(Object.defineProperty({__proto__:null,default:kE},Symbol.toStringTag,{value:"Module"})),_e=vE(EE),uf=xE,df=_e,Za=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}},Vl=Za;Za.default=Za;var Er={};Er.isClean=Symbol("isClean");Er.my=Symbol("my");var pf={after:`
12
+ `,beforeClose:`
13
+ `,beforeComment:`
14
+ `,beforeDecl:`
15
+ `,beforeOpen:" ",beforeRule:`
16
+ `,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function CE(e){return e[0].toUpperCase()+e.slice(1)}var Xa=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"+CE(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=Xa;Xa.default=Xa;var AE=hh;function Ja(e,t){new AE(t).stringify(e)}var Go=Ja;Ja.default=Ja;var{isClean:eo,my:PE}=Er,ME=Vl,OE=hh,IE=Go;function Qa(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=>Qa(s,n)):(o==="object"&&i!==null&&(i=Qa(i)),n[r]=i)}return n}var el=class{constructor(t={}){this.raws={},this[eo]=!1,this[PE]=!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=Qa(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 ME(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[eo]){this[eo]=!1;let t=this;for(;t=t.parent;)t[eo]=!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 OE().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=IE){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=el;el.default=el;var TE=qo,tl=class extends TE{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]==="$"}},Ko=tl;tl.default=tl;var $E="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",NE=(e,t=21)=>(n=t)=>{let r="",i=n;for(;i--;)r+=e[Math.random()*e.length|0];return r},LE=(e=21)=>{let t="",n=e;for(;n--;)t+=$E[Math.random()*64|0];return t},DE={nanoid:LE,customAlphabet:NE},{SourceMapConsumer:ff,SourceMapGenerator:hf}=_e,{existsSync:FE,readFileSync:_E}=_e,{dirname:Fa,join:jE}=_e;function BE(e){return Buffer?Buffer.from(e,"base64").toString():window.atob(e)}var nl=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=Fa(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 BE(t.substr(RegExp.lastMatch.length));let s=t.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+s)}getAnnotationURL(t){return t.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(t){return typeof t!="object"?!1:typeof t.mappings=="string"||typeof t._mappings=="string"||Array.isArray(t.sections)}loadAnnotation(t){let 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=Fa(t),FE(t))return this.mapFile=t,_E(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=jE(Fa(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=nl;nl.default=nl;var{SourceMapConsumer:VE,SourceMapGenerator:WE}=_e,{fileURLToPath:mf,pathToFileURL:to}=_e,{isAbsolute:rl,resolve:il}=_e,{nanoid:UE}=DE,_a=_e,yf=Vl,zE=mh,ja=Symbol("fromOffsetCache"),GE=!!(VE&&WE),gf=!!(il&&rl),$o=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)||rl(n.from)?this.file=n.from:this.file=il(n.from)),gf&&GE){let r=new zE(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 "+UE(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&&(to&&(o.input.url=to(this.file).toString()),o.input.file=this.file),o}fromOffset(t){let n,r;if(this[ja])r=this[ja];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[ja]=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:il(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;rl(s.source)?l=to(s.source):l=new URL(s.source,this.map.consumer().sourceRoot||to(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}},Ho=$o;$o.default=$o;_a&&_a.registerInput&&_a.registerInput($o);var{SourceMapConsumer:yh,SourceMapGenerator:vo}=_e,{dirname:xo,relative:gh,resolve:Sh,sep:bh}=_e,{pathToFileURL:Sf}=_e,qE=Ho,KE=!!(yh&&vo),HE=!!(xo&&Sh&&gh&&bh),YE=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||xo(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(),HE&&KE&&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=vo.fromSourceMap(t,{ignoreInvalidMapping:!0})}else this.map=new vo({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 vo({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?xo(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(r=xo(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 qE(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=YE,ZE=qo,ol=class extends ZE{constructor(t){super(t),this.type="comment"}},Yo=ol;ol.default=ol;var{isClean:Rh,my:vh}=Er,xh=Ko,kh=Yo,XE=qo,Eh,Wl,Ul,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 ht=class Mh extends XE{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 Wl(t)];else if(t.name)t=[new Ul(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]}};ht.registerParse=e=>{Eh=e};ht.registerRule=e=>{Wl=e};ht.registerAtRule=e=>{Ul=e};ht.registerRoot=e=>{Ch=e};var qt=ht;ht.default=ht;ht.rebuild=e=>{e.type==="atrule"?Object.setPrototypeOf(e,Ul.prototype):e.type==="rule"?Object.setPrototypeOf(e,Wl.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=>{ht.rebuild(t)})};var JE=qt,Oh,Ih,yr=class extends JE{constructor(t){super({type:"document",...t}),this.nodes||(this.nodes=[])}toResult(t={}){return new Oh(new Ih,this,t).stringify()}};yr.registerLazyResult=e=>{Oh=e};yr.registerProcessor=e=>{Ih=e};var zl=yr;yr.default=yr;var bf={},Th=function(t){bf[t]||(bf[t]=!0,typeof console<"u"&&console.warn&&console.warn(t))},sl=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=sl;sl.default=sl;var QE=$h,al=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 QE(t,n);return this.messages.push(r),r}warnings(){return this.messages.filter(t=>t.type==="warning")}get content(){return this.css}},Gl=al;al.default=al;var Ba=39,wf=34,no=92,Rf=47,ro=10,ar=32,io=12,oo=9,so=13,eC=91,tC=93,nC=40,rC=41,iC=123,oC=125,sC=59,aC=42,lC=58,cC=64,ao=/[\t\n\f\r "#'()/;[\\\]{}]/g,lo=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,uC=/.[\r\n"'(/\\]/,vf=/[\da-f]/i,dC=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 ro:case ar:case oo:case so:case io:{s=h;do s+=1,o=r.charCodeAt(s);while(o===ar||o===ro||o===oo||o===so||o===io);y=["space",r.slice(h,s)],h=s-1;break}case eC:case tC:case iC:case oC:case lC:case sC:case rC:{let ne=String.fromCharCode(o);y=[ne,ne,h];break}case nC:{if(p=w.length?w.pop()[1]:"",m=r.charCodeAt(h+1),p==="url"&&m!==Ba&&m!==wf&&m!==ar&&m!==ro&&m!==oo&&m!==io&&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)===no;)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||uC.test(l)?y=["(","(",h]:(y=["brackets",l,h,s],h=s);break}case Ba:case wf:{a=o===Ba?"'":'"',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)===no;)d-=1,u=!u}while(u);y=["string",r.slice(h,s+1),h,s],h=s;break}case cC:{ao.lastIndex=h+1,ao.test(r),ao.lastIndex===0?s=r.length-1:s=ao.lastIndex-2,y=["at-word",r.slice(h,s+1),h,s],h=s;break}case no:{for(s=h,c=!0;r.charCodeAt(s+1)===no;)s+=1,c=!c;if(o=r.charCodeAt(s+1),c&&o!==Rf&&o!==ar&&o!==ro&&o!==oo&&o!==so&&o!==io&&(s+=1,vf.test(r.charAt(s)))){for(;vf.test(r.charAt(s+1));)s+=1;r.charCodeAt(s+1)===ar&&(s+=1)}y=["word",r.slice(h,s+1),h,s],h=s;break}default:{o===Rf&&r.charCodeAt(h+1)===aC?(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):(lo.lastIndex=h+1,lo.test(r),lo.lastIndex===0?s=r.length-1:s=lo.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=qt,No=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)}},ql=No;No.default=No;Nh.registerAtRule(No);var Lh=qt,Dh,Fh,Cn=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()}};Cn.registerLazyResult=e=>{Dh=e};Cn.registerProcessor=e=>{Fh=e};var Cr=Cn;Cn.default=Cn;Lh.registerRoot(Cn);var gr={comma(e){return gr.split(e,[","],!0)},space(e){let t=[" ",`
29
+ `," "];return gr.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=gr;gr.default=gr;var jh=qt,pC=_h,Lo=class extends jh{constructor(t){super(t),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return pC.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)}},Kl=Lo;Lo.default=Lo;jh.registerRule(Lo);var fC=Ko,hC=dC,mC=Yo,yC=ql,gC=Cr,xf=Kl,kf={empty:!0,space:!0};function SC(e){for(let t=e.length-1;t>=0;t--){let n=e[t],r=n[3]||n[2];if(r)return r}}var bC=class{constructor(t){this.input=t,this.root=new gC,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 yC;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 mC;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=hC(this.input)}decl(t,n){let r=new fC;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]||SC(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})}},wC=bC,RC=qt,vC=wC,xC=Ho;function Do(e,t){let n=new xC(e,t),r=new vC(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 Hl=Do;Do.default=Do;RC.registerParse(Do);var{isClean:Qe,my:kC}=Er,EC=wh,CC=Go,AC=qt,PC=zl,MC=Th,Ef=Gl,OC=Hl,IC=Cr,TC={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},$C={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},NC={Once:!0,postcssPlugin:!0,prepare:!0},An=0;function lr(e){return typeof e=="object"&&typeof e.then=="function"}function Bh(e){let t=!1,n=TC[e.type];return e.type==="decl"?t=e.prop.toLowerCase():e.type==="atrule"&&(t=e.name.toLowerCase()),t&&e.append?[n,n+"-"+t,An,n+"Exit",n+"Exit-"+t]:t?[n,n+"-"+t,n+"Exit",n+"Exit-"+t]:e.append?[n,An,n+"Exit"]:[n,n+"Exit"]}function Cf(e){let t;return e.type==="document"?t=["Document",An,"DocumentExit"]:e.type==="root"?t=["Root",An,"RootExit"]:t=Bh(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function ll(e){return e[Qe]=!1,e.nodes&&e.nodes.forEach(t=>ll(t)),e}var cl={},Pn=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=ll(n);else if(n instanceof Vh||n instanceof Ef)i=ll(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=OC;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[kC]&&AC.rebuild(i)}this.result=new Ef(t,i,r),this.helpers={...cl,postcss:cl,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(!$C[r]&&/^[A-Z]/.test(r))throw new Error(`Unknown event ${r} in ${n.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!NC[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(lr(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(lr(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 lr(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=CC;t.syntax&&(n=t.syntax.stringify),t.stringifier&&(n=t.stringifier),n.stringify&&(n=n.stringify);let i=new EC(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(lr(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||MC("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(lr(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===An){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===An)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"}};Pn.registerPostcss=e=>{cl=e};var Wh=Pn;Pn.default=Pn;IC.registerLazyResult(Pn);PC.registerLazyResult(Pn);var LC=wh,DC=Go,FC=Th,_C=Hl,jC=Gl,ul=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=DC;this.result=new jC(this._processor,i,this._opts),this.result.css=n;let s=this;Object.defineProperty(this.result,"root",{get(){return s.root}});let a=new LC(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||FC("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=_C;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"}},BC=ul;ul.default=ul;var VC=BC,WC=Wh,UC=zl,zC=Cr,Sr=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 VC(this,t,n):new WC(this,t,n)}use(t){return this.plugins=this.plugins.concat(this.normalize([t])),this}},GC=Sr;Sr.default=Sr;zC.registerProcessor(Sr);UC.registerProcessor(Sr);var qC=Ko,KC=mh,HC=Yo,YC=ql,ZC=Ho,XC=Cr,JC=Kl;function br(e,t){if(Array.isArray(e))return e.map(i=>br(i));let{inputs:n,...r}=e;if(n){t=[];for(let i of n){let o={...i,__proto__:ZC.prototype};o.map&&(o.map={...o.map,__proto__:KC.prototype}),t.push(o)}}if(r.nodes&&(r.nodes=e.nodes.map(i=>br(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 XC(r);if(r.type==="decl")return new qC(r);if(r.type==="rule")return new JC(r);if(r.type==="comment")return new HC(r);if(r.type==="atrule")return new YC(r);throw new Error("Unknown node type: "+e.type)}var QC=br;br.default=br;var eA=Vl,Uh=Ko,tA=Wh,nA=qt,Yl=GC,rA=Go,iA=QC,zh=zl,oA=$h,Gh=Yo,qh=ql,sA=Gl,aA=Ho,lA=Hl,cA=_h,Kh=Kl,Hh=Cr,uA=qo;function F(...e){return e.length===1&&Array.isArray(e[0])&&(e=e[0]),new Yl(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 Yl().version,a}let o;return Object.defineProperty(i,"postcss",{get(){return o||(o=i()),o}}),i.process=function(s,a,l){return F([i(l)]).process(s,a)},i};F.stringify=rA;F.parse=lA;F.fromJSON=iA;F.list=cA;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=eA;F.Declaration=Uh;F.Container=nA;F.Processor=Yl;F.Document=zh;F.Comment=Gh;F.Warning=oA;F.AtRule=qh;F.Result=sA;F.Input=aA;F.Rule=Kh;F.Root=Hh;F.Node=uA;tA.registerPostcss(F);var dA=F;F.default=F;var H=RE(dA);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 pA=Object.defineProperty,fA=(e,t,n)=>t in e?pA(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Te=(e,t,n)=>fA(e,typeof t!="symbol"?t+"":t,n);function hA(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function mA(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 Zl={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}};Zl.exports=Yh();Zl.exports.createColors=Yh;var yA=Zl.exports,gA={},SA=Object.freeze(Object.defineProperty({__proto__:null,default:gA},Symbol.toStringTag,{value:"Module"})),je=mA(SA),Af=yA,Pf=je,dl=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}},Xl=dl;dl.default=dl;var Ar={};Ar.isClean=Symbol("isClean");Ar.my=Symbol("my");var Mf={after:`
40
+ `,beforeClose:`
41
+ `,beforeComment:`
42
+ `,beforeDecl:`
43
+ `,beforeOpen:" ",beforeRule:`
44
+ `,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function bA(e){return e[0].toUpperCase()+e.slice(1)}var pl=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"+bA(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=pl;pl.default=pl;var wA=Xh;function fl(e,t){new wA(t).stringify(e)}var Zo=fl;fl.default=fl;var{isClean:co,my:RA}=Ar,vA=Xl,xA=Xh,kA=Zo;function hl(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=>hl(s,n)):(o==="object"&&i!==null&&(i=hl(i)),n[r]=i)}return n}var ml=class{constructor(t={}){this.raws={},this[co]=!1,this[RA]=!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=hl(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 vA(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[co]){this[co]=!1;let t=this;for(;t=t.parent;)t[co]=!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 xA().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=kA){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}},Xo=ml;ml.default=ml;var EA=Xo,yl=class extends EA{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]==="$"}},Jo=yl;yl.default=yl;var CA="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",AA=(e,t=21)=>(n=t)=>{let r="",i=n;for(;i--;)r+=e[Math.random()*e.length|0];return r},PA=(e=21)=>{let t="",n=e;for(;n--;)t+=CA[Math.random()*64|0];return t},MA={nanoid:PA,customAlphabet:AA},{SourceMapConsumer:Of,SourceMapGenerator:If}=je,{existsSync:OA,readFileSync:IA}=je,{dirname:Va,join:TA}=je;function $A(e){return Buffer?Buffer.from(e,"base64").toString():window.atob(e)}var gl=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=Va(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 $A(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=Va(t),OA(t))return this.mapFile=t,IA(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=TA(Va(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=gl;gl.default=gl;var{SourceMapConsumer:NA,SourceMapGenerator:LA}=je,{fileURLToPath:Tf,pathToFileURL:uo}=je,{isAbsolute:Sl,resolve:bl}=je,{nanoid:DA}=MA,Wa=je,$f=Xl,FA=Jh,Ua=Symbol("fromOffsetCache"),_A=!!(NA&&LA),Nf=!!(bl&&Sl),Fo=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)||Sl(n.from)?this.file=n.from:this.file=bl(n.from)),Nf&&_A){let r=new FA(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 "+DA(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&&(uo&&(o.input.url=uo(this.file).toString()),o.input.file=this.file),o}fromOffset(t){let n,r;if(this[Ua])r=this[Ua];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[Ua]=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:bl(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;Sl(s.source)?l=uo(s.source):l=new URL(s.source,this.map.consumer().sourceRoot||uo(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}},Qo=Fo;Fo.default=Fo;Wa&&Wa.registerInput&&Wa.registerInput(Fo);var{SourceMapConsumer:Qh,SourceMapGenerator:ko}=je,{dirname:Eo,relative:em,resolve:tm,sep:nm}=je,{pathToFileURL:Lf}=je,jA=Qo,BA=!!(Qh&&ko),VA=!!(Eo&&tm&&em&&nm),WA=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||Eo(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(),VA&&BA&&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(`
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?Eo(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(r=Eo(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 jA(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=WA,UA=Xo,wl=class extends UA{constructor(t){super(t),this.type="comment"}},es=wl;wl.default=wl;var{isClean:im,my:om}=Ar,sm=Jo,am=es,zA=Xo,lm,Jl,Ql,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 mt=class pm extends zA{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 Jl(t)];else if(t.name)t=[new Ql(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]}};mt.registerParse=e=>{lm=e};mt.registerRule=e=>{Jl=e};mt.registerAtRule=e=>{Ql=e};mt.registerRoot=e=>{cm=e};var Kt=mt;mt.default=mt;mt.rebuild=e=>{e.type==="atrule"?Object.setPrototypeOf(e,Ql.prototype):e.type==="rule"?Object.setPrototypeOf(e,Jl.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=>{mt.rebuild(t)})};var GA=Kt,fm,hm,wr=class extends GA{constructor(t){super({type:"document",...t}),this.nodes||(this.nodes=[])}toResult(t={}){return new fm(new hm,this,t).stringify()}};wr.registerLazyResult=e=>{fm=e};wr.registerProcessor=e=>{hm=e};var ec=wr;wr.default=wr;var Df={},mm=function(t){Df[t]||(Df[t]=!0,typeof console<"u"&&console.warn&&console.warn(t))},Rl=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=Rl;Rl.default=Rl;var qA=ym,vl=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 qA(t,n);return this.messages.push(r),r}warnings(){return this.messages.filter(t=>t.type==="warning")}get content(){return this.css}},tc=vl;vl.default=vl;var za=39,Ff=34,po=92,_f=47,fo=10,cr=32,ho=12,mo=9,yo=13,KA=91,HA=93,YA=40,ZA=41,XA=123,JA=125,QA=59,eP=42,tP=58,nP=64,go=/[\t\n\f\r "#'()/;[\\\]{}]/g,So=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,rP=/.[\r\n"'(/\\]/,jf=/[\da-f]/i,iP=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 fo:case cr:case mo:case yo:case ho:{s=h;do s+=1,o=r.charCodeAt(s);while(o===cr||o===fo||o===mo||o===yo||o===ho);y=["space",r.slice(h,s)],h=s-1;break}case KA:case HA:case XA:case JA:case tP:case QA:case ZA:{let ne=String.fromCharCode(o);y=[ne,ne,h];break}case YA:{if(p=w.length?w.pop()[1]:"",m=r.charCodeAt(h+1),p==="url"&&m!==za&&m!==Ff&&m!==cr&&m!==fo&&m!==mo&&m!==ho&&m!==yo){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)===po;)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||rP.test(l)?y=["(","(",h]:(y=["brackets",l,h,s],h=s);break}case za:case Ff:{a=o===za?"'":'"',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)===po;)d-=1,u=!u}while(u);y=["string",r.slice(h,s+1),h,s],h=s;break}case nP:{go.lastIndex=h+1,go.test(r),go.lastIndex===0?s=r.length-1:s=go.lastIndex-2,y=["at-word",r.slice(h,s+1),h,s],h=s;break}case po:{for(s=h,c=!0;r.charCodeAt(s+1)===po;)s+=1,c=!c;if(o=r.charCodeAt(s+1),c&&o!==_f&&o!==cr&&o!==fo&&o!==mo&&o!==yo&&o!==ho&&(s+=1,jf.test(r.charAt(s)))){for(;jf.test(r.charAt(s+1));)s+=1;r.charCodeAt(s+1)===cr&&(s+=1)}y=["word",r.slice(h,s+1),h,s],h=s;break}default:{o===_f&&r.charCodeAt(h+1)===eP?(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):(So.lastIndex=h+1,So.test(r),So.lastIndex===0?s=r.length-1:s=So.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=Kt,_o=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)}},nc=_o;_o.default=_o;gm.registerAtRule(_o);var Sm=Kt,bm,wm,Mn=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()}};Mn.registerLazyResult=e=>{bm=e};Mn.registerProcessor=e=>{wm=e};var Pr=Mn;Mn.default=Mn;Sm.registerRoot(Mn);var Rr={comma(e){return Rr.split(e,[","],!0)},space(e){let t=[" ",`
57
+ `," "];return Rr.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=Rr;Rr.default=Rr;var vm=Kt,oP=Rm,jo=class extends vm{constructor(t){super(t),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return oP.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)}},rc=jo;jo.default=jo;vm.registerRule(jo);var sP=Jo,aP=iP,lP=es,cP=nc,uP=Pr,Bf=rc,Vf={empty:!0,space:!0};function dP(e){for(let t=e.length-1;t>=0;t--){let n=e[t],r=n[3]||n[2];if(r)return r}}var pP=class{constructor(t){this.input=t,this.root=new uP,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 cP;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 lP;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=aP(this.input)}decl(t,n){let r=new sP;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]||dP(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})}},fP=pP,hP=Kt,mP=fP,yP=Qo;function Bo(e,t){let n=new yP(e,t),r=new mP(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 ic=Bo;Bo.default=Bo;hP.registerParse(Bo);var{isClean:et,my:gP}=Ar,SP=rm,bP=Zo,wP=Kt,RP=ec,vP=mm,Wf=tc,xP=ic,kP=Pr,EP={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},CP={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},AP={Once:!0,postcssPlugin:!0,prepare:!0},On=0;function ur(e){return typeof e=="object"&&typeof e.then=="function"}function xm(e){let t=!1,n=EP[e.type];return e.type==="decl"?t=e.prop.toLowerCase():e.type==="atrule"&&(t=e.name.toLowerCase()),t&&e.append?[n,n+"-"+t,On,n+"Exit",n+"Exit-"+t]:t?[n,n+"-"+t,n+"Exit",n+"Exit-"+t]:e.append?[n,On,n+"Exit"]:[n,n+"Exit"]}function Uf(e){let t;return e.type==="document"?t=["Document",On,"DocumentExit"]:e.type==="root"?t=["Root",On,"RootExit"]:t=xm(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function xl(e){return e[et]=!1,e.nodes&&e.nodes.forEach(t=>xl(t)),e}var kl={},In=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=xl(n);else if(n instanceof km||n instanceof Wf)i=xl(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=xP;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[gP]&&wP.rebuild(i)}this.result=new Wf(t,i,r),this.helpers={...kl,postcss:kl,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(!CP[r]&&/^[A-Z]/.test(r))throw new Error(`Unknown event ${r} in ${n.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!AP[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(ur(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(ur(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 ur(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=bP;t.syntax&&(n=t.syntax.stringify),t.stringifier&&(n=t.stringifier),n.stringify&&(n=n.stringify);let i=new SP(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(ur(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||vP("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(ur(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===On){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===On)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"}};In.registerPostcss=e=>{kl=e};var Em=In;In.default=In;kP.registerLazyResult(In);RP.registerLazyResult(In);var PP=rm,MP=Zo,OP=mm,IP=ic,TP=tc,El=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=MP;this.result=new TP(this._processor,i,this._opts),this.result.css=n;let s=this;Object.defineProperty(this.result,"root",{get(){return s.root}});let a=new PP(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||OP("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=IP;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"}},$P=El;El.default=El;var NP=$P,LP=Em,DP=ec,FP=Pr,vr=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 NP(this,t,n):new LP(this,t,n)}use(t){return this.plugins=this.plugins.concat(this.normalize([t])),this}},_P=vr;vr.default=vr;FP.registerProcessor(vr);DP.registerProcessor(vr);var jP=Jo,BP=Jh,VP=es,WP=nc,UP=Qo,zP=Pr,GP=rc;function xr(e,t){if(Array.isArray(e))return e.map(i=>xr(i));let{inputs:n,...r}=e;if(n){t=[];for(let i of n){let o={...i,__proto__:UP.prototype};o.map&&(o.map={...o.map,__proto__:BP.prototype}),t.push(o)}}if(r.nodes&&(r.nodes=e.nodes.map(i=>xr(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 zP(r);if(r.type==="decl")return new jP(r);if(r.type==="rule")return new GP(r);if(r.type==="comment")return new VP(r);if(r.type==="atrule")return new WP(r);throw new Error("Unknown node type: "+e.type)}var qP=xr;xr.default=xr;var KP=Xl,Cm=Jo,HP=Em,YP=Kt,oc=_P,ZP=Zo,XP=qP,Am=ec,JP=ym,Pm=es,Mm=nc,QP=tc,eM=Qo,tM=ic,nM=Rm,Om=rc,Im=Pr,rM=Xo;function _(...e){return e.length===1&&Array.isArray(e[0])&&(e=e[0]),new oc(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 oc().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=ZP;_.parse=tM;_.fromJSON=XP;_.list=nM;_.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=KP;_.Declaration=Cm;_.Container=YP;_.Processor=oc;_.Document=Am;_.Comment=Pm;_.Warning=JP;_.AtRule=Mm;_.Result=QP;_.Input=eM;_.Rule=Om;_.Root=Im;_.Node=rM;HP.registerPostcss(_);var iM=_;_.default=_;var Y=hA(iM);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 Cl=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"]},bo={},oM=()=>!!globalThis.Zone;function sc(e){if(bo[e])return bo[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&&!oM())return bo[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?bo[e]=c:n}catch{return n}}var Ga={};function gt(e,t,n){var r;let i=`${e}.${String(n)}`;if(Ga[i])return Ga[i].call(t);let o=sc(e),s=(r=Object.getOwnPropertyDescriptor(o,n))==null?void 0:r.get;return s?(Ga[i]=s,s.call(t)):t[n]}var qa={};function Tm(e,t,n){let r=`${e}.${String(n)}`;if(qa[r])return qa[r].bind(t);let o=sc(e)[n];return typeof o!="function"?t[n]:(qa[r]=o,o.bind(t))}function sM(e){return gt("Node",e,"ownerDocument")}function aM(e){return gt("Node",e,"childNodes")}function lM(e){return gt("Node",e,"parentNode")}function cM(e){return gt("Node",e,"parentElement")}function uM(e){return gt("Node",e,"textContent")}function dM(e,t){return Tm("Node",e,"contains")(t)}function pM(e){return Tm("Node",e,"getRootNode")()}function fM(e){return!e||!("host"in e)?null:gt("ShadowRoot",e,"host")}function hM(e){return e.styleSheets}function mM(e){return!e||!("shadowRoot"in e)?null:gt("Element",e,"shadowRoot")}function yM(e,t){return gt("Element",e,"querySelector")(t)}function gM(e,t){return gt("Element",e,"querySelectorAll")(t)}function $m(){return sc("MutationObserver").constructor}function Ht(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:sM,childNodes:aM,parentNode:lM,parentElement:cM,textContent:uM,contains:dM,getRootNode:pM,host:fM,styleSheets:hM,shadowRoot:mM,querySelector:yM,querySelectorAll:gM,mutationObserver:$m,patch:Ht};function Se(e,t,n=document){let r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}var Rn=`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(Rn),-1},getNode(){return console.error(Rn),null},removeNodeFromMap(){console.error(Rn)},has(){return console.error(Rn),!1},reset(){console.error(Rn)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(qf=new Proxy(qf,{get(e,t,n){return t==="map"&&console.error(Rn),Reflect.get(e,t,n)}}));function kr(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 ts(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)}}),()=>ts(e,t,o||{},!0)}var Vo=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(Vo=()=>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(To(i,t,r))return!0}catch{}return!!(n&&(i.matches(n)||r&&i.closest(n)!==null))}function SM(e,t){return t.getId(e)!==-1}function Ka(e,t,n){return e.tagName==="TITLE"&&n.headTitleMutations?!0:t.getId(e)===mr}function _m(e,t){if(pr(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 Al(e){return!!e.changedTouches}function bM(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 Pl(e){return e?e instanceof Cl&&"shadowRoot"in e?!!e.shadowRoot:!!k.shadowRoot(e):!1}var Ml=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 wM(e){let t=e,n;for(;n=Vm(t);)t=n;return t}function RM(e){let t=k.ownerDocument(e);if(!t)return!1;let n=wM(e);return k.contains(t,n)}function Wm(e){let t=k.ownerDocument(e);return t?k.contains(t,e)||RM(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||{}),ft=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(ft||{}),Tn=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(Tn||{}),vn=(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))(vn||{});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 Ol=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}`,Il=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 Ol,i=l=>{let c=l,u=mr;for(;u===mr;)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=pr(c)?this.mirror.getId(Vm(l)):this.mirror.getId(c),p=i(l);if(d===-1||p===-1)return r.addNode(l);let m=kn(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),Pl(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=Mo({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:Oo(t),value:r,maskInputFn:this.maskInputFn})}),b(this,"processMutation",t=>{if(!Ka(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=Oo(n);i=Mo({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,Gt(n.tagName),Gt(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=pr(t.target)?this.mirror.getId(k.host(t.target)):this.mirror.getId(t.target);be(t.target,this.blockClass,this.blockSelector,!1)||Ka(n,this.mirror,this.slimDOMOptions)||!SM(n,this.mirror)||(this.addedSet.has(n)?(Tl(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)]?Tl(this.movedSet,n):(this.removes.push({parentId:i,id:r,isShadow:pr(t.target)&&fr(t.target)?!0:void 0}),vM(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(Ka(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)),Pl(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 Tl(e,t){e.delete(t),k.childNodes(t).forEach(n=>Tl(e,n))}function vM(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:xM(e,t)}function xM(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 hr;function kM(e){hr=e}function EM(){hr=void 0}var O=e=>hr?(...n)=>{try{return e(...n)}catch(r){if(hr&&hr(r)===!0)return;throw r}}:e,zt=[];function Mr(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 Il;zt.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 CM({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=kr(O(d=>{let p=Date.now()-a;e(s.map(m=>(m.timeOffset-=p,m)),d),s=[],a=null}),o),c=O(kr(O(d=>{let p=Mr(d),{clientX:m,clientY:y}=Al(d)?d.changedTouches[0]:d;a||(a=Vo()),s.push({x:m,y,id:r.getId(p),timeOffset:Vo()-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 AM({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=Mr(d);if(be(p,r,i,!0))return;let m=null,y=u;if("pointerType"in d){switch(d.pointerType){case"mouse":m=ft.Mouse;break;case"touch":m=ft.Touch;break;case"pen":m=ft.Pen;break}m===ft.Touch?ve[u]===ve.MouseDown?y="TouchStart":ve[u]===ve.MouseUp&&(y="TouchEnd"):ft.Pen}else Al(d)&&(m=ft.Touch);m!==null?(l=m,(y.startsWith("Touch")&&m===ft.Touch||y.startsWith("Mouse")&&m===ft.Mouse)&&(m=null)):ve[u]===ve.Click&&(m=l,l=null);let f=Al(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=Gt(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(kr(O(a=>{let l=Mr(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 PM({viewportResizeCb:e},{win:t}){let n=-1,r=-1,i=O(kr(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 MM=["INPUT","TEXTAREA","SELECT"],Xf=new WeakMap;function OM({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=Mr(v),x=v.isTrusted,T=g&&g.tagName;if(g&&T==="OPTION"&&(g=k.parentElement(g)),!g||!T||MM.indexOf(T)<0||be(g,r,i,!0)||g.classList.contains(o)||s&&g.matches(s))return;let j=g.value,te=!1,V=Oo(g)||"";V==="radio"||V==="checkbox"?te=g.checked:(a[T.toLowerCase()]||a[V])&&(j=Mo({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=>ts(v[0],v[1],{set(){O(d)({target:this,isTrusted:!1})}},!1,f))),O(()=>{y.forEach(v=>v())})}function Wo(e){let t=[];function n(r,i){if(wo("CSSGroupingRule")&&r.parentRule instanceof CSSGroupingRule||wo("CSSMediaRule")&&r.parentRule instanceof CSSMediaRule||wo("CSSSupportsRule")&&r.parentRule instanceof CSSSupportsRule||wo("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 Pt(e,t,n){let r,i;return e?(e.ownerNode?r=t.getId(e.ownerNode):i=n.getId(e),{styleId:i,id:r}):{}}function IM({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}=Pt(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}=Pt(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}=Pt(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}=Pt(d,t,n.styleMirror);return(y&&y!==-1||f&&f!==-1)&&e({id:y,styleId:f,replaceSync:m}),u.apply(d,p)})}));let l={};Ro("CSSGroupingRule")?l.CSSGroupingRule=r.CSSGroupingRule:(Ro("CSSMediaRule")&&(l.CSSMediaRule=r.CSSMediaRule),Ro("CSSConditionRule")&&(l.CSSConditionRule=r.CSSConditionRule),Ro("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}=Pt(m.parentStyleSheet,t,n.styleMirror);return(w&&w!==-1||v&&v!==-1)&&e({id:w,styleId:v,adds:[{rule:f,index:[...Wo(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}=Pt(m.parentStyleSheet,t,n.styleMirror);return(h&&h!==-1||w&&w!==-1)&&e({id:h,styleId:w,removes:[{index:[...Wo(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 TM({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}=Pt((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:Wo(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}=Pt((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:Wo(l.parentRule)}),a.apply(l,c)})}),O(()=>{i.CSSStyleDeclaration.prototype.setProperty=o,i.CSSStyleDeclaration.prototype.removeProperty=s})}function $M({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:r,sampling:i,doc:o}){let s=O(l=>kr(O(c=>{let u=Mr(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(vn.Play),o),Se("pause",s(vn.Pause),o),Se("seeked",s(vn.Seeked),o),Se("volumechange",s(vn.VolumeChange),o),Se("ratechange",s(vn.RateChange),o)];return O(()=>{a.forEach(l=>l())})}function NM({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=Ht(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 LM(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 DM({doc:e,customElementCb:t}){let n=e.defaultView;return!n||!n.customElements?()=>{}:Ht(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 FM(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 _M(e,t={}){let n=e.doc.defaultView;if(!n)return()=>{};FM(e,t);let r;e.recordDOM&&(r=Gm(e,e.doc));let i=CM(e),o=AM(e),s=qm(e),a=PM(e,{win:n}),l=OM(e),c=$M(e),u=()=>{},d=()=>{},p=()=>{},m=()=>{};e.recordDOM&&(u=IM(e,{win:n}),d=Km(e,e.doc),p=TM(e,{win:n}),e.collectFonts&&(m=NM(e)));let y=LM(e),f=DM(e),h=[];for(let w of e.plugins)h.push(w.observer(w.callback,n,w.options));return O(()=>{zt.forEach(w=>w.reset()),r?.disconnect(),i(),o(),s(),a(),l(),c(),u(),d(),p(),m(),y(),f(),h.forEach(w=>w())})}function wo(e){return typeof window[e]<"u"}function Ro(e){return!!(typeof window[e]<"u"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}var Uo=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}},$l=class{constructor(t){b(this,"iframes",new WeakMap),b(this,"crossOriginIframeMap",new WeakMap),b(this,"crossOriginIframeMirror",new Uo(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 Uo(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)})}},Nl=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(!fr(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(Ht(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}},En="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",jM=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(dr=0;dr<En.length;dr++)jM[En.charCodeAt(dr)]=dr;var dr,BM=function(e){var t=new Uint8Array(e),n,r=t.length,i="";for(n=0;n<r;n+=3)i+=En[t[n]>>2],i+=En[(t[n]&3)<<4|t[n+1]>>4],i+=En[(t[n+1]&15)<<2|t[n+2]>>6],i+=En[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 VM(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=VM(n,r),o=i.indexOf(e);return o===-1&&(o=i.length,i.push(e)),o};function Co(e,t,n){if(e instanceof Array)return e.map(r=>Co(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=BM(e);return{rr_type:r,base64:i}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[Co(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:[Co(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=>Co(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 WM(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=Ht(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:Tn["2D"],property:s,args:u})},0),l.apply(this,c)}});i.push(a)}catch{let a=ts(t.CanvasRenderingContext2D.prototype,s,{set(l){e(this.canvas,{type:Tn["2D"],property:s,args:[l],setter:!0})}});i.push(a)}return()=>{i.forEach(s=>s())}}function UM(e){return e==="experimental-webgl"?"webgl":e}function Qf(e,t,n,r){let i=[];try{let o=Ht(e.HTMLCanvasElement.prototype,"getContext",function(s){return function(a,...l){if(!be(this,t,n,!0)){let c=UM(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=Ht(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=ts(e,l,{set(u){n(this.canvas,{type:t,property:l,args:[u],setter:!0})}});s.push(c)}return s}function zM(e,t,n,r){let i=[];return i.push(...eh(t.WebGLRenderingContext.prototype,Tn.WebGL,e,n,r,t)),typeof t.WebGL2RenderingContext<"u"&&i.push(...eh(t.WebGL2RenderingContext.prototype,Tn.WebGL2,e,n,r,t)),()=>{i.forEach(o=>o())}}var Xm="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",GM=e=>Uint8Array.from(atob(e),t=>t.charCodeAt(0)),th=typeof window<"u"&&window.Blob&&new Blob([GM(Xm)],{type:"text/javascript;charset=utf-8"});function qM(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 Ll=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 qM;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:Tn["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=WM(this.processMutation.bind(this),t,n,r),s=zM(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)}},Dl=class{constructor(t){b(this,"trackedLinkElements",new WeakSet),b(this,"mutationCb"),b(this,"adoptedStyleSheetCb"),b(this,"styleMirror",new Ml),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){}},Fl=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,Ao,Ha,zo=!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=Yk();function Yt(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:Ln=new Set([]),errorHandler:Dn}=e;kM(Dn);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 Mt=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);bM();let dc,rs=0,pc=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=Vo(),(Z=zt[0])!=null&&Z.isFrozen()&&X.type!==P.FullSnapshot&&!(X.type===P.IncrementalSnapshot&&X.data.source===E.Mutation)&&zt.forEach(xe=>xe.unfreeze()),ie)t?.(pc(X),$e);else if(Ie){let xe={type:"rrweb",event:pc(X),origin:window.location.origin,isCheckout:$e};window.parent.postMessage(xe,"*")}if(X.type===P.FullSnapshot)dc=X,rs=0;else if(X.type===P.IncrementalSnapshot){if(X.data.source===E.Mutation&&X.data.isAttachIframe)return;rs++;let xe=r&&rs>=r,B=n&&X.timestamp-dc.timestamp>n;(xe||B)&&Ao(!0)}};let Tr=N=>{ee({type:P.IncrementalSnapshot,data:{source:E.Mutation,...N}})},fc=N=>ee({type:P.IncrementalSnapshot,data:{source:E.Scroll,...N}}),hc=N=>ee({type:P.IncrementalSnapshot,data:{source:E.CanvasMutation,...N}}),yy=N=>ee({type:P.IncrementalSnapshot,data:{source:E.AdoptedStyleSheet,...N}}),Ot=new Dl({mutationCb:Tr,adoptedStyleSheetCb:yy}),It=new $l({mirror:Fe,mutationCb:Tr,stylesheetManager:Ot,recordCrossOriginIframes:te,wrappedEmit:ee});for(let N of Ve||[])N.getMirror&&N.getMirror({nodeMirror:Fe,crossOriginIframeMirror:It.crossOriginIframeMirror,crossOriginIframeStyleMirror:It.crossOriginIframeStyleMirror});let is=new Fl;Ha=new Ll({recordCanvas:j,mutationCb:hc,win:window,blockClass:i,blockSelector:o,mirror:Fe,sampling:v.canvas,dataURLOptions:g});let $r=new Nl({mutationCb:Tr,scrollCb:fc,bypassOptions:{blockClass:i,blockSelector:o,maskTextClass:l,maskTextSelector:c,inlineStylesheet:u,maskInputOptions:Mt,dataURLOptions:g,maskTextFn:f,maskInputFn:y,recordCanvas:j,inlineImages:fe,sampling:v,slimDOMOptions:We,iframeManager:It,stylesheetManager:Ot,canvasManager:Ha,keepIframeSrcFn:$,processedNodeManager:is},mirror:Fe});Ao=(N=!1)=>{if(!T)return;ee({type:P.Meta,data:{href:window.location.href,width:Dm(),height:Lm()}},N),Ot.reset(),$r.init(),zt.forEach(Z=>Z.lock());let $e=bE(document,{mirror:Fe,blockClass:i,blockSelector:o,maskTextClass:l,maskTextSelector:c,inlineStylesheet:u,maskAllInputs:Mt,maskTextFn:f,maskInputFn:y,slimDOM:We,dataURLOptions:g,recordCanvas:j,inlineImages:fe,onSerialize:Z=>{jm(Z,Fe)&&It.addIframe(Z),Bm(Z,Fe)&&Ot.trackLinkElement(Z),Pl(Z)&&$r.addShadowRoot(k.shadowRoot(Z),document)},onIframeLoad:(Z,X)=>{It.attachIframe(Z,X),$r.observeAttachShadow(Z)},onStylesheetLoad:(Z,X)=>{Ot.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),zt.forEach(Z=>Z.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&Ot.adoptStyleSheets(document.adoptedStyleSheets,Fe.getId(document))};try{let N=[],$e=X=>{var xe;return O(_M)({mutationCb:Tr,mousemoveCb:(B,os)=>ee({type:P.IncrementalSnapshot,data:{source:os,positions:B}}),mouseInteractionCb:B=>ee({type:P.IncrementalSnapshot,data:{source:E.MouseInteraction,...B}}),scrollCb:fc,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:hc,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:Mt,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:It,stylesheetManager:Ot,shadowDomManager:$r,processedNodeManager:is,canvasManager:Ha,ignoreCSSAttributes:Ln,plugins:((xe=Ve?.filter(B=>B.observer))==null?void 0:xe.map(B=>({observer:B.observer,options:B.options,callback:os=>ee({type:P.Plugin,data:{plugin:B.name,payload:os}})})))||[]},h)};It.addLoadListener(X=>{try{N.push($e(X.contentDocument))}catch(xe){console.warn(xe)}});let Z=()=>{Ao(),N.push($e(document)),zo=!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)}}),is.destroy(),zo=!1,EM()}}catch(N){console.warn(N)}}Yt.addCustomEvent=(e,t)=>{if(!zo)throw new Error("please add custom event after start recording");ee({type:P.Custom,data:{tag:e,payload:t}})};Yt.freezePage=()=>{zt.forEach(e=>e.freeze())};Yt.takeFullSnapshot=e=>{if(!zo)throw new Error("please take full snapshot after start recording");Ao(e)};Yt.mirror=Fe;var nh;(function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"})(nh||(nh={}));var AF=5*1e3;var{addCustomEvent:PF}=Yt,{freezePage:MF}=Yt,{takeFullSnapshot:OF}=Yt;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 HM=Na("@ripplo/rrweb-bundle/bundle","rrweb.js"),Qm;function ny(){return Qm??=KM(HM,{encoding:"utf8"}),Qm}async function Or({clientVersion:e,debugDir:t,writeOtlpPortFile:n}){let r=new Map,i=Qp(ty()),o=await Sa({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=Jp({debugDir:t,runId:c,worker:i});u.emit({clientVersion:e,kind:"meta",source:"capture",timeNanos:"0"}),r.set(c,u),await tf(l,c),await l.addInitScript(`globalThis.__ripploCapturePort = ${String(o.port)};`),await ZM(l,u),await QM(l,u);let d=[];return{emitAction:p=>{nO(u,p)},emitAssertion:p=>{rO(u,p)},finish:()=>eO(u,{pages:d,registry:r,runId:c}),onPage:p=>{d.push(p),tO(u,s,p)}}},debugDir:t,close:async()=>{await o.stop(),await i.terminate()},injectSpan:(l,c)=>{r.get(l)?.emit(c)}}}async function YM(e){await Promise.all(e.map(t=>t.evaluate("globalThis.__ripploFlushRrweb ? globalThis.__ripploFlushRrweb() : undefined").catch(()=>{})))}async function ZM(e,t){await e.exposeBinding(ey,(n,r)=>{let i=typeof r=="string"?r:JSON.stringify(r);t.emitRrwebBatch(Buffer.from(i,"utf8"))})}var XM="__ripploEventPush",JM=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 QM(e,t){await e.exposeBinding(XM,(n,r)=>{let i=JM.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:bn(o.timestamp)});return}t.emit({kind:"error",message:o.message,source:"browser",stack:o.stack,timeNanos:bn(o.timestamp)})})}async function eO(e,t){await YM(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 tO(e,t,n){n.on("load",()=>{n.addScriptTag({content:t}).catch(()=>{})}),n.on("requestfinished",r=>{aO(e,r).catch(()=>{})}),n.url()!=="about:blank"&&n.addScriptTag({content:t}).catch(()=>{})}function nO(e,t){e.emit({action:t.kind,kind:"action",source:"test",target:iO(t),timeNanos:bn(Date.now()),value:oO(t)})}function rO(e,t){let n=vi(t);e.emit({kind:"assertion",label:n.label,outcome:t.outcome,source:"test",step:n.step,timeNanos:bn(Date.now()),wait:t.waitBudget,waitMs:t.waitMs})}function iO(e){if(e.url!=null)return e.url;if(e.locator!=null)return ns(e.locator)}function ns(e){return e.by==="testId"?`testId=${e.value}`:e.by==="inside"?`${ns(e.scope)} \u25B8 ${ns(e.target)}`:e.by==="surface"?ns(e.container):`${e.role} ${e.name??""}`.trim()}function oO(e){return e.value!=null?typeof e.value=="object"?JSON.stringify(e.value):String(e.value):e.key}var sO=/^http:\/\/127\.0\.0\.1:\d+\/rrweb\//;async function aO(e,t){if(sO.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 lO(n):void 0,source:"browser",spanId:s?.[2],status:n.status(),timeNanos:bn(a>0?a:Date.now()),traceId:s?.[1],url:n.url()})}async function lO(e){try{return await e.text()}catch{return}}function Ir(e){return{aborted:!0,findings:[],ran:[],teardown:e}}function lc(e,t){return new ac(wO(e,t))}function dO(e,t){return new ac(pO(e,t))}async function pO(e,t){let n=await Gp(e.profileDir).catch(()=>{});if(n==null)return Zt(Ue(new Error("launch")));try{return $n(await fO({context:n,params:e,signal:t}))}catch(r){return Zt(Ue(r))}finally{await n.close().catch(ze)}}async function fO({context:e,params:t,signal:n}){let r=e.pages()[0]??await e.newPage(),i=await Or({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 hO(e,n),await o.finish(),await i.close(),{behaviorPath:cO.join(t.debugDir,t.runId,"behavior.jsonl")}}function hO(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 mO(e,t){return new ac(yO(e,t))}async function yO(e,t){let n=gO(e),r=ay({lockfile:e.lockfile,options:e.options,runId:e.runId,signal:t}),i=async o=>{try{return $n(await SO({established:o,params:e,signal:t}))}catch(s){return await o.teardown().match(ze,ze),Zt(Br(s)?s:Ue(s))}};return sy(r,n).match(i,async o=>(await cc(r.teardown),Zt(o)))}function gO(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 SO({established:e,params:t,signal:n}){let r=Xi({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 bO(i,s.context),await e.teardown().match(ze,ze),await r.close(),{kind:"handed-over",ran:o.ran.length}}function bO(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 wO({browser:e,hub:t,request:n},r){if(r.aborted)return $n(Ir("skipped"));let i=ay({lockfile:n.lockfile,options:n.options,runId:n.runId,signal:r}),o=async s=>{try{return await vO({browser:e,established:s,hub:t,request:n,signal:r})}catch(a){return Zt(Br(a)?a:Ue(a))}};return sy(i,n).match(o,s=>RO(s,i.teardown))}async function RO(e,t){return e.kind!=="aborted"?Zt(e):$n(Ir(await cc(t)))}function cc(e){return e().match(()=>"done",()=>"failed")}async function vO(e){let t=await xO(e);if(t.kind==="completed"){let r=Date.now();return e.established.teardown().match(()=>(e.request.onPhase?.("teardown",Date.now()-r),$n({aborted:!1,...t.result})),i=>Zt(i))}let n=await cc(e.established.teardown);if(t.kind==="aborted")return $n(Ir(n));throw t.error}function iy(e,t,n){return Hn(e,t).map(r=>({params:{...Vi(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(CO(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=an(n),a=Date.now(),l=await ji({canon:Ci(n),classify:Ei(n),dataRules:s.dataRules,driver:o.driver,facts:{facts:Ws(s.facts,re(e.test)),overlays:Ze(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 xO({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:zp(r.test.viewport)});return await s.close(),{kind:"completed",result:o}}catch(o){return tr(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 dn(t.lockfile,t.test,{generate:Dr(Lr(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:kO(e.signIn,i.principals),snapshot:i.snapshot,teardown:e.teardown}))})}function kO(e,t){return n=>{let r=t.get(n);return r==null?uO(Ue(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:Li(i.setupWorld),reader:Ia(e.entities,EO(e),i.query),ready:i.ready,signIn:i.signIn,teardown:i.teardown}}function EO(e){return e.singletons.filter(t=>t.source==="backend").map(t=>t.name)}function CO(e){return e.singletons.filter(t=>t.source==="client").map(t=>t.name)}import{err as AO,ok as PO,ResultAsync as MO}from"neverthrow";function OO({cacheDir:e,clientVersion:t,debugDir:n,headed:r,writeOtlpPortFile:i}){let o=Xi({cacheDir:e,headed:r}),s,a,l=async()=>(s??=Or({clientVersion:t,debugDir:n,writeOtlpPortFile:i}),a=await s,a),c=async(p,m)=>{if(m.aborted)return PO(Ir("skipped"));try{let y=await l();if(p.options.headed&&!r)return await Pa(!0,async h=>lc({browser:h,hub:y,request:p},m));let f=await o.acquire();return await lc({browser:f,hub:y,request:p},m)}catch(y){return AO(Ue(y))}};return{close:async()=>{await o.close();let p=s;s=void 0,a=void 0,p!=null&&await p.then(m=>m.close()).catch(()=>{})},prewarm:async()=>{await l(),await o.acquire()},injectSpan:(p,m)=>{a?.injectSpan(p,m)},runOnce:(p,m)=>new MO(c(p,m))}}import{z as C}from"zod";function IO(e){let t=e.split(`
65
+ `).map(i=>KO(i)).filter(i=>i!=null),n=VO(t),r=t.map(i=>LO(i,n)).filter(i=>i!=null).filter(i=>i.kind==="input"||i.element!=null);return TO(r)}function TO(e){return e.filter((t,n)=>{let r=e[n+1];return!(t.kind==="input"&&r?.kind==="input"&&$O(t.element,r.element))})}function $O(e,t){return e?.testId===t?.testId&&e?.ariaLabel===t?.ariaLabel&&e?.placeholder===t?.placeholder}var NO={2:"click",3:"contextmenu",4:"dblclick"};function LO(e,t){return e.rrwebType==="IncrementalSnapshot:MouseInteraction"?DO(e,t):e.rrwebType==="IncrementalSnapshot:Input"?FO(e,t):null}function DO(e,t){let n=QO.safeParse(e.event.data);if(!n.success)return null;let r=NO[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 FO(e,t){let n=eI.safeParse(e.event.data);return n.success?{element:cy(n.data.id,t),kind:"input",timeNanos:e.timeNanos,value:n.data.text??_O(n.data.isChecked)}:null}function _O(e){return e==null?void 0:String(e)}var jO=new Set(["button","a","input","select","textarea","summary"]);function ly(e,t){let n=t.get(e);if(n!=null)return BO(n)?e:n.parentId==null?void 0:ly(n.parentId,t)}function BO(e){return e.attrs["data-testid"]!=null||e.attrs["aria-label"]!=null||e.attrs.role!=null||jO.has(e.tag??"")}function cy(e,t){let n=e==null?void 0:t.nodes.get(e);if(!(n==null||e==null))return{ariaLabel:Nn(n,"aria-label"),href:Nn(n,"href"),name:Nn(n,"name"),placeholder:Nn(n,"placeholder"),role:Nn(n,"role"),tag:n.tag,testId:Nn(n,"data-testid"),text:uy(e,t)}}function Nn(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 VO(e){let t=e.flatMap(i=>WO(i).flatMap(o=>uc(o,void 0))),n=e.flatMap(i=>UO(i).flatMap(o=>uc(o.node,o.parentId??void 0))),r=GO(new Map([...t,...n]),e);return{children:zO(r),nodes:r}}function WO(e){if(e.rrwebType!=="FullSnapshot")return[];let t=ZO.safeParse(e.event.data);return t.success?[t.data.node]:[]}function UO(e){if(e.rrwebType!=="IncrementalSnapshot:Mutation")return[];let t=dy.safeParse(e.event.data);return t.success?t.data.adds.flatMap(n=>{let r=XO.safeParse(n);return r.success?[r.data]:[]}):[]}function zO(e){let t=new Map;return e.forEach((n,r)=>{n.parentId!=null&&t.set(n.parentId,[...t.get(n.parentId)??[],r])}),t}function uc(e,t){let n=YO.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=>uc(s,r.id))]}function GO(e,t){return t.flatMap(r=>qO(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 qO(e){if(e.rrwebType!=="IncrementalSnapshot:Mutation")return[];let t=dy.safeParse(e.event.data);return t.success?t.data.attributes.flatMap(n=>{let r=JO.safeParse(n);return r.success?[r.data]:[]}):[]}function KO(e){if(e.trim().length===0)return null;let t=tI.safeParse(HO(e));return t.success?t.data:null}function HO(e){try{return JSON.parse(e)}catch{return null}}var YO=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()}),ZO=C.object({node:C.unknown()}),XO=C.object({node:C.unknown(),parentId:C.number().nullable().default(null)}),JO=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([])}),QO=C.object({id:C.number(),type:C.number()}),eI=C.object({id:C.number(),isChecked:C.boolean().optional(),text:C.string().optional()}),tI=C.object({event:C.object({data:C.unknown()}),kind:C.literal("rrweb"),rrwebType:C.string(),timeNanos:C.string()});function nI(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 rI(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=cn(n.findings);if(i.length===0)return{kind:"clean",ranCount:n.ranCount,timing:{confirm:void 0,detect:n.timing}};let o=or(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}:iI(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"&&Vr(n.error));return t!=null&&t.kind==="driver-error"?t.error:void 0}async function iI(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=cn(i.findings);return a.length===0||or(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:oI(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:nI(a)},c=>({error:c,kind:"error"}))}function oI(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 qi(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 sI({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=cn(c.findings);return u.length>0?{findings:u,kind:"still-fails"}:{kind:"resolved"}},c=>({kind:"state-unavailable",reason:c.kind}))}export{tn as a,R as b,ct as c,re as d,J as e,Kn as f,Vr as g,Nc as h,_n as i,ri as j,Qt as k,qu as l,kt as m,di as n,rd as o,dd as p,fd as q,sp as r,ap as s,cp as t,up as u,pp as v,le as w,Sd as x,Si as y,jt as z,Bt as A,Vt as B,Xs as C,Q as D,Rd as E,vd as F,xi as G,ta as H,kd as I,Qn as J,pt as K,mp as L,xp as M,Ep as N,Cp as O,Pp as P,qi as Q,Mp as R,Sa as S,dO as T,mO as U,iy as V,OO as W,IO as X,rI as Y,my as Z,sI as _};
66
+ /*! Bundled license information:
67
+
68
+ rrweb/dist/rrweb.js:
69
+ (*! *****************************************************************************
70
+ Copyright (c) Microsoft Corporation.
71
+
72
+ Permission to use, copy, modify, and/or distribute this software for any
73
+ purpose with or without fee is hereby granted.
74
+
75
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
76
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
77
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
78
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
79
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
80
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
81
+ PERFORMANCE OF THIS SOFTWARE.
82
+ ***************************************************************************** *)
83
+ */